Changeset 3444

Show
Ignore:
Timestamp:
08/08/07 16:32:17 (1 year ago)
Author:
tg
Message:

first cut at the parser data types

thanks to bsiegert@mbsd for discussing the algorithms and data types used
and providing useful information

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/common-nfo/tools/nfotiser/Makefile

    r3443 r3444  
    3535                categories.c \ 
    3636                dbscheme.S \ 
     37                pfile.c \ 
     38                parser.c \ 
    3739                main.c 
    3840 
     
    6769dbscheme.o: dbscheme.S mknfodb.sql 
    6870categories.o: nfotiser.h 
     71parser.o: nfotiser.h 
     72pfile.o: extern.h nfotiser.h 
  • branches/common-nfo/tools/nfotiser/extern.h

    r3443 r3444  
    1414#include "nfotiser.h" 
    1515 
    16 /* categories.c */ 
    17 extern const struct categories categories[]; 
    18 const char *category(const char *); 
     16__BEGIN_DECLS 
    1917/* dbscheme.S */ 
    2018extern const char dbscheme[]; 
     19__END_DECLS 
    2120 
    2221#endif 
  • branches/common-nfo/tools/nfotiser/nfotiser.h

    r3443 r3444  
    1010#define NFOTISER_NFOTISER_H 
    1111 
     12#include <sys/queue.h> 
     13 
    1214struct categories { 
    1315        const char *catname; 
     
    1517}; 
    1618 
     19enum parser_kwtype { 
     20        KWT_NORMAL, 
     21        KWT_MULTI, 
     22        KWT_ITERATED, 
     23        KWT_MULTITER 
     24}; 
     25 
     26enum parser_argtype { 
     27        ARGT_STRING, 
     28        ARGT_INTEGER 
     29}; 
     30 
     31#ifndef parser_kwords 
     32#define parser_kwords   int 
    1733#endif 
     34 
     35struct parser_keywords { 
     36        const char *kwprefix; 
     37        parser_kwords kwnum; 
     38        enum parser_kwtype kwtype; 
     39        enum parser_argtype argtype; 
     40}; 
     41 
     42struct parser_res { 
     43        CIRCLEQ_ENTRY(parser_res) e; 
     44        parser_kwords keyword; 
     45        char *kw_multi; 
     46        unsigned kw_iter; 
     47        char *value; 
     48}; 
     49 
     50CIRCLEQ_HEAD(parser_result, parser_res); 
     51 
     52__BEGIN_DECLS 
     53/* categories.c */ 
     54extern const struct categories categories[]; 
     55const char *category(const char *); 
     56/* parser.c */ 
     57struct parser_result *nfo_parse(int fd); 
     58__END_DECLS 
     59 
     60#endif