Skip to content
Merged

12 20 #108

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
93718df
COMMON: bump version. allow c-lib to be called from unit
chrisw-s Oct 21, 2020
f272046
COMMON: allow c-lib to be called from unit
chrisw-s Oct 22, 2020
7540836
ANDROID: upgrade to target android 29
chrisws Oct 25, 2020
4bf3767
ANDROID: upgrade to target android 29
chrisws Oct 25, 2020
1d77de0
ANDROID: upgrade to target android 29
chrisws Oct 25, 2020
83fa4c8
COMMON: add support for inline assignment of export variables
chrisw-s Oct 26, 2020
1d2ca74
COMMON: add support for unit alias names
chrisw-s Oct 27, 2020
ba82d39
COMMON: Implemented c-styles escape sequences
chrisw-s Oct 29, 2020
8cebc82
SDL: implemented restoring the cursor position
chrisw-s Oct 31, 2020
b85fd37
CONSOLE: give error when file not found
chrisw-s Nov 1, 2020
41365c6
COMMON: minor fixes for windows build
chrisw-s Nov 7, 2020
ed220db
ANDROID: change path label when displaying project folder
chrisws Nov 10, 2020
d0ad15c
COMMON: ensure INT datatype is always 64 bits
chrisw-s Nov 10, 2020
ae64913
CONSOLE: fix invoking a sbx file
chrisw-s Nov 11, 2020
99a5274
MODULES: avoid loading support DLLs
chrisw-s Nov 12, 2020
02eba13
ANDROID: add option to preserve user data when app uninstalled
chrisws Nov 13, 2020
52d301e
COMMON: update c-module err on win32
chrisw-s Nov 13, 2020
1712404
Merge branch '12_20' of github.com:chrisws/SmallBASIC into 12_20
chrisw-s Nov 13, 2020
dc8386c
COMMON: Fix to allow multiple modules and units within saem program
chrisw-s Nov 19, 2020
e50faed
COMMON: defer call to module init function
chrisw-s Nov 30, 2020
8a258fe
COMMON: update module error messages
chrisw-s Dec 1, 2020
eee5e3f
COMMON: added id field to V_MAP and V_FUNC
chrisw-s Dec 13, 2020
5a7e8a3
COMMON: fix audio regression
chrisw-s Dec 16, 2020
9d8d92c
SDL: Update editor popup appearance
chrisw-s Dec 19, 2020
2233074
SDL: Update editor popup appearance
chrisw-s Dec 19, 2020
570abdb
SDL: Update editor popup appearance
chrisw-s Dec 19, 2020
fc4acd6
SDL: Update editor popup appearance
chrisw-s Dec 20, 2020
0e56054
SDL: Update editor popup appearance
chrisw-s Dec 20, 2020
a9fccd6
SDL: increase debug launch pause time
chrisw-s Dec 21, 2020
aa88e5c
ANDROID: show input pick when samsung keyboard detected #106
chrisws Dec 21, 2020
c0f228f
ANDROID: fix module regression
chrisws Dec 21, 2020
022de50
ANDROID: update tools, fix maxint
chrisws Dec 21, 2020
08586e5
UI: fix TextEditInput use as form widget
chrisw-s Dec 22, 2020
ea60f5d
CONSOLE: console DELAY now does event processing
chrisw-s Dec 25, 2020
7e0c8d5
CONSOLE: console DELAY now does event processing
chrisw-s Dec 26, 2020
550f55b
UI: fix textwidget layout handling
chrisw-s Dec 28, 2020
a921b29
FLTK: add missing file
chrisws Dec 29, 2020
8c27521
WEB: updated for libmicrohttpd-0.9.72
chrisw-s Dec 29, 2020
1c7b13e
UI: help popup display issue
chrisw-s Jan 1, 2021
3eaf4fc
CONSOLE: fix module command option
chrisw-s Jan 2, 2021
eb1b92e
COMMON: fix debug module build
chrisw-s Jan 2, 2021
5ae7b9d
SDL: fix error display regression
chrisw-s Jan 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
2020-12-19 (12.20)
SDL: Update editor popup appearance

2020-11-19 (12.20)
COMMON: Fix to allow multiple modules and units within saem program

2020-11-13 (12.20)
ANDROID: add option to preserve user data when app uninstalled

2020-11-10 (12.20)
ANDROID: change path label when displaying project folder
COMMON: ensure INT datatype is always 64 bits

2020-11-01 (12.20)
CONSOLE: give error when file not found

2020-10-31 (12.20)
SDL: implemented restoring the cursor position

2020-10-29 (12.20)
COMMON: Implemented c-styles escape sequences

2020-10-27 (12.20)
COMMON: add support for inline assignment of export variables
COMMON: add support for unit alias names

2020-10-21 (12.20)
ANDROID: upgrade to target android 29

2020-10-21 (12.20)
COMMON: Fix to allow c-modules to be called from units

2020-07-16 (12.19)
COMMON: Fix 'Print #' on Windows to use Windows line endings

Expand Down
5 changes: 3 additions & 2 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# This file is part of SmallBASIC
#
# Copyright(C) 2001-2015 Chris Warren-Smith.
# Copyright(C) 2001-2020 Chris Warren-Smith.
#
# This program is distributed under the terms of the GPL v2.0 or later
# Download the GNU Public License (GPL) from www.gnu.org
#

ln -sf README.md README

git submodule update --
git submodule init
git submodule update

pkg-config --version > /dev/null || echo "Please install pkg-config"

Expand Down
11 changes: 2 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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], [12.19])
AC_INIT([smallbasic], [12.20])
AC_CONFIG_SRCDIR([configure.ac])

AC_CANONICAL_TARGET
Expand Down Expand Up @@ -59,8 +59,6 @@ function checkForWindows() {
*darwin*)
;;
*)
dnl backlinking support for modules
LDFLAGS="${LDFLAGS} -export-dynamic"
esac
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
}
Expand Down Expand Up @@ -219,7 +217,6 @@ function buildSDL() {
AC_DEFINE(_SDL, 1, [Defined when building SDL version])
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])

BUILD_SUBDIRS="src/common src/platform/sdl"
Expand All @@ -235,7 +232,6 @@ function buildAndroid() {
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
AC_DEFINE(_ANDROID, 1, [Defined for Android build.])
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])

BUILD_SUBDIRS="src/platform/android"
Expand All @@ -260,7 +256,6 @@ function buildConsole() {
)

AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, test $win32 = yes)
AC_DEFINE(BUILD_CONSOLE, 1, [Building a console based system.])

if test $win32 = yes; then
dnl test whether to build using mingw
Expand All @@ -287,7 +282,7 @@ function buildConsole() {
TARGET="Building Cygwin MinGW console version."
AC_DEFINE(__MINGW32__, 1, [as above])
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
PACKAGE_LIBS="${PACKAGE_LIBS} -Wl,-Bstatic -mconsole -lmingw32 -lwsock32 -lws2_32 -static-libgcc"
PACKAGE_LIBS="${PACKAGE_LIBS} -Wl,-Bstatic -mconsole -lwsock32 -lws2_32 -static-libgcc"
BUILD_SUBDIRS="src/common src/platform/console"
fi
AC_DEFINE(_Win32, 1, [Windows build])
Expand Down Expand Up @@ -320,7 +315,6 @@ function buildWeb() {
BUILD_SUBDIRS="src/common src/platform/web"
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
AC_DEFINE(USE_TERM_IO, 0, [dont use the termios library.])
AC_DEFINE(IMPL_DEV_ENV, 1, [Driver implements dev_env funcs])
Expand Down Expand Up @@ -374,7 +368,6 @@ function buildFLTK() {
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
AC_DEFINE(_FLTK, 1, [Defined for FLTK build.])
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])

BUILD_SUBDIRS="src/common src/platform/fltk"
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
smallbasic (12.20) unstable; urgency=low
* Various see web site

-- Chris Warren-Smith <[email protected]> Fri, 16 Oct 2020 09:45:25 +1000

smallbasic (0.12.19) unstable; urgency=low
* Various see web site

Expand Down
29 changes: 18 additions & 11 deletions samples/distro-examples/tests/call_tau.bas
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
' example: using a unit, 0.9
'

Import Tau, PreDef
Import Tau as taz, PreDef

? "Tau's exported variable: ", tau.expvar
? "Function fooF : ", tau.fooF("Hi")
? "Tau's exported variable: ", taz.expvar
? "Function fooF : ", taz.fooF("Hi")
? "Procedure fooP : "
tau.fooP "Hi"
taz.fooP "Hi"

' reverse var-update
tau.expvar = "message from main"
tau.print_expvar
? tau.expvar
tau.build_ta
? tau.ta
taz.expvar = "message from main"
taz.print_expvar
? taz.expvar
taz.build_ta
? taz.ta
'tau.cerr

rem check system-variables
Expand All @@ -31,12 +31,19 @@ foyer.name= "my name is PI"
? "end"

for i = 0 to 1000
tau.addRoom(foyer,x)
jj = tau.calcRoomSize(foyer,x)
taz.addRoom(foyer,x)
jj = taz.calcRoomSize(foyer,x)
next i

sub addRoom(the_thing, d)
print the_thing.name, d
end

addRoom(foyer,x)

if (Taz.LIGHTGRAY != rgb(200, 200, 200)) then
print "Error importing inline assigned export variable"
endif
if (Taz.YELLOW != rgb(253, 249, 0)) then
print "Error importing inline assigned export variable"
endif
11 changes: 10 additions & 1 deletion samples/distro-examples/tests/strings.bas
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ if expect != seq(0, 2*pi, 360/15+1) then throw "SEQ error"
s="Hello\033There"
if (27 != asc(mid(s, 6, 1))) then throw "err"
rem Non escaping '\' should appear verbatim
s= "a\c\e"
s= "a\\c\\e"
if mid(s, 2, 1) != "\\" then throw s
if mid(s, 4, 1) != "\\" then throw s

Expand All @@ -189,3 +189,12 @@ for c in s1
next c
if (s1 <> s2) then throw s2

if (asc("\a") != 7) then throw "err1"
if (asc("\b") != 8) then throw "err2"
if (asc("\e") != 27) then throw "err3"
if (asc("\f") != 12) then throw "err4"
if (asc("\n") != 10) then throw "err5"
if (asc("\r") != 13) then throw "err6"
if (asc("\t") != 9) then throw "err7"
if (asc("\v") != 11) then throw "err8"

6 changes: 5 additions & 1 deletion samples/distro-examples/tests/tau.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ Import TauChild

Export expvar, foof, foop
export addRoom,calcRoomSize
export print_expvar, ta, build_ta, cerr
export print_expvar, ta, build_ta, cerr

expvar = "Tau's exported variable"

export const LIGHTGRAY = rgb(200, 200, 200)
export const GRAY = rgb(130, 130, 130)
export const DARKGRAY = rgb(80, 80, 80), const YELLOW = rgb(253, 249, 0)

func fooF(x)
foof = "Tau's fooF("+x+") is here"
end
Expand Down
63 changes: 45 additions & 18 deletions src/common/bc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,36 @@

#include "common/bc.h"
#include "common/smbas.h"
#include "common/str.h"

/*
* string escape codes
*/
const char escapes[][2] = {
{'a', 0x07},
{'b', 0x08},
{'e', 0x1b},
{'f', 0x0c},
{'n', 0x0a},
{'r', 0x0d},
{'t', 0x09},
{'v', 0x0b},
};

/*
* whether the character is an escape
*/
int bc_is_escape(char c, char *value) {
int len = sizeof(escapes) / sizeof(escapes[0]);
int result = 0;
for (int i = 0; i < len && !result; i++) {
if (escapes[i][0] == c) {
*value = escapes[i][1];
result = 1;
}
}
return result;
}

/*
* Create a bytecode segment
Expand Down Expand Up @@ -182,23 +212,18 @@ void bc_add_strn(bc_t *bc, const char *str, int len) {
* returns a pointer of src to the next "element"
*/
char *bc_store_string(bc_t *bc, char *src) {
char *p = src;
char *np = NULL;
// skip past opening quotes
char *p = src + 1;
char *base = src + 1;
int len = 0;
char escape = 0;
cstr cs;
cstr_init(&cs, 5);

// skip past opening quotes
p++;
while (*p) {
if ((*p == '\\' && ((*(p + 1) == '\"') || *(p + 1) == '\\'))
|| *p == V_JOIN_LINE) {
// escaped quote " or escaped escape
int seglen = p - base;
np = np ? realloc(np, len + seglen + 1) : malloc(seglen + 1);
strncpy(np + len, base, seglen);
// add next segment
len += seglen;
np[len] = 0;
cstr_append_i(&cs, base, p - base);

if (*p == V_JOIN_LINE) {
// skip null newline
Expand All @@ -211,6 +236,11 @@ char *bc_store_string(bc_t *bc, char *src) {

// include " (or \ ) in next segment
base = ++p;
} else if (*p == '\\' && bc_is_escape(*(p + 1), &escape)) {
char code[] = {escape, '\0'};
cstr_append_i(&cs, base, p - base);
cstr_append_i(&cs, code, 1);
base = (++p) + 1;
} else if (*p == V_QUOTE) {
// revert hidden quote
*p = '\"';
Expand All @@ -220,17 +250,14 @@ char *bc_store_string(bc_t *bc, char *src) {
*p = '\n';
} else if (*p == '\"') {
// end of string detected
int seglen = p - base;
np = np ? realloc(np, len + seglen + 1) : malloc(seglen + 1);
memcpy(np + len, base, seglen);
bc_add_strn(bc, np, len + seglen);
free(np);
cstr_append_i(&cs, base, p - base);
bc_add_strn(bc, cs.buf, cs.length);
p++;
return p;
break;
}
p++;
}
free(np);
free(cs.buf);
return p;
}

Expand Down
Loading