"Fossies" - the Fresh Open Source Software Archive

Member "ctok.h" (9 May 1995, 1693 Bytes) of package /linux/misc/old/cpost.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*------------------------------------------------------------------
    2  * ctok : C language tokenizer
    3  *------------------------------------------------------------------
    4  * 10-01-91 originally by Patrick J. Mueller
    5  *------------------------------------------------------------------*/
    6 
    7 /*------------------------------------------------------------------
    8  * define
    9  *------------------------------------------------------------------*/
   10 #define MAX_IDENT_LEN  255
   11 #define MAX_OPER_LEN     3
   12 
   13 /*------------------------------------------------------------------
   14  * typedefs
   15  *------------------------------------------------------------------*/
   16 #define TOKEN_EOF            0           /* end of file             */
   17 #define TOKEN_IDENT          1           /* identifier              */
   18 #define TOKEN_NUMBER         2           /* number                  */
   19 #define TOKEN_STRING         3           /* char or string constant */
   20 #define TOKEN_PREPROC        4           /* preprocessor            */
   21 #define TOKEN_COMMENT        5           /* comment                 */
   22 #define TOKEN_OPER           6           /* operator                */
   23 
   24 typedef struct
   25    {
   26    int            type;
   27    unsigned long  offs;
   28    unsigned long  len;
   29    unsigned long  line;
   30    char          *ident;
   31    } Token;
   32 
   33 typedef unsigned long (*CTokRead)(
   34    void  *readInfo,
   35    char **buffer
   36    );
   37 
   38 /*------------------------------------------------------------------
   39  * prototypes
   40  *------------------------------------------------------------------*/
   41 void *CTokInit(
   42    CTokRead  readFunc,
   43    void     *readInfo
   44    );
   45 
   46 void CTokTerm(
   47    void *handle
   48    );
   49 
   50 void CTokGet(
   51    void     *handle,
   52    Token    *token
   53    );