- added stuff for ease/pardef

This commit is contained in:
zolliker
2005-09-05 08:07:57 +00:00
parent e83353d722
commit f5bb7d6366
3 changed files with 140 additions and 0 deletions

49
strobj.c Normal file
View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------
strobj.c
a string object based on pardef, logging is on by default
Markus Zolliker, March 2005
----------------------------------------------------------------------------
*/
#include <stdio.h>
#include "sics.h"
#include "pardef.h"
#include "initializer.h"
typedef struct {
ParData p;
char *str;
} StrObj;
static ParClass strObjClass = { "string", sizeof(StrObj) };
/*----------------------------------------------------------------------------*/
static void StrObjParDef(void *object) {
StrObj *so = ParCast(&strObjClass, object);
ParName("");
ParAccess(usUser);
ParSave(1);
ParList(NULL);
ParStr(&so->str, NULL);
}
/*----------------------------------------------------------------------------*/
static int StrObjInit(SConnection *con, int argc, char *argv[], int dynamic) {
StrObj *so = NULL;
char *creationCmd = NULL;
if (dynamic) {
creationCmd = ParArg2Text(argc, argv, NULL, 0);
}
so = ParMake(con, argv[1], &strObjClass, StrObjParDef, creationCmd);
if (so) {
so->str = NULL;
}
return so != NULL;
}
/*----------------------------------------------------------------------------*/
void StrObjStartup(void) {
ParMakeClass(&strObjClass, NULL);
MakeDriver("string", StrObjInit, 0);
}