- Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsbasicw.html
113 lines (113 loc) · 5.08 KB
/
sbasicw.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="utf-8">
<metahttp-equiv="X-UA-Compatible" content="IE=edge">
<metaname="viewport" content="width=device-width, initial-scale=1">
<title>SmallBASIC | sbasicw</title>
<metaname="description" content="SmallBASIC | One more basic">
<linkrel="canonical" href="/sbasicw.html">
<linkrel="keywords" href="sbasicw">
<linkrel="stylesheet" href="/css/style.css">
<linkrel="icon" type="image/png" href="/images/sb-desktop-32x32.png">
<scriptsrc="/clipboard.js"></script>
</head>
<body>
<buttononclick="topFunction()" id="BackToTopBtn" title="Go to top">⯅</button>
<scriptsrc="/backtotop.js"></script>
<divclass="wrapAll clearfix">
<navclass="navigation">
<divclass="logo">
<ahref="/"><imgsrc='/images/sb-logo.png?v=2' alt="logo"></a>
</div>
<divclass="navlinks">
<ahref="/pages/download.html">Download</a>
<ahref="/pages/news.html">News</a>
<ahref="/pages/community.html">Community</a>
<aclass='active' href="/pages/articles.html">Resources</a>
<ahref="/pages/reference.html">Language Reference</a>
<ahref="/pages/guide.html">SmallBASIC Manual</a>
</div>
</nav>
<divclass="mainsection">
<divclass="tabs clearfix">
<divclass="tabsRight">
<atarget="_github" href="https://github.com/smallbasic/smallbasic.github.io/blob/master/_build/pages/sbasicw.markdown">Edit</a>
<atarget="_github" href="https://github.com/smallbasic/smallbasic.github.io/commits/master/_build/pages/sbasicw.markdown">History</a>
</div>
</div>
<divclass="article">
<h1id="sbasicw">SBASICW</h1>
<blockquote>
<p><code>sbasicw</code> is a web server which can display the output of
a SmallBASIC program in a browser. It can also be used to dynamically
generate websites using SmallBASIC commands.</p>
</blockquote>
<h2id="getting-started">Getting started</h2>
<h3id="render-to-canvas">Render to canvas</h3>
<p>Launch <code>sbasicw</code> (Linux) or <code>sbasicw.exe</code>
(Windows) in a folder containing the files of your website. It is quite
helpful, if <code>sbasicw</code> is in the search path. After you
started the web server you can open in your browser the URL
<code>http://127.0.0.1:8080</code>. This will display the file
<code>index.html</code>. You can also load
<code>http://127.0.0.1:8080/myprogram.bas</code>. This will execute the
SmallBASIC file <code>myprogram.bas</code>. The output (graphics and
text) will be rendered to an HTML5 canvas and displayed as a bitmap in
your browser. Only a snapshot of the output is displayed i.e., you would
only see one frame of an animation in your web browser.</p>
<h3id="html-text-output">HTML text output</h3>
<p>Launch the web server in a folder containing the files of your
website with the following command:</p>
<pre><code>sbasicw --graphic-text="0"</code></pre>
<p>If you call a SmallBASIC file, graphics output will still be rendered
to an HTML5 canvas. But output of the <code>print</code> command is
interpreted as text by the browser. You can print HTML and even Java
script commands.</p>
<h2id="transfer-data">Transfer data</h2>
<p><code>sbasicw</code> supports sending data using the get method. To
send variables to a SmallBASIC program add
<code>?var1=value1&var2=value2...&varN=valueN</code> to the URL
of the website. You can then read the values of the variables using the
<code>env()</code> function, for example
<code>v = env("var1")</code>.</p>
<h2id="tutorial">Tutorial</h2>
<p><ahref="/assets/sbasicw_tutorial.zip">sbasicw_tutorial.zip</a>
contains several HTML and SmallBASIC files. To start the tutorial
extract the files to a folder of your choice and launch the web sever in
this folder with:</p>
<pre><code>Linux: sbasicw --graphic-text="0"
Windows: sbasicw.exe --graphic-text="0"</code></pre>
<p>Open a browser and start the tutorial with
<code>http://127.0.0.1:8080</code>. You will learn how to link between
HTML files, dynamically generate HTML files using SmallBASIC, create
forms, process the input of the forms and draw graphics to an HTML
canvas.</p>
<figure>
<imgsrc="/images/sbasicw_screenshot.png"
alt="Page 7 of the tutorial" />
<figcaptionaria-hidden="true">Page 7 of the tutorial</figcaption>
</figure>
<h2id="run-the-web-server-in-the-background">Run the web server in the
background</h2>
<p>If you want to start the web server in the background, use the
following command:</p>
<pre><code>sbasicw &
sbasicw --graphic-text="0" &</code></pre>
<p>If an error message like
<code>[1] + suspended (tty input) sbasicw</code> is displayed, then
start the server with:</p>
<pre><code>sbasicw < /dev/null &
sbasicw --graphic-text="0" < /dev/null &</code></pre>
</div>
<divclass="pagefooter">
This page was last edited on Sat, 29 Jun 2024 22:46:01 +0200
|
<ahref="https://en.wikipedia.org/wiki/Markdown" target="_blank" rel="nofollow">Markdown</a>
processed with
<ahref="https://pandoc.org/MANUAL.html#pandocs-markdown" target="_blank" rel="nofollow">pandoc 3.1.12.1</a>
</div>
</div>
</div>
</body>
</html>