home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / MacPerl Source ƒ / Perl5 / embed_h.pl < prev    next >
Encoding:
Perl Script  |  1995-10-07  |  1.1 KB  |  63 lines  |  [TEXT/MPS ]

  1. #!/usr/local/bin/perl
  2.  
  3. open(EMBED, ">embed.h") || die "Can't open embed.h for writing";
  4.  
  5. print EMBED <<'END';
  6. /* This file is derived from global.sym and interp.sym */
  7.  
  8. /* (Doing namespace management portably in C is really gross.) */
  9.  
  10. #ifdef EMBED
  11.  
  12. /* globals we need to hide from the world */
  13. END
  14.  
  15. open(GLOBAL, "global.sym") || die "Couldn't open global.sym for reading");
  16.  
  17. while (<GLOBAL>) {
  18.     s/\s*#.*//;
  19.     next if (/^\s*$/);
  20.     s/(\w+)/#define $1        Perl_$1/;
  21.     print EMBED;
  22. }
  23.  
  24. print EMBED <<'END';
  25.  
  26. #endif /* EMBED */
  27.  
  28. /* Put interpreter specific symbols into a struct? */
  29.  
  30. #ifdef MULTIPLICITY
  31.  
  32. END
  33.  
  34. open(INTERP, "interp.sym") || die "Couldn't open interp.sym for reading");
  35.  
  36. while (<INTERP>) {
  37.     s/\s*#.*//;
  38.     next if (/^\s*$/);
  39.     s/(\w+)/#define $1        (curinterp->I$1)/;
  40.     print EMBED;
  41. }
  42.  
  43. print EMBED <<'END';
  44.  
  45. #else    /* not multiple, so translate interpreter symbols the other way... */
  46.  
  47. END
  48.  
  49. open(INTERP, "interp.sym") || die "Couldn't open interp.sym for reading");
  50.  
  51. while (<INTERP>) {
  52.     s/\s*#.*//;
  53.     next if (/^\s*$/);
  54.     s/(\w+)/#define I$1        $1/;
  55.     print EMBED;
  56. }
  57.  
  58. print EMBED <<'END';
  59.  
  60. #endif /* MULTIPLICITY */
  61. END
  62.  
  63.