1.) Modified macro system as to use only Sicsunknown for resolving unknown
Tcl commands. Removed the broken obTcl object system and replaced it by
the object.tcl system from sntl. Redid the scan command with this. The
end of this is that SICS is now independent of the tcl version and
works with tcl 8.0 thus giving a factor of up to 10 in script execution
speed.
2.) Added driving an angle through a translation table (object lin2ang)
This commit is contained in:
39
macro.c
39
macro.c
@@ -90,6 +90,7 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
|
||||
struct __SicsUnknown {
|
||||
SConnection *pCon[MAXSTACK];
|
||||
char *lastUnknown[MAXSTACK];
|
||||
int iStack;
|
||||
SicsInterp *pInter;
|
||||
};
|
||||
@@ -129,6 +130,7 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
SicsInterp *pSinter = NULL;
|
||||
SConnection *pCon = NULL;
|
||||
CommandList *pCommand = NULL;
|
||||
char *lastCommand = NULL, comBuffer[132];
|
||||
int iRet,i;
|
||||
int iMacro;
|
||||
|
||||
@@ -137,6 +139,8 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
assert(pSics);
|
||||
pSinter = pSics->pInter;
|
||||
pCon = pSics->pCon[pSics->iStack];
|
||||
lastCommand = pSics->lastUnknown[pSics->iStack];
|
||||
|
||||
assert(pSinter);
|
||||
assert(pCon);
|
||||
|
||||
@@ -157,13 +161,32 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
Tcl_AppendResult(pInter,"Object ",myarg[0]," not found",NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* check for endless loop */
|
||||
Arg2Text(margc, myarg, comBuffer,131);
|
||||
if(lastCommand != NULL)
|
||||
{
|
||||
if(strcmp(lastCommand,comBuffer) == 0)
|
||||
{
|
||||
Tcl_AppendResult(pInter,"ERROR: Never ending loop in unknown\n",
|
||||
"Offending command: ",comBuffer,
|
||||
"Probably Tcl command not found",NULL);
|
||||
SCSetInterrupt(pCon,eAbortBatch);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
pSics->lastUnknown[pSics->iStack] = strdup(comBuffer);
|
||||
|
||||
/* invoke */
|
||||
iMacro = SCinMacro(pCon);
|
||||
SCsetMacro(pCon,1);
|
||||
iRet = pCommand->OFunc(pCon,pSinter,pCommand->pData,margc, myarg);
|
||||
SCsetMacro(pCon,iMacro);
|
||||
|
||||
free(pSics->lastUnknown[pSics->iStack]);
|
||||
pSics->lastUnknown[pSics->iStack] = NULL;
|
||||
|
||||
|
||||
/* finish */
|
||||
if(iRet)
|
||||
{
|
||||
@@ -192,7 +215,6 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
initialises a Tcl-Interpreter, installs SICS unknown mechanism and kills
|
||||
a few dangerous commands from the normal Tcl command set
|
||||
*/
|
||||
extern int initcl_Init(Tcl_Interp *pInter);
|
||||
|
||||
Tcl_Interp *MacroInit(SicsInterp *pSics)
|
||||
{
|
||||
@@ -220,7 +242,8 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
pUnknown->iStack = 0;
|
||||
pUnknown->pInter = pSics;
|
||||
pUnbekannt = pUnknown;
|
||||
Tcl_CreateCommand(pInter,"SicsUnknown",SicsUnknownProc,pUnknown, UnknownKill);
|
||||
Tcl_CreateCommand(pInter,"unknown",SicsUnknownProc,
|
||||
pUnknown, UnknownKill);
|
||||
|
||||
/* delete dangers */
|
||||
Tcl_DeleteCommand(pInter,"exit");
|
||||
@@ -228,13 +251,6 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
Tcl_DeleteCommand(pInter,"vwait");
|
||||
Tcl_DeleteCommand(pInter,"exec");
|
||||
|
||||
/* default initialisation */
|
||||
Tcl_SetVar(pInter,"auto_path"," ",TCL_GLOBAL_ONLY);
|
||||
initcl_Init(pInter);
|
||||
|
||||
/* initialise Don Libber Tcl-debugger */
|
||||
/* Dbg_Init(pInter); */
|
||||
|
||||
return pInter;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -812,6 +828,9 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
||||
at the end. This is to permit clients to search for this string in
|
||||
order to find out when a command has finished.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int TransactAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user