home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilst
/
treesize
/
!TreeSize
/
HowItWorks
< prev
next >
Wrap
Text File
|
1992-07-25
|
4KB
|
76 lines
!TreeSize - How it Works
Each PROC and FN in the !RunImage file begins with a REM statement
explaining what the routine does.
When you drag a directory icon to the application icon, the filer sends a
message through the Wimp to our application, giving the full pathname of the
directory whose icon you have dragged. This message is intended to invite us
to load the object in question, but, instead, the application uses it when
calling the procedure PROCdirectory, which simply catalogues the directory
using the system call OS_GBPB, and proceeds to work through the entries,
adding up the size of the files.
If it comes across a sub-directory, it call PROCdir, which performs a
similar function to PROCdirectory, but does not produce a window. PROCdir is
recursive, which means that, if it finds another sub-directory in the one
which it is checking, it calls itself. In this way, the routine can deal
with directories nested to any level.
Each time the procedure calls itself, it uses a bit more of the memory
allocated to the application. The amount of memory is set by a line in the
!Run file, and has been found to be sufficient for directories nested up to
nineteen deep.
If you have a deeper nesting of directories on your disc, you may run out of
memory, resulting in an error message, such as "No room". If this happens,
you will need to edit the !Run file. This can be done by loading !Edit. You
should then hold down Shift while double-clicking on the !TreeSize icon to
show its directory, and dragging the !Run file icon to the !Edit icon.
The !Run file contains a line:-
Wimpslot -min 32k -max 32k
By changing the two 32k figures to a higher figure and resaving the file,
you can increase the amount of memory allocated to the application. Note
that memory is allocated in blocks of 8k, or 16k if your machine has more
than 1Mb of RAM, so your higher figure should be a multiple of this amount.
This application uses multiple windows of different heights, which have to
be created as required. Each window is based on a header window, whose
template is contained in the Templates file.
Sixteen windows may be open at any one time, their details being held in
array variables windno% and title%. Their titles are held as indirected data
in a single memory block, at t_blk%. When a window is created, PROCfindspace
checks the block for a string of zeros long enough to be overwritten by the
title. When you close a window, it is also deleted, its title is cleared
from the block and its array variables are reset.
If you press Escape during cataloguing, you interrupt the process of
creating a window and adding icons to it, though the window has not, at this
point, been opened. In order that this window does not become one of the
sixteen that the application can handle, the error handler FNerror deletes
it and removes its details from the window table.
During initialisation, the routine PROCfilesys checks for the presence of
floppy and hard discs, and creates the main menu accordingly. It does this
by using the system call OS_FSControl to detect the names of all existing
filing systems, then using the name of each one to check for the existence
of a system call "xxx_Drives", which returns the number of floppy or hard
drives for that filing system. Each name is tried up to six times, as lower
case, upper case and lower case with an initial capital, with or without the
name being followed by the letters "FS".
If your you have a drive which does not appear on the menu, you can open a
filer window on it and drag any object from its root directory to the
application's icon with shift held down.
As the application knows nothing of the drag operation, it cannot check the
shift key until it receives the message from the filer to load the object in
question. That is why it is necessary to release the mouse button before you
release the shift key.
I would like to thank Ian Copestake of Ian Copestake Software for his advice
concerning the IDE filing system, and for testing the software.