Loading libacc/Android.mk +22 −4 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) # # Shared library # # Shared library for target # ======================================================== LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp Loading @@ -16,4 +15,23 @@ LOCAL_SHARED_LIBRARIES := libdl libcutils include $(BUILD_SHARED_LIBRARY) # Shared library for host # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_STATIC_LIBRARIES := libcutils LOCAL_LDLIBS := -ldl include $(BUILD_HOST_SHARED_LIBRARY) # Build children # ======================================================== include $(call all-makefiles-under,$(LOCAL_PATH)) libacc/acc.cpp +29 −20 Original line number Diff line number Diff line Loading @@ -1087,26 +1087,6 @@ class Compiler : public ErrorSink { size_t mPosition; }; int ch; // Current input character, or EOF intptr_t tok; // token intptr_t tokc; // token extra info int tokl; // token operator level intptr_t rsym; // return symbol intptr_t loc; // local variable index char* glo; // global variable index char* sym_stk; char* dstk; // Define stack char* dptr; // Macro state: Points to macro text during macro playback. int dch; // Macro state: Saves old value of ch during a macro playback. char* last_id; char* pGlobalBase; char* pVarsBase; // Value of variables InputStream* file; CodeBuf codeBuf; CodeGenerator* pGen; class String { public: String() { Loading Loading @@ -1306,6 +1286,8 @@ class Compiler : public ErrorSink { void pop() { if (mUsed > 0) { mUsed -= 1; } else { error("internal error: Popped empty stack."); } } Loading Loading @@ -1338,7 +1320,34 @@ class Compiler : public ErrorSink { size_t mSize; }; struct InputState { InputStream* pStream; int oldCh; }; int ch; // Current input character, or EOF intptr_t tok; // token intptr_t tokc; // token extra info int tokl; // token operator level intptr_t rsym; // return symbol intptr_t loc; // local variable index char* glo; // global variable index char* sym_stk; char* dstk; // Define stack char* dptr; // Macro state: Points to macro text during macro playback. int dch; // Macro state: Saves old value of ch during a macro playback. char* last_id; char* pGlobalBase; char* pVarsBase; // Value of variables InputStream* file; CodeBuf codeBuf; CodeGenerator* pGen; MacroTable mMacros; Array<InputState> mInputStateStack; String mErrorBuf; Loading libacc/tests/Android.mk +19 −2 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) # Executable for host # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp Loading @@ -7,9 +11,22 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libacc LOCAL_MODULE_TAGS := tests include $(BUILD_HOST_EXECUTABLE) # Executable for target # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp LOCAL_SHARED_LIBRARIES := \ libacc LOCAL_MODULE_TAGS := tests include $(BUILD_EXECUTABLE) No newline at end of file libacc/tests/data/returnval-ansi.c +4 −1 Original line number Diff line number Diff line #define VALUE (2*FOO) #define FOO 12 int main(int argc, char** argv) { return f(); } int f() { return 10; return VALUE; } libacc/tests/main.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ int run(MainPtr mainFunc, int argc, char** argv) { int main(int argc, char** argv) { const char* inFile = NULL; bool printListing; bool runResults = false; FILE* in = stdin; int i; for (i = 1; i < argc; i++) { Loading @@ -41,6 +42,9 @@ int main(int argc, char** argv) { case 'S': printListing = true; break; case 'R': runResults = true; break; default: fprintf(stderr, "Unrecognized flag %s\n", arg); return 3; Loading Loading @@ -108,7 +112,7 @@ int main(int argc, char** argv) { accGetScriptLabel(script, "main", (ACCvoid**) & mainPointer); result = accGetError(script); if (result == ACC_NO_ERROR) { if (result == ACC_NO_ERROR && runResults) { fprintf(stderr, "Executing compiled code:\n"); int codeArgc = argc - i + 1; char** codeArgv = argv + i - 1; Loading Loading
libacc/Android.mk +22 −4 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) # # Shared library # # Shared library for target # ======================================================== LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp Loading @@ -16,4 +15,23 @@ LOCAL_SHARED_LIBRARIES := libdl libcutils include $(BUILD_SHARED_LIBRARY) # Shared library for host # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_STATIC_LIBRARIES := libcutils LOCAL_LDLIBS := -ldl include $(BUILD_HOST_SHARED_LIBRARY) # Build children # ======================================================== include $(call all-makefiles-under,$(LOCAL_PATH))
libacc/acc.cpp +29 −20 Original line number Diff line number Diff line Loading @@ -1087,26 +1087,6 @@ class Compiler : public ErrorSink { size_t mPosition; }; int ch; // Current input character, or EOF intptr_t tok; // token intptr_t tokc; // token extra info int tokl; // token operator level intptr_t rsym; // return symbol intptr_t loc; // local variable index char* glo; // global variable index char* sym_stk; char* dstk; // Define stack char* dptr; // Macro state: Points to macro text during macro playback. int dch; // Macro state: Saves old value of ch during a macro playback. char* last_id; char* pGlobalBase; char* pVarsBase; // Value of variables InputStream* file; CodeBuf codeBuf; CodeGenerator* pGen; class String { public: String() { Loading Loading @@ -1306,6 +1286,8 @@ class Compiler : public ErrorSink { void pop() { if (mUsed > 0) { mUsed -= 1; } else { error("internal error: Popped empty stack."); } } Loading Loading @@ -1338,7 +1320,34 @@ class Compiler : public ErrorSink { size_t mSize; }; struct InputState { InputStream* pStream; int oldCh; }; int ch; // Current input character, or EOF intptr_t tok; // token intptr_t tokc; // token extra info int tokl; // token operator level intptr_t rsym; // return symbol intptr_t loc; // local variable index char* glo; // global variable index char* sym_stk; char* dstk; // Define stack char* dptr; // Macro state: Points to macro text during macro playback. int dch; // Macro state: Saves old value of ch during a macro playback. char* last_id; char* pGlobalBase; char* pVarsBase; // Value of variables InputStream* file; CodeBuf codeBuf; CodeGenerator* pGen; MacroTable mMacros; Array<InputState> mInputStateStack; String mErrorBuf; Loading
libacc/tests/Android.mk +19 −2 Original line number Diff line number Diff line LOCAL_PATH:= $(call my-dir) # Executable for host # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp Loading @@ -7,9 +11,22 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libacc LOCAL_MODULE_TAGS := tests include $(BUILD_HOST_EXECUTABLE) # Executable for target # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp LOCAL_SHARED_LIBRARIES := \ libacc LOCAL_MODULE_TAGS := tests include $(BUILD_EXECUTABLE) No newline at end of file
libacc/tests/data/returnval-ansi.c +4 −1 Original line number Diff line number Diff line #define VALUE (2*FOO) #define FOO 12 int main(int argc, char** argv) { return f(); } int f() { return 10; return VALUE; }
libacc/tests/main.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ int run(MainPtr mainFunc, int argc, char** argv) { int main(int argc, char** argv) { const char* inFile = NULL; bool printListing; bool runResults = false; FILE* in = stdin; int i; for (i = 1; i < argc; i++) { Loading @@ -41,6 +42,9 @@ int main(int argc, char** argv) { case 'S': printListing = true; break; case 'R': runResults = true; break; default: fprintf(stderr, "Unrecognized flag %s\n", arg); return 3; Loading Loading @@ -108,7 +112,7 @@ int main(int argc, char** argv) { accGetScriptLabel(script, "main", (ACCvoid**) & mainPointer); result = accGetError(script); if (result == ACC_NO_ERROR) { if (result == ACC_NO_ERROR && runResults) { fprintf(stderr, "Executing compiled code:\n"); int codeArgc = argc - i + 1; char** codeArgv = argv + i - 1; Loading