home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
utilities
/
utilst
/
zap
/
!Zap
/
Docs
/
E-Zapcalls
< prev
next >
Wrap
Text File
|
1995-06-19
|
46KB
|
1,093 lines
*************************************************************************
* >E-ZapCalls Documentation of Zap entry points (how to call Zap) *
*************************************************************************
Zap does NOT have a SWI interface as it uses registers R8-R10 to point to
data blocks, and these cannot be passed to swi's. To call Zap you will need
to know the address of the Zap module workspace (ie it's private word). If
you are an extension mode then this will be passed to you in R12 whenever you
are called by one of your entry points. However, for the first call you make
to Zap, when you add your module to it's list via Zap_Addmode, you will not
know it. Then you should use OS_Module 18 to find it. Eg,
SYS "XOS_Module",18,"Zap" TO R0,R1,R2,R3,workspace%
Now, the first word in Zap's workspace contains the address of a table of
Zap's entry points. Thus to call the entry point (documented below) at offset
a% I suggest you use the basic macro given below.
REM Call Zap at entry offset a%
REM Entry: R0-R11=args R12=zap workspace
REM Exit : R0-R11=returned values R12 preserved R14 corrupted
DEF FNcall(a%)
[OPTpass
LDR R14,[R12] \ get start of zap table
ADD R14,R14,#a% \ address of the sub
STMFD R13!,{R14} \ save address on stack
MOV R14,PC \ return address (with flags)
LDMFD R13!,{PC} \ call the sub
]:=""
The names of the routines are listed below in the order in which they appear
in the table. Thus the first, Zap_AddMode, is at offset 0. The second,
Zap_Claim is at offset 4, etc. These values are defined for you in the
program E-Library.
In general these routines have the following entry/exit conditions:
\E R0-R11=arguments R12=Zap's workspace R13=user stack R14=return address
\X R1-R13 preserved. R0 and Flags ALTERED. V set if error and R0=error block
Thus if I write:
\E R8
\X R1=3
Then I mean that on entry R8 was the window block pointer, R12 zap's
workspace etc. And on exit that R1=3, R2-R13 saved, R0 corrupted etc. If I
omit the \E or \X then I mean the standard entry/exit conditions hold.
Errors should be passed back to Zap by the entry point through which the
module was called (with V flag set and R0=error block pointer). Please note
that for most calls, Zap must be paged in as the current task! This will be
so if you are an extension mode.
For a table/summary of the zap call names for including in your source, see
the file E-Library.
Zap_AddMode
Adds a new Zap extension mode. This should be called after the module Zap is
loaded, but before it starts up as a new task. Zap need not be paged in for
this call.
\E R0=address of table of entry points (see file E-Entry)
Zap_Claim
Claims a block of workspace in Zap's heap.
\E R0=number of bytes required
\X R0=pointer to the heap block
Zap_Ensure
Ensures a zap heap block is of a given size.
\E R0=pointer to the heap block
R1=number of bytes required.
\X R0=new heap block pointer of (possibly moved) extended block.
(An error is returned if the block couldn't be enlarged).
Zap_Free
Free a zap heap block after use.
\E R0=pointer to heap block to free
Zap_MoveBytes
Moves a block of memory. The movement may be up or down by any amount. The
data is ALWAYS preserved no matter where the destination is. This routine is
highly optimised and should be used for moving any large block of data. Zap
need not be paged in.
\E R1=source byte address
R2=destination byte address
R3=number of bytes to move
\X R1-R3 corrupted
Zap_SplitBuffer
This splits a file held in Zap at the indicated file offset ready for
insertion/deletion of data. It also ensures that file buffer has a given
amount of room free. See E-File.
\E R0=file offset to split at (new value for f_splito)
R1=minimum number of bytes to have free in the split
R9=file to be split
Zap_NewTxtStatus
This updates the screen after changes are made to a file. This is very low
level and you should use Zap_Command when possible. Zap_SaveTxtStatus should
be called first.
\E R0/R1 as for SaveTxtStatus and R2=new input caret offset.
Zap_SaveTxtStatus
This is a low level call used by Zap_DoCommand when changing a file. You
should use Zap_Command/Zap_DoCommand in preference. Any file changes done
using this call are NOT saved in the undo buffer. Ie, don't use it. To use it
you specify the area of the file to be changed (R0 to R2) and the amount of
the change (in R1). After making the change you use Zap_NewTxtStatus to
update the screen. Set f_docom to 0 if in doubt.
\E R0=file offset of first byte in file to be changed.
R1=proposed signed change in size of file.
R2=file offset of first character which is unchanged.
f_docom,f_dolen,f_dodata must be set up - see e_prevline.
Zap_Command
This should be used for inserting/deleting/replacing data in a file. Its
action is to call the mode entry point named e_command. See E-Entry. The
mode's default action is then to call Zap_DoCommand. The commands are
automatically placed in the undo buffer. If you are doing a sequence of
insertions/deletions then please use Zap_Start/StopOp. Note that the cursor
is automatically updated to the end of the inserted/deleted region. To
prevent this, set b14 of f_flags, but you MUST restore it after the command
returns.
\E R0=command number: 1=insert 2=delete 3=replace (forward)
4=replace (backward). Add &10 if command is to be buffered
in one block (and thus undone in one key press).
R1=file offset for command to take place at.
R2=number of bytes being inserted/deleted/replaced.
R3=data to insert/replace with for commands 1,3,4.
R8=window on file to be altered/0 if none.
R9=file to be altered.
NB If you don't specify the window then it won't know which mode to
call, so this command will just call Zap_DoCommand.
Zap_NewWinStatus
This recreates a window after some display parameters have changed. Use
Zap_SaveWinStatus before changing any parameters.
\E R8/R9
Zap_SaveWinStatus
This is used before changing any of the 'w_*' window parameters which would
effect the display. See E-Window. The current cursor position, scroll offsets
etc are saved. After changing the window parameters call Zap_NewWinStatus.
Zap will do it's best to recreate the window with the new attributes,
preserving the position of the cursor on screen.
\E R8/R9
Zap_ReplaceArea
This command replaces one area of text with another (not necessarily of the
same length) by performing the minimum number of insertions/deletions/simple
replaces using Zap_Command. In BASIC mode it also retokenises the line as
necessary. This is used during a search and replace. See mode entry point
e_replace.
\E R1=file offset of original data
R2=length of original data
R3=address of replacement data
R4=length of replacement data R8/R9
Zap_PlotCaret
This command plots a caret in its new position automatically removing it from
its old position. Ie, it just calls Zap_ClearCaret then Zap_SetCaret.
\E R10=caret block
Zap_ReflectCaret
This acts as Zap_PlotCaret but only uses c_off, updating the c_loff and c_col
offsets from this. Ie, it just calls Zap_UpdateCaret then Zap_PlotCaret.
\E R10=caret block
Zap_SetCaret
This updates the area of the window containing the the caret given on entry.
Hence it's effect is usually to draw the caret at it's (new) position. See
E-Cursors.
\E R10=caret block
Zap_ClearCaret
As for Zap_SetCaret, but it updates the area of the window where the caret
last was (stored in the c_o* variables). Hence the caret is in effect removed
from its old position. See E-Cursors.
\E R10=caret block
Zap_DoCommand
This acts as Zap_Command but actually performs the action rather than
calling the extension mode.
\E As for Zap_Command.
Zap_ShowCursor
This call makes sure that a given cursor can be seen in its window (by
changing the scroll offsets if necessary). It does not redraw the cursor
in general (though changing the scroll offsets may cause it to be redrawn).
\E R10=cursor block of cursor to show
Zap_ReadVar
Reads one of Zaps internal variables. See the file E-Vars for the numbers.
\E R1=variable number.
\X R0=variable value.
Zap_