Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
df9783b
COMMON: bump version
chrisws Sep 15, 2018
6a50542
COMMON: fix crash when attempting to load an image from a failed netw…
chrisws Sep 15, 2018
c1bba73
ANDROID: update for latest tool refresh
chrisws Sep 27, 2018
5433b73
COMMON: fix some intellij inspections
chrisws Sep 28, 2018
110b5fd
COMMON: fix error message when command LINE INPUT attempts to read a …
chrisws Sep 28, 2018
459686b
COMMON: added console build check for endianness
chrisws Sep 30, 2018
9701c2e
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Sep 30, 2018
3aaab31
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Sep 30, 2018
f6bcf10
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Oct 5, 2018
1c38fc3
Fix FUNC RETURN statement on linuxone
chrisws Oct 5, 2018
bf1a507
ANDROID: remove incorrect CPU_BIGENDIAN define
chrisws Oct 5, 2018
fc10ac3
COMMON: make all test portable
chrisws Oct 5, 2018
1e3f497
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Oct 6, 2018
97c33ba
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Oct 7, 2018
49b3f6a
COMMON: fix crash when passing zero as format argument to DATEFMT
chrisws Oct 8, 2018
69a0a04
COMMON: fix about page logo
chrisws Oct 13, 2018
aca49b3
COMMON: fix about page logo
chrisws Oct 13, 2018
cb4a0a4
ANDROID: bump version
chrisws Oct 13, 2018
964b0d9
COMMON: fix iOS compile error
chrisws Oct 16, 2018
60776ec
UI: changed display of BLACK to be a slightly ligher onyx colour.
chrisws Oct 20, 2018
f5f4773
COMMON: fix backslash escape regression
chrisws Oct 20, 2018
3a59e22
COMMON: fix backslash escape regression
chrisws Oct 20, 2018
f3ea970
UI: set widget default colours from output
chrisws Oct 24, 2018
b5b794b
UI: fix colour handling
chrisws Oct 27, 2018
bcdfc01
COMMON: fix broken implementation to avoid appending multiple kwTYPE_…
chrisws Oct 31, 2018
c6c50f7
bump lodepng version
chrisws Nov 10, 2018
7d70a9b
CONSOLE: added support for IMAGE command
chrisws Nov 10, 2018
edc0e7f
CONSOLE: added support for IMAGE command
chrisws Nov 10, 2018
2d2716a
CONSOLE: added support for IMAGE command
chrisws Nov 11, 2018
0bf5c92
CONSOLE: added support for IMAGE command
chrisws Nov 11, 2018
8c314f5
Fix Win32 build
chrisws Nov 17, 2018
b423a4e
Fix Win32 build
chrisws Nov 19, 2018
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
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2018-11-11 (0.12.14)
CONSOLE: added support for IMAGE command

2018-10-20 (0.12.14)
UI: fix navigation when network access down then available
UI: changed display of "BLACK" to be a slightly ligher onyx colour.
ANDROID: update help tip in scratch window

2018-10-13 (0.12.14)
COMMON: fix about page logo

2018-10-09 (0.12.14)
COMMON: fix crash when passing zero as format argument to DATEFMT

2018-09-30 (0.12.14)
COMMON: fix broken implementation to avoid appending multiple kwTYPE_EOCs (or kwTYPE_LINE)

2018-09-23 (0.12.14)
COMMON: fix error message when command "LINE INPUT" attempts to read a non open file

2018-09-23 (0.12.14)
COMMON: fix crash when attempting to load an image from a failed network connection

2018-08-08 (0.12.13)
SDL: fix incorrect file loading with ALT+1-9 command

Expand Down
14 changes: 12 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.13])
AC_INIT([smallbasic], [0.12.14])
AC_CONFIG_SRCDIR([configure.ac])

AC_CANONICAL_TARGET
Expand Down Expand Up @@ -161,6 +161,9 @@ function buildSDL() {
dnl avoid using MSCRT versions of printf for long double
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -D__USE_MINGW_ANSI_STDIO"

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])

dnl do not depend on cygwin.dll under cygwin build
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -mms-bitfields"
PACKAGE_LIBS="${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
Expand Down Expand Up @@ -198,6 +201,7 @@ function buildSDL() {
esac

PACKAGE_CFLAGS="${PACKAGE_CFLAGS} `sdl2-config --cflags` `freetype-config --cflags` -fno-exceptions"
CXXFLAGS="${CXXFLAGS} -fno-rtti -std=c++11"

dnl preconfigured values for SDL build
AC_DEFINE(_SDL, 1, [Defined when building SDL version])
Expand All @@ -223,7 +227,6 @@ function buildAndroid() {
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()])
AC_DEFINE(CPU_BIGENDIAN, 1, [Android uses big-endian])

BUILD_SUBDIRS="src/platform/android"
AC_SUBST(BUILD_SUBDIRS)
Expand All @@ -241,6 +244,13 @@ function buildConsole() {
win32="yes"
esac

AC_C_BIGENDIAN(
AC_DEFINE(CPU_BIGENDIAN, 1, [machine is big-endian]),
AC_DEFINE(CPU_LITTLE_ENDIAN, 1, [machine is little-endian]),
AC_MSG_ERROR(unknown endianess),
AC_MSG_ERROR(universial endianess not supported)
)

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

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.14) unstable; urgency=low
* Various see web site

-- Chris Warren-Smith <cwarrensmith@gmail.com> Sat, 15 Sept 2018 09:45:25 +1000

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

Expand Down
3 changes: 1 addition & 2 deletions samples/distro-examples/tests/all.bas
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ print "CREAL:" + CREAL (x)
print "CSC:" + CSC (x)
print "CSCH:" + CSCH (x)
print "DATE:"' + DATE
print "DATEFMT:" + DATEFMT("ddmmyy", 12345) + " " + DATEFMT("yyymmdd", d,m,y)
print "DATEFMT:" + DATEFMT("ddmmyy", 12345) + " " + DATEFMT("yyymmdd", d,m,y): xx=datefmt(0,date)
print "DEFINEKEY:"' + DEFINEKEY k,sub
print "DEG:" + DEG (x)
print "DETERM:"' + DETERM (A, 1)
print "DISCLOSE:" + DISCLOSE("{debraceme}", "{}")
print "ENCLOSE:" + ENCLOSE ("braceme", "{}")
print "ENV:" + ENV("DISPLAY")
print "EOF:"' + EOF (fileN)
print "EXIST:"' + EXIST (file)
print "EXP:" + EXP (x)
Expand Down
15 changes: 12 additions & 3 deletions samples/distro-examples/tests/ongoto.bas
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
rem test "OUT OF ADDRESS SPACE" error with incorrect kw optimisation
goto 50
a=b
50 a=b

rem a terrible alternative to select/case
a = 1
100
ON a GOTO 110,120,130
110 a = 2:GOTO 100
120 a = 3:GOTO 100
130

for i=0 to 5
on i gosub 10,20, 30 , 40
Expand All @@ -12,6 +24,3 @@ return
return
40 ? "40"
return



3 changes: 1 addition & 2 deletions samples/distro-examples/tests/output/all.out
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ DEG:704.73808801091252
DETERM:
DISCLOSE:debraceme
ENCLOSE:{braceme}
ENV::0.0
EOF:
EXIST:
EXP:219695.98867213790072
Expand Down Expand Up @@ -172,7 +171,7 @@ POINT:0
POLYAREA:0
POLYCENT:
POW:12.3
PROGLINE:190
PROGLINE:189
PTDISTLN:0
PTDISTSEG:0
PTSIGN:0
Expand Down
1 change: 1 addition & 0 deletions samples/distro-examples/tests/output/uds.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ a.xfish.small=small
a.xfish.big=big
3
2
10
5 changes: 5 additions & 0 deletions samples/distro-examples/tests/strings.bas
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,8 @@ 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"
if mid(s, 2, 1) != "\\" then throw s
if mid(s, 4, 1) != "\\" then throw s

25 changes: 24 additions & 1 deletion samples/distro-examples/tests/uds.bas
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,27 @@ rem fill the var cache for testing in valgrind
cache = {}
for i = 0 to 8096
cache[i] = "."
next i
next i

'
' regression modifying kwTYPE_EOC
'
func GridClass()
sub setCellValue(a)
? a
end
local result = {}
result.setCellValue = @setCellValue
return result
end
func Game()
sub start()
self.grid.setCellValue(10)
end
local result = {}
result.grid = GridClass()
result.start = @start
return result
end
g = Game()
g.start()
1 change: 1 addition & 0 deletions samples/distro-examples/tests/unx_benchmarks.bas
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'

st=ticks
tickspersec=1000
for i=1 to 1000000:next
et=ticks
? "FOR speed: "; ((et-st)/tickspersec); "sec "; round(1000000/((et-st)/tickspersec));" l/s"
Expand Down
35 changes: 22 additions & 13 deletions src/common/bc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

#include "common/bc.h"
#include "common/smbas.h"
#if defined(_UnixOS)
#include <assert.h>
#endif

/*
* Create a bytecode segment
Expand All @@ -21,6 +18,8 @@ void bc_create(bc_t *bc) {
bc->size = BC_ALLOC_INCR;
bc->count = 0;
bc->cp = 0;
bc->eoc_position = 0;
bc->line_position = 0;
}

/*
Expand All @@ -32,6 +31,8 @@ void bc_destroy(bc_t *bc) {
bc->size = 0;
bc->count = 0;
bc->cp = 0;
bc->eoc_position = 0;
bc->line_position = 0;
}

/*
Expand All @@ -50,21 +51,14 @@ void bc_resize(bc_t *bc, uint32_t new_size) {
/*
* add one command
*/
void bc_add1(bc_t *bc, byte code) {
void bc_add1(bc_t *bc, char code) {
if (bc->count + sizeof(byte) >= bc->size) {
bc_resize(bc, bc->size + BC_ALLOC_INCR);
}
bc->ptr[bc->count] = code;
bc->count++;
}

/*
* change one command
*/
void bc_store1(bc_t *bc, bcip_t offset, byte code) {
bc->ptr[offset] = code;
}

/*
* add one uint32_t
*/
Expand Down Expand Up @@ -245,12 +239,27 @@ char *bc_store_string(bc_t *bc, char *src) {
*/
void bc_eoc(bc_t *bc) {
if (bc && bc->count &&
(bc->ptr[bc->count - 1] != kwTYPE_LINE &&
bc->ptr[bc->count - 1] != kwTYPE_EOC)) {
(bc->eoc_position == 0 || bc->eoc_position != bc->count - 1)) {
// avoid appending multiple kwTYPE_EOCs (or kwTYPE_LINE)
bc->eoc_position = bc->count;
bc_add1(bc, kwTYPE_EOC);
}
}

/*
* pops any EOC mark at the current position
*/
int bc_pop_eoc(bc_t *bc) {
int result;
if (bc->eoc_position > 0 && bc->eoc_position == bc->count - 1) {
bc->eoc_position = 0;
result = (bc->ptr[--bc->count] == kwTYPE_EOC);
} else {
result = 0;
}
return result;
}

/*
* appends the src to dst
*/
Expand Down
24 changes: 13 additions & 11 deletions src/common/bc.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ typedef struct {
bcip_t cp; /**< current position (used by readers not writers) */
bcip_t size; /**< allocation size (optimization) */
bcip_t count; /**< current size (used by writers as the current position) */
bcip_t eoc_position; /**< position of most recent kwTYPE_EOC or kwTYPE_LINE*/
bcip_t line_position; /**< position of most recent kwTYPE_LINE */
} bc_t;

/**
Expand Down Expand Up @@ -77,17 +79,7 @@ void bc_resize(bc_t *bc, uint32_t newsize);
* @param bc the bc structure
* @param code the byte
*/
void bc_add1(bc_t *bc, byte code);

/**
* @ingroup scan
*
* put 1 byte to specified offset
*
* @param bc the bc structure
* @param code the byte
*/
void bc_store1(bc_t *bc, bcip_t offset, byte code);
void bc_add1(bc_t *bc, char code);

/**
* @ingroup scan
Expand Down Expand Up @@ -126,6 +118,16 @@ char *bc_store_string(bc_t *bc, char *src);
*/
void bc_eoc(bc_t *bc);

/**
* @ingroup scan
*
* pops any EOC mark at the current position
*
* @param bc the bc segment
* @return whether kwTYPE_EOC was popped
*/
int bc_pop_eoc(bc_t *bc);

/**
* @ingroup scan
*
Expand Down
Loading