- Added support for accessing the exe file management functions from scripts

- Fixed a bug in hmdata.c
- Fixed an issue with tempoerature writing through RemObjects in mesure
- Added auxiliary reflections to tasub
- Make maximize use soft motor positions
This commit is contained in:
koennecke
2006-11-24 15:51:19 +00:00
parent f15cb4c6db
commit 0825c48986
24 changed files with 328 additions and 253 deletions

View File

@ -175,6 +175,43 @@ static pDynString locateBatchBuffer(pExeMan self, char *name){
DeleteDynString(result);
return NULL;
}
/*-------------------------------------------------------------------
* Generate a full path name for the argument in the first
* directory of batch path
* -------------------------------------------------------------------*/
static int makeExePath(pExeMan self, SConnection *pCon, int argc, char *argv[]){
char buffer[512], *pPtr = NULL, pPath[132];
if(argc < 3) {
SCWrite(pCon,"ERROR: require a file name for makepath",eError);
return 0;
}
strcpy(buffer,"exe.makepath = ");
/*
* do nothing to absolute path
*/
if(argv[2][0] == '/'){
strncat(buffer,argv[2],511-strlen(buffer));
SCWrite(pCon,buffer,eValue);
return 1;
}
pPtr = self->batchPath;
pPtr = stptok(pPtr,pPath,131,":");
strncat(buffer,pPath,511-strlen(buffer));
strncat(buffer,"/",511-strlen(buffer));
strncat(buffer,argv[2],511-strlen(buffer));
SCWrite(pCon,buffer,eValue);
return 1;
}
/*--------------------------------------------------------------------*/
pDynString findBatchFile(SicsInterp *pSics, char *name){
pExeMan self = (pExeMan)FindCommandData(pSics,"exe","ExeManager");
if(self == NULL){
return NULL;
}
return locateBatchBuffer(self,name);
}
/*--------------------------------------------------------------------*/
static int runBatchBuffer(pExeMan self, SConnection *pCon,
SicsInterp *pSics, char *name){
@ -937,6 +974,7 @@ int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
char pBufferName[256];
int status;
pDynString dirList = NULL;
pDynString fullPath = NULL;
self = (pExeMan)pData;
assert(self != NULL);
@ -1012,6 +1050,24 @@ int ExeManagerWrapper(SConnection *pCon, SicsInterp *pSics, void *pData,
SCWrite(pCon,"Nothing found",eValue);
}
return 1;
}else if(strcmp(argv[1],"fullpath") == 0){
if(argc < 2){
SCWrite(pCon,"ERROR: not enough arguments to exe fullpath",eError);
return 0;
}
fullPath = locateBatchBuffer(self,argv[2]);
if(fullPath == NULL){
SCWrite(pCon,"ERROR: buffer NOT found",eError);
return 0;
} else {
DynStringInsert(fullPath,"exe.fullpath=",0);
SCWrite(pCon,GetCharArray(fullPath),eValue);
DeleteDynString(fullPath);
return 1;
}
return 1;
}else if(strcmp(argv[1],"makepath") == 0){
return makeExePath(self,pCon,argc,argv);
}else if(strcmp(argv[1],"clear") == 0){
clearQueue(self);
SCSendOK(pCon);