home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
ovlay.zip
/
OVLAY.DOC
< prev
next >
Wrap
Text File
|
1990-04-17
|
5KB
|
88 lines
Documentation for OVLAY.CLA version 2
-------------------------------------
This is a method of allowing overlayed procedures to call each
other. This is accomplished by adding the name of the called
procedure to a stack, plus (optionally) the name of the procedure
to return to, and a message (80 bytes) to be passed to the
procedure. The first procedure then returns, allowing a master
control procedure to gain control. The control procedure pops
the top record off the stack, determines if it is processing a
'call' or a 'return', and calls the appropriate procedure.
4 changes were made to the original version to make it more
efficient:
1. The mnemonic names of procedures were changed to
numeric byte equates from 1 to n allowing
enhancements 2 and 3.
2. The case statements in SEL_PROC were replaced
with an execute structure which should execute
in the same amount of time regardless of the
number of overlay procedures it is managing.
(Overhead time to process a large case
structure could have become significant if
the number of procedures was large).
3. The 2 12-byte strings in the stack structure
were replaced by a pair of BYTE fields - a
savings of 10 bytes per record in the stack.
This would also reduce string comparison
time overhead.
4. The message string was moved to the end of
the structure so that Clarion's implicit
truncation could chop off the portion of it
that was unused - a potential savings of up
to 80 bytes per stack record (depending on
the messages being passed).
How to use it.
1. You must assign equates for all procedures (that you will be
using) into PROCDEFS.INC. You must put the procedure
names into the EXECUTE structures in the SEL_PROC function in
OVLAY.CLA (in the same numerical order as they are
declared in PROCDEFS.INC). NOTE: PRETURN EQUATE(01)
is a MANDATORY statement in PROCDEFS.INC.
2. Modify the MEMBER statement in OVLAY.CLA to match your
main program.
3. Add the line INCLUDE('OVLAY1.CPY') to your MAP structure
4. Add the lines INCLUDE('OVLAY2.CPY') to your global
data area.
5. The main program should push the first procedure onto the
stack and call PROC_CTL to start the ball rolling.
6. For one procedure to call another procedure, it should first
push the call record onto the stack, and then execute
a RETURN statement.
7. To push a call record/procedure onto the stack, use the call
STACK_PROC(call proc,return proc,'message')
call proc is the name of the procedure you are calling as
defined in PROCDEFS.INC
return proc is the name of the procedure that should gain
control after call proc terminates (it does not
have to be the procedure that is making the call
but imposing that restriction may make debugging
easier). If you do not want a return proc
then use the name PRETURN.
message is data to be passed to the called procedure (via
global string variable PMSG). It is currently 80
bytes long but you can change it. If you don't
have a message to pass, just leave the quotes empty.
Message can be a constant in single quotes, (')
or the name of a string variable or constant.
Limitations:
1. All parameter passing must be through PMSG.
2. Calling procedure should close all screen structures before
making the call or unexpected results may occur.
3. If control is returned to a procedure after a call, it's
logic should either determine the difference between a first
time call and a return so that it may jump to the appropriate
point for resuming code execution if necessary. This may
require the use of global flags in the main program.
4. If a procedure making a call to another procedure needs to
save any of its local data, it must do so explicitly before
making the call, and then restore it explicitly upon
receiving control back.
For an example of the use of OVLAY.CLA, see OVSAMPLE.CLA