3 source/interpret.c | 33 +--------------------------------
4 source/interpret.h | 3 +--
5 source/macro.c | 21 +++++++--------------
6 3 files changed, 9 insertions(+), 48 deletions(-)
8 diff --quilt old/source/interpret.c new/source/interpret.c
9 --- old/source/interpret.c
10 +++ new/source/interpret.c
11 @@ -342,7 +342,6 @@ int AddSym(Symbol *sym, char **msg)
12 *msg = "macro too large";
16 ProgP->type = SYM_INST;
19 @@ -946,7 +945,6 @@ Symbol *InstallSymbol(const char *name,
20 strcpy(s->name, name);
24 s->hash = hashName(s->name);
25 if (type == LOCAL_SYM) {
26 s->next = LocalSymList;
27 @@ -971,7 +969,7 @@ Symbol *PromoteToGlobal(Symbol *sym)
31 - if (sym->type != LOCAL_SYM || sym->added)
32 + if (sym->type != LOCAL_SYM)
35 /* Remove sym from the local symbol list */
36 @@ -1587,11 +1585,6 @@ static int pushSymVal(void)
37 if (!s->value.val.subr(FocusWindow, NULL, 0, &symVal, &errMsg)) {
38 EXEC_ERROR(errMsg, s->name);
40 - } else if (s->type == C_FUNCTION_SYM
41 - || s->type == MACRO_FUNCTION_SYM
42 - || s->type == ACTION_ROUTINE_SYM) {
43 - symVal.tag = SUBR_TAG;
46 EXEC_ERROR("reading non-variable: %s", s->name);
47 if (symVal.tag == NO_TAG && !inTypeOfMode) {
48 @@ -2683,27 +2676,12 @@ static int callSubroutineFromSymbol(Symb
49 DataValue argArray = noValue;
51 int haveNamedArgs = (nArgs < 0);
52 - DataValue *symValPtr = NULL;
59 - if (sym->type == LOCAL_SYM) {
60 - symValPtr = &FP_GET_SYM_VAL(FrameP, sym);
61 - } else if (sym->type == GLOBAL_SYM) {
62 - symValPtr = &sym->value;
65 - if (symValPtr->tag == SUBR_TAG) {
66 - sym = symValPtr->val.sym;
68 - EXEC_ERROR("%s is not a variable holding a subroutine pointer",
74 ** If the subroutine is built-in, call the built-in routine
76 @@ -2906,7 +2884,6 @@ int OverlayRoutineFromProg(Program *prog
77 strcpy(sym->name, prog->name);
78 sym->value.val.prog = prog;
82 ret = OverlayRoutineFromSymbol(sym, nArgs, removeArgs);
84 @@ -4091,9 +4068,6 @@ static int typeOfOut(void)
86 retVal.val.str.rep = PERM_ALLOC_STR("ARRAY");
89 - retVal.val.str.rep = PERM_ALLOC_STR("SUBROUTINE");
92 retVal.val.str.len = strlen(retVal.val.str.rep);
94 @@ -4344,8 +4318,6 @@ static const char *tagToStr(enum typeTag
99 - return "<subroutine>";
103 @@ -4512,9 +4484,6 @@ static void dumpVal(DataValue dv)
105 printd("<array> %8p[%d]", dv.val.arrayPtr, ArraySize(&dv));
108 - printd("<subroutine> %s", dv.val.sym->name);
112 printd("<no value>");
113 diff --quilt old/source/interpret.h new/source/interpret.h
114 --- old/source/interpret.h
115 +++ new/source/interpret.h
116 @@ -50,7 +50,7 @@ enum operations {
120 -enum typeTags {NO_TAG, INT_TAG, STRING_TAG, ARRAY_TAG, SUBR_TAG};
121 +enum typeTags {NO_TAG, INT_TAG, STRING_TAG, ARRAY_TAG};
123 enum execReturnCodes {MACRO_TIME_LIMIT, MACRO_PREEMPT, MACRO_DONE, MACRO_ERROR};
125 @@ -106,7 +106,6 @@ typedef struct SparseArrayEntryTag {
126 typedef struct SymbolRec {
131 struct SymbolRec *next; /* to link to another */
133 diff --quilt old/source/macro.c new/source/macro.c
134 --- old/source/macro.c
135 +++ new/source/macro.c
136 @@ -3816,24 +3816,20 @@ static int callMS(WindowInfo *window, Da
137 int nArgs, DataValue *result, char **errMsg)
140 + char stringStorage[TYPE_INT_STR_SIZE(int)];
144 *errMsg = "subroutine %s called without arguments";
147 - if (argList[0].tag == SUBR_TAG) {
148 - sym = argList[0].val.sym;
150 - char stringStorage[TYPE_INT_STR_SIZE(int)];
153 - if (!readStringArg(argList[0], &fnname, stringStorage, errMsg)) {
157 - sym = LookupSymbol(fnname);
158 + if (!readStringArg(argList[0], &fnname, stringStorage, errMsg)) {
162 + sym = LookupSymbol(fnname);
165 *errMsg = "subroutine name invalid";
167 @@ -3843,7 +3839,7 @@ static int callMS(WindowInfo *window, Da
171 - * subr = define(func_name, func_body[, "override"])
172 + * define(func_name, func_body[, "override"])
174 static int defineMS(WindowInfo *window, DataValue *argList, int nArgs,
175 DataValue *result, char **errMsg)
176 @@ -3932,9 +3928,6 @@ static int defineMS(WindowInfo *window,
177 sym = InstallSymbol(name, MACRO_FUNCTION_SYM, subrPtr);
180 - result->tag = SUBR_TAG;
181 - result->val.sym = sym;