From 1e1e6966fc964c3078b562c7eb96c55326977d2f Mon Sep 17 00:00:00 2001
From: Joerg Siebenmorgen
Date: Wed, 16 Apr 2025 21:01:13 +0200
Subject: [PATCH] Add android file transfer
---
_build/pages/android_file_transfer.markdown | 18 +++
_build/pages/articles.markdown | 1 +
_build/pages/guide.markdown | 93 ++++++++++---
pages/android_file_transfer.html | 71 ++++++++++
pages/articles.html | 2 +
pages/guide.html | 143 +++++++++++++-------
6 files changed, 258 insertions(+), 70 deletions(-)
create mode 100644 _build/pages/android_file_transfer.markdown
create mode 100644 pages/android_file_transfer.html
diff --git a/_build/pages/android_file_transfer.markdown b/_build/pages/android_file_transfer.markdown
new file mode 100644
index 00000000..f0b3d0bf
--- /dev/null
+++ b/_build/pages/android_file_transfer.markdown
@@ -0,0 +1,18 @@
+# SmallBASIC File Transfer
+
+Easy file transfer between your Android device and your desktop using WIFI.
+
+## Step-by-Step Guide
+
+1. Enable WIFI on your mobile to access your home network.
+2. In the [setup]-screen, select a font, enable extensions and give a port number, for example 5432.
+3. Follow the instructions to restart SmallBASIC.
+4. Open the [about]-screen to display the device IP and token.
+5. On your desktop browser, enter http://device-ip:port. For example: http://192.168.1.5:5432.
+6. You should see a login screen with "Enter your access token".
+7. Enter the token as shown in the [about]-page.
+8. You can now upload and download SmallBASIC files between your desktop and your mobile.
+
+
+
+
\ No newline at end of file
diff --git a/_build/pages/articles.markdown b/_build/pages/articles.markdown
index 7d4e1d3b..ef67961f 100644
--- a/_build/pages/articles.markdown
+++ b/_build/pages/articles.markdown
@@ -21,6 +21,7 @@
- [Setup external editors](/pages/language_support.html)
- [Distribute your program](/pages/distributiontool.html)
- [SmallBASIC web server](/pages/sbasicw.html)
+- [SmallBASIC file transfer](/pages/android_file_transfer.html)
## Plugins
diff --git a/_build/pages/guide.markdown b/_build/pages/guide.markdown
index 58eb3f02..c39f65e9 100644
--- a/_build/pages/guide.markdown
+++ b/_build/pages/guide.markdown
@@ -47,6 +47,7 @@ Contents
* [Maps as Pseudo Objects for OOP](#MapsAsPseudoObjectForOOP)
* [Operators](#Operators)
* [Pseudo-operators](#pseudo)
+* [Expressions](#Expressions)
* [Subroutines and Functions](#SubroutinesAndFunctions)
* [Names](#SubroutinesAndFunctionsNames)
* [Declaration of Subroutines](#DeclarationOfSubroutines)
@@ -57,7 +58,7 @@ Contents
* [Using Local Variables](#UsingLocalVariables)
* [Nested Routines](#NestedRoutines)
* [Declarations in PalmOS](#DeclarationsInPalmOS)
-* [Expressions](#Expressions)
+* [Conditions](#Conditions)
* [IF-THEN-ELSIF-ELSE](#IfThenElseifEndif)
* [Single-line IF-THEN-ELSE](#SingleLineIfThenElse)
* [Inline Version of IF](#InlineVersionOfIf)
@@ -71,12 +72,15 @@ Contents
* [Units](#Units)
* [Declaration](#UnitsDeclaration)
* [Import](#UnitsImport)
+* [Input and Output](#InputAndOutput)
+ * [Print on Screen](#PrintOnScreen)
+ * [Read Input from the Keyboard](#ReadInputFromKeyboard)
+* [The USE Keyword](#TheUseKeyword)
* [OPTION](#Statement1)
* [OPTION BASE](#Statement2)
* [OPTION MATCH](#Statement3)
* [OPTION PREDEF](#Statement4)
* [Meta Commands](#Meta)
-* [The USE Keyword](#TheUseKeyword)
* [Exception Handling](#ExceptionHandling)
:::
@@ -100,7 +104,7 @@ too.
### Windows {#Windows}
-Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html).
+Download the [latest release of SmallBASIC](/pages/download.html).
The different versions of SmallBASIC are included in the zip-file. Extract the zip-file to a
location of your choice. Open the SmallBASIC folder and start one of the following programs:
@@ -110,7 +114,7 @@ location of your choice. Open the SmallBASIC folder and start one of the followi
### Linux {#Linux}
-Download the [latest release of SmallBASIC](https://smallbasic.github.io/pages/download.html).
+Download the [latest release of SmallBASIC](pages/download.html).
The different versions of SmallBASIC are provided as separate AppImages. Download an AppImage
and copy it to a directory of your choice. Execute the AppImage. Depending of the Linux version
you have to make the AppImage executable: `chmod u+x AppImageFile`, where `AppImageFile` is the
@@ -119,7 +123,10 @@ filename of the AppImage.
### Android {#Android}
Download and install SmallBASIC for Android using
-[Google Play](https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic).
+[Google Play](https://play.google.com/store/apps/details?id=net.sourceforge.smallbasic). Files
+are stored in `/InternalMemory/SmallBASIC` or in case of an old Android version in
+`/InternalMemory/Android/data/net.sourceforge.smallbasic/files`. For easy file transfer between
+Android and desktop, please read [SmallBASIC file transfer](/pages/android_file_transfer.html)
### Build from Source {#BuildFromSource}
@@ -131,9 +138,9 @@ Please follow the instructions on [Github](https://github.com/smallbasic/SmallBA
Please read the separate articles for the different versions of SmallBASIC:
-- [SDL](https://smallbasic.github.io/pages/sdl.html)
-- [Android](https://smallbasic.github.io/pages/android.html)
-- [FLTK](https://smallbasic.github.io/pages/fltk.html)
+- [SDL](/pages/sdl.html)
+- [Android](/pages/android.html)
+- [FLTK](/pages/fltk.html)
## Source Code Format {#SourceCodeFormat}
@@ -1425,7 +1432,7 @@ the select-case structure will be exited and all following case statements will
tested anymore. If non of the case statements were entered the optional 'CASE ELSE'
statements will be entered.
-See function reference [SELECT CASE](https://smallbasic.github.io/reference/655.html) for
+See function reference [SELECT CASE](/reference/655.html) for
detailed information.
## Units {#Units}
@@ -1476,6 +1483,62 @@ IMPORT MyUnit as u
u.MyFunction(1)
```
+## The USE Keyword {#TheUseKeyword}
+
+The `USE` keyword is used on specific commands for passing a user-defined expression.
+
+```smallbasic
+SPLIT s," ",v USE TRIM(x)
+```
+
+In this example, every element of `v` will be trimmed. Use the `x` variable to
+specify the parameter of the expression. If the expression needs more parameter,
+you can use also the names `y` and `z`.
+
+
+## Input and Output {#InputAndOutput}
+
+### Print on Screen {#PrintOnScreen}
+
+Use `PRINT` to print text on the screen at the current cursor location. When starting
+the BASIC program, the cursor is in the top left corner. After printing to the screen
+the cursor location will be updated. After execution of `PRINT`, if not otherwise
+specified, the cursor will be moved to the beginning of the next line. When printing
+to the last line of the screen, the screen will scroll up by one line.
+
+Basic usage of `PRINT`:
+
+```smallbasic
+PRINT 1 ' Output: 1
+PRINT 1+1 ' Output: 2
+PRINT cos(pi) ' Output: -1
+PRINT "Text" ' Output: Text
+```
+
+If `;` or `,` are used as last character of a print command, carriage return/line feed
+(new line) will be suppressed after printing.
+
+Please read the language reference of [PRINT](/reference/535.html)
+for a detailed description. The text cursor can be set using
+[LOCATE](/reference/530.html).
+
+### Read Input from the Keyboard {#ReadInputFromKeyboard}
+
+`INPUT` reads text from keyboard and stores it in a variable. `INPUT` can print a prompt
+on screen. After execution of `INPUT` the cursor will be moved to the beginning of the
+next line. `INPUT` will block execution of the program until the return-key is pressed.
+
+Basic usage of `INPUT`:
+
+```smallbasic
+INPUT "How old are you?", age
+PRINT age
+```
+
+For more information see language reference of [INPUT](/reference/527.html).
+[INKEY](/reference/539.html) and [DEFINEKEY](/reference/1015.html) allow to read from
+a keyboard without blocking the execution of the program.
+
## OPTION {#Statement1}
The `OPTION` command is used to pass parameters to the SB-environment. There are
@@ -1548,18 +1611,6 @@ SmallBASIC uses the following meta commands:
#unit-path: C:\sbasic\units;C:\temp
```
-### The USE Keyword {#TheUseKeyword}
-
-The `USE` keyword is used on specific commands for passing a user-defined expression.
-
-```smallbasic
-SPLIT s," ",v USE TRIM(x)
-```
-
-In this example, every element of `v` will be trimmed. Use the `x` variable to
-specify the parameter of the expression. If the expression needs more parameter,
-you can use also the names `y` and `z`.
-
## Exception Handling {#ExceptionHandling}
Exception handling is supported for file handling, and accessing serial ports and
diff --git a/pages/android_file_transfer.html b/pages/android_file_transfer.html
new file mode 100644
index 00000000..6dad2aae
--- /dev/null
+++ b/pages/android_file_transfer.html
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+ Codestin Search App
+
+
+
+
+
+
+
+
+
+
+
like raylib or nuklear. The Android version is similar to the SDL
version and comes with an integrated IDE, too.
Windows
-
Download the latest release
-of SmallBASIC. The different versions of SmallBASIC are included in
-the zip-file. Extract the zip-file to a location of your choice. Open
-the SmallBASIC folder and start one of the following programs:
+
Download the latest release of
+SmallBASIC. The different versions of SmallBASIC are included in the
+zip-file. Extract the zip-file to a location of your choice. Open the
+SmallBASIC folder and start one of the following programs:
Download the latest release of
+SmallBASIC. The different versions of SmallBASIC are provided as
separate AppImages. Download an AppImage and copy it to a directory of
your choice. Execute the AppImage. Depending of the Linux version you
have to make the AppImage executable:
@@ -190,7 +195,12 @@
Linux
Android
Download and install SmallBASIC for Android using Google
-Play.
+Play. Files are stored in /InternalMemory/SmallBASIC or
+in case of an old Android version in
+/InternalMemory/Android/data/net.sourceforge.smallbasic/files.
+For easy file transfer between Android and desktop, please read SmallBASIC file
+transfer
Build from Source
Using Linux it is quite easy to build SmallBASIC from source. This
has the advantage, that you don’t need to use AppImages and you can use
@@ -202,10 +212,9 @@
Using the Integrated
Please read the separate articles for the different versions of
SmallBASIC:
SmallBASIC files are plain text files in ASCII or UTF-8. A program
@@ -1437,8 +1446,7 @@
SELECT CASE
select-case structure will be exited and all following case statements
will not be tested anymore. If non of the case statements were entered
the optional ‘CASE ELSE’ statements will be entered.
-
See function reference SELECT CASE
for detailed information.
Units
Units are a set of subroutines, functions and/or variables that can
@@ -1478,6 +1486,52 @@
Import
IMPORT MyUnit as uu.MyFunction(1)
+
The USE Keyword
+
The USE keyword is used on specific commands for passing
+a user-defined expression.
+
SPLIT s," ",v USETRIM(x)
+
In this example, every element of v will be trimmed. Use
+the x variable to specify the parameter of the expression.
+If the expression needs more parameter, you can use also the names
+y and z.
+
Input and Output
+
Print on Screen
+
Use PRINT to print text on the screen at the current
+cursor location. When starting the BASIC program, the cursor is in the
+top left corner. After printing to the screen the cursor location will
+be updated. After execution of PRINT, if not otherwise
+specified, the cursor will be moved to the beginning of the next line.
+When printing to the last line of the screen, the screen will scroll up
+by one line.
If ; or , are used as last character of a
+print command, carriage return/line feed (new line) will be suppressed
+after printing.
+
Please read the language reference of PRINT for a detailed description. The
+text cursor can be set using LOCATE.
+
Read Input from the Keyboard
+
INPUT reads text from keyboard and stores it in a
+variable. INPUT can print a prompt on screen. After
+execution of INPUT the cursor will be moved to the
+beginning of the next line. INPUT will block execution of
+the program until the return-key is pressed.
+
Basic usage of INPUT:
+
INPUT"How old are you?", age
+PRINT age
+
For more information see language reference of INPUT. INKEY and DEFINEKEY allow to read from a keyboard
+without blocking the execution of the program.
OPTION
The OPTION command is used to pass parameters to the
SB-environment. There are two styles for that, the run-time which can
@@ -1493,10 +1547,10 @@
OPTION BASE
Use OPTION BASE 1 to set the index of the first element
of an array to 1. This option is useful especially for
beginners, because it makes counting elements more intuitive.
-
OPTION BASE 1
-A = [1,2,3]
-PRINT A[1] ' Output 1
+
OPTION BASE 1
+A = [1,2,3]
+PRINT A[1] ' Output 1
OPTION BASE is a run-time option.
OPTION MATCH
OPTION MATCH [PCRE [CASELESS]|SIMPLE] sets the default
@@ -1537,39 +1591,30 @@
Meta Commands
up the environment variable SB_UNIT_PATH. Directories on Linux must be
separated by :, and on DOS/Windows by ;
-
The USE keyword is used on specific commands for passing
-a user-defined expression.
-
SPLIT s," ",v USETRIM(x)
-
In this example, every element of v will be trimmed. Use
-the x variable to specify the parameter of the expression.
-If the expression needs more parameter, you can use also the names
-y and z.
Exception handling is supported for file handling, and accessing
serial ports and network sockets. Exception handling is typically used
with errors raised when calling a file system command that cannot be
completed, for example attempting to open a non-existent file.
-
TRY
-' do something
-CATCH err
-print err
-' do something
-END TRY
-
TRY
-' do something
-CATCH"Error 1"
-' do something
-CATCH"Error 2"
-' do something
-END TRY
+
TRY
+' do something
+CATCH err
+print err
+' do something
+END TRY
+
TRY
+' do something
+CATCH"Error 1"
+' do something
+CATCH"Error 2"
+' do something
+END TRY
The TRY statement introduces a try/catch block. A
try/catch block consist of the following structure: