Skip to content

Commit e14b006

Browse files
committed
Merge pull request #40 from chrisws/0_11_20
0 12 5
2 parents 171a1b4 + cbdf3aa commit e14b006

Some content is hidden

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

63 files changed

+2232
-1284
lines changed

ChangeLog

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1-
2016-02-18
2-
Removed TICKSPERSEC, TICKS now returns millisecond intervals
1+
2016-03-29 (0.12.6)
2+
Removed TICKSPERSEC
3+
Removed BALLOC, MALLOC and VADR keywords. Removed duplicate ENVIRON
4+
Removed system constants BPP and VIDADR, OSNAME, LINECHART, BARCHART
5+
Added TIMESTAMP to return the modified-datetime of a file
6+
Added LSHIFT and RSHIFT bit shift operators
7+
SBVER now includes build information
8+
TICKS now returns millisecond intervals
39
Refactor eval() for performance
410
Fixed some memory leaks in the ui handler
511
Editor now restores cursor when returning from run
12+
Editor now displays the correct filename in the title bar
613
Added "industrial" editor theme from Shian (slot 2)
14+
Fixed editor highlighting
715
Runtime errors now show source screen with red error highlighter
816
Form refresh command now takes an boolean arg, true=push ui state to vars
9-
Removed BALLOC, MALLOC and VADR keywords
17+
The IMAGE argument can now be PNG data stored in an INT array
18+
The IMAGE argument can now be x,y,w,h screen corordinates
19+
The IMAGE argument can now be a 2-D array of POINTS
20+
Updated IMAGE sub-command to save 2-D array of POINT
21+
Added window.setFont command to set font size, bold and italic. example:
22+
w = window():w.setFont(10, "pt", false, true)
23+
TRUE is now always returned as 1
24+
Added file manager to main shell program
25+
Fixed problem with escaped chars using FORMAT
26+
Fixed problem with XNOR command result
27+
Fixed problem with IMP and EQV command result
28+
Fixed issues with INKEY command to allow ALT/SHIFT/CTRL states to be returned
29+
Fixed capslock handling
30+
Fixed issues with TRY/CATCH
31+
Fixed using POINT to retrieve IMAGE data
32+
Fixed issues with CHAIN
33+
Fixed TLOAD to work correctly with TRY/CATCH
34+
Fixed XPOS and YPOS to return 0 based values
1035

1136
2016-02-11
1237
Added export to mobile command (SDL)

configure.ac

Lines changed: 3 additions & 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.5])
10+
AC_INIT([smallbasic], [0.12.6])
1111
AC_CONFIG_SRCDIR([configure.ac])
1212

1313
AC_CANONICAL_TARGET
@@ -364,6 +364,8 @@ checkDebugMode
364364
checkForWindows
365365

366366
PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Wno-unused-result"
367+
BUILD_DATE=`date +"%a, %d %b %Y"`
368+
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])
367369

368370
AC_SUBST(PACKAGE_CFLAGS)
369371
AC_SUBST(PACKAGE_LIBS)

debian/changelog

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

documentation/build_kwp.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ bool isKeyword(const char *keyword) {
9595
}
9696
}
9797

98+
const char* constants[] = {
99+
"SBVER", "PI", "XMAX", "YMAX", "TRUE", "FALSE", "CWD", "HOME", "COMMAND", ""
100+
};
101+
for (int i = 0; !result && constants[i] != '\0'; i++) {
102+
if (strcasecmp(constants[i], keyword) == 0) {
103+
result = true;
104+
}
105+
}
106+
98107
return result;
99108
}
100109

@@ -223,8 +232,8 @@ uint32_t getHash(const char *key) {
223232
uint32_t hash, i;
224233
for (hash = i = 0; key[i] != '\0'; i++) {
225234
hash += tolower(key[i]);
226-
hash += (hash << 3);
227-
hash ^= (hash >> 1);
235+
hash += (hash << 4);
236+
hash ^= (hash >> 2);
228237
}
229238
return hash;
230239
}
@@ -264,7 +273,7 @@ int main(int argc, char *argv[]) {
264273
HelpItem *item = (*it);
265274
if (strcasecmp(item->package, "Language") == 0) {
266275
count++;
267-
fprintf(stdout, " %uu,\n", getHash(item->keyword));
276+
fprintf(stdout, " %uu, //%s\n", getHash(item->keyword), item->keyword);
268277
}
269278
}
270279
fprintf(stdout, "};\n");
@@ -276,7 +285,7 @@ int main(int argc, char *argv[]) {
276285
HelpItem *item = (*it);
277286
if (strcasecmp(item->package, "Language") != 0) {
278287
count++;
279-
fprintf(stdout, " %uu,\n", getHash(item->keyword));
288+
fprintf(stdout, " %uu, //%s\n", getHash(item->keyword), item->keyword);
280289
}
281290
}
282291
fprintf(stdout, "};\n");

documentation/mkref.bas

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ in_map = array(in_str)
2323

2424
if (len(args) == 2 && args(1) == "txt") then
2525
mk_text_reference(in_map)
26+
elif (len(args) == 2 && args(1) == "bas") then
27+
mk_bas(in_map)
2628
else
2729
mk_help(in_map)
2830
fi
@@ -56,6 +58,20 @@ func fix_comments(comments, keyword)
5658
fix_comments = comments
5759
end
5860

61+
sub mk_bas(byref in_map)
62+
local i, row, group, keyword
63+
local in_map_len = len(in_map) - 1
64+
for i = 0 to in_map_len
65+
row = in_map(i).body_value
66+
keyword = get_field(row, "keyword=", true)
67+
group = get_field(row, "group=", true)
68+
? group + " " + keyword
69+
while (i + 1 < in_map_len && in_map(i).entity_id == in_map(i + 1).entity_id)
70+
i++
71+
wend
72+
next i
73+
end
74+
5975
sub mk_help(byref in_map)
6076
local i, row, group, type, keyword, syntax, brief
6177
local in_map_len = len(in_map) - 1

documentation/sbasic_ref.csv

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ Date,command,TIMEHMS,574,"TIMEHMS hms| timer, BYREF h, BYREF m, BYREF s","Conver
4949
Date,function,DATE,575,"DATE","Returns the current date as string ""DD/MM/YYYY""."
5050
Date,function,DATEFMT,576,"DATEFMT (format, dmy| (d,m,y)| julian_date)","Returns formatted date string."
5151
Date,function,JULIAN,577,"JULIAN (dmy| (d,m,y))","Returns the Julian date. (dates must be greater than 1/1/100 AD)."
52+
Date,function,TICKS,1448,"TICKS","Returns the number of milliseconds that have elapsed between successive calls."
5253
Date,function,TIME,578,"TIME","Returns the current time as string ""HH:MM:SS""."
54+
Date,function,TIMER,1449,"TIMER","Returns the number of seconds from midnight."
55+
Date,function,TIMESTAMP,1450,"TIMESTAMP filename","Returns the file last modified date and time."
5356
Date,function,WEEKDAY,579,"WEEKDAY (dmy| (d,m,y)| julian_date)","Returns the day of the week (0 = Sunday)."
5457
File,command,ACCESS,580,"ACCESS (file)","Returns the access rights of the file."
5558
File,command,BLOAD,582,"BLOAD filename[, address]","Loads a specified memory image file into memory."
@@ -71,7 +74,6 @@ File,command,SEEK,597,"SEEK #fileN; pos","Sets file position for the next read/w
7174
File,command,TLOAD,598,"TLOAD file, BYREF var [, type]","Loads a text file into array variable. Each text-line is an array element. type 0 = load into array (default), 1 = load into string."
7275
File,command,TSAVE,599,"TSAVE file, var","Writes an array to a text file. Each array element is a text-line."
7376
File,command,WRITE,600,"WRITE #fileN; var1 [, ...]","Store variables to a file as binary data."
74-
File,function,ACCESS,601,"ACCESS (file)","Returns the access rights of the file."
7577
File,function,BGETC,602,"BGETC (fileN)","Reads and returns a byte from file or device (Binary mode) ."
7678
File,function,EOF,603,"EOF (fileN)","Returns true if the file pointer is at end of the file. For COMx and SOCL VFS returns true if the connection is broken."
7779
File,function,EXIST,604,"EXIST (file)","Returns true if file exists."
@@ -106,6 +108,16 @@ Graphics,function,TXTW,634,"TXTW (s)","Returns the text width of string s in pix
106108
Graphics,function,XPOS,635,"XPOS","Returns the current X position of the cursor in ""characters""."
107109
Graphics,function,YPOS,636,"YPOS","Returns the current Y position of the cursor in ""characters""."
108110
Language,command,CALL,637,"CALL (fp)","Invoke a sub or func by address pointer."
111+
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"
114+
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"
118+
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."
109121
Language,function,IFF,638,"IFF expr","Inline version of IF. eg, animal = ""cat"": fur = IFF( animal = ""cat"", ""yes"", ""no""): ? fur"
110122
Language,keyword,AS,1424,"AS #fileN","See: OPEN"
111123
Language,keyword,BG,1428,"SOUND frq, dur [, vol] [BG]","Play sound in the background. This prevent the program from blocking while the sound plays."
@@ -120,12 +132,9 @@ Language,keyword,ELSE,644,"ELSE","foo = 2: if foo==1: ? ""one"": ELSE: ? ""not o
120132
Language,keyword,ELSEIF,645,"ELSEIF","foo = 2: if foo==1: ? ""one"": ELSEIF foo==2: ? ""two"": fi"
121133
Language,keyword,END TRY,1427,"END TRY","The END TRY statement marks the end of a TRY/CATCH block."
122134
Language,keyword,ENDIF,646,"ENDIF","foo = 1: if foo==1: ? ""one"": ENDIF"
123-
Language,keyword,EXEC,647,"EXEC file","Transfers control to another operating system program."
124135
Language,keyword,EXIT,648,"EXIT [FOR|LOOP|SUB|FUNC]","Exits a multi line function definition, a loop, or a subprogram. By default (if no parameter is specified) exits from last command block (loop, for-loop or routine)."
125-
Language,keyword,EXPORT,649,"EXPORT thing","Export a SUB, FUNC or variable from a UNIT to be used by the unit consumer."
126136
Language,keyword,FI,650,"FI","Declares the end of an IF statement. Same as ENDIF."
127137
Language,keyword,FUNC,651,"FUNC foo (a, b)","Declares a function. Return a value by assigning a 'variable' with the same name as the function."
128-
Language,keyword,IMPORT,652,"IMPORT","Import an exported UNIT variable, SUB or FUNC."
129138
Language,keyword,LOCAL,653,"LOCAL","Declare local variables inside a SUB or FUNC. Local variables no longer exist once the SUB or FUNC has returned."
130139
Language,keyword,NEXT,654,"NEXT","See FOR."
131140
Language,keyword,SELECT,655,"SELECT CASE expr","Perform multiple tests on the expression. Offers a more concise syntax to writing successive IF tests."
@@ -135,7 +144,6 @@ Language,keyword,SUB,657,"SUB foo (a, b)","Declare a sub procedure. Sub's do not
135144
Language,keyword,THEN,658,"THEN","foo = 1: if foo==1 THEN: ? ""one"": fi"
136145
Language,keyword,TO,1420,"FOR t = 1 TO 10","Specifies the loop counter end in a FOR loop"
137146
Language,keyword,TRY,1425,"TRY","The TRY statement introduces a TRY/CATCH BLOCK"
138-
Language,keyword,UNIT,659,"UNIT name","Units are a set of procedures, functions and/or variables that can be used by another program or unit."
139147
Language,keyword,UNTIL,660,"UNTIL","a = 0: repeat: a++: ? a: UNTIL a = 10"
140148
Language,keyword,USE,661,"USE","Used with various commands for passing a user-defined expression. eg SPLIT s,"" "",v USE TRIM(x). Trim each element of v."
141149
Language,keyword,USG,1423,"PRINT USG","Synonym for USING"
@@ -144,7 +152,7 @@ Language,operator,AND,662,"a AND b","Logical AND. Right side is not evaluated if
144152
Language,operator,BAND,663,"a BAND b","Bitwise AND."
145153
Language,operator,BOR,664,"a BOR b","Bitwise OR."
146154
Language,operator,EQV,665,"a EQV b","Bitwise equivalence."
147-
Language,operator,IMP,666,"a IMP b","Bitwise IMP."
155+
Language,operator,IMP,666,"a IMP b","Used to perform a logical implication on two expressions."
148156
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."
149157
Language,operator,LIKE,668,"a LIKE b","Regular-expression operator. Compares the left part of the expression with the right side regex pattern."
150158
Language,operator,MDL,669,"MDL","Modulus."
@@ -155,7 +163,6 @@ Language,operator,NOT,673,"a NOT b","Invert expression result. Equivalent syntax
155163
Language,operator,OR,674,"a OR b","Logical OR. Right side is not evaluated if left side evaluates to True."
156164
Language,operator,XNOR,675,"a XNOR b","Bitwise exclusive NOT OR."
157165
Language,operator,XOR,676,"a XOR b","Bitwise exclusive OR. Equivalent syntax to: a ~ b"
158-
Language,statement,CHAIN,677,"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."
159166
Language,statement,CONST,678,"CONST name = expr","Declare a variable who's value does not change during program execution."
160167
Language,statement,END,679,"END","Declares the END of a SUB or FUNC."
161168
Language,statement,FOR,680,"FOR expr","Defines a FOR/NEXT loop. FOR counter = start TO end [STEP incr] ... NEXT. FOR element IN array (or map) ... NEXT."
@@ -165,7 +172,6 @@ Language,statement,IF,683,"IF expr","Tests the expression and IF it evaluates to
165172
Language,statement,LABEL,684,"LABEL name","Defines a label. A label marks a position in the code."
166173
Language,statement,LET,685,"LET var=expr","Assigns a value to the variable."
167174
Language,statement,ON,686,"ON GOTO|GOSUB label1 [, ..., labelN]","Causes a branch to one of a list of labels."
168-
Language,statement,OPTION,687,"OPTION keyword","Used to pass parameters to the run-time environment."
169175
Language,statement,REM,688,"REM comment","Code comments. Comments can also be introduced using # and single quote character. "
170176
Language,statement,REPEAT,689,"REPEAT ... UNTIL expr","Begins the definition of a REPEAT/UNTIL loop."
171177
Language,statement,RETURN,690,"RETURN","Execution branches to the command immediately following the most recent GOSUB command."
@@ -286,18 +292,19 @@ String,function,UCASE,803,"UCASE (s)","Converts the string s to upper case."
286292
String,function,UPPER,804,"UPPER (s)","Converts the string s to upper case."
287293
String,function,VAL,805,"VAL (s)","Returns the numeric value of string s."
288294
System,command,DELAY,806,"DELAY ms","Delay for a specified amount of milliseconds. Note 'delay' depends on the system clock."
289-
System,command,ENV,807,"ENV expr","See ENVIRON."
290-
System,command,ENVIRON,808,"ENVIRON expr","Adds a variable to or deletes a variable from the current environment variable-table."
295+
System,command,ENV,807,"ENV expr","Adds a variable to or deletes a variable from the current environment variable-table."
291296
System,command,PAUSE,809,"PAUSE [secs]","Pauses the execution for a specified length of time, or until user hit the keyboard."
292297
System,command,RANDOMIZE,810,"RANDOMIZE [int]","Seeds the random number generator."
293298
System,command,STKDUMP,812,"STKDUMP","Display internal execution stack."
294-
System,command,THROW,811,"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."
295299
System,command,TROFF,813,"TROFF","See TRON."
296300
System,command,TRON,814,"TRON","When trace mechanism is ON, displays each line number as the program is executed."
297-
System,function,ENV,815,"ENV expr","See ENVIRON."
298-
System,function,ENVIRON,816,"ENVIRON 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)."
301+
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)."
299302
System,function,FRE,606,"FRE (x)","Returns system information. eg, 0 = free memory, "
300303
System,function,PROGLINE,817,"PROGLINE","Returns the current program line number."
301304
System,function,RUN,818,"RUN cmdstr","Loads a secondary copy of system's shell and, executes an program, or an shell command."
302-
System,function,TICKS,819,"TICKS","Returns the number of milliseconds that have elapsed between successive calls."
303-
System,function,TIMER,821,"TIMER","Returns the number of seconds from midnight."
305+
System,keyword,EXEC,1443,"EXEC file","Transfers control to another operating system program."
306+
System,keyword,EXPORT,1440,"EXPORT thing","Export a SUB, FUNC or variable from a UNIT to be used by the unit consumer."
307+
System,keyword,IMPORT,1441,"IMPORT","Import an exported UNIT variable, SUB or FUNC."
308+
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."
309+
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."
310+
System,statement,OPTION,1442,"OPTION keyword","Used to pass parameters to the run-time environment."

0 commit comments

Comments
 (0)