Skip to content

Commit

Permalink
Merge pull request #44 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 1, 2016
2 parents e42228b + c2120b3 commit 8df8098
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
SUBDIRS = @BUILD_SUBDIRS@

deb:
fakeroot dpkg-buildpackage -b
fakeroot dpkg-buildpackage -b -uc -us

test:
(cd @TEST_DIR@ && make test)
Expand Down
17 changes: 17 additions & 0 deletions samples/distro-examples/tests/output/trycatch.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,20 @@ 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

26 changes: 25 additions & 1 deletion samples/distro-examples/tests/trycatch.bas
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,29 @@ if (Found != 5) then
throw "Failed: " + Found
endif
sub stack_test
if 1 == 1 then
if 2 == 2 then
if 3 == 3 then
try
try
try
try
try
a = 1 / 0
catch
end try
catch
end try
catch
end try
catch
end try
catch
end try
fi
fi
fi
end
stack_test
1 change: 1 addition & 0 deletions src/common/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ void log_printf(const char *format, ...) {

if (size) {
char *buf = malloc(size + 3);
buf[0] = '\0';
va_start(args, format);
vsnprintf(buf, size + 1, format, args);
va_end(args);
Expand Down
10 changes: 5 additions & 5 deletions src/common/sberr.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ void rt_raise(const char *fmt, ...) {

// log the stack trace
for (i_stack = prog_stack_count; i_stack > 0; i_stack--) {
stknode_t node = prog_stack[i_stack];
stknode_t node = prog_stack[i_stack - 1];
switch (node.type) {
case 0xFF:
case kwBYREF:
case kwTYPE_CRVAR:
case 0xFF:
case kwBYREF:
case kwTYPE_CRVAR:
// ignore these types
break;

default:
default:
for (i_kw = 0; keyword_table[i_kw].name[0] != '\0'; i_kw++) {
if (node.type == keyword_table[i_kw].code) {
log_printf(" %s: %d", keyword_table[i_kw].name, node.line);
Expand Down
2 changes: 1 addition & 1 deletion src/common/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1818,7 +1818,7 @@ void comp_get_unary(const char *p, int *ladd, int *linc, int *ldec, int *leqop)
*ladd = (strncmp(p, "<<", 2) == 0);
*linc = (strncmp(p, "++", 2) == 0);
*ldec = (strncmp(p, "--", 2) == 0);
if (p[1] == '=' && strchr("-+/\\*^%&|", p[0])) {
if (p[0] != '\0' && p[1] == '=' && strchr("-+/\\*^%&|", p[0])) {
*leqop = p[0];
} else {
*leqop = 0;
Expand Down
13 changes: 4 additions & 9 deletions src/ui/inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,9 @@ void FormInput::construct(var_p_t form, var_p_t field, int id) {
}

const char *caption = getText();
int textW = 0;
int textH = 0;

if (caption) {
MAExtent extent = maGetTextSize(caption);
textW = EXTENT_X(extent);
textH = EXTENT_Y(extent);
}
MAExtent extent = maGetTextSize(caption != NULL && caption[0] ? caption : "Z");
int textW = EXTENT_X(extent);
int textH = EXTENT_Y(extent);

if (_width <= 0 && caption != NULL) {
_width = textW + padding(false);
Expand Down Expand Up @@ -572,7 +567,7 @@ void FormLineInput::draw(int x, int y, int w, int h, int chw) {
maFillRect(px, y, width, _height);
maSetColor(_bg);
maDrawText(px, y, _buffer + _scroll + start, chars);
} else {
} else if (hasFocus()) {
int px = x + (_point * chw);
maFillRect(px, y, chw, _height);
if (_point < len) {
Expand Down
1 change: 1 addition & 0 deletions src/ui/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ void System::systemPrint(const char *format, ...) {

if (size) {
char *buf = (char *)malloc(size + 1);
buf[0] = '\0';
va_start(args, format);
vsnprintf(buf, size + 1, format, args);
va_end(args);
Expand Down

0 comments on commit 8df8098

Please sign in to comment.