|a
EXAMPLE PROGRAMS
|b
|c
2lower.str
|d
|e
This program takes a line of text as input on the command line
and converts uppercase letters to lowercase ones. 
"./2lower.str ABC" should print "abc". This is merely a 
demonstration of case conversion in Stril.
|f
|c
2upper.str
|d
|e
This program takes a line of text as input on the command line
and converts lowercase letters to uppercase ones. 
"./2upper.str abc" should print "ABC". This is merely a 
demonstration of case conversion in Stril.
|f
|c
Add-pim.str
|d
|e
This program creates new entries in an existing database file. 
It reads the entries generated by new-pim.str and prompts
accordingly. Syntax: ./add-pim.str test1.pim 
|f
|c
Bin2h.str
|d
|e
This program takes a binary number as input and converts
it to hexadecimal. The length of the binary number has
to be divisible by four. Example: ./bin2h.str 11111111
(should print FF, i. e. 255 in base 10).
|f
|c
Bin2o.str
|d
|e
This program takes a binary number as input and converts
it to octal. The length of the binary number has
to be divisible by three. Example: ./bin2o.str 111001
(should print 71, i. e. 57 in base 10).
|f
|c
Char2num.str
|d
|e
This program takes a single character as input on the command line
and outputs the numerical value of that character. "./char2num.str A"
should print "65".
|f
|c
Clear.str
|d
|e
This program clears the screen of your terminal by printing 
two backslash sequences.
The first backslash command (\\r[2J) clears the screen. The second backslash
command (\\r[90F) repositions your cursor to the first line if your terminal
window has less than 90 lines. No parameters are required.
|f
|c
Cview.str
|d
|e
This program shows a form of ASCII art on the screen. It shares
much of the code and the speed limitations with sview.str. Upper
case letters are printed in green, numbers are printed in yellow,
lower case letters are printed in blue
and anything else is printed in white. The background colour
is blue. Syntax: ./cview.str image.txt.
|f
|c
Echo.str
|d
|e
This is a replica of the standard *nix echo program. It simply prints the
parameters it is fed on the command line. If you don't use any parameters, 
it prints nothing. The program understands backslash sequences, but you'll
probably need to use double backslashes. That is a feature of your shell
or command interpreter. It has nothing to do with echo.str.
|f
|c
Encrypt.str
|d
|e
This program takes a line of text as input on the command line
and adds one to the value of each character. "./encrypt.str again"
should print "bhbjo". This is merely a demonstration. The program
does NOT generate secure encryption!
|f
|c
False.str
|d
|e
This is a replica of a standard *.nix shell programming utility.
It does nothing unsuccessfully and terminates with exit code -1. 
|f
|c
Fmt.str
|d
|e
This is a simple text formatter. Lines are broken after about
70 characters, but words and empty lines are left as they are.
One carriage return per line is removed, thereby hopefully
converting files to *nix format. Syntax: ./fmt.str file
|f
|c
G2pbm.str
|d
|e
This program takes a file containing Stril ASCII art (the edited
output of gmake.str) as input and
outputs a pbm image. The program writes to the screen, so you
have to redirect the output to a file.
Syntax: g2pbm.str image.txt > image.pbm.
|f
|c
Gmake.str
|d
|e
This program creates an ASCII art canvas of 22 lines with 60
characters per line. You have to redirect the output to a file.
The resulting file can be edited with any text editor, but it
is best to use a mono-spaced font. 
Syntax: gmake.str character > file.
|f
|c
Gview.str
|d
|e
This program shows a form of ASCII art on the screen. It shares
much of the code and the speed limitations with Sview.str. Upper
case letters are printed in half-bright, numbers are printed in bold letters
and anything else is printed as a space. Syntax: gview.str image.txt.
|f
|c
H2bin.str
|d
|e
This program takes a hexadecimal number (0-9,a-f) as input on 
the command line and converts it to binary. 
"./h2bin.str ff" should print "11111111". 
|f
|c
Keypress.str
|d
|e
This program works the same way as echo, but it waits for
a single keypress when the optional argument has been
printed. Syntax: ./keypress.str (arg)
|f
|c
Mirror.str
|d
|e
This program takes a line of text as input on the command line
and creates a mirror image.
"./mirror.str ABC" should print "CBA". 
|f
|c
More.str
|d
|e
More.str is a featureless version of the *nix program
with the same name. I reads from standard input and 
waits for user input each time 20 lines have been printed.
Syntax: Some command | ./more.str
|f
|c
Motd.str
|d
|e
The program prints a message of the day and takes a
single letter as input. Syntax: ./motd.str char.
|f
|c
New-pim.str
|d
|e
This program creates a new database file. You have to write
the names of the sub-records when prompted. If you want the 
file to contain
title, author, year and publisher, you write "Title" at
the first prompt, "Author" at the second prompt and so on.
When you are finished, you press enter on an empty line. 
Syntax: ./new-pim.str test1.pim
|f
|c
No.str
|d
|e
The program prints "n" for no in an eternal loop. It is the negation of
yes, a standard *nix shell programming utility.
|f
|c
Num2char.str
|d
|e
This program takes a number as input on the command line
and prints the corresponding character. The number has to
be in the range 0-126. "./num2char.str 126" should print ~ (a tilde).
|f
|c
O2bin.str
|d
|e
This program takes an octal number (0-7) as input on the command line
and converts it to binary. 
"./h2bin.str 70" should print "111000". 
|f
|c
Read.str
|d
|e
This program changes your foreground colour to white and your 
background colour to blue. Then it reads one word at a time from 
standard input. It pauses two seconds between each word. 
Syntax: ./read.str < test.txt
|f
|c
Reader.str
|d
|e
This is a more advanced version of read.str. It reads from a file, not
from standard input, and it needs to be fed a filename on the
command line. Reader.str
presents the file line by line, it can set and use
bookmarks, and it can search the file for an expression.
|f
|c
Readline.str
|d
|e
This program reads lines from standard input and 
prints to the screen. Syntax: ./readline.str < test.txt
|f
|c
Reset.str
|d
|e
This program resets all terminal attributes by printing a
backslash sequence (\\rc). It also clears the screen.
|f
|c
Sview.str
|d
|e
This program colour codes Stril operators (<,|,\ and comma)to make
it easier to spot errors. It writes byte by byte (could be improved),
so it is rather slow. The speed is, however, not really an issue.
Stril programs tend to be rather small. Syntax: sview.str program.str.
|f
|c
Sync.str
|d
|e
This program is actually the same as true.str. Stril calls sync
before it exits. Syntax: ./sync.str
|f
|c
Text2html.str
|d
|e
This is the program that is used to generate the documentation 
of Stril. It depends on html.stl (a simple style-sheet). It is not meant 
as a general text to HTML converter, but it demonstrates that Stril is
able to generate a subset of HTML. Text2html.str writes to standard output.
Syntax: ./text2texts.str file
|f
|c
Text2text.str
|d
|e
This program can also be used to generate the documentation 
of Stril. It depends on txt.stl (a simple style-sheet). It is not meant 
as a general text formatter, but it demonstrates the text processing
capabilities of Stril. Text2text.str combines the code base of fmt.str
and text2html.str. It writes to standard output.
Syntax: ./text2texts.str file
|f
|c
True.str
|d
|e
This is a replica of a standard *.nix shell programming utility.
It does nothing successfully and terminates with exit code 0. 
|f
|c
Unhtml.str
|d
|e
This program removes HTML tags from a file. It writes to standard
output. The support for national characters is limited, but more
could easily be added. "Less than" is also handled correctly.
Syntax: ./unhtml.str file
|f
|c
View-pim.str
|d
|e
This program allows you to search and print database files generated by
new-pim.str and add-pim.str. Only the first sub-record in each record can
be searched. Syntax: ./view-pim.str test1.pim
|f
|c
Wait.str
|d
|e
This program does nothing successfully if you run it without arguments.
If an argument is used, it waits for a number of seconds. That number is
the value of the first character in the argument minus 48. "./wait.str D"
should wait for 20 seconds since a capital D has the value of 68.
Syntax: ./wait.str arg.
|f
|c
Yes.str
|d
|e
This program prints "y" for yes in an endless loop.
It is a replica of a standard *nix utility that is
often used in shell programming.
|f
