Fix brainf*ck interpreter memory issue
[bob_language.git] / preprocessor.sh
blobb3eae3b71acfe62bab3fd94cc9ff3da939904f1a
1 #!/bin/sh
3 echo "Preprocessing code.asm..."
5 outfile="assembly.c"
6 outfileh="assembly.h"
8 echo "#include <stdio.h>" > $outfile
9 echo "" >> assembly.c
10 echo "void asm_print(FILE *output) {" >> $outfile
11 sed 's/\(^.*$\)/ fputs(\"\1\\n", output);/' code.asm >> $outfile
12 echo "}" >> $outfile
14 echo "#ifndef ASSEMBLY_H" > $outfileh
15 echo "#define TABLES_H" >> $outfileh
16 echo "" >> $outfileh
17 echo "void asm_print(FILE *output);" >> $outfileh
18 echo "" >> $outfileh
19 echo "#endif" >> $outfileh