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