home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / ext / DPI / mkconst.pl < prev    next >
Text File  |  1996-02-21  |  471b  |  20 lines

  1. open(GPERF, "> dpiconst.gperf") or die "Cannot create dpiconst.gperf\n";
  2. open(NAMES, "> dpiconst.list")  or die "Cannot create dpiconst.list\n";
  3.  
  4. print GPERF "struct DpiConst { const char *name; long val; };\n%%\n";
  5. %consts = ();
  6. while (<>) {
  7.     if (/^\s*#define\s+((SNMP_|DPI_|dpi)\w+)\s/) {
  8.     $consts{$1} = 1;
  9.     }
  10. }
  11. @consts = sort keys %consts;
  12.  
  13. foreach (@consts) {
  14.     print GPERF "$_,$_\n";
  15.     print NAMES "$_\n";
  16. }
  17.  
  18. close(GPERF);
  19. close(NAMES);
  20.