Skip to content

Commit 74a9002

Browse files
committed
Merge pull request #42 from chrisws/0_11_20
0 12 6
2 parents af111b6 + 3270282 commit 74a9002

File tree

18 files changed

+184
-207
lines changed

18 files changed

+184
-207
lines changed

README.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,6 @@ Useful adb commands for debugging:
8181
adb shell dumpsys cpuinfo
8282
adb shell top -m 10
8383

84-
## Building the TIZEN port
85-
86-
1. Download and install the Tizen IDE
87-
88-
2. Add the following lines to .bashrc
89-
```
90-
TIZEN_SDK=${HOME}/tizen-sdk
91-
TIZEN_ROOTSTRAP=${TIZEN_SDK}/platforms/mobile-3.0/rootstraps/mobile-3.0-device.native
92-
export TIZEN_BIN=${TIZEN_SDK}/tools/arm-linux-gnueabi-gcc-4.5/bin
93-
export TIZEN_LIBS=${HOME}/tizen-lib
94-
export PATH=${PATH}:${TIZEN_BIN}:~/bin
95-
export CHOST=arm-linux-gnueabi
96-
export LDFLAGS="--sysroot=${TIZEN_ROOTSTRAP} -L${TIZEN_LIBS}/lib"
97-
export CPPFLAGS="--sysroot=${TIZEN_ROOTSTRAP} -fmessage-length=0 -fPIC\
98-
-I${TIZEN_ROOTSTRAP}/usr/include -I${TIZEN_LIBS}/include"
99-
export CFLAGS=${CPPFLAGS}
100-
```
101-
3. Build the common components
102-
```
103-
./configure --enable-tizen
104-
```
105-
4. Build the project using Tizen IDE
106-
10784
### .indent.pro settings
10885
```
10986
-brf -nbap -br -brs -cdb -cdw -ce -cli0 -fca -i2 -l110 -lc110 -lp

configure.ac

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dnl
22
dnl Configure script for SmallBASIC
33
dnl
4-
dnl Copyright(C) 2001-2015 Chris Warren-Smith.
4+
dnl Copyright(C) 2001-2016 Chris Warren-Smith.
55
dnl
66
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
@@ -34,11 +34,6 @@ AC_ARG_ENABLE(sdl,
3434
[ac_build_sdl="yes"],
3535
[ac_build_sdl="no"])
3636

37-
AC_ARG_ENABLE(tizen,
38-
AS_HELP_STRING([--enable-tizen],[build common library for Tizen(default=no)]),
39-
[ac_build_tizen="yes"],
40-
[ac_build_tizen="no"])
41-
4237
AC_ARG_ENABLE(android,
4338
AS_HELP_STRING([--enable-android],[build common library for Android(default=no)]),
4439
[ac_build_android="yes"],
@@ -90,9 +85,6 @@ function checkPCRE() {
9085
have_pcre="no"
9186
esac
9287

93-
if test x$ac_build_tizen = xyes; then
94-
have_pcre="no"
95-
fi
9688
if test x$ac_build_android = xyes; then
9789
have_pcre="no"
9890
fi
@@ -103,6 +95,23 @@ function checkPCRE() {
10395
fi
10496
}
10597

98+
function checkTermios() {
99+
AC_CHECK_HEADERS([termios.h], [have_termios_h=yes; break;])
100+
101+
case "${host_os}" in
102+
*mingw* | pw32* | cygwin*)
103+
have_termios_h="no"
104+
esac
105+
106+
if test x$ac_build_android = xyes; then
107+
have_termios_h="no"
108+
fi
109+
110+
if test "${have_termios_h}" = "yes" ; then
111+
AC_DEFINE(USE_TERM_IO, 1, [use the termios library.])
112+
fi
113+
}
114+
106115
function defaultConditionals() {
107116
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
108117
}
@@ -253,23 +262,6 @@ function buildSDL() {
253262
(cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
254263
}
255264

256-
function buildTizen() {
257-
TARGET="Building common library for Tizen."
258-
259-
defaultConditionals
260-
261-
AC_DEFINE(_UnixOS, 1, [Building under Unix like systems.])
262-
AC_DEFINE(_TIZEN, 1, [Defined for Tizen build.])
263-
AC_DEFINE(IMPL_DEV_READ, 1, [Implement dev_read()])
264-
AC_DEFINE(DEV_EVENTS_OSD, 1, [dev_events() implemented using osd_events().])
265-
AC_DEFINE(IMPL_DEV_DELAY, 1, [Driver implements dev_delay()])
266-
AC_DEFINE(CPU_BIGENDIAN, 1, [Tizen uses big-endian])
267-
AC_DEFINE(IMPL_LOG_WRITE, 1, [Driver implements lwrite()])
268-
269-
BUILD_SUBDIRS="src/platform/tizen/common"
270-
AC_SUBST(BUILD_SUBDIRS)
271-
}
272-
273265
function buildAndroid() {
274266
TARGET="Building for Android."
275267

@@ -350,15 +342,14 @@ if test x$ac_build_fltk = xyes; then
350342
buildFLTK
351343
elif test x$ac_build_sdl = xyes; then
352344
buildSDL
353-
elif test x$ac_build_tizen = xyes; then
354-
buildTizen
355345
elif test x$ac_build_android = xyes; then
356346
buildAndroid
357347
else
358348
buildConsole
359349
fi
360350

361351
checkPCRE
352+
checkTermios
362353
checkDebugMode
363354
checkForWindows
364355

@@ -378,7 +369,6 @@ src/common/Makefile
378369
src/platform/fltk/Makefile
379370
src/platform/sdl/Makefile
380371
src/platform/unix/Makefile
381-
src/platform/tizen/common/Makefile
382372
src/platform/android/Makefile
383373
])
384374
AC_OUTPUT

documentation/build_kwp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ bool isKeyword(const char *keyword) {
9696
}
9797

9898
const char* constants[] = {
99-
"SBVER", "PI", "XMAX", "YMAX", "TRUE", "FALSE", "CWD", "HOME", "COMMAND", ""
99+
"SBVER", "PI", "XMAX", "YMAX", "TRUE", "FALSE", "CWD", "HOME", "COMMAND", "INCLUDE", ""
100100
};
101-
for (int i = 0; !result && constants[i] != '\0'; i++) {
101+
for (int i = 0; !result && constants[i][0] != '\0'; i++) {
102102
if (strcasecmp(constants[i], keyword) == 0) {
103103
result = true;
104104
}

documentation/sbasic_ref.csv

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Graphics,command,RECT,622,"RECT [STEP] x,y [,|STEP x2,y2] [, color| COLOR color]
9797
Graphics,command,SHOWPAGE,1429,"SHOWPAGE","This command is used to display pending graphics operations allowing for smooth animations."
9898
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."
9999
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"
100+
Graphics,constant,XMAX,1526,"XMAX","Holds the screen width in pixels"
100101
Graphics,function,PEN,627,"PEN (0..14)","Returns the PEN/MOUSE data."
101102
Graphics,function,POINT,628,"POINT (x [, y])","Returns the color of the pixel at x,y."
102103
Graphics,function,RGB,629,"RGB (r, g, b)","Returns the RGB color codes for the specified values. Takes values 0..255 for each of the color."
@@ -109,15 +110,9 @@ Graphics,function,XPOS,635,"XPOS","Returns the current X position of the cursor
109110
Graphics,function,YPOS,636,"YPOS","Returns the current Y position of the cursor in ""characters""."
110111
Language,command,CALL,637,"CALL (fp)","Invoke a sub or func by address pointer."
111112
Language,command,THROW,1437,"THROW [info [, ...]]","The THROW command (previously known as RTE) is used to initiate a catch-able error. If there is no surrounding TRY/CATCH block, THROW can be used to abort the program."
112-
Language,constant,COMMAND,1459,"COMMAND","SmallBASIC startup command line options."
113-
Language,constant,CWD,1456,"CWD","Current working directory"
114113
Language,constant,FALSE,1457,"FALSE","FALSE"
115-
Language,constant,HOME,1458,"HOME","User HOME folder"
116-
Language,constant,PI,1452,"PI","Holds PI"
117-
Language,constant,SBVER,1451,"SBVER","Version and build information"
118114
Language,constant,TRUE,1455,"TRUE","TRUE"
119-
Language,constant,XMAX,1453,"XMAX","Holds the screen width in pixels"
120-
Language,constant,YMAX,1454,"YMAX","Holds the screen height in pixels."
115+
Graphics,constant,YMAX,1527,"YMAX","Holds the screen height in pixels."
121116
Language,function,IFF,638,"IFF expr","Inline version of IF. eg, animal = ""cat"": fur = IFF( animal = ""cat"", ""yes"", ""no""): ? fur"
122117
Language,keyword,AS,1424,"AS #fileN","See: OPEN"
123118
Language,keyword,BG,1428,"SOUND frq, dur [, vol] [BG]","Play sound in the background. This prevent the program from blocking while the sound plays."
@@ -155,12 +150,14 @@ Language,operator,EQV,665,"a EQV b","Bitwise equivalence."
155150
Language,operator,IMP,666,"a IMP b","Used to perform a logical implication on two expressions."
156151
Language,operator,IN,667,"a IN b","Returns an index (1 Based) to the matching element when b is an array. Returns TRUE if the value is contained within b as a string."
157152
Language,operator,LIKE,668,"a LIKE b","Regular-expression operator. Compares the left part of the expression with the right side regex pattern."
153+
Language,operator,LSHIFT,1496,"result = LSHIFT number, amount","Performs an arithmetic left shift on a bit pattern."
158154
Language,operator,MDL,669,"MDL","Modulus."
159155
Language,operator,MOD,670,"a MOD b","Modulus. Equivalent syntax to the percent character, eg a % b"
160156
Language,operator,NAND,671,"a NAND b","Bitwise exclusive NOT AND."
161157
Language,operator,NOR,672,"a NOR b","Bitwise NOT OR."
162158
Language,operator,NOT,673,"a NOT b","Invert expression result. Equivalent syntax to the exclamation character, eg a ! b"
163159
Language,operator,OR,674,"a OR b","Logical OR. Right side is not evaluated if left side evaluates to True."
160+
Language,operator,RSHIFT,1497,"result = RSHIFT number, amount","Performs an arithmetic right shift on a bit pattern."
164161
Language,operator,XNOR,675,"a XNOR b","Bitwise exclusive NOT OR."
165162
Language,operator,XOR,676,"a XOR b","Bitwise exclusive OR. Equivalent syntax to: a ~ b"
166163
Language,statement,CONST,678,"CONST name = expr","Declare a variable who's value does not change during program execution."
@@ -298,6 +295,11 @@ System,command,RANDOMIZE,810,"RANDOMIZE [int]","Seeds the random number generato
298295
System,command,STKDUMP,812,"STKDUMP","Display internal execution stack."
299296
System,command,TROFF,813,"TROFF","See TRON."
300297
System,command,TRON,814,"TRON","When trace mechanism is ON, displays each line number as the program is executed."
298+
System,constant,COMMAND,1521,"COMMAND","SmallBASIC startup command line options."
299+
System,constant,CWD,1522,"CWD","Current working directory"
300+
System,constant,HOME,1525,"HOME","User HOME folder"
301+
System,constant,PI,1524,"PI","Holds PI"
302+
System,constant,SBVER,1523,"SBVER","Version and build information"
301303
System,function,ENV,815,"ENV expr","Returns the value of a specified entry in the current environment table. If the parameter is empty ("""") then returns an array of the environment variables (in var=value form)."
302304
System,function,FRE,606,"FRE (x)","Returns system information. eg, 0 = free memory, "
303305
System,function,PROGLINE,817,"PROGLINE","Returns the current program line number."
@@ -307,4 +309,5 @@ System,keyword,EXPORT,1440,"EXPORT thing","Export a SUB, FUNC or variable from a
307309
System,keyword,IMPORT,1441,"IMPORT","Import an exported UNIT variable, SUB or FUNC."
308310
System,keyword,UNIT,1446,"UNIT name","Declares the source module as a unit. Units are a set of procedures, functions and/or variables that can be used by another program or unit."
309311
System,statement,CHAIN,1439,"CHAIN source","Compile and run the given source. Source can be a file name, a line of code or an array of code. Use ENV to share variables with the parent process."
312+
System,statement,INCLUDE,1462,"INCLUDE source-file.bas","Inserts code in the named file when the program is compiled. "
310313
System,statement,OPTION,1442,"OPTION keyword","Used to pass parameters to the run-time environment."

src/common/brun.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void exec_setup_predefined_variables() {
283283
setsysvar_int(SYSVAR_YMAX, os_graf_my - 1);
284284
setsysvar_int(SYSVAR_TRUE, 1);
285285
setsysvar_int(SYSVAR_FALSE, 0);
286-
setsysvar_str(SYSVAR_PWD, dev_getcwd());
286+
setsysvar_str(SYSVAR_CWD, dev_getcwd());
287287
setsysvar_str(SYSVAR_COMMAND, opt_command);
288288

289289
#if defined(_UnixOS)
@@ -1178,7 +1178,7 @@ int brun_create_task(const char *filename, byte *preloaded_bc, int libf) {
11781178
find_unit(filename, fname);
11791179
}
11801180
if (access(fname, R_OK)) {
1181-
panic("File '%s' not found", filename);
1181+
panic("File '%s' not found", fname);
11821182
}
11831183
// look if it is already loaded
11841184
if (search_task(fname) != -1) {
@@ -1765,6 +1765,10 @@ int sbasic_exec(const char *file) {
17651765
if (opt_syntaxcheck) { // this is a command-line flag to
17661766
// syntax-check only
17671767
exec_rq = 0;
1768+
} else if (ctask->bc_type == 2) {
1769+
// cannot run a unit
1770+
exec_rq = 0;
1771+
gsb_last_error = 1;
17681772
} else if (opt_decomp && success) {
17691773
sbasic_exec_prepare(file); // load everything
17701774
sbasic_dump_taskinfo(stdout);

src/common/device.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
#if !defined(_device_h)
2727
#define _device_h
2828

29+
#include "config.h"
30+
31+
#if USE_TERM_IO
32+
#include <termios.h>
33+
#endif
34+
2935
#include "common/sys.h"
3036
#include "common/var.h"
3137

src/common/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ void dev_chdir(const char *dir) {
616616
if (chdir(dir) != 0) {
617617
err_file(errno);
618618
}
619-
setsysvar_str(SYSVAR_PWD, dev_getcwd());
619+
setsysvar_str(SYSVAR_CWD, dev_getcwd());
620620
}
621621

622622
/**

0 commit comments

Comments
 (0)