alec

Abstraction Layer for Escape Codes
git clone git://git.dimitrijedobrota.com/alec.git
Log | Files | Refs | README | LICENSE

generator.h (1082B)


      1 #ifndef ALEC_PARSER_H
      2 #define ALEC_PARSER_H
      3 
      4 #include <stdio.h>
      5 #include <stdlib.h>
      6 #include <string.h>
      7 
      8 extern int yylineno;
      9 void yyerror(char *s, ...);
     10 
     11 typedef struct node node_t;
     12 typedef struct list list_t;
     13 typedef struct record record_t;
     14 
     15 struct node {
     16     char *data;
     17     node_t *next;
     18 };
     19 
     20 struct list {
     21     node_t *head;
     22     node_t *tail;
     23 };
     24 
     25 struct record {
     26     char *name;
     27     list_t *args;
     28     list_t *rules;
     29     list_t *recipe;
     30 };
     31 
     32 typedef void (*free_f)(void *);
     33 typedef int (*cmp_f)(const void *, const void *);
     34 
     35 int scmp(const void *a, const void *b);
     36 
     37 node_t *node_new(char *data);
     38 
     39 list_t *list_new(char *data);
     40 void list_free(list_t *l, free_f free_data);
     41 void list_append(list_t *l, node_t *n);
     42 
     43 int list_find(list_t *l, void *data, cmp_f cmp);
     44 
     45 struct record *record_new(char *name, list_t *args, list_t *rules, list_t *recipe);
     46 void record_free(void *rp);
     47 
     48 void record_dupes(list_t *d, list_t *l);
     49 
     50 void record_print_template(const struct record *r, int dup);
     51 void record_print_function(const struct record *r);
     52 void record_print_dupes(const list_t *l);
     53 
     54 #endif