API cleanup. Documentation.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9629 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2006-12-30 18:27:47 +00:00
commit 264b7dff90
26 changed files with 712 additions and 373 deletions

View file

@ -147,12 +147,12 @@ void appendChild(Node *node, Node *chd) {
}
/* -----------------------------------------------------------------------------
* preppendChild()
* prependChild()
*
* Preppends a new child to a node
* Prepends a new child to a node
* ----------------------------------------------------------------------------- */
void preppendChild(Node *node, Node *chd) {
void prependChild(Node *node, Node *chd) {
Node *fc;
if (!chd)
@ -171,17 +171,19 @@ void preppendChild(Node *node, Node *chd) {
}
/* -----------------------------------------------------------------------------
* deleteNode()
* removeNode()
*
* Deletes a node.
* Removes a node from the parse tree. Detaches it from its parent's child list.
* ----------------------------------------------------------------------------- */
void deleteNode(Node *n) {
void removeNode(Node *n) {
Node *parent;
Node *prev;
Node *next;
parent = parentNode(n);
if (!parent) return;
prev = previousSibling(n);
next = nextSibling(n);
if (prev) {
@ -198,6 +200,11 @@ void deleteNode(Node *n) {
set_lastChild(parent, prev);
}
}
/* Delete attributes */
Delattr(n,"parentNode");
Delattr(n,"nextSibling");
Delattr(n,"prevSibling");
}
/* -----------------------------------------------------------------------------
@ -219,21 +226,6 @@ Node *copyNode(Node *n) {
return c;
}
/* -----------------------------------------------------------------------------
* Swig_tag_nodes()
*
* Tags a collection of nodes with an attribute. Used by the parser to mark
* subtypes with extra information.
* ----------------------------------------------------------------------------- */
void Swig_tag_nodes(Node *n, const String_or_char *attrname, DOH *value) {
while (n) {
Setattr(n, attrname, value);
Swig_tag_nodes(firstChild(n), attrname, value);
n = nextSibling(n);
}
}
/* -----------------------------------------------------------------------------
* checkAttribute()
* ----------------------------------------------------------------------------- */
@ -257,7 +249,7 @@ int checkAttribute(Node *n, const String_or_char *name, const String_or_char *va
* This function can be called more than once with different namespaces.
* ----------------------------------------------------------------------------- */
int Swig_require(const char *ns, Node *n, ...) {
void Swig_require(const char *ns, Node *n, ...) {
va_list ap;
char *name;
DOH *obj;
@ -292,18 +284,16 @@ int Swig_require(const char *ns, Node *n, ...) {
/* Save the view */
{
String *view = Getattr(n, k_view);
String *view = Getattr(n, "view");
if (view) {
if (Strcmp(view, ns) != 0) {
Setattr(n, NewStringf("%s:view", ns), view);
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
} else {
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
}
return 1;
}
@ -313,7 +303,7 @@ int Swig_require(const char *ns, Node *n, ...) {
* are saved, ie behaves as if all the attribute names were prefixed by ?.
* ----------------------------------------------------------------------------- */
int Swig_save(const char *ns, Node *n, ...) {
void Swig_save(const char *ns, Node *n, ...) {
va_list ap;
char *name;
DOH *obj;
@ -340,18 +330,16 @@ int Swig_save(const char *ns, Node *n, ...) {
/* Save the view */
{
String *view = Getattr(n, k_view);
String *view = Getattr(n, "view");
if (view) {
if (Strcmp(view, ns) != 0) {
Setattr(n, NewStringf("%s:view", ns), view);
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
} else {
Setattr(n, k_view, ns);
Setattr(n, "view", ns);
}
}
return 1;
}
/* -----------------------------------------------------------------------------
@ -366,7 +354,7 @@ void Swig_restore(Node *n) {
String *ns;
Iterator ki;
ns = Getattr(n, k_view);
ns = Getattr(n, "view");
assert(ns);
l = NewList();