tinypy: file reading support.

git-svn-id: svn://kolibrios.org@2001 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
jaeger 2011-07-08 19:48:44 +00:00
parent 3dee3b0598
commit 42affd404a
6 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
export MENUETDEV=../../libraries/menuetlibc
OUTFILE = tpmain
OBJS = tpmain.o
OBJS = tpmain.o kolibri_init.o kolibri_fs.o
include $(MENUETDEV)/makefiles/Makefile_for_program
#testmod.o: fasm_modules/testmod.s
# fasm fasm_modules/testmod.s

View File

@ -0,0 +1 @@
/home/john/Kolibri/kolibrios.org/programs/develop/tinypy/modules/kolibri/fs.c

View File

@ -0,0 +1 @@
/home/john/Kolibri/kolibrios.org/programs/develop/tinypy/modules/kolibri/init.c

View File

@ -69,7 +69,7 @@ tp_obj tp_iter(TP,tp_obj self, tp_obj k) {
tp_obj tp_get(TP,tp_obj self, tp_obj k) {
int type = self.type;
tp_obj r;
/*con_printf("tp_get %s %s\n", TP_CSTR(self), TP_CSTR(k));*/
if (type == TP_DICT) {
return _tp_dict_get(tp,self.dict.val,k,"tp_get");
} else if (type == TP_LIST) {
@ -142,8 +142,6 @@ tp_obj tp_get(TP,tp_obj self, tp_obj k) {
}
}
con_printf("Raising exception\n");
tp_raise(tp_None,"tp_get(%s,%s)",TP_CSTR(self),TP_CSTR(k));
}
@ -162,7 +160,7 @@ int tp_iget(TP,tp_obj *r, tp_obj self, tp_obj k) {
void tp_set(TP,tp_obj self, tp_obj k, tp_obj v) {
int type;
con_printf("vm is %x self is %x k is %x v is %x", tp, self, k, v);
type = self.type;
if (type == TP_DICT) {
_tp_dict_set(tp,self.dict.val,k,v);

View File

@ -1,2 +1,7 @@
import kolibri
if __name__=="__main__":
print("ok!")
f = kolibri.open("/hd0/1/tinypy/test.txt")
print(f.size)
print(f.read())
f.close()

View File

@ -15,6 +15,7 @@ void main(void) {
argv[1][strlen(argv[1]) - 1] = '\0';
con_printf("Running file %s\n", argv[1]);
tp_vm *tp = tp_init(argc, argv);
kolibri_init(tp);
/* INIT */
tp_call(tp,"py2bc","tinypy",tp_None);
tp_deinit(tp);