*** empty log message ***

This commit is contained in:
zolliker
2008-03-03 14:44:30 +00:00
parent 921c46d213
commit 33c0b7dcaa

View File

@ -1064,8 +1064,7 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, SConnection *p
pHdb parent = NULL; pHdb parent = NULL;
char *name; char *name;
char *slash; char *slash;
CommandList *pCom; pObjectDescriptor pDes;
pDummy pDum;
int iret; int iret;
if (relpath[0] == '/' || rootpath == NULL) { /* absolute path */ if (relpath[0] == '/' || rootpath == NULL) { /* absolute path */
@ -1083,17 +1082,12 @@ pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, SConnection *p
slash = strchr(element+6, '/'); slash = strchr(element+6, '/');
if (slash != NULL) *slash = '\0'; /* split off object name */ if (slash != NULL) *slash = '\0'; /* split off object name */
pCom = FindCommand(pServ->pSics, element); pDes = FindCommandDescriptor(pServ->pSics, element);
if (pCom == NULL) { if (pDes == NULL) {
SCPrintf(pCon, eError, "ERROR: object %s not found", element); SCPrintf(pCon, eError, "ERROR: object %s not found", element);
return NULL; return NULL;
} }
pDum = pCom->pData; node = pDes->parNode;
if (pDum == NULL) {
SCPrintf(pCon, eError, "ERROR: object %s has no data", element);
return NULL;
}
node = pDum->pDescriptor->parNode;
if (node == NULL) { if (node == NULL) {
SCPrintf(pCon, eError, "ERROR: object %s does not use hipadaba", element); SCPrintf(pCon, eError, "ERROR: object %s does not use hipadaba", element);
return NULL; return NULL;
@ -1164,8 +1158,7 @@ int GetHdbPath(pHdb nodeArg, char *path, size_t pathlen) {
pHdb node, parent; pHdb node, parent;
int len, pos, l; int len, pos, l;
static char *sics="/sics"; static char *sics="/sics";
CommandList *pCom; pObjectDescriptor pDes;
pDummy pDum;
path[0]='\0'; path[0]='\0';
if (nodeArg == NULL) { if (nodeArg == NULL) {
@ -1182,12 +1175,11 @@ int GetHdbPath(pHdb nodeArg, char *path, size_t pathlen) {
/* check root and add prefix */ /* check root and add prefix */
if (parent->mama != root) { /* not anchored in root */ if (parent->mama != root) { /* not anchored in root */
pCom = FindCommand(pServ->pSics, parent->name); pDes = FindCommandDescriptor(pServ->pSics, parent->name);
if (!pCom) { if (!pDes) {
return 0; /* not a sics object */ return 0; /* not a sics object */
} }
pDum = pCom->pData; if (pDes->parNode != parent) {
if (pDum->pDescriptor->parNode != parent) {
/* node named as a sics object, but command is not related to node */ /* node named as a sics object, but command is not related to node */
return 0; return 0;
} }
@ -1595,7 +1587,7 @@ int readHdbValue(hdbValue *v, char *data, char *error, int errlen){
double dValue; double dValue;
char number[80]; char number[80];
char *pPtr = NULL; char *pPtr = NULL;
CommandList *pCom = NULL; void *objData;
switch(v->dataType){ switch(v->dataType){
case HIPNONE: case HIPNONE:
@ -1669,12 +1661,12 @@ int readHdbValue(hdbValue *v, char *data, char *error, int errlen){
} }
break; break;
case HIPOBJ: case HIPOBJ:
pCom = FindCommand(pServ->pSics,data); objData = FindCommandData(pServ->pSics,data,NULL);
if(pCom == NULL && pCom->pData != NULL){ if(objData == NULL){
snprintf(error,errlen,"object %s NOT found", data); snprintf(error,errlen,"object %s NOT found", data);
return 0; return 0;
} }
v->v.obj = pCom->pData; v->v.obj = objData;
break; break;
case HIPFUNC: case HIPFUNC:
break; break;
@ -2449,9 +2441,7 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]){ int argc, char *argv[]){
pHdb node = NULL; pHdb node = NULL;
char buffer[256]; char buffer[256];
CommandList *pCom = NULL; pObjectDescriptor pDes = NULL;
pDummy pDum = NULL;
if(argc < 3) { if(argc < 3) {
SCWrite(pCon,"ERROR: need path and object name to link", SCWrite(pCon,"ERROR: need path and object name to link",
@ -2469,14 +2459,13 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
return 0; return 0;
} }
pCom = FindCommand(pSics,argv[2]); pDes = FindCommandDescriptor(pSics,argv[2]);
if(pCom == NULL){ if(pDes == NULL){
snprintf(buffer,255,"ERROR: failed to find object %s", argv[2]); snprintf(buffer,255,"ERROR: failed to find object %s", argv[2]);
SCWrite(pCon,buffer,eError); SCWrite(pCon,buffer,eError);
return 0; return 0;
} }
pDum = pCom->pData; if(pDes->parNode == NULL){
if(pDum == NULL || pDum->pDescriptor->parNode == NULL){
snprintf(buffer,255, snprintf(buffer,255,
"ERROR: Object %s does not use Hipadaba natively and thus cannot be linked", "ERROR: Object %s does not use Hipadaba natively and thus cannot be linked",
argv[2]); argv[2]);
@ -2484,7 +2473,7 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
return 0; return 0;
} }
if(pDum->pDescriptor->parNode->mama != NULL){ if(pDes->parNode->mama != NULL){
snprintf(buffer,255, snprintf(buffer,255,
"ERROR: Object %s is already linked somewhere else", "ERROR: Object %s is already linked somewhere else",
argv[2]); argv[2]);
@ -2492,13 +2481,13 @@ static int LinkHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
return 0; return 0;
} }
AddHipadabaChild(node,pDum->pDescriptor->parNode,pCon); AddHipadabaChild(node,pDes->parNode,pCon);
if(argc > 3){ if(argc > 3){
if(pDum->pDescriptor->parNode->name != NULL){ if(pDes->parNode->name != NULL){
free(pDum->pDescriptor->parNode->name); free(pDes->parNode->name);
} }
pDum->pDescriptor->parNode->name = strdup(argv[3]); pDes->parNode->name = strdup(argv[3]);
} }
SCSendOK(pCon); SCSendOK(pCon);