home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d01xx
/
d0134.lha
/
Library
/
libr.doc
< prev
next >
Wrap
Text File
|
1988-03-18
|
11KB
|
471 lines
LIBRARY
A Text Storage Program For The Amiga(tm)
by
Bill Brownson
June 11, 1987
Copyright 1987, Bill Brownson
Introduction
One of the most common uses for any computer is the Storage of data of
various types. There are a variety of programs available for Data
Base Management, Word Processing and similar types of software. The
data Base programs normally require that all records conform to a
specific format, and normally require that all records be the same
size. Word processing programs have no requirement for content or
form, but it is difficult to find a specific file referencing a
subject, particularly if there are several files which are about the
same general subject. Archive Programs, like word processing, have no
requirement for content or form and waste no space but with them it is
difficult to catalogue information for easy retrieval at a later date.
Both word processing and data Base programs waste disk space. The
data Base wastes space by requiring that all records be the same size,
and the text files (indeed all files) waste space because, on the
average, every file wastes one half of a disk allocation unit, whether
it is 128 bytes (early CP/M) or 512 bytes (AMIGA(tm)). It would be a
definite advantage if there were a way to store files without wasting
space and still be able to search files to find records based on
selection criteria.
The LIBRARY is a program which does exactly that. The LIBRARY program
stores files without regard to structure or content, and allows
searching for specific files by word or phrase and also allows
searching by more complicated methods. It also allows direct access
to the Amiga(tm) CLI interface. The program is entirely menu driven,
allowing for a more "user friendly" interface.
Description
The LIBRARY program is written entirely in assembler. There is a
second program which will purge the LIBRARY of deleted files, and also
sort the files in the LIBRARY in alphabetic order. This does not need
to be done often, but will speed searches by arranging the file in the
order that it is searched.
The program may be run from either CLI or workbench. The first thing
the program will do is request the name of the LIBRARY to use. When
this name is entered, the program will attempt to open the given file.
If the file does not exist, the next information requested will be a
verification of the name and the question "do you want to create it?".
If the answer yes, the program will then create two files, one with
the extension ".lbr" and the other with the extension ".ndx". If the
user answers no, the program will return to either Workbench or CLI.
After file creation or if the file exists, a menu will be displayed,
and the user will be able to enter his choice of ten menu items.
Enter Selection [ ]
1. Add file 6. Delete File
2. Display File 7. Rename File
3. Display Directory 8. New CLI
4. Keyword Search 9. Logical Search
5. Write file to disk Q. Exit program
The program may be exited by pressing "Q" at the option request.
Add File
This is the basic operation of the program. Text files which have
been created by one of the various editors available to the AMIGA(tm)
are read off of the disk and added to the LIBRARY.
When this option is selected, the program will request the name of the
file as it exists on disk, and then verify that it is there. If
desired, it is possible to return to the menu by pressing "Return" at
the first character or ESC at any character. It will then ask for the
internal name for the file. This name can include leading or included
spaces and any printable character. After the internal name is
entered, the program will begin reading the file and adding it to the
LIBRARY. After the file has been added, it is immediately available
to all other options. When a file is first added, it is immediately
placed in proper sort order in the internal Directory. All directory
entries are stored in upper case for consistency. Multiple files of
the same name are allowed but not recommended because of the possible
confusion in searches or writing to disk.
The recommended format for text files is left flush, and, whenever
possible, having the most common words and phrases which will identify
the document at the start. This is not necessary, but will allow a
quick search of large files without the requirement of searching the
entire file.
Display File
The second most common use of a file (or record) is to be able to
display it. When Display is selected, the program will first check to
see if an index (created by one of the search methods) exists. If
there is an index, the program will ask if the user wants to use the
index. Any response besides a "y" or "Y" will request the name of the
file to display. Enter only as much of the name as is necessary.
The program will then display the selected file(s) which match the
entry request. The menu can be returned to by pressing "Return" or
"ESC". If use of the index is selected, all files selected in the
last search will be displayed in alphabetic order.
Files are displayed 20 lines at a time, with a pause between sections.
Pressing "RETURN" will clear the screen and display the next 20 lines.
If there is more than one file which matches the entry, the program
will pause between files, and then display the next file.
Directory
This option will display a list of all of the files which are
currently in the LIBRARY. The entries are displayed in sorted order.
The program will display the file names until the screen is filled,
and then pause until "RETURN" is pressed.
Search
This is the first method of finding which files contain a specific
word or phrase. The program requests a word or phrase to search for,
and then commences the search. Pressing any key during the search
will halt the search. File names are displayed as they are searched,
and all files which have the given word or phrase are displayed on the
screen. The search speed depends on the operating system. A typical
search of a LIBRARY with 130 entries in 109K should take under 20
seconds from a floppy drive and version 1.2 of the operating system.
Limited wildcarding (only "?") is allowed, and the search will
consider a line feed to be equivalent to a space.
Write File to Disk
Having the text files in the LIBRARY program would not be very useful
if there was no way to extract the files for access by an editor or
the printer. This option allows selected files to be written to the
disk. The program first checks for the index created by search. If
it is found, the program will ask if the index is to be used. Any
response except "Y" or "y" will bypass the index. If index use is not
requested or there is no index, the program requests the name of the
file. It is necessary to enter only enough of the file name to select
the specific file (or files). The program will then request the disk
file name to write to. At either request, a "Return" or "ESC" will
return the user to the menu. The program will then create the file
(deleting any file of the same name). The printer (as "PRT:") may be
specified instead of a disk file if hard copy of a file is required.
If index use is selected, all files selected on the last search will
be output.
Delete
Delete functions in a similar manner to the other options. It will
request the name of the file to delete, with a "Return" or "ESC"
returning the user to the menu. In this particular case, the entry
must match exactly the name of the file to be deleted (except for
case). The file is then marked for deletion, and is immediately
removed from the directory. The file is still in the LIBRARY,
however, and may be recovered by using an editor such as "MicroEmacs"
to extract the file to disk to be re-added. The file is not
permanently deleted until the "Packit" program is run.
Rename File
Files are not always stored under the most descriptive title. This
option allows files to be renamed. This option requests the old file
name, and then the new file name. Again, the menu may be returned to
by pressing "Return" in the first character position. The entry must
(except for case) match exactly an entry in the directory. renamed
files are immediately placed in the directory in sorted order.
Logical Search
The real usefulness of a program of this type is the ability to find
data which matches certain criteria. This option is similar in
function and speed to the normal search, but allows some very
important options.
As usual, the program requests a word or phrase to search for. After
this is entered, the program will present a mini-menu which will allow
for (1) and, (2) or, or (3) and not options. After this is selected,
the program will allow entry of a second word or phrase. searching
continues in the same manner and is only slightly slower than the
standard search. These options make it very easy to find a specified
document or documents. Examples include searching for "disk" and not
"hard" and searching for "disk" or "floppy" and the obvious searching
for files with "disk" and "floppy".
NewCLI
This option will open a new screen on the Amiga(tm). It is a standard
window allowing full access of to the Command Line Interface of the
Amiga(tm). The user may return to the LIBRARY by typing "ENDCLI"
Non-Menu Items
Fast Search
Comprehensive searches are time consuming. The LIBRARY program has a
maximum search speed of about 15K per second from ram. At maximum
speed on a maximum size file (32 M), this search would take 35
minutes. As this is unacceptable in most circumstances, a fast search
method has been added for large files. It only searches the first 512
bytes of a file, if the file is larger than 512 bytes, or the entire
file if shorter. This reduces the maximum number of disk reads to one
per entry or about 500 for the maximum size file. The program should
be able to accomplish this search in under 2 minutes, depending on the
hard disk drive used. This option is a straight search, not the
Logical search. This search is accessed by typeing "F" at the Menu.
Ego Message
Pressing "I" will give my name and address.
The LIBRARY program will run on any AMIGA(tm) using workbench versions
1.1 or 1.2. It is has been tested on 5 1/4" drives and 3 1/2" drives.
It has been tested on both 68000 and 68010 CPUs. The only current
restrictions are a limit of 500 files in a single LIBRARY and file
sizes are Limited to 64K giving a maximum LIBRARY size of 32
Megabytes. Any type of file may be stored within the File, but
searches on object modules may prove to be meaningless.
The full system is $29.95 and available from
Bill Brownson
7217 Romford Way
North Richland Hills, TX 76180
Amiga is a trademark of Commodore-Amiga, Inc.