home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / source / driver / util / parsef.h < prev    next >
C/C++ Source or Header  |  1992-11-27  |  2KB  |  82 lines

  1. #define ARG_MAXLINE    256    /* configuration file max. linelength    */
  2. #define ARG_STRING_SIZE    50    /* one single argument length        */
  3. #define MAX_KEY_LEN    14    /* max. keyword length            */
  4. #define MAX_FORMAT_LEN    50    /* max. format string length        */
  5.  
  6. typedef void __stdargs (* string_parse_function)(struct string_parse *, char *line, ...) ;
  7.  
  8. struct string_parse {
  9.     char    *paf_keyword;    /*    keyword to match    */
  10.     char    *paf_format;    /*    format string        */
  11. #if 0
  12.     void (*paf_function)(char *keyword, char *line, long arg1, long arg2, long arg3);
  13. #else
  14.     string_parse_function paf_function;
  15. #endif
  16.     long     paf_flags;    /*    flags see below        */
  17.     long     paf_userdata;    /*    ?            */
  18. };
  19.  
  20. #define PAF_NO_ARG    1
  21. #define PAF_1_ARG    2
  22. #define PAF_2_ARGS    3
  23. #define PAF_3_ARGS    4
  24. #define PAF_ARGS    7    /* function deals with arg(s)        */
  25. #define PAF_BOOL_ARG    8    /* You have to set PAF_1_ARG too    */
  26. #define PAF_NOKEY    16
  27.  
  28. extern int Parse_Linenr;    /* current line number in file        */
  29. extern int Parse_Control;
  30.  
  31. #define PAC_END        1    /* force an exit            */
  32. #define PAC_END_UNKNOWN 2    /* stop if unknown keyword        */
  33. #define PAC_WARNING    4    /* use Warning() instead of Message()    */
  34. #define PAC_END_SEARCH    8    /* only PAF_NOKEY: stop parsing this line */
  35.  
  36. /* Functions are called with :
  37.  
  38.    PAF_BOOL_ARG :
  39.     (struct string_parse *actual,
  40.      char *line_of_file,
  41.      int 1 if on, 0 otherwise);
  42.  
  43.    PAF_NO_1_2_3_ARG(S) :
  44.     (struct string_parse *actual,
  45.      char *line_of_file,
  46.      arg1, arg2, arg3);
  47.  
  48.    PAF_ARGS :
  49.     #ifdef USE_PAFARGS
  50.     (struct string_parse *actual,
  51.      char *line_of_file,
  52.      arg1, arg2, arg3);
  53.     #else        keyword is still in line_of_file
  54.     (struct string_parse *actual,
  55.      char *line_of_file);
  56.     #endif
  57.  
  58.    PAF_NO_KEY :        kind of demon, I can imagine some stuff
  59.     (struct string_parse *actual,
  60.      char *line_of_file);
  61. */
  62.  
  63. /*#define USE_PAFARGS*/
  64.  
  65. /* #Define USE_PAFARGS if in the PAF_ARGS case you *want* your
  66. functions to have the format string scanned and be called with
  67. _no_more_ than 3 (three) parameters. Otherwise, the paf_format format
  68. string is free to be used by your functions, and your functions are
  69. called with no other parameter. (see below) */
  70.  
  71. #if 0
  72. #define PARSE_INTS    1    /*    returns array of ints    */
  73. #define PARSE_PSTRING    2    /*    returns printer string    */
  74. #endif
  75.  
  76. /* normally, parse_line() returns after a matching keyword has been found,
  77. this can be disabled in a PAF_NO_KEY function case if the called function
  78. sets the var below. This can be used to accelerate reading or to disable
  79. options. */
  80.  
  81. extern int keep_parse_line;
  82.