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