Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

node.h File Reference

#include <stdio.h>
#include <time.h>

Include dependency graph for node.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Node
 Main Node type definition. More...

Defines

#define NODE_CHECK(x)   ((x)->code == NODE_CODE ? 1 : 0)
#define NODE_CODE   1131
#define STORAGE_TYPE   extern

Typedefs

typedef unsigned long long int uword64
typedef long long int word64

Enumerations

enum  NodeType {
  NODE_GLOBAL = 0, NODE_GENERIC = 1, NODE_PARSED_INTEGER = 2, NODE_PARSED_DOUBLE = 3,
  NODE_PARSED_DATE = 4, NODE_EXTERNAL = 5
}
 Node string literal value parsed types enumeration. More...

Functions

STORAGE_TYPE void * kml_calloc (size_t num, size_t size)
STORAGE_TYPE void kml_free (void *memblock)
STORAGE_TYPE void * kml_malloc (size_t size)
STORAGE_TYPE void * kml_realloc (void *memblock, size_t size)
STORAGE_TYPE void node_clear (Node *node)
 Clears the memory used by literal This function commonly used when the node is declared explicitly but its parts, such as prefix and literal are allocated dynamically.
STORAGE_TYPE Nodenode_clone (const Node *src)
 Copies the node.
STORAGE_TYPE int node_compare (const Node *node1, const Node *node2)
 Compares two nodes.
int node_compare_ (const Node *node1, const Node *node2)
 Not documented, for internal use only.
STORAGE_TYPE void node_free (Node *node)
 Frees the memory, allocated fro node node.
STORAGE_TYPE const char * node_get_literal (Node *node, long *literal_size)
 Get the literal part of the node.
STORAGE_TYPE void node_init_double (Node *node, double value)
 Initializes the node as a floating point value.
STORAGE_TYPE void node_init_integer (Node *node, long value)
 Initializes the node as an integer value.
STORAGE_TYPE void node_init_string (Node *node, const char *string)
 Initializes the node as a string with prefix.
void node_print (FILE *channel, Node *node)
 Prints the node on channel.
STORAGE_TYPE void node_set_instance_of (Node *node, const Node *context, const Node *instance_of)
STORAGE_TYPE void node_set_literal (Node *node, const char *literal, long literal_size)
 Sets the literal part of the node.

Variables

static Node NODE_NULL = { NODE_CODE, NODE_GLOBAL, 0, 0}


Define Documentation

#define NODE_CHECK  )     ((x)->code == NODE_CODE ? 1 : 0)
 

#define NODE_CODE   1131
 

#define STORAGE_TYPE   extern
 


Typedef Documentation

typedef unsigned long long int uword64
 

typedef long long int word64
 


Enumeration Type Documentation

enum NodeType
 

Node string literal value parsed types enumeration.

Enumerator:
NODE_GLOBAL  Global (dictionary) node that has an id-alias pair.
NODE_GENERIC  Node has a Generic (string value).
NODE_PARSED_INTEGER  Parser guesses the node literal value is integer.
NODE_PARSED_DOUBLE  Parser guesses the node literal value is double.
NODE_PARSED_DATE  Parser guesses the node literal value is date.
NODE_EXTERNAL 


Function Documentation

STORAGE_TYPE void* kml_calloc size_t  num,
size_t  size
 

STORAGE_TYPE void kml_free void *  memblock  ) 
 

STORAGE_TYPE void* kml_malloc size_t  size  ) 
 

STORAGE_TYPE void* kml_realloc void *  memblock,
size_t  size
 

STORAGE_TYPE void node_clear Node node  ) 
 

Clears the memory used by literal This function commonly used when the node is declared explicitly but its parts, such as prefix and literal are allocated dynamically.

STORAGE_TYPE Node* node_clone const Node src  ) 
 

Copies the node.

Creates the copy of the given node src.

Returns:
A pointer to an allocated Node
Note:
Needed to be freed after use.

STORAGE_TYPE int node_compare const Node node1,
const Node node2
 

Compares two nodes.

  • node1 first node to be compared
  • node2 second node to be compared
Two nodes are considered identical if and only if its its literals are equal

Returns:
zero if nodes are not equal and positive value in other case.

int node_compare_ const Node node1,
const Node node2
 

Not documented, for internal use only.

STORAGE_TYPE void node_free Node node  ) 
 

Frees the memory, allocated fro node node.

STORAGE_TYPE const char* node_get_literal Node node,
long *  literal_size
 

Get the literal part of the node.

Returns:
a pointer to the literal field of the node given. Also changes contents of the literal_size param and fills it with the actual size of the literal in case of binary and -1 in case of zero-terminated string.

STORAGE_TYPE void node_init_double Node node,
double  value
 

Initializes the node as a floating point value.

Deprecated:
prefix is no more used.
Remains for compatibility purposes only!

STORAGE_TYPE void node_init_integer Node node,
long  value
 

Initializes the node as an integer value.

Deprecated:
prefix is no more used.
Remains for compatibility purposes only!

STORAGE_TYPE void node_init_string Node node,
const char *  string
 

Initializes the node as a string with prefix.

Takes a node struct pointer node to the allocated memory and sets the literal as it would be a zero-terminated string. Also, checks if the literal represents an alias for global (NODE_GLOBAL) id or can be parsed to integer, double or other supported type. If the node cannot be parsed, the type of node becomes NODE_GENERIC.

Note:
Please note, the literal points to globally allocated string to avoid double storages and cannot be freed by hand.

void node_print FILE *  channel,
Node node
 

Prints the node on channel.

  • channel the channel node is to be printed on
  • node the node to be printed
    Note:
    Only for testing purposes

STORAGE_TYPE void node_set_instance_of Node node,
const Node context,
const Node instance_of
 

STORAGE_TYPE void node_set_literal Node node,
const char *  literal,
long  literal_size
 

Sets the literal part of the node.

the literal content is passed as literal and the literal_size is the size in bytes of the literal. literal_size may be -1 if the literal points to the zero-terminated string.

Deprecated:
since 0.2.0.
literal cannot be set directly (only through node_init_x family of methods).


Variable Documentation

Node NODE_NULL = { NODE_CODE, NODE_GLOBAL, 0, 0} [static]
 


Generated on Wed Dec 27 16:52:23 2006 for VRB Online Server by  doxygen 1.4.4