- support for dynamic objects

This commit is contained in:
zolliker
2008-02-13 09:54:57 +00:00
parent f723000564
commit 5ee27af961
4 changed files with 127 additions and 24 deletions

View File

@ -13,6 +13,8 @@
#include "dynstring.h"
#include "macro.h"
#include "sicshipadaba.h"
#include "initializer.h"
#include "splitter.h"
extern int decodeSICSPriv(char *txt); /* from access.c */
/*--------------------------------------------------------------------------*/
@ -55,8 +57,9 @@ void KillSICSOBJ(void *data){
if(self == NULL){
return;
}
RemoveHdbNodeFromParent(self->objectNode, pServ->dummyCon);
if(self->pDes != NULL){
DeleteDescriptor(self->pDes);
DeleteDescriptor(self->pDes); /* kill descriptor including node */
}
if(self->KillPrivate != NULL && self->pPrivate != NULL){
self->KillPrivate(self->pPrivate);
@ -249,16 +252,40 @@ pSICSOBJ SetupSICSOBJ(SConnection *pCon,SicsInterp *pSics, void *pData,
int argc, char *argv[]){
pSICSOBJ pNew = NULL;
int status;
int type;
int priv;
if(argc < 3){
SCWrite(pCon,"ERROR: not enough arguments to InstallSICSOBJ",eError);
return NULL;
}
pNew = MakeSICSOBJ(argv[1], argv[2]);
if (argc < 5) {
type = HIPNONE;
priv = usInternal;
} else {
/* convert privilege */
priv = decodeSICSPriv(argv[3]);
/* convert datatype */
strtolower(argv[4]);
type = convertHdbType(argv[4]);
if(type > HIPFLOAT){
SCWrite(pCon,
"ERROR: invalid type requested: none, int, float supported",
eError);
return 0;
}
}
pNew = MakeSICSOBJv(argv[1], argv[2], type, priv);
if(pNew == NULL){
SCWrite(pCon,"ERROR: out of memory creating new SICS object",eError);
return NULL;
}
if (strcasecmp(argv[0],"DynSicsObj") == 0) {
/* save creation command */
pNew->pDes->creationCommand = Arg2Tcl(argc, argv, NULL, -1);
}
status = AddCommand(pSics,
argv[1],
InvokeSICSOBJ,