home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / SPIDER.ZIP / common.ch < prev    next >
Text File  |  1993-02-14  |  5KB  |  130 lines

  1. % Change file to common.web for Spider Web generation for OS2
  2. % To be used for research purposes only
  3. % For more information, see file COPYRIGHT in the parent directory
  4.  
  5. % This file is part of Spidery WEB
  6.  
  7. % This program by Norman Ramsey is based on programs Silvio Levy
  8. % and D. E. Knuth.  Silvio Levy wrote most of the code.
  9. % It is distributed WITHOUT ANY WARRANTY, express or implied.
  10. % Dec 1987
  11.  
  12. % Change file by Bruce Dubbs, Texas A&M University, bdubbs@neuron.tamu.edu
  13.  
  14.  
  15. @x  Module  7  Sun Feb 14 01:12:22 1993
  16. @ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
  17. the user's external character set by means of arrays |xord| and |xchr|
  18. that are analogous to PASCAL's |ord| and |chr| functions.
  19.  
  20. @<Definitions...@>=
  21. ASCII xord[last_text_char]; /* specifies conversion of input characters */
  22. outer_char xchr[@'200]; /* specifies conversion of output characters */
  23. @y  Module  7  Sun Feb 14 01:12:22 1993
  24. @ The \.{WEAVE} and \.{TANGLE} processors convert between ASCII code and
  25. the user's external character set by means of arrays |xord| and |xchr|
  26. that are analogous to PASCAL's |ord| and |chr| functions.
  27.  
  28. We have to change the size of xord to |last_text_char|+1 to cover the 
  29. entire 128 byte ASCII array.
  30.  
  31. @<Definitions...@>=
  32. ASCII xord[last_text_char+1]; /* specifies conversion of input characters */
  33. outer_char xchr[@'200]; /* specifies conversion of output characters */
  34. @z  Module  7  Sun Feb 14 01:12:22 1993
  35.  
  36. @x  Module  8  Sun Feb 14 01:16:14 1993
  37. @ Every system supporting \cee\ must be able to read and write the 95
  38. visible characters of standard ASCII above (although not necessarily using the
  39. ASCII codes to represent them).  Conversely, these characters, plus
  40. the newline, are sufficient to write any \cee\ program.  Other
  41. characters are desirable mainly in strings, and they can be referred
  42. to by means of escape sequences like \.{'\t'}.
  43.  
  44. The basic implementation of \.{WEB}, then, only has to assign an
  45. |xord| to these 95 characters (newlines are swallowed by the reading
  46. routines).  The easiest way to do this is to assign the characters to
  47. their positions in |xchr| and then invert the correspondence:
  48.  
  49. @<Functions...@>=
  50. common_init()
  51. {
  52.   strcpy(xchr,"                                 !\"#$%&'()*+,-./0123456789\
  53. :;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ");
  54.   @<System-dependent parts of character set@>;
  55.   @<Invert |xchr| to get |xord|@>;
  56.   @<Initialize pointers@>;
  57.   setting_up=1;
  58.   @<Scan arguments and open output files@>;
  59.   setting_up=0;
  60. }
  61. @y  Module  8  Sun Feb 14 01:16:14 1993
  62. @ Every system supporting \cee\ must be able to read and write the 95
  63. visible characters of standard ASCII above (although not necessarily using the
  64. ASCII codes to represent them).  Conversely, these characters, plus
  65. the newline, are sufficient to write any \cee\ program.  Other
  66. characters are desirable mainly in strings, and they can be referred
  67. to by means of escape sequences like \.{'\t'}.
  68.  
  69. The basic implementation of \.{WEB}, then, only has to assign an
  70. |xord| to these 95 characters (newlines are swallowed by the reading
  71. routines).  The easiest way to do this is to assign the characters to
  72. their positions in |xchr| and then invert the correspondence:
  73.  
  74. We make a change here so the string copy does not add a null to the |xchr|
  75. array.
  76.  
  77. @<Functions...@>=
  78. common_init()
  79. {
  80.   strncpy(xchr,"                                 !\"#$%&'()*+,-./0123456789\
  81. :;<=>?@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ",128);
  82.   @<System-dependent parts of character set@>;
  83.   @<Invert |xchr| to get |xord|@>;
  84.   @<Initialize pointers@>;
  85.   setting_up=1;
  86.   @<Scan arguments and open output files@>;
  87.   setting_up=0;
  88. }
  89. @z  Module  8  Sun Feb 14 01:16:14 1993
  90.  
  91. @x  Module  28  Sun Feb 14 01:17:40 1993
  92. @ When a \.{@@i} line is found in the |cur_file|, we must temporarily
  93. stop reading it and start reading from the named include file.  The
  94. \.{@@i} line should give a complete file name with or without \.{"..."};
  95. \.{WEB} will look for include files in standard directories using
  96. the |pathopen| module.
  97. That is set up at the beginning using the {\tt -I} arguments 
  98. and the {\tt WEBPATH} environment variable.
  99. @<Add environment variable |"WEBPATH"| to search path@>=
  100.     pathaddpath(getenv("WEBPATH"),':');
  101. @y  Module  28  Sun Feb 14 01:17:40 1993
  102. @ When a \.{@@i} line is found in the |cur_file|, we must temporarily
  103. stop reading it and start reading from the named include file.  The
  104. \.{@@i} line should give a complete file name with or without \.{"..."};
  105. \.{WEB} will look for include files in standard directories using
  106. the |pathopen| module.
  107. That is set up at the beginning using the {\tt -I} arguments 
  108. and the {\tt WEBPATH} environment variable.
  109.  
  110. We change the path delimeter to a semi-colon for OS/2.
  111.  
  112. @<Add environment variable |"WEBPATH"| to search path@>=
  113.     pathaddpath(getenv("WEBPATH"),';');
  114. @z  Module  28  Sun Feb 14 01:17:40 1993
  115.  
  116. @x  Module  70  Sun Feb 14 01:19:06 1993
  117. @ @<Set up null...@>= 
  118. #ifdef MSDOS
  119. strcpy(change_file_name,"NUL");
  120. #else
  121. strcpy(change_file_name,"/dev/null");
  122. #endif
  123. @y  Module  70  Sun Feb 14 01:19:06 1993
  124. @ OS/2 uses {\tt /dev/nul} instead of {\tt /dev/null}.
  125.  
  126. @<Set up null...@>= 
  127. strcpy(change_file_name,"/dev/nul");  
  128. @z  Module  70  Sun Feb 14 01:19:06 1993
  129.  
  130.