Skip to content

Commit f2e7576

Browse files
committed
DOC: update reference index
1 parent b1da5d5 commit f2e7576

File tree

109 files changed

+584
-416
lines changed

Some content is hidden

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

109 files changed

+584
-416
lines changed

_build/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pandoc = /usr/bin/pandoc
1818
# variables
1919
mkdir = @mkdir -p $(dir $@)
2020
out = _out
21-
pandoc_options=--smart --to html5
21+
pandoc_options=--to html5
2222
bas = $(patsubst layouts/%.html, $(out)/%.bas, $(wildcard layouts/*.html))
2323
pages = $(patsubst pages/%.markdown, $(out)/pages4/%.html, $(wildcard pages/*.markdown))
2424
reference = $(patsubst reference/%.markdown, $(out)/reference3/%.html, $(wildcard reference/*.markdown))

_build/includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<meta charset="utf-8">
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
5-
<title>{{ page.title }}</title>
5+
<title>SmallBASIC - {{ page.name }}</title>
66
<meta name="description" content="{{ page.help }}">
77
<link rel="canonical" href="{{ page.url }}">
88
<link rel="keywords" href="{{ page.title }}">

_build/page.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ else
3737
package = item.package
3838
filepath = item.nodeId + "-" + lower(item.package) + "-" + lower(item.keyword) + ".markdown"
3939
filepath = "reference/" + translate(filepath, " ", "")
40-
lastedit = run("git log -1 --format=\"%aD\" -- " + filepath)
40+
lastedit = run("git log -1 --format=\"%cD by %cn\" -- " + filepath)
4141
sourceurl = "https://github.com/smallbasic/smallbasic.github.io/blob/master/_build/" + filepath
4242
changesurl = "https://github.com/smallbasic/smallbasic.github.io/commits/master/_build/" + filepath
4343
endif

_build/pages/reference.markdown

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,35 @@ Language reference
44
BASIC is a very simple language and it is a perfect tool for calculations or utilities.
55
Its name stands for (B)eginners (A)ll-purpose (S)ymbolic (I)nstruction (c)ode. It was developed by John
66
Kemeny and Thomas Kurtz at Dartmouth College during the middle of 1960, and was one of the most
7-
popular languages for several decades. {.roleNote}
7+
popular languages for several decades.
8+
9+
::: contentsPanel ::
10+
::: contentsHeader ::
11+
Contents
12+
:::
13+
14+
#. [Console](/reference/521.html)
15+
#. [Data](/reference/581.html)
16+
#. [Date](/reference/575.html)
17+
#. [File](/reference/580.html)
18+
#. [Graphics](/reference/611.html)
19+
#. [Language](/reference/622.html)
20+
#. [Math](/reference/704.html)
21+
#. [String](/reference/771.html)
22+
#. [System](/reference/1439.html)
23+
:::
824

925
How to read the language reference syntax
1026
-----------------------------------------
1127

12-
* Everything written inside of [] characters are optional values.
13-
* Everything written inside of { characters means you must select one of them.
14-
* The symbol | means OR.
15-
* The symbols ... mean you can repeat the previous syntax.
16-
* Keywords are written with capital letters.
17-
* Parameters are written with lower letters.
18-
* Keywords with suffix () are functions.
19-
* Parameters with suffix () are arrays.
28+
+ Everything written inside of [] characters are optional values.
29+
+ Everything written inside of { characters means you must select one of them.
30+
+ The symbol | means OR.
31+
+ The symbols ... mean you can repeat the previous syntax.
32+
+ Keywords are written with capital letters.
33+
+ Parameters are written with lower letters.
34+
+ Keywords with suffix () are functions.
35+
+ Parameters with suffix () are arrays.
2036

2137
~~~
2238
FOO <- This is keyword
@@ -30,27 +46,16 @@ foo() <- This is array/parameter
3046
The following example means that you must give the first parameter (a) but you can use the second (x)
3147
only if you want to. But if you want to use the (x) you must also separate it from (a) with a comma.
3248

33-
~~~FOO a[, x]~~~
49+
~~~
50+
FOO a[, x]
51+
~~~
3452

3553
The next example means that you must use the first parameter. You can also use second parameter
3654
but you must separate it with ',' or ';'. You can also repeat the last syntax more times.
3755

38-
~~~FOO var [{,|;} var2 [...]]~~~
39-
40-
<div class="contentsPanel">
41-
<div class="contentsHeader">Contents</div>
42-
<ul>
43-
<li><span>1</span><a href="/reference/521.html">Console</a></li>
44-
<li><span>2</span><a href="/reference/581.html">Data</a></li>
45-
<li><span>3</span><a href="/reference/575.html">Date</a></li>
46-
<li><span>4</span><a href="/reference/580.html">File</a></li>
47-
<li><span>5</span><a href="/reference/611.html">Graphics</a></li>
48-
<li><span>6</span><a href="/reference/662.html">Language</a></li>
49-
<li><span>7</span><a href="/reference/704.html">Math</a></li>
50-
<li><span>8</span><a href="/reference/771.html">String</a></li>
51-
<li><span>9</span><a href="/reference/1439.html">System</a></li>
52-
</ul>
53-
</div>
56+
~~~
57+
FOO var [{,|;} var2 [...]]
58+
~~~
5459

5560
You can find
5661
------------
@@ -64,12 +69,10 @@ STEP under Graphics, aspect under Graphics, FILLED under Graphics, QBcolors und
6469
"system variables" AKA built in coder constants under System eg, pi, xmax, ymax, cwd...
6570
INCLUDE under System
6671

67-
Allot of information is under Articles > "Welcome to SmallBASIC":
72+
Alot of information is under Articles > "Welcome to SmallBASIC"
6873
operators eg ~ % ^ ! IN LIKE
6974
special characters eg [ , ;] ARRAY definition << append to array
7075
basic stuff about variables, subs and functions
7176
aha! stuff on units, meta commands, options, pseudo operators
7277

7378
TRY CATCH THROW ENDTRY ... located in Language ref > Language unsorted list
74-
75-

_build/reference/1015-console-definekey.markdown

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ sub moveLeft
1212
end
1313
defineKey 0xFF04, moveLeft
1414
Refer to keymap.h in the SVN repository for key definitions. TODO: create a keys.bas unit for key constants
15-
<pre>
15+
16+
~~~
1617
1718
' DEFINEKEY demo.bas SmallBASIC 0.12.2 [B+=MGA] 2016-03-30
1819
'remember Etch-A-Sketch?
@@ -78,9 +79,10 @@ sub quit
7879
stop
7980
end
8081
81-
</pre>
82+
~~~
83+
8284

83-
<pre>
85+
~~~
8486
8587
' Note:
8688
' * You may Include "definekey_const.bas" file in another file to make your code more clear.
@@ -169,5 +171,5 @@ Const DK_MK_WHEEL = 0xFFC4
169171
Const DK_MK_FIRST = DK_MK_PUSH
170172
Const DK_MK_LAST = DK_MK_WHEEL
171173
172-
</pre>
174+
~~~
173175

_build/reference/1425-language-try.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ The TRY statement introduces a TRY/CATCH BLOCK
88

99
Note:
1010
If this demo program crashes... then run it again. It seems that TRY / CATCH block might be unstable within a function or sub... (?)
11-
<pre>
11+
12+
~~~
1213
1314
' See also: Home -- Articles -- TRY / CATCH
1415
Const FILE_NAME = "try demo.tmp" ' -- DON'T use existing file for demo.
@@ -73,5 +74,5 @@ If fn Then
7374
Fi
7475
Pause
7576
76-
</pre>
77+
~~~
7778

_build/reference/1432-data-array.markdown

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
Creates a ARRAY or MAP variable from the given string or expression
66

7-
<pre>
7+
8+
~~~
89
910
' See also Article "New features" -> "User defined structures".
1011
Def uline(text) = Cat(2) + text + Cat(-2) ' Underline text
@@ -78,7 +79,7 @@ b.title = "Top-Left"
7879
?:?:? " Press any key..."
7980
Pause
8081
81-
</pre>
82+
~~~
8283

8384
Thank you.
8485
Ah, new stuff!
@@ -108,13 +109,14 @@ Here I quote Chris from Home -- Forums -- Project help -- Tile Map Editor:
108109
<blockquote>
109110
...
110111
If you click File / Export and save the output in JSON format, you can then use the output in a SmallBASIC program like this:
111-
<pre>
112+
113+
~~~
112114
113115
tload "map.json" , buffer, 1
114116
tiles= array(buffer)
115117
? tiles.layers(0).data(0)
116118
117-
</pre>
119+
~~~
118120

119121
...
120122
</blockquote>
@@ -123,7 +125,8 @@ That's useful but can it be applied to other ARRAY types? For example I can make
123125
I've copy this code from JSON Wikipedia, it seems like JSON supports more then one
124126
dimension according to the example...
125127
The following example shows a possible JSON representation describing a person:
126-
<pre>
128+
129+
~~~
127130
128131
{
129132
"firstName": "John",
@@ -154,7 +157,7 @@ The following example shows a possible JSON representation describing a person:
154157
"spouse": null
155158
}
156159
157-
</pre>
160+
~~~
158161

159162
This what Chris wrote at Home -- Forums -- Announcements (10/02/2014):
160163
<blockquote>
@@ -175,7 +178,8 @@ Home -- Forums -- Project help -- Tile Map Editor -- coffee first...
175178
It shows how easy is to save and load ordinary array with more than one dimension, by using the WRITE and READ keywords to save and load array variables in binary format.
176179
I am trying to make a dictionary with two columns as part of writing an assembler. I can SEARCH the first column and use (0,1) then (1,1) to look up the second column if I REDIM the array loaded from a file.
177180
But I cannot see a way to load the file with two dimensions.
178-
<pre>
181+
182+
~~~
179183
180184
REM SmallBASIC
181185
REM created: 03/04/2016
@@ -222,11 +226,12 @@ SEARCH i, "JEQ", r
222226
? "jump = ",i(0,r)
223227
? "binary = ",i(1,r)
224228
225-
</pre>
229+
~~~
226230

227231
See: Home -- Language reference -- File -- TLOAD -- How to convert TLOAD's array into nested array
228232
Thanks for your help but REDIM works for me.
229-
<pre>
233+
234+
~~~
230235
231236
? "OPEN \\"dest\\" FOR INPUT AS #1"
232237
OPEN "dest" FOR INPUT AS #1

_build/reference/1439-system-chain.markdown

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
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.
66

7-
<pre>
7+
8+
~~~
89
910
' Note: CHAIN behaves like EVAL function in other languages.
1011
Option Base 1 ' (for 'IN' keyword which is 1-Based)
@@ -48,9 +49,10 @@ Color 15 ' print the return value from file
4849
? " (Return value SB1 is: "; Env("SB1"); ")" ' (i is 6)
4950
Pause
5051
51-
</pre>
52+
~~~
53+
5254

53-
<pre>
55+
~~~
5456
5557
Const FILENAME = "demo.bas"
5658
' Create demo bas file (could be any SmallBASIC file):
@@ -83,9 +85,10 @@ Color 7: ? "I'm The Parent Program..."
8385
Color 15: ? "Child program returned value: "; Env("SB1")
8486
Pause
8587
86-
</pre>
88+
~~~
89+
8790

88-
<pre>
91+
~~~
8992
9093
' Dedicated to MGA.
9194
' s is any legal SmallBASIC Math Expression as String, e.g. "1 + 2 / 4"
@@ -106,5 +109,5 @@ End Func
106109
? eval("Rad((45 * 3) - 20) * 2")
107110
Pause
108111
109-
</pre>
112+
~~~
110113

_build/reference/1443-system-exec.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
55
Transfers control to another operating system program.
66

7-
<pre>
7+
8+
~~~
89
910
Const IS_LINUX = (Left(HOME, 1) = "/") ' Check if it's Linux system
1011
Const IS_WINDOWS = Not IS_LINUX
@@ -51,7 +52,7 @@ End Select
5152
? "Done.";
5253
Pause
5354
54-
</pre>
55+
~~~
5556

5657
Apparently, RUN/EXEC have bugs in SmallBASIC version 0.12.2...:
5758
chrisws replied on Sun, 04/24/2016 - 00:29 http://smallbasic.sourceforge.net/?q=comment/1187#comment-1187

0 commit comments

Comments
 (0)