/* / \ / \ |\ / \ / \ chiral software | \ / \ \ \ |\ /| /| \| \ / |/ | |\ | /| / | \|/ |/ \ | / \|/ */ /* This Dendra C implementation uses malloc() to obtain space and parses from a char array. Notes: Dendra structures obtained from the constructors, parser or dendraDup() should be freed with dendraFree(). For dendraPrint(), it is the callers responsibility to free the returned array with free(). */ #ifndef _DENDRA_H #define _DENDRA_H #define DENDRA_LONG 1 #define DENDRA_DOUBLE 2 #define DENDRA_STRING 3 #define DENDRA_SYMBOL 4 #define DENDRA_VECT 5 #define DENDRA_SENTINEL 6 typedef union DendraData { long l; double d; char *s; struct Dendra **ns; } DendraData; typedef struct Dendra { int type; long size; DendraData data; } Dendra; extern Dendra * dendraLong (long l); extern Dendra * dendraDouble (double d); extern Dendra * dendraString (char *s, long size); extern Dendra * dendrSymbol (char *s, long size); extern Dendra * dendraVect (long size); extern Dendra * dendraParse (char **buf, char *end); extern char * dendraPrint (Dendra *n, long *size); extern void dendraFree (Dendra *n); extern Dendra * dendraDup (Dendra *n); extern Dendra * dendraPair (Dendra *h, Dendra *t); #endif