ref: 47a288683dbdc55c5df9b9f65db9909de6021af0
dir: /libxpath/dat.h/
typedef struct Name Name;
struct Name {
char *name;
int quoted;
Name *next;
};
Name* addname(char *);
typedef struct Func Func;
typedef struct Node Node;
typedef struct Cond Cond;
enum {
Nroot = 0, /* ^/ */
Nstring, /* 'bla' */
Nnumber, /* 234 */
Nchild, /* child:: */
Nattribute, /* attribute:: */
Nfunction, /* name() */
Ndescself, /* descendant-or-self:: */
NEND,
};
struct Node {
Name *name; /* name of node */
int type; /* type of node */
int number;
Cond *cond; /* conditions */
Func *func; /* function */
Node *chain; /* next node in chain */
Node *next;
};
struct Func {
Name *name;
void (*f)(XpResult*, Elem*);
Func *next;
};
enum {
CTand = 0,
CTor,
CTindex,
CTeq,
CTattr,
CThasattr,
};
struct Cond {
int type;
int index;
Name *attr;
Name *value;
Cond *a;
Cond *b;
Node *anode;
Node *bnode;
Cond *next;
};
void debugprintnodes(Node*);
Node* parsexpath(char*);
Cond* addcondb(int, Cond*, Cond*);
Cond* addcondi(int);
Cond* addcondattr(Name*, Name*);
Cond* addcondhasattr(Name*);
Cond* addcondcnode(int, Node*, Node*);
Node* addnode(Name*, int, Cond*);
Node* addnoden(int, Cond*);
Node* chainnode(Node*, Node*);
Func* findfunc(Name*);
Func* addfunc(Name*, void (*f)(XpResult*, Elem*));
void initfuncs(void);
void buildsinglestring(XpResult*, char*);
void buildsingleelem(XpResult*, Elem*);
void buildsinglenum(XpResult*, int);
typedef struct Mbuf Mbuf;
struct Mbuf {
void *ptr;
Mbuf *next;
};
void regmbuf(void*);
int position(Elem*);
int last(Elem*);