home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / utilities / print / aroff / sources / aroff.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-28  |  3.9 KB  |  154 lines

  1. #ifndef AZTEC_C
  2.  
  3. #include <stdio.h>
  4. #include <sys/types.h>
  5. #include <ctype.h>
  6. #include <time.h>
  7. #include <string.h>
  8. #include <fcntl.h>
  9.  
  10. #endif
  11.  
  12. /**** Definitions des constantes ***/
  13.  
  14. #define LGMAXNDF 255
  15. #define LGMAXBUF 512
  16. #define LGMAXSTR 255
  17.  
  18. #define IM_FILLING 0x01     /* filling on */
  19. #define IM_RDMACRO 0x02     /* defining macro */
  20. #define IM_EXMACRO 0x04     /* executing macro */
  21. #define IM_RDARGS  0x08     /* reading args. of request */
  22. #define IM_TRANSP  0x10     /* transparent mode */
  23. #define IM_STRING  0x20     /* inserting string */
  24.  
  25. #define AM_BOTH    1        /* mode d'ajustement */
  26. #define AM_RIGHT   2
  27. #define AM_LEFT    3
  28. #define AM_CENTER  4
  29.  
  30. #define DEF_LINLEN 80        /* valeurs par defaut */
  31. #define DEF_PAGLEN 66
  32. #define DEF_TITLEN 80
  33. #define DEF_INDENT 0
  34. #define DEF_PAGNUM 1
  35. #define DEF_LINSPC 1
  36. #define DEF_PAGOFS 0
  37. #define DEF_TABLEN 8
  38. #define DEF_TABCHR ' '
  39. #define DEF_LINNUM 1
  40. #define DEF_PILE   256
  41.  
  42. #define F_WASBS    0x0001    /* prev. char. was '\'   */
  43. #define F_WASNL    0x0002    /* prev. char. was '\n'  */
  44. #define F_SKIPEOL  0x0004    /* ignore until EOL     */
  45. #define F_NOBRK    0x0008    /* desactive do_br()     */
  46. #define F_NEWPAR   0x0010    /* new section (2 \n)    */
  47. #define F_NOTI       0x0020    /* derniere req != "ti"  */
  48. #define F_BREAKED  0x0040    /* ligne "cassee" (.br)  */
  49. #define F_NUMBER   0x0080    /* numerote les lignes     */
  50. #define F_MACREQ   0x0100    /* exec requete/macro     */
  51. #define F_TRAP       0x0200    /* trappe declanchee     */
  52. #define F_SORTIE   0x0400    /* au moins 1 lig sortie */
  53. #define F_CONTINUE 0x0800    /* continue et non break */
  54.  
  55. #define SC_IGNORE  '\001'
  56. #define SC_FIXSPC  '\002'
  57. #define SC_EXPAND  '\003'
  58.  
  59. #define ERR_PILEV    1    /* pile vide           */
  60. #define ERR_PILEP    2    /* pile pleine           */
  61. #define ERR_SYNTAX    3    /* erreur de syntaxe   */
  62. #define ERR_OVERFLOW    4    /* debordement table   */
  63. #define ERR_OPEN    5    /* err. ouverture fic. */
  64. #define ERR_ARGS    6    /* args. incorrects    */
  65. #define ERR_WRITE    7    /* erreur en ecriture  */
  66. #define ERR_MEMORY    8    /* plus de memoire     */
  67.  
  68. #define BSET( f , b ) f |= b
  69. #define BCLR( f , b ) f &= ~b
  70. #define Fatal( c ) FatalError( c , __LINE__ , __FILE__ )
  71.  
  72. /*****************************************************************/
  73.  
  74. struct Noeud
  75. {
  76.   struct Noeud *el_Suivant ;
  77.   struct Noeud *el_Precedant ;
  78. } ;
  79.  
  80. struct TeteListe
  81. {
  82.   struct Noeud *tl_Premier ;
  83.   struct Noeud *tl_Dernier ;
  84.   long        tl_NbrElem ;
  85. } ;
  86.  
  87. /************************************************************************/
  88.  
  89. struct MLine
  90. {
  91.   struct Noeud    ml_Node ;        /* ptr ligne suiv. */
  92.   long        ml_Len ;        /* taille ligne    */
  93.   unsigned char ml_Text[LGMAXSTR] ;    /* ligne elle-meme */
  94. } ;
  95.  
  96. struct Macro
  97. {
  98.   struct Noeud       m_Node ;    /* ptr macro suivante */
  99.   char           m_Name[3] ;    /* nom de cette macro */
  100.   long           m_Flag ;    /* indicateurs divers */
  101.   struct TeteListe m_Def ;    /* tete liste lignes  */
  102.   struct MLine      *m_NextL ;    /* ptr ligne a lire   */
  103.   long           m_NextC ;    /* ptr caract. a lire */
  104.   long           m_NbArg ;    /* nombre d'arguments */
  105.   unsigned char    m_Arg[10][LGMAXSTR+1] ;   /* args. */
  106. } ;
  107.  
  108. #define MF_TRAP 0x01    /* appele par une trappe */
  109. #define MF_WAIT 0x02    /* a une ligne en attente */
  110.  
  111. struct InputFile
  112. {
  113.   struct Noeud    if_Node ;        /* ptr fichier suivant */
  114.   char        if_Name[LGMAXNDF+1] ;    /* nom de ce fichier   */
  115.   int        if_Desc ;        /* retourne par open() */
  116.   unsigned char if_Buf[LGMAXBUF+1] ;    /* tampon de lecture   */
  117.   long        if_BufLen ;        /* nb de car. ds ifBuf */
  118.   long        if_NextC ;        /* ptr caract. a lire  */
  119.   long        if_Line ;        /* no ligne courante   */
  120.   long        if_Flag ;        /* indicateurs           */
  121. } ;
  122.  
  123. #define IFF_STDIN 0x01    /* fichier = entree standard */
  124.  
  125. struct Command
  126. {
  127.   char *c_name ;
  128.   void (*c_func)() ;
  129. } ;
  130.  
  131. struct String
  132. {
  133.   long s_pos ;
  134.   long s_len ;
  135.   char s_val[LGMAXSTR+1] ;
  136. } ;
  137.  
  138. struct Contexte
  139. {
  140.   union
  141.   {
  142.     struct InputFile c_file ;
  143.     struct Macro     c_macro ;
  144.     struct String    c_string ;
  145.   } src ;
  146.   long           c_ptr  ;
  147.   long           c_len  ;
  148.   char           c_obuf[LGMAXBUF] ;
  149.   long           c_seek ;
  150.   long           c_olen ;
  151.   long           c_imod ;
  152.   long           c_flag ;
  153. } ;
  154.