Skip to content

Commit 15f753f

Browse files
authored
Merge pull request #126 from chrisws/12_22
12 22
2 parents 602f875 + 4b09a3f commit 15f753f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+967
-633
lines changed

ChangeLog

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
2021-08-22 (12.23)
2+
SDL: Validate window dimensions on loading to prevent hidden window
3+
4+
2021-08-16 (12.23)
5+
COMMON: Fix array append regression #122
6+
UI: added window hideKeypad #125
7+
8+
2021-08-16 (12.23)
9+
ANDROID: Hide keypad on run. Show keypad for INPUT, then re-hide on completion.
10+
11+
2021-07-28 (12.22)
12+
UI: Allow RGB to be used with image array passed to IMAGE
13+
14+
2021-07-27 (12.22)
15+
FLTK: Fix PSET display of extra pixel
16+
17+
2021-07-04 (12.22)
18+
SDL: Fix Live edit when start path contains unicode characters
19+
20+
2021-07-02 (12.22)
21+
UI: Fix to make image save and load compatible
22+
23+
2021-06-25 (12.22)
24+
ANDROID: Unified file listing includes bas files from sub-folders
25+
26+
2021-06-23 (12.22)
27+
FLTK: Implemented image opacity handling
28+
UI: Implemented image.clip(left,top,right,bottom)
29+
30+
2021-06-12 (12.22)
31+
UI: Fix potential memory leak using IMAGE
32+
UI: Fix RGB handling with IMAGE
33+
ANDROID: restore home directory when resuming from run
34+
ANDROID: removed samsung keypad warning
35+
36+
2021-06-06 (12.22)
37+
UI: implemented image.draw(), fix image.save in andoid #115
38+
39+
2021-06-05 (12.22)
40+
COMMON: Fixes 'Socket Client doesn't receive byte with value 13' #112
41+
COMMON: Fixes TSAVE of arrays includes extra null character. #119
42+
43+
2021-05-03 (12.22)
44+
COMMON: Fix array access regression
45+
46+
2021-05-03 (12.22)
47+
ANDROID: Removes path navigation to show unified view of available folder
48+
49+
2021-04-02 (12.22)
50+
SDL: Update editor to handle unit errors
51+
152
2021-04-02 (12.21)
253
ANDROID: Added range checking for the web services port
354

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dnl This program is distributed under the terms of the GPL v2.0
77
dnl Download the GNU Public License (GPL) from www.gnu.org
88
dnl
99

10-
AC_INIT([smallbasic], [12.21])
10+
AC_INIT([smallbasic], [12.22])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET

documentation/sbasic_ref.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Graphics,command,PSET,621,"PSET [STEP] x,y [, color| COLOR color]","Draw a pixel
9595
Graphics,command,RECT,622,"RECT [STEP] x,y [,|STEP x2,y2] [, color| COLOR color] [FILLED]","Draws a rectangular parallelogram."
9696
Graphics,command,SHOWPAGE,1429,"SHOWPAGE","This command is used to display pending graphics operations allowing for smooth animations."
9797
Graphics,command,VIEW,623,"VIEW [x1,y1,x2,y2 [,color [,border-color]]]","Defines a viewport. The viewport defined by VIEW is disabled by a VIEW command with no parameters."
98-
Graphics,command,WINDOW,624,"WINDOW [x1,y1,x2,y2]","The WINDOW command allows you to redefine the corners of the display screen as a pair of ""world"" coordinates. WINDOW is also overloaded as a function, returning a system object providing access to the following sub-commands: graphicsScreen1, graphicsScreen2, textScreen, alert, ask, menu, message, showKeypad, insetTextScreen"
98+
Graphics,command,WINDOW,624,"WINDOW [x1,y2,x2,y1]","The WINDOW command allows you to redefine the corners of the display screen as a pair of ""world"" coordinates. WINDOW is also overloaded as a function, returning a system object providing access to the following sub-commands: graphicsScreen1, graphicsScreen2, textScreen, alert, ask, menu, message, showKeypad, insetTextScreen"
9999
Graphics,constant,XMAX,1526,"XMAX","Holds the screen width in pixels"
100100
Graphics,constant,YMAX,1527,"YMAX","Holds the screen height in pixels."
101101
Graphics,function,PEN,627,"PEN (0..14)","Returns the PEN/MOUSE data."

samples/distro-examples/tests/all.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ print "RIGHT:" + RIGHT (s,2)
198198
print "RIGHTOF:" + RIGHTOF (s1, s2)
199199
print "RIGHTOFLAST:" + RIGHTOFLAST (s1, s2)
200200
print "RINSTR:" + RINSTR (2, s1, s2)
201-
print "RND:" + RND
201+
print "RND:" + iff(RND>=0 && RND<=1.0,1,0)
202202
print "ROUND:" + ROUND (x,22)
203203
print "RTRIM:" + RTRIM (s)
204204
print "RUN:" '+ RUN cmdstr

samples/distro-examples/tests/array.bas

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,12 @@ sub xfunc(argx)
327327
end
328328
z=anims[0].framePoses[0, 0].translation
329329
xfunc(anims[0].framePoses[0, 0].translation)
330+
331+
dim a()
332+
append a, [1,2],[3,4],[5,6]
333+
a << [7,8,9]
334+
if (a[0] != [1,2]) then throw "err1"
335+
if (a[1] != [3,4]) then throw "err2"
336+
if (a[2] != [5,6]) then throw "err3"
337+
if (a[3] != [7,8,9]) then throw "err4"
338+

samples/distro-examples/tests/output/all.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ RIGHT:gs
183183
RIGHTOF:
184184
RIGHTOFLAST:
185185
RINSTR:0
186-
RND:0.75898406142369
186+
RND:1
187187
ROUND:12.3
188188
RTRIM:catsanddogs
189189
RUN:

src/common/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ libsb_common_a_SOURCES = \
5454
device.c device.h \
5555
screen.c \
5656
system.c \
57+
random.c \
5758
eval.c \
5859
extlib.c extlib.h \
5960
file.c \

src/common/blib.c

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,6 @@ void cmd_append() {
258258

259259
// for each argument to append
260260
do {
261-
// get the value to append
262-
var_t arg_p;
263-
v_init(&arg_p);
264-
eval(&arg_p);
265-
266261
// find the array element
267262
var_t *elem_p;
268263
if (var_p->type != V_ARRAY) {
@@ -274,7 +269,8 @@ void cmd_append() {
274269
}
275270

276271
// set the value onto the element
277-
v_move(elem_p, &arg_p);
272+
v_init(elem_p);
273+
eval(elem_p);
278274

279275
// next parameter
280276
if (code_peek() != kwTYPE_SEP) {
@@ -288,27 +284,6 @@ void cmd_append() {
288284
} while (1);
289285
}
290286

291-
void cmd_append_opt() {
292-
var_t *v_left = code_getvarptr();
293-
294-
// skip kwTYPE_SEP + ","
295-
code_skipsep();
296-
297-
// skip kwTYPE_VAR
298-
code_skipnext();
299-
300-
var_t *elem_p;
301-
if (v_left->type != V_ARRAY) {
302-
v_toarray1(v_left, 1);
303-
elem_p = v_elem(v_left, 0);
304-
} else {
305-
v_resize_array(v_left, v_asize(v_left) + 1);
306-
elem_p = v_elem(v_left, v_asize(v_left) - 1);
307-
}
308-
309-
v_set(elem_p, tvar[code_getaddr()]);
310-
}
311-
312287
/**
313288
* INSERT A, index, v1 [, vN]
314289
*/
@@ -530,7 +505,7 @@ void cmd_print(int output) {
530505
if (code_peek() == kwTYPE_EOC || code_peek() == kwTYPE_LINE) {
531506
// There are no parameters
532507
if (dev_fstatus(handle)) {
533-
dev_fwrite(handle, (byte *)OS_LINESEPARATOR, sizeof(OS_LINESEPARATOR));
508+
dev_fwrite(handle, (byte *)OS_LINESEPARATOR, OS_LINESEPARATOR_LEN);
534509
} else {
535510
err_fopen();
536511
}
@@ -2051,18 +2026,18 @@ void cmd_restore() {
20512026
* RANDOMIZE [num]
20522027
*/
20532028
void cmd_randomize() {
2054-
long seed;
2029+
var_int_t seed;
20552030

20562031
byte code = code_peek();
20572032
switch (code) {
20582033
case kwTYPE_LINE:
20592034
case kwTYPE_EOC:
2060-
srand(clock());
2035+
pcg32_srand(clock());
20612036
break;
20622037
default:
20632038
seed = par_getint();
20642039
if (!prog_error) {
2065-
srand(seed);
2040+
pcg32_srand(seed);
20662041
}
20672042
};
20682043
}

src/common/blib.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ void cmd_packed_let();
3737
void cmd_dim(int);
3838
void cmd_redim(void);
3939
void cmd_append(void);
40-
void cmd_append_opt(void);
4140
void cmd_lins(void);
4241
void cmd_ldel(void);
4342
void cmd_erase(void);

src/common/blib_db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void cmd_fsaveln() {
725725
for (int i = 0; i < v_asize(array_p); i++) {
726726
var_p = v_elem(array_p, i);
727727
fprint_var(handle, var_p);
728-
dev_fwrite(handle, (byte *)OS_LINESEPARATOR, sizeof(OS_LINESEPARATOR));
728+
dev_fwrite(handle, (byte *)OS_LINESEPARATOR, OS_LINESEPARATOR_LEN);
729729
}
730730
} else {
731731
// parameter is an string

0 commit comments

Comments
 (0)