Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

commit using githubs windows client

  • Loading branch information...
commit 44631809d8ae0a4962b9aaae4d03a624d8eb428c 1 parent 9cb8e66
@pez2001 authored
View
7 .git_ignore
@@ -1,7 +0,0 @@
-src/*.o
-src/*.txt
-src/*.a
-src/*.dll
-src/*.exe
-test_scripts/__pycache__
-test_scripts/__pycache__/*
View
49 .gitattributes
@@ -0,0 +1,49 @@
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
+
+*.jpg binary
+*.png binary
+*.gif binary
+
+*.cs text=auto diff=csharp
+*.vb text=auto
+*.c text=auto
+*.cpp text=auto
+*.cxx text=auto
+*.h text=auto
+*.hxx text=auto
+*.py text=auto
+*.rb text=auto
+*.java text=auto
+*.html text=auto
+*.htm text=auto
+*.css text=auto
+*.scss text=auto
+*.sass text=auto
+*.less text=auto
+*.js text=auto
+*.lisp text=auto
+*.clj text=auto
+*.sql text=auto
+*.php text=auto
+*.lua text=auto
+*.m text=auto
+*.asm text=auto
+*.erl text=auto
+*.fs text=auto
+*.fsx text=auto
+*.hs text=auto
+
+*.csproj text=auto merge=union
+*.vbproj text=auto merge=union
+*.fsproj text=auto merge=union
+*.dbproj text=auto merge=union
+*.sln text=auto eol=crlf merge=union
View
13 .gitignore
@@ -0,0 +1,13 @@
+src/*.hex
+src/*.elf
+src/*.o
+src/*.ao
+src/*.do
+src/*.da
+src/*.aopp
+src/*.txt
+src/*.a
+src/*.dll
+src/*.exe
+test_scripts/__pycache__
+test_scripts/__pycache__/*
View
BIN  src/tests/test10.pyc
Binary file not shown
View
BIN  src/tools/build_inc/build_inc.o
Binary file not shown
View
15 src/unit_tests.c
@@ -486,6 +486,20 @@ object *ImportModule(struct _vm *vm,char *module_name)
return(obj);
}
+object *CatchException(struct _vm *vm,struct _object *exception)
+{
+ printf("caught exception:");
+ object *msg_name = CreateUnicodeObject(str_Copy("message"));
+ gc_IncRefCount(msg_name);
+ object *message = GetAttribute(tos,msg_name);
+ gc_DecRefCount(msg_name);
+ PrintObject(message);
+ printf("\n");
+ vm_Close();
+ return(NULL);
+ return(CreateEmptyObject(TYPE_NONE));
+}
+
void AtomicOpenPYC(char *filename)
{
printf("executing object:%s\n", filename);
@@ -496,6 +510,7 @@ void AtomicOpenPYC(char *filename)
#endif
vm *vm = vm_Init(NULL);
vm->import_module_handler = &ImportModule;
+ vm->exception_handler = &CatchException;
long pyc_magic = MAGIC;
stream *f = stream_CreateFromFile(filename,"rb");
if (!stream_Open(f))
View
8 src/vm.c
@@ -1854,7 +1854,7 @@ object *vm_Step(vm *vm)
case OPCODE_RAISE_VARARGS:
{
- printf("RAISE_VARARGS\n");
+ //printf("RAISE_VARARGS\n");
//stack_Dump(bo->stack);
tos = stack_Pop(bo->stack);
tos = DissolveRef(tos);
@@ -1874,12 +1874,6 @@ object *vm_Step(vm *vm)
if(tos2->type == TYPE_KV)
tos2 = ((kv_object*)tos2)->value;
}
- object *msg_name = CreateUnicodeObject(str_Copy("message"));
- gc_IncRefCount(msg_name);
- object *message = GetAttribute(tos,msg_name);
- gc_DecRefCount(msg_name);
- PrintObject(message);
- printf("\n");
if(vm->exception_handler != NULL)
vm->exception_handler(vm,tos);
}
View
29 test_scripts/test10.py
@@ -1,29 +0,0 @@
-def func():
- def sub_func():
- print("hi from subfunc\n")
- x = 1
- x = x + 1
- x = x + x + 2
- x = x + x - 1
- x = rek(x)
- print("x:",x,"\n")
-# x = "Hallo Welt"
-# print("x:",x,"\n")
-# y = "Gute Nacht"
-# print("y:",y,"\n")
-# v = "Und bis morgen"
-# print("y:"+ y+ " " + v +"\n")
- sub_func()
- if("hi" == "hi"):
- print("== string compare added\n")
-
- if(1 == 1):
- print("== num compare added\n")
-
-def rek(e):
- if(e < 1000):
- e = rek(e*e)
- return(e)
-
-func()
-
View
29 test_scripts/test11.py
@@ -1,29 +0,0 @@
-def func():
- def sub_func():
- print("hi from subfunc\n")
- x = 1
- x = x + 1
- x = x + x + 2
- x = x + x - 1
- x = rek(x)
- print("x:",x,"\n")
-# x = "Hallo Welt"
-# print("x:",x,"\n")
-# y = "Gute Nacht"
-# print("y:",y,"\n")
-# v = "Und bis morgen"
-# print("y:"+ y+ " " + v +"\n")
- sub_func()
- if("hi" == "hi"):
- print("== string compare added\n")
-
- if(1 == 1):
- print("== num compare added\n")
-
-def rek(e):
- if(e < 1000):
- e = rek(e*e)
- return(e)
-
-func()
-
View
3  test_scripts/test_import_e.py
@@ -1,3 +0,0 @@
-from eratosthenes import *
-#print("compiled")
-#testf()
Please sign in to comment.
Something went wrong with that request. Please try again.