- various improvements
This commit is contained in:
16
pardef.c
16
pardef.c
@ -432,7 +432,7 @@ static int ParExecute(SConnection *con, SicsInterp *sics, void *object, int argc
|
||||
ctx->argc = argc - 3;
|
||||
ctx->argv = argv + 3;
|
||||
ctx->doit = toupper(argv[1][0]) != 'U';
|
||||
ctx->exact = 1;
|
||||
ctx->exact = 0;
|
||||
ParDo(con, o, PAR_LOGSWITCH, argv[2]);
|
||||
}
|
||||
} else if ((0 == strcasecmp(argv[1], "save") || 0 == strcasecmp(argv[1], "unsave"))) {
|
||||
@ -603,7 +603,7 @@ void ParFind(void) {
|
||||
long ParText2Int(char *text) {
|
||||
long num = 0;
|
||||
|
||||
if (strcasecmp(text, "undefined") == 0) {
|
||||
if (strcasecmp(text, "undefined") == 0 || text[0] == '\0') {
|
||||
return PAR_LNAN;
|
||||
}
|
||||
if (ctx->enumList) {
|
||||
@ -622,7 +622,7 @@ char *ParInt2Text(int num) {
|
||||
static char buf[12];
|
||||
|
||||
if (num == PAR_LNAN) {
|
||||
return "undefined";
|
||||
return ""; /* undefined */
|
||||
}
|
||||
if (! ctx->enumList) return NULL;
|
||||
for (i = 0; i <= num; i++) {
|
||||
@ -686,7 +686,7 @@ void ParName(char *name) {
|
||||
ctx->access = -1;
|
||||
ctx->doit = -1;
|
||||
ctx->logName = ""; /* log by default */
|
||||
ctx->exact = 1; /* exact by default */
|
||||
ctx->exact = 0; /* not exact by default */
|
||||
return;
|
||||
case PAR_GET:
|
||||
if (0 != strcasecmp(name, ctx->thisPar)) {
|
||||
@ -926,7 +926,7 @@ void ParOut(char *buf) {
|
||||
} else {
|
||||
p == NULL;
|
||||
}
|
||||
if (p == NULL) p = "undefined";
|
||||
if (p == NULL) p = ""; /* undefined */
|
||||
ParPrintf(NULL, eValue, "%s", p);
|
||||
break;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ void ParFloat(float *value, float defValue) {
|
||||
case FMT_OP:
|
||||
if (*value == PAR_NAN) {
|
||||
ctx->fmt = NULL;
|
||||
ParOut("undefined");
|
||||
ParOut(""); /* undefined */
|
||||
} else {
|
||||
if (ctx->fmt == NULL) {
|
||||
ctx->fmt = "%#.5g";
|
||||
@ -1110,7 +1110,7 @@ void ParInt(int *value, int defValue) {
|
||||
/* fall through */
|
||||
case FMT_OP:
|
||||
if (*value == PAR_LNAN) {
|
||||
ParOut("undefined");
|
||||
ParOut(""); /* undefined */
|
||||
} else {
|
||||
snprintf(buf, sizeof buf, "%d", *value);
|
||||
ParOut(buf);
|
||||
@ -1145,6 +1145,7 @@ void ParStr(char **value, char *defValue) {
|
||||
ParOut(*value);
|
||||
break;
|
||||
case INIT_OP:
|
||||
ctx->exact = 1;
|
||||
if (defValue != NULL) {
|
||||
*value = strdup(defValue);
|
||||
}
|
||||
@ -1170,6 +1171,7 @@ void ParFixedStr(char *value, int maxsize, char *defValue) {
|
||||
ParOut(value);
|
||||
break;
|
||||
case INIT_OP:
|
||||
ctx->exact = 1;
|
||||
if (defValue != NULL) {
|
||||
snprintf(value, maxsize, "%s", defValue);
|
||||
}
|
||||
|
Reference in New Issue
Block a user