diff --git a/build/example.py b/build/example.py index 3bde517bd..850d8ae12 100644 --- a/build/example.py +++ b/build/example.py @@ -1,10 +1,21 @@ -import tpt -import random -import time +import utils # example script def noise(typ,amount=50): - for xx in range(284,316): - for yy in range(184,216): + for xx in range(4,612): + for yy in range(4,384): if(random.randrange(0,100)>8 + t = tpt.get_prop(i,"type")+amount + if t>=148: + t=t-148 + if t==128: + t=129 + if t==55: + t=56 + tpt.set_type(i=i,settoint=t) \ No newline at end of file diff --git a/console_README b/console_README index c989987b1..b94053e3d 100644 --- a/console_README +++ b/console_README @@ -2,37 +2,36 @@ the console in this version is a python console and will execute any command you enter. the api for interacting with the powder toy is contained in the tpt module and is already imported at startup. currently implemented api functions: - tpt.create(x,y,type) create a particle of type at , - tpt.reset_velocity() resets all velocity - tpt.reset_pressure() resets all pressure - tpt.reset_sparks() resets all sparks - tpt.set_life(type,life) sets the life of all particles with type - to (set to -1 for all) - tpt.set_type(type1,type2) sets the type of all particles with type - to (set to -1 for all) - tpt.set_temp(type,temp) sets the temp of all particles with type - to (set to -1 for all) - tpt.set_tmp(type,tmp) sets the tmp of all particles with type - to (set to -1 for all) - tpt.set_x(type,x) sets the x of all particles with type - to (set to -1 for all) - tpt.set_y(type,y) sets the y of all particles with type - to (set to -1 for all) - tpt.set_vx(type,vx) sets the vx of all particles with type - to (set to -1 for all) - tpt.set_vy(type,vy) sets the vy of all particles with type - to (set to -1 for all) - tpt.set_ctype(type,ctype) sets the ctype of all particles with type - to (set to -1 for all) - tpt.pause() pause the game(note that closing the console - pauses the game) - tpt.unpause() unpause the game(note that closing the console - pauses the game) - tpt.toggle_pause() toggle pause(note that closing the console - pauses the game) - tpt.close_console() closes the console and pauses the game - tpt.open_console() opens the console - tpt.toggle_console() toggles the console + create(x,y,type) create a particle of type at , + reset_velocity() resets all velocity + reset_pressure() resets all pressure + reset_sparks() resets all sparks + +### USING SET COMMANDS ### +the console uses keywords to identify variables of what to set, you can specify x and y coords with x=100 y=100, ect. +i is the particle number +name will change all of name's type to the setto variable. It needs to be a string "dust" ect, "all" for all. +the setto is what the particle(s) will be set to, it is a string for the type/ctype commands, and an int for the rest. +you need to set the to* variable and one location/name/coords for it to work. + set_type(x=,y=,i=,name="",setto="") + set_life() + set_temp() + set_tmp() + set_x() + set_y() + set_vx() + set_vy() + set_ctype() + + pause() pause the game(note that closing the console + pauses the game) + unpause() unpause the game(note that closing the console + pauses the game) + toggle_pause() toggle pause(note that closing the console + pauses the game) + close_console() closes the console and pauses the game + open_console() opens the console + toggle_console() toggles the console NOTE: these functions don't do bounds checking, which means that they CAN AND WILL CRASH the powder toy. be carefull. @@ -43,5 +42,4 @@ tpt.set_life(32,life) you can do tpt.set_life(element['uran'],life) ### COMPILING ### before you compile you should have python 2.x installed. -you must run the "getheader.py" script to get the correct linking options, add -these options to the makefile \ No newline at end of file +you must run the "getheader.py" script to get the correct linking options, add these options to the makefile diff --git a/getheader.py b/getheader.py index 558726c4f..da581b5ff 100644 --- a/getheader.py +++ b/getheader.py @@ -1,5 +1,6 @@ import sys import os.path +import compileall path=os.path.join(sys.exec_prefix,"include","python%s"%sys.version[:3]) #print "headers at ",repr(path) #-lpython2.3 -lm -L/usr/lib/python2.3/config @@ -10,4 +11,27 @@ print args,"-I%s"%path path=os.path.join(sys.exec_prefix,"include") args="-lpython%s -lm -L%s"%(sys.version[:3],os.path.join(sys.exec_prefix,"lib","config"))#,"python%s"%sys.version[:3] print "\n windows args are" -print args,"-I%s"%path \ No newline at end of file +print args,"-I%s"%path + +#unsigned char tpt_console_pyc[] = { 0x1B, 0x57}; +lst=[] +compileall.compile_dir("./src/python", force=1) + +print "\n\n\ngenerating pyconsole.h" + +fname="./src/python/tpt_console.pyc" +try: + fid=open(fname,"r") +except IOError: + fname="./src/python/tpt_console.pyo" +finally: + fid.close() + +with open(fname,"r") as fid: + for char in fid.read(): + lst.append(hex(ord(char))) +tmp=",".join(lst) +out=''.join(["#include \nunsigned char tpt_console_pyc[] = {",tmp,"};"]) +with open("./includes/pyconsole.h","w") as fid: + fid.write(out) +print "done" diff --git a/includes/defines.h b/includes/defines.h index f3abed394..8ac19db00 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -16,6 +16,8 @@ #define THUMB_CACHE_SIZE 256 +//#define pyconsole + #define IMGCONNS 3 #define TIMEOUT 100 #define HTTP_TIMEOUT 10 diff --git a/includes/pyconsole.h b/includes/pyconsole.h new file mode 100644 index 000000000..733d17799 --- /dev/null +++ b/includes/pyconsole.h @@ -0,0 +1,2 @@ +#include +unsigned char tpt_console_pyc[] = {0x3,0xf3,0xd,0xa,0x26,0xe1,0x6f,0x4d,0x63,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x73,0xc5,0x4,0x0,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x0,0x0,0x5a,0x0,0x0,0x64,0x0,0x0,0x64,0x2,0x0,0x6c,0x0,0x0,0x54,0x64,0x0,0x0,0x64,0x2,0x0,0x6c,0x1,0x0,0x54,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x2,0x0,0x5a,0x2,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x3,0x0,0x5a,0x3,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x4,0x0,0x5a,0x4,0x0,0x64,0x0,0x0,0x64,0x1,0x0,0x6c,0x5,0x0,0x5a,0x5,0x0,0x64,0x3,0x0,0x64,0x34,0x1,0x64,0x4,0x0,0x84,0x0,0x0,0x83,0x0,0x0,0x59,0x5a,0x6,0x0,0x65,0x6,0x0,0x83,0x0,0x0,0x65,0x2,0x0,0x5f,0x7,0x0,0x65,0x6,0x0,0x83,0x0,0x0,0x65,0x2,0x0,0x5f,0x8,0x0,0x69,0x95,0x0,0x64,0x5,0x0,0x64,0x6,0x0,0x36,0x64,0x7,0x0,0x64,0x8,0x0,0x36,0x64,0x9,0x0,0x64,0xa,0x0,0x36,0x64,0xb,0x0,0x64,0xc,0x0,0x36,0x64,0xd,0x0,0x64,0xe,0x0,0x36,0x64,0xf,0x0,0x64,0x10,0x0,0x36,0x64,0x11,0x0,0x64,0x12,0x0,0x36,0x64,0x13,0x0,0x64,0x14,0x0,0x36,0x64,0x15,0x0,0x64,0x16,0x0,0x36,0x64,0x17,0x0,0x64,0x18,0x0,0x36,0x64,0x19,0x0,0x64,0x1a,0x0,0x36,0x64,0x1b,0x0,0x64,0x1c,0x0,0x36,0x64,0x1d,0x0,0x64,0x1e,0x0,0x36,0x64,0x1f,0x0,0x64,0x20,0x0,0x36,0x64,0x21,0x0,0x64,0x22,0x0,0x36,0x64,0x23,0x0,0x64,0x24,0x0,0x36,0x64,0x25,0x0,0x64,0x26,0x0,0x36,0x64,0x27,0x0,0x64,0x28,0x0,0x36,0x64,0x29,0x0,0x64,0x2a,0x0,0x36,0x64,0x2b,0x0,0x64,0x2c,0x0,0x36,0x64,0x2d,0x0,0x64,0x2e,0x0,0x36,0x64,0x2f,0x0,0x64,0x30,0x0,0x36,0x64,0x31,0x0,0x64,0x32,0x0,0x36,0x64,0x33,0x0,0x64,0x34,0x0,0x36,0x64,0x35,0x0,0x64,0x36,0x0,0x36,0x64,0x37,0x0,0x64,0x38,0x0,0x36,0x64,0x39,0x0,0x64,0x3a,0x0,0x36,0x64,0x3b,0x0,0x64,0x3c,0x0,0x36,0x64,0x3d,0x0,0x64,0x3e,0x0,0x36,0x64,0x3f,0x0,0x64,0x40,0x0,0x36,0x64,0x41,0x0,0x64,0x42,0x0,0x36,0x64,0x43,0x0,0x64,0x44,0x0,0x36,0x64,0x45,0x0,0x64,0x46,0x0,0x36,0x64,0x47,0x0,0x64,0x48,0x0,0x36,0x64,0x49,0x0,0x64,0x4a,0x0,0x36,0x64,0x4b,0x0,0x64,0x4c,0x0,0x36,0x64,0x4d,0x0,0x64,0x4e,0x0,0x36,0x64,0x4f,0x0,0x64,0x50,0x0,0x36,0x64,0x51,0x0,0x64,0x52,0x0,0x36,0x64,0x53,0x0,0x64,0x54,0x0,0x36,0x64,0x55,0x0,0x64,0x56,0x0,0x36,0x64,0x57,0x0,0x64,0x58,0x0,0x36,0x64,0x59,0x0,0x64,0x5a,0x0,0x36,0x64,0x5b,0x0,0x64,0x5c,0x0,0x36,0x64,0x5d,0x0,0x64,0x5e,0x0,0x36,0x64,0x5f,0x0,0x64,0x60,0x0,0x36,0x64,0x61,0x0,0x64,0x62,0x0,0x36,0x64,0x63,0x0,0x64,0x64,0x0,0x36,0x64,0x65,0x0,0x64,0x66,0x0,0x36,0x64,0x67,0x0,0x64,0x68,0x0,0x36,0x64,0x69,0x0,0x64,0x6a,0x0,0x36,0x64,0x6b,0x0,0x64,0x6c,0x0,0x36,0x64,0x6d,0x0,0x64,0x6e,0x0,0x36,0x64,0x6f,0x0,0x64,0x70,0x0,0x36,0x64,0x71,0x0,0x64,0x72,0x0,0x36,0x64,0x73,0x0,0x64,0x74,0x0,0x36,0x64,0x75,0x0,0x64,0x76,0x0,0x36,0x64,0x77,0x0,0x64,0x78,0x0,0x36,0x64,0x79,0x0,0x64,0x7a,0x0,0x36,0x64,0x7b,0x0,0x64,0x7c,0x0,0x36,0x64,0x7d,0x0,0x64,0x7e,0x0,0x36,0x64,0x7f,0x0,0x64,0x80,0x0,0x36,0x64,0x81,0x0,0x64,0x82,0x0,0x36,0x64,0x83,0x0,0x64,0x84,0x0,0x36,0x64,0x85,0x0,0x64,0x86,0x0,0x36,0x64,0x87,0x0,0x64,0x88,0x0,0x36,0x64,0x89,0x0,0x64,0x8a,0x0,0x36,0x64,0x8b,0x0,0x64,0x8c,0x0,0x36,0x64,0x8d,0x0,0x64,0x8e,0x0,0x36,0x64,0x8f,0x0,0x64,0x90,0x0,0x36,0x64,0x91,0x0,0x64,0x92,0x0,0x36,0x64,0x93,0x0,0x64,0x94,0x0,0x36,0x64,0x95,0x0,0x64,0x96,0x0,0x36,0x64,0x97,0x0,0x64,0x98,0x0,0x36,0x64,0x99,0x0,0x64,0x9a,0x0,0x36,0x64,0x9b,0x0,0x64,0x9c,0x0,0x36,0x64,0x9d,0x0,0x64,0x9e,0x0,0x36,0x64,0x9f,0x0,0x64,0xa0,0x0,0x36,0x64,0xa1,0x0,0x64,0xa2,0x0,0x36,0x64,0xa3,0x0,0x64,0xa4,0x0,0x36,0x64,0xa5,0x0,0x64,0xa6,0x0,0x36,0x64,0xa7,0x0,0x64,0xa8,0x0,0x36,0x64,0xa9,0x0,0x64,0xaa,0x0,0x36,0x64,0xab,0x0,0x64,0xac,0x0,0x36,0x64,0xad,0x0,0x64,0xae,0x0,0x36,0x64,0xaf,0x0,0x64,0xb0,0x0,0x36,0x64,0xb1,0x0,0x64,0xb2,0x0,0x36,0x64,0xb3,0x0,0x64,0xb4,0x0,0x36,0x64,0xb5,0x0,0x64,0xb6,0x0,0x36,0x64,0xb7,0x0,0x64,0xb8,0x0,0x36,0x64,0xb9,0x0,0x64,0xba,0x0,0x36,0x64,0xbb,0x0,0x64,0xbc,0x0,0x36,0x64,0xbd,0x0,0x64,0xbe,0x0,0x36,0x64,0xbf,0x0,0x64,0xc0,0x0,0x36,0x64,0xc1,0x0,0x64,0xc2,0x0,0x36,0x64,0xc3,0x0,0x64,0xc4,0x0,0x36,0x64,0xc5,0x0,0x64,0xc6,0x0,0x36,0x64,0xc7,0x0,0x64,0xc8,0x0,0x36,0x64,0xc9,0x0,0x64,0xca,0x0,0x36,0x64,0xcb,0x0,0x64,0xcc,0x0,0x36,0x64,0xcd,0x0,0x64,0xce,0x0,0x36,0x64,0xcf,0x0,0x64,0xd0,0x0,0x36,0x64,0xd1,0x0,0x64,0xd2,0x0,0x36,0x64,0xd3,0x0,0x64,0xd4,0x0,0x36,0x64,0xd5,0x0,0x64,0xd6,0x0,0x36,0x64,0xd7,0x0,0x64,0xd8,0x0,0x36,0x64,0xd9,0x0,0x64,0xda,0x0,0x36,0x64,0xdb,0x0,0x64,0xdc,0x0,0x36,0x64,0xdd,0x0,0x64,0xde,0x0,0x36,0x64,0xdf,0x0,0x64,0xe0,0x0,0x36,0x64,0xe1,0x0,0x64,0xe2,0x0,0x36,0x64,0xe3,0x0,0x64,0xe4,0x0,0x36,0x64,0xe5,0x0,0x64,0xe6,0x0,0x36,0x64,0xe7,0x0,0x64,0xe8,0x0,0x36,0x64,0xe9,0x0,0x64,0xea,0x0,0x36,0x64,0xeb,0x0,0x64,0xec,0x0,0x36,0x64,0xed,0x0,0x64,0xee,0x0,0x36,0x64,0xef,0x0,0x64,0xf0,0x0,0x36,0x64,0xf1,0x0,0x64,0xf2,0x0,0x36,0x64,0xf3,0x0,0x64,0xf4,0x0,0x36,0x64,0xf5,0x0,0x64,0xf6,0x0,0x36,0x64,0xf7,0x0,0x64,0xf8,0x0,0x36,0x64,0xf9,0x0,0x64,0xfa,0x0,0x36,0x64,0xfb,0x0,0x64,0xfc,0x0,0x36,0x64,0xfd,0x0,0x64,0xfe,0x0,0x36,0x64,0xff,0x0,0x64,0x0,0x1,0x36,0x64,0x1,0x1,0x64,0x2,0x1,0x36,0x64,0x3,0x1,0x64,0x4,0x1,0x36,0x64,0x5,0x1,0x64,0x6,0x1,0x36,0x64,0x7,0x1,0x64,0x8,0x1,0x36,0x64,0x9,0x1,0x64,0xa,0x1,0x36,0x64,0xb,0x1,0x64,0xc,0x1,0x36,0x64,0xd,0x1,0x64,0xe,0x1,0x36,0x64,0xf,0x1,0x64,0x10,0x1,0x36,0x64,0x11,0x1,0x64,0x12,0x1,0x36,0x64,0x13,0x1,0x64,0x14,0x1,0x36,0x64,0x15,0x1,0x64,0x16,0x1,0x36,0x64,0x17,0x1,0x64,0x18,0x1,0x36,0x64,0x19,0x1,0x64,0x1a,0x1,0x36,0x64,0x1b,0x1,0x64,0x1c,0x1,0x36,0x64,0x1d,0x1,0x64,0x1e,0x1,0x36,0x64,0x1f,0x1,0x64,0x20,0x1,0x36,0x64,0x21,0x1,0x64,0x22,0x1,0x36,0x64,0x23,0x1,0x64,0x24,0x1,0x36,0x64,0x25,0x1,0x64,0x26,0x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x6c,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x69,0x73,0x7a,0x73,0x69,0x6d,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x72,0x74,0x69,0x69,0x6e,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x72,0x74,0x6f,0x69,0x6f,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x73,0x74,0x65,0x69,0x70,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x70,0x73,0x74,0x73,0x69,0x71,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x61,0x6e,0x61,0x72,0x69,0x72,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x76,0x69,0x6e,0x65,0x69,0x73,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x69,0x6e,0x76,0x69,0x73,0x69,0x74,0x0,0x0,0x0,0x74,0x8,0x0,0x0,0x0,0x65,0x71,0x75,0x61,0x6c,0x76,0x65,0x6c,0x69,0x75,0x0,0x0,0x0,0x74,0x6,0x0,0x0,0x0,0x73,0x70,0x61,0x77,0x6e,0x32,0x69,0x76,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x70,0x61,0x77,0x6e,0x69,0x77,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x31,0x69,0x78,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x32,0x69,0x79,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x33,0x69,0x7a,0x0,0x0,0x0,0x74,0x5,0x0,0x0,0x0,0x73,0x68,0x6c,0x64,0x34,0x69,0x7b,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x6c,0x6f,0x6c,0x7a,0x69,0x7c,0x0,0x0,0x0,0x74,0x4,0x0,0x0,0x0,0x77,0x69,0x66,0x69,0x69,0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63,0x5f,0x5f,0x22,0x2c,0x22,0x5f,0x5f,0x70,0x61,0x63,0x6b,0x61,0x67,0x65,0x5f,0x5f,0x22,0x2c,0x27,0x74,0x70,0x74,0x27,0x2c,0x27,0x63,0x6c,0x65,0x61,0x6e,0x27,0x2c,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x27,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x27,0x2c,0x27,0x5f,0x66,0x6f,0x72,0x6b,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x5f,0x73,0x74,0x61,0x74,0x75,0x73,0x27,0x2c,0x27,0x66,0x6f,0x72,0x6b,0x5f,0x75,0x6e,0x62,0x6c,0x6f,0x63,0x6b,0x27,0x2c,0x27,0x73,0x79,0x73,0x27,0x5d,0xa,0x20,0x20,0x20,0x20,0x68,0x61,0x6e,0x64,0x6c,0x65,0x2e,0x67,0x6c,0x6f,0x62,0x3d,0x7b,0x7d,0xa,0x20,0x20,0x20,0x20,0x66,0x6f,0x72,0x20,0x69,0x74,0x65,0x6d,0x20,0x69,0x6e,0x20,0x63,0x6f,0x70,0x79,0x3a,0xa,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x61,0x6e,0x64,0x6c,0x65,0x2e,0x67,0x6c,0x6f,0x62,0x5b,0x69,0x74,0x65,0x6d,0x5d,0x3d,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x28,0x29,0x5b,0x69,0x74,0x65,0x6d,0x5d,0x74,0x0,0x0,0x0,0x0,0x4e,0x28,0x4,0x0,0x0,0x0,0x74,0x7,0x0,0x0,0x0,0x67,0x6c,0x6f,0x62,0x61,0x6c,0x73,0x74,0x6,0x0,0x0,0x0,0x68,0x61,0x6e,0x64,0x6c,0x65,0x74,0x4,0x0,0x0,0x0,0x67,0x6c,0x6f,0x62,0x74,0x3,0x0,0x0,0x0,0x62,0x75,0x66,0x28,0x0,0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c,0x65,0x2e,0x70,0x79,0x74,0x8,0x0,0x0,0x0,0x3c,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x3e,0x1,0x0,0x0,0x0,0x73,0x4a,0x0,0x0,0x0,0xc,0x1,0xa,0x1,0xa,0x1,0xc,0x1,0xc,0x1,0xc,0x1,0xc,0x3,0x13,0x5,0xc,0x1,0xc,0x2,0x3b,0x1,0x38,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x31,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0x2a,0x1,0xa,0x3,0x9,0x2,0x9,0x4,0x9,0xa,0x9,0xa}; \ No newline at end of file diff --git a/src/interface.c b/src/interface.c index 79ebcb12d..6382ed00c 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3847,10 +3847,12 @@ struct command_history { }; typedef struct command_history command_history; command_history *last_command = NULL; +command_history *last_command2 = NULL; char *console_ui(pixel *vid_buf,char error[255],char console_more) { int mx,my,b,cc,ci = -1; pixel *old_buf=calloc((XRES+BARSIZE)*(YRES+MENUSIZE), PIXELSIZE); command_history *currentcommand; + command_history *currentcommand2; ui_edit ed; ed.x = 15; ed.y = 207; @@ -3864,10 +3866,15 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { ed.cursor = 0; //fillrect(vid_buf, -1, -1, XRES, 220, 0, 0, 0, 190); memcpy(old_buf,vid_buf,(XRES+BARSIZE)*YRES*PIXELSIZE); - fillrect(old_buf, -1, -1, XRES, 220, 0, 0, 0, 190); + fillrect(old_buf, -1, -1, XRES+1, 220, 0, 0, 0, 190); + + currentcommand2 = malloc(sizeof(command_history)); + memset(currentcommand2, 0, sizeof(command_history)); + currentcommand2->prev_command = last_command2; + currentcommand2->command = mystrdup(error); + last_command2 = currentcommand2; SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - cc = 0; while(cc < 80){ fillrect(old_buf, -1, -1+cc, XRES+BARSIZE, 2, 0, 0, 0, 160-(cc*2)); @@ -3880,6 +3887,7 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { my /= sdl_scale; ed.focus = 1; + //clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent? memcpy(vid_buf,old_buf,(XRES+BARSIZE)*YRES*PIXELSIZE); draw_line(vid_buf, 0, 219, XRES+BARSIZE-1, 219, 228, 228, 228, XRES+BARSIZE); drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.3 (by cracker64, python by Doxin)" //TODO: help command @@ -3907,9 +3915,31 @@ char *console_ui(pixel *vid_buf,char error[255],char console_more) { break; } } + cc = 0; + currentcommand2 = last_command2; + while(cc < 10) + { + if(currentcommand2==NULL) + break; + drawtext(vid_buf, 215, 175-(cc*12), currentcommand2->command, 255, 225, 225, 255); + if(currentcommand2->prev_command!=NULL) + { + if(cc<9) { + currentcommand2 = currentcommand2->prev_command; + } else if(currentcommand2->prev_command!=NULL) { + free(currentcommand2->prev_command); + currentcommand2->prev_command = NULL; + } + cc++; + } + else + { + break; + } + } - if(error && ed.str[0]=='\0') - drawtext(vid_buf, 20, 207, error, 255, 127, 127, 200); + //if(error && ed.str[0]=='\0') + //drawtext(vid_buf, 20, 207, error, 255, 127, 127, 200); if(console_more==0) drawtext(vid_buf, 5, 207, ">", 255, 255, 255, 240); else diff --git a/src/main.c b/src/main.c index 005fc656a..a793a7b89 100644 --- a/src/main.c +++ b/src/main.c @@ -24,6 +24,8 @@ */ #include "Python.h" +#include "pyconsole.h" + #include #include #include @@ -1189,12 +1191,16 @@ char console_error[255] = ""; //functions callable from python: static PyObject* -emb_create(PyObject *self, PyObject *args) +emb_create(PyObject *self, PyObject *args, PyObject *keywds) { int x,y,t; - if(!PyArg_ParseTuple(args, "III:create",&x,&y,&t)) + char *name = ""; + char *kwlist[] = {"x","y","t","name", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "II|Is:create",kwlist, &x,&y,&t,&name)) return NULL; // + if(strcmp(name,"")!=0) + console_parse_type(name, &t, console_error); return Py_BuildValue("i",create_part(-1,x,y,t)); } //sys_pause = !sys_pause @@ -1338,13 +1344,17 @@ emb_reset_sparks(PyObject *self, PyObject *args) return Py_BuildValue("i",1); } -emb_set_life(PyObject *self, PyObject *args) +emb_set_life(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_life",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].life = life; + } return Py_BuildValue("i",1); } -emb_set_type(PyObject *self, PyObject *args) +emb_set_type(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_type",&j,&life)) + int i = -1,life,j=-1,x=-1,y=-1; + char *name = ""; + char *type = ""; + char *kwlist[] = {"setto", "settoint", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "|sIsIII:set_type",kwlist ,&type,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1 && j==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + console_parse_type(type, &life, console_error); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].type = life; + } return Py_BuildValue("i",1); } -emb_set_temp(PyObject *self, PyObject *args) +emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_temp",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].temp = life; + } return Py_BuildValue("i",1); } -emb_set_tmp(PyObject *self, PyObject *args) +emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_tmp",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].tmp = life; + } return Py_BuildValue("i",1); } -emb_set_x(PyObject *self, PyObject *args) +emb_set_x(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_x",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *type = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].x = life; + } return Py_BuildValue("i",1); } -emb_set_y(PyObject *self, PyObject *args) +emb_set_y(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_y",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].y = life; + } return Py_BuildValue("i",1); } -emb_set_ctype(PyObject *self, PyObject *args) +emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_ctype",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *type = ""; + char *kwlist[] = {"setto", "toctypeint", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "s|IsIII:set_type",kwlist ,&type, &life, &name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(!life) + console_parse_type(type, &life, console_error); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].ctype = life; + } return Py_BuildValue("i",1); } -emb_set_vx(PyObject *self, PyObject *args) +emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_vx",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].vx = life; + } return Py_BuildValue("i",1); } -emb_set_vy(PyObject *self, PyObject *args) +emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds) { - int i,life,j; - if(!PyArg_ParseTuple(args, "II:set_vy",&j,&life)) + int i = -1,life,j,x=-1,y=-1; + char *name = ""; + char *kwlist[] = {"setto", "from", "i", "x", "y", NULL}; + if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y)) return NULL; // - if(j==-1) + if(strcmp(name,"")==0 && x==-1 && y==-1 && i==-1) + return Py_BuildValue("s","Need more args(coords,i,or a particle name)"); + if(strcmp(name,"all")==0) { for(i=0; i=0 && x=0 && y>8].type != PT_NONE) + parts[pmap[y][x]>>8].vy = life; + } return Py_BuildValue("i",1); } +emb_get_pmap(PyObject *self, PyObject *args) +{ + int x,y; + if(!PyArg_ParseTuple(args, "II:get_pmap",&x,&y)) + return NULL; + // + if(x<0 || y<0 || x>=XRES || y>=YRES) + return Py_BuildValue("i",-1); + + return Py_BuildValue("I",pmap[y][x]); +} +emb_get_prop(PyObject *self, PyObject *args) +{ + int i; + char *prop = ""; + if(!PyArg_ParseTuple(args, "Is:get_pmap",&i,&prop)) + return NULL; + // + if(parts[i].type) + { + if(strcmp(prop,"type")==0) + return Py_BuildValue("i",parts[i].type); + if(strcmp(prop,"life")==0) + return Py_BuildValue("i",parts[i].life); + if(strcmp(prop,"ctype")==0) + return Py_BuildValue("i",parts[i].ctype); + if(strcmp(prop,"temp")==0) + return Py_BuildValue("i",parts[i].temp); + if(strcmp(prop,"tmp")==0) + return Py_BuildValue("i",parts[i].tmp); + if(strcmp(prop,"vy")==0) + return Py_BuildValue("f",parts[i].vy); + if(strcmp(prop,"vx")==0) + return Py_BuildValue("f",parts[i].vx); + if(strcmp(prop,"x")==0) + return Py_BuildValue("i",parts[i].x); + if(strcmp(prop,"y")==0) + return Py_BuildValue("i",parts[i].y); + } + + return Py_BuildValue("i",-1); +} static PyMethodDef EmbMethods[] = { //WARNING! don't forget to register your function here! - {"create", emb_create, METH_VARARGS,"create a particle."}, - {"log", emb_log, METH_VARARGS,"logs an error string to the console."}, - {"reset_pressure", emb_reset_pressure, METH_VARARGS,"resets all the pressure."}, - {"reset_velocity", emb_reset_velocity, METH_VARARGS,"resets all the velocity."}, - {"reset_sparks", emb_reset_sparks, METH_VARARGS,"resets all the sparks."}, - {"set_life", emb_set_life, METH_VARARGS,"sets life of a specified particle."}, - {"set_type", emb_set_type, METH_VARARGS,"sets type of a specified particle."}, - {"set_temp", emb_set_temp, METH_VARARGS,"sets temp of a specified particle."}, - {"set_tmp", emb_set_tmp, METH_VARARGS,"sets tmp of a specified particle."}, - {"set_x", emb_set_x, METH_VARARGS,"sets x of a specified particle."}, - {"set_y", emb_set_y, METH_VARARGS,"sets y of a specified particle."}, - {"set_ctype", emb_set_y, METH_VARARGS,"sets ctype of a specified particle."}, - {"set_vx", emb_set_vx, METH_VARARGS,"sets vx of a specified particle."}, - {"set_vy", emb_set_vy, METH_VARARGS,"sets vy of a specified particle."}, - {"pause", emb_pause, METH_VARARGS,"pause the game."}, - {"unpause", emb_unpause, METH_VARARGS,"unpause the game."}, - {"toggle_pause", emb_toggle_pause, METH_VARARGS,"toggle game pause."}, - {"open_console", emb_open_console, METH_VARARGS,"open the game console."}, - {"close_console", emb_close_console, METH_VARARGS,"close the game console."}, - {"toggle_console", emb_toggle_console, METH_VARARGS,"toggle the game console."}, - {"console_more", emb_console_more, METH_VARARGS,"turns the more indicator on."}, - {"console_less", emb_console_less, METH_VARARGS,"turns the more indicator off."}, + {"create", emb_create, METH_VARARGS|METH_KEYWORDS, "create a particle."}, + {"log", emb_log, METH_VARARGS, "logs an error string to the console."}, + {"reset_pressure", emb_reset_pressure, METH_VARARGS, "resets all the pressure."}, + {"reset_velocity", emb_reset_velocity, METH_VARARGS, "resets all the velocity."}, + {"reset_sparks", emb_reset_sparks, METH_VARARGS, "resets all the sparks."}, + {"set_life", emb_set_life, METH_VARARGS|METH_KEYWORDS, "sets life of a specified particle."}, + {"set_type", emb_set_type, METH_VARARGS|METH_KEYWORDS, "sets type of a specified particle."}, + {"set_temp", emb_set_temp, METH_VARARGS|METH_KEYWORDS, "sets temp of a specified particle."}, + {"set_tmp", emb_set_tmp, METH_VARARGS|METH_KEYWORDS, "sets tmp of a specified particle."}, + {"set_x", emb_set_x, METH_VARARGS|METH_KEYWORDS, "sets x of a specified particle."}, + {"set_y", emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets y of a specified particle."}, + {"set_ctype", emb_set_y, METH_VARARGS|METH_KEYWORDS, "sets ctype of a specified particle."}, + {"set_vx", emb_set_vx, METH_VARARGS|METH_KEYWORDS, "sets vx of a specified particle."}, + {"set_vy", emb_set_vy, METH_VARARGS|METH_KEYWORDS, "sets vy of a specified particle."}, + {"pause", emb_pause, METH_VARARGS, "pause the game."}, + {"unpause", emb_unpause, METH_VARARGS, "unpause the game."}, + {"toggle_pause", emb_toggle_pause, METH_VARARGS, "toggle game pause."}, + {"open_console", emb_open_console, METH_VARARGS, "open the game console."}, + {"close_console", emb_close_console, METH_VARARGS, "close the game console."}, + {"toggle_console", emb_toggle_console, METH_VARARGS, "toggle the game console."}, + {"console_more", emb_console_more, METH_VARARGS, "turns the more indicator on."}, + {"console_less", emb_console_less, METH_VARARGS, "turns the more indicator off."}, + {"get_pmap", emb_get_pmap, METH_VARARGS, "get the pmap value."}, + {"get_prop", emb_get_prop, METH_VARARGS, "get some properties."}, {NULL, NULL, 0, NULL} }; @@ -1639,11 +1830,13 @@ 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 + //pname=PyString_FromString("tpt_console");//create string object + //pmodule = PyImport_Import(pname);//import module + PyObject *tpt_console_obj = PyMarshal_ReadObjectFromString(tpt_console_pyc+8, sizeof(tpt_console_pyc)-8); + pmodule=PyImport_ExecCodeModule("tpt_console", tpt_console_obj); if(pmodule!=NULL) { - Py_DECREF(pname);//throw away the string object + //Py_DECREF(pname);//throw away the string object pfunc=PyObject_GetAttrString(pmodule,"handle");//get the handler function if(pfunc && PyCallable_Check(pfunc))//check if it's really a function { @@ -2885,9 +3078,7 @@ int main(int argc, char *argv[]) } } else - { create_line(lx, ly, x, y, bsx, bsy, c); - } lx = x; ly = y; } @@ -2912,7 +3103,7 @@ int main(int argc, char *argv[]) { if (sdl_mod & (KMOD_CAPS)) c = 0; - if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&c!=PT_WIND&&!REPLACE_MODE) + if (c!=WL_STREAM+100&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE&&c!=PT_WIND) flood_parts(x, y, c, -1, -1); if (c==SPC_HEAT || c==SPC_COOL) create_parts(x, y, bsx, bsy, c); diff --git a/src/powder.c b/src/powder.c index e93f88d79..e15565b7a 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1138,7 +1138,7 @@ int nearest_part(int ci, int t) void update_particles_i(pixel *vid, int start, int inc) { - int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors; + int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors, createdsomething; float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl; int fin_x, fin_y, clear_x, clear_y; float fin_xf, fin_yf, clear_xf, clear_yf; @@ -1345,14 +1345,14 @@ void update_particles_i(pixel *vid, int start, int inc) if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART) continue; for ( golnum = 1; golnum<=NGOL; golnum++) - for ( goldelete = 0; goldelete<9; goldelete++) { - if (neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) + goldelete = neighbors; + if (gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2) { if (create_part(-1,nx,ny,goltype[golnum-1])) createdsomething = 1; } - else if (neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself + else if (gol[nx][ny]==golnum&&(grule[golnum][goldelete-1]==0||grule[golnum][goldelete-1]==2))//subtract 1 because it counted itself { if(parts[r>>8].tmp==grule[golnum][9]-1) parts[r>>8].tmp --; @@ -2873,9 +2873,7 @@ int create_parts(int x, int y, int rx, int ry, int c) dw = 1; } if (c == PT_WIND) - { return 1; - } if (dw==1) { rx = rx/CELL; diff --git a/src/python/tpt_console.py b/src/python/tpt_console.py new file mode 100644 index 000000000..864fed889 --- /dev/null +++ b/src/python/tpt_console.py @@ -0,0 +1,77 @@ +import tpt +from tpt import * +from utils import * +import sys +import code +import ctypes +import traceback +#print "console module loaded." +#redirect stdout like this: +class logger: + def write(self,txt): + txt=txt.strip().split("\n")[-1] + repr(txt) + tpt.log(txt) +sys.stdout=logger() +sys.stderr=logger() + +element={"none":0,"dust":1,"watr":2,"oil":3,"fire":4,"stne":5,"lava":6,"gunp":7, + "nitr":8,"clne":9,"gas":10,"plex":11,"goo":12,"icei":13,"metl":14,"sprk":15, + "snow":16,"wood":17,"neut":18,"plut":19,"plnt":20,"acid":21,"void":22, + "wtrv":23,"cnct":24,"dstw":25,"salt":26,"sltw":27,"dmnd":28,"bmtl":29, + "brmt":30,"phot":31,"uran":32,"wax":33,"mwax":34,"pscn":35,"nscn":36, + "lntg":37,"insl":38,"bhol":39,"whol":40,"rbdm":41,"lrbd":42,"ntct":43, + "sand":44,"glas":45,"ptct":46,"bgla":47,"thdr":48,"plsm":49,"etrd":50, + "nice":51,"nble":52,"btry":53,"lcry":54,"stkm":55,"swch":56,"smke":57, + "desl":58,"coal":59,"lo2":60,"o2":61,"inwr":62,"yest":63,"dyst":64, + "thrm":65,"glow":66,"brck":67,"hflm":68,"firw":69,"fuse":70,"fsep":71, + "amtr":72,"bcol":73,"pcln":74,"hswc":75,"iron":76,"mort":77,"gol":78, + "hlif":79,"asim":80,"2x2":81,"dani":82,"amoe":83,"move":84,"pgol":85, + "dmoe":86,"34":87,"llif":88,"stan":89,"spng":90,"rime":91,"fog":92, + "bcln":93,"love":94,"deut":95,"warp":96,"pump":97,"fwrk":98,"pipe":99, + "frzz":100,"frzw":101,"grav":102,"bizr":103,"bizrg":104,"bizrs":105, + "inst":106,"isoz":107,"iszs":108,"prti":109,"prto":110,"pste":111, + "psts":112,"anar":113,"vine":114,"invis":115,"equalvel":116,"spawn2":117, + "spawn":118,"shld1":119,"shld2":120,"shld3":121,"shld4":122,"lolz":123, + "wifi":124,"filt":125,"aray":126,"bray":127,"stkm2":128,"bomb":129, + "c5":130,"sing":131,"qrtz":132,"pqrt":133,"seed":134,"maze":135, + "coag":136,"wall":137,"gnar":138,"repl":139,"myst":140,"boyl":141, + "lote":142,"frg2":143,"star":144,"frog":145,"bran":146,"wind":147, + "num":148} + + +def fork_unblock(): + pass#i need to implement this some day. +def error(ex): + err=traceback.format_exc() + sys.stdout.write(err) + +def clean(): + #add any functions that must be reachable here. + """copy=["__builtins__","__name__","__doc__","__package__",'tpt','clean', + 'element','fork','_fork','fork_status','fork_unblock','sys'] + handle.glob={} + for item in copy: + handle.glob[item]=globals()[item]""" + handle.glob=globals() + handle.buf="" + +def handle(txt): + try: + a=handle.glob + except: + clean() + try: + _handle(txt) + except Exception as ex: + error(ex) + +def _handle(txt): + #print "handling '%s'"%txt + try: + sys.stdout.write(repr(eval(txt,handle.glob))) + except: + try: + exec txt in handle.glob + except Exception as ex: + error(ex)