Created
October 31, 2009 21:07
-
-
Save hiredman/223246 to your computer and use it in GitHub Desktop.
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
user=> | |
(cc | |
#^{:tag :c-program :compiler "gcc" :options "-I/usr/local/include/ -L/usr/local/lib -lgc" | |
:file-name "test.c" :binary-file "test"} | |
(#^:include<> ["stdio.h"] | |
#^:include<> ["gc.h"] | |
"typedef union se {struct cons * cp; int i;} sexp;\n" | |
"struct cons {union se head; union se tail;};\n" | |
(#^:int main [] | |
{#^:int x 1 | |
#^:int m 2} | |
{#^:int w #^:call (printf "Hello Wolrd %d\n" x)} | |
#^:call (printf "%d\n" w) | |
#^:call (hello "Hello World\n") | |
#^:call (return 0)) | |
(#^:void hello [#^:char* s] | |
#^:call (printf "%s" s)))) | |
gcc -I/usr/local/include/ -L/usr/local/lib -lgc test.c -o test | |
#<user$eval__2004$fn__2006 user$eval__2004$fn__2006@15291cd> | |
user=> (-> *1 (apply nil) .getInputStream is->string print) | |
Hello Wolrd 1 | |
14 | |
Hello World | |
nil | |
user=> | |
;cat test.c | |
#include<stdio.h> | |
#include<gc.h> | |
typedef union se {struct cons * cp; int i;} sexp; | |
struct cons {union se head; union se tail;}; | |
int main () | |
{ | |
int x = 1; | |
int m = 2; | |
int w = printf("Hello Wolrd %d\n",x); | |
; | |
printf("%d\n",w); | |
hello("Hello World\n"); | |
return(0); | |
} | |
void hello ( char* s) | |
{ | |
printf("%s",s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment