Skip to content

Instantly share code, notes, and snippets.

@def-
Created January 23, 2015 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save def-/c496cd42774617fd0271 to your computer and use it in GitHub Desktop.
Save def-/c496cd42774617fd0271 to your computer and use it in GitHub Desktop.
/* Generated by Nim Compiler v0.10.3 */
/* (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -O3 -fno-strict-aliasing -I/media/nim/lib -o /home/deen/nimcache/asd.o /home/deen/nimcache/asd.c */
#define NIM_INTBITS 64
#include "nimbase.h"
#include <stdio.h>
#include <string.h>
typedef struct TY89012 TY89012;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TY89012 {
NI HEX3Astate;
NI X89005;
};
typedef N_NIMCALL_PTR(void, TY3289) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3294) (void* p);
struct TNimType {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3289 marker;
TY3294 deepcopy;
};
struct TNimNode {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (void* ClEnv);
void* ClEnv;
} TY89007;
typedef N_CLOSURE_PTR(void, TMP7) (void);
N_NIMCALL(void, a_89003)(void);
N_NIMCALL(void, TMP6)(void* p, NI op);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_CLOSURE(void, b_89006)(void* ClEnv);
N_NIMCALL(NimStringDesc*, nimIntToStr)(NI x);
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, asdInit)(void);
NIM_EXTERNC N_NOINLINE(void, asdDatInit)(void);
TNimType NTI89012; /* object */
extern TNimType NTI108; /* int */
TNimType NTI89014; /* range -1..0(int) */
TNimType NTI89022; /* ref object */
N_NIMCALL(void, TMP6)(void* p, NI op) {
TY89012* a;
a = (TY89012*)p;
}
N_CLOSURE(void, b_89006)(void* ClEnv) {
TY89012* HEX3Aenvp_89018;
NimStringDesc* LOC1;
HEX3Aenvp_89018 = (TY89012*) ClEnv;
LOC1 = 0;
LOC1 = nimIntToStr((*HEX3Aenvp_89018).X89005);
printf("%s\012", (LOC1)->data);
}
N_NIMCALL(void, a_89003)(void) {
TY89012* HEX3Aenv_89021;
TY89007 LOC1;
HEX3Aenv_89021 = 0;
HEX3Aenv_89021 = (TY89012*) newObj((&NTI89022), sizeof(TY89012));
(*HEX3Aenv_89021).X89005 = 10;
memset((void*)(&LOC1), 0, sizeof(LOC1));
LOC1.ClPrc = b_89006; LOC1.ClEnv = HEX3Aenv_89021;
LOC1.ClEnv? LOC1.ClPrc(LOC1.ClEnv):((TMP7)(LOC1.ClPrc))();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
setStackBottom(locals);
}
void PreMainInner() {
systemInit();
asdDatInit();
}
void PreMain() {
void (*volatile inner)();
systemDatInit();
inner = PreMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int cmdCount;
char** cmdLine;
char** gEnv;
N_CDECL(void, NimMainInner)(void) {
asdInit();
}
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, asdInit)(void) {
a_89003();
}
NIM_EXTERNC N_NOINLINE(void, asdDatInit)(void) {
static TNimNode* TMP5[2];
static TNimNode TMP3[3];
NTI89012.size = sizeof(TY89012);
NTI89012.kind = 18;
NTI89012.base = 0;
NTI89012.flags = 3;
TMP5[0] = &TMP3[1];
NTI89014.size = sizeof(NI);
NTI89014.kind = 20;
NTI89014.base = (&NTI108);
NTI89014.flags = 3;
TMP3[1].kind = 1;
TMP3[1].offset = offsetof(TY89012, HEX3Astate);
TMP3[1].typ = (&NTI89014);
TMP3[1].name = ":state";
TMP5[1] = &TMP3[2];
TMP3[2].kind = 1;
TMP3[2].offset = offsetof(TY89012, X89005);
TMP3[2].typ = (&NTI108);
TMP3[2].name = "x89005";
TMP3[0].len = 2; TMP3[0].kind = 2; TMP3[0].sons = &TMP5[0];
NTI89012.node = &TMP3[0];
NTI89022.size = sizeof(TY89012*);
NTI89022.kind = 22;
NTI89022.base = (&NTI89012);
NTI89022.flags = 2;
NTI89022.marker = TMP6;
}
proc a =
var x = 10
proc b = echo x
b()
a()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment