Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

node.c File Reference

#include "mit-copyright.h"
#include "node.h"

Go to the source code of this file.

Data Structures

struct  _bunch_of_nodes

Defines

#define NODE_BATCH_SIZE   100

Functions

void node_DestroyAllNodes ()
Nodenode_create_string_constant (int opcode, string text)
Nodenode_create_noary (int opcode)
Nodenode_create_unary (int opcode, Node *arg)
Nodenode_create_binary (int opcode, Node *first_arg, Node *second_arg)
Nodereverse_list_of_nodes (Node *list)


Define Documentation

#define NODE_BATCH_SIZE   100
 

Definition at line 23 of file node.c.

Referenced by node_DestroyAllNodes().


Function Documentation

Node* node_create_binary int  opcode,
Node first_arg,
Node second_arg
 

Definition at line 160 of file node.c.

References _Node::d, _Node::first, Node, _Node::nodes, and _Node::second.

00164 {
00165         Node *n;
00166 
00167         n = node_create(opcode);
00168         n->d.nodes.first = first_arg;
00169         n->d.nodes.second = second_arg;
00170         return (n);
00171 }

Node* node_create_noary int  opcode  ) 
 

Definition at line 138 of file node.c.

References Node.

00140 {
00141         Node *n;
00142 
00143         n = node_create(opcode);
00144         return (n);
00145 }

Node* node_create_string_constant int  opcode,
string  text
 

Definition at line 126 of file node.c.

References _Node::d, Node, and _Node::string_constant.

00129 {
00130         Node *n;
00131 
00132         n = node_create(opcode);
00133         n->d.string_constant = text;
00134         return (n);
00135 }

Node* node_create_unary int  opcode,
Node arg
 

Definition at line 148 of file node.c.

References _Node::d, _Node::first, Node, and _Node::nodes.

00151 {
00152         Node *n;
00153 
00154         n = node_create(opcode);
00155         n->d.nodes.first = arg;
00156         return (n);
00157 }

void node_DestroyAllNodes  ) 
 

Definition at line 95 of file node.c.

References NODE_BATCH_SIZE.

Referenced by parse_buffer(), and parse_file().

00096 {
00097         struct _bunch_of_nodes *next_bunch;
00098         int i, last_node_used_in_this_bunch;
00099 
00100         while (nodes) {
00101                 next_bunch = nodes->next_bunch;
00102                 last_node_used_in_this_bunch = next_bunch ?
00103                         NODE_BATCH_SIZE - 1 : last_node_in_current_bunch_used;
00104                 for (i = 0; i <= last_node_used_in_this_bunch; i++) {
00105                         if (nodes->nodes[i].opcode == STRING_CONSTANT_OPCODE)
00106                                 free(nodes->nodes[i].d.string_constant);
00107                         else if (nodes->nodes[i].opcode == VARREF_OPCODE)
00108                                 free(nodes->nodes[i].d.string_constant);
00109                         else if (nodes->nodes[i].opcode == VARNAME_OPCODE)
00110                                 free(nodes->nodes[i].d.string_constant);
00111                 }
00112                 free(nodes);
00113                 nodes = next_bunch;
00114         }
00115 
00116         current_bunch = nodes;
00117 }

Node* reverse_list_of_nodes Node list  ) 
 

Definition at line 189 of file node.c.

References _Node::next, and Node.

00191 {
00192         Node *next_node;
00193         Node *head = NULL;
00194 
00195         while (list) {
00196                 next_node = list->next;
00197 
00198                 /*
00199                  * Add the node list to the beginning of linked list head:
00200                  */
00201                 list->next = head;
00202                 head = list;
00203 
00204                 list = next_node;
00205         }
00206 
00207         return (head);
00208 }



Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo

Source Perspective by Fisheye