- added FindCommandDescriptor to SCinter.*
- modified support for dynamic objects - improved logger system - various fixes
This commit is contained in:
@@ -28,6 +28,7 @@ typedef enum {
|
||||
sct_take_keyword,
|
||||
sct_get_keyword,
|
||||
sct_complete_keyword,
|
||||
sct_retry_keyword,
|
||||
sct_chain_keyword,
|
||||
sct_next_keyword,
|
||||
sct_steplist_keyword,
|
||||
@@ -44,6 +45,7 @@ static char *sctKeywords[]={
|
||||
"take",
|
||||
"get",
|
||||
"complete",
|
||||
"retry",
|
||||
"chain",
|
||||
"next",
|
||||
"steplist",
|
||||
@@ -116,6 +118,7 @@ struct Sct {
|
||||
char *result;
|
||||
char *nextScript;
|
||||
SctChain *runningChain;
|
||||
int tryCnt;
|
||||
SCStore debugConn;
|
||||
char *debugCommand;
|
||||
int sent;
|
||||
@@ -259,6 +262,7 @@ static int SctReadCallback(void *user, void *conn, pHdb node, hdbValue value) {
|
||||
int SctCallDynamicScript(Sct *sct, char *name, char *script) {
|
||||
SctList *sl;
|
||||
SctChain *sc;
|
||||
|
||||
for (sl = sct->scriptLists.head; sl != NULL; sl = sl->next) {
|
||||
for (sc = sl->chains.head; sc != NULL; sc = sc->next) { /* don't touch the list pos */
|
||||
if (sc->dynamic && strcasecmp(name, sc->dynamic) == 0) {
|
||||
@@ -408,6 +412,25 @@ static int SctExec(SConnection *con, SicsInterp *sics, void *object, int argc, c
|
||||
|
||||
}
|
||||
goto missingScriptList;
|
||||
case sct_retry_keyword:
|
||||
if (argc < 3) {
|
||||
SCPrintf(con, eInError, "ERROR: should be: %s retry <max try> <message>", argv[0]);
|
||||
goto quit;
|
||||
}
|
||||
if (sct->runningChain == NULL) {
|
||||
SCPrintf(con, eInError, "ERROR: no running chain (fatal error)", argv[0]);
|
||||
goto quit;
|
||||
}
|
||||
sct->tryCnt++;
|
||||
if (sct->tryCnt >= atoi(argv[2])) {
|
||||
SCPrintf(con, eInError, "ERROR: too may retries (%d) after %s",
|
||||
sct->tryCnt, ConcatArgs(argc-3, argv+3));
|
||||
goto quit;
|
||||
}
|
||||
sct->nextScript = sct->runningChain->command;
|
||||
if (sct->result) free(sct->result);
|
||||
sct->result = NULL;
|
||||
break;
|
||||
case sct_chain_keyword:
|
||||
if (argc < 4) {
|
||||
SCPrintf(con, eInError, "ERROR: should be: %s chain <name> <script>", argv[0]);
|
||||
@@ -496,6 +519,7 @@ static char *SctCallChain(SctChain *sc) {
|
||||
return NULL; /* empty script: do nothing */
|
||||
}
|
||||
sct->runningChain = sc;
|
||||
sct->tryCnt = 0;
|
||||
sct->relatedPath = sc->relatedPath;
|
||||
sc->msg = NULL;
|
||||
return SctCall(sc->command);
|
||||
@@ -759,14 +783,14 @@ int SctAddNode2Script(Sct *sct, SctChain *sc, pHdb node, SConnection *con) {
|
||||
if (child == NULL) {
|
||||
child = MakeSICSHdbPar("error", usInternal, MakeHdbText(""));
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
SetHdbProperty(child, "hidden", "whenempty");
|
||||
SetHdbProperty(child, "visible", "false");
|
||||
}
|
||||
if (sc->scriptList->type == set_type) {
|
||||
child = GetHipadabaNode(node, "target");
|
||||
if (child == NULL) {
|
||||
child = MakeSICSHdbPar("target", usInternal, node->value);
|
||||
AddHipadabaChild(node, child, NULL);
|
||||
SetHdbProperty(child, "hidden","target");
|
||||
SetHdbProperty(child, "visible","false");
|
||||
}
|
||||
data->setChain = sc;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user