changeset 5021:f7331c9f689f

<oerjan> chmod +x gcccomp; mv gcccomp interps/gcccomp
author HackBot
date Mon, 06 Oct 2014 05:38:55 +0000
parents fb86bf0b485a
children b19465a7c673
files gcccomp interps/gcccomp/gcccomp
diffstat 2 files changed, 1 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/gcccomp	Mon Oct 06 05:38:14 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#!/bin/bash
-LANG="$1"
-echo >>"$2"
-
-case "$LANG" in
-    c)
-        HEAD='#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/types.h>\n#include <unistd.h>\nint main(int argc, char **argv) {\nint main(void) { printf("Calling main from itself not supported.\n"); exit(1); }\n'
-        TAIL='; return 0; }'
-        EXT='c'
-        GCC='gcc'
-        FLAGS='-std=gnu99'
-    ;;
-
-    c++)
-        HEAD='#include <iostream>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\nusing namespace std;\nint main(int argc, char **argv) {'
-        TAIL='; return 0; }'
-        EXT='cc'
-        GCC='g++'
-        FLAGS='-std=gnu++0x'
-    ;;
-
-    assembler)
-        HEAD='.globl main; main: pushq %rbp; movq %rsp, %rbp;'
-        TAIL='movl $0, %eax; leave; ret;'
-        EXT='s'
-        GCC='gcc'
-        FLAGS=''
-    ;;
-
-    java)
-        HEAD='class Main { public static void main(String[] args) {'
-        TAIL='; } }'
-        EXT='java'
-        GCC='gcj'
-        FLAGS='--main=Main'
-    ;;
-esac
-
-SOURCE="/tmp/source.$$.$EXT"
-
-(
-    echo -e "$HEAD"
-    cat "$2"
-    echo "$TAIL"
-) > "$SOURCE"
-
-"$GCC" -x "$LANG" "$SOURCE" $FLAGS -o /tmp/compiled.$$ 2> /dev/null ||
-"$GCC" -x "$LANG" "$2" $FLAGS -o /tmp/compiled.$$ 2> /dev/null ||
-echo 'Does not compile.'
-rm -f "$SOURCE"
-
-#ulimit -u 3
-if [ -x /tmp/compiled.$$ ] ; then /tmp/compiled.$$; fi 2>&1
-rm -f /tmp/compiled.$$
--- a/interps/gcccomp/gcccomp	Mon Oct 06 05:38:14 2014 +0000
+++ b/interps/gcccomp/gcccomp	Mon Oct 06 05:38:55 2014 +0000
@@ -4,7 +4,7 @@
 
 case "$LANG" in
     c)
-        HEAD='#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/types.h>\n#include <unistd.h>\nint main(int argc, char **argv) {'
+        HEAD='#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/types.h>\n#include <unistd.h>\nint main(int argc, char **argv) {\nint main(void) { printf("Calling main from itself not supported.\n"); exit(1); }\n'
         TAIL='; return 0; }'
         EXT='c'
         GCC='gcc'