My Project
Loading...
Searching...
No Matches
pp.h File Reference

parser state More...

Go to the source code of this file.

Data Structures

struct  PPState_
 
struct  PP_
 

Typedefs

typedef struct PPState_ PPState
 
typedef struct PP_ PP
 

Enumerations

enum  pptype { pptype_file , pptype_arg , pptype_handle }
 

Functions

ANN PPStatenew_ppstate (MemPool, const char *name)
 
ANEW PPnew_pp (MemPool p, const uint size, const char *name)
 
ANN void free_pp (MemPool p, PP *pp, void *data)
 

Detailed Description

parser state

Definition in file pp.h.

Typedef Documentation

◆ PP

typedef struct PP_ PP

◆ PPState

typedef struct PPState_ PPState

Enumeration Type Documentation

◆ pptype

enum pptype
Enumerator
pptype_file 
pptype_arg 
pptype_handle 

Definition at line 8 of file pp.h.

8 {
12};
@ pptype_handle
Definition pp.h:11
@ pptype_arg
Definition pp.h:10
@ pptype_file
Definition pp.h:9

Function Documentation

◆ free_pp()

ANN void free_pp ( MemPool p,
PP * pp,
void * data )

Definition at line 38 of file pp.c.

38 {
39 pp_post(pp, data);
40 vector_release(&pp->state);
41 vector_release(&pp->global_undef);
42 hend(pp->macros);
43 mp_free(p, Hash, pp->macros);
44 vector_release(&pp->data);
45 mp_free(p, PP, pp);
46}
static void pp_post(PP *pp, void *data)
Definition pp.c:26
Definition pp.h:26
struct Hash_ * macros
Definition pp.h:28
struct Vector_ global_undef
Definition pp.h:29
struct Vector_ state
Definition pp.h:27
struct Vector_ data
Definition pp.h:31

◆ new_pp()

ANEW PP * new_pp ( MemPool p,
const uint size,
const char * name )

Definition at line 11 of file pp.c.

11 {
12 PP *pp = (PP *)mp_calloc(p, PP);
13 vector_init(&pp->data);
14 pp->macros = (Hash)mp_calloc(p, Hash);
15 hini(pp->macros, size);
16 pp->macros->p = p; // in ctor ?
17 vector_init(&pp->state);
18 vector_init(&pp->global_undef);
19 PPState *pps = new_ppstate(p, name);
20 pos_ini(&pps->loc.first);
21 pos_ini(&pps->loc.last);
22 vector_add(&pp->state, (vtype)pps);
23 return pp;
24}
ANN void pos_ini(pos_t *pos)
Definition gwlog.c:11
ANN PPState * new_ppstate(MemPool p, const char *filename)
Definition pp.c:5
Definition pp.h:14
loc_t loc
Definition pp.h:22
struct pos_t last
Definition gwlog.h:17
struct pos_t first
Definition gwlog.h:16

◆ new_ppstate()

ANN PPState * new_ppstate ( MemPool p,
const char * name )

Definition at line 5 of file pp.c.

5 {
6 PPState *ppstate = mp_calloc(p, PPState);
7 ppstate->filename = filename;
8 return ppstate;
9};
char * filename
Definition pp.h:21