import source from 1.3.40
[external/swig.git] / Source / Swig / swigtree.h
1 /* ----------------------------------------------------------------------------- 
2  * See the LICENSE file for information on copyright, usage and redistribution
3  * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4  *
5  * swigtree.h
6  *
7  * These functions are used to access and manipulate the SWIG parse tree.
8  * The structure of this tree is modeled directly after XML-DOM.  The attribute 
9  * and function names are meant to be similar.
10  * ----------------------------------------------------------------------------- */
11
12 /* $Id: swig.h 9622 2006-12-19 03:49:17Z beazley $ */
13
14 /* Macros to traverse the DOM tree */
15
16 #define  nodeType(x)               Getattr(x,"nodeType")
17 #define  parentNode(x)             Getattr(x,"parentNode")
18 #define  previousSibling(x)        Getattr(x,"previousSibling")
19 #define  nextSibling(x)            Getattr(x,"nextSibling")
20 #define  firstChild(x)             Getattr(x,"firstChild")
21 #define  lastChild(x)              Getattr(x,"lastChild")
22
23 /* Macros to set up the DOM tree (mostly used by the parser) */
24
25 #define  set_nodeType(x,v)         Setattr(x,"nodeType",v)
26 #define  set_parentNode(x,v)       Setattr(x,"parentNode",v)
27 #define  set_previousSibling(x,v)  Setattr(x,"previousSibling",v)
28 #define  set_nextSibling(x,v)      Setattr(x,"nextSibling",v)
29 #define  set_firstChild(x,v)       Setattr(x,"firstChild",v)
30 #define  set_lastChild(x,v)        Setattr(x,"lastChild",v)
31
32 /* Utility functions */
33
34 extern int    checkAttribute(Node *obj, const_String_or_char_ptr name, const_String_or_char_ptr value);
35 extern void   appendChild(Node *node, Node *child);
36 extern void   prependChild(Node *node, Node *child);
37 extern void   removeNode(Node *node);
38 extern Node  *copyNode(Node *node);
39
40 /* Node restoration/restore functions */
41
42 extern void  Swig_require(const char *ns, Node *node, ...);
43 extern void  Swig_save(const char *ns, Node *node, ...);
44 extern void  Swig_restore(Node *node);
45
46 /* Debugging of parse trees */
47
48 extern void Swig_print_tags(File *obj, Node *root);
49 extern void Swig_print_tree(Node *obj);
50 extern void Swig_print_node(Node *obj);