home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume20 / psxhtstr.pch < prev    next >
Encoding:
Text File  |  1989-09-22  |  13.2 KB  |  624 lines

  1. Path: wuarchive!mailrus!uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!bbn.com!rsalz
  2. From: rsalz@uunet.uu.net (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v20i022:  POSIX 1003.1 #include file tester, Patch1
  5. Message-ID: <1981@prune.bbn.com>
  6. Date: 21 Sep 89 19:42:52 GMT
  7. Lines: 614
  8. Approved: rsalz@uunet.UU.NET
  9.  
  10. Submitted-by: Barry Books <bbooks@aixsm.austin.ibm.com>
  11. Posting-number: Volume 20, Issue 22
  12. Archive-name: posix.h-tester.pch
  13. Patch-To: posix.h-tester: Volume 20, Issue 1
  14.  
  15. The POSIX include file tester archive was truncated some where
  16. along the way.  Here are the missing files along with one other
  17. to fix a typo.
  18.  
  19. Thanks,
  20. Barry Books
  21.                 
  22.  
  23. # This is a shell archive.  Remove anything before this line,
  24. # then unpack it by saving it in a file and typing "sh file".
  25. # Contents:  include1.0/ include1.0/types/ include1.0/types/wait
  26. #    include1.0/typedef include1.0/typedef.awk include1.0/ctypes
  27. #    include1.0/report.t include1.0/tr.testrig include1.0/functions
  28.  
  29. echo mkdir - include1.0
  30. mkdir include1.0
  31. chmod u=rwx,g=rx,o=rx include1.0
  32.  
  33. echo mkdir - include1.0/types
  34. mkdir include1.0/types
  35. chmod u=rwx,g=rx,o=rx include1.0/types
  36.  
  37. echo x - include1.0/types/wait
  38. sed 's/^@//' > "include1.0/types/wait" <<'@//E*O*F include1.0/types/wait//'
  39.  
  40. @//E*O*F include1.0/types/wait//
  41. chmod u=rw,g=r,o=r include1.0/types/wait
  42.  
  43. echo x - include1.0/typedef
  44. sed 's/^@//' > "include1.0/typedef" <<'@//E*O*F include1.0/typedef//'
  45.  #
  46. #**********************************************************************
  47. # THERE MUST BE A SPACE in the first character of the first line.
  48. #**********************************************************************
  49. #
  50. #            NOTICE STATEMENT
  51. #
  52. # This code was developed by IBM Corporation.  Copyright is disclaimed.
  53. #
  54. # IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
  55. # WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
  56. #
  57. #    "@(#) This code was developed by IBM Corporation. "
  58. #    "@(#) Copyright is disclaimed. "
  59. #
  60. #**********************************************************************
  61. #  Written by:  Barry Books
  62. #**********************************************************************
  63.  
  64.  #
  65. # copy the .h to a .c for C compiler
  66. TMP=`$MKTEMP`
  67. touch $TMP.c
  68. cp $1 $TMP.c
  69.  
  70. # compile the file with _POSIX_SOURCE defined
  71. # put space around ( ) and *
  72. # change all white space to newline so one token per line
  73. # run awk to find typedefs
  74. cc -D _POSIX_SOURCE -E $TMP.c | sed 's/(/ ( /g; s/)/ ) /g; s/\*/ * /g' | tr  -s "     " "\012\012"  | awk -f typedef.awk | ./report -t $1
  75.  
  76. #clean up
  77. rm -f $TMP.c
  78. @//E*O*F include1.0/typedef//
  79. chmod u=rwx,g=rx,o=rx include1.0/typedef
  80.  
  81. echo x - include1.0/typedef.awk
  82. sed 's/^@//' > "include1.0/typedef.awk" <<'@//E*O*F include1.0/typedef.awk//'
  83.  #
  84. #**********************************************************************
  85. # THERE MUST BE A SPACE in the first character of the first line.
  86. #**********************************************************************
  87. #
  88. #            NOTICE STATEMENT
  89. #
  90. # This code was developed by IBM Corporation.  Copyright is disclaimed.
  91. #
  92. # IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
  93. # WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
  94. #
  95. #    "@(#) This code was developed by IBM Corporation. "
  96. #    "@(#) Copyright is disclaimed. "
  97. #
  98. #**********************************************************************
  99. #  Written by:  Barry Books
  100. #**********************************************************************
  101.  
  102. # state machine to find typedefs
  103. # order is important
  104.  
  105. BEGIN {
  106.     STRUCT=0;
  107.     OPEN = 0;
  108.     SEMI = 0;
  109.     SQRB = 0;
  110.     TYPEDEF = 0;
  111. }
  112.  
  113. #toss some keywords
  114. /unsigned/    {
  115.     next;
  116.     }
  117.  
  118. /extern/    {
  119.     SEMI = 0;
  120.     next;
  121.     }
  122.  
  123. /signed/    {
  124.     next;
  125.     }
  126.  
  127. /\(/    {
  128.     next;
  129.     }
  130.  
  131. /\)/    {
  132.     next;
  133.     }
  134.  
  135. #attempt to fix typedef thing[num]; problem
  136. #this didn't work
  137. /\[/    {
  138.         SQRB += 1;
  139.     }
  140.  
  141. /\]/    {
  142.         SQRB -= 1;
  143.     }
  144.  
  145. #keep track of braces
  146. /{/    {
  147.         OPEN += 1;
  148.         next;
  149.     }
  150.  
  151. /}/    {
  152.         OPEN -= 1;
  153.         next;
  154.     }
  155.  
  156. # semi colon is end of statement
  157. # save the names and the next token will print the results
  158. # this takes care of both cases
  159. # typedef thing;
  160. # typedef thing ;
  161. #this should have be done with sed to make everything
  162. # typedef thing ;
  163. # maybe next time
  164. /;/    {
  165.         if ( OPEN > 0 )
  166.             next;
  167.         else
  168.         {
  169.             SEMI = 1;
  170.             if ( length($1) > 1 )
  171.             {
  172.                 TMPNAME=substr($1,1,length($1)-1);
  173.                 if ( TMPNAME !~ /]/ )
  174.                     NAME=TMPNAME;
  175.             }
  176.         }
  177.     }
  178.  
  179. # this matches everything
  180. # if its a typedef print the results and reset the flags
  181. /^/    {
  182.         if ( TYPEDEF == 1 )
  183.         {
  184.             if ( SEMI == 1 )
  185.             {
  186.                 printf("%s\n",NAME);
  187.                 SEMI = 0;
  188.                 TYPEDEF = 0;
  189.             }
  190.             else
  191.             {
  192.                 if ( SQRB = 0 )
  193.                     NAME = $1;
  194.                 next;
  195.             }
  196.         }
  197.     }
  198.  
  199. #keep tract of these keywords
  200. /typedef/    {
  201.     TYPEDEF=1;
  202.     SEMI=0;
  203.     next;
  204.     }
  205.  
  206. /struct/    {
  207.     STRUCT=1;
  208.     SEMI=0;
  209.     next;
  210.     }
  211.  
  212.  
  213. @//E*O*F include1.0/typedef.awk//
  214. chmod u=rw,g=r,o=r include1.0/typedef.awk
  215.  
  216. echo x - include1.0/ctypes
  217. sed 's/^@//' > "include1.0/ctypes" <<'@//E*O*F include1.0/ctypes//'
  218. char
  219. double
  220. float
  221. int
  222. long
  223. short
  224. @//E*O*F include1.0/ctypes//
  225. chmod u=rw,g=r,o=r include1.0/ctypes
  226.  
  227. echo x - include1.0/report.t
  228. sed 's/^@//' > "include1.0/report.t" <<'@//E*O*F include1.0/report.t//'
  229.  
  230.  
  231.  
  232.                       Report on POSIX Include File Conformance
  233.  
  234.           Overview
  235.             This document reports objects in include files which do  not
  236.             meet  the POSIX 1003.1 specification.  This is intended as a
  237.             tool more than a conformance test and is distributed to  aid
  238.             in  reaching a consensus on what should be and should not be
  239.             included in a POSIX 1003.1 conforming include file.
  240.  
  241.           Requirements
  242.             The standard specifies the contents of include files in  two
  243.             ways  first  by  stating  items  which  must be included and
  244.             second allowing for other items as long as they meet certain
  245.             criteria.   No  other objects are allowed when _POSIX_SOURCE
  246.             is defined ( 1003.1 2.82. ).  The following  is  a  list  of
  247.             objects not specifically mentioned in the standard but still
  248.             allowed.
  249.                  1. All external identifiers that  begin  with  an
  250.                       underscore  are reserved ( POSIX 1003.1 2.8.1
  251.                       ).
  252.                  2.  All  other  identifiers  that  begin  with  an
  253.                       underscore  and either an uppercase letter or
  254.                       another  underscore  are  reserved  (   POSIX
  255.                       1003.1 2.8.1 ).
  256.                  3. Namespaces reserved by the C Standard are  also
  257.                       reserved ( POSIX 1003.1 2.8.1 ).
  258.                  4. Types ending in _t are reserved ( POSIX  1003.1
  259.                       2.6 ).
  260.                  5. Implementations may add members to a structure or
  261.                       union  (  POSIX 1003.1 2.8.2 ). These members
  262.                       must have either standard C  types  or  types
  263.                       ending in _t ( implied by 4 ).
  264.                  6. Additional macro definitions, beginning with  E
  265.                       and a digit or E and an upper-case letter may
  266.                       also be specified  by  the  implementation  (
  267.                       ANSI 4.1.3 ).
  268.                  7. Additional signals and pointers to  undeclarable
  269.                       functions,    with   definitions   beginning,
  270.                       respectively, with letters SIG and an  upper-
  271.                       case  letter  or  with SIG_ and an upper-case
  272.                       letter  may  also   be   specified   by   the
  273.                       implementation ( ANSI 4.7 ).
  274.                  8. Headers may be included in any order  and  more
  275.                       than once with no effect different from being
  276.                       included only once,  except  for  assert.h  (
  277.                       ANSI 4.1.1 ).
  278.  
  279.           Interpreting The Results
  280.             The results from each include file are  divided  into  three
  281.             categories:  defines, structures and typedefs. If an include
  282.             file is missing it is marked missing and the tests for  that
  283.             include file are skipped.
  284.  
  285.             Defines
  286.             The defines section  contains  four  columns.   The  "extra"
  287.             column  contains defines not allowed by the standard.  These
  288.             items should  be  moved  outside   the  scope  _POSIX_SOURCE
  289.             feature  test  macro.  The "other" column contains items not
  290.             specifically mentioned for this particular include file  but
  291.             allowed  by  the  standard.   The  "missing" column contains
  292.             items required by the standard but not found in the  include
  293.             files.   This  column is used as a debugging aid as the test
  294.             suites can find these problems quite easily.  You should not
  295.             find  items  in  this column that are in your include files.
  296.             The  last  column  is  the  "macros"  column.   This  column
  297.             contains a list of functions that are defined as macros.
  298.  
  299.             Structures
  300.             The structure  section  contains  two  columns.   The  first
  301.             column  contains  any  structures not specified by the POSIX
  302.             1003.1 or the ANSI C standard.  The second  column  contains
  303.             structure elements not allowed by the 1003.1 standard.
  304.  
  305.             Typedefs
  306.             The typedef section is similar to the define  section.   The
  307.             first  column  contains  typedefs  not allowed by the 1003.1
  308.             standard.  The next column  contains  typedefs  required  in
  309.             other  include  files and the final column contains typedefs
  310.             that are missing.
  311.  
  312. @//E*O*F include1.0/report.t//
  313. chmod u=rw,g=r,o=r include1.0/report.t
  314.  
  315. echo x - include1.0/tr.testrig
  316. sed 's/^@//' > "include1.0/tr.testrig" <<'@//E*O*F include1.0/tr.testrig//'
  317.  #
  318. #**********************************************************************
  319. # THERE MUST BE A SPACE in the first character of the first line.
  320. #**********************************************************************
  321. #
  322. #            NOTICE STATEMENT
  323. #
  324. # This code was developed by IBM Corporation.  Copyright is disclaimed.
  325. #
  326. # IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
  327. # WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
  328. #
  329. #    "@(#) This code was developed by IBM Corporation. "
  330. #    "@(#) Copyright is disclaimed. "
  331. #
  332. #**********************************************************************
  333. #  Written by:  Barry Books
  334. #**********************************************************************
  335.  
  336. # if your are missing tr
  337. awk '{ for (i = 1; i <= NF; i++ ) {print $i}}'
  338. @//E*O*F include1.0/tr.testrig//
  339. chmod u=rwx,g=rwx,o=rwx include1.0/tr.testrig
  340.  
  341. echo x - include1.0/functions
  342. sed 's/^@//' > "include1.0/functions" <<'@//E*O*F include1.0/functions//'
  343. assert
  344. isalnum
  345. isalpha
  346. iscntrl
  347. isdigit
  348. isgraph
  349. islower
  350. isprint
  351. ispunct
  352. isspace
  353. isupper
  354. isxdigit
  355. tolower
  356. toupper
  357. setlocale
  358. localeconv
  359. acos
  360. asin
  361. atan
  362. atan2
  363. cos
  364. sin
  365. tan
  366. cosh
  367. sinh
  368. tanh
  369. exp
  370. frexp
  371. ldexp
  372. log
  373. log10
  374. modf
  375. pow
  376. sqrt
  377. ceil
  378. fabs
  379. floor
  380. fmod
  381. setjmp
  382. longjmp
  383. signal
  384. raise
  385. va_start
  386. va_arg
  387. va_end
  388. remove
  389. rename
  390. tmpfile
  391. tmpnam
  392. fclose
  393. fflush
  394. fopen
  395. freopen
  396. setbuf
  397. setvbuf
  398. fprintf
  399. fscanf
  400. printf
  401. scanf
  402. sprinf
  403. sscanf
  404. vfprintf
  405. vprintf
  406. vsprintf
  407. fgetc
  408. fgets
  409. fputc
  410. fputs
  411. getc
  412. getchar
  413. gets
  414. putc
  415. putchar
  416. puts
  417. ungetc
  418. fread
  419. fwrite
  420. fgetpos
  421. fseek
  422. fsetpos
  423. ftell
  424. rewind
  425. clearerr
  426. feof
  427. ferror
  428. perror
  429. atof
  430. atoi
  431. atol
  432. strtod
  433. strtol
  434. strtoul
  435. rand
  436. srand
  437. calloc
  438. free
  439. malloc
  440. realloc
  441. abort
  442. atexit
  443. exit
  444. getenv
  445. systems
  446. bsearch
  447. qsort
  448. abs
  449. div
  450. labs
  451. ldiv
  452. mblen
  453. mbtowc
  454. wctomb
  455. mbstowcs
  456. wcstombs
  457. memcpy
  458. memmove
  459. strcpy
  460. strncpy
  461. strcat
  462. strncat
  463. memcmp
  464. strcmp
  465. strcol
  466. strncmp
  467. strxfrm
  468. memchr
  469. strchr
  470. strcspan
  471. strpbrk
  472. strrchr
  473. strspn
  474. strstr
  475. strtok
  476. memset
  477. strerror
  478. strlen
  479. clock
  480. difftime
  481. mktime
  482. time
  483. asctime
  484. ctime
  485. gmtime
  486. localtime
  487. strftime
  488. access
  489. alarm
  490. asctime
  491. cfgetispeed
  492. cfgetospeed
  493. cfsetispeed
  494. cfsetospeed
  495. chdir
  496. chmod
  497. chown
  498. close
  499. closedir
  500. creat
  501. ctermid
  502. cuserid
  503. dup
  504. dup2
  505. execl
  506. execle
  507. execlp
  508. execv
  509. execve
  510. execvp
  511. _exit
  512. fcntl
  513. fdopen
  514. fileno
  515. fork
  516. fpathconf
  517. fstat
  518. getcwd
  519. getegid
  520. getenv
  521. geteuid
  522. getgid
  523. getgrgid
  524. getgrnam
  525. getgroups
  526. getlogin
  527. getpgrp
  528. getpid
  529. getppid
  530. getpwnam
  531. getpwuid
  532. getuid
  533. isatty
  534. kill
  535. link
  536. longjmp
  537. lseek
  538. mkdir
  539. mkfifo
  540. open
  541. opendir
  542. pathconf
  543. pause
  544. pipe
  545. read
  546. readdir
  547. rename
  548. rewinddir
  549. rmdir
  550. setgid
  551. setjmp
  552. setlocale
  553. setpgid
  554. setsid
  555. setuid
  556. sigaction
  557. sigaddset
  558. sigdelset
  559. sigemptyset
  560. sigfillset
  561. sigismember
  562. siglongjmp
  563. sigpending
  564. sigprocmask
  565. sigsetjmp
  566. sigsuspend
  567. sleep
  568. stat
  569. sysconf
  570. tcdrain
  571. tcflow
  572. tcflush
  573. tcgetattr
  574. tcgetpgrp
  575. time
  576. times
  577. ttyname
  578. tzset
  579. umask
  580. uname
  581. unlink
  582. utime
  583. wait
  584. waitpid
  585. write
  586.  
  587. S_ISDIR
  588. S_ISCHR
  589. S_ISBLK
  590. S_ISREG
  591. S_ISFIFO
  592. WIFEXITED
  593. WEXITSTATUS
  594. WIFSIGNALED
  595. WTERMSIG
  596. WIFSTOPPED
  597. WSTOPSIG
  598. @//E*O*F include1.0/functions//
  599. chmod u=rw,g=r,o=r include1.0/functions
  600.  
  601. echo Inspecting for damage in transit...
  602. temp=/tmp/shar$$; dtemp=/tmp/.shar$$
  603. trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
  604. cat > $temp <<\!!!
  605.        1       0       1 wait
  606.       33     170    1117 typedef
  607.      130     331    1993 typedef.awk
  608.        6       6      33 ctypes
  609.       83     540    4519 report.t
  610.       21     104     789 tr.testrig
  611.      255     254    1843 functions
  612.      529    1405   10295 total
  613. !!!
  614. wc  include1.0/types/wait include1.0/typedef include1.0/typedef.awk include1.0/ctypes include1.0/report.t include1.0/tr.testrig include1.0/functions | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
  615. if [ -s $dtemp ]
  616. then echo "Ouch [diff of wc output]:" ; cat $dtemp
  617. else echo "No problems found."
  618. fi
  619. exit 0
  620.  
  621. -- 
  622. Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
  623. Use a domain-based address or give alternate paths, or you may lose out.
  624.