home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / misc / cvt / source / cvt.h < prev    next >
C/C++ Source or Header  |  1995-03-03  |  4KB  |  163 lines

  1. /*                                                               -*- C -*-
  2.  *  CVT.H
  3.  *
  4.  *  (c)Copyright 1993 by Tobias Ferber,  All Rights Reserved
  5.  */
  6.  
  7. #ifndef CVT_H
  8. #define CVT_H
  9.  
  10. #include <ctype.h>
  11. #include <string.h>
  12. #include <stdio.h>
  13.  
  14. #define VERSION "1.6"
  15.  
  16. #ifdef __GNUC__
  17. /* suggested parentheses around assignment used as truth value */
  18. #define if(assignment) if((assignment))
  19. #endif /* __GNUC__ */
  20.  
  21. #ifndef MAXIMUM_PATHNAME_LENGTH
  22. #define MAXIMUM_PATHNAME_LENGTH  256L
  23. #endif
  24.  
  25. #define ENV_CVSCRIPTS   "CVSCRIPTS"    /* .cvt files home directory */
  26. #define CVT_EXT         ".cvt"         /* default extension for .cvt files */
  27. #define TEMPFILE_FORMAT "CVT%05ld.TMP" /* format of temporary filenames */
  28.  
  29. #if defined(AMIGA) || defined(unix)
  30. #define PSLASH     '/'     /* concatenated to pathnames if needed */
  31. #define PSEP       ','     /* seperator for pathnames in environment vars */
  32.  
  33. #elif defined(__MSDOS__)
  34. #define PSLASH     '\\'
  35. #define PSEP       ';'
  36.  
  37. #endif
  38.  
  39. #define CATSYM     ','     /* default concatenation symbol */
  40. #define RTERM      ';'     /* default conversion rule terminal symbol */
  41.  
  42. #define XHSBUFSIZE   42L   /* This value indicates the initial buffer size
  43.                             * of the lhs/rhs buffer of readcrule().
  44.                             * Each time the buffer exceeds another
  45.                             * XHSBUFSIZE bytes will be added. */
  46.  
  47. #define NIL(type) (type *)0L
  48.  
  49. typedef struct crule {  /* conversion rules: */
  50.   struct crule *next;   /* next crule with same first lhs char */
  51.   char *lhs, *rhs;      /* input text and output text */
  52.   int l,r;              /* #of chars in the above arrays */
  53.   int ln;               /* line # of this rule in the script file */
  54. } crule_t;
  55.  
  56.  
  57. typedef struct fnode {  /* filename node: */
  58.   struct fnode *next;   /* next node (command line from left to right) */
  59.   char *filename;       /* the input filename */
  60.   char *hostname;       /* where `filename' appeared, 0==command-line */
  61. } fnode_t;
  62.  
  63.  
  64. /*** / PROTOTYPES / ***/
  65.  
  66. #ifndef __P
  67.  
  68. #if defined (__STDC__) || defined(__cplusplus)
  69. #define __P(protos) protos
  70. #else /* !(__STDC__ || __cplusplus) */
  71. #define __P(protos) ()
  72. #endif /* __STDC__ || __cplusplus */
  73.  
  74. #endif /* !__P */
  75.  
  76. #if defined(__cplusplus) || defined(cplusplus)
  77. extern "C" {
  78. #endif
  79.  
  80. /* rules.c */
  81. extern crule_t *new __P( (void) );
  82. extern crule_t *dispose __P( (crule_t *) );
  83. extern int init_rules __P( (void) );
  84. extern void exit_rules __P( (void) );
  85. extern int addcrule __P( (crule_t *) );
  86.  
  87. #ifdef DEBUG
  88. extern int maxlhs __P( (void) );
  89. extern void print_crule __P( (crule_t *) );
  90. extern void dump_crules __P( (void) );
  91. #endif /* DEBUG */
  92.  
  93. /* echo.c */
  94. extern void echo __P( (const char *fmt, ...) );
  95.  
  96. /* args.c */
  97. extern char *convert_args __P( (char *) );
  98. extern void display_args __P( (void) );
  99.  
  100. /* numdigits.c */
  101. extern int numdigits __P( (int, int) );
  102.  
  103. /* tfname.c */
  104. extern char *tfname __P( (char *) );
  105.  
  106. /* flist.c */
  107. extern int chain_fname __P( (char *, char *) );
  108. extern void purge_flist __P( (void) );
  109. extern int get_fname __P( (FILE *, char *) );
  110. extern int read_flist __P( (char *) );
  111. #ifdef DEBUG
  112. extern void print_flist __P( (void) );
  113. #endif
  114.  
  115. /* cvtparse.c */
  116. extern void lerror __P( (long, const char *, ...) );
  117. extern crule_t *readcrule __P( (FILE *) );
  118.  
  119. #ifdef _DCC /* DICE */
  120. /* getenv.c */
  121. extern char *getenv __P( (const char *) );
  122. #endif
  123.  
  124. /* cvt.c */
  125. extern FILE *cvtopen __P( (char *) );
  126. extern int parsefile __P( (FILE *) );
  127. extern void putrhs __P( (crule_t *) );
  128. extern void takeiteasy __P( (void) );
  129. extern int dothehardpart __P( (void) );
  130.  
  131. #if defined(__cplusplus) || defined(cplusplus)
  132. }
  133. #endif /* C++ */
  134.  
  135.  
  136. /*** / GLOBALS / ***/
  137.  
  138. /* flist.c */
  139. extern fnode_t *flist;
  140. extern int global_numfiles;
  141.  
  142. /* rules.c */
  143. extern crule_t **crules;
  144. extern long global_numrules;
  145. extern int global_maxlhs;
  146.  
  147. /* main.c */
  148. extern int global_numchars;
  149. extern int global_maxhexdigits;
  150. extern int global_maxoctdigits;
  151. extern int global_numerrors;
  152. extern int global_maxerrors;
  153. extern int global_checkexists;
  154.  
  155. extern char *whoami;
  156. extern FILE *fin, *fout, *ferr;
  157.  
  158. #ifdef DEBUG
  159. extern int debuglevel;  /* main.c */
  160. #endif
  161.  
  162. #endif /* !CVT_H */
  163.