revert parser stuff from enhenced patch
[nedit-bw.git] / there-is-no-struct-SparseArrayEntry.patch
blob63775e61f295c1d32f3d56bf5422022bc191e529
1 ---
3 source/interpret.c | 16 ++++++++--------
4 source/interpret.h | 7 ++++---
5 2 files changed, 12 insertions(+), 11 deletions(-)
7 diff --quilt old/source/interpret.c new/source/interpret.c
8 --- old/source/interpret.c
9 +++ new/source/interpret.c
10 @@ -163,14 +163,14 @@ static void stackdump(int n, int extra);
11 static Symbol *GlobalSymList = NULL;
13 /* List of all memory allocated for strings */
14 static char *AllocatedStrings = NULL;
16 -typedef struct {
17 +typedef struct SparseArrayEntryWrapperTag {
18 SparseArrayEntry data; /* LEAVE this as top entry */
19 int inUse; /* we use pointers to the data to refer to the entire struct */
20 - struct SparseArrayEntryWrapper *next;
21 + struct SparseArrayEntryWrapperTag *next;
22 } SparseArrayEntryWrapper;
24 static SparseArrayEntryWrapper *AllocatedSparseArrayEntries = NULL;
26 /* Message strings used in macros (so they don't get repeated every time
27 @@ -894,11 +894,11 @@ int AllocNStringCpy(NString *string, con
28 static SparseArrayEntry *allocateSparseArrayEntry(void)
30 SparseArrayEntryWrapper *mem;
32 mem = (SparseArrayEntryWrapper *)XtMalloc(sizeof(SparseArrayEntryWrapper));
33 - mem->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
34 + mem->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
35 AllocatedSparseArrayEntries = mem;
36 #ifdef TRACK_GARBAGE_LEAKS
37 ++numAllocatedSparseArrayElements;
38 #endif
39 return(&(mem->data));
40 @@ -990,11 +990,11 @@ void GarbageCollectStrings(void)
41 AllocatedSparseArrayEntries = NULL;
42 while (nextAP != NULL) {
43 thisAP = nextAP;
44 nextAP = (SparseArrayEntryWrapper *)nextAP->next;
45 if (thisAP->inUse != 0) {
46 - thisAP->next = (struct SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
47 + thisAP->next = (SparseArrayEntryWrapper *)AllocatedSparseArrayEntries;
48 AllocatedSparseArrayEntries = thisAP;
50 else {
51 #ifdef TRACK_GARBAGE_LEAKS
52 --numAllocatedSparseArrayElements;
53 @@ -2283,13 +2283,13 @@ static void arrayDisposeNode(rbTreeNode
54 src->right = NULL;
55 src->parent = NULL;
56 src->color = -1;
59 -struct SparseArrayEntry *ArrayNew(void)
60 +SparseArrayEntry *ArrayNew(void)
62 - return((struct SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
63 + return((SparseArrayEntry *)rbTreeNew(arrayEmptyAllocator));
67 ** insert a DataValue into an array, allocate the array if needed
68 ** keyStr must be a string that was allocated with AllocString()
69 @@ -2609,11 +2609,11 @@ static int beginArrayIter(void)
70 iteratorValPtr->tag = INT_TAG;
71 if (arrayVal.tag != ARRAY_TAG) {
72 return(execError("can't iterate non-array", NULL));
75 - iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry *)arrayIterateFirst(&arrayVal);
76 + iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateFirst(&arrayVal);
77 return(STAT_OK);
81 ** copy key to symbol if node is still valid, marked bad by a color of -1
82 @@ -2678,11 +2678,11 @@ static int arrayIter(void)
83 if (thisEntry && thisEntry->nodePtrs.color != -1) {
84 itemValPtr->tag = STRING_TAG;
85 itemValPtr->val.str.rep = thisEntry->key;
86 itemValPtr->val.str.len = strlen(thisEntry->key);
88 - iteratorValPtr->val.arrayPtr = (struct SparseArrayEntry *)arrayIterateNext(thisEntry);
89 + iteratorValPtr->val.arrayPtr = (SparseArrayEntry *)arrayIterateNext(thisEntry);
91 else {
92 PC = branchAddr;
94 return(STAT_OK);
95 diff --quilt old/source/interpret.h new/source/interpret.h
96 --- old/source/interpret.h
97 +++ new/source/interpret.h
98 @@ -55,10 +55,11 @@ enum typeTags {NO_TAG, INT_TAG, STRING_T
99 enum execReturnCodes {MACRO_TIME_LIMIT, MACRO_PREEMPT, MACRO_DONE, MACRO_ERROR};
101 #define ARRAY_DIM_SEP "\034"
103 struct DataValueTag;
104 +struct SparseArrayEntryTag;
105 struct ProgramTag;
106 struct SymbolRec;
108 typedef union InstTag {
109 int (*func)(void);
110 @@ -82,15 +83,15 @@ typedef struct DataValueTag {
111 BuiltInSubr subr;
112 struct ProgramTag* prog;
113 XtActionProc xtproc;
114 Inst* inst;
115 struct DataValueTag* dataval;
116 - struct SparseArrayEntry *arrayPtr;
117 + struct SparseArrayEntryTag *arrayPtr;
118 } val;
119 } DataValue;
121 -typedef struct {
122 +typedef struct SparseArrayEntryTag {
123 rbTreeNode nodePtrs; /* MUST BE FIRST ENTRY */
124 char *key;
125 DataValue value;
126 } SparseArrayEntry;
128 @@ -119,11 +120,11 @@ typedef struct {
130 void InitMacroGlobals(void);
132 SparseArrayEntry *arrayIterateFirst(DataValue *theArray);
133 SparseArrayEntry *arrayIterateNext(SparseArrayEntry *iterator);
134 -struct SparseArrayEntry *ArrayNew(void);
135 +SparseArrayEntry *ArrayNew(void);
136 Boolean ArrayInsert(DataValue* theArray, char* keyStr, DataValue* theValue);
137 void ArrayDelete(DataValue *theArray, char *keyStr);
138 void ArrayDeleteAll(DataValue *theArray);
139 unsigned ArraySize(DataValue *theArray);
140 Boolean ArrayGet(DataValue* theArray, char* keyStr, DataValue* theValue);