Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2014-08-11
Cleanup system var handling, removed os_ver

2014-08-09
Renamed command "#UNIT-PATH:" to "UNITPATH"
Renamed command "#INC:" to "INCLUDE"
Expand Down
109 changes: 59 additions & 50 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,67 @@

SUBDIRS = @BUILD_SUBDIRS@

EXTRA_DIST = \
AUTHORS \
ChangeLog \
configure.in \
NEWS \
README \
autogen.sh \
src/platform/gtk/sbgtk.glade \
src/platform/gtk/sbgtk.gladep \
src/platform/gtk/debian/changelog \
src/platform/gtk/debian/control \
src/platform/gtk/debian/copyright \
src/platform/gtk/debian/rules \
src/platform/gtk/debian/sbasic.links \
src/platform/sdl/fonts/BI1.c \
src/platform/sdl/fonts/BI2.c \
src/platform/sdl/fonts/BI5.c \
src/platform/sdl/fonts/BI7.c \
src/platform/sdl/fonts/psf2c.c \
documentation/export_csv.bas \
documentation/sbasic_ref.csv \
documentation/HOWTO/HOWTO-DOCUMENT.TXT \
documentation/HOWTO/HOWTO-PORT.TXT \
documentation/HOWTO/DEVELOP.TXT \
documentation/LICENSE \
documentation/README \
documentation/README.BCC \
documentation/README.DEV \
documentation/README.DOS \
documentation/README.HELIO \
documentation/README.PALM \
documentation/README.UNIX \
plugins/publish.bas \
plugins/comment_in.bas \
plugins/comment_out.bas \
plugins/dos2unix.bas \
plugins/indent.bas \
plugins/help.bas \
translator/SB.g \
translator/Makefile \
translator/Translator.java \
images/logo.gif \
images/sb16x16.png \
images/sb32x32.png \
images/sb-desktop-16x16.png \
images/sb-desktop-32x32.png \
ide/smallbasic.lang \
ide/small-basic-mode.el \
ide/smallbasic.syn \
rpm/README \
EXTRA_DIST = \
AUTHORS \
ChangeLog \
configure.in \
NEWS \
README \
autogen.sh \
src/platform/gtk/sbgtk.glade \
src/platform/gtk/sbgtk.gladep \
src/platform/gtk/debian/changelog \
src/platform/gtk/debian/control \
src/platform/gtk/debian/copyright \
src/platform/gtk/debian/rules \
src/platform/gtk/debian/sbasic.links \
src/platform/sdl/fonts/BI1.c \
src/platform/sdl/fonts/BI2.c \
src/platform/sdl/fonts/BI5.c \
src/platform/sdl/fonts/BI7.c \
src/platform/sdl/fonts/psf2c.c \
documentation/export_csv.bas \
documentation/sbasic_ref.csv \
documentation/HOWTO/HOWTO-DOCUMENT.TXT \
documentation/HOWTO/HOWTO-PORT.TXT \
documentation/HOWTO/DEVELOP.TXT \
documentation/LICENSE \
documentation/README \
documentation/README.BCC \
documentation/README.DEV \
documentation/README.DOS \
documentation/README.HELIO \
documentation/README.PALM \
documentation/README.UNIX \
plugins/publish.bas \
plugins/comment_in.bas \
plugins/comment_out.bas \
plugins/dos2unix.bas \
plugins/indent.bas \
plugins/help.bas \
translator/SB.g \
translator/Makefile \
translator/Translator.java \
images/logo.gif \
images/sb16x16.png \
images/sb32x32.png \
images/sb-desktop-16x16.png \
images/sb-desktop-32x32.png \
ide/smallbasic.lang \
ide/small-basic-mode.el \
ide/smallbasic.syn \
rpm/README \
rpm/SPECS/opensuse.spec

install-exec-hook:
(mkdir -p $(DESTDIR)$(pkgdatadir) && \
mkdir -p $(DESTDIR)$(pkgdatadir)/plugins && \
mkdir -p $(DESTDIR)$(pkgdatadir)/ide && \
mkdir -p $(DESTDIR)$(pkgdatadir)/samples && \
cp documentation/sbasic_ref.csv $(DESTDIR)$(pkgdatadir) && \
cp plugins/*.* $(DESTDIR)$(pkgdatadir)/plugins && \
cp ide/*.* $(DESTDIR)$(pkgdatadir)/ide)

deb:
fakeroot dpkg-buildpackage

Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
smallbasic (0.11.12) unstable; urgency=low
* Fixed/implemented INCLUDE command

-- Chris Warren-Smith <cwarrensmith@gmail.com> Sat, 11 August 2014 09:45:25 +1000

smallbasic (0.11.11) unstable; urgency=low
* Built using common code from the android project and SDL

Expand Down
2 changes: 0 additions & 2 deletions samples/distro-examples/tests/call_tau.bas
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ rem check system-variables
predef.prsys




7 changes: 0 additions & 7 deletions samples/distro-examples/tests/output/call_tau.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,4 @@ message from main
message from tau
[1,2,3,4]
Predefined Variables
OS VER =0x0
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
SB VER =0x0
PI =3.14159265358979
XMAX =161
YMAX =42
CWD =/home/chrisws/src/SmallBASIC/src/platform/unix/
HOME =/home/chrisws/
10 changes: 0 additions & 10 deletions samples/distro-examples/tests/predef.bas
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,5 @@ export prsys

sub prsys
? cat(1);"Predefined Variables";cat(0)
? "OS VER =0x"; HEX$(osver)
? "OS NAME="; osname
? "SB VER =0x"; HEX$(sbver)
? "PI ="; pi
? "XMAX ="; xmax
? "YMAX ="; ymax
? "CWD ="; CWD
? "HOME ="; HOME
end



20 changes: 2 additions & 18 deletions src/common/brun.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,32 +591,16 @@ void setsysvar_str(int index, const char *value) {
*/
void exec_setup_predefined_variables() {
char homedir[OS_PATHNAME_SIZE + 1];
#if defined(_UnixOS)
int l;
#endif

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

setsysvar_int(SYSVAR_OSVER, os_ver);
setsysvar_str(SYSVAR_OSNAME, OS_NAME);
setsysvar_str(SYSVAR_SBVER, SB_STR_VER);
setsysvar_num(SYSVAR_PI, SB_PI);

// Change from Haraszti - 30/3/2007 Thanks Atilla :)
// setsysvar_int(SYSVAR_XMAX, 159);
// setsysvar_int(SYSVAR_YMAX, 159);
// setsysvar_int(SYSVAR_BPP, 1);
setsysvar_int(SYSVAR_XMAX, os_graf_mx - 1);
setsysvar_int(SYSVAR_YMAX, os_graf_my - 1);
if (os_graphics) {
setsysvar_int(SYSVAR_BPP, os_color_depth);
}
else {
setsysvar_int(SYSVAR_BPP, 4);
}
// end of change

setsysvar_int(SYSVAR_BPP, os_graphics ? os_color_depth : 4);
setsysvar_int(SYSVAR_TRUE, -1);
setsysvar_int(SYSVAR_FALSE, 0);
setsysvar_int(SYSVAR_LINECHART, 1);
Expand All @@ -631,7 +615,7 @@ void exec_setup_predefined_variables() {
else {
strcpy(homedir, "/tmp/");
}
l = strlen(homedir);
int l = strlen(homedir);
if (homedir[l - 1] != OS_DIRSEP) {
homedir[l] = OS_DIRSEP;
homedir[l + 1] = '\0';
Expand Down
109 changes: 0 additions & 109 deletions src/common/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ void termination_handler(int signum) {
* initialize all drivers
*/
int dev_init(int mode, int flags) {
#if defined(_UnixOS)
int verfd;
// struct utsname uts;
#endif

#if defined(DRV_SOUND)
drvsound_ok = drvsound_init();
#endif
Expand All @@ -73,21 +68,6 @@ int dev_init(int mode, int flags) {
os_graphics = mode;
term_init(); // by default
if (mode) {
#if defined(_UnixOS)
char buf[256];

if (term_israw()) {
setsysvar_str(SYSVAR_OSNAME, "Unix/RAW");
} else {
if (getenv("TERM")) {
strcpy(buf, "Unix/Terminal:");
strcat(buf, getenv("TERM"));
setsysvar_str(SYSVAR_OSNAME, buf);
} else {
setsysvar_str(SYSVAR_OSNAME, "Unix/Stream");
}
}
#endif
if (osd_devinit() == 0) {
panic("osd_devinit() failed");
}
Expand All @@ -107,95 +87,6 @@ int dev_init(int mode, int flags) {
} else {
dev_fgcolor = 7;
dev_bgcolor = 0;
#if USE_TERM_IO
// term_settextcolor(dev_fgcolor, dev_bgcolor);
#endif
}

#if defined(_UnixOS)
/*
if ( uname(&uts) == 0 ) {
// will use the POSIX's uname()
strcpy(tmp, "Unix/");
strcat(tmp, uts.machine);
strcat(tmp, "/");
strcat(tmp, uts.sysname);
setsysvar_str(SYSVAR_OSNAME, tmp);
}
else {
*/
// will try to read /proc/version
verfd = open("/proc/version", O_RDONLY);
if (verfd != -1) {
char *p;
char verstr[256];
char tmp[300];
int bytes;

memset(verstr, 0, 256);
bytes = read(verfd, verstr, 255);
verstr[(bytes < 256) ? bytes : 255] = '\0';
p = strchr(verstr, '\n');
if (p) {
*p = '\0';
}
close(verfd);

// store name to system constant
strcpy(tmp, "Unix/");
strcat(tmp, verstr);
setsysvar_str(SYSVAR_OSNAME, tmp);

// build OSVER
if ((p = strstr(verstr, "ersion")) != NULL) {
long vi = 0;
int dg = 0;

p += 6;
while (*p == ' ' || *p == '\t') {
p++;
}
while (*p) {
if (is_digit(*p)) {
vi = (vi << 4) + (*p - '0');
dg++;
} else if (*p == '.') {
switch (dg) {
case 0:
vi = vi << 8;
break;
case 1:
vi = vi << 4;
break;
};

dg = 0;
}
else {
break;
}

p++;
} // while (*p)

os_ver = vi;
} // if ver
} // verfd

setsysvar_int(SYSVAR_OSVER, os_ver);
#elif defined(_DOS)
os_ver = ((_osmajor << 16) | (_osminor)) << 8;
setsysvar_int(SYSVAR_OSVER, os_ver);
#else
setsysvar_int(SYSVAR_OSVER, os_ver);
#endif

setsysvar_int(SYSVAR_XMAX, os_graf_mx - 1);
setsysvar_int(SYSVAR_YMAX, os_graf_my - 1);
if (os_graphics) {
setsysvar_int(SYSVAR_BPP, os_color_depth);
} else {
setsysvar_int(SYSVAR_BPP, 4);
}

#if USE_TERM_IO && !defined(__MINGW32__)
Expand Down
17 changes: 2 additions & 15 deletions src/common/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,8 @@ void g_line(int x1, int y1, int x2, int y2, void (*dotproc) (int, int));
* Globals are needed for speed and for memory-usage optimization
*
* @code
* dword os_ver; // OS version (ex: 0x330 for PalmOS 3.3)
*
* byte os_charset; // System's charset (see os_charset_codes)
*
* byte use_sony_clie; // True if the program runs under a Sony CLIE
*
* UInt16 sony_refHR; // Sony's HiRes lib ref
*
* byte os_color; // True if the output has real colors (256+ colors)
*
* dword os_color_depth; // The number of bits of the supported colors
Expand Down Expand Up @@ -144,18 +138,11 @@ enum os_charset_codes {
};

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

#if defined(SONY_CLIE)
extern byte use_sony_clie; // true if the program runs under a Sony CLIE
extern UInt16 sony_refHR; // Sony's HiRes lib ref
#endif

extern byte os_color; // true if the output has real colors (256+
// colors)
extern byte os_color; // true if the output has real colors (256+ colors)
extern dword os_color_depth; // the number of bits of the supported colors
// (ex: 8 for 256 colors, 15 or 16 for 64K, 24 or 32 for 1.6M)
// (ex: 8 for 256 colors, 15 or 16 for 64K, 24 or 32 for 1.6M)
extern byte os_graphics; // non-zero if the driver supports graphics
extern int os_graf_mx; // graphic mode: maximum x
extern int os_graf_my; // graphic mode: maximum y
Expand Down
Loading