Skip to content

Commit 8e8077f

Browse files
committed
Refactor send
1 parent 618b1a9 commit 8e8077f

File tree

7 files changed

+21
-22
lines changed

7 files changed

+21
-22
lines changed

.gdbinit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ end
9494

9595

9696
define ofield
97-
po (($arg0)((OOP)$arg1)->object)->$arg2
97+
pos (($arg0)((OOP)$arg1)->object)->$arg2
9898
end
9999
document ofield
100100
Access a field of a Smalltalk object and print its contents.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ aclocal.m4
44
config.*
55
configure
66
*.o
7+
*.d
78
*.lo
89
*.la
910
*.star

gst-objc-ext.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ typedef union ObjcType {
1515
unsigned int uintType;
1616
long longType;
1717
unsigned long ulongType;
18-
long long longlongType;
19-
unsigned long long ulonglongType;
20-
float floatTYpe;
21-
double doubleType;
18+
// long long longlongType;
19+
// unsigned long long ulonglongType;
20+
// float floatTYpe;
21+
// double doubleType;
2222
SEL selType;
2323
} ObjcType;
2424

gst-objc-ext.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void gst_SkipQualifiers(const char **typestr)
128128
return NULL;
129129
}
130130

131-
static void UnboxValue(long long value, void *dest, const char *objctype)
131+
void gst_unboxValue(long long value, void *dest, const char *objctype)
132132
{
133133
gst_SkipQualifiers(&objctype);
134134

@@ -215,7 +215,7 @@ static void UnboxValue(long long value, void *dest, const char *objctype)
215215
}
216216
}
217217

218-
static ObjcType BoxValue(void *value, const char *typestr)
218+
ObjcType gst_boxValue(void *value, const char *typestr)
219219
{
220220
gst_SkipQualifiers(&typestr);
221221
ObjcType ret;
@@ -373,13 +373,14 @@ static ObjcType BoxValue(void *value, const char *typestr)
373373
for (i = 0; i < argc; i++)
374374
{
375375
const char *objCType = [sig getArgumentTypeAtIndex: i + 2];
376-
gst_UnboxValue(args[i], unboxedArgumentsBuffer[i + 2], objCType);
376+
gst_unboxValue(args[i], unboxedArgumentsBuffer[i + 2], objCType);
377377
unboxedArguments[i + 2] = unboxedArgumentsBuffer[i + 2];
378378
}
379379

380380
char msgSendRet[[sig methodReturnLength]];
381381
ffi_call(&cif, methodIMP, &msgSendRet, unboxedArguments);
382-
382+
383+
return gst_boxValue(msgSendRet, [sig methodReturnType]);
383384
}
384385

385386
void

gst-objc.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
proxy->defineCFunc ("objc_retain", gst_retain);
2626
proxy->defineCFunc ("objc_release", gst_release);
2727
pool = [[NSAutoreleasePool alloc] init];
28-
29-
[NSApplication sharedApplication];
30-
NSWindow* wnd = [[NSWindow alloc] initWithContentRect: NSMakeRect(0.0, 0.0, 100.0, 100.0)
31-
styleMask: 15
32-
backing: 2
33-
defer: 1];
34-
[wnd setTitle: @"Test it"];
3528
NSLog (@"Load complete");
3629
}
3730

gst-objc/ObjcObject.st

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ Object subclass: ObjcObject [
6565
ifFalse: [buffer at: i - 1 put: each type: CLongType valueType]
6666
]
6767
]."
68-
return := ObjcRuntime objcMsgSendClass: nil
69-
receiver: self objcPtr
70-
sel: selector
68+
return := ObjcRuntime objcMsgSend: self objcPtr
69+
sel: (ObjcRuntime selRegisterName: selector)
7170
argc: arguments size
72-
argv: arguments.
71+
argv: arguments
72+
super: nil.
7373
" buffer free."
7474
^return = objcPtr
7575
ifFalse: [self class basicFromPtr: return]

gst-objc/ObjcRuntime.st

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
CStruct subclass: ObjcType [
2+
<declaration: #((#value #long))>
3+
]
4+
15
Object subclass: ObjcRuntime [
26

37
ObjcRuntime class [
@@ -42,9 +46,9 @@ Object subclass: ObjcRuntime [
4246
<cCall: 'class_getName' returning: #string args: #( #cObject )>
4347
]
4448

45-
objcMsgSendClass: class receiver: receiver sel: selector argc: aInt argv: args [
49+
objcMsgSend: receiver sel: selector argc: aInt argv: args super: class [
4650
<category: 'instance'>
47-
<cCall: 'objc_sendMsg' returning: #cObject args: #( #cObject #cObject #string #uint #unknown )>
51+
<cCall: 'objc_sendMsg' returning: #{ObjcType} args: #( #cObject #cObject #uint #smalltalk #cObject )>
4852
]
4953

5054
retain: receiver [

0 commit comments

Comments
 (0)