home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
doc
/
fpcutils.txt
< prev
next >
Wrap
Text File
|
1989-10-28
|
8KB
|
234 lines
°F-PC-Utils Utilities Provided in F-PC
──────────────────────────
F-PC provides a number of tools to make exploring and programming in
Forth easier and more efficient.
Categories
∙Decompiler Un-compiles memory to see what was compiled.
∙Debugger Source level debugger for Forth words
∙Dump-Memory Examine any memory area of the computer.
∙Where-Used Shows where a word is used.
∙Stack-Print Examine the contents of the forth stack.
∙View/Browse Hypertext link around the F-PC source code.
∙Word-Help Operational Help on any F-PC word.
∙Words-Like Scans dictionary for words containing a string.
∙Multi-File-Search Scan multiple filespecs for a string.
∙Multi-File-Edit Edit multiple files containing a string.
°Decompiler Forth Decompiler
────────────────
The word ∙SEE will Un-compile any (non-code) Forth word and show you the
compiled source for that word.
Typing: SEE ∙HEX <Enter> <Enter> is the Enter key.
Will show: : HEX
16 BASE ! ;
The decompiler can also be used on other Forth words types as well. The
primary advantage of the decompiler is that it is available even when the
source code is not available for viewing.
°Debugger Debug Hi-level Forth Words
──────────────────────────
F-PC contains a source level debugger that allows stepping through Forth
Colon definitions as they execute while examining the stack operations.
This can be very useful when looking for renowned "Stack Underflow"
problem.
Two words are available for starting the debugger, they are:
∙DEBUG <word> <Enter> Start debugging <word> when it is later
executed.
∙DBG <word> <Enter> Start debugging <word> now.
When the debugger is invoked, the source for <word> will be shown on the
upper lines of the display with the current word hilighted in reverse
video. A running word by word scroll with the current stack contents will
appear at the bottom of the screen allowing you to step through the
definition and watch what happens.
°Dump-Memory Display Memory Contents
───────────────────────
F-PC has words to dump any portion of memory in the computer. Multiple
words are provided to make it easier to examine certain areas of the
computers memory.
Stack contents Word Function
─────────────────────────────────────────────────────────────────────
( address length ) ∙DUMP Dumps CODE segment
( segment offset length ) ∙LDUMP Dumps ANY segment
( relative-segment length ) ∙XDUMP Dumps LIST segment
( offset length ) ∙YDUMP Dumps HEAD segment
XDUMP takes the "relative-segment" that is compiled into the BODY field
of a COLON definition and adds the contents of XSEG to determine where to
XDUMP from.
°Where-Used Where is This Word Used
───────────────────────
Just as it is useful to look at a word's source to see how it works, it
is also useful to see how a word is used. The word to do this is:
∙REF <word> <Enter>
All words that use <word> will be listed along with their vocabularies.
See also ∙WORDS ∙HELP
°Stack-Print Display Data Stack
──────────────────
F-PC provides two ways to look at the stack non-destructively. At the
Forth command level, you can type ∙.S <enter>, to see the stack displayed
horizontally with the top of stack to the right. The second way to display
the stack is with a background task that is watching the keyboard waiting
for both SHIFT keys to pressed. Then the routine detects both Shift keys,
it pulls down a stack from the top of the screen which will remain visible
until you release the Shift keys. you can try it NOW, although you will
probably only see the message "Stack Empty" appear. At the Forth command
level, after you have placed several items on the stack, a menu-like window
will be pulled down showing the stack contents.
°View/Browse View or Browse a word
─────────────────────
When installed on a hard disk drive F-PC has immediate access to the
source for every word in the system. You can browse ANY Forth word by
typing the following command:
∙BROWSE <word> <Enter>
F-PC will lookup <word> and startup a browser on its source file for you
to examine.
F-PC actually has several ∙ALIAS or shortcut names you can use for the
above command. Any of the following will work the same as BROWSE.
∙B ∙VIEW ∙V
°Word-Help Give me Help on a Word
──────────────────────
Just as the source for any word in F-PC can be Browsed of Viewed, you can
get usage Help on any word in F-PC with the following command:
∙HELP <word> <Enter>
The <word> will be looked up, and the help file containing help for
<word> will be shown to you in a browser.
An ∙ALIAS or shorthand name for HELP is ∙H .
See also ∙WORDS ∙REF
°Words-Like Words Containing
────────────────
F-PC can show you which words in its 2000+ word dictionary that contain a
particular sequence of characters. The command is:
∙WORDS <sub-string> <Enter>
All word in the dictionary regardless of which vocabulary they are in
will be displayed along with the vocabulary name they are in.
You can even pass two strings to WORDS and it will show words which
contain only BOTH strings.
∙WORDS <sub-string1> <sub-string2> <enter>
See also ∙REF ∙HELP
°Multi-File-Search Find a String on Disk
─────────────────────
There are times when you would like to know in which files a particular
word or phrase is used. For example you might want to know every place
that uses a particular graphics word, or maybe you can't remember shich
file contains the serial interface words. F-PC makes it easy to look for
such things on your hard disk with the following command:
∙FLOOK GRAPHINIT SRC\*.SEQ <filespec> <filespec>
In this example, we are looking for the word GRAPHINIT in the
subdirectory SRC, and we are looking in all .SEQ files. Multiple file
specifications can follow and all files matching will be searched. The
search is NOT case sensitive. You can print all occurances found in the
above command by preceeding it with the ∙PRINT command as follows:
∙PRINT FLOOK GRAPHINIT SRC\*.SEQ
See also ∙EDITALL
°Multi-File-Edit Edit all occurances of a String
───────────────────────────────
Like FLOOK on the previous screen, there are times when you want to
change all or almost all occurances of a character sequence from one string
to another. F-PC provides the ability to do this in the following command:
∙EDITALL GRAPHINIT SRC\*.SEQ <filespec> <filespec>
In this example perhaps you want to change all occurances of GRAPHINIT to
GRAPHICS-INIT, as would occur if you changed the graphics package you were
using. Each file containing GRAPHINIT will be started in the editor at the
first occurance found. You can then change it and search for additional
occurances with Alt-F6, the repeat search command in the editor.
When you leave the editor saving changes, the search will continue and
start the editor on the next file where a match is found.
See also ∙FLOOK