241 lines
8.6 KiB
Plaintext
241 lines
8.6 KiB
Plaintext
======
|
|
=== SlideScript
|
|
======
|
|
A simple, user friendly scripting language for the average person. SS is meant to
|
|
be simple, and work as its documented as. SlideScript is a bin tool to say the
|
|
least and is a helpful *nix userland tool in the CLI
|
|
|
|
-----
|
|
Compiling
|
|
-----
|
|
* Compile SS using the make command.
|
|
* Install SS using make install.
|
|
* Modify test.ss to learn the basics of SS.
|
|
* Run ./test.ss to execute the script.
|
|
|
|
***NOTE: if compiling on OSX/BSD, please uncomment #define BSD in src/config.h
|
|
|
|
-----
|
|
Documentation
|
|
-----
|
|
Here is a list of functions and features that SlideScript comes with
|
|
at this moment!
|
|
|
|
* Commenting! Examples:
|
|
* # Comment is real in this one
|
|
|
|
* Comp, loop, if, and ifn functions:
|
|
* comp: "1" "1" -> compares integer 1 and 1 -> returns true
|
|
* comp: "true" "false" -> compares string true and false -> returns false
|
|
* loop: 3; print "Hello world!" -> Will loop print "Hello world!" 3 times.
|
|
* if: true; print "True!" -> Prints "True!"
|
|
* ifn: false; print "False!" -> Prints "False!"
|
|
|
|
* Read, write, and cat(enate) functions. Examples:
|
|
* write "file.txt" "This will be written to file.txt"
|
|
* read "file.txt"
|
|
* cat "file.txt" "Data to write to end of file.txt"
|
|
|
|
* Basic math expressions
|
|
* calc "45 / 5" or calc "255.3 * 442.77"
|
|
* Of course addition and subtraction as well
|
|
|
|
* Time example:
|
|
* time
|
|
|
|
* Isdir and isfile function, example:
|
|
* isdir "examples/" -> returns 0 for not, 1 for is
|
|
* isfile "examples/functions.ss" -> returns 1, its there
|
|
|
|
* File manipulation functions
|
|
* move "file1" "file2" -> Renames/moves file1 to file2 (mv alias)
|
|
* chdir "/home/user" -> Changes directory to /home/user (cd alias)
|
|
* backdir -> Moves you back one directory (..)
|
|
* showpath -> Returns current working directory (pwd alias)
|
|
* showdir -> Lists current directory (ls alias)
|
|
* showdir "/" -> lists '/'
|
|
* mkfile "file.txt" -> creates empty 'file.txt' (touch alias)
|
|
* mkdir "testing/" -> creates directory 'testing'
|
|
* mkfile "testing/file.txt" -> creates directory 'testing', and creates 'file.txt'
|
|
|
|
* Execute example:
|
|
* exec "ls -al" (alias to ~"ls -al")
|
|
|
|
* Slidescript compression functions, example:
|
|
* compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, and dir1, 2 archived, compressed,
|
|
and saved in 'archivename.tar.ss'
|
|
* decompress "archivename.tar.ss" -> decompresses 'archivename.tar.ss'
|
|
|
|
* Print example:
|
|
* print "Hi everyone!"
|
|
|
|
* Sleep (Zzz) example (sleeps for 2 seconds):
|
|
* sleep 2
|
|
|
|
* Search functions, example:
|
|
* search "README.txt" "SlideScript" -> returns each line that 'SlideScript' is found on
|
|
|
|
* Variable setting and passing
|
|
* filename=file.txt -> filename
|
|
* filedata=File '%filename%' is being moved to moo -> %filename% is populated as file.txt
|
|
* write "%filename%" "%filedata%" -> writes filedata contents to file.txt as expected.
|
|
* unset "filename" -> Removes variable data from session memory to be redefinied / reused.
|
|
|
|
* Decoding and encoding strings
|
|
* encode "Regular string" -> Converts to encrypted string 'Uhjvqds#xuulqj'
|
|
* decode "Uhjvqds#xuulqj" -> Converts back to 'Regular string'
|
|
|
|
* MD5 file checking
|
|
* md5 "file.txt" -> outputs filename and md5 hash
|
|
|
|
* Layered piping
|
|
* md5 "file.txt" | encrypt "%PIPE%" | write "file.txt.md5.enc" "%PIPE%" -> writes output of md5 to file.txt.md5
|
|
|
|
* Networking functions
|
|
* netlisten "<port>" "<search>" "<respond>" -> listens on <port> and replies <respond> on <search> found from outside
|
|
* nettoss "<address>" "<port>" "<data>" -> binds to outside server at <address>:<port> and pushes <data> thus, disconnecting
|
|
* nethttp "<port>" "<forkval>" -> throws up a web server on <port> in the current working directory,
|
|
forkval (0 or 1, 0 don't fork into background / 1 do).
|
|
|
|
* Backquoted function parsing within variables
|
|
* curtime=`time` -> Will set curtime value to return of time at the time of parse.
|
|
print "%curtime%" -> Prints the variable value of curtime, same operation as function time, but good for timing scripts
|
|
|
|
|
|
This will change rapidly as of currently, slidescript is in beavy development! To get the feel of the scripting,
|
|
the best bet is to take a look at some of the slidescript examples in 'examples/'
|
|
|
|
functions.ss -> displays most basic functions
|
|
net-http.ss -> displays built in http web server
|
|
net-listen.ss -> displays slidescript's raw listen socket
|
|
net-toss.ss -> displays the 'client side' networking function.
|
|
|
|
|
|
-----
|
|
Todo list
|
|
-----
|
|
|
|
This section will obviously expand and adapt to the direction of the language. This is going to change rapidly.
|
|
|
|
* Add in-script functions
|
|
* Add script including
|
|
* More networking function flexibility
|
|
* File pull / file push functionality (via network sockets)
|
|
* Micro text editor
|
|
* IRC server, bot, and client built in
|
|
* Web server additions (pulled from chttpd)
|
|
* PATH variable support for use as a shell in some cases
|
|
|
|
-----
|
|
Done
|
|
-----
|
|
|
|
List of finished features, in a rough summary.
|
|
|
|
* Added help, and version functions
|
|
* Simple syntax checking and error reporting, its a lazy language, syntax can sway.
|
|
* Most syntax errors will produce warnings instead of terminating process
|
|
* Up to 32 layer function piping
|
|
* Support for linux system calls
|
|
* Network listen socket, toss function
|
|
* Builtin HTTP server for disposeable use, can be ran in the foreground or forked into the background
|
|
* Read and write from file
|
|
* Some simple functions
|
|
* Shebang handling
|
|
* Variable support
|
|
* If, ifn, loop, and comp statements
|
|
|
|
-----
|
|
Changelog
|
|
-----
|
|
|
|
Changes between version bumps in SlideScript. Hoping to have a lightweight top-down scripting language
|
|
by V1.0.0 release! From there it will be molding and preserving the art.
|
|
* V0.6.0
|
|
* Multiple dynamic memory bug fixes, SlideScript is 99% dynamic on memory use
|
|
* Included if, and ifn functions for comp, isfile, isdir, etc return values.
|
|
* Incorporated unset function to wipe variable data within the same session.
|
|
* Additions to help command
|
|
* Code cleanup
|
|
* Fixed large bug when attempting to use multiple variables within one function.
|
|
* Fixed compile warnings on some systems
|
|
* Fixed system uncompatibility for Windows systems, should work cross-compiled!
|
|
|
|
* V0.5.4
|
|
* Added memory management framework for dynamic memory handling
|
|
* tar.c cleanup
|
|
* fflush additions for telnet usage of SS.
|
|
|
|
* V0.5.3
|
|
* Added version, and help command
|
|
|
|
* V0.5.2
|
|
* Bugfixes and tweaks
|
|
* Added loop and comp(are) statements
|
|
|
|
* V0.5.1
|
|
* Compression and decompression bugfixes
|
|
* System working functions (move, chdir, and showpath)
|
|
* General clean, removed bins/ until language stabilizes
|
|
|
|
* V0.5.0
|
|
* Interactive mode gives users prompt on call to slidescript (Thanks OldCoder!)
|
|
* Added showdir (alias ls)
|
|
* Added compress / decompress functions (WIP, slow LZ77 algorithm)
|
|
* Multiple bug fixes
|
|
* Shell like interactive behavior
|
|
|
|
* V0.4.5
|
|
* Multiple bug fixes in not setting null byte to dynamic mem before strcat is used
|
|
* Function isfile, as well as mkfile and mkdir are added
|
|
* Added grep like function, search!
|
|
* Cleanup code
|
|
|
|
* V0.4.4
|
|
* Softened the kill program errors, added warn functions behind the scenes
|
|
* Added backquote function processing in variables
|
|
* Fixed bug in read not displaying multi-line files
|
|
* Fixed bug in write not finding first quote syntax
|
|
* Added function isdir, and cat(enate) function. NOT cat as in linux env.
|
|
* Code clean-up
|
|
|
|
* V0.4.0
|
|
* Added calc function for floating math equations
|
|
* Cleaned up some more syntax handling, as well as bugs
|
|
* Added structured and savable multi-layer piping up to 32 functions deep
|
|
|
|
* V0.3.3
|
|
* Added first networking functions: netlisten, nettoss, nethttp.
|
|
* Embedded web server functionality
|
|
* Cleaned up code
|
|
* Improved syntax handling on functions
|
|
|
|
* V0.3.0
|
|
* Added simple 2 layer function piping for more useful tasks
|
|
* Fixed a couple core dump bugs
|
|
* Now reads files into memory, and then forces text files through SS, allows for in file variables
|
|
* Added "md5" functionality
|
|
* Multi-formal working syntax
|
|
|
|
* V0.2.1
|
|
* Added "decrypt" decode function
|
|
* Added "encrypt" encode function
|
|
* Added system "exec" function
|
|
* Added basic syntax handling, for a more uniform language
|
|
|
|
* V0.2.0
|
|
* Added "delete" function
|
|
* Added embedded variable handling to SS functions (variables can be used like everywhere!)
|
|
* Added linux system calls via exec
|
|
* Some cleaning up.
|
|
|
|
* V0.1.1
|
|
* Added variable handling with a buffer size of 2KB per variable, and cap of 2048 variables.
|
|
* Now operates under the shebang!
|
|
|
|
-----
|
|
Contributions
|
|
-----
|
|
Robert (OldCoder) Kiraly -> shebang support and string manipulations
|
|
(C) Copyright 2014-2021 Chris Dorman, some rights reserved (GPLv2)
|