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

treeconf_int.h File Reference


Detailed Description

For internal use only.

This file contains the various structures, macros, and function declarations used internally by the library.

Definition in file treeconf_int.h.

#include <stdlib.h>
#include "tc_config.h"
#include "treeconf_err.h"
#include "treeconf_version.h"
#include "treeconf.h"

Include dependency graph for treeconf_int.h:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  result
 Node lookup results. More...

Defines

#define __TREECONF_LIBRARY__
 Library sentinel.
#define __attribute__(A)
 GCC attribute declarator.
#define RCSTAG(tag)
 Embed RCS revision information.
#define TC_BUFSIZE
 Buffer size for tc_load().
#define TC_NAMSIZE
 Variable name size for tc_load().
#define _tn_call_nodown(parent, name, elements)
 Call nodown callback.
#define _tn_call_change(node)
 Call change callback.
#define _tc_doerror(e)
 Jump to error handling code.
#define _tc_release_node(node)
 Release a specific node.

Functions

unsigned int _tc_lookup_node (treeconf_ctx_t *ctx, const char *name, treeconf_node_t *node, struct result *res)
 Node look-up helper function.
treeconf_node_t_tc_create_node (treeconf_ctx_t *ctx, treeconf_node_t *parent, treeconf_type_t type, const char *name, int len, const char *def, treeconf_nodown_t nodown, treeconf_change_t change, void *assoc)
 Create a node.
void _tc_release_children (treeconf_node_t *node)
 Release a node's children.


Define Documentation

#define __attribute__  ) 
 

For internal use only.

GCC allows attributes to be attached to functions, variables, etc. We are particularly interested in the unused attribute, which is used to prevent a warning from the declaration of rcsid in the RCSTAG() macro. However, not all compilers understand __attribute__(), so this macro is defined to be empty if the compiler does not understand it.

Definition at line 63 of file treeconf_int.h.

#define __TREECONF_LIBRARY__
 

For internal use only.

This macro signals to the public header files that they are being used by the library itself. This is mostly used to control inclusions.

Definition at line 38 of file treeconf_int.h.

#define _tc_doerror  ) 
 

For internal use only.

This macro simply sets the err variable (assumed to be in scope) to e, then jumps to the error handling code (labeled by error). This construct showed up enough that it was worth it to simplify it in this way.

Parameters:
e The error code to assign to the err variable.

Definition at line 136 of file treeconf_int.h.

Referenced by tc_find(), tc_load(), tc_register(), and tc_set().

#define _tc_release_node node   ) 
 

For internal use only.

This macro releases all memory associated with a given node, including that of all the node's children (if any).

Parameters:
node A pointer to a treeconf_node_t specifying the node to release.

Definition at line 150 of file treeconf_int.h.

Referenced by _tc_release_children(), and tc_destroy().

#define _tn_call_change node   ) 
 

For internal use only.

This macro calls the change callback function if one has been declared.

Parameters:
node A pointer to a treeconf_node_t specifying the node that has been changed.

Definition at line 121 of file treeconf_int.h.

Referenced by _tc_set(), and tc_register().

#define _tn_call_nodown parent,
name,
elements   ) 
 

For internal use only.

This macro takes care of calling the nodown callback function (see the documentation for treeconf_nodown_t). If no nodown function was declared, this macro will simply return 0.

Parameters:
parent A pointer to a treeconf_node_t specifying the immediate parent of the named node.
name A pointer to a treeconf_str_t containing the remaining name elements for the given node.
elements An integer giving the number of name elements.
Returns:
Boolean true if the node should be created, false otherwise.

Definition at line 108 of file treeconf_int.h.

Referenced by tc_find(), and tc_set().

#define RCSTAG tag   ) 
 

For internal use only.

Embeds the tag (a string including the RCS Id tag) into the binary. This can be useful when tracking down version skew issues.

Definition at line 73 of file treeconf_int.h.

#define TC_BUFSIZE
 

For internal use only.

This is the buffer size used for extracting data from a configuration file by tc_load().

Definition at line 81 of file treeconf_int.h.

#define TC_NAMSIZE
 

For internal use only.

This is the buffer size used for variable names by tc_load().

Definition at line 88 of file treeconf_int.h.


Function Documentation

treeconf_node_t* _tc_create_node treeconf_ctx_t ctx,
treeconf_node_t parent,
treeconf_type_t  type,
const char *  name,
int  len,
const char *  def,
treeconf_nodown_t  nodown,
treeconf_change_t  change,
void *  assoc
 

For internal use only.

This function creates a node with a given set of characteristics.

Parameters:
ctx A pointer to a treeconf_ctx_t.
parent The parent of the node to be created.
type The type of node to create.
name The name of the node (as opposed to variable) to create.
len The length of the node name.
def The default value of the node, or NULL to create an internal node.
nodown A treeconf_nodown_t designating the nodown callback for the node.
change A treeconf_change_t designating the change callback for the node.
assoc A pointer to void designating application-specific association data for the node.
Returns:
A pointer to the newly-created and initialized node.

Definition at line 82 of file _tc_node.c.

References _treeconf_node_s::tn_assoc, _treeconf_node_s::tn_change, _treeconf_node_s::tn_context, _treeconf_node_s::tn_default, _treeconf_node_s::tn_down, _treeconf_node_s::tn_magic, _treeconf_node_s::tn_name, _treeconf_node_s::tn_next, _treeconf_node_s::tn_nodown, _treeconf_node_s::tn_parent, _treeconf_node_s::tn_type, _treeconf_node_s::tn_value, treeconf_ctx_t, treeconf_node_t, _treeconf_ctx_s::tx_config, and _treeconf_ctx_s::tx_count.

Referenced by tc_find(), tc_register(), and tc_set().

unsigned int _tc_lookup_node treeconf_ctx_t ctx,
const char *  name,
treeconf_node_t node,
struct result res
 

For internal use only.

This helper function looks up the node named by name (relative to the parent node) in the configuration stored in the ctx. The result of the lookup is stored in the result structure.

Parameters:
ctx A pointer to a treeconf_ctx_t designating the configuration tree.
name The name of the node to look up.
node A pointer to a treeconf_node_t indicating the starting point for the search.
[out] res A pointer to the result structure to load with the results of the node lookup.
Return values:
ENOENT The named node cannot exist.
ENOMEM Unable to allocate memory.

Definition at line 55 of file _tc_lookup_node.c.

References result::r_comps, result::r_count, result::r_node, result::r_startnew, tc_break(), _treeconf_node_s::tn_down, tn_name, _treeconf_node_s::tn_next, tn_type, treeconf_ctx_t, treeconf_node_t, _treeconf_str_s::ts_length, _treeconf_str_s::ts_string, and tx_config.

Referenced by tc_find(), tc_get(), tc_register(), and tc_set().

Here is the call graph for this function:

void _tc_release_children treeconf_node_t node  ) 
 

For internal use only.

This function walks through the list of children for the given node, releasing all memory allocated for them.

Parameters:
node A pointer to a treeconf_node_t designating the node to release the children of.

Definition at line 45 of file _tc_node.c.

References _tc_release_node, _treeconf_node_s::tn_down, _treeconf_node_s::tn_next, and treeconf_node_t.

Referenced by tc_register(), and tc_set().


Generated on Wed Jun 8 09:18:37 2005 for treeconf by  doxygen 1.3.9.1