home *** CD-ROM | disk | FTP | other *** search
-
- TPTool19.DOC
-
- TPTOOL.LBR DOCUMENTATION, February 1985, version 1.9.e
-
- This library contains the source from the book "Software Tools
- in Pascal" by B.W. Kernighan and P.J. Plauger, Addison-Wesley,
- 1981. (ISBN 0-201- 10342-7). It has been adapted for Turbo
- Pascal.
-
- The tools are embedded in a shell which implements
- redirection, pipes, and sequential processes. It runs under
- any Turbo Pascal, on CP/M-80, CP/M-86, or MS-DOS. In short,
- much of UNIX can be run on your micro.
-
-
- HOW TO IMPLEMENT:
-
- Include files needed:
- shell.pas toolu.pas fprims.pas chapter*.pas OS-*.pas
-
- All systems
- In TOOLU.PAS, set Configuration Section
- In CHAPTER1.PAS include appropriate OS- file
-
- CP/M-80
- Compile SHELL.PAS with the COM option
- Compile CHAPTERX.PAS with the CHAIN option
- Execute SHELL
-
- CP/M-86
- In configuration section, change ".COM" TO ".CMD"
- Set minimum code ("O" option) to 0800
- Set minimum data ("D" option) to 0200
- (display will show a higher value)
- Follow same procedure as CP/M-80
- When compiling .CHN files, note code and data
- sizes; each must be <= set minimum
-
- MS-DOS
- In Configuration section, use ".COM"
- Same procedure as CP/M-86
-
- Concurrent CP/M
- Set maximum free dynamic memory
- Same procedure as CP/M-86
-
-
-
-
- PORTABILITY AND TESTING EXPERIENCE
-
- CP/M-80: AppleII, DEC Rainbow -- production use
- CP/M-86: DEC Rainbow -- most routines tested
- MS-DOS: DEC Rainbow -- sporadic tests
- Concurrent-DOS, CCPM: not tested but believed to work
-
-
- PUBLIC DOMAIN AUTHORIZATION BY AUTHORS
-
- The following authorize each of their contributions to the
- public domain.
-
- Brian J. Kernigan: Design and implement system, write book
- (with P.J.Plauger, 1981).
- Bill McGee: Type code in from book, implement shell, adapt
- to UCSD, MT+, and Turbo Pascals on CP/M-80 (1984)
- Willett Kempton: Add pipes, sequential processes,
- redirection to shell, error recovery, configuration. Adapt to
- CP/M-86 and MS-DOS (January 1985)
-
- Distribution coordinated by Bill McGee, 613-828-9130. This
- document was written by Kempton and McGee.
-
-
-
- NOTES
-
- Compiled Turbo code is fast enough to make this a useful set
- of tools for file manipulation. Pipes are more efficient if a
- "memory disk" is used. Nevertheless, don't expect this to run
- nearly as fast as UNIX on a VAX.
-
- Unless you are familiar with the UNIX tools, it will be
- difficult to understand this system without the Kernigan &
- Plauger book.
-
- To pipe, use '|', to add processes, use ';'. To put '|',
- ';', or ' ' (blank) into arguments, enclose them in " ".
- Pipelines will normally have '<' in the first process, and '>'
- in the last process, with neither '<' nor '>' in any
- intermediate processes. If you redirect to a file, and it
- exists, it is overwritten (destroyed) without warning. Be
- careful with '>'! For more information, see any UNIX manual.
-
- The source code is about 4,500 lines. On any of the three
- operating systems, the entire runtime system occupies about
- 130K. The drive to which piping is done must have enough space
- for the total sizes of any two adjacent pipes.
-
-
-
- EXAMPLES
-
- These examples escalate rapidly in complexity. (Some
- examples may be split across lines for readability. Each
- single pipeline to shell must be typed on a single line.)
-
- Show the contents of file "read.me" at the console:
-
- $ copy <read.me
-
-
- Copy from one file to another (overwriting the new):
-
- $ copy <oldfile >newfile
-
-
- Concatenate two files together into a third file, then count
- words in the third file:
-
- $ concat f1.txt f2.txt >f3.txt ; wordcount <f3.txt
-
-
- Same operation, without keeping the third file:
-
- $ concat file1.txt file2.txt|wordcount
-
-
- Print an alphabetized listing of all procedures and
- functions, with their parameters, from file "toolu.pas".
- (There are faster ways to do this operation.)
-
- $ translit <toolu.pas A-Z a-z|change procedure function |
- find "% *function"|change "% *function *"|sort >lst:
-
-
- Make a file containing the names of all files beginning with
- C, T, O, F, or S and ending with .PAS, then report how many
- there are:
-
- $ list|find %[CTOFS]?*.PAS|sort >flist;linecount <flist
-
-
- Use the file list created above to list all uses of
- "ENDFILE" in all of those files:
-
- $ copy <flist|change ?* "e &@nf@ng/ENDFILE/p" |edit
-
-
- Execute a shell command which has been stored in the first
- line of the file "proclist.shl"
-
- $ shell <proclist.shl
-
- Exit from the shell back to the host operating system:
-
- $ quit
-
-
-
- BUGS
-
- Edit (Chapter 6), if given a file over 2000 lines, will
- truncate extra lines and say the file is only 2000 lines.
- Edit, linecount, compare (& others?) will ignore a partial
- line (without CR LF) immediately before eof. Sort looses parts
- of files over 300 lines long. Empty files cannot be opened for
- reading.
-
- If the system is abnormally halted (i.e. by the Turbo
- runtime or a user control-C), the user has to manually delete
- the file "$PIPE0", or the next shell will start abnormally.
- Error trapping could be more extensive, and a method for
- halting output is needed.
-
- Directory listings are implemented only under CP/M-80 and
- MS-DOS version 2, not CP/M-86 or MS-DOS ver 1.
-
- If overlays were used in place of chaining, system size
- would be reduced, and the command cycle would be faster.
- However, this would limit the system to owners of Turbo verson
- 2. (Next revision may require Turbo ver 2). Obvious speedups
- have not been exploited ("first make it right, then make it
- faster").
-
- Calls to SHELL are not truly recursive; they simply read the
- first line of standard input and put it in the process queue.
- (Most easily fixed after overlays have been implemented with
- true recursive calls in root.)
-
-
-
- WANTED
-
- The bug fix to enable CP/M-86 directory listings would be
- greatly appreciated. A file "TEST86.PAS" is included for
- testing "OS-CPM86.PAS" Please send CP/M-86 mods to Willett
- Kempton at Rainbow_Data (Fidonode 36), other mods to Bill
- McGee as noted above. Versions will have three numbers (e.g.
- version 1.9.0). Revisors who resubmit to their local boards
- are asked to change only the third number (e.g. version
- 1.9.a).
-
-
-
-
-
-
-
-
-
-
-
-
-