Skip to content

Commit

Permalink
Merge pull request #45 from chrisws/0_11_20
Browse files Browse the repository at this point in the history
0 12 6
  • Loading branch information
chrisws committed May 14, 2016
2 parents 8df8098 + e5a842d commit fdeae96
Show file tree
Hide file tree
Showing 45 changed files with 566 additions and 424 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2016-05-14 (0.12.6)
Fix to prevent const overwriting another const
Updated MID and REPLACE for performance
POINT(0) and POINT(1) values now reset with each program run
POINT(-x, -y) now provides access to the base screen image. For better
performance use the IMAGE.SAVE sub command

2016-05-07 (0.12.6)
Reverted LASTX/LASTY. Data was already accessible via POINT command
Reverted getPixel from SCREEN for performance. Can still access this by passed -ve x/y values
Reverted using var V_FUNC handling for int sys vars due to eval issues

2016-04-26 (0.12.6)
Fixes for unit case sensitivity

Expand Down
2 changes: 1 addition & 1 deletion samples/distro-examples/apps/calc.bas
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func showResult(result)
rect out_x, out_y STEP w, h, COLOR bgnd FILLED
rect out_x - 1, out_y - 1 STEP w + 1, h + 1, COLOR 2

local out_str = chr(27) + "[15 C" + result
local out_str = result
local out_str_w = textwidth(result)
local x = (out_x + w) - out_str_w - textwidth("0")

Expand Down
2 changes: 1 addition & 1 deletion samples/distro-examples/examples/Circles_and_arcs.bas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
color 0,15
color 1,2:cls
circle ymax/4,ymax/4,ymax/8
circle ymax/2,ymax/4,ymax/8 FILLED
circle ymax/4,ymax/2,ymax/8,.75
Expand Down
3 changes: 1 addition & 2 deletions samples/distro-examples/examples/Predefined_Variables.bas
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
? cat(1);"Predefined Variables";cat(0)
? "OS VER =0x"; HEX$(osver)
? "SB VER =0x"; HEX$(sbver)
? "SB VER ="; sbver
? "PI ="; pi
? "XMAX ="; xmax
? "YMAX ="; ymax
Expand Down
Binary file modified samples/distro-examples/games/UFO.bas
Binary file not shown.
2 changes: 1 addition & 1 deletion samples/distro-examples/games/sokoban.bas
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ sub play_game(byref game)

game.game_over = false
while game.game_over = false
pause true: k = inkey
k = inkey(1)
if len(k) = 2 then
ch = asc(right(k,1))
select case ch
Expand Down
3 changes: 0 additions & 3 deletions samples/distro-examples/graphics/3dtorus.bas
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
' Jelly 2004
' Http://rel.betterwebber.com
const Xmax = 640
const Ymax = 480
const Xmid = Xmax/2
const Ymid = Ymax/2
const Lens = 256
const PI = 3.141593
const rings = 14
const bands = 15
const ringradius = 100
Expand Down
3 changes: 2 additions & 1 deletion samples/distro-examples/graphics/Charts.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
' CHART examples

const VN=10
const LINECHART=1
const BARCHART=2
dim v(1 to VN)

randomize timer

cls
Expand Down
1 change: 1 addition & 0 deletions samples/distro-examples/graphics/Simple_3D.bas
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ for i=1 to 15
calcPt
line sx,sy
next
showpage
end

'
Expand Down
12 changes: 12 additions & 0 deletions samples/distro-examples/tests/array.bas
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,16 @@ if (sim(0) <> 50) then
throw "dim sim not tasty"
fi

rem ==6866== Source and destination overlap in memcpy(0xfc3f090, 0xfc3f096, 13)
rem ==6866== at 0x4C32513: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
rem ==6866== by 0x48D4A3: memcpy (string3.h:53)
rem ==6866== by 0x48D4A3: comp_text_line_let (scan.c:1874)

dim dots(1)
dots(0).y = 100
dots(0).dy = 1
dots(0).y += dots(0).dy
if (dots(0).y != 101) then
throw "not 101 !!!"
endif

6 changes: 4 additions & 2 deletions samples/distro-examples/tests/call_tau.bas
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ foyer.name= "my name is PI"

? "end"

tau.addRoom(foyer,x)

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

sub addRoom(the_thing, d)
print the_thing.name, d
Expand Down
11 changes: 5 additions & 6 deletions samples/distro-examples/tests/output/trycatch.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ 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
Expand All @@ -20,4 +14,9 @@ Stack:
IF: 193
IF: 192
SUB: 216


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

5 changes: 4 additions & 1 deletion samples/distro-examples/tests/tau.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Unit Tau
Import TauChild

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

expvar = "Tau's exported variable"
Expand Down Expand Up @@ -37,7 +37,10 @@ sub cerr
end

sub addRoom(the_thing,d)
end

func calcRoomSize(the_thing,d)
calcRoomSize = 1
end

rem initialization
Expand Down
10 changes: 5 additions & 5 deletions samples/distro-examples/tests/trycatch.bas
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ if 1 == 1 then
try
try
a = 1 / 0
catch
catch "X"
end try
catch
catch "X"
end try
catch
catch "X"
end try
catch
catch "X"
end try
catch
catch "X"
end try
fi
fi
Expand Down
12 changes: 6 additions & 6 deletions src/common/blib.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
* LET v[(x)] = any
* CONST v[(x)] = any
*/
void cmd_let(int allowConst) {
void cmd_let(int is_const) {
var_t *v_left = code_getvarptr();

if (!prog_error) {
if (v_left->const_flag && !allowConst) {
if (v_left->const_flag) {
err_const();
return;
}
Expand All @@ -46,7 +46,7 @@ void cmd_let(int allowConst) {
eval(&v_right);
if (!prog_error) {
v_set(v_left, &v_right);
v_left->const_flag = allowConst;
v_left->const_flag = is_const;
}
v_free(&v_right);
}
Expand Down Expand Up @@ -84,6 +84,7 @@ void cmd_dim(int preserve) {
code_skipnext();
zaf = 0;
do {
v_init(&arg);
eval(&arg);
if (prog_error) {
return;
Expand Down Expand Up @@ -1474,9 +1475,8 @@ void cmd_endif() {
stknode_t node;

code_pop(&node, kwIF);
while (node.type != kwIF) {
while (node.type != kwIF && !prog_error) {
code_pop(&node, kwIF);
IF_ERR_BREAK;
}

if (!prog_error) {
Expand Down Expand Up @@ -1755,7 +1755,6 @@ void cmd_next() {
jump_ip = node.x.vfor.jump_ip;

var_p = node.x.vfor.var_ptr;
// v_init(&var_to);
var_step.const_flag = 0;
var_step.type = V_INT;
var_step.v.i = 1;
Expand All @@ -1766,6 +1765,7 @@ void cmd_next() {
//

prog_ip = node.x.vfor.to_expr_ip;
v_init(&var_to);
eval(&var_to);

if (!prog_error && (var_to.type == V_INT || var_to.type == V_NUM)) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/blib.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void cmd_deriv(void);
void cmd_diffeq(void);

// not basic, but speed is needed
void graph_reset(void); // graphics module - reset
void graph_reset(void);
void cmd_pset(void);
void cmd_line(void);
void cmd_rect(void);
Expand Down
6 changes: 2 additions & 4 deletions src/common/blib_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ void cmd_floadln() {
int eof, eol, bufLen, bufIndex;
dword unreadBytes;

err_reset();
if (code_peek() == kwTYPE_SEP) {
// "filename" is an already open file number
flags = 0;
Expand Down Expand Up @@ -646,7 +645,7 @@ void cmd_floadln() {
unreadBytes -= bufLen;

dev_fread(handle, (byte *)buf, bufLen);
if (err_has_error()) {
if (prog_error) {
eof = 1;
break;
}
Expand All @@ -666,7 +665,7 @@ void cmd_floadln() {
}
} // read line

if (err_has_error()) {
if (prog_error) {
// clear & exit
v_free(array_p);
v_init(array_p);
Expand Down Expand Up @@ -716,7 +715,6 @@ void cmd_fsaveln() {
int flags = DEV_FILE_OUTPUT;
int handle, i;

err_reset();
if (code_peek() == kwTYPE_SEP) {
// "filename" is an already open file number
flags = 0;
Expand Down
Loading

0 comments on commit fdeae96

Please sign in to comment.