forked from KolibriOS/kolibrios
tinypy: can now run from shell and use command line parameters.
git-svn-id: svn://kolibrios.org@2073 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
export MENUETDEV=../../libraries/menuetlibc
|
||||
OUTFILE = tpmain
|
||||
OBJS = tpmain.o kolibri_init.o kolibri_fs.o kolibri_gui.o kolibri_dbg.o
|
||||
CFLAGS = -I.
|
||||
CFLAGS = -I. -mpreferred-stack-boundary=2 -mincoming-stack-boundary=2
|
||||
include $(MENUETDEV)/makefiles/Makefile_for_program
|
||||
kolibri_dbg.o: fasm_modules/kolibri_dbg.s
|
||||
fasm fasm_modules/kolibri_dbg.s
|
||||
|
@@ -15,7 +15,6 @@ def _import(name):
|
||||
return MODULES[name]
|
||||
py = name+".py"
|
||||
tpc = name+".tpc"
|
||||
print("CP")
|
||||
if exists(py):
|
||||
if not exists(tpc) or mtime(py) > mtime(tpc):
|
||||
s = load(py)
|
||||
@@ -43,7 +42,6 @@ def import_fname(fname,name):
|
||||
return g
|
||||
|
||||
def tinypy():
|
||||
print("tinypy called")
|
||||
return import_fname(ARGV[0],'__main__')
|
||||
|
||||
def main(src,dest):
|
||||
@@ -52,5 +50,4 @@ def main(src,dest):
|
||||
save(dest,r)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("Running main")
|
||||
main(ARGV[1],ARGV[2])
|
||||
|
@@ -1,25 +1,16 @@
|
||||
#include "tp.c"
|
||||
/* INCLUDE */
|
||||
const char header[]="TinyPy for kolibriOS";
|
||||
const int argc = 2;
|
||||
extern _stdcall void kolibri_dbg_init(tp_vm *tp);
|
||||
|
||||
void main(void) {
|
||||
char *argv[2]={"tpmain", "test.py"};
|
||||
|
||||
CONSOLE_INIT(header);
|
||||
con_printf("TinyPy console, version 1.1.\n");
|
||||
con_printf("Enter program file:");
|
||||
if (!(argv[1] = malloc(256)))
|
||||
con_printf("Memory error\n");
|
||||
con_gets(argv[1], 256);
|
||||
argv[1][strlen(argv[1]) - 1] = '\0';
|
||||
con_printf("Running file %s\n", argv[1]);
|
||||
void main(int argc, const char *argv[]) {
|
||||
tp_vm *tp = tp_init(argc, argv);
|
||||
kolibri_dbg_init(tp);
|
||||
kolibri_init(tp);
|
||||
CONSOLE_INIT(header);
|
||||
/* INIT */
|
||||
tp_call(tp,"py2bc","tinypy",tp_None);
|
||||
con_printf("Done");
|
||||
tp_deinit(tp);
|
||||
kol_exit();
|
||||
return;
|
||||
|
Reference in New Issue
Block a user