- 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:
56
exeman.c
56
exeman.c
@ -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);
|
||||
|
Reference in New Issue
Block a user