diff --git a/misc/api/basics.html b/misc/api/basics.html new file mode 100644 index 0000000..51871e2 --- /dev/null +++ b/misc/api/basics.html @@ -0,0 +1,141 @@ + + +
+
+
+
+ ![]() |
+ | +
+ Starting off with SlideScript, you'll first need to obtain the source and build it.
+ We're going to assume you're using a *nix based system today, so the easiest way to
+ get the source is with a tool a developer should be familiar with: git.
+Installing system-wide:
+
+# git clone https://notabug.org/Pentium44/slidescript
+# cd slidescript/
+# make & make install
+# slidescript
+ss:prompt:
+
+Running after build:
+
+# git clone https://notabug.org/Pentium44/slidescript
+# cd slidescript/
+# make
+# ./slidescript
+ss:prompt:
+
+ From this step, you should easily have built SlideScript, and
+ would be sitting at the fancy incorporation of an interactive shell.
+ Want to use it at as a script? Just make a file "script.ss", and
+ add a shebang after system wide install:#!/usr/bin/slidescript
+ + SlideScript will parse an equal character into a variable using the + contents on each side of such equal character. No quotes are needed + after an equal character and can be ended via new-line. You can print + variables and/or strings to stdout in SlideScript using the "print" function. + Examples (interactive and scripted): +
+ss:prompt: buffer=This will be the contents of variable "buffer"
+ss: var 'buffer' -> This is the contents of variable "buffer"
+ss:prompt: print "%buffer%"
+This is the contents of variable "buffer"
+ss:prompt:
+
+OR
+
+#!/usr/bin/slidescript
+# This is a comment, script away
+buffer=This will be the contents of variable "buffer"
+print "%buffer%"
+# Unset function on variables similar to perl
+unset "buffer" # Dumps buffer from memory!
+
+
+ From here, we are going to be refering to all examples as scripts. Yes,
+ SlideScript does have interactive mode for being a convenient all-in-one
+ shell, but lets focus on the scripting side of things; shall we?
+
+
+
+ Piping is very similar to piping within a *nix shell. In SlideScript,
+ the piping character remains "vertical bar" or "|". The return value
+ of the function processed on the left side of the piping character will
+ be pushed into a variable known as "PIPE". Hmm, wonder why? :P
+ You can use piping in recursion in SlideScript.
+ Backquotes or "`" are used within SlideScript, mainly in variables,
+ for processing functions within the language, and saving the returned value
+ as a string. For example: whatsthetime=`time` would be saved as:
+ ss: var 'whatsthetime' -> Wed Jun 9 17:56:23 2021
+ Here are some examples:
+
+#!/usr/bin/slidescript
+# First, lets show how a pipe works:
+print "hello" | print "%PIPE% world" # Returns: hello world
+
+# Now for stacked piping, lets use a variable with the current time, and
+# Play with it!
+
+whatsthetime=`time` # return: ss: var 'whatsthetime' -> Wed Jun 9 17:56:23 2021
+
+calc "56.5 * 6.25" | print "Solved: %PIPE%" | print "[%whatsthetime%] %PIPE%"
+### Return value of the contraption: [Wed Jun 9 17:56:23 2021] Solved: 353.125000
+
+# This is more for, how math works in SlideScript #
+# Example of using piping to do mathimatical equations with parathesis!
+calc "33.3 / 2" | calc "%PIPE% * 26" | calc "%PIPE% + 2" # Return: 434.899994
+
+
+
+
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
Under development...
+ +
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
If you're following through the API documentation, chapter by chapter,
+ then you have a good idea of the foundation of the language in terms
+ of it's structure. Now for some features of SlideScript. File manipulation
+ is definitely something that can be tackled without a doubt. A selection
+ of functions within SlideScript that are file related are: isfile, isdir,
+ showdir (ls), showpath (pwd), move (mv), delete, chdir (cd), read, write,
+ and cat.
+ To be honest, how could SlideScript be shell like without having the
+ functionality of all the system utilities. Here's the kicker, everything
+ is built-in to the core of SlideScript, making it extremely versatile and
+ super simple! No dependency on other software!
+
+#!/usr/bin/slidescript
+# File manipulation examples
+
+# showdir: list directories/files in current directory.
+# argument count: 0
+# returns: file list.
+showdir
+ls # alias
+
+# showpath: show current working directory location (alias pwd).
+# argument count: 0
+# returns: working directory path
+showpath
+pwd # alias
+
+# chdir: Change directory
+# argument count: 1, ex: docs/; /home/user
+# returns: No return
+chdir "docs/"
+showpath # Show return of change
+
+# backdir: Back a directory / to parent directory (same as chdir "..")
+# argument count: 0
+# returns: No return
+backdir
+
+# isdir / isfile: Return true or false (0 or 1) on file / directory find.
+# argument count: 1, ex: "docs/README.txt"
+# returns: true / false
+isfile "docs/README.txt" # returns: true
+isdir "docs/" # returns: true
+isfile "docs/" # returns: false
+
+# move: move file / rename file based on arguments.
+# argument count: 2, , ex: "docs/" "documents/"
+# returns: no return
+move "docs" "documents" # renamed docs -> documents
+
+# delete: delete file (non-recursive)
+# argument count: 1, , ex: "docs/README.txt"
+# return: no return
+delete "docs/README.txt" # deletes README.txt inside docs/
+
+# read: read contents of file given to function
+# argument count: 1, , ex: "docs/README.txt"
+# return: contents of file
+read "docs/README.txt" # Returns contents of "README.txt"
+
+# write: write contents to file.
+# argument count: 2, , ex: "test.txt" "Hello world!"
+# return: no return
+write "test.txt" "Hello world!"
+
+# cat: catenate file with given contents
+# argument count: 2, , ex: "test.txt" "I'm back!"
+# return: no return
+cat "test.txt" "I'm back!" # catenates "I'm back!" to the end of the original test.txt "Hello world!"
+# Ending file contents of "test.txt":
+# Hello world!
+# I'm back!
+
+
+
+
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
Now that most of the basic built-in functions are aware, time to + start playing with some of the more interesting parts of SlideScript. + SlideScript does indeed seem more shell-like than anything but has its + own unique abilities unlike other scripting languages.
+ +
+ You can indeed compare values / process based on what's found around.
+ For example, file functions like isdir and isfile return a true or false
+ based on what they find. These returns can be used by some of the
+ statement handling built into SlideScript's lexer.
+ if(n):
+
+#!/usr/bin/slidescript
+# Using isfile/isdir and if/ifn for determining when something needs to be done
+doesitexist=`isfile "test.txt"` # returns 0 / false
+ifn: %doesitexist%; write "test.txt" "created..." # If false, write
+if: %doesitexist%; cat "test.txt" "adding to file..." # if true, catenate
+
+ comp(are):
+
+#!/usr/bin/slidescript
+# Using compare and if/ifn for determining if a string is similar or different
+string1=Testing strings
+string2=String testings
+match=`comp: "%string1%" "%string2%"`
+ifn: %match%; print "Different" # If false, different
+if: %match%; print "Same" # if true, same
+
+ loop:
+
+#!/usr/bin/slidescript
+# Using compare and if/ifn for determining when something needs to be done
+count=5
+loop: %count%; print "Printing %count% times..."
+
+
+
+ + SlideScript is a list of other functions that can be used at a given time + or place: time, and sleep. +
+#!/usr/bin/slidescript
+# Time example:
+time
+
+# Sleep example:
+sleep "3"
+print "Will print after 3 seconds..."
+
+
+
+
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
SlideScript is pretty simple, and to be worth working with, you
+ must know how to use it. I'm going to break down the basics of SlideScript
+ and the functions built-in to the core of the project. This page will
+ grow and adapt as the project moves onward. Please note that some functions
+ may slightly differ when building nightly source!
+
+ Documentation / API:
+
+ SlideScript is available as source on + NotABug. In + due time, I will start compiling binaries for SlideScript for a range + of operating systems from *Nix 32/64 bit, Windows, OSX, Android (Termux), + and more! But due to rapidly changing in features, and bugfixes, its + just too unstable and... well... outdated after a week or two :D +
+ +
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
There are various functions within SlideScript in terms of networking availability. + The micro web server is stable and 100% usable, and also incorporated: netlisten and nettoss. +
+ +
+ SlideScript has, for convenience and ease of use at the prompt level,
+ a built-in web server. The function is known as nethttp.
+ The function has the ability to fork into the background as an
+ operational daemon until the SlideScript session is ended.
+ When not forked, the web server runs in the foreground and
+ will inform when a connection has been made and requests a file
+ from the webserver.
+
+#!/bin/usr/slidescript
+# Starting the built-in web server
+# run in background!
+nethttp "8080" "1"
+
+chdir "docs"
+
+# run in foreground!
+nethttp "8081" "0"
+
+
+
+
+ Amazingly convenient feature for passing raw text from machine
+ to machine, and these functions are known as: netlisten and nettoss.
+
+ Listening server:
+
+#!/usr/bin/slidescript
+# Start listening server on port "7000"
+netlisten "7000"
+
+ Incoming connections send data using the nettoss function and
+ data is saved into a flat file in the working directory as a
+ random filename based on time, srand, and rand in C.
+### Sending text / files via interactive shell ###
+
+ss:prompt: nettoss "127.0.0.1" "7000" "Hello!"
+ss:client:connected to 127.0.0.1:7000
+ss:prompt:
+
+### Listening socket ###
+
+ss:server:listening on '7000'
+ss:server:connection from 127.0.0.1
+ss:server:client buffer saved as 'wQiHVlWxD595XZlk'
+
+
+
+
+ Still need help? Want to report a bug? Join us!
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+
+
+
+ ![]() |
+ | +
Welcome to the world of SlideScript! To make it simple, SlideScript
+ is the lazy language and has a very laid-back script parser. What does
+ that mean for you? Well, you can take what's comfortable with you and
+ implement it into a SlideScript ready form-factor with just a bit of
+ behind the scenes information on how SlideScript works!
+
+ SlideScript is early in development but supports a heap of features
+ right out the gate:
+
+ SlideScript is available as source on + NotABug. In + due time, I will start compiling binaries for SlideScript for a range + of operating systems from *Nix 32/64 bit, Windows, OSX, Android (Termux), + and more! But due to rapidly changing in features, and bugfixes, its + just too unstable and... well... outdated after a week or two :D +
+ +
+ IP/Port: cddo.cc/1337
+ Main hang channel: #theroot
+ FreeBox channel: #freebox
+ FreonLinux channel: #freonlinux
+