home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / progrmng / stk110.lzh / STKSRC.COM / DODOC.AWK next >
Encoding:
AWK Script  |  1991-02-25  |  1.0 KB  |  42 lines

  1. ### An AWK script to create the stkref.doc from the include files
  2. BEGIN            { no_print= in_comment= 0;
  3.               for (i=0; i<75; i++) separator=separator "-";
  4.               titles[0]="GRTYPES"
  5.               titles[1]="The SPR functions"
  6.               titles[2]="The SPR_FIO functions"
  7.               titles[3]="The SPR_HIT functions"
  8.               titles[4]="The SPR_ANIM functions"
  9.               titles[5]="The GR functions"
  10.               titles[6]="The MOUSE functions"
  11.             }
  12.  
  13. /^#define _/        { next }
  14. /^#define/        { print $0; next }
  15. /^#/            { next }
  16. /^\*\*\*\*\**$/        { if (no_print)
  17.                 no_print=0
  18.               else
  19.                   no_print=1
  20.               no_comment=0;
  21.               next
  22.             }
  23. /^\/\*\**$/        { in_comment=1; print ""; next }
  24. /^\*\**\/$/        { in_comment=0; print "\n"; next }
  25. /^\*.*\.h[ \t]*$/    { if (title!=0)
  26.                 print "\f\n" separator
  27.               print titles[title++];
  28.               print separator;
  29.               next 
  30.             }
  31. /./            { empty_line=empty_previous=0 }
  32. /^[ \n]*$/        { empty_line=1 }
  33. {
  34.     if (no_print || empty_previous) 
  35.         next;
  36.     if (in_comment)
  37.         print "  " substr($0,3,78);
  38.     else
  39.         print $0;
  40.     empty_previous = empty_line;
  41. }
  42.