added #define PYEXT so you can use an external tpt_console.py on 64bit OSes

This commit is contained in:
Lieuwe 2011-03-13 18:45:40 +01:00
parent db07c1ee0c
commit c33f6adae7
6 changed files with 31 additions and 5 deletions

View File

@ -28,7 +28,7 @@ def init():
NICK=name+"[tpt]"
IDENT=name+"[tpt]"
REALNAME=name
CHANNEL="#foobar7"
CHANNEL="#powder"
readbuffer=""
def exit():
@ -57,7 +57,7 @@ def key(keyy) :
except:
key.pmod=(False,False,False)
global typing,typed
print "got %s"%repr(keyy)
#print "got %s"%repr(keyy)
ctrl1,ctrl2,alt1,alt2,shift1,shift2=tpt.get_modifier()
mod=(ctrl1 or ctrl2,alt1 or alt2,shift1 or shift2)
skip=False

View File

@ -68,6 +68,7 @@ extern unsigned char ZSIZE;
#define BRUSH_NUM 2
#define PYCONSOLE
//#define PYEXT //enable this on 64bit to prevent segfault
#ifdef PIX16
typedef unsigned short pixel;

File diff suppressed because one or more lines are too long

0
log.log Normal file
View File

View File

@ -27,8 +27,10 @@
#ifdef PYCONSOLE
#include "Python.h"
#ifndef PYEXT
#include "pyconsole.h"
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
@ -1972,10 +1974,15 @@ int main(int argc, char *argv[])
PyRun_SimpleString("import sys\nsys.path.append('.')");
PyRun_SimpleString("print 'python present.'");
//load the console module and whatnot
//pname=PyString_FromString("tpt_console");//create string object
//pmodule = PyImport_Import(pname);//import module
#ifdef PYEXT
printf("using external python console file.\n");
pname=PyString_FromString("tpt_console");//create string object
pmodule = PyImport_Import(pname);//import module
Py_DECREF(pname);//throw away string
#else
PyObject *tpt_console_obj = PyMarshal_ReadObjectFromString(tpt_console_pyc+8, sizeof(tpt_console_pyc)-8);
pmodule=PyImport_ExecCodeModule("tpt_console", tpt_console_obj);
#endif
if(pmodule!=NULL)
{
//Py_DECREF(pname);//throw away the string object

18
syntaxcheck.py Normal file
View File

@ -0,0 +1,18 @@
import sys
import subprocess
if len(sys.argv)<2:
print("usage: syntaxcheck.py <filename>")
raise SystemExit
fname=sys.argv[1]
cppargs=["-E"]+sys.argv[2:]
p=subprocess.Popen(["gcc",fname]+cppargs,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
ret=p.communicate()
if len(ret[1])>0:
print("errors hapened!")
print(repr(ret[1].decode()))
raise SystemExit(-1)
print(len(ret[0].decode()))
#python syntaxcheck.py ./src/main.c -DINTERNAL -opowder -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations -lSDL -lm -lbz2 -lpython2.7 -lm -L/usr/lib/python2.7/config -I/usr/include/python2.7 -march=native -DX86 -DX86_SSE3 -msse3 src/*.c src/elements/*.c -DLIN64