Skip to content

Commit

Permalink
Changed around stuff in Value and added custom memory allocators for …
Browse files Browse the repository at this point in the history
…dynamic objects
  • Loading branch information
BenLand100 committed Feb 26, 2010
1 parent bbe88f5 commit d0d85fa
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 339 deletions.
2 changes: 2 additions & 0 deletions Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const char* InterpEx::what() const throw() {
return "Unknown precompiler directive";
case E_EXPECTED:
return "Something was expected and not found";
case E_NO_EQUIV_VAL:
return "Conversion to/from native not defined";
default:
return "Unknown error!";
}
Expand Down
1 change: 1 addition & 0 deletions Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class InterpEx;
#define E_NOT_METHOD E_RUNTIME + 15
#define E_WRONG_NUM_ARG E_RUNTIME + 16
#define E_REF_TYPE E_RUNTIME + 17
#define E_NO_EQUIV_VAL E_RUNTIME + 18

//Non-catchable exceptions
#define E_NOCATCH 100
Expand Down
6 changes: 6 additions & 0 deletions Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ unsigned int Method::numArgs() {
return arguments.size();
}

void interp_mem(MALLOC malloc, REALLOC realloc, FREE free) {
Value::malloc = malloc;
Value::realloc = realloc;
Value::free = free;
}

void* interp_init(PreCompiler_Callback precomp, ErrorHandeler_Callback err) {
return (void*) new Interpreter(precomp, err);
}
Expand Down
1 change: 1 addition & 0 deletions Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class Frame {
};

extern "C" {
void interp_mem(MALLOC malloc, REALLOC realloc, FREE free) __attribute__((cdecl));
void* interp_init(PreCompiler_Callback precomp, ErrorHandeler_Callback err) __attribute__((cdecl));
void interp_meth(void* interp, void* addr, char* def) __attribute__((cdecl));
void interp_type(void* interp, char* def) __attribute__((cdecl));
Expand Down
Loading

0 comments on commit d0d85fa

Please sign in to comment.