Skip to content

Commit

Permalink
Merge pull request #86 from chrisws/0_12_17
Browse files Browse the repository at this point in the history
0 12 17
  • Loading branch information
chrisws authored Dec 22, 2019
2 parents 8db539b + efe04d2 commit a6db1a0
Show file tree
Hide file tree
Showing 74 changed files with 901 additions and 10,351 deletions.
13 changes: 13 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[submodule "src/lib/miniaudio"]
path = src/lib/miniaudio
url = https://github.com/dr-soft/miniaudio.git
[submodule "src/lib/stb"]
path = src/lib/stb
url = https://github.com/nothings/stb.git
[submodule "src/lib/lodepng"]
path = src/lib/lodepng
url = https://github.com/lvandeve/lodepng.git
ignore = untracked
[submodule "src/lib/jsmn"]
path = src/lib/jsmn
url = https://github.com/zserge/jsmn.git
27 changes: 26 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
2019-08-23 (0.12.15)
2019-12-21 (0.12.17)
SDL: fix issue #81 - numlock handling

2019-12-15 (0.12.17)
FLTK: add online samples command
FLTK: fix tab resizing

2019-12-07 (0.12.17)
FLTK: fix memory leaks
FLTK: implement audio
UI: add menu control key indicators

2019-11-30 (0.12.17)
ANDROID: fix module access in newer android versions.
UI: code cleanup

2019-11-30 (0.12.17)
FLTK: fix color display
FLTK: add clear console command
COMMON: fix dirwalk error handling

2019-11-23 (0.12.17)
COMMON: Fix select case by func. Closes #83
COMMON: update dependencies

2019-08-23 (0.12.16)
ANDROID: fix ChromeOS crash when restarting over existing instance

2019-08-19 (0.12.15)
Expand Down
10 changes: 10 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ covcheck-android:

clangcheck:
(make clean -s && \
scan-build ./configure && \
scan-build -o scan make -s)

clangcheck-fltk:
(make clean -s && \
scan-build ./configure --enable-fltk && \
scan-build -o scan make -s)

clangcheck-sdl:
(make clean -s && \
scan-build ./configure --enable-sdl && \
scan-build -o scan make -s)

Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
For news please visit smallbasic.sourceforge.net
For news please visit https://smallbasic.github.io
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, sound, and graphic commands along with structured programming syntax

### Initialise dependencies

```
$ git submodule update --init
```

## Building the SDL version

Initial setup on linux
Expand Down
2 changes: 2 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

ln -sf README.md README

git submodule update --

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

rm -f acinclude.m4
Expand Down
6 changes: 4 additions & 2 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], [0.12.16])
AC_INIT([smallbasic], [0.12.17])
AC_CONFIG_SRCDIR([configure.ac])

AC_CANONICAL_TARGET
Expand Down Expand Up @@ -285,7 +285,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} -mconsole -lmingw32 -lwsock32 -lws2_32 -static-libgcc"
PACKAGE_LIBS="${PACKAGE_LIBS} -Wl,-Bstatic -mconsole -lmingw32 -lwsock32 -lws2_32 -static-libgcc"
BUILD_SUBDIRS="src/common src/platform/console"
fi
AC_DEFINE(_Win32, 1, [Windows build])
Expand Down Expand Up @@ -352,6 +352,8 @@ function buildFLTK() {
FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -mms-bitfields"
PACKAGE_LIBS="-Wl,-Bstatic ${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
AC_DEFINE(_Win32, 1, [Windows build])
AC_DEFINE(_USE_MATH_DEFINES, 1, [for M_PI in math.h])
AC_DEFINE(realpath(F, R), _fullpath(R, F, PATH_MAX), [add missing realpath for system.cpp])
;;

*darwin*)
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 (0.12.17) unstable; urgency=low
* Various see web site

-- Chris Warren-Smith <[email protected]> Sat, 09 Nov 2019 09:45:25 +1000

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

Expand Down
18 changes: 2 additions & 16 deletions samples/distro-examples/tests/output/trycatch.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,5 @@ open failed FS(2): NO SUCH FILE OR DIRECTORY
after try
catch by error name
outer after try


* RTE-ERROR AT ../../../samples/distro-examples/tests/trycatch.bas:200 *
Description:
Division by zero

Stack:
TRY: 199
TRY: 198
TRY: 197
TRY: 196
TRY: 195
IF: 194
IF: 193
IF: 192
SUB: 216
Error: Division by zero
End of test
25 changes: 23 additions & 2 deletions samples/distro-examples/tests/trycatch.bas
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ if 1 == 1 then
fi
end

stack_test
try
stack_test
catch e
print "Error: " + e
end try

sub manageFiles()
sub renameFile()
Expand All @@ -229,7 +233,6 @@ sub manageFiles()
viewFile()
end

try
try
throw "!!!error!!!"
Expand All @@ -244,3 +247,21 @@ if (inner == "!!!error!!!") then
throw "inner still in scope"
endif

rem test for select case <udf>
func num(n)
return n
end
select case num(10)
case 10
rem success!
case else
throw "fail"
end select
select case round(pi)
case 3
rem "success!"
case else
throw "fail"
end select

print "End of test"
2 changes: 0 additions & 2 deletions src/common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ noinst_LIBRARIES = libsb_common.a

libsb_common_a_SOURCES = \
../lib/match.c ../lib/match.h \
../lib/jsmn.c ../lib/jsmn.h \
../lib/lodepng.c ../lib/lodepng.h \
../lib/str.c ../lib/str.h \
../lib/matrix.c \
../lib/xpm.c \
Expand Down
16 changes: 4 additions & 12 deletions src/common/blib.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,9 @@ uint8_t get_dimensions(int32_t **lbound, int32_t **ubound) {
* DIM var([lower TO] uppper [, ...])
*/
void cmd_dim(int preserve) {
int exitf = 0;

do {
byte code = code_peek();
if (code == kwTYPE_LINE || code == kwTYPE_EOC) {
exitf = 1;
break;
}
if (code_peek() == kwTYPE_SEP) {
Expand Down Expand Up @@ -227,7 +224,7 @@ void cmd_dim(int preserve) {
}
free(lbound);
free(ubound);
} while (!exitf && !prog_error);
} while (!prog_error);
}

/**
Expand Down Expand Up @@ -487,8 +484,6 @@ void cmd_erase() {
if (prog_error) {
break;
}
byte code = code_peek();

if (code_isvar()) {
var_p = code_getvarptr();
} else {
Expand All @@ -504,7 +499,7 @@ void cmd_erase() {
}

// next
code = code_peek();
byte code = code_peek();
if (code == kwTYPE_SEP) {
par_getcomma();
} else {
Expand All @@ -518,7 +513,6 @@ void cmd_erase() {
*/
void cmd_print(int output) {
byte last_op = 0;
byte exitf = 0;
byte use_format = 0;
intptr_t handle = 0;
var_t var;
Expand Down Expand Up @@ -603,7 +597,7 @@ void cmd_print(int output) {
}

// PRINT
do {
while (!prog_error) {
code = code_peek();
if (code == kwTYPE_SEP) {
code_skipnext();
Expand All @@ -615,7 +609,6 @@ void cmd_print(int output) {
}
} else {
if (kw_check_evexit(code) || code == kwTYPE_LEVEL_END) {
exitf = 1;
break;
}

Expand Down Expand Up @@ -643,11 +636,10 @@ void cmd_print(int output) {
}
v_free(&var);
};

if (prog_error) {
return;
}
} while (exitf == 0);
};

if (last_op == 0) {
pv_write("\n", output, handle);
Expand Down
17 changes: 12 additions & 5 deletions src/common/blib_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,14 +806,17 @@ void dirwalk(char *dir, char *wc, bcip_t use_ip, int depth) {
join_path(path, ++dir);
dir = path;
} else if (dir[0] == '~') {
strlcpy(path, getenv("HOME"), sizeof(path));
join_path(path, ++dir);
dir = path;
const char *home = getenv("HOME");
if (home != NULL) {
strlcpy(path, home, sizeof(path));
join_path(path, ++dir);
dir = path;
}
}

DIR *dfd = opendir(dir);
if (dfd == NULL) {
log_printf("DIRWALK: can't open %s", dir);
log_printf(ERR_DIRWALK_CANT_OPEN, dir);
return;
}

Expand All @@ -827,14 +830,18 @@ void dirwalk(char *dir, char *wc, bcip_t use_ip, int depth) {
continue;
}
if (strlen(dir) + strlen(dp->d_name) + 2 > OS_PATHNAME_SIZE) {
rt_raise("DIRWALK: name %s/%s too long", dir, dp->d_name);
rt_raise(ERR_DIRWALK_NAME, dir, dp->d_name);
} else {
// check filename
int callusr;
int contf = 1;
struct stat st;

if (!wc) {
if (code_peek() == kwTYPE_EOC) {
rt_raise(ERR_DIRWALK_MISSING_USE);
break;
}
callusr = 1;
} else {
callusr = wc_match(wc, dp->d_name);
Expand Down
4 changes: 3 additions & 1 deletion src/common/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
//
// Copyright(C) 2000 Nicholas Christopoulos

#include "config.h"

#include "include/osd.h"
#include "common/device.h"
#include "common/smbas.h"
#include "common/messages.h"
#include "common/keymap.h"
#include "common/osd.h"
#include "common/inet.h"

#ifdef __MINGW32__
Expand Down
12 changes: 6 additions & 6 deletions src/common/extlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ typedef struct {
} slib_t;

static slib_t slib_table[MAX_SLIBS];
static int slib_count;
static int extprocsize;
static int extproccount;
static int extfuncsize;
static int extfunccount;
static uint32_t slib_count;
static uint32_t extprocsize;
static uint32_t extproccount;
static uint32_t extfuncsize;
static uint32_t extfunccount;
static ext_func_node_t *extfunctable;
static ext_proc_node_t *extproctable;

Expand Down Expand Up @@ -159,7 +159,7 @@ int slib_add_external_proc(const char *proc_name, int lib_id) {
/**
* Add an external function to the list
*/
int slib_add_external_func(const char *func_name, int lib_id) {
int slib_add_external_func(const char *func_name, uint32_t lib_id) {
// scan for conflicts
for (int i = 0; i < extfunccount; i++) {
if (strcmp(extfunctable[i].name, func_name) == 0) {
Expand Down
Loading

0 comments on commit a6db1a0

Please sign in to comment.