home *** CD-ROM | disk | FTP | other *** search
- /*
- * header file for psfix.c
- */
-
- /*
- * This software may be freely distributed under the following conditions:
- * 1. It is distributed in its current form, without alterations.
- * 2. No monetary profit is made, under any circumstances.
- *
- * Marc A. Murison
- * Smithsonian Astrophysical Observatory
- * 60 Garden Street, MS 63
- * Cambridge, MA 02138
- *
- * (617) 495-7079 murison@cfacx2.harvard.edu
- */
-
- #define FILES
- #define NO_FLOAT
- #include "strlib.h"
- #include "fileio.h"
- #include "vectdef.h"
-
- #ifndef STRING_H
- #define STRING_H
- #include <string.h>
- #endif
-
- #ifndef STDLIB_H
- #define STDLIB_H
- #include <stdlib.h>
- #endif
-
-
-
- /* global parameters */
-
- #define VERSION "Psfix 2.73"
-
- #if __MSDOS__
- #define MAX_FBUFF 54000L /* input (file) buffer size */
- #else
- #define MAX_FBUFF 100000
- #endif
-
- #define MAX_LBUFF 260 /* line buffer size */
- #define MAX_CHARS 80 /* max # chars per output line */
- #define M_C "80"
- #define NTABS 4 /* tab expansion spaces */
- #define OUTP_INTVL 50 /* interval for screen update of progress */
- #define MAXARGS 4 /* max # command line arguments */
-
- #define INEXT ".ps" /* default input file extension */
- #define OUTEXT ".out" /* default output file extension */
-
-
-
- /* function prototypes */
-
- void process_line_buffer( char *line_buff_start, char **line_buff_ptr_ptr,
- File_Def *outfile, long *char_count, long *newlines,
- long *oldlines, int *EOF_flag );
-
- void disk_full( File_Def *file );
-
- void banner( char infile_name[], char outfile_name[],
- long *char_count_ptr, long *newlines_ptr,
- long *oldlines_ptr );
-
- ulong pfill_file_buff( FILE *infile, int ftype, ulong Nmax,
- char *buff_ptr, int *EOF_ptr, int *ncomment,
- int *paren_level );
-
- uint pfill_line_buff( FILE *infile, int ftype, char file_buffer[],
- char **file_buff_ptr_ptr, ulong Fbytes, uint Lbytes,
- char *line_buff_ptr, int msg_flag, int *EOF_ptr,
- int *ncomment, int *paren_level );
-
- void errout( Boolean bell, FILE *device, char *errstring );
-
-
- /* usage and help text */
-
- char *usage = "\n"
- "\nHelp: psfix ?"
- "\nWrite help to a file named \"help\": psfix ??"
- "\n"
- "\nUse: psfix infile[.ps] [outfile[.out]]"
- "\n psfix infile[.ps] [.out]"
- "\n psfix dirfile [.out]"
- "\n psfix dirfile [.ps .out]"
- "\n";
-
- char *help =
- "----------------------------------------------------------------------------"
- "\n " VERSION " " __DATE__
- "\n----------------------------------------------------------------------------"
- "\nThis software is the property of the Smithsonian Astrophysical Observatory"
- "\nand the U.S. government. It may be freely distributed under the following"
- "\nconditions:"
- "\n 1. It is distributed in its current form, without alterations."
- "\n 2. No monetary profit is made, under any circumstances."
- "\n----------------------------------------------------------------------------"
- "\n"
- "\nPsfix: Massage PostScript output from programs such as EasyFlow and "
- "\n Word Perfect to help make journeys through mainframe computers"
- "\n in an unmangled state."
- "\n"
- "\nPsfix performs the following actions:"
- "\n"
- "\n * Records are broken to 80 bytes or less, at an appropriate place"
- "\n to preserve valid PostScript commands. Psfix will fail if it"
- "\n encounters more than " M_C " consecutive non-blank characters."
- "\n"
- "\n * All comments are stripped."
- "\n"
- "\n * Lone carriage returns are replaced by a space."
- "\n"
- "\n * Tabs are replaced by a space."
- "\n"
- "\nPsfix will operate on a list of files as well as on a single specified file."
- "\n"
- "\nPlease direct comments, suggestions, or problems to"
- "\n"
- "\n Marc A. Murison"
- "\n Smithsonian Astrophysical Observatory"
- "\n 60 Garden Street, MS 63"
- "\n Cambridge, MA 02138"
- "\n"
- "\n (617) 495-7079"
- "\n murison@cfacx2.harvard.edu"
- "\n"
- "\n----------------------------------------------------------------------------"
- "\n"
- "\nTo write this text to a file named \"help\", type \"psfix ??\"."
- "\n"
- "\n----------------------------------------------------------------------------"
- "\n"
- "\nWARNING: If an output file already exists, it will be overwritten!"
- "\n"
- "\nSingle File Use:"
- "\n"
- "\n For a single input file, type either"
- "\n"
- "\n psfix infile[.ps] [outfile[.out]]"
- "\n or"
- "\n psfix infile[.ps] [.out]"
- "\n"
- "\n where [] indicates quantities which need not be typed. The"
- "\n default outfile name is the infile with \".out\" as the"
- "\n extension. You may type \".any\" in place of the outfile name,"
- "\n in which case the infile name is used with \".any\" as the"
- "\n extension."
- "\n"
- "\n For example,"
- "\n"
- "\n psfix stuff .foo"
- "\n"
- "\n will cause psfix to read input from stuff.ps and write output"
- "\n to stuff.foo, whereas"
- "\n"
- "\n psfix stuff.eps"
- "\n"
- "\n will cause psfix to read input from stuff.eps and write output"
- "\n to stuff.out. You get the idea."
- "\n"
- "\n----------------------------------------------------------------------------"
- "\n"
- "\nDirectory File Use:"
- "\n"
- "\n For a directory of input files, type"
- "\n"
- "\n psfix dirfile [.out]"
- "\n or"
- "\n psfix dirfile [.ps .out]"
- "\n"
- "\n where dirfile contains the word DIRECTORY (case ignored) as the"
- "\n first word on the first line in the file, followed by input file"
- "\n names, one per line. File extensions are not neccessary and will"
- "\n be ignored if present. "
- "\n"
- "\n In addition, the result of a DOS dir, sorted or not, will be"
- "\n understood without need of any editing. For example, the file"
- "\n tmp.dat, created by either"
- "\n"
- "\n dir *.ps > tmp.dat"
- "\n or"
- "\n dir *.ps | sort > tmp.dat"
- "\n"
- "\n will work fine, even though \"DIRECTORY\" is not the first word."
- "\n"
- "\n The default output file extension is \".out\". If another"
- "\n is desired, it must be specified after dirfile on the"
- "\n command line. Likewise, the default input file extension"
- "\n is \".ps\". If another is desired, *both* the input and"
- "\n the output extensions must be specified after dirfile, as"
- "\n shown above. Thus, the DOS sequence"
- "\n"
- "\n dir *.eps > tmp.dat"
- "\n"
- "\n psfix tmp.dat .eps .foo"
- "\n"
- "\n will process all *.eps files in the current directory, putting"
- "\n the resulting output into the files *.foo."
- "\n"
- "\n"
- "\n * * * * * End of Help * * * * *"
- "\n";
-
-
-
-
-