home *** CD-ROM | disk | FTP | other *** search
/ Mega CD-ROM 1 / megacd_rom_1.zip / megacd_rom_1 / POSTSCRI / PSFIX.ZIP / PSFIX.H < prev    next >
C/C++ Source or Header  |  1991-04-11  |  7KB  |  213 lines

  1. /*
  2.  *  header file for psfix.c
  3.  */
  4.  
  5. /*
  6.  * This software may be freely distributed under the following conditions:
  7.  *         1. It is distributed in its current form, without alterations.
  8.  *         2. No monetary profit is made, under any circumstances.
  9.  *
  10.  *             Marc A. Murison
  11.  *             Smithsonian Astrophysical Observatory
  12.  *             60 Garden Street, MS 63
  13.  *             Cambridge, MA  02138
  14.  *
  15.  *             (617) 495-7079      murison@cfacx2.harvard.edu
  16.  */
  17.  
  18. #define   FILES
  19. #define   NO_FLOAT
  20. #include  "strlib.h"
  21. #include  "fileio.h"
  22. #include  "vectdef.h"
  23.  
  24. #ifndef STRING_H
  25. #define STRING_H
  26. #include  <string.h>
  27. #endif
  28.  
  29. #ifndef STDLIB_H
  30. #define STDLIB_H
  31. #include  <stdlib.h>
  32. #endif
  33.  
  34.  
  35.  
  36. /* global parameters */
  37.  
  38. #define  VERSION       "Psfix  2.73"
  39.  
  40. #if __MSDOS__            
  41. #define     MAX_FBUFF     54000L        /* input (file) buffer size               */
  42. #else
  43. #define  MAX_FBUFF 100000
  44. #endif
  45.  
  46. #define  MAX_LBUFF      260        /* line buffer size                       */
  47. #define     MAX_CHARS       80       /* max # chars per output line            */
  48. #define  M_C          "80"
  49. #define     NTABS          4        /* tab expansion spaces                   */
  50. #define  OUTP_INTVL    50        /* interval for screen update of progress */
  51. #define  MAXARGS        4        /* max # command line arguments           */
  52.  
  53. #define  INEXT          ".ps"   /* default input file extension           */
  54. #define  OUTEXT         ".out"  /* default output file extension          */
  55.  
  56.  
  57.  
  58. /* function prototypes */
  59.  
  60. void    process_line_buffer( char *line_buff_start, char **line_buff_ptr_ptr,
  61.                           File_Def *outfile, long *char_count, long *newlines,
  62.                           long *oldlines, int *EOF_flag );
  63.  
  64. void    disk_full( File_Def *file );
  65.  
  66. void     banner( char infile_name[], char outfile_name[], 
  67.                 long *char_count_ptr, long *newlines_ptr, 
  68.                 long *oldlines_ptr );
  69.  
  70. ulong    pfill_file_buff( FILE *infile, int ftype, ulong Nmax, 
  71.                          char *buff_ptr, int *EOF_ptr, int *ncomment,
  72.                          int *paren_level );
  73.  
  74. uint    pfill_line_buff( FILE *infile, int ftype, char file_buffer[],
  75.                          char **file_buff_ptr_ptr, ulong Fbytes, uint Lbytes,
  76.                          char *line_buff_ptr, int msg_flag, int *EOF_ptr,
  77.                          int *ncomment, int *paren_level );
  78.  
  79. void    errout( Boolean bell, FILE *device, char *errstring );
  80.  
  81.  
  82. /* usage and help text */
  83.  
  84. char *usage = "\n"
  85.               "\nHelp:  psfix  ?"
  86.               "\nWrite help to a file named \"help\":  psfix ??"
  87.               "\n"
  88.               "\nUse:   psfix  infile[.ps]  [outfile[.out]]"
  89.               "\n       psfix  infile[.ps]  [.out]"
  90.               "\n       psfix  dirfile      [.out]"
  91.               "\n       psfix  dirfile      [.ps  .out]"
  92.               "\n";
  93.  
  94. char *help =
  95.   "----------------------------------------------------------------------------"
  96. "\n                        " VERSION "  " __DATE__
  97. "\n----------------------------------------------------------------------------"
  98. "\nThis software is the property of the Smithsonian Astrophysical Observatory"
  99. "\nand the U.S. government. It may be freely distributed under the following"
  100. "\nconditions:"
  101. "\n        1. It is distributed in its current form, without alterations."
  102. "\n        2. No monetary profit is made, under any circumstances."
  103. "\n----------------------------------------------------------------------------"
  104. "\n"
  105. "\nPsfix:  Massage PostScript output from programs such as EasyFlow and "
  106. "\n        Word Perfect to help make journeys through mainframe computers"
  107. "\n        in an unmangled state."
  108. "\n"
  109. "\nPsfix performs the following actions:"
  110. "\n"
  111. "\n        * Records are broken to 80 bytes or less, at an appropriate place"
  112. "\n          to preserve valid PostScript commands. Psfix will fail if it"
  113. "\n          encounters more than " M_C " consecutive non-blank characters."
  114. "\n"
  115. "\n        * All comments are stripped."
  116. "\n"
  117. "\n        * Lone carriage returns are replaced by a space."
  118. "\n"
  119. "\n        * Tabs are replaced by a space."
  120. "\n"
  121. "\nPsfix will operate on a list of files as well as on a single specified file."
  122. "\n"
  123. "\nPlease direct comments, suggestions, or problems to"
  124. "\n"
  125. "\n            Marc A. Murison"
  126. "\n            Smithsonian Astrophysical Observatory"
  127. "\n            60 Garden Street, MS 63"
  128. "\n            Cambridge, MA  02138"
  129. "\n"
  130. "\n            (617) 495-7079"
  131. "\n            murison@cfacx2.harvard.edu"
  132. "\n"
  133. "\n----------------------------------------------------------------------------"
  134. "\n"
  135. "\nTo write this text to a file named \"help\", type \"psfix ??\"."
  136. "\n"
  137. "\n----------------------------------------------------------------------------"
  138. "\n"
  139. "\nWARNING:  If an output file already exists, it will be overwritten!"
  140. "\n"
  141. "\nSingle File Use:"
  142. "\n"
  143. "\n        For a single input file, type either"
  144. "\n"
  145. "\n             psfix  infile[.ps]  [outfile[.out]]"
  146. "\n        or"
  147. "\n             psfix  infile[.ps]  [.out]"
  148. "\n"
  149. "\n        where [] indicates quantities which need not be typed. The"
  150. "\n        default outfile name is the infile with \".out\" as the"
  151. "\n        extension. You may type \".any\" in place of the outfile name,"
  152. "\n        in which case the infile name is used with \".any\" as the"
  153. "\n        extension."
  154. "\n"
  155. "\n        For example,"
  156. "\n"
  157. "\n             psfix  stuff  .foo"
  158. "\n"
  159. "\n        will cause psfix to read input from stuff.ps and write output"
  160. "\n        to stuff.foo, whereas"
  161. "\n"
  162. "\n             psfix  stuff.eps"
  163. "\n"
  164. "\n        will cause psfix to read input from stuff.eps and write output"
  165. "\n        to stuff.out. You get the idea."
  166. "\n"
  167. "\n----------------------------------------------------------------------------"
  168. "\n"
  169. "\nDirectory File Use:"
  170. "\n"
  171. "\n        For a directory of input files, type"
  172. "\n"
  173. "\n             psfix  dirfile  [.out]"
  174. "\n        or"
  175. "\n             psfix  dirfile  [.ps .out]"
  176. "\n"
  177. "\n        where dirfile contains the word DIRECTORY (case ignored) as the"
  178. "\n        first word on the first line in the file, followed by input file"
  179. "\n        names, one per line. File extensions are not neccessary and will"
  180. "\n        be ignored if present. "
  181. "\n"
  182. "\n        In addition, the result of a DOS dir, sorted or not, will be"
  183. "\n        understood without need of any editing. For example, the file"
  184. "\n        tmp.dat, created by either"
  185. "\n"
  186. "\n             dir  *.ps  >  tmp.dat"
  187. "\n        or"
  188. "\n             dir  *.ps  |  sort  >  tmp.dat"
  189. "\n"
  190. "\n        will work fine, even though \"DIRECTORY\" is not the first word."
  191. "\n"
  192. "\n        The default output file extension is \".out\". If another"
  193. "\n        is desired, it must be specified after dirfile on the"
  194. "\n        command line. Likewise, the default input file extension"
  195. "\n        is \".ps\". If another is desired, *both* the input and"
  196. "\n        the output extensions must be specified after dirfile, as"
  197. "\n        shown above. Thus, the DOS sequence"
  198. "\n"
  199. "\n             dir  *.eps  >  tmp.dat"
  200. "\n"
  201. "\n             psfix  tmp.dat  .eps  .foo"
  202. "\n"
  203. "\n        will process all *.eps files in the current directory, putting"
  204. "\n        the resulting output into the files *.foo."
  205. "\n"
  206. "\n"
  207. "\n               *  *  *  *  *  End of Help  *  *  *  *  *"
  208. "\n";
  209.  
  210.  
  211.  
  212.  
  213.