Created
February 4, 2015 21:44
-
-
Save philip-wernersbach/025530cd63312c41d6d9 to your computer and use it in GitHub Desktop.
Araq/Nim: Invalid Objective-C code generated when calling class method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generated by Nim Compiler v0.10.3 */ | |
/* (c) 2015 Andreas Rumpf */ | |
/* The generated code is subject to the original license. */ | |
/* Compiled for: MacOSX, amd64, clang */ | |
/* Command for C compiler: | |
clang -c -w -I/Users/philip/coding_projects/published-forked-from-github/Nim/lib -o nimcache/minimalist_cocoa_app.o nimcache/minimalist_cocoa_app.m */ | |
#define NIM_INTBITS 64 | |
#include "nimbase.h" | |
#import <Cocoa/Cocoa.h> | |
static N_INLINE(NI, newnsautoreleasepool_90038)(void); | |
static N_INLINE(void, nimFrame)(TFrame* s); | |
N_NOINLINE(void, stackoverflow_19401)(void); | |
static N_INLINE(void, popFrame)(void); | |
static N_INLINE(void, initStackBottomWith)(void* locals); | |
N_NOINLINE(void, setStackBottom)(void* thestackbottom); | |
NIM_EXTERNC N_NOINLINE(void, systemInit)(void); | |
NIM_EXTERNC N_NOINLINE(void, systemDatInit)(void); | |
NIM_EXTERNC N_NOINLINE(void, minimalist_cocoa_appInit)(void); | |
NIM_EXTERNC N_NOINLINE(void, minimalist_cocoa_appDatInit)(void); | |
NI pool_90058; | |
extern TFrame* frameptr_16842; | |
static N_INLINE(void, nimFrame)(TFrame* s) { | |
NI LOC1; | |
LOC1 = 0; | |
{ | |
if (!(frameptr_16842 == NIM_NIL)) goto LA4; | |
LOC1 = 0; | |
} | |
goto LA2; | |
LA4: ; | |
{ | |
LOC1 = ((NI) ((NI16)((*frameptr_16842).calldepth + ((NI16) 1)))); | |
} | |
LA2: ; | |
(*s).calldepth = ((NI16) (LOC1)); | |
(*s).prev = frameptr_16842; | |
frameptr_16842 = s; | |
{ | |
if (!((*s).calldepth == ((NI16) 2000))) goto LA9; | |
stackoverflow_19401(); | |
} | |
LA9: ; | |
} | |
static N_INLINE(void, popFrame)(void) { | |
frameptr_16842 = (*frameptr_16842).prev; | |
} | |
static N_INLINE(NI, newnsautoreleasepool_90038)(void) { | |
NI result; | |
NI LOC1; | |
nimfr("newNSAutoreleasePool", "minimalist_cocoa_app.nim") | |
result = 0; | |
nimln(20, "minimalist_cocoa_app.nim"); | |
nimln(20, "minimalist_cocoa_app.nim"); | |
nimln(20, "minimalist_cocoa_app.nim"); | |
LOC1 = 0; | |
LOC1 = [NSAutoreleasePool alloc]; | |
result = [LOC1 init]; | |
goto BeforeRet; | |
BeforeRet: ; | |
popFrame(); | |
return result; | |
} | |
static N_INLINE(void, initStackBottomWith)(void* locals) { | |
setStackBottom(locals); | |
} | |
void PreMainInner() { | |
systemInit(); | |
minimalist_cocoa_appDatInit(); | |
} | |
void PreMain() { | |
void (*volatile inner)(); | |
systemDatInit(); | |
inner = PreMainInner; | |
initStackBottomWith((void *)&inner); | |
(*inner)(); | |
} | |
int cmdCount; | |
char** cmdLine; | |
char** gEnv; | |
N_CDECL(void, NimMainInner)(void) { | |
minimalist_cocoa_appInit(); | |
} | |
N_CDECL(void, NimMain)(void) { | |
void (*volatile inner)(); | |
PreMain(); | |
inner = NimMainInner; | |
initStackBottomWith((void *)&inner); | |
(*inner)(); | |
} | |
int main(int argc, char** args, char** env) { | |
cmdLine = args; | |
cmdCount = argc; | |
gEnv = env; | |
NimMain(); | |
return nim_program_result; | |
} | |
NIM_EXTERNC N_NOINLINE(void, minimalist_cocoa_appInit)(void) { | |
NI LOC1; | |
NIM_BOOL LOC2; | |
nimfr("minimalist_cocoa_app", "minimalist_cocoa_app.nim") | |
nimln(4, "minimalist_cocoa_app.nim"); | |
nimln(25, "minimalist_cocoa_app.nim"); | |
pool_90058 = newnsautoreleasepool_90038(); | |
nimln(26, "minimalist_cocoa_app.nim"); | |
nimln(26, "minimalist_cocoa_app.nim"); | |
LOC1 = 0; | |
LOC1 = [NSApplication sharedApplication]; | |
nimln(27, "minimalist_cocoa_app.nim"); | |
nimln(27, "minimalist_cocoa_app.nim"); | |
LOC2 = 0; | |
LOC2 = [((NU8) 0) NSApp setActivationPolicy]; | |
popFrame(); | |
} | |
NIM_EXTERNC N_NOINLINE(void, minimalist_cocoa_appDatInit)(void) { | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cocoa_h = "<Cocoa/Cocoa.h>" | |
{.passL: "-framework Cocoa"} | |
{.emit: "#import " & cocoa_h.} | |
type | |
NSObject {.importc: "NSObject", header: cocoa_h, final.} = distinct int | |
NSAutoreleasePool {.importc: "NSAutoreleasePool", header: cocoa_h, final.} = NSObject | |
NSApplication {.importc: "NSApplication", header: cocoa_h, final.} = NSObject | |
NSApplicationActivationPolicy = enum | |
NSApplicationActivationPolicyRegular, | |
NSApplicationActivationPolicyAccessory, | |
NSApplicationActivationPolicyProhibited | |
proc objcAllocNSAutoreleasePool: NSAutoreleasePool {.importobjc: "NSAutoreleasePool alloc", nodecl.} | |
proc objcInitNSAutoreleasePool(self: NSAutoreleasePool): NSAutoreleasePool {.importobjc: "init", nodecl.} | |
proc newNSAutoreleasePool: NSAutoreleasePool {.inline.} = | |
return objcAllocNSAutoreleasePool().objcInitNSAutoreleasePool() | |
proc nsApplicationSharedApplication: NSApplication {.importobjc: "NSApplication sharedApplication", nodecl.} | |
proc nsAppSetActivationPolicy(policy: NSApplicationActivationPolicy): bool {.importobjc: "NSApp setActivationPolicy", nodecl.} | |
let pool = newNSAutoreleasePool() | |
discard nsApplicationSharedApplication() | |
discard nsAppSetActivationPolicy(NSApplicationActivationPolicyRegular) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment