home *** CD-ROM | disk | FTP | other *** search
/ Dream 45 / Amiga_Dream_45.iso / Amiga / Magazine / Dossier-LaTeX / AmiWeb2C.lha / source / web2c-6.1 / web2c / mpware / dvitomp.chch < prev    next >
Text File  |  1995-04-10  |  6KB  |  194 lines

  1. Changes for DVITOMP.CH by Andreas Scherer, April 10, 1995.
  2.  
  3. @x l.48
  4. @d banner=='% Written by DVItoMP, C Version 0.63'
  5. @y
  6. @d banner=='% Written by DVItoMP, C Version 0.63'
  7.  
  8. @d amiga==ifdef('_AMIGA')
  9. @d agima==endif('_AMIGA')
  10. @z
  11.  
  12. @x l.57
  13. @p program DVI_to_MP;
  14. @y
  15. @p program DVI_to_MP;
  16.  
  17. amiga@;
  18. @=#include "dvitomp.version";@>
  19. agima@;
  20. @z
  21.  
  22. @x l.63
  23.   begin setpaths; {read environment, to find TEXFONTS, if there}
  24. @y
  25.   begin set_paths(TFM_FILE_PATH_BIT + VF_FILE_PATH_BIT);
  26.   {read environment, to find TEXFONTS, if there}
  27. @z
  28.  
  29. @x l.73
  30. @!name_length=FILENAMESIZE; {a file name shouldn't be longer than this}
  31. @y
  32. @!name_length=PATH_MAX; {a file name shouldn't be longer than this}
  33. @z
  34.  
  35. Replace Web2C 5.581 by Web2C 6.1.  There is no |test_access|, only
  36. |test_read_access|, and the parameters are different.  If there's a problem
  37. in opening the output file for writing, this will be made clear by the
  38. operating system (`Resource busy' or the like).
  39.  
  40. @x l.127
  41. In C we retrieve the file name from the command line and use an external
  42. |test_access| procedure to detect any problems so that we can issue
  43. appropriate error messages.  This procedure takes the file name from
  44. the global variable |cur_name|.  It has two other arguments that we
  45. shall use later on to control path searching for input files.
  46. @^system dependencies@>
  47.  
  48. @d write_access_mode=2 {``write'' mode for |test_access|}
  49. @d no_file_path=0    {no path searching should be done}
  50.  
  51. @p procedure test_usage;
  52. begin if argc<>3 then
  53.   begin err_print_ln('Usage: dvitomp <dvi-file> <mpx-file>');
  54.   jump_out;
  55.   end;
  56. end;
  57. @#
  58. procedure open_mpx_file; {prepares to write text on |mpx_file|}
  59. begin test_usage;
  60. argv(2,cur_name);
  61. if test_access(write_access_mode,no_file_path) then
  62.   rewrite(mpx_file, real_name_of_file)
  63. else abort('Cannot write on the mpx file');
  64. end;
  65. @y
  66. In C we retrieve the file name from the command line.
  67. @^system dependencies@>
  68.  
  69. @p procedure test_usage;
  70. begin if argc<>3 then
  71.   begin err_print_ln('Usage: dvitomp <dvi-file> <mpx-file>');
  72.   jump_out;
  73.   end;
  74. end;
  75. @#
  76. procedure open_mpx_file; {prepares to write text on |mpx_file|}
  77. begin test_usage;
  78. argv(2,cur_name);
  79. rewrite(mpx_file, cur_name);
  80. end;
  81. @z
  82.  
  83. @x l.176
  84. specifies the file name.  In C, we test the success of this operation by
  85. first using the external |test_access| function, which also does path
  86. searching based on the user's environment or the default path.
  87. @^system dependencies@>
  88.  
  89. @d read_access_mode=4  {``read'' mode for |test_access|}
  90. @d font_file_path=3  {path specifier for \.{TFM} files}
  91. @d vf_file_path=12 {path specifier for \.{VF} files}
  92.  
  93. @p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
  94. begin test_usage;
  95.     argv(1, cur_name);
  96.     if test_access(read_access_mode,no_file_path) then
  97.     reset(dvi_file, real_name_of_file)
  98.     else abort('DVI file not found');
  99. end;
  100. @#
  101. function open_tfm_file:boolean; {prepares to read packed bytes in |tfm_file|}
  102. var @!ok:boolean;
  103. begin ok:=test_access(read_access_mode,font_file_path);
  104. if ok then reset(tfm_file,real_name_of_file);
  105. open_tfm_file:=ok;
  106. end;
  107. @#
  108. function open_vf_file:boolean; {prepares to read packed bytes in |tfm_file|}
  109. var @!ok:boolean;
  110. begin ok:=test_access(read_access_mode,vf_file_path);
  111. if ok then reset(vf_file,real_name_of_file);
  112. open_vf_file:=ok;
  113. end;
  114. @y
  115. specifies the file name.  In C, we test the success of this operation by
  116. first using the external |test_read_access| function, which also does path
  117. searching based on the user's environment or the default path.
  118. @^system dependencies@>
  119.  
  120. @p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|}
  121. begin test_usage;
  122.     argv (toint(1), cur_name);
  123.     reset (dvi_file, cur_name);
  124. end;
  125. @z
  126.  
  127. @x l.1056 of DVITOMP.WEB
  128.     if open_vf_file then did_it:=in_VF(f);
  129. @y
  130.     if test_read_access (cur_name, VF_FILE_PATH)
  131.     then begin
  132.       reset (vf_file, cur_name);
  133.       did_it:=in_VF(f);
  134.     end;
  135. @z
  136.  
  137. @x l.1059 of DVITOMP.WEB
  138.       if not open_tfm_file then font_abort('No TFM file found for ')(f);
  139.   @.no TFM file found@>
  140.       did_it:=in_TFM(f);
  141. @y
  142.       if test_read_access (cur_name, TFM_FILE_PATH)
  143.       then begin
  144.         reset (tfm_file, cur_name);
  145.   @.no TFM file found@>
  146.         did_it:=in_TFM(f);
  147.       end else font_abort('No TFM file found for ')(f);
  148. @z
  149.  
  150. John Hobby had his own |print_real| routine, which wrote to |mpxfile|
  151. automatically.  Web2C 6.1 writes to |stdout|.  Redirect the output.
  152.  
  153. @x l.326
  154.   print_real(m,1,5); print(',');
  155.   print_real(x,1,4); print(',');
  156.   print_real(y,1,4);
  157. @y
  158.   f_print_real(mpxfile,m,1,5); print(',');
  159.   f_print_real(mpxfile,x,1,4); print(',');
  160.   f_print_real(mpxfile,y,1,4);
  161. @z
  162.  
  163. @x l.346
  164.   print_real(xx1,1,4); print(',');
  165.   print_real(yy1,1,4); print(')..(');
  166.   print_real(xx2,1,4); print(',');
  167.   print_real(yy2,1,4); print('), ');
  168.   print_real(ww,1,4);
  169. @y
  170.   f_print_real(mpxfile,xx1,1,4); print(',');
  171.   f_print_real(mpxfile,yy1,1,4); print(')..(');
  172.   f_print_real(mpxfile,xx2,1,4); print(',');
  173.   f_print_real(mpxfile,yy2,1,4); print('), ');
  174.   f_print_real(mpxfile,ww,1,4);
  175. @z
  176.  
  177. @x l.362
  178. print_real(dd,1,4); print(')--(');
  179. print_real(w,1,4);  print(',');
  180. print_real(dd,1,4); print_ln(')--');@/
  181. print(' (');
  182. print_real(w,1,4);  print(',');
  183. print_real(h,1,4);  print(')--(0,');
  184. print_real(h,1,4);  print_ln(')--cycle;');
  185. @y
  186. f_print_real(mpxfile,dd,1,4); print(')--(');
  187. f_print_real(mpxfile,w,1,4);  print(',');
  188. f_print_real(mpxfile,dd,1,4); print_ln(')--');@/
  189. print(' (');
  190. f_print_real(mpxfile,w,1,4);  print(',');
  191. f_print_real(mpxfile,h,1,4);  print(')--(0,');
  192. f_print_real(mpxfile,h,1,4);  print_ln(')--cycle;');
  193. @z
  194.