Skip to content

Commit 7ba209c

Browse files
authored
Merge pull request #76 from chrisws/0_12_15
0 12 15
2 parents 09b41b0 + e29bd4b commit 7ba209c

File tree

14 files changed

+70
-14
lines changed

14 files changed

+70
-14
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2018-12-28 (0.12.15)
2+
Fix crash when using GOTO with a non-existent label
3+
Fix crash in editor when double tapping empty document
4+
Fix menu display on chromebook and other devices
5+
16
2018-11-11 (0.12.14)
27
CONSOLE: added support for IMAGE command
38

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], [0.12.14])
10+
AC_INIT([smallbasic], [0.12.15])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
smallbasic (0.12.15) unstable; urgency=low
2+
* Various see web site
3+
4+
-- Chris Warren-Smith <cwarrensmith@gmail.com> Fri, 28 Dec 2018 09:45:25 +1000
5+
16
smallbasic (0.12.14) unstable; urgency=low
27
* Various see web site
38

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REM Don't crash when label does not exist
2+
goto 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
* COMP-ERROR AT Main:2 *
4+
Description:
5+
Label '1' is not defined
6+

src/common/scan.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3401,7 +3401,7 @@ void comp_pass2_scan() {
34013401
w = label->ip;
34023402

34033403
// adjust the address to compensate for optimisation to remove adjoining kwEOC
3404-
if (comp_prog.ptr[w] != kwTYPE_LINE && comp_prog.ptr[w - 1] == kwTYPE_LINE) {
3404+
if (w > 0 && w < comp_prog.count && comp_prog.ptr[w] != kwTYPE_LINE && comp_prog.ptr[w - 1] == kwTYPE_LINE) {
34053405
w--;
34063406
}
34073407
memcpy(comp_prog.ptr + node->pos + (j * ADDRSZ) + (ADDRSZ + ADDRSZ + 3), &w, ADDRSZ);
@@ -3419,7 +3419,7 @@ void comp_pass2_scan() {
34193419
w = label->ip;
34203420

34213421
// adjust the address to compensate for optimisation to remove adjoining kwEOC
3422-
if (comp_prog.ptr[w] != kwTYPE_LINE && comp_prog.ptr[w - 1] == kwTYPE_LINE) {
3422+
if (w > 0 && w < comp_prog.count && comp_prog.ptr[w] != kwTYPE_LINE && comp_prog.ptr[w - 1] == kwTYPE_LINE) {
34233423
w--;
34243424
}
34253425

@@ -3697,12 +3697,14 @@ bcip_t comp_optimise_line_goto(bcip_t ip) {
36973697

36983698
ip = comp_read_goto(ip + 1, &addr, &level);
36993699
bcip_t goto_ip = addr;
3700-
if (comp_prog.ptr[goto_ip] == kwTYPE_EOC) {
3700+
3701+
// note: INVALID_ADDR is assumed to be > comp_prog.count
3702+
if (goto_ip < comp_prog.count && comp_prog.ptr[goto_ip] == kwTYPE_EOC) {
37013703
new_addr = goto_ip + 1;
37023704
}
3703-
while (goto_ip > 0 && comp_prog.ptr[goto_ip] == kwTYPE_LINE) {
3705+
while (goto_ip > -1 && comp_prog.ptr[goto_ip] == kwTYPE_LINE) {
37043706
goto_ip += 1 + sizeof(bcip_t);
3705-
if (comp_prog.ptr[goto_ip] == kwGOTO) {
3707+
if (goto_ip < comp_prog.count && comp_prog.ptr[goto_ip] == kwGOTO) {
37063708
code_t next_level;
37073709
comp_read_goto(goto_ip + 1, &addr, &next_level);
37083710
goto_ip = addr;

src/platform/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 16
1111
targetSdkVersion 27
12-
versionCode 31
13-
versionName "0.12.14.2"
12+
versionCode 32
13+
versionName "0.12.15"
1414
resConfigs "en"
1515
}
1616

src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import android.content.DialogInterface.OnCancelListener;
1313
import android.content.Intent;
1414
import android.content.pm.PackageManager;
15+
import android.content.res.Configuration;
1516
import android.content.res.Resources;
1617
import android.graphics.Rect;
1718
import android.location.Criteria;
@@ -101,6 +102,7 @@ public class MainActivity extends NativeActivity {
101102
System.loadLibrary("smallbasic");
102103
}
103104

105+
public static native void onActivityPaused(boolean paused);
104106
public static native void onResize(int width, int height);
105107
public static native void onUnicodeChar(int ch);
106108
public static native boolean optionSelected(int index);
@@ -378,7 +380,17 @@ public void optionsBox(final String[] items) {
378380
this._options = items;
379381
runOnUiThread(new Runnable() {
380382
public void run() {
381-
openOptionsMenu();
383+
invalidateOptionsMenu();
384+
Configuration config = getResources().getConfiguration();
385+
// https://stackoverflow.com/questions/9996333/openoptionsmenu-function-not-working-in-ics/17903128#17903128
386+
if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) > Configuration.SCREENLAYOUT_SIZE_LARGE) {
387+
int originalScreenLayout = config.screenLayout;
388+
config.screenLayout = Configuration.SCREENLAYOUT_SIZE_LARGE;
389+
openOptionsMenu();
390+
config.screenLayout = originalScreenLayout;
391+
} else {
392+
openOptionsMenu();
393+
}
382394
}
383395
});
384396
}
@@ -589,6 +601,18 @@ protected void onCreate(Bundle savedInstanceState) {
589601
checkFilePermission();
590602
}
591603

604+
@Override
605+
protected void onPause() {
606+
super.onPause();
607+
onActivityPaused(true);
608+
}
609+
610+
@Override
611+
protected void onResume() {
612+
super.onResume();
613+
onActivityPaused(false);
614+
}
615+
592616
@Override
593617
protected void onStop() {
594618
super.onStop();

src/platform/android/jni/display.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ Graphics::Graphics(android_app *app) : ui::Graphics(),
118118
_fontBufferB(NULL),
119119
_app(app),
120120
_w(0),
121-
_h(0) {
121+
_h(0),
122+
_paused(false) {
122123
}
123124

124125
Graphics::~Graphics() {
@@ -154,7 +155,7 @@ bool Graphics::construct(int fontId) {
154155
}
155156

156157
void Graphics::redraw() {
157-
if (_app->window != NULL) {
158+
if (_app->window != NULL && !_paused) {
158159
ANativeWindow_Buffer buffer;
159160
if (ANativeWindow_lock(_app->window, &buffer, NULL) < 0) {
160161
trace("Unable to lock window buffer");

src/platform/android/jni/display.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct Graphics : ui::Graphics {
2525
bool construct(int fontId);
2626
void redraw();
2727
void resize();
28+
void onPaused(bool paused) { _paused=paused; }
2829
void setSize(int w, int h) { _w = w; _h = h; }
2930

3031
private:
@@ -35,6 +36,7 @@ struct Graphics : ui::Graphics {
3536
FT_Byte *_fontBufferB;
3637
android_app *_app;
3738
int _w, _h;
39+
bool _paused;
3840
};
3941

4042
#endif

0 commit comments

Comments
 (0)