tinypy: minor fixes

git-svn-id: svn://kolibrios.org@8476 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
maxcodehack 2020-12-26 11:49:39 +00:00
parent 6db1f4dd5a
commit 0f14837705
4 changed files with 39 additions and 33 deletions

View File

@ -1,4 +1,4 @@
NAME=tinypy NAME = tinypy
CC = kos32-gcc CC = kos32-gcc
LD = kos32-ld LD = kos32-ld
@ -13,24 +13,24 @@ CFLAGS = -U_Win32 -U_WIN32 -U__MINGW32__ -mpreferred-stack-boundary=2 \
INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include INCLUDES= -I. -I$(SDK_DIR)/sources/newlib/libc/include
LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib LIBPATH:= -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
KOLIBRI_M_OBJ= ../modules/kolibri/init.o \ MODULES_DIR = $(abspath ../modules)
../modules/kolibri/fs.o \
../modules/kolibri/net.o \
../modules/kolibri/gui.o \
../modules/kolibri/debug.o \
OBJECTS = tpmain.o $(KOLIBRI_M_OBJ)
all:$(NAME) MODULES_OBJ = $(MODULES_DIR)/kolibri/init.o \
$(MODULES_DIR)/kolibri/fs.o \
$(MODULES_DIR)/kolibri/net.o \
$(MODULES_DIR)/kolibri/gui.o \
$(MODULES_DIR)/kolibri/debug.o
OBJECTS = tpmain.o $(MODULES_OBJ)
all: $(NAME)
$(NAME): $(OBJECTS) $(NAME): $(OBJECTS)
$(LD) $(LIBPATH) --subsystem native -o $@ $(OBJECTS) $(LDFLAGS) -n -Map $(NAME).map $(LD) $(LIBPATH) --subsystem native -o $@ $(OBJECTS) $(LDFLAGS) -n # -Map $(NAME).map
kos32-objcopy $@ -O binary objcopy $@ -O binary
kpack $@
%.o : %.c Makefile %.o : %.c Makefile
$(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $< $(CC) -c $(INCLUDES) $(CFLAGS) -o $@ $<
clean: clean:
rm -f *.o $(NAME).map $(KOLIBRI_M_OBJ) rm -f *.o $(NAME).map $(MODULES_OBJ)

View File

@ -8,6 +8,7 @@ void (* _stdcall con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_
int (* _cdecl con_printf)(const char* format,...); int (* _cdecl con_printf)(const char* format,...);
void (* _stdcall con_exit)(char bCloseWindow); void (* _stdcall con_exit)(char bCloseWindow);
void (* __stdcall con_gets)(char* str, int n); void (* __stdcall con_gets)(char* str, int n);
void (* _stdcall con_set_title)(const char* title);
void CONSOLE_INIT(const char title[]) void CONSOLE_INIT(const char title[])
{ {
@ -21,7 +22,9 @@ void CONSOLE_INIT(const char title[])
!(con_gets = ( __stdcall void (*)(char*, int)) !(con_gets = ( __stdcall void (*)(char*, int))
kol_cofflib_procload (imp, "con_gets"))|| kol_cofflib_procload (imp, "con_gets"))||
!(con_exit = ( _stdcall void (*)(char)) !(con_exit = ( _stdcall void (*)(char))
kol_cofflib_procload (imp, "con_exit"))) kol_cofflib_procload (imp, "con_exit")) ||
!(con_set_title = ( _stdcall void (*)(const char*))
kol_cofflib_procload (imp, "con_set_title")))
{ {
kol_exit(); kol_exit();
} }

View File

@ -9,13 +9,13 @@ def onkey():
def onbtn(): def onbtn():
print("Button pressed") print("Button pressed")
if __name__=="__main__":
kolibri.debug_print("Debug test line\n") kolibri.debug_print("Debug test line\n")
w = kolibri.window(10,10,400, 400, False) w = kolibri.window(10,10,400, 400, False)
w.on_show = onshow w.on_show = onshow
w.on_key = onkey w.on_key = onkey
w.on_button = onbtn w.on_button = onbtn
w.show() w.show()
print("running") print("running")
w.run() w.run()
print("Exit") print("Exit")

View File

@ -1,19 +1,22 @@
#include "tp.c"
/* INCLUDE */ /* INCLUDE */
const char header[]="TinyPy for kolibriOS"; #include "tp.c"
//extern void kolibri_dbg_init(tp_vm *tp); //__attribute__((__stdcall__)); const char header[] = "TinyPy for KolibriOS";
void main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
/* INIT */
tp_vm *tp = tp_init(argc, argv); tp_vm *tp = tp_init(argc, argv);
kolibri_init(tp); kolibri_init(tp);
CONSOLE_INIT(header); CONSOLE_INIT(header);
/* INIT */
tp_call(tp,"py2bc","tinypy",tp_None); tp_call(tp,"py2bc","tinypy",tp_None);
con_printf("Done"); // con_printf("Done");
tp_deinit(tp); tp_deinit(tp);
kol_exit();
return; // Exit console
con_exit(0);
// Exit program
return 0;
} }
/**/ /**/