nsgenbind
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
nsgenbind-ast.h File Reference

Go to the source code of this file.

Typedefs

typedef int() genbind_callback_t(struct genbind_node *node, void *ctx)
 

Enumerations

enum  genbind_node_type {
  GENBIND_NODE_TYPE_ROOT = 0 , GENBIND_NODE_TYPE_IDENT , GENBIND_NODE_TYPE_NAME , GENBIND_NODE_TYPE_MODIFIER ,
  GENBIND_NODE_TYPE_CDATA , GENBIND_NODE_TYPE_STRING , GENBIND_NODE_TYPE_LINE , GENBIND_NODE_TYPE_FILE ,
  GENBIND_NODE_TYPE_BINDING , GENBIND_NODE_TYPE_WEBIDL , GENBIND_NODE_TYPE_CLASS , GENBIND_NODE_TYPE_PRIVATE ,
  GENBIND_NODE_TYPE_INTERNAL , GENBIND_NODE_TYPE_PROPERTY , GENBIND_NODE_TYPE_FLAGS , GENBIND_NODE_TYPE_METHOD ,
  GENBIND_NODE_TYPE_METHOD_TYPE , GENBIND_NODE_TYPE_PARAMETER
}
 
enum  genbind_type_modifier { GENBIND_TYPE_NONE = 0 , GENBIND_TYPE_TYPE = 1 , GENBIND_TYPE_UNSHARED = 2 , GENBIND_TYPE_TYPE_UNSHARED = 3 }
 
enum  genbind_method_type {
  GENBIND_METHOD_TYPE_INIT = 0 , GENBIND_METHOD_TYPE_FINI , GENBIND_METHOD_TYPE_METHOD , GENBIND_METHOD_TYPE_GETTER ,
  GENBIND_METHOD_TYPE_SETTER , GENBIND_METHOD_TYPE_PROTOTYPE , GENBIND_METHOD_TYPE_PREFACE , GENBIND_METHOD_TYPE_PROLOGUE ,
  GENBIND_METHOD_TYPE_EPILOGUE , GENBIND_METHOD_TYPE_POSTFACE
}
 

Functions

int genbind_fprintf (FILE *stream, const char *format,...)
 
int genbind_cmp_node_type (struct genbind_node *node, void *ctx)
 
FILE * genbindopen (const char *filename)
 
int genbind_parsefile (char *infilename, struct genbind_node **ast)
 
char * genbind_strapp (char *a, char *b)
 
struct genbind_nodegenbind_new_node (enum genbind_node_type type, struct genbind_node *l, void *r)
 
struct genbind_nodegenbind_new_number_node (enum genbind_node_type type, struct genbind_node *l, int number)
 
struct genbind_nodegenbind_node_link (struct genbind_node *tgt, struct genbind_node *src)
 
struct genbind_nodegenbind_node_prepend (struct genbind_node *list, struct genbind_node *inst)
 
struct genbind_nodegenbind_node_add (struct genbind_node *node, struct genbind_node *list)
 
int genbind_dump_ast (struct genbind_node *node)
 
struct genbind_nodegenbind_node_find (struct genbind_node *node, struct genbind_node *prev, genbind_callback_t *cb, void *ctx)
 
struct genbind_nodegenbind_node_find_type (struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type nodetype)
 
int genbind_node_enumerate_type (struct genbind_node *node, enum genbind_node_type type)
 
struct genbind_nodegenbind_node_find_type_ident (struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type nodetype, const char *ident)
 
struct genbind_nodegenbind_node_find_method (struct genbind_node *node, struct genbind_node *prev, enum genbind_method_type methodtype)
 
struct genbind_nodegenbind_node_find_method_ident (struct genbind_node *node, struct genbind_node *prev, enum genbind_method_type methodtype, const char *ident)
 
int genbind_node_foreach_type (struct genbind_node *node, enum genbind_node_type type, genbind_callback_t *cb, void *ctx)
 
struct genbind_nodegenbind_node_getnode (struct genbind_node *node)
 
char * genbind_node_gettext (struct genbind_node *node)
 
int * genbind_node_getint (struct genbind_node *node)
 

Typedef Documentation

◆ genbind_callback_t

typedef int() genbind_callback_t(struct genbind_node *node, void *ctx)

callback for search and iteration routines

Definition at line 62 of file nsgenbind-ast.h.

Enumeration Type Documentation

◆ genbind_method_type

Enumerator
GENBIND_METHOD_TYPE_INIT 

method is initialiser

GENBIND_METHOD_TYPE_FINI 

method is finalizer

GENBIND_METHOD_TYPE_METHOD 

method is a method

GENBIND_METHOD_TYPE_GETTER 

method is a getter

GENBIND_METHOD_TYPE_SETTER 

method is a setter

GENBIND_METHOD_TYPE_PROTOTYPE 

method is a prototype

GENBIND_METHOD_TYPE_PREFACE 

method is a preface

GENBIND_METHOD_TYPE_PROLOGUE 

method is a prologue

GENBIND_METHOD_TYPE_EPILOGUE 

method is a epilogue

GENBIND_METHOD_TYPE_POSTFACE 

method is a postface

Definition at line 46 of file nsgenbind-ast.h.

◆ genbind_node_type

Enumerator
GENBIND_NODE_TYPE_ROOT 
GENBIND_NODE_TYPE_IDENT 

generic identifier string

GENBIND_NODE_TYPE_NAME 

generic type string

GENBIND_NODE_TYPE_MODIFIER 

node modifier

GENBIND_NODE_TYPE_CDATA 

verbatim block of character data

GENBIND_NODE_TYPE_STRING 

text string

GENBIND_NODE_TYPE_LINE 

linenumber

GENBIND_NODE_TYPE_FILE 

file name

GENBIND_NODE_TYPE_BINDING 

Binding

GENBIND_NODE_TYPE_WEBIDL 
GENBIND_NODE_TYPE_CLASS 

class definition

GENBIND_NODE_TYPE_PRIVATE 
GENBIND_NODE_TYPE_INTERNAL 
GENBIND_NODE_TYPE_PROPERTY 
GENBIND_NODE_TYPE_FLAGS 
GENBIND_NODE_TYPE_METHOD 

binding method

GENBIND_NODE_TYPE_METHOD_TYPE 

binding method type

GENBIND_NODE_TYPE_PARAMETER 

method parameter

Definition at line 12 of file nsgenbind-ast.h.

◆ genbind_type_modifier

Enumerator
GENBIND_TYPE_NONE 
GENBIND_TYPE_TYPE 

identifies a type handler

GENBIND_TYPE_UNSHARED 

unshared item

GENBIND_TYPE_TYPE_UNSHARED 

identifies a unshared type handler

Definition at line 38 of file nsgenbind-ast.h.

Function Documentation

◆ genbind_cmp_node_type()

int genbind_cmp_node_type ( struct genbind_node node,
void *  ctx 
)

Definition at line 341 of file nsgenbind-ast.c.

◆ genbind_dump_ast()

int genbind_dump_ast ( struct genbind_node node)

Dump the binding AST to file

If the debug flag has been set this causes the binding AST to be written to a binding-ast output file

Parameters
nodeNode of the tree to start dumping from (usually tree root)
Returns
0 on sucess or non zero on faliure and error message printed.

Definition at line 496 of file nsgenbind-ast.c.

◆ genbind_fprintf()

int genbind_fprintf ( FILE *  stream,
const char *  format,
  ... 
)

Definition at line 621 of file nsgenbind-ast.c.

◆ genbind_new_node()

struct genbind_node * genbind_new_node ( enum genbind_node_type  type,
struct genbind_node l,
void *  r 
)

create a new node with value from pointer

Definition at line 125 of file nsgenbind-ast.c.

◆ genbind_new_number_node()

struct genbind_node * genbind_new_number_node ( enum genbind_node_type  type,
struct genbind_node l,
int  number 
)

create a new number node

Create a node with of number type

Definition at line 136 of file nsgenbind-ast.c.

◆ genbind_node_add()

struct genbind_node * genbind_node_add ( struct genbind_node node,
struct genbind_node list 
)

Definition at line 73 of file nsgenbind-ast.c.

◆ genbind_node_enumerate_type()

int genbind_node_enumerate_type ( struct genbind_node node,
enum genbind_node_type  type 
)

count how many nodes of a specified type.

Enumerate how many nodes of the specified type there are by performing a depth first search for nodes of the given type and counting the number of results.

Parameters
nodeThe node to start the search from
nodetypeThe type of node to count
Returns
The number of nodes found.

Definition at line 183 of file nsgenbind-ast.c.

◆ genbind_node_find()

struct genbind_node * genbind_node_find ( struct genbind_node node,
struct genbind_node prev,
genbind_callback_t cb,
void *  ctx 
)

Depth first left hand search using user provided comparison

Parameters
nodeThe node to start the search from
prevThe node at which to stop the search, either NULL to search the full tree depth (initial search) or the result of a previous search to continue.
cbComparison callback
ctxContext for callback

Definition at line 196 of file nsgenbind-ast.c.

◆ genbind_node_find_method()

struct genbind_node * genbind_node_find_method ( struct genbind_node node,
struct genbind_node prev,
enum genbind_method_type  methodtype 
)

Find a method node of a given method type

Parameters
nodeA node of type GENBIND_NODE_TYPE_CLASS to search for methods.
prevThe node at which to stop the search, either NULL to search the full tree depth (initial search) or the result of a previous search to continue.
methodtypeThe type of method to find.
Returns
A node of type GENBIND_NODE_TYPE_METHOD on success or NULL on faliure

Definition at line 279 of file nsgenbind-ast.c.

◆ genbind_node_find_method_ident()

struct genbind_node * genbind_node_find_method_ident ( struct genbind_node node,
struct genbind_node prev,
enum genbind_method_type  methodtype,
const char *  ident 
)

Find a method node of a given method type and identifier

Parameters
nodeA node of type GENBIND_NODE_TYPE_CLASS to search for methods.
prevThe node at which to stop the search, either NULL to search the full tree depth (initial search) or the result of a previous search to continue.
methodtypeThe type of method to find.
identThe identifier to search for
Returns
A node of type GENBIND_NODE_TYPE_METHOD on success or NULL on faliure

Definition at line 312 of file nsgenbind-ast.c.

◆ genbind_node_find_type()

struct genbind_node * genbind_node_find_type ( struct genbind_node node,
struct genbind_node prev,
enum genbind_node_type  nodetype 
)

Depth first left hand search returning nodes of the specified type

Parameters
nodeThe node to start the search from
prevThe node at which to stop the search, either NULL to search the full tree depth (initial search) or the result of a previous search to continue.
nodetypeThe type of node to seach for
Returns
The found node or NULL for no nodes.

Definition at line 223 of file nsgenbind-ast.c.

◆ genbind_node_find_type_ident()

struct genbind_node * genbind_node_find_type_ident ( struct genbind_node node,
struct genbind_node prev,
enum genbind_node_type  nodetype,
const char *  ident 
)

Depth first left hand search returning nodes of the specified type with an ident child node with matching text

Parameters
nodeThe node to start the search from
prevThe node at which to stop the search, either NULL to search the full tree depth (initial search) or the result of a previous search to continue.
nodetypeThe type of node to seach for
identThe text to match the ident child node to

Definition at line 235 of file nsgenbind-ast.c.

◆ genbind_node_foreach_type()

int genbind_node_foreach_type ( struct genbind_node node,
enum genbind_node_type  type,
genbind_callback_t cb,
void *  ctx 
)

Iterate all nodes of a certian type from a node with a callback.

Depth first search for nodes of the given type calling the callback with context.

Parameters
nodeThe node to start the search from.

Definition at line 151 of file nsgenbind-ast.c.

◆ genbind_node_getint()

int * genbind_node_getint ( struct genbind_node node)

get a nodes integer value

Parameters
nodeThe nodes to get integer from
Returns
pointer to the node value or NULL if the node is not of type int or is empty.

Definition at line 389 of file nsgenbind-ast.c.

◆ genbind_node_getnode()

struct genbind_node * genbind_node_getnode ( struct genbind_node node)

get a nodes node list content

Parameters
nodeThe nodes to get node list from
Returns
pointer to the node list or NULL if the node does not contain a list

Definition at line 367 of file nsgenbind-ast.c.

◆ genbind_node_gettext()

char * genbind_node_gettext ( struct genbind_node node)

get a nodes text content

Parameters
nodeThe nodes to get text from
Returns
pointer to the node text or NULL if the node is not of type text or is empty.

Definition at line 348 of file nsgenbind-ast.c.

◆ genbind_node_link()

struct genbind_node * genbind_node_link ( struct genbind_node tgt,
struct genbind_node src 
)

Definition at line 117 of file nsgenbind-ast.c.

◆ genbind_node_prepend()

struct genbind_node * genbind_node_prepend ( struct genbind_node list,
struct genbind_node inst 
)

Definition at line 48 of file nsgenbind-ast.c.

◆ genbind_parsefile()

int genbind_parsefile ( char *  infilename,
struct genbind_node **  ast 
)

Definition at line 584 of file nsgenbind-ast.c.

◆ genbind_strapp()

char * genbind_strapp ( char *  a,
char *  b 
)

Definition at line 104 of file nsgenbind-ast.c.

◆ genbindopen()

FILE * genbindopen ( const char *  filename)

Definition at line 517 of file nsgenbind-ast.c.