From: khamidou Date: Wed, 10 Jun 2009 21:08:58 +0000 (+0200) Subject: rewriting the painting code X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ade29454c975d79d9dff3e825e11695b553c234a;p=te.git rewriting the painting code --- diff --git a/py2c.py b/py2c.py new file mode 100755 index 0000000..a813612 --- /dev/null +++ b/py2c.py @@ -0,0 +1,29 @@ +#! /usr/bin/env python +# +# py2c takes as parameters a list of python files and creates one big C file +# that contains strings that are fed to the python interpreter. + +import sys + +try: + ofile = open("py2cout.c", "w+") +except IOError: + print "Unable to open py2cout.c" + sys.exit(-1) + +skel = +"/* This code has been generated by py2c.py +#include " + +ofile.write(skel) + +for i in sys.argv[1:]: + try: + f = open(i, "r") + except IOError: + print "Unable to open " + i + sys.exit(-1) + + c = f.read() + + diff --git a/util.h b/util.h new file mode 100644 index 0000000..0142824 --- /dev/null +++ b/util.h @@ -0,0 +1,6 @@ +#ifndef __TE_UTIL_H__ +#define __TE_UTIL_H__ + +#define decrement_or_nullify(x) (x > 0) ? x-- : x = 0; + +#endif