home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / tex / texsrc2 / Src / fontutil / pltotf / old-ch < prev    next >
Text File  |  1993-02-21  |  11KB  |  347 lines

  1. % pltotf.ch for C compilation with web2c.
  2. % The original version of this file was created by Pavel Curtis.
  3. %
  4. % History:
  5. % (more recent changes in ../ChangeLog.W2C)
  6. % 04/04/83 (PC)  Original version, made to work with version 1.2 of PLtoTF.
  7. % 04/16/83 (PC)  Brought up to version 1.3 of PLtoTF.
  8. % 06/30/83 (HWT) Revised changefile format for version 1.7 Tangle
  9. % 07/28/83 (HWT) Brought up to version 2
  10. % 12/19/86 (ETM) Brought up to version 2.1
  11. % 07/05/87 (ETM) Brought up to version 2.3
  12. % 03/22/88 (ETM) Converted for use with WEB to C
  13. % 11/29/89 (KB)  Version 3.
  14. % 01/16/90 (SR)  Version 3.2.
  15. % (more recent changes in ../ChangeLog.W2C)
  16.  
  17.  
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  19. % [0] WEAVE: print changes only.
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  21. @x
  22. \pageno=\contentspagenumber \advance\pageno by 1
  23. @y
  24. \pageno=\contentspagenumber \advance\pageno by 1
  25. \let\maybe=\iffalse
  26. \def\title{PL$\,$\lowercase{to}$\,$TF changes for C}
  27. @z
  28.  
  29. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  30. % [1] Change banner string.
  31. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  32. @x
  33. @d banner=='This is PLtoTF, Version 3.4' {printed when the program starts}
  34. @y
  35. @d banner=='This is PLtoTF, Version 3.4' {more is printed later}
  36. @z
  37.  
  38. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  39. % [2] Fix files in program statement.
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. @x
  42. @p program PLtoTF(@!pl_file,@!tfm_file,@!output);
  43. @y
  44. @p program PLtoTF;
  45. @z
  46.  
  47. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  48. % [still 2] No banner unless verbose.
  49. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  50. @x
  51.   begin print_ln(banner);@/
  52. @y
  53.   begin
  54.     if (argc < 3) or (argc > n_options + 3)
  55.     then begin
  56.       print_ln ('Usage: pltotf [-verbose] <property list file> <tfm file>.');
  57.       uexit (1);
  58.     end;
  59.  
  60.     @<Initialize the option variables@>;
  61.     @<Parse arguments@>;
  62. @z
  63.  
  64. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  65. % [3] Larger constants.
  66. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  67. @x
  68. @!max_lig_steps=5000;
  69.   {maximum length of ligature program, must be at most $32767-257=32510$}
  70. @!max_kerns=500; {the maximum number of distinct kern values}
  71. @!hash_size=5003; {preferably a prime number, a bit larger than the number
  72.   of character pairs in lig/kern steps}
  73. @y
  74. @!max_lig_steps=32000;
  75.   {maximum length of ligature program, must be at most $32767-257=32510$}
  76. @!max_kerns=15000; {the maximum number of distinct kern values}
  77. @!hash_size=15077; {preferably a prime number, a bit larger than the number
  78.   of character pairs in lig/kern steps}
  79. @z
  80.  
  81. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  82. % [6] Open PL file.
  83. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  84. @x
  85. reset(pl_file);
  86. @y
  87. argv (optind, pl_name);
  88. reset (pl_file, pl_name);
  89. if verbose then begin
  90.   print (banner);
  91.   print_ln (version_string);
  92. end;
  93. @z
  94.  
  95. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  96. % [15] Change type of tfm_file and declare extra file name variables. 
  97. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  98. @x
  99. @!tfm_file:packed file of 0..255;
  100. @y
  101. @!tfm_file:packed file of 0..255;
  102. @!tfm_name,@!pl_name:packed array[1..PATH_MAX] of char;
  103. @z
  104.  
  105. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  106. % [16] Open TFM file.
  107. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  108. @x
  109. @ On some systems you may have to do something special to write a
  110. packed file of bytes. For example, the following code didn't work
  111. when it was first tried at Stanford, because packed files have to be
  112. opened with a special switch setting on the \PASCAL\ that was used.
  113. @^system dependencies@>
  114.  
  115. @<Set init...@>=
  116. rewrite(tfm_file);
  117. @y
  118. @ On some systems you may have to do something special to write a
  119. packed file of bytes with Pascal.  It's no problem in C.
  120. @^system dependencies@>
  121.  
  122. @<Set init...@>=
  123. argv (optind + 1, tfm_name);
  124. rewrite (tfm_file, tfm_name);
  125. @z
  126.  
  127. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  128. % [79] `index' might be a library routine.
  129. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  130. @x
  131. |k|th element of its list.
  132.  
  133. @<Glob...@>=
  134. @!index:array[pointer] of byte;
  135. @y
  136. |k|th element of its list.
  137.  
  138. @d index == index_var
  139.  
  140. @<Glob...@>=
  141. @!index:array[pointer] of byte;
  142. @z
  143.  
  144. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  145. % [103] No output (except errors) unless verbose.
  146. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  147. @x
  148. @<Print |c| in octal notation@>;
  149. @y
  150. if verbose then @<Print |c| in octal notation@>;
  151. @z
  152.  
  153. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  154. % [115] Output of reals.
  155. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  156. @x
  157. @ @d round_message(#)==if delta>0 then print_ln('I had to round some ',
  158. @.I had to round...@>
  159.   #,'s by ',(((delta+1) div 2)/@'4000000):1:7,' units.')
  160. @y
  161. @ @d round_message(#)==if delta>0 then begin print('I had to round some ',
  162. @.I had to round...@>
  163.   #,'s by '); print_real((((delta+1) div 2)/@'4000000),1,7);
  164.   print_ln(' units.'); end
  165. @z
  166.  
  167. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  168. % [118] Change the name of the variable `class', since AIX 3.1's <math.h>
  169. % defines a function by that name.
  170. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  171. @x
  172. @d pending=4 {$f(x,y)$ is being evaluated}
  173. @y
  174. @d pending=4 {$f(x,y)$ is being evaluated}
  175.  
  176. @d class == class_var 
  177. @z
  178.  
  179. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  180. % [123] web2c can't handle these mutually recursive procedures.
  181. % But let's do a fake definition of f here, so that it gets into web2c's
  182. % symbol table...
  183. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  184. @x
  185. @p function f(@!h,@!x,@!y:indx):indx; forward;@t\2@>
  186.   {compute $f$ for arguments known to be in |hash[h]|}
  187. @y
  188. @p 
  189. ifdef('notdef') 
  190. function f(@!h,@!x,@!y:indx):indx; begin end;@t\2@>
  191.   {compute $f$ for arguments known to be in |hash[h]|}
  192. endif('notdef')
  193. @z
  194.  
  195. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  196. % [124] ... and then really define it now.
  197. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
  198. @x
  199. @p function f;
  200. @y
  201. @p function f(@!h,@!x,@!y:indx):indx; 
  202. @z
  203.  
  204. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  205. % [127] Fix up output of bytes.
  206. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  207. @x
  208. @d out(#)==write(tfm_file,#)
  209. @y
  210. @d out(#)==putbyte(#,tfm_file)
  211. @z
  212.  
  213. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  214. % [136] Fix output of reals.
  215. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  216. @x
  217. @p procedure out_scaled(x:fix_word); {outputs a scaled |fix_word|}
  218. var @!n:byte; {the first byte after the sign}
  219. @!m:0..65535; {the two least significant bytes}
  220. begin if abs(x/design_units)>=16.0 then
  221.   begin print_ln('The relative dimension ',x/@'4000000:1:3,
  222.     ' is too large.');
  223. @.The relative dimension...@>
  224.   print('  (Must be less than 16*designsize');
  225.   if design_units<>unity then print(' =',design_units/@'200000:1:3,
  226.       ' designunits');
  227. @y
  228. @p procedure out_scaled(x:fix_word); {outputs a scaled |fix_word|}
  229. var @!n:byte; {the first byte after the sign}
  230. @!m:0..65535; {the two least significant bytes}
  231. begin if fabs(x/design_units)>=16.0 then
  232.   begin print('The relative dimension ');
  233.     print_real(x/@'4000000,1,3);
  234.     print_ln(' is too large.');
  235. @.The relative dimension...@>
  236.   print('  (Must be less than 16*designsize');
  237.   if design_units<>unity then begin print(' =');
  238.     print_real(design_units/@'200000,1,3);
  239.     print(' designunits');
  240.   end;
  241. @z
  242.  
  243. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  244. % [141] char_remainder[c] is unsigned, and label_table[sort_ptr].rr
  245. % might be -1, and if -1 is coerced to being unsigned, it will be bigger
  246. % than anything else.
  247. %%%%%%%%%