- Adapted indenation to new agreed upon system

- Added support for second generation scriptcontext based counter
This commit is contained in:
koennecke
2009-02-13 09:00:03 +00:00
parent a3dcad2bfa
commit 91d4af0541
405 changed files with 88101 additions and 88173 deletions

View File

@ -49,71 +49,72 @@
typedef void voidFunc(void);
typedef struct __hdbValue {
int dataType;
int arrayLength;
int doNotFree;
union __value {
int intValue;
double doubleValue;
char *text;
int *intArray;
double *floatArray;
voidFunc *func;
void *obj;
}v;
}hdbValue;
int dataType;
int arrayLength;
int doNotFree;
union __value {
int intValue;
double doubleValue;
char *text;
int *intArray;
double *floatArray;
voidFunc *func;
void *obj;
} v;
} hdbValue;
/*------------------------------------------------------------------------------*/
typedef struct __hipadaba {
int magic;
struct __hipadaba *mama;
struct __hipadaba *child;
struct __hipadaba *next;
struct __hdbcallback *callBackChain;
char *name;
hdbValue value;
int protected;
pStringDict properties;
}Hdb, *pHdb;
int magic;
struct __hipadaba *mama;
struct __hipadaba *child;
struct __hipadaba *next;
struct __hdbcallback *callBackChain;
char *name;
hdbValue value;
int protected;
pStringDict properties;
} Hdb, *pHdb;
/*-------------- return values for callback functions -------------------------*/
typedef enum {hdbContinue,
hdbAbort,
hdbKill } hdbCallbackReturn;
typedef enum { hdbContinue,
hdbAbort,
hdbKill
} hdbCallbackReturn;
/*======================== Messages ===========================================*/
typedef struct __hdbMessage {
char *type;
char *type;
} hdbMessage, *pHdbMessage;
/*-----------------------------------------------------------------------------*/
typedef struct {
char *type;
hdbValue *v;
void *callData;
}hdbDataMessage, *pHdbDataMessage;
char *type;
hdbValue *v;
void *callData;
} hdbDataMessage, *pHdbDataMessage;
/*-------------------------------------------------------------------------------*/
typedef struct {
char *type;
void *callData;
}hdbTreeChangeMessage, *pHdbTreeChangeMessage;
char *type;
void *callData;
} hdbTreeChangeMessage, *pHdbTreeChangeMessage;
/*-------------------------------------------------------------------------------*/
typedef struct {
char *type;
void *testPtr;
void *result;
}hdbDataSearch, *pHdbDataSearch;
char *type;
void *testPtr;
void *result;
} hdbDataSearch, *pHdbDataSearch;
/*-------------------------------------------------------------------------------*/
typedef hdbCallbackReturn (*hdbCallbackFunction)(pHdb currentNode,
void *userData,
pHdbMessage message);
typedef hdbCallbackReturn(*hdbCallbackFunction) (pHdb currentNode,
void *userData,
pHdbMessage message);
typedef void (*killUserData)(void *data);
typedef void (*killUserData) (void *data);
/*-------------------------------------------------------------------------------*/
typedef struct __hdbcallback {
void *userData;
killUserData killFunc;
hdbCallbackFunction userCallback;
int killFlag;
struct __hdbcallback *next;
struct __hdbcallback *previous;
}hdbCallback, *pHdbCallback;
void *userData;
killUserData killFunc;
hdbCallbackFunction userCallback;
int killFlag;
struct __hdbcallback *next;
struct __hdbcallback *previous;
} hdbCallback, *pHdbCallback;
/*============= Message Test Functions ==========================================*/
/**
* Test a message if it is a set message
@ -162,7 +163,7 @@ pHdbMessage GetHdbKillNodeMessage(pHdbMessage toTest);
* @param datatype The datatype of the hdbValue
* @param length The array length of the hdbValue
* @return a suitably defined hdbValue
*/
*/
hdbValue makeHdbValue(int datatype, int length);
/**
* wrap an integer as an hdbValue
@ -194,7 +195,7 @@ hdbValue MakeHdbText(char *initText);
* data points to dynamically allocated memory.
* @return: A properly initialized hdbValue structure
*/
hdbValue MakeHdbIntArray(int length, int *data);
hdbValue MakeHdbIntArray(int length, int *data);
/**
* wrap a float array as an hdbValue
* @param length The length of the int array
@ -204,13 +205,13 @@ hdbValue MakeHdbIntArray(int length, int *data);
* data points to dynamically allocated memory.
* @return: A properly initialized hdbValue structure
*/
hdbValue MakeHdbFloatArray(int length, double *data);
hdbValue MakeHdbFloatArray(int length, double *data);
/**
* wrap a function as an hdbValue
* @param func the function
* @return: A properly initialized hdbValue structure
*/
hdbValue MakeHdbFunc(voidFunc *func);
hdbValue MakeHdbFunc(voidFunc * func);
/**
* wrap an object as an hdbValue
* @param obj the object
@ -222,14 +223,14 @@ hdbValue MakeHdbObj(void *obj);
* @param v The hdbValue to check for dynamic memory allocation to be
* released.
*/
void ReleaseHdbValue(hdbValue *v);
void ReleaseHdbValue(hdbValue * v);
/**
* copy a hipadaba value field. Takes care of memory allocation
* @param source The hdbValue to copy from
* @param target The hdbValue to copy to.
* @return 1 on success, 0 when out of memory or when type mismatch
*/
int copyHdbValue(hdbValue *source, hdbValue *target);
int copyHdbValue(hdbValue * source, hdbValue * target);
/**
* compares two hdbValues for identity
* @param v1 The first hdbValue
@ -245,7 +246,7 @@ int compareHdbValue(hdbValue v1, hdbValue v2);
* @param clone the target hdbValue structure
* @return 1 on success, 0 on when out of memory
*/
int cloneHdbValue(hdbValue *source, hdbValue *clone);
int cloneHdbValue(hdbValue * source, hdbValue * clone);
/**
* get the length of the hdbValue in bytes.
* @param v The hdbValue to calculate the length for
@ -259,7 +260,7 @@ int getHdbValueLength(hdbValue v);
* @param datatype The datatype of the new node
* @param length the array length
* @return a new node or NULL when out of memory
*/
*/
pHdb MakeHipadabaNode(char *name, int datatype, int length);
/**
* add a child to a node at the end of the child list.
@ -267,7 +268,7 @@ pHdb MakeHipadabaNode(char *name, int datatype, int length);
* @param child The node to add
* @param callData User data for the tree chnage callback. Can be NULL.
*/
void AddHipadabaChild(pHdb parent, pHdb child, void *callData);
void AddHipadabaChild(pHdb parent, pHdb child, void *callData);
/**
* Delete only the node data, without invoking any callbacks
* @param node The node to delete.
@ -291,14 +292,14 @@ int isHdbNodeValid(pHdb node);
* @param root The node where to start the search for the node
* @param path The unix path string for the node relative to parent
* @return The desired node or NULL when no such node exists
*/
*/
pHdb GetHipadabaNode(pHdb root, char *path);
/**
* given a node, return the full path name to the node
* @param node The node to get the path for
* @return The full path to the node. This is dynamically allocated memory;
* the caller is reponsible for deleting it. Can be NULL when out of memory.
*/
*/
char *GetHipadabaPath(pHdb node);
/**
* removes a node from the parents child list.
@ -321,21 +322,21 @@ int CountHdbChildren(pHdb node);
* not be invoked
* @return A new suitabaly initialised callback structure or NULL when required elements
* are missing or there is nor memory.
*/
pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
void *userData, killUserData killFunc);
*/
pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
void *userData, killUserData killFunc);
/**
* add a callback at the end of the callback chain
* @param node The node to which to append the callback
* @param newCB The callback to append
*/
void AppendHipadabaCallback(pHdb node,pHdbCallback newCB);
void AppendHipadabaCallback(pHdb node, pHdbCallback newCB);
/**
* add a callback at the head of the callback chain
* @param node The node to which to append the callback
* @param newCB The callback prepend
*/
void PrependHipadabaCallback(pHdb node,pHdbCallback newCB);
void PrependHipadabaCallback(pHdb node, pHdbCallback newCB);
/**
* find the callback data
* @param node the node from where callbacks have to be searched
@ -371,7 +372,7 @@ void RecurseCallbackChains(pHdb node, pHdbMessage message);
* @param v The new value for the node
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, 1 on success
*/
*/
int SetHipadabaPar(pHdb node, hdbValue v, void *callData);
/**
* Update a hipadaba parameter. This is an internal update of a parameter,
@ -380,7 +381,7 @@ int SetHipadabaPar(pHdb node, hdbValue v, void *callData);
* @param v The new value for the node
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, 1 on success
*/
*/
int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData);
/**
* notify any update listeners that this node has been internally modifed.
@ -388,7 +389,7 @@ int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData);
* @param callData Addtional data for the callback
* @return 1 on success, 0 on failure
*/
int NotifyHipadabaPar(pHdb node,void *callData);
int NotifyHipadabaPar(pHdb node, void *callData);
/**
* Read a hipadaba parameter
@ -396,16 +397,17 @@ int NotifyHipadabaPar(pHdb node,void *callData);
* @param v The read value for the node
* @param callData Additonal context data to be passed to the callback functions
* @return 0 on failure, 1 on success
*/
int GetHipadabaPar(pHdb node, hdbValue *v, void *callData);
*/
int GetHipadabaPar(pHdb node, hdbValue * v, void *callData);
/*================================ Property Interface ==============================================*/
/**
* set a property
* Set or delete a property
* @param node The node to set the property for
* @param key The key for the property
* @param value The value of the property
* @param value The value of the property. If this is NULL, the
* property is deleted.
*/
void SetHdbProperty(pHdb node, char *key, char *value);
void SetHdbProperty(pHdb node, char *key, char *value);
/**
* get the value of a property
* @param node The node to get the property from
@ -414,7 +416,7 @@ int GetHipadabaPar(pHdb node, hdbValue *v, void *callData);
* @param len The length of value
* @return 0 on failure, 1 on success
*/
int GetHdbProperty(pHdb node, char *key, char *value, int len);
int GetHdbProperty(pHdb node, char *key, char *value, int len);
/**
* get the value of a property
* @param node The node to get the property from
@ -422,11 +424,11 @@ int GetHipadabaPar(pHdb node, hdbValue *v, void *callData);
* @return the property or NULL on failure. Warning: the string is
* only valid as long as the property has not changed
*/
char *GetHdbProp(pHdb node, char *key);
char *GetHdbProp(pHdb node, char *key);
/**
* initialize a property scan on this node
* @param node The node for which to scan properties
*/
*/
void InitHdbPropertySearch(pHdb node);
/**
* get the next property in a search
@ -434,6 +436,6 @@ void InitHdbPropertySearch(pHdb node);
* @param value An area where to copy the value of the property
* @param len The length of value
* @return The key of the property or NULL when the property list is exhausted
*/
const char *GetNextHdbProperty(pHdb node, char *value ,int len);
*/
const char *GetNextHdbProperty(pHdb node, char *value, int len);
#endif