Skip to content

Commit 8b0cdbb

Browse files
committed
Merge pull request #14 from chrisws/android
Android
2 parents 886402b + 18dd8d8 commit 8b0cdbb

File tree

14 files changed

+80
-227
lines changed

14 files changed

+80
-227
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2014-08-11
2+
Cleanup system var handling, removed os_ver
3+
14
2014-08-09
25
Renamed command "#UNIT-PATH:" to "UNITPATH"
36
Renamed command "#INC:" to "INCLUDE"

Makefile.am

Lines changed: 59 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,67 @@
77

88
SUBDIRS = @BUILD_SUBDIRS@
99

10-
EXTRA_DIST = \
11-
AUTHORS \
12-
ChangeLog \
13-
configure.in \
14-
NEWS \
15-
README \
16-
autogen.sh \
17-
src/platform/gtk/sbgtk.glade \
18-
src/platform/gtk/sbgtk.gladep \
19-
src/platform/gtk/debian/changelog \
20-
src/platform/gtk/debian/control \
21-
src/platform/gtk/debian/copyright \
22-
src/platform/gtk/debian/rules \
23-
src/platform/gtk/debian/sbasic.links \
24-
src/platform/sdl/fonts/BI1.c \
25-
src/platform/sdl/fonts/BI2.c \
26-
src/platform/sdl/fonts/BI5.c \
27-
src/platform/sdl/fonts/BI7.c \
28-
src/platform/sdl/fonts/psf2c.c \
29-
documentation/export_csv.bas \
30-
documentation/sbasic_ref.csv \
31-
documentation/HOWTO/HOWTO-DOCUMENT.TXT \
32-
documentation/HOWTO/HOWTO-PORT.TXT \
33-
documentation/HOWTO/DEVELOP.TXT \
34-
documentation/LICENSE \
35-
documentation/README \
36-
documentation/README.BCC \
37-
documentation/README.DEV \
38-
documentation/README.DOS \
39-
documentation/README.HELIO \
40-
documentation/README.PALM \
41-
documentation/README.UNIX \
42-
plugins/publish.bas \
43-
plugins/comment_in.bas \
44-
plugins/comment_out.bas \
45-
plugins/dos2unix.bas \
46-
plugins/indent.bas \
47-
plugins/help.bas \
48-
translator/SB.g \
49-
translator/Makefile \
50-
translator/Translator.java \
51-
images/logo.gif \
52-
images/sb16x16.png \
53-
images/sb32x32.png \
54-
images/sb-desktop-16x16.png \
55-
images/sb-desktop-32x32.png \
56-
ide/smallbasic.lang \
57-
ide/small-basic-mode.el \
58-
ide/smallbasic.syn \
59-
rpm/README \
10+
EXTRA_DIST = \
11+
AUTHORS \
12+
ChangeLog \
13+
configure.in \
14+
NEWS \
15+
README \
16+
autogen.sh \
17+
src/platform/gtk/sbgtk.glade \
18+
src/platform/gtk/sbgtk.gladep \
19+
src/platform/gtk/debian/changelog \
20+
src/platform/gtk/debian/control \
21+
src/platform/gtk/debian/copyright \
22+
src/platform/gtk/debian/rules \
23+
src/platform/gtk/debian/sbasic.links \
24+
src/platform/sdl/fonts/BI1.c \
25+
src/platform/sdl/fonts/BI2.c \
26+
src/platform/sdl/fonts/BI5.c \
27+
src/platform/sdl/fonts/BI7.c \
28+
src/platform/sdl/fonts/psf2c.c \
29+
documentation/export_csv.bas \
30+
documentation/sbasic_ref.csv \
31+
documentation/HOWTO/HOWTO-DOCUMENT.TXT \
32+
documentation/HOWTO/HOWTO-PORT.TXT \
33+
documentation/HOWTO/DEVELOP.TXT \
34+
documentation/LICENSE \
35+
documentation/README \
36+
documentation/README.BCC \
37+
documentation/README.DEV \
38+
documentation/README.DOS \
39+
documentation/README.HELIO \
40+
documentation/README.PALM \
41+
documentation/README.UNIX \
42+
plugins/publish.bas \
43+
plugins/comment_in.bas \
44+
plugins/comment_out.bas \
45+
plugins/dos2unix.bas \
46+
plugins/indent.bas \
47+
plugins/help.bas \
48+
translator/SB.g \
49+
translator/Makefile \
50+
translator/Translator.java \
51+
images/logo.gif \
52+
images/sb16x16.png \
53+
images/sb32x32.png \
54+
images/sb-desktop-16x16.png \
55+
images/sb-desktop-32x32.png \
56+
ide/smallbasic.lang \
57+
ide/small-basic-mode.el \
58+
ide/smallbasic.syn \
59+
rpm/README \
6060
rpm/SPECS/opensuse.spec
6161

62+
install-exec-hook:
63+
(mkdir -p $(DESTDIR)$(pkgdatadir) && \
64+
mkdir -p $(DESTDIR)$(pkgdatadir)/plugins && \
65+
mkdir -p $(DESTDIR)$(pkgdatadir)/ide && \
66+
mkdir -p $(DESTDIR)$(pkgdatadir)/samples && \
67+
cp documentation/sbasic_ref.csv $(DESTDIR)$(pkgdatadir) && \
68+
cp plugins/*.* $(DESTDIR)$(pkgdatadir)/plugins && \
69+
cp ide/*.* $(DESTDIR)$(pkgdatadir)/ide)
70+
6271
deb:
6372
fakeroot dpkg-buildpackage
6473

debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
smallbasic (0.11.12) unstable; urgency=low
2+
* Fixed/implemented INCLUDE command
3+
4+
-- Chris Warren-Smith <cwarrensmith@gmail.com> Sat, 11 August 2014 09:45:25 +1000
5+
16
smallbasic (0.11.11) unstable; urgency=low
27
* Built using common code from the android project and SDL
38

samples/distro-examples/tests/call_tau.bas

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,3 @@ rem check system-variables
2020
predef.prsys
2121

2222

23-
24-

samples/distro-examples/tests/output/call_tau.out

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,4 @@ message from main
1010
message from tau
1111
[1,2,3,4]
1212
Predefined Variables
13-
OS VER =0x0
14-
OS NAME=Unix/Linux version 3.13.0-32-generic (buildd@kissel) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014
15-
SB VER =0x0
1613
PI =3.14159265358979
17-
XMAX =161
18-
YMAX =42
19-
CWD =/home/chrisws/src/SmallBASIC/src/platform/unix/
20-
HOME =/home/chrisws/

samples/distro-examples/tests/predef.bas

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,5 @@ export prsys
44

55
sub prsys
66
? cat(1);"Predefined Variables";cat(0)
7-
? "OS VER =0x"; HEX$(osver)
8-
? "OS NAME="; osname
9-
? "SB VER =0x"; HEX$(sbver)
107
? "PI ="; pi
11-
? "XMAX ="; xmax
12-
? "YMAX ="; ymax
13-
? "CWD ="; CWD
14-
? "HOME ="; HOME
158
end
16-
17-
18-

src/common/brun.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -591,32 +591,16 @@ void setsysvar_str(int index, const char *value) {
591591
*/
592592
void exec_setup_predefined_variables() {
593593
char homedir[OS_PATHNAME_SIZE + 1];
594-
#if defined(_UnixOS)
595-
int l;
596-
#endif
597594

598595
// needed here (otherwise task will not updated)
599596
ctask->has_sysvars = 1;
600597

601-
setsysvar_int(SYSVAR_OSVER, os_ver);
602598
setsysvar_str(SYSVAR_OSNAME, OS_NAME);
603599
setsysvar_str(SYSVAR_SBVER, SB_STR_VER);
604600
setsysvar_num(SYSVAR_PI, SB_PI);
605-
606-
// Change from Haraszti - 30/3/2007 Thanks Atilla :)
607-
// setsysvar_int(SYSVAR_XMAX, 159);
608-
// setsysvar_int(SYSVAR_YMAX, 159);
609-
// setsysvar_int(SYSVAR_BPP, 1);
610601
setsysvar_int(SYSVAR_XMAX, os_graf_mx - 1);
611602
setsysvar_int(SYSVAR_YMAX, os_graf_my - 1);
612-
if (os_graphics) {
613-
setsysvar_int(SYSVAR_BPP, os_color_depth);
614-
}
615-
else {
616-
setsysvar_int(SYSVAR_BPP, 4);
617-
}
618-
// end of change
619-
603+
setsysvar_int(SYSVAR_BPP, os_graphics ? os_color_depth : 4);
620604
setsysvar_int(SYSVAR_TRUE, -1);
621605
setsysvar_int(SYSVAR_FALSE, 0);
622606
setsysvar_int(SYSVAR_LINECHART, 1);
@@ -631,7 +615,7 @@ void exec_setup_predefined_variables() {
631615
else {
632616
strcpy(homedir, "/tmp/");
633617
}
634-
l = strlen(homedir);
618+
int l = strlen(homedir);
635619
if (homedir[l - 1] != OS_DIRSEP) {
636620
homedir[l] = OS_DIRSEP;
637621
homedir[l + 1] = '\0';

src/common/device.c

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ void termination_handler(int signum) {
5353
* initialize all drivers
5454
*/
5555
int dev_init(int mode, int flags) {
56-
#if defined(_UnixOS)
57-
int verfd;
58-
// struct utsname uts;
59-
#endif
60-
6156
#if defined(DRV_SOUND)
6257
drvsound_ok = drvsound_init();
6358
#endif
@@ -73,21 +68,6 @@ int dev_init(int mode, int flags) {
7368
os_graphics = mode;
7469
term_init(); // by default
7570
if (mode) {
76-
#if defined(_UnixOS)
77-
char buf[256];
78-
79-
if (term_israw()) {
80-
setsysvar_str(SYSVAR_OSNAME, "Unix/RAW");
81-
} else {
82-
if (getenv("TERM")) {
83-
strcpy(buf, "Unix/Terminal:");
84-
strcat(buf, getenv("TERM"));
85-
setsysvar_str(SYSVAR_OSNAME, buf);
86-
} else {
87-
setsysvar_str(SYSVAR_OSNAME, "Unix/Stream");
88-
}
89-
}
90-
#endif
9171
if (osd_devinit() == 0) {
9272
panic("osd_devinit() failed");
9373
}
@@ -107,95 +87,6 @@ int dev_init(int mode, int flags) {
10787
} else {
10888
dev_fgcolor = 7;
10989
dev_bgcolor = 0;
110-
#if USE_TERM_IO
111-
// term_settextcolor(dev_fgcolor, dev_bgcolor);
112-
#endif
113-
}
114-
115-
#if defined(_UnixOS)
116-
/*
117-
if ( uname(&uts) == 0 ) {
118-
// will use the POSIX's uname()
119-
strcpy(tmp, "Unix/");
120-
strcat(tmp, uts.machine);
121-
strcat(tmp, "/");
122-
strcat(tmp, uts.sysname);
123-
setsysvar_str(SYSVAR_OSNAME, tmp);
124-
}
125-
else {
126-
*/
127-
// will try to read /proc/version
128-
verfd = open("/proc/version", O_RDONLY);
129-
if (verfd != -1) {
130-
char *p;
131-
char verstr[256];
132-
char tmp[300];
133-
int bytes;
134-
135-
memset(verstr, 0, 256);
136-
bytes = read(verfd, verstr, 255);
137-
verstr[(bytes < 256) ? bytes : 255] = '\0';
138-
p = strchr(verstr, '\n');
139-
if (p) {
140-
*p = '\0';
141-
}
142-
close(verfd);
143-
144-
// store name to system constant
145-
strcpy(tmp, "Unix/");
146-
strcat(tmp, verstr);
147-
setsysvar_str(SYSVAR_OSNAME, tmp);
148-
149-
// build OSVER
150-
if ((p = strstr(verstr, "ersion")) != NULL) {
151-
long vi = 0;
152-
int dg = 0;
153-
154-
p += 6;
155-
while (*p == ' ' || *p == '\t') {
156-
p++;
157-
}
158-
while (*p) {
159-
if (is_digit(*p)) {
160-
vi = (vi << 4) + (*p - '0');
161-
dg++;
162-
} else if (*p == '.') {
163-
switch (dg) {
164-
case 0:
165-
vi = vi << 8;
166-
break;
167-
case 1:
168-
vi = vi << 4;
169-
break;
170-
};
171-
172-
dg = 0;
173-
}
174-
else {
175-
break;
176-
}
177-
178-
p++;
179-
} // while (*p)
180-
181-
os_ver = vi;
182-
} // if ver
183-
} // verfd
184-
185-
setsysvar_int(SYSVAR_OSVER, os_ver);
186-
#elif defined(_DOS)
187-
os_ver = ((_osmajor << 16) | (_osminor)) << 8;
188-
setsysvar_int(SYSVAR_OSVER, os_ver);
189-
#else
190-
setsysvar_int(SYSVAR_OSVER, os_ver);
191-
#endif
192-
193-
setsysvar_int(SYSVAR_XMAX, os_graf_mx - 1);
194-
setsysvar_int(SYSVAR_YMAX, os_graf_my - 1);
195-
if (os_graphics) {
196-
setsysvar_int(SYSVAR_BPP, os_color_depth);
197-
} else {
198-
setsysvar_int(SYSVAR_BPP, 4);
19990
}
20091

20192
#if USE_TERM_IO && !defined(__MINGW32__)

src/common/device.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,8 @@ void g_line(int x1, int y1, int x2, int y2, void (*dotproc) (int, int));
100100
* Globals are needed for speed and for memory-usage optimization
101101
*
102102
* @code
103-
* dword os_ver; // OS version (ex: 0x330 for PalmOS 3.3)
104-
*
105103
* byte os_charset; // System's charset (see os_charset_codes)
106104
*
107-
* byte use_sony_clie; // True if the program runs under a Sony CLIE
108-
*
109-
* UInt16 sony_refHR; // Sony's HiRes lib ref
110-
*
111105
* byte os_color; // True if the output has real colors (256+ colors)
112106
*
113107
* dword os_color_depth; // The number of bits of the supported colors
@@ -144,18 +138,11 @@ enum os_charset_codes {
144138
};
145139

146140
#if !defined(DEVICE_MODULE)
147-
extern dword os_ver; // OS version (ex: 0x330 for PalmOS 3.3)
148141
extern byte os_charset;
149142

150-
#if defined(SONY_CLIE)
151-
extern byte use_sony_clie; // true if the program runs under a Sony CLIE
152-
extern UInt16 sony_refHR; // Sony's HiRes lib ref
153-
#endif
154-
155-
extern byte os_color; // true if the output has real colors (256+
156-
// colors)
143+
extern byte os_color; // true if the output has real colors (256+ colors)
157144
extern dword os_color_depth; // the number of bits of the supported colors
158-
// (ex: 8 for 256 colors, 15 or 16 for 64K, 24 or 32 for 1.6M)
145+
// (ex: 8 for 256 colors, 15 or 16 for 64K, 24 or 32 for 1.6M)
159146
extern byte os_graphics; // non-zero if the driver supports graphics
160147
extern int os_graf_mx; // graphic mode: maximum x
161148
extern int os_graf_my; // graphic mode: maximum y

0 commit comments

Comments
 (0)