- Implemented tcl: prefix which allows to execute a command in Tcl directly

- Fixed a stack overrun bug in macro.c
- Fixed a killing bug in devser.c
- Added node writing with offset to nxscript.c
- Wrote a simulation driver for second generation HM's
- Readded devexec commands to  SICS
- Readded Hipadaba initialisation to SICS
- Fixed a bug in sinqhttprot.c which is triggered when a reconnect happens
  during a node based download of data.


SKIPPED:
	psi/sinqhttpprot.c
This commit is contained in:
koennecke
2010-02-02 12:38:10 +00:00
parent 1dff223146
commit 09cc25ec5b
15 changed files with 282 additions and 212 deletions

View File

@ -52,6 +52,14 @@
Paul Hathaway, May 2004
Added FindAlias function, Mark Koennecke, January 2007
A new type of object function has been introduced ObjectFuncSelfParse. This
type of object function parses its command itself. As of now only one is
implemented for issuing Tcl commands from the command line, which will
stay a hidden feature. If more things of this type come along, then this
has to be expanded to become a full infrastructure.
Mark Koennecke, January 2010
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
@ -244,6 +252,33 @@ int RemoveCommand(SicsInterp * pInterp, char *pName)
extern char *stptok(char *s, char *tok, unsigned int toklen, char *brk);
extern char *SkipSpace(char *pPtr);
/*-----------------------------------------------------------------------*/
static char tclescape[] = "tcl:";
static int TclExecFunc(SConnection *pCon, SicsInterp *pInter, void *data,
char *command)
{
int status;
char *realcommand;
if(!SCMatchRights(pCon,usMugger)){
return 0;
}
realcommand = command + strlen(tclescape);
MacroPush(pCon);
status = Tcl_Eval(InterpGetTcl(pInter), realcommand);
MacroPop();
if(status == TCL_OK){
SCWrite(pCon,(char *)Tcl_GetStringResult(InterpGetTcl(pInter)), eValue );
return 1;
} else {
SCWrite(pCon,(char *)Tcl_GetStringResult(InterpGetTcl(pInter)), eValue );
return 0;
}
return 0;
}
/*-----------------------------------------------------------------------*/
int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
{
int iCount = 0;
@ -271,6 +306,9 @@ int InterpExecute(SicsInterp * self, SConnection * pCon, char *pText)
SICSLogWrite(pBueffel, eCommand);
}
if(strstr(pText,tclescape) == pText){
return TclExecFunc(pCon,self,NULL,pText);
}
/* convert to argc, argv */
argc = 0;