File: compilation-errors.patch

package info (click to toggle)
steptalk 0.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 4,104 kB
  • ctags: 780
  • sloc: objc: 14,096; yacc: 394; makefile: 31; csh: 8; awk: 3; lisp: 3
file content (393 lines) | stat: -rw-r--r-- 12,210 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
2011-06-06  Yavor Doganov  <yavor@gnu.org>

	Minor updates for the new runtime.  Do not import <obc/objc-api.h>.
	* Frameworks/StepTalk/STObjCRuntime.m (STCreateTypedSelector)
	<newSel>: Initialize.
	* Frameworks/StepTalk/NSInvocation+additions.m
	(+invocationWithTarget:selectorName:): Use standard GNUstep
	runtime functions.

2011-04-07  Wolfgang Lux  <wolfgang.lux@gmail.com>

	* Modules/ObjectiveC/ObjectiveCRuntime.m (-allClasses):
	* Modules/ObjectiveC/NSObject+additions.m (methods_for_class,
	ivars_for_class, +methodNames): Update to Objective-C 2 API.

2011-04-06  Richard Frith-Macdonald <rfm@gnu.org>

	* Frameworks/StepTalk/STObjCRuntime.m: replace runtime specific typed
	selector code with the standard gnustep functions.

2011-04-06  Wolfgang Lux  <wolfgang.lux@gmail.com>

	* Frameworks/StepTalk/STObjCRuntime.m (STAllObjectiveCClasses,
	STCreateTypedSelector, STConstructMethodSignatureForSelector,
	selectors_from_list, STAllObjectiveCSelectors): Update to
	Objective-C 2 API.

2011-01-20  Wolfgang Lux  <wolfgang.lux@gmail.com>

	* Modules/AppKit/AppKitNotifications.list: Update AppKit
	notification list to match recent change in gui.


--- steptalk.orig/Frameworks/StepTalk/STObjCRuntime.m
+++ steptalk/Frameworks/StepTalk/STObjCRuntime.m
@@ -37,6 +37,7 @@
 #import <Foundation/NSSet.h>
 #import <Foundation/NSString.h>
 #import <Foundation/NSValue.h>
+#import <GNUstepBase/GSObjCRuntime.h>
 
 #define SELECTOR_TYPES_COUNT 10
 
@@ -58,21 +59,25 @@
 
 NSMutableDictionary *STAllObjectiveCClasses(void)
 {
+    int                  i, numClasses;
     NSString            *name;
     NSMutableDictionary *dict;
-    void                *state = 0;
-    Class                class;
+    Class               *classes;
 
     dict = [NSMutableDictionary dictionary];
 
-    while( (class = objc_next_class(&state)) )
+    numClasses = objc_getClassList(NULL, 0);
+    classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class));
+    numClasses = objc_getClassList(classes, numClasses);
+//    NSLog(@"%i Objective-C classes found", numClasses);
+
+    for(i = 0; i < numClasses; i++)
     {
-        name = [NSString stringWithCString:class_get_class_name(class)];
+        name = [NSString stringWithCString:class_getName(classes[i])];
         
-        [dict setObject:class forKey:name];
+        [dict setObject:classes[i] forKey:name];
     }
-    
-//    NSLog(@"%i Objective-C classes found",[dict count]);
+    NSZoneFree(STMallocZone, classes);
 
     return dict;
 }
@@ -142,7 +147,7 @@
                        @"with %i arguments, types:'%s'",
                         name,argc,selector_types[argc]);
                     
-            sel = sel_register_typed_name(name, selector_types[argc]);
+            sel = GSSelectorFromNameAndTypes(name, selector_types[argc]);
         }
 
         if(!sel)
@@ -163,11 +168,11 @@
 
 SEL STCreateTypedSelector(SEL sel)
 {
-    const char *name = sel_get_name(sel);
+    const char *name = sel_getName(sel);
     const char *ptr;
     int         argc = 0;
 
-    SEL         newSel;
+    SEL         newSel = NULL;
 
     NSLog(@"STCreateTypedSelector is deprecated.");
 
@@ -189,7 +194,7 @@
                    @"with %i arguments, types:'%s'",
                     name,argc,selector_types[argc]);
 
-        newSel = sel_register_typed_name(name, selector_types[argc]);
+        newSel = GSSelectorFromNameAndTypes(name, selector_types[argc]);
     }
 
     if(!newSel)
@@ -205,7 +210,7 @@
 
 NSMethodSignature *STConstructMethodSignatureForSelector(SEL sel)
 {
-    const char *name = sel_get_name(sel);
+    const char *name = sel_getName(sel);
     const char *ptr;
     const char *types = (const char *)0;
     int         argc = 0;
@@ -248,31 +253,25 @@
     
     NSLog(@"STMethodSignatureForSelector is deprecated.");
 
-    types = sel_get_type(sel);
+    types = GSTypesFromSelector(sel);
     
     if(!types)
     {
         sel = STCreateTypedSelector(sel);
-        types = sel_get_type(sel);
+        types = GSTypesFromSelector(sel);
     }
     return [NSMethodSignature signatureWithObjCTypes:types];
 }
 
 
-static NSArray *selectors_from_list(struct objc_method_list *methods)
+static NSArray *selectors_from_list(Method *methods, unsigned int numMethods)
 {
     NSMutableArray *array = [NSMutableArray array];
-    int             count = methods->method_count;
-    int             i;
+    unsigned int    i;
     
-    for(i=0;i<count;i++)
+    for (i = 0; i < numMethods; i++)
     {
-        [array addObject:NSStringFromSelector(methods->method_list[i].method_name)];
-    }
-
-    if(methods->method_next)
-    {
-        [array addObjectsFromArray:selectors_from_list(methods->method_next)];
+        [array addObject:NSStringFromSelector(method_getName(methods[i]))];
     }
     
     return array;
@@ -281,29 +280,39 @@
 
 NSArray *STAllObjectiveCSelectors(void)
 {
+    int             i, numClasses;
+    unsigned int    numMethods;
     NSMutableArray *array;
-    NSArray        *methods;
-    Class           class;
-    void           *state = 0;
+    NSArray        *selectors;
+    Method         *methods;
+    Class          *classes;
     
     array = [[NSMutableArray alloc] init];
 
-    while( (class = objc_next_class(&state)) )
+    numClasses = objc_getClassList(NULL, 0);
+    classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class));
+    numClasses = objc_getClassList(classes, numClasses);
+
+    for(i = 0; i < numClasses; i++)
     {
-        if(class->methods)
+	methods = class_copyMethodList(classes[i], &numMethods);
+        if(methods)
         {
-            methods = selectors_from_list(class->methods);
-            [array addObjectsFromArray:methods];
+            selectors = selectors_from_list(methods, numMethods);
+            [array addObjectsFromArray:selectors];
         }
-        class = class->class_pointer;
+	free(methods);
 
-        if(class->methods)
+        methods = class_copyMethodList(object_getClass(classes[i]), &numMethods);
+        if(methods)
         {
-            methods = selectors_from_list(class->methods);
-            [array addObjectsFromArray:methods];
+            selectors = selectors_from_list(methods, numMethods);
+            [array addObjectsFromArray:selectors];
         }
+	free(methods);
     }
-    
+    NSZoneFree(STMallocZone, classes);
+
     /* get rid of duplicates */
     array = (NSMutableArray *)[[NSSet setWithArray:(NSArray *)array] allObjects];
     array = (NSMutableArray *)[array sortedArrayUsingSelector:@selector(compare:)];
--- steptalk.orig/Modules/ObjectiveC/NSObject+additions.m
+++ steptalk/Modules/ObjectiveC/NSObject+additions.m
@@ -26,32 +26,30 @@
 
 #import "NSObject+additions.h"
 
-#import <objc/objc-api.h>
-
 #import <Foundation/NSArray.h>
 #import <Foundation/NSString.h>
 
 static NSArray *methods_for_class(Class class)
 {
     NSMutableArray          *array = [NSMutableArray array];
-    struct objc_method_list *methods;
+    Method                  *methods;
     SEL                      sel;
-    int                      i;
+    unsigned int             i, numMethods;
 
     if(!class)
         return nil;
+
     
-    methods = class->methods;
+    methods = class_copyMethodList(class, &numMethods);
 
-    while(methods)
+    if(methods)
     {
-        for(i = 0; i < methods->method_count; i++)
+        for(i = 0; i < numMethods; i++)
         {
-            sel = methods->method_list[i].method_name;
+            sel = method_getName(methods[i]);
             [array addObject:NSStringFromSelector(sel)];
         }
-        
-        methods = methods->method_next;
+	free(methods);
     }
     
     return [NSArray arrayWithArray:array];
@@ -60,25 +58,26 @@
 static NSArray *ivars_for_class(Class class)
 {
     NSMutableArray        *array;
-    struct objc_ivar_list* ivars; 
+    Ivar*                  ivars;
     const char            *cname;
-    int                    i;
+    unsigned int           i, numIvars;
     
     if(!class)
         return nil;
     
     array = [NSMutableArray array];
     
-    ivars = class->ivars;
+    ivars = class_copyIvarList(class, &numIvars);
 
     if(ivars)
     {
-        for(i=0;i<ivars->ivar_count;i++)
+        for(i = 0; i < numIvars ; i++)
         {
-            cname = ivars->ivar_list[i].ivar_name;
+            cname = ivar_getName(ivars[i]);
             [array addObject:[NSString stringWithCString:cname]];
         }
     }
+    free(ivars);
     
     return [NSArray arrayWithArray:array];
 }
@@ -97,7 +96,7 @@
 
 + (NSArray *)methodNames
 {
-    return methods_for_class(class_get_meta_class(self));
+    return methods_for_class(object_getClass(self));
 }
 
 + (NSArray *)instanceVariableNames
--- steptalk.orig/Modules/ObjectiveC/ObjectiveCRuntime.m
+++ steptalk/Modules/ObjectiveC/ObjectiveCRuntime.m
@@ -28,8 +28,6 @@
 
 #import "NSObject+additions.h"
 
-#import <objc/objc-api.h>
-
 #import <StepTalk/STObjCRuntime.h>
 #import <StepTalk/STSelector.h>
 
@@ -52,16 +50,21 @@
 
 - (NSArray *)allClasses
 {
+    int             i, numClasses;
     NSMutableArray *array;
-    Class           class;
-    void           *state = NULL;
+    Class          *classes;
 
     array = [NSMutableArray array];
 
-    while( (class = objc_next_class(&state)) )
+    numClasses = objc_getClassList(NULL, 0);
+    classes = (Class *)NSZoneMalloc(NULL, numClasses * sizeof(Class));
+    numClasses = objc_getClassList(classes, numClasses);
+
+    for(i = 0; i < numClasses; i++)
     {
-        [array addObject:class];
+        [array addObject:classes[i]];
     }
+    NSZoneFree(NULL, classes);
     
     return [NSArray arrayWithArray:array];
 }
--- steptalk.orig/Frameworks/StepTalk/NSInvocation+additions.m
+++ steptalk/Frameworks/StepTalk/NSInvocation+additions.m
@@ -40,7 +40,7 @@
 #import "STSelector.h"
 #import "STStructure.h"
 
-#import <objc/objc-api.h>
+#import <GNUstepBase/GSObjCRuntime.h>
 
 #if 0
 static Class NSNumber_class = nil;
@@ -216,7 +216,7 @@
         // NSLog(@"REGISTERING SELECTOR");
         const char *name = [selectorName cString];
         
-        sel = sel_register_name(name);
+        sel = GSSelectorFromName(name);
 
         if(!sel)
         {
@@ -235,7 +235,8 @@
     if(requiresRegistration)
     {
         // NSLog(@"REGISTERING SELECTOR TYPES");
-        sel = sel_register_typed_name([selectorName cString], [signature methodReturnType]);
+        sel = GSSelectorFromNameAndTypes([selectorName cString],
+					 [signature methodReturnType]);
         // NSLog(@"REGISTERED %@", NSStringFromSelector(sel));
         
     }
--- steptalk.orig/Frameworks/StepTalk/STStructure.m
+++ steptalk/Frameworks/StepTalk/STStructure.m
@@ -34,8 +34,6 @@
 #import <Foundation/NSDebug.h>
 #import "NSInvocation+additions.h"
 
-#import <objc/objc-api.h>
-
 @implementation STStructure
 + structureWithValue:(void *)value type:(const char*)type
 {
--- steptalk.orig/Languages/Smalltalk/STBytecodeInterpreter.m
+++ steptalk/Languages/Smalltalk/STBytecodeInterpreter.m
@@ -50,8 +50,6 @@
 #import <Foundation/NSInvocation.h>
 #import <Foundation/NSValue.h>
 
-#import  <objc/encoding.h>
-
 @interface STBytecodeInterpreter(STPrivateMethods)
 - (short)fetchBytecode;
 - (BOOL)dispatchBytecode:(STBytecode)bytecode;
--- steptalk.orig/Modules/AppKit/AppKitNotifications.m
+++ steptalk/Modules/AppKit/AppKitNotifications.m
@@ -63,8 +63,8 @@
                             numberWithFloat(numberClass, numberWithInt_sel, obj), \
                             name)
 
-    ADD_id_OBJECT(NSColorListChangedNotification,@"NSColorListChangedNotification");
-    ADD_id_OBJECT(NSColorPanelColorChangedNotification,@"NSColorPanelColorChangedNotification");
+    ADD_id_OBJECT(NSColorListDidChangeNotification,@"NSColorListDidChangeNotification");
+    ADD_id_OBJECT(NSColorPanelColorDidChangeNotification,@"NSColorPanelColorDidChangeNotification");
     ADD_id_OBJECT(NSControlTextDidBeginEditingNotification,@"NSControlTextDidBeginEditingNotification");
     ADD_id_OBJECT(NSControlTextDidEndEditingNotification,@"NSControlTextDidEndEditingNotification");
     ADD_id_OBJECT(NSControlTextDidChangeNotification,@"NSControlTextDidChangeNotification");