Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
2014-09-28
Refactor image handling to use system object

2014-09-22
Implemented ARRAY command to read JSON into a map variable

2014-09-19
Fix STR(v) support for map variables

2014-09-12
Add support for unary operators on array elements
Fix printing UDS vars

2014-09-08
Fix call FUNC with (arg1), (arg2)
Fix INKEY Backspace in FLTK
Fix FOR/NEXT using float increments

2014-09-06
RTE command renamed THROW

Expand Down
3 changes: 2 additions & 1 deletion 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.11.15])
AC_INIT([smallbasic], [0.11.16])
AC_CONFIG_SRCDIR([configure.ac])

AC_CANONICAL_TARGET
Expand Down Expand Up @@ -226,6 +226,7 @@ function buildSDL() {
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
AC_DEFINE(IMPL_OSD_SOUND, 1, [Driver implements osd_sound()])
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
AC_DEFINE(IMPL_IMAGE, 1, [Driver implements image commands])
AC_DEFINE(OS_PREC64, 1, [64 bit variables])
AC_DEFINE(DRV_BEEP, 1, [Use the driver based beep function])

Expand Down
8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
smallbasic (0.11.16) unstable; urgency=low
* Add support for unary operators on array elements
* Fix call FUNC with (arg1), (arg2)
* Fix INKEY Backspace in FLTK
* Fix FOR/NEXT using float increments

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

smallbasic (0.11.15) unstable; urgency=low
* RTE renamed THROW

Expand Down
14 changes: 14 additions & 0 deletions samples/distro-examples/devio/google.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
url = "http://ajax.googleapis.com/ajax/services/search/web?rsz=large&q=" + trim(command) + "&v=1.0"
open url as #1
if (eof(1)) then
throw "Connection failed: " + url
fi

dim results
tload #1, results
json = array(results)
num_results = len(json.responseData.results)
for i = 0 to num_results - 1
print json.responseData.results(i).titleNoFormatting
print " "; json.responseData.results(i).unescapedUrl
next i
41 changes: 41 additions & 0 deletions samples/distro-examples/tests/array.bas
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,44 @@ if ubound(m)<>3 then ?"UBOUND() ERROR"
if lbound(m,2)<>-1 then ?"LBOUND() ERROR"
if ubound(m,2)<>1 then ?"UBOUND() ERROR"

if (isarray(m) == false) then
throw "m is not an array"
end if

m2 = array("[1,2,3,\"other\"]")
if (isarray(m2) == false) then
throw "m2 is not an array"
end if

if (isnumber(m2(0)) == false) then
throw "m2(0) is not an number"
end if

if (isstring(m2(3)) == false) then
throw "m2(3) is not an string"
end if

m3 = array("{\"cat\":{\"name\":\"lots\"},\"other\":\"thing\",\"zz\":\"thing\"}")
if (ismap(m3) == false) then
throw "m3 is not an map"
end if

m4 = byref m3
if (isref(m4) == false) then
throw "m3 is not an ref"
end if

if m4.cat.name <> "lots" then
throw "ref/map error"
end if

dim sim
sim << 100
sim(0) --
sim(0) ++
sim(0) /= 2
if (sim(0) <> 50) then
throw "dim sim not tasty"
fi


12 changes: 11 additions & 1 deletion samples/distro-examples/tests/iifs.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
'
' Test for refactoring regression
'
blue=1
red=2
green=3

if false then blue=4:red=5:green=6

if (1 <> blue OR red <> 2 OR green <> 3) then
throw "Inline IF error: blue=" + blue + " red=" + red + " green=" + green
endif

' normal if
if 1 then:? "Normal IF - Ok":else:? "ERROR":fi
Expand All @@ -25,4 +36,3 @@ goto 200
? "label 600 - Ok"
goto 210


2 changes: 1 addition & 1 deletion samples/distro-examples/tests/output/hash.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
something
123
[blah=something,other=123,100=cats]
{"100":"cats","blah":"something","other":123}
13 changes: 7 additions & 6 deletions samples/distro-examples/tests/output/ref.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ dog= dog
1= 1
a=b a=b
a<>b a<>b
[NAME=kitchen]
[NAME=hall]
[NAME=Kitchen,FRIDGE=empty]
[NAME=toilet,OCCUPIED=-1]
[NAME=Kitchen,FRIDGE=empty]
[NAME=hall]
{"NAME":"kitchen"}
{"NAME":"hall"}
{"FRIDGE":"empty","NAME":"Kitchen"}
{"NAME":"toilet","OCCUPIED":-1}
{"FRIDGE":"empty","NAME":"Kitchen"}
{"NAME":"hall"}
toilet
12 changes: 11 additions & 1 deletion samples/distro-examples/tests/output/uds.out
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
start of test
end of test
a:
{"XCAT":"cat","XDOG":"dog","XFISH":{"BIG":"big","SMALL":"small"}}
In a:
a.XCAT=cat
a.XDOG=dog
a.XFISH={"BIG":"big","SMALL":"small"}
In a.xfish:
a.xfish.BIG=big
a.xfish.SMALL=small
3
2
4 changes: 3 additions & 1 deletion samples/distro-examples/tests/ref.bas
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ print "a<>b", iFF(a==b, "a=b", "a<>b")

dim rooms
sub addRoom(byref room)
rooms << @room
rooms << byref room
end

dim kitchen,hall,toilet
Expand All @@ -40,3 +40,5 @@ print rooms(0)
print rooms(1)
print rooms(2)

roomref = byref rooms(0)
print roomref.name
2 changes: 1 addition & 1 deletion samples/distro-examples/tests/tau.bas
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sub build_ta
end

sub cerr
rte 2
throw 2
end

sub addRoom(the_thing,d)
Expand Down
29 changes: 29 additions & 0 deletions samples/distro-examples/tests/trycatch.bas
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,33 @@ end try

? "outer after try"

rem
rem Test whether the stack is unwound correctly
rem

iter = 100
cnt = 0
i = 0

while (i < iter)
try
while (true)
if (true)
if (true)
throw "foo"
end if
end if
wend
catch err
select case err
case "foo"
cnt++
end select
end try
i++
wend

if (cnt <> iter) then
print "Test failed: "; cnt; " <> "; iter
end if

27 changes: 25 additions & 2 deletions samples/distro-examples/tests/uds.bas
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'
' This is a test for user-defined structures
' This is a test for the MAP variable type
'

? "start of test"
Expand Down Expand Up @@ -87,4 +87,27 @@ if ((my_pet.x + 1) < 10) then
? "wrong !"
fi

? "end of test"
a.xcat = "cat"
a.xdog = "dog"
a.xfish.big = "big"
a.xfish.small = "small"

? "a:"
? a

? "In a:"
for i in a
? "a." + i + "="; a(i)
next i

? "In a.xfish:"
for i in a.xfish
? "a.xfish." + i + "="; a.xfish(i)
next i

? len(a)
? len(a.xfish)

inner.foo="bar"
m.b << inner
s = " " + m.b(0).foo
Loading