MAIN\PEASYDOS.TXT ·
TXT ·
19.6 KB ·
1988-08-11 ·
from PCPlus_Issue-25_Oct-1988
PeasyDos Basics guide for Version 1.0
(C) 1988 Duncan P Charlton and Sue E Horseman
This document provides a guide to the operation of the PeasyDos environment
and instructions on how to use the programming language in order to build a
shell for your system.
1 PEASYDOS OPERATION
1.1 Input to PeasyDos
Whenever PeasyDos is not carrying out one of your commands it will be waiting
for you to tell it what to do next. There are two methods that allow you to
give PeasyDos instructions: Menus, where you choose one option from a list of
many; and the Line Editor where you have to type in a line of text.
1.1.1 Menus
PeasyDos menus appear on the top two lines of the screen and consist
of a list of options, one of which is highlighted (the current option)
and below that a more detailed description of the current option.
There are two ways of selecting an option from the menu.
(a) Use the <LEFT> and <RIGHT> cursor keys to move to the desired
option and then press <RETURN> to select the option. As you
move through the options the text below will change to give an
explanation of the current option.
(b) Press the key corresponding to the first letter of the option.
If there is only one option beginning with that particular
letter then that option will be selected. If more than one
option begins with that particular letter then a new menu will
appear with just those options shown. At this point you can
use the cursor keys as described in (a), or continue typing
the option name until the desired option is selected.
At times a Menu will be too long to be accommodated by the width of
the screen. This will be shown by small arrows at the right or left
hand side of line 1 indicating that the menu continues off the screen.
If this happens the <Ctrl> <LEFT> or <Ctrl> <RIGHT> keys can be used
to view options off the screen. If you simply use the <LEFT> or
<RIGHT> cursor key the Menu will 'scroll' to accommodate the new
options.
Although the menu might be too long to be shown this will not affect
the methods of selecting options described in (a) and (b) above.
1.1.2 Line editor
At times you will be asked to type in a line of text, for example when
specifying the drive for a format operation or a filename in a rename
operation. At these times the text you type will appear on line 23 of
the screen and you can type your text or use the keys below to edit
what you are typing:
<DEL> Delete character under cursor
<DEL RIGHT> Delete character before cursor
<HOME> Move to start of line
<END> Move to end of line
<Cursor LEFT> Move cursor back one character
<Cursor RIGHT> Move cursor forward one character
<Ctrl> <HOME> Delete all of line
<RETURN> When you have finished typing the line
Sometimes a default option will appear before you have typed anything,
if you want to accept the default then just press <RETURN>. If not,
you can edit the default with the keys listed above. If you want to
get rid of the default altogether, use <Ctrl> <HOME> to delete the
whole line.
1.2 Areas of the screen
PeasyDos uses five main areas of the screen to provide you with information
1.2.1 The menu bar occupies the top two lines of the screen and is
used to show the menus described in section 1.1.1 above.
1.2.2 The Editor uses line 23 of the screen as described in section
1.1.2 above.
1.2.3 Line 24 of the screen is the status line and contains a
copyright notice and the PeasyDos version number.
1.2.4 The Message line occupies line 25 of the screen and PeasyDos
will display helpful instructions there.
1.2.5 The rest of the screen is used by individual PeasyDos
application to display relevant information.
1.3 Running a PeasyDos Program.
To execute a Peasydos program type
dosman <filename>
where <filename> is the name of the PeasyDos program file that you
have created.
2 PROGRAMMING IN PEASYDOS.
In order to configure PeasyDos to your own system you must create a program
file. You can do this using any text editor, for example the Sidekick editor
(or even Edlin!).
If you are familiar with another procedural programming language such as
BASIC, Pascal,C or the DOS batch file language you should find the example
given below fairly easy to understand and you may find the PeasyDos Language
Description that follows it to be sufficient to allow you write your own
PeasyDos programs.
Before we present an example program there are a few things to note about a
PeasyDos program.
Programs consist of a list of Commands that tell PeasyDos what to do next,
PeasyDos will simply run through the list executing the commands.
As well as commands there are Functions. These cause PeasyDos to evaluate the
function and return a value.
Finally there are Variables. These are used to store values and are given a
value with the SET Command. The maximum length of a variable name is 8
characters.
Example of a PeasyDos program
PeasyDos was originally written to provide a menu driven interface for
selecting programs and so the first function that you will need to use will
probably be the MENU function. Let's look at an example,
SET MENUVAR MENU "Format" : "Format a Disk",
"Diskcopy" : "Copy a Floppy Disk",
"Exit" : "Exit to DOS"
ENDMENU
This means SET the variable MENUVAR to be equal to the result of the function
MENU. The text following the keyword MENU indicates the possible options for
that menu. The left column indicates the choices in the menu and the right
column the explanation that will appear when the corresponding option is
highlighted.
When the above example is encountered in a program file a menu would be
displayed looking something like this
FORMAT Diskcopy Exit
Format a Disk
where the capital letters indicate that the word 'Format' will be highlighted
on screen.
When one of the options is selected, (see Menus above) the variable MENUVAR
will take on one of the values "Format", "Diskcopy" or "Exit".
So far so good, now we need to take different actions according to the value
of MENUVAR. The easiest way to do this in PeasyDos in to write a list of
commands for each option and have PeasyDos execute the section corresponding
to the value of MENUVAR. Lets ignore the sections of code for the moment and
just look at how we make the selection.
GOSUB MENUVAR
That was pretty painless wasn't it?
The GOSUB (GO SUBroutine) instructs PeasyDos to execute the program lines at
MENUVAR until it encounters a RETURN command, and then to continue with the
commands after the GOSUB. At the moment MENUVAR is either "Format", "Diskcopy"
or "Exit" so we need three pieces of program to deal with those three options.
Let's write the one for 'Format' first..
:Format
RUN "FORMAT A:"
RETURN
The colon in the first line indicates that 'Format' is a label, or name, for a
piece of code.
The command RUN will execute the expression after it, as if you had typed it
at the DOS prompt. The second line, therefor, has exactly the same effect as
typing FORMAT A: at the prompt, ie the DOS FORMAT command will be executed to
format a disk.
Lastly the RETURN statement tells PeasyDos to go back to where it was before
it called this subroutine.
Here are the other subroutines:
:Diskcopy
RUN "DISKCOPY A: B:"
RETURN
:Exit
EXIT
:Diskcopy is almost exactly the same as Format.
:Exit is a bit different, it has a new command EXIT. All it does is exit from
PeasyDos back to the DOS prompt.
Now let's look at the complete program.
:MAINLOOP
SET MENUVAR MENU "Format" : "Format a Disk",
"Diskcopy" : "Copy a Floppy Disk",
"Exit" : "Exit to DOS"
ENDMENU
GOSUB MENUVAR
GOTO "MAINLOOP"
:Format
RUN "FORMAT A:"
RETURN
:Diskcopy
RUN "DISKCOPY A: B:"
RETURN
:Exit
EXIT
END
Note that there are three more lines in the program
:MAINLOOP
GOTO "MAINLOOP"
END
:MAINLOOP is another label and GOTO "MAINLOOP" instructs PeasyDos to loop back
to MAINLOOP. This means that the program will continually:
display the main menu
perform the operation and,
redisplay the menu
until Exit is selected.
END simply tells PEASYDOS that it has reached the end of the program file.
So that's a simple PeasyDos program. You can adapt and extend it to fit your
own system.
3. PeasyDos Language Definition and Description for Version 1.0
3.1 Backus-Naur definition
The following is the Backus-Naur Form (BNF) definition of the PeasyDos
Programming Language:
EXPRESSION EVALUATION
<primitive> ::= <variable> | <constant> | <function>
<rlnl-op> ::= $= | == | < | <= | >= | > | <>
<rlnl-expr> ::= <expr> | <expr> <rlnl-op> <expr>
<expr> ::= <primitive> { & <primitive> }
COMMANDS
<set-cursor-command> ::= @ <expr> <expr>
<chdir-command> ::= CHDIR <expr>
<clear-command> ::= CLEAR
<display-command> ::= DISPLAY <expr>
<exec-command> ::= EXEC <expr>
<exit-command> ::= EXIT
<gosub-command> ::= GOSUB <expr>
<goto-command> ::= GOTO <expr>
<if-command> ::= IF <rlnl-expr> <statement>
<loud-command> ::= LOUD
<message-command> ::= MESSAGE <expr>
<return-command> ::= RETURN
<run-command> ::= RUN <expr>
<set-command> ::= SET <variable> <expr>
<shell-command> ::= SHELL <expr>
<silent-command> ::= SILENT
FUNCTIONS
<curdir-function> ::= CURDIR
<dosver-function> ::= DOSVER
<edit-function> ::= EDIT <expr> <expr>
<files-function> ::= FILES <expr>
<menu-function> ::= MENU <expr> : <expr>
{, <expr> <expr> } ENDMENU
<menulist-function> ::= MENULIST <expr>
<nextkey-function> ::= NEXTKEY
<sortlist-function> ::= SORTLIST <expr>
<subdirs-function> ::= SUBDIRS
3.2 Language description.
3.2.1 Relational operators.
The following relational operators are supported:
$= String equality
$<> String inequality
== Numeric equality
< Numeric less than
<= Numeric less than or equal
>= Numeric greater than or equal
> Numeric greater then
<> Numeric not equal
Relation operators return either the string "True" or "False"
Note that PeasyDos is a typeless language, no distinction is made
between strings and numbers or lists, different operators are provided
for example, string comparison and numeric comparisons. This means
firstly that care must be taken to use the correct operator eg.
"0123" $= "123" is False, but
"0123" == "123" is True.
If a non-numeric string is used in a numeric comparison it will be
given the value zero for example
"Hello" == "World" is true since both strings will have the
value zero.
3.2.2 Term level operators
Concatenation of strings is provided by the & operator
eg.
"Hello " & "World"
is equivalent to "Hello World"
at present no arithmetic operators are provided.
3.2.3 PeasyDos commands.
@ x y
Sets the cursor to the position x,y.
eg.
@ "0" "0" homes the cursor
CHDIR new-directory
Sets the current directory to new-directory, if new-directory
does not exist exits PeasyDos with an error.
eg.
CHDIR "\" Sets the current directory to the root directory
CLEAR
Clears the screen
DISPLAY <expr>
Displays <expr> at the current cursor position then performs a
CR/LF.
eg.
@ "0" "10"
DISPLAY "Hello world!"
displays Hello World on the tenth line of the screen.
EXIT
Leaves PeasyDos
GOSUB <expr>
Executes the statements at the label <expr> until a RETURN is
found. At this point control is returned to the next
statement.
eg.
GOSUB "Format"
jumps to the label Format and executes the statements until
the next RETURN
Note the quotes around 'Format', if they are omitted as in,
GOSUB Format
the Variable Format will be evaluated and PeasyDos will jump
to that label, this is a very useful device - see the example
program for how to use it.
GOTO <expr>
Transfers control directly to the label <expr>.
IF <rlnl-expr> <statement>
If <rlnl-expr> is True then executes <statement> otherwise
continues execution on the next line.
eg.
IF MENUVAR $= "ESC" GOTO MAINLOOP
LOUD
Puts PeasyDos into Loud mode, see description of SILENT
command.
MESSAGE <expr>
Displays <expr> on the message line
eg.
MESSAGE "Press the space bar to continue"
RETURN
See GOSUB command
RUN <expr>
Clears the screen displays <expr> and executes it
eg.
RUN "WS"
runs the Wordstar wordprocessor
SET <variable> <expr>
Sets <variable> to <expr>
eg.
SET GREETING "Hello world"
SHELL <expr>
Same as RUN but displays "Press any key to Return to PeasyDos"
and waits for a keypress before returning to PeasyDos.
SILENT
Puts PeasyDos into Silent mode. This is similar to ECHO OFF in
DOS batch files in that commands are not displayed before
being executed. LOUD puts PeasyDos back into Loud (the
default) mode.
3.2.4 PEASYDOS FUNCTIONS.
CURDIR
Returns the current DOS directory
DOSVER
Returns the DOS version number
EDIT <expr1> <expr2>
Waits for and returns a line of input from the user, <expr1>
(which can be the empty string "") is provided as a default
and at most <expr2> characters can be entered.
eg.
SET NEWDISK EDIT "A:" "2"
FILES <expr>
Returns a list of all the files in the current directory that
match the mask <expr>.
eg.
SET CFILES FILES "*.C"
MENU <option> : <exp> {, <option> <exp> } ENDMENU
Returns the selected value from the menu. <option>s are the
choices to be displayed, <exp>s are the more detailed
explanations of those choices. If the <ESC> key is pressed the
function will return the value "ESC".
MENULIST <expr>
Same as MENU except that it takes a list, for example the list
of files returned by FILES, and produces a menu from that. In
this case only options are given and not explanations.
eg.
SET FILEVAR MENULIST FILES "*.*"
will display a menu of all the files on the disk and return
the selected files.
NEXTKEY
Returns the next key pressed.
SORTLIST <expr>
Sorts a list such as that returned by the FILES functions into
alphabetical order.
eg.
SORTLIST FILES "*.*"
SUBDIRS
Returns a list of all the subdirectories of the current directory.
Now available in Version 1.2
New operators
+ Numeric plus
- Numeric minus
/ Numeric DIV
% Numeric MOD
* Numeric multiplication
$< Alphabetically less than
$> Alphabetical greater then
New commands
SETTATT <file> <att> Sets file attributes
SETDISK <drv> Set default drive
WHILE <rlnl-exp> 'While' flow of control construct
.... WEND
New functions
BIGMENU <list> <ipl> Like MENU but uses the whole screen
and allows more than one option to be
selected.
DSPACE <drv> Returns disk free space
FDATE <file> Returns date stamp of <file>
FSIZE <file> Returns size of <file>
FTIME <file> Returns time stamp of <file>
GETATT <file> Returns the attributes of <file>.
HEAD <list> Returns the head of <list>
MID <s> <n><expr> Returns <n> chars from <expr> starting
at <s>
TAIL <list> Returns the tail of <list>
VOLLAB <drv> Returns Volume label of disk in
specified drive
LICENSE
COPYRIGHT (C) 1988 Duncan P Charlton All Rights Reserved.
This is the shareware version of PeasyDos, the programmable DOS shell, if you
would like the full version, which incorporates many advanced features, and
a printed manual and programmers guide, then please send £30.00 to:
Duncan P Charlton
The Old School House
Southstoke
Bath BA2 7DU
You are free to use, copy and distribute PeasyDos for noncommercial use
providing all the following conditions are observed.
No fee is charged for use, copying or distribution.
The program is not modified in any way.
The file LICENSE.TXT is distributed with all copies.