diff --git a/Source/DOH/base.c b/Source/DOH/base.c index ac1b33666..c17f32824 100644 --- a/Source/DOH/base.c +++ b/Source/DOH/base.c @@ -829,3 +829,28 @@ DohGetmark(DOH *ho) { DohBase *h = (DohBase *) ho; return h->flag_usermark; } + +/* ----------------------------------------------------------------------------- + * DohCall() + * + * Invokes a function via DOH. A Function is represented by a hash table with + * the following attributes: + * + * "builtin" - Pointer to built-in function (if any) + * + * (Additional attributes may be added later) + * + * Returns a DOH object with result on success. Returns NULL on error + * ----------------------------------------------------------------------------- */ + +DOH * +DohCall(DOH *func, DOH *args) { + DOH *result; + DOH *(*builtin)(DOH *); + + builtin = (DOH *(*)(DOH *)) GetVoid(func,"builtin"); + if (!builtin) return 0; + result = (*builtin)(args); + return result; +} + diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 4c22739d8..b807a4bd5 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -104,7 +104,7 @@ #define DohNewVoid DOH_NAMESPACE(NewVoid) #define DohSplit DOH_NAMESPACE(Split) #define DohNone DOH_NAMESPACE(None) - +#define DohCall DOH_NAMESPACE(Call) #define DohObjMalloc DOH_NAMESPACE(ObjMalloc) #define DohObjFree DOH_NAMESPACE(ObjFree) #define DohMemoryDebug DOH_NAMESPACE(MemoryDebug) @@ -377,6 +377,7 @@ extern void DohMemoryDebug(void); #define Setmark DohSetmark #define Getmark DohGetmark #define None DohNone +#define Call DohCall #endif #ifdef NIL diff --git a/Source/DOH/fio.c b/Source/DOH/fio.c index db7e5eb1c..d42be5fa4 100644 --- a/Source/DOH/fio.c +++ b/Source/DOH/fio.c @@ -123,7 +123,7 @@ DohvPrintf(DOH *so, const char *format, va_list ap) } break; case 10: /* Look for a width and precision */ - if (isdigit(*p) && (*p != '0')) { + if (isdigit((int)*p) && (*p != '0')) { w = temp; *(w++) = *p; *(fmt++) = *p; @@ -154,7 +154,7 @@ DohvPrintf(DOH *so, const char *format, va_list ap) break; case 20: /* Hmmm. At the start of a width field */ - if (isdigit(*p)) { + if (isdigit((int)*p)) { *(w++) = *p; *(fmt++) = *p; } else if (strchr(fmt_codes,*p)) { @@ -196,7 +196,7 @@ DohvPrintf(DOH *so, const char *format, va_list ap) case 40: /* Start of precision expected */ - if (isdigit(*p) && (*p != '0')) { + if (isdigit((int)*p) && (*p != '0')) { *(fmt++) = *p; *(w++) = *p; state = 41; @@ -217,7 +217,7 @@ DohvPrintf(DOH *so, const char *format, va_list ap) } break; case 41: - if (isdigit(*p)) { + if (isdigit((int)*p)) { *(fmt++) = *p; *(w++) = *p; } else if (strchr(fmt_codes,*p)) { diff --git a/Source/DOH/string.c b/Source/DOH/string.c index d48b82ca4..7b87acbfe 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.c @@ -529,11 +529,11 @@ match_identifier(char *base, char *s, char *token, int tokenlen) while (s) { s = strstr(s,token); if (!s) return 0; - if ((s > base) && (isalnum(*(s-1)) || (*(s-1) == '_'))) { + if ((s > base) && (isalnum((int) *(s-1)) || (*(s-1) == '_'))) { s += tokenlen; continue; } - if (isalnum(*(s+tokenlen)) || (*(s+tokenlen) == '_')) { + if (isalnum((int)*(s+tokenlen)) || (*(s+tokenlen) == '_')) { s += tokenlen; continue; } @@ -549,7 +549,7 @@ match_identifier_begin(char *base, char *s, char *token, int tokenlen) while (s) { s = strstr(s,token); if (!s) return 0; - if ((s > base) && (isalnum(*(s-1)) || (*(s-1) == '_'))) { + if ((s > base) && (isalnum((int)*(s-1)) || (*(s-1) == '_'))) { s += tokenlen; continue; } @@ -564,7 +564,7 @@ match_identifier_end(char *base, char *s, char *token, int tokenlen) while (s) { s = strstr(s,token); if (!s) return 0; - if (isalnum(*(s+tokenlen)) || (*(s+tokenlen) == '_')) { + if (isalnum((int)*(s+tokenlen)) || (*(s+tokenlen) == '_')) { s += tokenlen; continue; } @@ -819,7 +819,7 @@ String_chop(DOH *so) String *str = (String *) ObjData(so); /* Replace trailing whitespace */ c = str->str + str->len - 1; - while ((str->len > 0) && (isspace(*c))) { + while ((str->len > 0) && (isspace((int)*c))) { if (str->sp >= str->len) { str->sp--; if (*c == '\n') str->line--;