(gl_MEMCOLL): Require AC_FUNC_MEMCMP.
[gnulib.git] / MODULES.html.sh
1 #!/bin/sh
2 # Usage: MODULES.html.sh > MODULES.html
3
4 sed_lt='s,<,\&lt;,g'
5 sed_gt='s,>,\&gt;,g'
6 sed_escape_dot='s,\.,\\.,g'
7 sed_escape_slash='s,/,\\/,g'
8 trnl='\012'
9
10 indent=""
11 missed_modules=`gnulib-tool --list`
12 missed_files=`ls lib/* m4/* | sed -e /CVS/d -e /README/d -e /ChangeLog/d -e /Makefile/d -e /TODO/d`
13
14 # func_echo line
15 # outputs line with indentation.
16 func_echo ()
17 {
18   echo "${indent}$*"
19 }
20
21 # func_indent
22 # increases the indentation.
23 func_indent ()
24 {
25   indent="$indent  "
26 }
27
28 # func_unindent
29 # decreases the indentation.
30 func_unindent ()
31 {
32   indent=`echo "$indent" | sed -e 's/  $//'`
33 }
34
35 # func_begin tag [attribute...]
36 # opens a HTML tag.
37 func_begin ()
38 {
39   func_echo "<$*>"
40   func_indent
41 }
42
43 # func_end tag
44 # closes a HTML tag.
45 func_end ()
46 {
47   func_unindent
48   func_echo "</$1>"
49 }
50
51 # func_wrap tag [attribute...]
52 # encloses $element in a HTML tag, without line breaks.
53 func_wrap ()
54 {
55   element="<$*>${element}</$1>"
56 }
57
58 # func_begin_table
59 func_begin_table ()
60 {
61   func_begin TABLE
62   func_begin TR
63   func_echo "<TH ALIGN=LEFT>lib/"
64   func_echo "<TH ALIGN=LEFT>lib/"
65   func_echo "<TH ALIGN=LEFT>m4/"
66   func_echo "<TH ALIGN=LEFT>&nbsp;"
67   func_end TR
68   func_begin TR
69   func_echo "<TH ALIGN=LEFT>Header"
70   func_echo "<TH ALIGN=LEFT>Implementation"
71   func_echo "<TH ALIGN=LEFT>Autoconf macro"
72   func_echo "<TH ALIGN=LEFT>Depends on"
73   func_end TR
74 }
75
76 # func_module module
77 func_module ()
78 {
79   func_begin TR
80
81   element=`gnulib-tool --extract-include-directive $1 | sed -e "$sed_lt" -e "$sed_gt" -e '${/^$/d}' | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
82   test -n "$element" || element='---'
83   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
84
85   sed_choose_unconditional_nonstandard_include='s,^#include "\(.*\)"$,\1,p'
86   includefile=`gnulib-tool --extract-include-directive $1 | sed -n -e "$sed_choose_unconditional_nonstandard_include" | sed -e "$sed_escape_dot" | tr -d "$trnl"`
87   sed_choose_lib_files='s,^lib/\(.*\)$,\1,p'
88   element=`gnulib-tool --extract-filelist $1 | sed -e '/^$/d' | sed -n -e "$sed_choose_lib_files" | sed -e '/^'"${includefile}"'$/d' | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
89   test -n "$element" || element='---'
90   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
91
92   sed_choose_m4_files='s,^m4/\(.*\)$,\1,p'
93   element=`(gnulib-tool --extract-filelist $1 | sed -e '${/^$/d}' | sed -n -e "$sed_choose_m4_files" | sed -e '/^onceonly/d'; gnulib-tool --extract-autoconf-snippet $1 | sed -e '${/^$/d}') | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
94   test -n "$element" || element='---'
95   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
96
97   element=`gnulib-tool --extract-dependencies $1 | sed -e '${/^$/d}' | sed -e 's/$/<BR>/' | tr -d "$trnl" | sed -e 's/<BR>$//'`
98   test -n "$element" || element='---'
99   func_echo "<TD ALIGN=LEFT VALIGN=TOP>$element"
100
101   func_end TR
102
103   missed_modules=`echo "$missed_modules" | sed -e '/^'"$1"'$/d'`
104
105   files=`gnulib-tool --extract-filelist $1`
106   sed_removal_prefix='s,^,/^,'
107   sed_removal_suffix='s,$,\$/d,'
108   sed_remove_files=`echo '{'; for file in $files; do echo $file | sed -e "$sed_escape_dot" -e "$sed_escape_slash" | sed -e "$sed_removal_prefix" -e "$sed_removal_suffix"; done; echo '}'`
109   missed_files=`echo "$missed_files" | sed -e "$sed_remove_files"`
110 }
111
112 # func_end_table
113 func_end_table ()
114 {
115   func_end TABLE
116 }
117
118
119 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">'
120 func_begin HTML
121
122 func_begin HEAD
123
124 element="Gnulib Module List"
125 func_wrap TITLE
126 func_echo "$element"
127
128 modules=`gnulib-tool --list`
129 modules=`for m in $modules; do printf "%s, " $m; done | sed -e 's/, $//'`
130 func_echo '<META NAME="keywords" CONTENT="'"${modules}"'">'
131
132 func_end HEAD
133
134 func_begin BODY
135
136 func_end BODY
137
138 element="Gnulib Module List"
139 func_wrap H1
140 func_echo "$element"
141
142 func_echo 'This is a list of the modules which make up gnulib, with dependencies.'
143
144 element="Support for systems lacking ANSI C 89"
145 func_wrap H2
146 func_echo "$element"
147
148 func_begin_table
149 func_module c-bs-a
150 func_module assert
151 func_module atexit
152 func_module strtod
153 func_module strtol
154 func_module strtoul
155 func_module memchr
156 func_module memcmp
157 func_module memcpy
158 func_module memmove
159 func_module memset
160 func_module strcspn
161 func_module strpbrk
162 func_module strstr
163 func_module strerror
164 func_module mktime
165 func_end_table
166
167 func_echo 'These modules are not listed among dependencies below, for simplicity.'
168
169 element="Enhancements for ANSI C 89 functions"
170 func_wrap H2
171 func_echo "$element"
172
173 element="Memory management functions <stdlib.h>"
174 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
175 func_wrap H3
176 func_echo "$element"
177
178 func_begin_table
179 func_module malloc
180 func_module realloc
181 func_end_table
182
183 element="Date and time <time.h>"
184 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
185 func_wrap H3
186 func_echo "$element"
187
188 func_begin_table
189 func_module strftime
190 func_end_table
191
192 element="Extra functions based on ANSI C 89"
193 func_wrap H2
194 func_echo "$element"
195
196 element="Memory management functions <stdlib.h>"
197 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
198 func_wrap H3
199 func_echo "$element"
200
201 func_begin_table
202 func_module xalloc
203 func_module alloca
204 func_module bumpalloc
205 func_end_table
206
207 element="Integer arithmetic functions <stdlib.h>"
208 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
209 func_wrap H3
210 func_echo "$element"
211
212 func_begin_table
213 func_module gcd
214 func_end_table
215
216 element="Environment variables <stdlib.h>"
217 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
218 func_wrap H3
219 func_echo "$element"
220
221 func_begin_table
222 func_module putenv
223 func_module setenv
224 func_end_table
225
226 element="Character handling <ctype.h>"
227 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
228 func_wrap H3
229 func_echo "$element"
230
231 element="String handling <string.h>"
232 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
233 func_wrap H3
234 func_echo "$element"
235
236 func_begin_table
237 func_module bcopy
238 func_module memrchr
239 func_module stpcpy
240 func_module strcase
241 func_module strdup
242 func_module strnlen
243 func_module strndup
244 func_end_table
245
246 element="Numeric conversion functions <stdlib.h>"
247 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
248 func_wrap H3
249 func_echo "$element"
250
251 func_begin_table
252 func_module xstrtod
253 func_module xstrtol
254 func_end_table
255
256 element="Date and time <time.h>"
257 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
258 func_wrap H3
259 func_echo "$element"
260
261 func_begin_table
262 func_module getdate
263 func_end_table
264
265 element="Input/Output <stdio.h>"
266 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
267 func_wrap H3
268 func_echo "$element"
269
270 func_begin_table
271 func_module unlocked-io
272 func_end_table
273
274 element="Command-line arguments"
275 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
276 func_wrap H3
277 func_echo "$element"
278
279 func_begin_table
280 func_module argmatch
281 func_module version-etc
282 func_module long-options
283 func_end_table
284
285 element="Cryptographic computations"
286 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
287 func_wrap H3
288 func_echo "$element"
289
290 func_begin_table
291 func_module md5
292 func_module sha
293 func_end_table
294
295 element="Misc"
296 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
297 func_wrap H3
298 func_echo "$element"
299
300 func_begin_table
301 func_module diacrit
302 func_module getstr
303 func_module getline
304 func_module linebuffer
305 func_module obstack
306 func_module hash-pjw
307 func_module hash
308 func_module readtokens
309 func_module strverscmp
310 func_end_table
311
312 element="Support for systems lacking ISO C 99"
313 func_wrap H2
314 func_echo "$element"
315
316 element="Boolean type and values <stdbool.h>"
317 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
318 func_wrap H3
319 func_echo "$element"
320
321 func_begin_table
322 func_module stdbool
323 func_end_table
324
325 element="Numeric conversion functions <stdlib.h>"
326 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
327 func_wrap H3
328 func_echo "$element"
329
330 func_begin_table
331 func_module strtoll
332 func_module strtoull
333 func_end_table
334
335 element="Functions for greatest-width integer types <inttypes.h>"
336 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
337 func_wrap H3
338 func_echo "$element"
339
340 func_begin_table
341 func_module strtoimax
342 func_module strtoumax
343 func_end_table
344
345 element="Enhancements for ISO C 99 functions"
346 func_wrap H2
347 func_echo "$element"
348
349 func_begin_table
350 func_end_table
351
352 element="Extra functions based on ISO C 99"
353 func_wrap H2
354 func_echo "$element"
355
356 element="Numeric conversion functions <stdlib.h>"
357 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
358 func_wrap H3
359 func_echo "$element"
360
361 func_begin_table
362 func_module xstrtoimax
363 func_module xstrtoumax
364 func_end_table
365
366 element="Support for systems lacking POSIX:2001"
367 func_wrap H2
368 func_echo "$element"
369
370 func_begin_table
371 func_module chown
372 func_module dup2
373 func_module ftruncate
374 func_module getgroups
375 func_module gettimeofday
376 func_module mkdir
377 func_module mkstemp
378 func_module stat
379 func_module lstat
380 func_module timespec
381 func_module nanosleep
382 func_module regex
383 func_module rename
384 func_module rmdir
385 func_module utime
386 func_end_table
387
388 element="Enhancements for POSIX:2001 functions"
389 func_wrap H2
390 func_echo "$element"
391
392 func_begin_table
393 func_module dirname
394 func_module getopt
395 func_module unistd-safer
396 func_module fnmatch
397 func_module fnmatch-posix
398 func_module fnmatch-gnu
399 func_module exclude
400 func_end_table
401
402 element="Extra functions based on POSIX:2001"
403 func_wrap H2
404 func_echo "$element"
405
406 element="Numeric conversion functions"
407 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
408 func_wrap H3
409 func_echo "$element"
410
411 func_begin_table
412 func_module human
413 func_end_table
414
415 element="File system functions"
416 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
417 func_wrap H3
418 func_echo "$element"
419
420 func_begin_table
421 func_module acl
422 func_module backupfile
423 func_module fsusage
424 func_module dirfd
425 func_module euidaccess
426 func_module file-type
427 func_module fileblocks
428 func_module filemode
429 func_module isdir
430 func_module lchown
431 func_module makepath
432 func_module modechange
433 func_module mountlist
434 func_module path-concat
435 func_module pathmax
436 func_module same
437 func_module save-cwd
438 func_module savedir
439 func_module xgetcwd
440 func_module xreadlink
441 func_end_table
442
443 element="File descriptor based Input/Output"
444 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
445 func_wrap H3
446 func_echo "$element"
447
448 func_begin_table
449 func_module safe-read
450 func_module safe-write
451 func_module full-read
452 func_module full-write
453 func_end_table
454
455 element="File stream based Input/Output"
456 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
457 func_wrap H3
458 func_echo "$element"
459
460 func_begin_table
461 func_module fpending
462 func_module closeout
463 func_module stdio-safer
464 func_module getpass
465 func_end_table
466
467 element="Users and groups"
468 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
469 func_wrap H3
470 func_echo "$element"
471
472 func_begin_table
473 func_module getugroups
474 func_module group-member
475 func_module idcache
476 func_module userspec
477 func_end_table
478
479 element="Date and time"
480 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
481 func_wrap H3
482 func_echo "$element"
483
484 func_begin_table
485 func_module gettime
486 func_module settime
487 func_module posixtm
488 func_end_table
489
490 element="Networking functions"
491 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
492 func_wrap H3
493 func_echo "$element"
494
495 func_begin_table
496 func_module gethostname
497 func_module xgethostname
498 func_module canon-host
499 func_end_table
500
501 element="Internationalization functions"
502 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
503 func_wrap H3
504 func_echo "$element"
505
506 func_begin_table
507 func_module gettext
508 func_module iconv
509 func_module localcharset
510 func_module hard-locale
511 func_module mbswidth
512 func_module memcasecmp
513 func_module memcoll
514 func_module xmemcoll
515 func_module unicodeio
516 func_module rpmatch
517 func_module yesno
518 func_end_table
519
520 element="Executing programs"
521 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
522 func_wrap H3
523 func_echo "$element"
524
525 element="Java"
526 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
527 func_wrap H3
528 func_echo "$element"
529
530 element="Misc"
531 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
532 func_wrap H3
533 func_echo "$element"
534
535 func_begin_table
536 func_module exitfail
537 func_module c-stack
538 func_module error
539 func_module fatal
540 func_module getloadavg
541 func_module getpagesize
542 func_module getusershell
543 func_module physmem
544 func_module posixver
545 func_module quotearg
546 func_module quote
547 func_module readutmp
548 func_module sig2str
549 func_end_table
550
551 if test -n "$missed_modules"; then
552
553   element="Unclassified modules - please update MODULES.html.sh"
554   element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
555   func_wrap H2
556   func_echo "$element"
557
558   func_begin_table
559   for module in $missed_modules; do
560     func_module $module
561   done
562   func_end_table
563
564 fi
565
566 if test -n "$missed_files"; then
567
568   element="Lone files - please create new modules containing them"
569   element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
570   func_wrap H2
571   func_echo "$element"
572
573   func_echo '<PRE>'
574   echo "$missed_files"
575   echo '</PRE>'
576
577 fi
578
579 element="Future developments"
580 element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"`
581 func_wrap H2
582 func_echo "$element"
583
584 func_echo 'Ideally a module could consist of:'
585 func_begin UL
586 func_echo '<LI>A header file: lib/<VAR>module</VAR>.h'
587 func_echo '<LI>One or more implementation files: lib/<VAR>module</VAR>.c et al.'
588 func_echo '<LI>One or more autoconf macro files: m4/<VAR>module</VAR>.m4 et al.'
589 func_echo '<LI>A configure.ac fragment, Makefile.am fragment, dependency list: modules/<VAR>module</VAR>'
590 func_echo '<LI>Some documentation'
591 func_echo '<LI>A POT file and some PO files'
592 func_echo '<LI>A testsuite'
593 func_end UL
594
595 func_echo '<HR>'
596 func_echo 'Generated from <CODE>MODULES.html.sh</CODE> on '`LC_ALL=C date +"%e %B %Y"`.
597
598 func_end HTML