Skip to content

Commit da0df12

Browse files
committed
Merge pull request #21 from chrisws/0_11_17a
COMMON: Improved performance. Updated FORM, IMAGE, INKEY, TIMER commands
2 parents a7ac9bb + c501f2c commit da0df12

File tree

216 files changed

+15479
-21508
lines changed

Some content is hidden

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

216 files changed

+15479
-21508
lines changed

ChangeLog

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2015-01-25
2+
Added timer func support
3+
Improved syntax error messages
4+
Remove dependence on malloc_usable_size
5+
Pass TRUE as an argument to PAUSE to wait for an event
6+
7+
2015-01-18
8+
Anti-aliased line drawing
9+
Improved INPUT with clipboard handling
10+
Improved graphics display performance
11+
12+
2014-12-03
13+
File-open now uses .bas DIR to locate files
14+
15+
2014-11-06
16+
Added WINDOW system object to control the ansiwidget
17+
Added sound support to SDL port
18+
19+
2014-10-28
20+
Update INKEY to return ALT, CTRL, ALT+CTRL key information
21+
22+
2014-10-20
23+
Refactor FORM handling to use system object
24+
125
2014-09-28
226
Refactor image handling to use system object
327

README

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,22 @@ SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for ever
44

55
1. Setup .bashrc:
66

7-
export PATH=$PATH:~/android-sdk/adt-bundle-linux-x86_64-20131030/sdk/platform-tools
8-
export ANDROID_SDK_ROOT=~/android-sdk/adt-bundle-linux-x86_64-20140321/sdk
7+
export PATH=$PATH:~/android-sdk/depot_tools:~/android-sdk/android-sdk-linux/platform-tools/
8+
export ANDROID_SDK_ROOT=~/android-sdk/android-sdk-linux
99
export TARGET_DEVICE=arm
1010
export PLATFORM_PREFIX=~/android-sdk/android-ext/
1111
export PATH=${PLATFORM_PREFIX}/bin:${PATH}
12-
export NDK=~/android-sdk/android-ndk-r9d
13-
export NDK_PLATFORM=android-9
12+
export NDK=~/android-sdk/android-ndk-r10d
13+
export NDK_PLATFORM=android-19
1414
export ANDROID_LOG_TAGS="DEBUG:I smallbasic:I AndroidRuntime:E *:S"
1515

16-
2. Build PNG + FreeType:
16+
2. Build FreeType:
1717

1818
First, prepare the cross-compiler from the NDK:
1919
$NDK_PATH/build/tools/make-standalone-toolchain.sh \
20-
--platform=$NDK_PLATFORM --install-dir=$PLATFORM_PREFIX
20+
--platform=$NDK_PLATFORM --install-dir=$PLATFORM_PREFIX --arch=arm
2121

2222
Then use it to cross-compile the tools:
23-
cd libpng-1.6.12/
24-
CFLAGS="-std=gnu99" ./configure --host=arm-linux-androideabi --prefix=/png
25-
make
26-
make install DESTDIR=$(pwd)
27-
2823
cd freetype-2.5.3/
2924
CFLAGS="-std=gnu99" ./configure --host=arm-linux-androideabi --prefix=/freetype --without-zlib --without-png --without-harfbuzz
3025
make
@@ -180,11 +175,15 @@ RANLIB = /cygdrive/c/cygwin/bin/ranlib
180175

181176
== Building the SDL version
182177

183-
Optionally install guichan - see http://guichan.sourceforge.net/wiki/index.php
184-
185178
$ ./configure --enable-sdl
186179
$ make
187180

181+
On windows, install tools:
182+
http://www.gtk.org/download/win32.php
183+
184+
$ ./configure --host=i686-w64-mingw32 --enable-sdl
185+
$ make
186+
188187
== Building the non-graphical console version (cygwin or linux)
189188
$ ./configure && make
190189

configure.ac

Lines changed: 43 additions & 62 deletions
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.11.16])
10+
AC_INIT([smallbasic], [0.11.17])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -55,13 +55,14 @@ function checkForWindows() {
5555
*mingw* | pw32* | cygwin*)
5656
win32="yes"
5757
AC_CHECK_TOOL(WINDRES, windres, :)
58+
;;
59+
*darwin*)
60+
;;
61+
*)
62+
dnl backlinking support for modules
63+
LDFLAGS="${LDFLAGS} -export-dynamic"
5864
esac
5965
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
60-
61-
dnl backlinking support for modules
62-
if test $win32 = no; then
63-
LDFLAGS="${LDFLAGS} -export-dynamic"
64-
fi
6566
}
6667

6768
function checkDebugMode() {
@@ -138,7 +139,7 @@ function buildFLTK() {
138139
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -D__USE_MINGW_ANSI_STDIO"
139140
esac
140141

141-
FLTK_CXXFLAGS="${PACKAGE_CFLAGS} `fltk2-config --cxxflags` -Wall -Wunused -fno-exceptions"
142+
FLTK_CXXFLAGS="${PACKAGE_CFLAGS} `fltk2-config --cxxflags` -fno-exceptions"
142143
PACKAGE_LIBS="${PACKAGE_LIBS} `fltk2-config --ldflags --use-images`"
143144

144145
dnl do not depend on cygwin.dll under cygwin build
@@ -163,17 +164,12 @@ function buildFLTK() {
163164
dnl preconfigured values for FLTK build
164165
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
165166
AC_DEFINE(_FLTK, 1, [Defined for FLTK build.])
166-
AC_DEFINE(USE_TERM_IO, 0, [Does not use terminal-io functions.])
167167
AC_DEFINE(USE_CLIB, 1, [Implements clibmgr.])
168168
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
169-
AC_DEFINE(IMPL_IMAGE, 1, [Driver implements image commands])
170-
AC_DEFINE(IMPL_DEV_GETS, 1, [Driver implements dev_gets()])
171169
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
172170
AC_DEFINE(IMPL_DEV_ENV, 1, [Driver implements dev_env funcs])
173171
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
174172
AC_DEFINE(OS_PREC64, 1, [64 bit variables])
175-
AC_DEFINE(DRV_BEEP, 1, [Use the driver based beep function])
176-
AC_DEFINE(IMPL_OSD_SOUND, 1, [Driver implements osd_sound()])
177173

178174
BUILD_SUBDIRS="src/common src/platform/fltk"
179175
AC_SUBST(BUILD_SUBDIRS)
@@ -200,39 +196,47 @@ function buildSDL() {
200196
AC_MSG_ERROR([libfreetype6-dev not installed: configure failed.])
201197
fi
202198

203-
AC_MSG_CHECKING(for SDL_image)
204-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
205-
#include "SDL2/SDL_image.h"
206-
]], [[]])],
207-
[AC_MSG_RESULT([yes])],
208-
[AC_MSG_ERROR([libsdl2-image-dev not installed: configure failed])])
199+
case "${host_os}" in
200+
*mingw* | cygwin*)
201+
dnl avoid using MSCRT versions of printf for long double
202+
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -D__USE_MINGW_ANSI_STDIO"
209203

210-
# Check fontconfig configuration
211-
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2)
212-
AC_SUBST(FONTCONFIG_CFLAGS)
213-
AC_SUBST(FONTCONFIG_LIBS)
204+
dnl do not depend on cygwin.dll under cygwin build
205+
PACKAGE_CFLAGS="-I`cygpath -m /usr/local/include` ${PACKAGE_CFLAGS} -mms-bitfields"
206+
PACKAGE_LIBS="-L`cygpath -m /usr/local/lib` ${PACKAGE_LIBS} -lwsock32 -static-libgcc -static-libstdc++"
207+
AC_DEFINE(_Win32, 1, [Windows build])
208+
AC_DEFINE(__addr_t_defined, 1, [Avoid conflict in cygwin/types.h])
209+
FONTCONFIG_CFLAGS=""
210+
FONTCONFIG_LIBS=""
211+
;;
212+
213+
*)
214+
# Unix - Check fontconfig configuration
215+
PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2)
216+
AC_SUBST(FONTCONFIG_CFLAGS)
217+
AC_SUBST(FONTCONFIG_LIBS)
218+
219+
dnl backlinking support for modules
220+
PACKAGE_LIBS="${PACKAGE_LIBS} -ldl"
221+
esac
214222

215223
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} ${FONTCONFIG_CFLAGS} `sdl2-config --cflags` `freetype-config --cflags`"
216-
PACKAGE_LIBS="${PACKAGE_LIBS} ${FONTCONFIG_LIBS} `sdl2-config --libs` `freetype-config --libs` -ldl"
224+
PACKAGE_LIBS="${PACKAGE_LIBS} ${FONTCONFIG_LIBS} `sdl2-config --libs` `freetype-config --libs`"
217225

218226
dnl preconfigured values for SDL build
219227
AC_DEFINE(_SDL, 1, [Defined when building SDL version])
220228
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
221-
AC_DEFINE(USE_TERM_IO, 0, [Does not use terminal-io functions.])
222229
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
223-
AC_DEFINE(IMPL_DEV_GETS, 1, [Driver implements dev_gets()])
224230
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
225231
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
226232
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
227-
AC_DEFINE(IMPL_OSD_SOUND, 1, [Driver implements osd_sound()])
228233
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
229-
AC_DEFINE(IMPL_IMAGE, 1, [Driver implements image commands])
230234
AC_DEFINE(OS_PREC64, 1, [64 bit variables])
231-
AC_DEFINE(DRV_BEEP, 1, [Use the driver based beep function])
232235

233236
BUILD_SUBDIRS="src/common src/platform/sdl"
234237
AC_SUBST(BUILD_SUBDIRS)
235238
(cd ide/android/assets && xxd -i main.bas > ../../../src/platform/sdl/main_bas.h)
239+
(cd ide/android/res/drawable-hdpi && xxd -i ic_launcher.png > ../../../../src/platform/sdl/icon.h)
236240
}
237241

238242
function buildTizen() {
@@ -243,16 +247,10 @@ function buildTizen() {
243247
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
244248
AC_DEFINE(_TIZEN, 1, [Defined for Tizen build.])
245249
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
246-
AC_DEFINE(HAVE_SEARCH_H, 1, [Found GNU search.h])
247-
AC_DEFINE(HAVE_TDESTROY, 1, [Found GNU search.h])
248250
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
249-
AC_DEFINE(IMPL_DEV_GETS, 1, [Driver implements dev_gets()])
250251
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
251-
AC_DEFINE(IMPL_IMAGE, 1, [Driver implements image commands])
252-
AC_DEFINE(HAVE_MALLOC_USABLE_SIZE, 0, [Newlib version causes mosync stack panic])
253252
AC_DEFINE(CPU_BIGENDIAN, 1, [Tizen uses big-endian])
254253
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
255-
AC_DEFINE(USE_TERM_IO, 0, [Does not use terminal-io functions.])
256254

257255
BUILD_SUBDIRS="src/platform/tizen/common"
258256
AC_SUBST(BUILD_SUBDIRS)
@@ -265,15 +263,11 @@ function buildAndroid() {
265263

266264
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
267265
AC_DEFINE(_ANDROID, 1, [Defined for Android build.])
268-
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
269266
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
270-
AC_DEFINE(IMPL_DEV_GETS, 1, [Driver implements dev_gets()])
267+
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
271268
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
272-
AC_DEFINE(IMPL_IMAGE, 1, [Driver implements image commands])
273-
AC_DEFINE(HAVE_MALLOC_USABLE_SIZE, 0, [Newlib version causes mosync stack panic])
274-
AC_DEFINE(CPU_BIGENDIAN, 1, [Android uses big-endian])
275269
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
276-
AC_DEFINE(USE_TERM_IO, 0, [Does not use terminal-io functions.])
270+
AC_DEFINE(CPU_BIGENDIAN, 1, [Android uses big-endian])
277271

278272
BUILD_SUBDIRS="src/platform/android"
279273
AC_SUBST(BUILD_SUBDIRS)
@@ -290,6 +284,7 @@ function buildConsole() {
290284
esac
291285

292286
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, test $win32 = yes)
287+
AC_DEFINE(BUILD_CONSOLE, 1, [Building a console based system.])
293288

294289
if test $win32 = yes; then
295290
dnl test whether to build using mingw
@@ -305,39 +300,32 @@ function buildConsole() {
305300
if test x$have_cygwin = xyes; then
306301
dnl preconfigured values for cygwin console build (depends on cygwin.dll)
307302
TARGET="Building Cygwin console version."
308-
AC_CHECK_HEADER(ncurses/termcap.h, [], [AC_MSG_ERROR("install libncurses-dev")])
309303
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
310-
AC_DEFINE(USE_TERM_IO, 1, [Uses terminal-io functions.])
311304
AC_DEFINE(DEV_EVENTS_OSD, 0, [dev_events() implemented using osd_events().])
312305
AC_DEFINE(_CygWin, 1, [Building a minimal dev_null based command-line version.])
313306
AC_DEFINE(__CYGWIN__, 1, [as above])
314307
AC_DEFINE(OS_PREC64, 1, [64 bit variables])
315308
AC_DEFINE(INET_UNSUP, 1, [inet not supported.])
316-
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -lgcc -lncurses"
317-
BUILD_SUBDIRS="src/common src/platform/cygwin"
309+
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -lgcc"
310+
BUILD_SUBDIRS="src/common src/platform/unix"
318311
else
319312
dnl preconfigured values for cygwin mingw console build
320313
TARGET="Building Cygwin MinGW console version."
321314
AC_DEFINE(__MINGW32__, 1, [as above])
322315
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
323-
AC_DEFINE(USE_TERM_IO, 0, [Does not use terminal-io functions.])
324-
AC_DEFINE(IMPL_EMPTY_TERM_EVENTS, 1, [Implement a dummy term_events()])
325-
PACKAGE_LIBS="${PACKAGE_LIBS} -mconsole -lmingw32"
326-
BUILD_SUBDIRS="src/common src/platform/mingw"
316+
PACKAGE_LIBS="${PACKAGE_LIBS} -mconsole -lmingw32 -lwsock32"
317+
BUILD_SUBDIRS="src/common src/platform/unix"
327318
fi
328319
AC_DEFINE(_Win32, 1, [Windows build])
329320
AC_DEFINE(__addr_t_defined, 1, [Avoid conflict in cygwin/types.h])
330321
else
331322
dnl preconfigured values for unix console build
332323
TARGET="Building Unix console version."
333324
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
334-
AC_DEFINE(USE_TERM_IO, 1, [Uses terminal-io functions.])
325+
AC_DEFINE(USE_TERM_IO, 0, [Uses terminal-io functions.])
335326
AC_DEFINE(DEV_EVENTS_OSD, 0, [dev_events() implemented using osd_events().])
336-
AC_DEFINE(DRV_SOUND, 1, [Driver implements functions in drvsound.h])
337-
AC_DEFINE(UNIX_MEMMGR, 1, [Unix memory manager])
338327
AC_DEFINE(OS_PREC64, 1, [64 bit variables])
339-
AC_CHECK_HEADER(readline/readline.h, [], [AC_MSG_ERROR("install libreadline-dev")])
340-
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread -lncurses -lreadline"
328+
PACKAGE_LIBS="${PACKAGE_LIBS} -lm -ldl -lpthread"
341329
BUILD_SUBDIRS="src/common src/platform/unix"
342330
TEST_DIR="src/platform/unix"
343331
AC_SUBST(TEST_DIR)
@@ -352,17 +340,10 @@ function buildDist() {
352340
BUILD_SUBDIRS="src/common src/platform/gtk/src src/platform/gtk/data src/platform/gtk/icons"
353341
BUILD_SUBDIRS="${BUILD_SUBDIRS} src/platform/fltk"
354342
BUILD_SUBDIRS="${BUILD_SUBDIRS} src/platform/sdl"
355-
BUILD_SUBDIRS="${BUILD_SUBDIRS} src/platform/cygwin"
356343
BUILD_SUBDIRS="${BUILD_SUBDIRS} src/platform/unix"
357-
BUILD_SUBDIRS="${BUILD_SUBDIRS} src/platform/mingw"
358344
AC_SUBST(BUILD_SUBDIRS)
359345
}
360346

361-
OS_NAME=`uname -a`
362-
363-
AC_DEFINE_UNQUOTED(OS_NAME, "${OS_NAME}", [SB system variable])
364-
AC_DEFINE(HAVE_C_MALLOC, 1, [allocate memory with regular malloc calls])
365-
366347
if test x$ac_build_dist = xyes; then
367348
buildDist
368349
elif test x$ac_build_fltk = xyes; then
@@ -381,6 +362,8 @@ checkPCRE
381362
checkDebugMode
382363
checkForWindows
383364

365+
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Wno-unused-result"
366+
384367
AC_SUBST(PACKAGE_CFLAGS)
385368
AC_SUBST(PACKAGE_LIBS)
386369

@@ -389,8 +372,6 @@ Makefile
389372
src/common/Makefile
390373
src/platform/fltk/Makefile
391374
src/platform/sdl/Makefile
392-
src/platform/cygwin/Makefile
393-
src/platform/mingw/Makefile
394375
src/platform/unix/Makefile
395376
src/platform/tizen/common/Makefile
396377
src/platform/android/Makefile

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
smallbasic (0.11.17) unstable; urgency=low
2+
* Fix compiler ignoring unused assignment values
3+
* Implement IMAGE
4+
5+
-- Chris Warren-Smith <[email protected]> Sat, 4 October 2014 09:45:25 +1000
6+
17
smallbasic (0.11.16) unstable; urgency=low
28
* Add support for unary operators on array elements
39
* Fix call FUNC with (arg1), (arg2)

ide/android/.classpath

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
4+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
5+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
6+
<classpathentry kind="src" path="src"/>
7+
<classpathentry kind="src" path="gen"/>
8+
<classpathentry kind="output" path="bin/classes"/>
9+
</classpath>

ide/android/.project

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>SmallBASIC</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

ide/android/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
package="net.sourceforge.smallbasic"
44
android:installLocation="preferExternal"
55
android:versionCode="14"
6-
android:versionName="0.11.12">
6+
android:versionName="0.11.17">
77
<!-- This is the platform API where NativeActivity was introduced. -->
88
<uses-sdk android:minSdkVersion="9"/>
99

@@ -20,7 +20,7 @@
2020
This will take care of integrating with our NDK code. -->
2121
<activity android:name="net.sourceforge.smallbasic.MainActivity"
2222
android:label="@string/app_name"
23-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
23+
android:theme="@style/SBTheme"
2424
android:configChanges="orientation|keyboardHidden">
2525
<!-- Tell NativeActivity the name of or .so -->
2626
<meta-data android:name="android.app.lib_name"

0 commit comments

Comments
 (0)