From 48ea095dc3b8ea8f4076afcb54b6695090e7da73 Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Thu, 7 Aug 2014 22:36:01 +1000 Subject: [PATCH 1/3] COMMON: added basic unit tests --- Makefile.am | 2 +- configure.ac | 5 ++ .../distro-examples/tests/output/array.out | 1 + .../distro-examples/tests/output/break.out | 5 ++ .../distro-examples/tests/output/byref.out | 24 +++++ .../tests/output/eval-test.out | 43 +++++++++ samples/distro-examples/tests/output/iifs.out | 8 ++ .../distro-examples/tests/output/matrices.out | 20 +++++ .../distro-examples/tests/output/metaa.out | 1 + .../distro-examples/tests/output/ongoto.out | 4 + samples/distro-examples/tests/output/uds.out | 2 + src/common/search.c | 4 +- src/platform/android/jni/Android.mk | 18 ++-- src/platform/android/jni/common/Android.mk | 88 +++++++++---------- src/platform/unix/Makefile.am | 13 +++ 15 files changed, 182 insertions(+), 56 deletions(-) create mode 100644 samples/distro-examples/tests/output/array.out create mode 100644 samples/distro-examples/tests/output/break.out create mode 100644 samples/distro-examples/tests/output/byref.out create mode 100644 samples/distro-examples/tests/output/eval-test.out create mode 100644 samples/distro-examples/tests/output/iifs.out create mode 100644 samples/distro-examples/tests/output/matrices.out create mode 100644 samples/distro-examples/tests/output/metaa.out create mode 100644 samples/distro-examples/tests/output/ongoto.out create mode 100644 samples/distro-examples/tests/output/uds.out diff --git a/Makefile.am b/Makefile.am index 1bc66edd..f1e44d3b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,7 +63,7 @@ deb: fakeroot dpkg-buildpackage test: - (cd $(SUBDIRS) && make test) + (cd @TEST_DIR@ && make test) release: (cd $(SUBDIRS) && make release) diff --git a/configure.ac b/configure.ac index 054fe9f9..136bba3f 100644 --- a/configure.ac +++ b/configure.ac @@ -522,6 +522,9 @@ function buildAndroid() { BUILD_SUBDIRS="src/platform/android" AC_SUBST(BUILD_SUBDIRS) + + TEST_DIR="src/platform/android" + AC_SUBST(TEST_DIR) } function buildConsole() { @@ -582,6 +585,8 @@ function buildConsole() { AC_CHECK_HEADER(readline/readline.h, [], [AC_MSG_ERROR("install libreadline-dev")]) PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread -lncurses -lreadline" BUILD_SUBDIRS="src/common src/platform/unix" + TEST_DIR="src/platform/unix" + AC_SUBST(TEST_DIR) fi AC_SUBST(BUILD_SUBDIRS) diff --git a/samples/distro-examples/tests/output/array.out b/samples/distro-examples/tests/output/array.out new file mode 100644 index 00000000..062e913e --- /dev/null +++ b/samples/distro-examples/tests/output/array.out @@ -0,0 +1 @@ +TEST: Arrays, unound, lbound diff --git a/samples/distro-examples/tests/output/break.out b/samples/distro-examples/tests/output/break.out new file mode 100644 index 00000000..b179e0b1 --- /dev/null +++ b/samples/distro-examples/tests/output/break.out @@ -0,0 +1,5 @@ +TEST REPEAT +TEST WHILE +TEST FOR +TEST SUB +DONE diff --git a/samples/distro-examples/tests/output/byref.out b/samples/distro-examples/tests/output/byref.out new file mode 100644 index 00000000..1d7d4654 --- /dev/null +++ b/samples/distro-examples/tests/output/byref.out @@ -0,0 +1,24 @@ +* simple +psa:1 +1 +psb:1 +-1 + +* array +psa:[1,2,3] +[1,2,3] +psb:[1,2,3] +[-1,2,3] + +* nested array #1 +psa:[[2,3,4],2,3] +[[2,3,4],2,3] +psb:[[2,3,4],2,3] +[[-1,3,4],2,3] + +* nested array #2 +psa:[2,3,4] +[2,3,4] +psb:[2,3,4] +[-1,3,4] +3 diff --git a/samples/distro-examples/tests/output/eval-test.out b/samples/distro-examples/tests/output/eval-test.out new file mode 100644 index 00000000..5615eaa4 --- /dev/null +++ b/samples/distro-examples/tests/output/eval-test.out @@ -0,0 +1,43 @@ +Generic +0.6: ERROR (acceptable?) <> 0.6 + +Auto type convertion +n=i+n = 2.2 = 2.2 +n=n+i = 2.2 = 2.2 +n=n+n = 2.2 = 2.2 +i=i+i = 2 = 2 +n=i+s = 2.2 = 2.2 +n=i+s = -.1 = -0.1 +n=n+s = 2.2 = 2.2 +n=s+i = 2 = 2 +n=s+n = 2.2 = 2.2 +s=i+s = 1a = 1a +s=n+s = 1.1a = 1.1a +s=s+i = a1 = a1 +s=s+n = a1.1 = a1.1 +s=s+s = 11 = 11 + +Compare +s=s = 1 = 1 +s=i = 1 = 1 +s=n = 1 = 1 +i=s = 1 = 1 +n=s = 1 = 1 +n=n = 1 = 1 +n=i = 1 = 1 +i=n = 1 = 1 +i=i = 1 = 1 +i>i = 1 = 1 +i>=i = 1 = 1 +i<=i = 1 = 1 +i<>i = 1 = 1 + +Array + +Nested arrays +true +true + +Testing base-convertion... +Scientific notation = 2E+.3 = 3.99052462993776 --- 2E-2 = 0.02 = 0.02 +Bob's bug = -30 = -30 diff --git a/samples/distro-examples/tests/output/iifs.out b/samples/distro-examples/tests/output/iifs.out new file mode 100644 index 00000000..85ef7f99 --- /dev/null +++ b/samples/distro-examples/tests/output/iifs.out @@ -0,0 +1,8 @@ +Normal IF - Ok +Inline IF - Ok +Ok +Ok +label 500 - Ok +label 600 - Ok +3 inline IFs +True diff --git a/samples/distro-examples/tests/output/matrices.out b/samples/distro-examples/tests/output/matrices.out new file mode 100644 index 00000000..65f34022 --- /dev/null +++ b/samples/distro-examples/tests/output/matrices.out @@ -0,0 +1,20 @@ +MATRICES + +[-6;2;-7] + [5;4;-6] = [-1;6;-13] +[-6;2;-7] - [5;4;-6] = [-11;-2;-1] +[-6;2;-7] * 0.5 = [-3;1;-3.5] +A = [-6;2;-7], -A = [6;-2;7] + +[-2;3] * [7,6,-3,5] = [-14,-12,6,-10;21,18,-9,15] + +[2,4;-1,-2] * [-2,2,4;1,-1,-2] = [0,0,0;0,0,0] + +[-3,0;2,-1] * [4,-2;3,5] = [-12,6;5,-9] + +Solve this: + 5x - 2y + 3z = -2 + -2x + 7y + 5z = 7 + 3x + 5y + 6z = 9 + +[x; y; z] = [2;3;-2] + diff --git a/samples/distro-examples/tests/output/metaa.out b/samples/distro-examples/tests/output/metaa.out new file mode 100644 index 00000000..9e0c06e8 --- /dev/null +++ b/samples/distro-examples/tests/output/metaa.out @@ -0,0 +1 @@ +Module: Meta-A diff --git a/samples/distro-examples/tests/output/ongoto.out b/samples/distro-examples/tests/output/ongoto.out new file mode 100644 index 00000000..16b77eac --- /dev/null +++ b/samples/distro-examples/tests/output/ongoto.out @@ -0,0 +1,4 @@ +10 +20 +30 +40 diff --git a/samples/distro-examples/tests/output/uds.out b/samples/distro-examples/tests/output/uds.out new file mode 100644 index 00000000..5d56218f --- /dev/null +++ b/samples/distro-examples/tests/output/uds.out @@ -0,0 +1,2 @@ +start of test +end of test diff --git a/src/common/search.c b/src/common/search.c index 455e4902..fba8b044 100644 --- a/src/common/search.c +++ b/src/common/search.c @@ -29,7 +29,7 @@ tdestroy_recurse(node_t *root, tdestroy_cb freefct) { if (root->right != NULL) { tdestroy_recurse(root->right, freefct); } - (*freefct) ((void *) root->key); + freefct((void *) root->key); free(root); } @@ -55,7 +55,7 @@ void *tfind(const void *vkey, void **vrootp, tcompare_cb compar) { node_t **rootp = (node_t **)vrootp; while (rootp != NULL && *rootp != NULL) { - int r = (*compar)(vkey, (*rootp)->key); + int r = compar(vkey, (*rootp)->key); if (r == 0) { // found return *rootp; diff --git a/src/platform/android/jni/Android.mk b/src/platform/android/jni/Android.mk index c5fc049f..5b10f78e 100644 --- a/src/platform/android/jni/Android.mk +++ b/src/platform/android/jni/Android.mk @@ -21,17 +21,17 @@ LOCAL_PATH := $(JNI_PATH) include $(CLEAR_VARS) LOCAL_MODULE := smallbasic LOCAL_CFLAGS := -DHAVE_CONFIG_H=1 -LOCAL_C_INCLUDES := $(SB_HOME) $(SB_HOME)/src \ - $(FREETYPE_HOME)/freetype/include \ +LOCAL_C_INCLUDES := $(SB_HOME) $(SB_HOME)/src \ + $(FREETYPE_HOME)/freetype/include \ $(FREETYPE_HOME)/freetype/include/freetype2 -LOCAL_SRC_FILES := main.cpp \ - display.cpp \ - runtime.cpp \ - ../../common/screen.cpp \ +LOCAL_SRC_FILES := main.cpp \ + display.cpp \ + runtime.cpp \ + ../../common/screen.cpp \ ../../common/ansiwidget.cpp \ - ../../common/form_ui.cpp \ - ../../common/StringLib.cpp \ - ../../common/graphics.cpp \ + ../../common/form_ui.cpp \ + ../../common/StringLib.cpp \ + ../../common/graphics.cpp \ ../../common/system.cpp LOCAL_LDLIBS := -llog -landroid -ljnigraphics LOCAL_STATIC_LIBRARIES := sb_common png freetype android_native_app_glue diff --git a/src/platform/android/jni/common/Android.mk b/src/platform/android/jni/common/Android.mk index 938e96d4..88b7b0ad 100644 --- a/src/platform/android/jni/common/Android.mk +++ b/src/platform/android/jni/common/Android.mk @@ -13,50 +13,50 @@ COMMON=$(SB_HOME)/src/common LOCAL_C_INCLUDES := $(SB_HOME) $(SB_HOME)/src LOCAL_MODULE := sb_common LOCAL_CFLAGS := -DHAVE_CONFIG_H=1 -LOCAL_SRC_FILES := \ - $(COMMON)/bc.c \ - $(COMMON)/blib.c \ - $(COMMON)/blib_db.c \ - $(COMMON)/blib_func.c \ - $(COMMON)/blib_graph.c \ - $(COMMON)/blib_math.c \ - $(COMMON)/matrix.c \ - $(COMMON)/blib_sound.c \ - $(COMMON)/brun.c \ - $(COMMON)/ceval.c \ - $(COMMON)/circle.c \ - $(COMMON)/decomp.c \ - $(COMMON)/device.c \ - $(COMMON)/screen.c \ - $(COMMON)/system.c \ - $(COMMON)/eval.c \ - $(COMMON)/extlib.c \ - $(COMMON)/file.c \ - $(COMMON)/ffill.c \ - $(COMMON)/fmt.c \ - $(COMMON)/fs_serial.c \ - $(COMMON)/fs_socket_client.c \ - $(COMMON)/fs_stream.c \ - $(COMMON)/g_line.c \ - $(COMMON)/geom.c \ - $(COMMON)/inet.c \ - $(COMMON)/kw.c \ - $(COMMON)/match.c \ - $(COMMON)/mem.c \ - $(COMMON)/panic.c \ - $(COMMON)/pfill.c \ - $(COMMON)/plot.c \ - $(COMMON)/proc.c \ - $(COMMON)/sberr.c \ - $(COMMON)/scan.c \ - $(COMMON)/str.c \ - $(COMMON)/tasks.c \ - $(COMMON)/search.c \ - $(COMMON)/var_uds.c \ - $(COMMON)/var_hash.c \ - $(COMMON)/keymap.c \ - $(COMMON)/units.c \ - $(COMMON)/var.c \ +LOCAL_SRC_FILES := \ + $(COMMON)/bc.c \ + $(COMMON)/blib.c \ + $(COMMON)/blib_db.c \ + $(COMMON)/blib_func.c \ + $(COMMON)/blib_graph.c \ + $(COMMON)/blib_math.c \ + $(COMMON)/matrix.c \ + $(COMMON)/blib_sound.c \ + $(COMMON)/brun.c \ + $(COMMON)/ceval.c \ + $(COMMON)/circle.c \ + $(COMMON)/decomp.c \ + $(COMMON)/device.c \ + $(COMMON)/screen.c \ + $(COMMON)/system.c \ + $(COMMON)/eval.c \ + $(COMMON)/extlib.c \ + $(COMMON)/file.c \ + $(COMMON)/ffill.c \ + $(COMMON)/fmt.c \ + $(COMMON)/fs_serial.c \ + $(COMMON)/fs_socket_client.c \ + $(COMMON)/fs_stream.c \ + $(COMMON)/g_line.c \ + $(COMMON)/geom.c \ + $(COMMON)/inet.c \ + $(COMMON)/kw.c \ + $(COMMON)/match.c \ + $(COMMON)/mem.c \ + $(COMMON)/panic.c \ + $(COMMON)/pfill.c \ + $(COMMON)/plot.c \ + $(COMMON)/proc.c \ + $(COMMON)/sberr.c \ + $(COMMON)/scan.c \ + $(COMMON)/str.c \ + $(COMMON)/tasks.c \ + $(COMMON)/search.c \ + $(COMMON)/var_uds.c \ + $(COMMON)/var_hash.c \ + $(COMMON)/keymap.c \ + $(COMMON)/units.c \ + $(COMMON)/var.c \ $(COMMON)/vmt.c include $(BUILD_STATIC_LIBRARY) diff --git a/src/platform/unix/Makefile.am b/src/platform/unix/Makefile.am index dd896a8d..27e17b81 100644 --- a/src/platform/unix/Makefile.am +++ b/src/platform/unix/Makefile.am @@ -41,3 +41,16 @@ sbasic_LDADD += -ldl endif sbasic_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a + +TEST_DIR=../../../samples/distro-examples/tests +UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto uds + +test: ${bin_PROGRAMS} + @for utest in $(UNIT_TESTS); do \ + ${bin_PROGRAMS} ${TEST_DIR}/$${utest}.bas > test.out; \ + if cmp -s test.out ${TEST_DIR}/output/$${utest}.out; then \ + echo $${utest} ✓; \ + else \ + echo $${utest} ✘; \ + fi ; \ + done; From 71544f02e2d40468908be0ce9f137bddccce1250 Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Sat, 9 Aug 2014 14:53:08 +1000 Subject: [PATCH 2/3] COMMON: cleanup comp_pass1(), fix INCLUDE statement --- ide/android/project.properties | 2 +- .../tests}/call_tau.bas | 0 samples/distro-examples/tests/metaa.bas | 4 +- samples/distro-examples/tests/metac.bas | 1 - .../distro-examples/tests/output/call_tau.out | 20 + .../distro-examples/tests/output/metaa.out | 1 + .../distro-examples/tests/output/pass1.out | 2 + samples/distro-examples/tests/pass1.bas | 17 + samples/distro-examples/tests/predef.bas | 8 + .../tests}/tau.bas | 0 .../tests}/tauchild.bas | 0 samples/unit-tests/predef.bas | 18 - src/common/scan.c | 584 ++++++++---------- src/common/tasks.h | 5 +- src/common/units.c | 2 - src/languages/keywords.en.c | 4 +- src/languages/messages.en.h | 1 + src/platform/unix/Makefile.am | 7 +- 18 files changed, 329 insertions(+), 347 deletions(-) rename samples/{unit-tests => distro-examples/tests}/call_tau.bas (100%) create mode 100644 samples/distro-examples/tests/output/call_tau.out create mode 100644 samples/distro-examples/tests/output/pass1.out create mode 100644 samples/distro-examples/tests/pass1.bas rename samples/{unit-tests => distro-examples/tests}/tau.bas (100%) rename samples/{unit-tests => distro-examples/tests}/tauchild.bas (100%) delete mode 100644 samples/unit-tests/predef.bas diff --git a/ide/android/project.properties b/ide/android/project.properties index 0840b4a0..7b23ae4a 100644 --- a/ide/android/project.properties +++ b/ide/android/project.properties @@ -8,7 +8,7 @@ # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt +proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-15 diff --git a/samples/unit-tests/call_tau.bas b/samples/distro-examples/tests/call_tau.bas similarity index 100% rename from samples/unit-tests/call_tau.bas rename to samples/distro-examples/tests/call_tau.bas diff --git a/samples/distro-examples/tests/metaa.bas b/samples/distro-examples/tests/metaa.bas index 86827c46..1b1a0ba5 100644 --- a/samples/distro-examples/tests/metaa.bas +++ b/samples/distro-examples/tests/metaa.bas @@ -1,5 +1,3 @@ -#!/usr/bin/sbasic -#inc:"metac.bas" - +INCLUDE "metac.bas" ? "Module: Meta-A" diff --git a/samples/distro-examples/tests/metac.bas b/samples/distro-examples/tests/metac.bas index 7e719b96..04760795 100644 --- a/samples/distro-examples/tests/metac.bas +++ b/samples/distro-examples/tests/metac.bas @@ -1,4 +1,3 @@ - ? "Module: Meta-B" diff --git a/samples/distro-examples/tests/output/call_tau.out b/samples/distro-examples/tests/output/call_tau.out new file mode 100644 index 00000000..30d58299 --- /dev/null +++ b/samples/distro-examples/tests/output/call_tau.out @@ -0,0 +1,20 @@ +TauChild::initialized + +Tau::initilized + +Tau's exported variable: Tau's exported variable +Function fooF : Tau's fooF(Hi) is here +Procedure fooP : +Tau's fooP(Hi) is here +message from main +message from tau +[1,2,3,4] +Predefined Variables +OS VER =0x0 +OS NAME=Unix/Linux version 3.13.0-32-generic (buildd@kissel) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 +SB VER =0x0 +PI =3.14159265358979 +XMAX =161 +YMAX =42 +CWD =/home/chrisws/src/SmallBASIC/src/platform/unix/ +HOME =/home/chrisws/ diff --git a/samples/distro-examples/tests/output/metaa.out b/samples/distro-examples/tests/output/metaa.out index 9e0c06e8..b05ea054 100644 --- a/samples/distro-examples/tests/output/metaa.out +++ b/samples/distro-examples/tests/output/metaa.out @@ -1 +1,2 @@ +Module: Meta-B Module: Meta-A diff --git a/samples/distro-examples/tests/output/pass1.out b/samples/distro-examples/tests/output/pass1.out new file mode 100644 index 00000000..2c94e483 --- /dev/null +++ b/samples/distro-examples/tests/output/pass1.out @@ -0,0 +1,2 @@ +OK +OK diff --git a/samples/distro-examples/tests/pass1.bas b/samples/distro-examples/tests/pass1.bas new file mode 100644 index 00000000..f2d16fa3 --- /dev/null +++ b/samples/distro-examples/tests/pass1.bas @@ -0,0 +1,17 @@ +OPTION PREDEF QUIET +OPTION PREDEF TEXTMODE +OPTION PREDEF COMMAND FOO + +if (command <> "FOO") then + print "ERROR" +else + print "OK" +end if + +UNITPATH = "/foo" +if ENV("UNITPATH") != "/foo" then + print "ERROR" + " WAS:" + ENV("UNITPATH") +else + print "OK" +end if + diff --git a/samples/distro-examples/tests/predef.bas b/samples/distro-examples/tests/predef.bas index a5a954b2..51f7be69 100644 --- a/samples/distro-examples/tests/predef.bas +++ b/samples/distro-examples/tests/predef.bas @@ -1,3 +1,8 @@ +unit predef + +export prsys + +sub prsys ? cat(1);"Predefined Variables";cat(0) ? "OS VER =0x"; HEX$(osver) ? "OS NAME="; osname @@ -5,6 +10,9 @@ ? "PI ="; pi ? "XMAX ="; xmax ? "YMAX ="; ymax +? "CWD ="; CWD +? "HOME ="; HOME +end diff --git a/samples/unit-tests/tau.bas b/samples/distro-examples/tests/tau.bas similarity index 100% rename from samples/unit-tests/tau.bas rename to samples/distro-examples/tests/tau.bas diff --git a/samples/unit-tests/tauchild.bas b/samples/distro-examples/tests/tauchild.bas similarity index 100% rename from samples/unit-tests/tauchild.bas rename to samples/distro-examples/tests/tauchild.bas diff --git a/samples/unit-tests/predef.bas b/samples/unit-tests/predef.bas deleted file mode 100644 index 51f7be69..00000000 --- a/samples/unit-tests/predef.bas +++ /dev/null @@ -1,18 +0,0 @@ -unit predef - -export prsys - -sub prsys -? cat(1);"Predefined Variables";cat(0) -? "OS VER =0x"; HEX$(osver) -? "OS NAME="; osname -? "SB VER =0x"; HEX$(sbver) -? "PI ="; pi -? "XMAX ="; xmax -? "YMAX ="; ymax -? "CWD ="; CWD -? "HOME ="; HOME -end - - - diff --git a/src/common/scan.c b/src/common/scan.c index b0d68854..f21a2fed 100644 --- a/src/common/scan.c +++ b/src/common/scan.c @@ -17,6 +17,25 @@ #include "common/units.h" #include "common/extlib.h" #include "common/messages.h" +#include "languages/keywords.en.c" + +#define STRLEN(s) ((sizeof(s) / sizeof(s[0])) - 1) +#define LEN_OPTION STRLEN(LCN_OPTION) +#define LEN_IMPORT STRLEN(LCN_IMPORT_WRS) +#define LEN_UNIT STRLEN(LCN_UNIT_WRS) +#define LEN_UNIT_PATH STRLEN(LCN_UNIT_PATH) +#define LEN_INC STRLEN(LCN_INC) +#define LEN_SUB_WRS STRLEN(LCN_SUB_WRS) +#define LEN_FUNC_WRS STRLEN(LCN_FUNC_WRS) +#define LEN_DEF_WRS STRLEN(LCN_DEF_WRS) +#define LEN_END_WRS STRLEN(LCN_END_WRS) +#define LEN_END_SELECT STRLEN(LCN_END_SELECT) +#define LEN_PREDEF STRLEN(LCN_PREDEF) +#define LEN_QUIET STRLEN(LCN_QUIET) +#define LEN_GRMODE STRLEN(LCN_GRMODE) +#define LEN_TEXTMODE STRLEN(LCN_TEXTMODE) +#define LEN_CSTR STRLEN(LCN_CSTR) +#define LEN_COMMAND STRLEN(LCN_COMMAND) char *comp_array_uds_field(char *p, bc_t * bc); void comp_text_line(char *text); @@ -50,8 +69,6 @@ void err_comp_label_not_def(const char *name) { sc_raise(MSG_LABEL_NOT_DEFINED, name); } -#include "languages/keywords.en.c" - /* * reset the external proc/func lists */ @@ -2886,18 +2903,12 @@ void comp_pass2_scan() { comp_label_t label; if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (isatty(STDOUT_FILENO)) -#endif - log_printf(MSG_PASS2_COUNT, i, comp_sp); + log_printf(MSG_PASS2_COUNT, i, comp_sp); } // for each node in stack for (i = 0; i < comp_sp; i++) { if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (isatty(STDOUT_FILENO)) -#endif if ((i % SB_KEYWORD_SIZE) == 0) { log_printf(MSG_PASS2_COUNT, i, comp_sp); } @@ -3336,31 +3347,6 @@ void comp_close() { comp_reset_externals(); } -/* - * returns true if the 'fileName' exists - */ -int comp_bas_exist(const char *basfile) { - int check = 0; - char *p, *fileName; - - fileName = tmp_alloc(strlen(basfile) + 5); - strcpy(fileName, basfile); - - p = strchr(fileName, '.'); - if (!p) { - strcat(fileName, ".bas"); - } - -#if !defined(_UnixOS) - check = (access(fileName, 0) == 0); -#else - check = (access(fileName, R_OK) == 0); -#endif - - tmp_free(fileName); - return check; -} - /* * load a source file */ @@ -3660,8 +3646,8 @@ const char *get_unit_name(const char *p, char *buf_p) { */ void comp_preproc_import(const char *slist) { const char *p; - char buf[OS_PATHNAME_SIZE + 1];int - uid; + char buf[OS_PATHNAME_SIZE + 1]; + int uid; bc_lib_rec_t imlib; p = slist; @@ -3757,244 +3743,242 @@ void comp_preproc_unit(char *name) { } /** - * PASS 1 + * Prepare compiler for INCLUDE source */ -int comp_pass1(const char *section, const char *text) { - char *ps, *p, lc = 0; - int i; - char pname[SB_KEYWORD_SIZE + 1];char - *code_line; - char *new_text; - int len_option, len_import, len_unit, len_unit_path, len_inc; - int len_sub, len_func, len_def, len_end, len_end_select; +void comp_preproc_include(char *p) { + char fileName[OS_PATHNAME_SIZE]; + char path[OS_PATHNAME_SIZE]; - code_line = tmp_alloc(SB_SOURCELINE_SIZE + 1); - memset(comp_bc_sec, 0, SB_KEYWORD_SIZE + 1); - if (section) { - strncpy(comp_bc_sec, section, SB_KEYWORD_SIZE); + SKIP_SPACES(p); + if (*p == '\"') { + p++; + } + char *fp = fileName; + int size = 0; + while (*p != '\n' && + *p != '\"' && + *p != '\0' && + ++size < OS_PATHNAME_SIZE) { + *fp++ = *p++; + } + *fp = '\0'; + + str_alltrim(fileName); + strcpy(path, fileName); + + int basExists = (access(path, R_OK) == 0); + if (!basExists) { + char *bas_dir = getenv("BASDIR"); + if (bas_dir) { + strcpy(path, bas_dir); + strcat(path, fileName); + basExists = (access(path, R_OK) == 0); + } + } + if (!basExists) { + sc_raise(MSG_INC_FILE_DNE, comp_file_name, path); + } else if (strcmp(comp_file_name, path) == 0) { + sc_raise(MSG_INC_FILE_INC, comp_file_name, path); } else { - strncpy(comp_bc_sec, SYS_MAIN_SECTION_NAME, SB_KEYWORD_SIZE); + char oldFileName[1024]; + char oldSec[SB_KEYWORD_SIZE + 1]; + strcpy(oldSec, comp_bc_sec); + strcpy(oldFileName, comp_file_name); + char *source = comp_load(path); + if (source) { + comp_pass1(NULL, source); + tmp_free(source); + } + strcpy(comp_file_name, oldFileName); + strcpy(comp_bc_sec, oldSec); } - new_text = comp_format_text(text); - - // second (we can change it to support preprocessor) - // Check for: - // include (#inc:) - // units-dir (#unit-path:) - // IMPORT - // UDF and UDP declarations - // PREDEF OPTIONS - p = ps = new_text; - comp_proc_level = 0; - *comp_bc_proc = '\0'; - - len_option = strlen(LCN_OPTION); - len_import = strlen(LCN_IMPORT_WRS); - len_unit = strlen(LCN_UNIT_WRS); - len_unit_path = strlen(LCN_UNIT_PATH); - len_inc = strlen(LCN_INC); - - len_sub = strlen(LCN_SUB_WRS); - len_func = strlen(LCN_FUNC_WRS); - len_def = strlen(LCN_DEF_WRS); - len_end = strlen(LCN_END_WRS); - len_end_select = strlen(LCN_END_SELECT); +} - while (*p) { - // OPTION environment parameters - if (strncmp(LCN_OPTION, p, len_option) == 0) { - p += len_option; +/** + * Handle OPTION environment parameters + */ +char *comp_preproc_options(char *p) { + SKIP_SPACES(p); + if (strncmp(LCN_PREDEF, p, LEN_PREDEF) == 0) { + p += LEN_PREDEF; + SKIP_SPACES(p); + if (strncmp(LCN_QUIET, p, LEN_QUIET) == 0) { + opt_quiet = 1; + } else if (strncmp(LCN_GRMODE, p, LEN_GRMODE) == 0) { + p += LEN_GRMODE; + comp_preproc_grmode(p); + opt_graphics = 1; + } else if (strncmp(LCN_TEXTMODE, p, LEN_TEXTMODE) == 0) { + opt_graphics = 0; + } else if (strncmp(LCN_CSTR, p, LEN_CSTR) == 0) { + opt_cstr = 1; + } else if (strncmp(LCN_COMMAND, p, LEN_COMMAND) == 0) { + p += LEN_COMMAND; SKIP_SPACES(p); - if (strncmp(LCN_PREDEF, p, strlen(LCN_PREDEF)) == 0) { - p += strlen(LCN_PREDEF); - SKIP_SPACES(p); - if (strncmp(LCN_QUIET, p, strlen(LCN_QUIET)) == 0) { - opt_quiet = 1; - } else if (strncmp(LCN_GRMODE, p, strlen(LCN_GRMODE)) == 0) { - p += strlen(LCN_GRMODE); - comp_preproc_grmode(p); - opt_graphics = 1; - } else if (strncmp(LCN_TEXTMODE, p, strlen(LCN_TEXTMODE)) == 0) { - opt_graphics = 0; - } else if (strncmp(LCN_CSTR, p, strlen(LCN_CSTR)) == 0) { - opt_cstr = 1; - } else if (strncmp(LCN_COMMAND, p, strlen(LCN_COMMAND)) == 0) { - char *pe; - p += strlen(LCN_COMMAND); - SKIP_SPACES(p); - pe = p; - while (*pe != '\0' && *pe != '\n') { - pe++; - } - lc = *pe; - *pe = '\0'; - if (strlen(p) < OPT_CMD_SZ) { - strcpy(opt_command, p); - } else { - memcpy(opt_command, p, OPT_CMD_SZ - 1); - opt_command[OPT_CMD_SZ - 1] = '\0'; - } - - *pe = lc; - } else { - sc_raise(MSG_OPT_PREDEF_ERR, p); - } + char *pe = p; + while (*pe != '\0' && *pe != '\n') { + pe++; } - } else if (strncmp(LCN_IMPORT_WRS, p, len_import) == 0) { - // IMPORT units - comp_preproc_import(p + len_import); - comp_preproc_remove_line(p, 1); - } else if (strncmp(LCN_UNIT_WRS, p, len_unit) == 0) { - // UNIT name - if (comp_unit_flag) { - sc_raise(MSG_MANY_UNIT_DECL); + char lc = *pe; + *pe = '\0'; + if (strlen(p) < OPT_CMD_SZ) { + strcpy(opt_command, p); } else { - comp_preproc_unit(p + len_unit); - } - comp_preproc_remove_line(p, 1); - } else if (strncmp(LCN_UNIT_PATH, p, len_unit_path) == 0) { - // UNIT-PATH name -#if defined(_UnixOS) || defined(_DOS) || defined(_Win32) - char upath[SB_SOURCELINE_SIZE + 1], *up; - char *ps; - - ps = p; - p += len_unit_path; - SKIP_SPACES(p); - if (*p == '\"') { - p++; + memcpy(opt_command, p, OPT_CMD_SZ - 1); + opt_command[OPT_CMD_SZ - 1] = '\0'; } - up = upath; + *pe = lc; + } else { + sc_raise(MSG_OPT_PREDEF_ERR, p); + } + } + return p; +} + +/** + * Setup the UNITPATH environment variable. + */ +void comp_preproc_unit_path(char *p) { + SKIP_SPACES(p); + if (*p == '=') { + p++; + SKIP_SPACES(p); + if (*p == '\"') { + p++; + char upath[SB_SOURCELINE_SIZE + 1]; + char *up = upath; while (*p != '\n' && *p != '\"') { *up++ = *p++; } *up = '\0'; - - sprintf(comp_bc_temp, "SB_UNIT_PATH=%s", upath); + sprintf(comp_bc_temp, "UNITPATH=%s", upath); putenv(strdup(comp_bc_temp)); - p = ps; - comp_preproc_remove_line(p, 0); -#else // supported OSes - comp_preproc_remove_line(p, 0); -#endif - } else { - // INCLUDE FILE - // this is not a normal way but needs less memory - if (strncmp(LCN_INC, p, len_inc) == 0) { - char *crp = NULL; - p += len_inc; - if (*p == '\"') { - p++; - - crp = p; - while (*crp != '\0' && *crp != '\"') { - crp++; - } - if (*crp == '\0') { - sc_raise(MSG_INC_MIS_DQ); - break; - } - - (lc = *crp, *crp = '\0'); - } else { - crp = strchr(p, '\n'); - *crp = '\0'; - lc = '\n'; - } + } + } +} - strcpy(code_line, p); - *crp = lc; - str_alltrim(code_line); - if (!comp_bas_exist(code_line)) { - sc_raise(MSG_INC_FILE_DNE, comp_file_name, code_line); - } else { - char fileName[1024]; - char sec[SB_KEYWORD_SIZE + 1]; - strcpy(sec, comp_bc_sec); - strcpy(fileName, comp_file_name); - if (strchr(code_line, '.') == NULL) { - strcat(code_line, ".bas"); - } - comp_load(code_line); - strcpy(comp_file_name, fileName); - strcpy(comp_bc_sec, sec); - } - } - if ((strncmp(LCN_SUB_WRS, p, len_sub) == 0) || - (strncmp(LCN_FUNC_WRS, p, len_func) == 0) - || (strncmp(LCN_DEF_WRS, p, len_def) == 0)) { - // SUB/FUNC/DEF - Automatic declaration - BEGIN - char *dp; - int single_line_f = 0; - - if (strncmp(LCN_SUB_WRS, p, len_sub) == 0) { - p += len_sub; - } else if (strncmp(LCN_FUNC_WRS, p, len_func) == 0) { - p += len_func; - } else { - p += len_def; - } - SKIP_SPACES(p); +/** + * SUB/FUNC/DEF - Automatic declaration - BEGIN + */ +char *comp_preproc_func_begin(char *p) { + char *dp; + int single_line_f = 0; + char pname[SB_KEYWORD_SIZE + 1]; + + if (strncmp(LCN_SUB_WRS, p, LEN_SUB_WRS) == 0) { + p += LEN_SUB_WRS; + } else if (strncmp(LCN_FUNC_WRS, p, LEN_FUNC_WRS) == 0) { + p += LEN_FUNC_WRS; + } else { + p += LEN_DEF_WRS; + } + SKIP_SPACES(p); + + // copy proc/func name + dp = pname; + while (is_alnum(*p) || *p == '_') { + *dp++ = *p++; + } + *dp = '\0'; + + // search for '=' + while (*p != '\n' && *p != '=') { + p++; + } + if (*p == '=') { + single_line_f = 1; + while (*p != '\n') { + p++; + } + } + + // add declaration + if (comp_udp_getip(pname) == INVALID_ADDR) { + comp_add_udp(pname); + } else { + sc_raise(MSG_UDP_ALREADY_DECL, pname); + } - // copy proc/func name - dp = pname; - while (is_alnum(*p) || *p == '_') { - *dp++ = *p++; - } - *dp = '\0'; + // func/proc name (also, update comp_bc_proc) + if (comp_proc_level) { + strcat(comp_bc_proc, "/"); + strcat(comp_bc_proc, baseof(pname, '/')); + } else { + strcpy(comp_bc_proc, pname); + } + + if (!single_line_f) { + comp_proc_level++; + } else { + // inline (DEF FN) + char *dol = strrchr(comp_bc_proc, '/'); + if (dol) { + *dol = '\0'; + } else { + *comp_bc_proc = '\0'; + } + } + return p; +} - // search for '=' - while (*p != '\n' && *p != '=') { - p++; - } - if (*p == '=') { - single_line_f = 1; - while (*p != '\n') { - p++; - } - } +/** + * SUB/FUNC/DEF - Automatic declaration - END + */ +void comp_preproc_func_end(char *p) { + // avoid seeing "END SELECT" which doesn't end a SUB/FUNC + if (strncmp(p, LCN_END_SELECT, LEN_END_SELECT) != 0) { + char *dol = strrchr(comp_bc_proc, '/'); + if (dol) { + *dol = '\0'; + } else { + *comp_bc_proc = '\0'; + } + comp_proc_level--; + } +} - // add declaration - if (comp_udp_getip(pname) == INVALID_ADDR) { - comp_add_udp(pname); - } else { - sc_raise(MSG_UDP_ALREADY_DECL, pname); - } - // func/proc name (also, update comp_bc_proc) - if (comp_proc_level) { - strcat(comp_bc_proc, "/"); - strcat(comp_bc_proc, baseof(pname, '/')); - } else { - strcpy(comp_bc_proc, pname); - } +/** + * Preprocess handler for pass1 + */ +void comp_preproc_pass1(char *p) { + comp_proc_level = 0; + *comp_bc_proc = '\0'; - if (!single_line_f) { - comp_proc_level++; - } else { - // inline (DEF FN) - char *dol = strrchr(comp_bc_proc, '/'); - if (dol) { - *dol = '\0'; - } else { - *comp_bc_proc = '\0'; - } - } - } else if (comp_proc_level) { - // SUB/FUNC/DEF - Automatic declaration - END - if (strncmp(LCN_END_WRS, p, len_end) == 0 || strncmp(LCN_END_WNL, p, len_end) == 0) { - // avoid seeing "END SELECT" which doesn't end a SUB/F - if (strncmp(p, LCN_END_SELECT, len_end_select) != 0) { - char *dol = strrchr(comp_bc_proc, '/'); - if (dol) { - *dol = '\0'; - } else { - *comp_bc_proc = '\0'; - } - comp_proc_level--; - } - } + while (*p) { + if (strncmp(LCN_OPTION, p, LEN_OPTION) == 0) { + // options + p = comp_preproc_options(p + LEN_OPTION); + } else if (strncmp(LCN_IMPORT_WRS, p, LEN_IMPORT) == 0) { + // import + comp_preproc_import(p + LEN_IMPORT); + comp_preproc_remove_line(p, 1); + } else if (strncmp(LCN_UNIT_WRS, p, LEN_UNIT) == 0) { + // unit + if (comp_unit_flag) { + sc_raise(MSG_MANY_UNIT_DECL); + } else { + comp_preproc_unit(p + LEN_UNIT); } - } // OPTION + comp_preproc_remove_line(p, 1); + } else if (strncmp(LCN_UNIT_PATH, p, LEN_UNIT_PATH) == 0) { + // unitpath + comp_preproc_unit_path(p + LEN_UNIT_PATH); + comp_preproc_remove_line(p, 0); + } else if (strncmp(LCN_INC, p, LEN_INC) == 0) { + // include + comp_preproc_include(p + LEN_INC); + comp_preproc_remove_line(p, 0); + } else if ((strncmp(LCN_SUB_WRS, p, LEN_SUB_WRS) == 0) || + (strncmp(LCN_FUNC_WRS, p, LEN_FUNC_WRS) == 0) || + (strncmp(LCN_DEF_WRS, p, LEN_DEF_WRS) == 0)) { + // sub/func + p = comp_preproc_func_begin(p); + } else if (comp_proc_level && + (strncmp(LCN_END_WRS, p, LEN_END_WRS) == 0 || + strncmp(LCN_END_WNL, p, LEN_END_WRS) == 0)) { + // end sub/func + comp_preproc_func_end(p); + } // skip text line while (*p != '\0' && *p != '\n') { @@ -4013,67 +3997,50 @@ int comp_pass1(const char *section, const char *text) { *comp_bc_proc = '\0'; if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (!isatty(STDOUT_FILENO)) { - fprintf(stdout, "%s: %s\n", WORD_FILE, comp_file_name); - } - else { - log_printf("%s: \033[1m%s\033[0m\n", WORD_FILE, comp_file_name); - } -#elif defined(_PalmOS) // if (code-sections) - log_printf - ("%s: \033[1m%s\033[0m\n\033[80m%s: \033[1m%s\033[0m\033[80m\n", - WORD_FILE, comp_file_name, WORD_SECTION, comp_bc_sec); -#else log_printf("%s: \033[1m%s\033[0m\n", WORD_FILE, comp_file_name); -#endif } - // Start +} + +/** + * PASS 1 + * + * Check for: + * INCLUDE + * UNITS-DIR (#unit-path:) + * IMPORT + * UDF and UDP declarations + * PREDEF OPTIONS + */ +int comp_pass1(const char *section, const char *text) { + memset(comp_bc_sec, 0, SB_KEYWORD_SIZE + 1); + if (section) { + strncpy(comp_bc_sec, section, SB_KEYWORD_SIZE); + } else { + strncpy(comp_bc_sec, SYS_MAIN_SECTION_NAME, SB_KEYWORD_SIZE); + } + + char *code_line = tmp_alloc(SB_SOURCELINE_SIZE + 1); + char *new_text = comp_format_text(text); + + comp_preproc_pass1(new_text); + if (!comp_error) { comp_line = 0; if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (!isatty(STDOUT_FILENO)) { - fprintf(stdout, MSG_PASS1); - } - else { -#endif log_printf(MSG_PASS1_COUNT, comp_line + 1); - -#if defined(_UnixOS) - } -#endif } - ps = p = new_text; + char *ps = new_text; + char *p = ps; while (*p) { if (*p == '\n') { // proceed *p = '\0'; comp_line++; if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (isatty(STDOUT_FILENO)) { -#endif - -#if defined(_PalmOS) - if ((comp_line % 16) == 0) { - if ((comp_line % 64) == 0) - log_printf(MSG_PASS1_COUNT, comp_line); - if (dev_events(0) < 0) { - dev_print("\n\n\a*** interrupted ***\n"); - comp_error = -1; - } - } -#else if ((comp_line % 256) == 0) { log_printf(MSG_PASS1_COUNT, comp_line); } -#endif - -#if defined(_UnixOS) - } -#endif } // add debug info: line-number @@ -4097,9 +4064,9 @@ int comp_pass1(const char *section, const char *text) { tmp_free(code_line); tmp_free(new_text); - // undefined keywords... by default are UDP, but if there is no - // UDP-body then ring the bell + // undefined keywords by default are UDP - error if no UDP-body if (!comp_error) { + int i; for (i = 0; i < comp_udpcount; i++) { if (comp_udptable[i].ip == INVALID_ADDR) { comp_line = comp_udptable[i].pline; @@ -4110,11 +4077,9 @@ int comp_pass1(const char *section, const char *text) { bc_eoc(&comp_prog); bc_resize(&comp_prog, comp_prog.count); - if (!comp_error) { - if (!opt_quiet && !opt_interactive) { - log_printf(MSG_PASS1_FIN, comp_line + 1); - log_printf("\n"); - } + if (!comp_error && !opt_quiet && !opt_interactive) { + log_printf(MSG_PASS1_FIN, comp_line + 1); + log_printf("\n"); } return (comp_error == 0); @@ -4172,16 +4137,7 @@ int comp_pass2_exports() { */ int comp_pass2() { if (!opt_quiet && !opt_interactive) { -#if defined(_UnixOS) - if (!isatty(STDOUT_FILENO)) { - fprintf(stdout, "Pass2...\n"); - } - else { -#endif log_printf(MSG_PASS2); -#if defined(_UnixOS) - } -#endif } if (comp_proc_level) { diff --git a/src/common/tasks.h b/src/common/tasks.h index 3f4254f9..ed7b6d6e 100644 --- a/src/common/tasks.h +++ b/src/common/tasks.h @@ -40,11 +40,10 @@ typedef struct { */ int line; /**< The current source code line */ int error; /**< The last RTL error code (its work as flag) */ - char errmsg[SB_ERRMSG_SIZE + 1];char file[OS_PATHNAME_SIZE + 1]; - /**< The program file name (task name) */ + char errmsg[SB_ERRMSG_SIZE + 1]; + char file[OS_PATHNAME_SIZE + 1]; /**< The program file name (task name) */ mem_t bytecode_h; /**< BC's memory handle */ int bc_type; /**< BC type (1=executable, 2=unit) */ - int has_sysvars; /**< true if the task has system-variables */ /* diff --git a/src/common/units.c b/src/common/units.c index d2d1d6ca..ca5e366b 100644 --- a/src/common/units.c +++ b/src/common/units.c @@ -54,7 +54,6 @@ void unit_mgr_close() { int find_unit_path(const char *name, char *file) { strcpy(file, name); strcat(file, ".bas"); - strlower(file); // find in unitpath if (getenv("UNITPATH")) { @@ -74,7 +73,6 @@ int find_unit_path(const char *name, char *file) { strcpy(file, bas_dir); strcat(file, name); strcat(file, ".bas"); - strlower(file); if (access(file, R_OK) == 0) { return 1; diff --git a/src/languages/keywords.en.c b/src/languages/keywords.en.c index 711ab837..75917b5b 100644 --- a/src/languages/keywords.en.c +++ b/src/languages/keywords.en.c @@ -474,9 +474,9 @@ struct proc_keyword_s proc_table[] = { #define LCN_GRMODE "GRMODE" #define LCN_TEXTMODE "TEXTMODE" #define LCN_CSTR "CSTR" -#define LCN_UNIT_PATH "#UNIT-PATH:" +#define LCN_UNIT_PATH "UNITPATH" #define LCN_COMMAND "COMMAND" -#define LCN_INC "#INC:" +#define LCN_INC "INCLUDE" #define LCN_SUB_WRS "SUB " #define LCN_FUNC_WRS "FUNC " #define LCN_DEF_WRS "DEF " diff --git a/src/languages/messages.en.h b/src/languages/messages.en.h index 8eac5b62..711c94c4 100644 --- a/src/languages/messages.en.h +++ b/src/languages/messages.en.h @@ -97,6 +97,7 @@ #define MSG_MANY_UNIT_DECL "Use 'Unit' keyword only once" #define MSG_INC_MIS_DQ "#INC: Missing \"" #define MSG_INC_FILE_DNE "File %s: File %s does not exist" +#define MSG_INC_FILE_INC "File %s: File cannot include itself" #define MSG_UDP_ALREADY_DECL "SUB/FUNC %s already defined" #define MSG_UDP_MIS_END_2 "File %s: SUB/FUNC: Missing END (possibly in %s)" #define MSG_PASS1 "Pass1...\n" diff --git a/src/platform/unix/Makefile.am b/src/platform/unix/Makefile.am index 27e17b81..74248153 100644 --- a/src/platform/unix/Makefile.am +++ b/src/platform/unix/Makefile.am @@ -43,14 +43,15 @@ endif sbasic_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a TEST_DIR=../../../samples/distro-examples/tests -UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto uds +UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto uds pass1 call_tau test: ${bin_PROGRAMS} @for utest in $(UNIT_TESTS); do \ - ${bin_PROGRAMS} ${TEST_DIR}/$${utest}.bas > test.out; \ + ./${bin_PROGRAMS} ${TEST_DIR}/$${utest}.bas > test.out; \ if cmp -s test.out ${TEST_DIR}/output/$${utest}.out; then \ echo $${utest} ✓; \ else \ - echo $${utest} ✘; \ + echo $${utest} ✘; \ + cat test.out; \ fi ; \ done; From 0808ff21cbc2f8ed720db8b0ad44938987f0501f Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Sun, 10 Aug 2014 08:51:52 +1000 Subject: [PATCH 3/3] COMMON: bump version --- ChangeLog | 7 +++++++ configure.ac | 10 +++++----- ide/android/AndroidManifest.xml | 4 ++-- ide/android/assets/main.bas | 2 +- src/platform/unix/Makefile.am | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76d1a7d5..11710f8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-08-09 + Renamed command "#UNIT-PATH:" to "UNITPATH" + Renamed command "#INC:" to "INCLUDE" + Fixed/implemented INCLUDE command + Refactored comp_pass_1 function is scan.c breaking into + smaller helper functions + 2014-07-07 Update SDL to use SDL2 and common widget diff --git a/configure.ac b/configure.ac index 136bba3f..1e5b22b5 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0 dnl Download the GNU Public License (GPL) from www.gnu.org dnl -AC_INIT([smallbasic], [0.11.11]) +AC_INIT([smallbasic], [0.11.12]) AC_CONFIG_SRCDIR([configure.ac]) AC_CANONICAL_TARGET @@ -88,12 +88,12 @@ function checkDebugMode() { AC_MSG_RESULT([$with_debug]) if test "$with_debug" = "yes" || test "$with_debug" = "full" then - CFLAGS="-g -O0" - CXXFLAGS="-g -O0" + CFLAGS="${CFLAGS} -g -O0" + CXXFLAGS="${CXXFLAGS} -g -O0" AC_DEFINE(_DEBUG, 1, [debugging build enabled]) else - CFLAGS="-O3 -Os" - CXXFLAGS="-O3 -Os" + CFLAGS="${CFLAGS} -O3 -Os" + CXXFLAGS="${CXXFLAGS} -O3 -Os" fi AC_SUBST(CFLAGS) } diff --git a/ide/android/AndroidManifest.xml b/ide/android/AndroidManifest.xml index 2ecb8261..2a7d25e5 100644 --- a/ide/android/AndroidManifest.xml +++ b/ide/android/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="14" + android:versionName="0.11.12"> diff --git a/ide/android/assets/main.bas b/ide/android/assets/main.bas index 952787a7..d7b17a69 100644 --- a/ide/android/assets/main.bas +++ b/ide/android/assets/main.bas @@ -30,7 +30,7 @@ sub about() print "(_ ._ _ _.|||_) /\ (_ |/ " print "__)| | |(_||||_)/--\__)|\_" print - print "Version 0.11.11" + print "Version 0.11.12" print print "Copyright (c) 2002-2014 Chris Warren-Smith" print "Copyright (c) 2000-2006 Nic Christopoulos" + chr(10) diff --git a/src/platform/unix/Makefile.am b/src/platform/unix/Makefile.am index 74248153..e1addd05 100644 --- a/src/platform/unix/Makefile.am +++ b/src/platform/unix/Makefile.am @@ -52,6 +52,6 @@ test: ${bin_PROGRAMS} echo $${utest} ✓; \ else \ echo $${utest} ✘; \ - cat test.out; \ + cat test.out; \ fi ; \ done;