home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
basic
/
tools
/
cbsf
/
cbsf.doc
next >
Wrap
Text File
|
1987-10-03
|
24KB
|
595 lines
CBSF - DEFINITIVE DATA SYSTEMS (C) 1987
INTRODUCTION
------------
Programming with the new integrated basic languages, such as
Microsofts QuickBASIC* and Borlands Turbo Basic*, are a pleasure
in comparison with programming in interpreted basic. However,
having only line labels in a program can cause a lot of headaches
when extensive error trapping/correcting, and/or event trapping
are required. And if end users of your programs are asked to
report problems, then the error type and line number are
indispensable. The solution is to write the source code using
labels as usual (which helps structure and readability) and let
CBSF convert the file to line numbers for you. Even if you use
interpreted basic CBSF will be of help. CBSF does much more than
just number or renumber a given source file.
* NUMBER or RENUMBER any compilable or interpreted basic program.
* FLEXIBLE - allows file to be numbered almost any way desired.
* CONVERT multiple statement lines to single statement per line
for improved readability and easier debugging.
* RESERVED words can be left as is, or converted to upper or
lower case for quick identification.
* VARIABLES can be left as is, or converted to upper or lower
case. (Does not affect remarks or quoted text)
* REMARKS can be left as is, deleted, or numbered.
* NULL LINES can be left in source, or deleted.
* REFERENCE file is created to tell what original line/label
was and what it is now.
* NO LIMIT on size of file that can be processed. Limited to
5000 converted line #'s or labels and available disk space.
* CONVERSION from compiled to interpreted basic. Although CBSF
is not a compiler to interpreter converter, it can be
invaluable in this function.
We hope you find CBSF as valuable an aid in developing programs
as many others have. If you will take the time to read the
following instructions carefully CBSF can be a great time and
labor saving tool.
Should you have any questions, suggestions, or complaints about
CBSF, please send them to: Definitive Data Systems
18451 SE 38th St.
Newalla, OK 74857
CBSF requires 256K, and at least one floppy drive.
* NOTE - Microsoft is a registered trademark of Microsoft Corp.
and throughout the rest of this manual MIcrosoft's
QuickBASIC will be referred to simply as QB.
Turbo Basic is a trademark of Borland International,
and throughout the rest of this manual will be referred
to simply as TB.
INPUT AREA ONE - FILE SPECIFIERS AND PROCESSING VALUES
------------------------------------------------------
Input area one is the entry point for the following items:
Input File:
This is the name of the file to be processed.
Output File:
This is the name the processed file will be stored under.
Reference File:
This is the name of the file that will contain the cross
reference of the original label/line number to the new line
number.
Starting Line Number:
This is the number which the first line in the new source
file will begin with.
Line Number Increment:
This is the amount that each line number will increase by.
Tab Stop Value:
This is the value (number of columns) that the tab key moves
the cursor on your system. If you are using QB then it is
the value under the view/options menu selection in QB. For
TB tab stop should be set to 8.
Notes on File Name Input:
File names can contain a drive specifier (i.e. A:), path
specifiers (i.e. \basic\myprog\myprog.bas), and any valid
file name. To enter a file name without an extension the
period must be the last character in the file name. For
example, the name "myprog." is the file name "myprog"
without an extension. If you do not specify an extension,
the extension in brackets will be appended to the file name.
For example, the name "myprog" will default to "myprog.bas"
at the Input File prompt. When entering file names only the
Input File name need be specified. The .CNV file and the
the .REF file will assume the file name specified as the
Input File if these inputs are left blank. All file name
inputs are limited to 50 chars..
CBSF supports the following editing keys:
Cursor Up-moves cursor up one field.
Cursor Down-moves cursor down one field.
Cursor Left-moves cursor left one character.
Cursor Right-moves cursor right one character.
Backspace-deletes character to left of cursor.
Delete-deletes character cursor is on.
Insert-inserts character at cursor.
Home-moves cursor to beginning of line.
End-moves cursor to end of line.
Page Up/Page Down-change input areas. Use them at any time.
INPUT AREA TWO - PROCESSING OPTIONS
-----------------------------------
Input area two is the selection point for the following options:
Number/Renumber Source
This option tells CBSF to add line numbers or renumber the
source file specified.
Line Numbers In Source
This option tells CBSF if the source file contains any lines
that begin with line numbers. If the source has lines that
begin with numbers this option must be selected.
Single Statement/Line
This option tells CBSF to convert the source file to a
single basic statement per each line. This makes the source
file much easier to read and debug.
Basic Source Format
This option tells CBSF the type of basic it is processing,
either compiled or interpreted.
Reserved Word Case
This option tells CBSF how to handle basic reserved words.
CBSF will convert reserved words to upper case, lower case,
or leave them as is, depending on the selection.
Text Case
This option is the same as the reserved word option except
that "text" is defined as all "words" that do not match a
reserved word. Text generally is all labels and variables.
Note that text in quotes and remarks are not converted by
either reserved or text options.
Remark Action
This option tells CBSF how to handle remarks. The choices
are none (no action), delete (deletes the remark), or number
(if remark is on a line by itself, it will be numbered).
Null Line Action
This option tells CBSF how to handle "null" or blank lines
in a source file. The choices are none (no action), or
delete (null lines deleted).
Input Area Two Option Selection
Use the arrow keys to highlight the option desired and the
spacebar to select the action or setting.
Note: If "F1" is pressed while in either input area you will be
returned to DOS.
General Information On Input
If an option is selected that requires another option
to be selected, and it is not, CBSF will enable it
automatically. For example, if the Basic Source Format
option is set to "INTERPRETED", but the Line Numbers In
Source option is set to "NO", CBSF will automatically enable
the Line Numbers In Source option (set to "YES"). The Page
Up/Page Down keys are used to change input areas and can be
used at any time.
BEGIN PROCESSING
----------------
After all inputs and options are entered as desired, there are
two choices to start processing:
F9 - If F9 is pressed all option settings in Area Two will be
saved in the file CBSF.OPT, and processing will begin.
These will be the default options on each successive
execution of CBSF, until the .OPT file is deleted or F9 is
used again. If F9 is never used there will be no .OPT file.
F10 - If F10 is pressed, processing will begin but the Area Two
options will not be saved.
As processing takes place, status is indicated on the screen by
the conversion and process counters. Note that not all
conversions will require both passes, if this is the case a
message indicating so will be printed. Processing may be ended
at any time by pressing the F1 key to abort and return to input
status, or F2 to abort and return to DOS.
PROCESSING METACOMMANDS
-----------------------
CBSF supports six processing metacommands, they will help to
format and number source code, and are described in detail in
this section.
General Format
Processing Metacommands use the following syntax:
REM |command=integer value
Processing Metacommands must appear on a line by themselves.
There MUST be a space between the word "REM" and the character
"|". Case does not matter. "REM" is the same as "rem". After
the "|" comes the command. Although it is suggested that the
command follows the "|", it can be separated by spaces as long as
it is on the same line and ONLY spaces separate it. After the
command comes the value (three of the commands do not require
values), the value MUST be separated by either a space, or by an
equal sign.
STEP Metacommand
The STEP metacommand instructs CBSF to "step" the next line
number "up" to the specified amount. For example, if the
current line number assigned by CBSF is 165, (with
Number/Renumber Source option) with a step amount of 100,
when a STEP command is executed the next line will start at
200. This is because STEP is calculated by the following
formula:
NEWLINE = (INT (CURRENT LINE / STEP AMOUNT) + 1) * STEP AMOUNT
200 = (INT ( 165 / 100 ) + 1) * 100
Basically, STEP can be thought of as a way to force the next
line number to the next "tens", "hundreds", "thousands",
etc. depending on the value of STAM. (10,100,1000).
The exact syntax for STEP is: "REM |STEP".
PROCESSING METACOMMANDS cont.
-----------------------------
STAM Metacommand (STep AMount)
The STAM metacommand sets the step amount (see the
explanation for STEP above) used to compute the STEP. STAM
can be any integer number from 1 to 5000. STAM may be used
as many times as desired. The exact syntax for STAM is:
"REM |STAM=value" or "REM |STAM=100". STAM defaults to 100
when CBSF is started.
STAB Metacommand (Step Absolute)
The STAB metacommand tells CBSF that the next line processed
will assume the absolute value specified by STAB. If the
value set by STAB is 5000, then the next line after the STAB
command will be line number 5000. STAB may be used as many
times as desired. STAB can be any integer number from 1 to
65529. The exact syntax for STAB is: "REM |STAB=5000" or
"REM |STAB=value".
INAM Metacommand (INcrement AMount)
The INAM metacommand is the same as the Increment value in
Input Area one. However, INAM allows the line number
increment value to be changed during processing and at
selected points in the source file. After the INAM command
is executed, subsequent lines will use this value as the
increment. INAM may be used as many times as desired. INAM
can be any integer number from 1 to 5000. The exact syntax
for INAM is: "REM |INAM=10" or "REM |INAM=value".
SRWD Metacommand (Special Reserved WorD)
The SRWD metacommand tells CBSF to use the file CBSF.SRW
when processing. This file is discussed in detail later in
this manual. Subsequent appearances of SRWD have no effect.
The syntax for SRWD is: "REM |SRWD".
SAMC Metacommand (SAve MetaCommand)
The SAMC metacommand tells CBSF to write all processing
metacommands to the .CNV file. This option is off by
default, and processing metacommands are discarded after
execution of the command. Note that this option does not
effect compiler metacommands (REM $command or $command).
Subsequent appearances of SAMC have no effect. The syntax
for SAMC is: "REM |SAMC".
General Information on Processing Metacommands
The metacommands SRWD and SAMC should be placed at the start
of the source file. If SAMC is to be used in the source
file, then it should be first or any metacommands before it
will not be written to the destination (.CNV) file. If SRWD
is used it must appear before any labels that look like
reserved words. Note that compiler metacommands are handled
by CBSF differently depending on whether they are QB or TB.
In the case of TB they are handled as standard lines, that
is, if the Number/Renumber Source option is YES, they are
numbered as any other line would be. In the case of QB,
metacommands will NOT be affected as long as they are
entered in the form "REM $xxxx". They must have only ONE
space between the word "REM" and the "$".
THE CBSF.RWD FILE
-----------------
This file should contain all the reserved words for the
particular version of basic to be processed. The file supplied
contains all the reserved words for QB version 3.0. The required
changes for QB ver. 2.xx and TB ver. 1.0 follow. (All .RWD and
.SRW files are supplied when you register CBSF).
Modification of this file is very simple, but there are a few
rules which MUST be followed for CBSF to operate properly.
1. ALL reserved words MUST be upper case (all capital letters).
example:"goto" will not work, "GOTO" is correct.
2. There can be only ONE word per line.
example:"PRINT USING" will not work. "PRINT" should be
entered on a line by itself, as should "USING".
3. Any characters that are not alpha-numeric should not be
entered. example:"INPUT" not "INPUT#", "CHAR" not "CHAR$".
4. Reserved words are in alphabetical order by FIRST character.
They do not have to be in exact alphabetical order, but must
be grouped by the first character in the word. All words
beginning with "A" must come first, all words with "B" next,
and so on. Look at the file CBSF.RWD for an example.
Modifications can be made with any text processor that produces
ASCII output, such as the editors in QB or TB.
Modifications for QB ver. 2.XX
If QB ver 2.xx is being used then the CBSF.RWD file needs to be
modified for that version. In this case the change needed is the
deletion of the following reserved words:
CASE CONST CVDMBF CVSMBF
DO ELSEIF LOOP MKDMBF
MKSMBF SELECT UNTIL
Delete these from the CBSF.RWD file and CBSF will be ready to
process QB ver. 2.xx files.
Modifications for TB ver. 1.0
If TB is being used then the CBSF.RWD file needs to be modified
for TB. The changes needed are as follows:
Delete the following:
ACCESS AUTO LOCK REDIM
SADD UNLOCK EDIT LLIST
MERGE MOTOR NEW RENUM
Add the following:
BIN BINARY CASE CEIL
CLNG CVMD CVMS DECR
DEFLNG DEFSTR DELAY DO
DYNAMIC ELSEIF ENDMEM ERADR
EXP10 EXP2 INCR INLINE
INSTAT INTERRUPT LCASE LOG10
LOG2 LOOP MEMSET MKL
MKMD MKMS MTIMER REG
SEEK SELECT SERVICE UCASE
UNTIL VARSEG
THE CBSF.RWD FILE (cont.)
--------------------------
In order to use CBSF with other Basic programming languages
simply compare the list of reserved words for that language with
the CBSF.RWD file and make any necessary changes. Or a new
CBSF.RWD file can be made following the above rules, with any
text processor that produces ASCII output.
THE CBSF.SRW FILE
-----------------
The CBSF.SRW file contains a list of all reserved words that may
also be used as labels. These words are ONLY those words that
end with a "$", and like the reserved words described above, are
entered without trailing symbols (no "$"). To find out if a
reserved word can be used as a label, write a short program such
as:
CHR: PRINT "TEST" (for QB) or:
CHR:
PRINT "TEST" (for TB)
If this code will compile and run (prints "TEST") then the word
"CHR" which looks to CBSF like "CHR$" is a special reserved word.
The file supplied contains all the special reserved words for QB
ver. 3.0. To use CBSF with QB ver. 2.xx or TB make the following
changes:
Delete these words:
MKDMBF MKSMBF
CBSF.SRW is now ready for QB ver. 2.xx. To complete changes
required for TB add the following words:
BIN LCASE MKL MKMD
MKMS UCASE
CBSF.SRW is now ready for TB.
As with CBSF.RWD this file can also be modified for whatever type
of basic being used, or a new file can be created.
General Information for CBSF.RWD and CBSF.SRW
All entries in both files MUST be capital letters only. There
should be no spaces in the word or on the line with the word.
CBSF will only use the files with the exact names of "CBSF.RWD"
and "CBSF.SRW". If more than one type of basic is being used,
then separate files for each type can be created, such as
"TB.RWD" and "QB3.RWD". A batch file can then be made to rename
the file to the proper name, load CBSF, and then change the name
back at completion of the session. Although it is not
recommended to use reserved word as labels, this will help if you
must. Do not use the "SRWD" metacommand if there are no labels
that look like reserved words in the source file as processing
speed is slightly reduced with this option.
OTHER CBSF FILES
----------------
The Input File
The file to be processed by CBSF must be an ASCII file. Both the
QB and TB editors produce ASCII files, and interpreted basic can
write files in ASCII by appending an ",a" to the end of the SAVE
command (i.e. SAVE "MYPROG.BAS",A). If the file is not an ASCII
file CBSF will still try to process it, but the resulting output
file will not be usable.
The Reference File (.REF)
The reference file is the file that contains a list of labels or
line numbers from the input file, and what they are in the output
file. For example, if the label in the input file is
"INPUT.ROUTINE" and the Number/Renumber Source option is on, then
CBSF will assign a number to this label. This will be stored in
the .REF file. If CBSF assigns the number 500 to this label, the
reference file entry will be: "INPUT.ROUTINE", 500. If the
Number/Renumber Source option is not selected, a .REF file will
not be produced.
The Option File (CBSF.OPT)
The CBSF.OPT file contains the options from input area two, if
the F9 key is used to start processing. This file does not come
with CBSF, but is created by CBSF. If F9 is never used, then
CBSF.OPT will not be created.
The Temporary File (CBSF.TMP)
The CBSF.TMP is the file that CBSF uses to store the converted
file, to be read for processing. Because certain options in CBSF
require two passes through the source file, CBSF needs a place to
store the temporary information. This file is always stored on
the same drive, and in the same directory (if applicable) as CBSF
and its associated files. Therefore, there must be sufficient
space on the disk being used for CBSF to create and store this
file (usually about the same size as the file being processed).
This file is never seen by the user except in certain error
conditions, discussed later.
The Output File
The output file is an ASCII file with the conversions as
selected. The only rule is that for the output file to run, the
input file should be able to run also.
General File Information
All files created and used by CBSF are standard ASCII files.
All information stored is in string format.
Hint: when using CBSF, best results can be obtained by doing all
processing on a ram disk. This provides the fastest processing
as well as reducing wear on disk drives.
Also note that the original source file is NEVER changed by CBSF.
PROCESSING ERRORS
-----------------
Errors during processing are displayed and processing stops.
Follow the instructions on the screen when an error occurs to
start processing again.
"PROCESSING ERRORS". If an "Illegal Function Call" or a
"Subscript Out of Range" error occurs (error #'s 5 and 9), the
message "PROCESSING ERROR - X LINE - XXX" is printed on the
screen. In this case the CBSF.TMP file will not be deleted, and
can be listed to determine if the error is in the source file by
examining the line in the input file immediately following the
last line printed in the CBSF.TMP file. If these errors persist
(especially in the case of error code 9), then a copy of the last
few lines of the CBSF.TMP file and a few lines before and after
the line causing the error in the input file, should be sent to
our office for evaluation. Also, please include the error number
and line number printed in the error message.
"UNEXPECTED ERROR" If this occurs, please send the line number
and error number for evaluation. (If these errors are persistent)
Note that on an "UNEXPECTED ERROR" there will be no CBSF.TMP file
to examine.
"INPUT PAST END" error. If this error occurs, the output file
should be examined. Generally, these errors are caused by a bad
end-of-file marker, but the resulting output file may still be
usable.
"GENERAL INPUT/OUTPUT" errors are lumped under the same error
message, and the type (number) of the error will be printed,
refer to your basic manual for a description of this error.
"SYMBOL TABLE OVERFLOW" error. CBSF does not have a limit on how
many lines it can process (except for the demo ver.), it does
however, have a limit on the number of labels and/or line numbers
it can convert. This maximum is 5000. For example, if the
source file has 10,000 lines in it, but only has 1800 labels,
then the limit of 5000 is not exceeded. However, if a source
file has 10,000 lines, and they are all numbered, CBSF will
process until it reaches line 5001, at which time a "SYMBOL TABLE
OVERFLOW" error will occur. Note that this error is only valid
if the Number/Renumber Source option is selected. It may be
easier to think of the 5000 maximum as the maximum number of
entries in the file .REF.
"CBSF.SRW FILE NOT FOUND" error. This error has no effect if the
SRWD metacommand is not used. If SRWD is used, then if CBSF
encounters a label that looks like a reserved word, it will be
treated as a reserved word.
"CBSF.RWD FILE NOT FOUND" error. Processing should not really be
attempted if this error occurs (although the option to continue
is available) because, depending on options selected, processing
results can be unpredictable at best.
All other errors are explained by the message on the screen.
When writing to us about errors, please include the error line
number, error code, type and ver. of file being processed (QB
v1,v2,v3 or TB v1, Basica, GWbasic, etc.) Also include the
version of CBSF and serial number from your CBSF disk.