*** empty log message ***

This commit is contained in:
cvs
2002-06-10 12:45:24 +00:00
parent 0daef05b2e
commit 267d16908a
20 changed files with 863 additions and 538 deletions

View File

@@ -28,32 +28,44 @@ int CocGetVar(const char *name, StrBuf *buf, int separator);
get a variable named <name> of variable list <varList> from the buffer <buf>
*/
void CocHdl(int (*handler)(int, void *));
char *CocReadVars(char *str, char stop);
/*
read variables from the string str until a word starts with the stop character
the string has the form [ whitespace var=value ] whitespace stop-character
any text between an exclamation character and the next line break is treated as comment
*/
void CocHdl(int (*handler)(int, void *, int));
/*
define handler for last defined item
*/
int *CocSizePtr(void);
/*
get size pointer from last defined item (only valid when an array)
*/
void *CocIntPtr(int *ptr);
void *CocFltPtr(float *ptr);
void *CocChrPtr(char *ptr);
void *CocDefVar(const char *name, void *var, int type, int access);
void *CocDefVar(const char *name, void *var, int type, int size, int access);
void CocDefVarS(const char *name, const char *tname, void *var, int type);
/*
Define variables. Call this routines not directly, but through
one of the macros below.
*/
#define CocDefInt(V,A) CocDefVar(#V,CocIntPtr(&V),COC_INT,A)
#define CocDefFlt(V,A) CocDefVar(#V,CocFltPtr(&V),COC_FLT,A)
#define CocDefStr(V,A) CocDefVar(#V,CocChrPtr(V),sizeof(V),A)
#define CocDefPtr(V,S) CocDefVarS(#V,#S,&V,(V!=(S *)NULL,COC_PTR));
#define CocDefStruct(V,S) CocDefVarS(#V,#S,&V,(&V!=(S *)NULL,COC_STRUCT));
#define CocIntFld(S,V,A) CocDefVar(#S":"#V,CocIntPtr(&((S *)NULL)->V),COC_INT,A);
#define CocFltFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(&((S *)NULL)->V),COC_FLT,A);
#define CocStrFld(S,V,A) CocDefVar(#S":"#V,CocChrPtr(((S *)NULL)->V),sizeof(((S *)NULL)->V),A);
#define CocDefCmd(V) CocDefVar("$",V,sizeof(V),0)
#define CocDefStrPtr(V,S,A) CocDefVar(#V,V,S,A)
#define CocAlias(A,V) CocDefVar(#A, #V, COC_ALIAS,0);
#define CocDefInt(V,A) CocDefVar(#V,CocIntPtr(&V),COC_INT,0,A)
#define CocDefFlt(V,A) CocDefVar(#V,CocFltPtr(&V),COC_FLT,0,A)
#define CocDefStr(V,A) CocDefVar(#V,CocChrPtr(V),COC_CHAR,sizeof(V),A)
#define CocDefArr(V,A) CocDefVar(#V,CocFltPtr(V),COC_ARRAY,sizeof(V)/sizeof(float),A)
#define CocDefPtr(V,S) CocDefVarS(#V,#S,&V,(V!=(S *)NULL,0,COC_PTR));
#define CocDefStruct(V,S) CocDefVarS(#V,#S,&V,(&V!=(S *)NULL,0,COC_STRUCT));
#define CocIntFld(S,V,A) CocDefVar(#S":"#V,CocIntPtr(&((S *)NULL)->V),COC_INT,0,A);
#define CocFltFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(&((S *)NULL)->V),COC_FLT,0,A);
#define CocStrFld(S,V,A) CocDefVar(#S":"#V,CocChrPtr(((S *)NULL)->V),COC_CHAR,sizeof(((S *)NULL)->V),A);
#define CocArrFld(S,V,A) CocDefVar(#S":"#V,CocFltPtr(((S *)NULL)->V),COC_FLT,sizeof(((S *)NULL)->V)/sizeof(float),A);
#define CocAlias(A,V) CocDefVar(#A, #V, COC_ALIAS,0,0);
#define COC_RDONLY 3
#define COC_RDWR 2
@@ -65,12 +77,14 @@ void CocDefVarS(const char *name, const char *tname, void *var, int type);
#define COC_DRD 4
#define COC_SHOW 5
#define COC_INT -1
#define COC_FLT -2
#define COC_PTR -3
#define COC_STRUCT -4
#define COC_TYPE -5
#define COC_ALIAS -6
#define COC_CHAR 1
#define COC_INT 2
#define COC_FLT 3
#define COC_ARRAY 4
#define COC_PTR 5
#define COC_STRUCT 6
#define COC_TYPE 7
#define COC_ALIAS 8
int CocInitServer(void *(*setDataRtn)(void *), int port);