home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / utilities / zap / !Zap / Docs / E-Entry < prev    next >
Encoding:
Text File  |  1994-03-18  |  28.2 KB  |  602 lines

  1. *************************************************************************
  2. * >E-Entry    Documents the format of a mode entry point table    *
  3. *************************************************************************
  4.  
  5. The offsets in the entry point table are given names beginning 'e_'. The
  6. E-Library program will define the offsets for you.
  7.  
  8. You must fill in the first 8 entries of this table. The rest of the entries
  9. you may leave as 0 (or more simply, set the table length in the 8th word to
  10. 32 bytes). The idea of the mode table, is that you specify a BASE mode. For
  11. all the entry points (from the 9th onwards) that are off the end of your
  12. table, or that you have left as 0, the base mode will be called instead.
  13.  
  14. Hence, the simplest Zap extension mode would just set the base mode as 0 (ie,
  15. TEXT) and leave the rest as 0. You will then get a clone of the text mode.
  16.  
  17. In general the following register conventions are used:
  18.  
  19.     R2    Current column in characters (see E-Windows)
  20.     R3    Current line in characters (see E-Windows)
  21.     R8    Window block pointer / 0 to change the default config
  22.     R9    File block pointer / 0 to change the default config
  23.     R10    Cursor block pointer
  24.     R11    Your extension mode workspace (private word)
  25.     R12    Zaps workspace (private word)
  26.  
  27. In general the entry points have entry and exit conditions:
  28.  
  29.     \E R0-R10=parameters R11=your workspace
  30.        R12=Zap's workspace R13=FD stack R14=return addr
  31.     \X You must save R1-R11 (unless otherwise mentioned).
  32.        You may corrupt R0 and flags.
  33.        Set V flag and put R0=error block pointer on an error.
  34.  
  35. See the E-ZapCalls file for more details on my entry/exit syntax.
  36.  
  37. All offsets given in the table below must be from the start of the module.
  38. Hence the table is relocatable. Zap finds the start address of your module
  39. via the first table entry (e_module). It uses this and an OS_Module call to
  40. determine the address of your workspace (to pass in R11). All strings should
  41. be 0 terminated.
  42.  
  43. Entry points for arbitrary modes may be called using Zap_CallMode,
  44. Zap_CallGivenMode or Zap_BaseMode. If none of these will do, then use
  45. Zap_ReadMode to find the table entry linked points and the address of the
  46. mode's workspace and the entry point can be called directly.
  47.  
  48. Each mode has a word of workspace reserved in the window block (pointed to
  49. by R8) for each file. A mode is responsible for storing the current options
  50. in their mode word when the user changes mode (see e_start/e_end). There
  51. are Zap calls provided to make this easier for you. If you need more than
  52. one word of workspace then the mode word can store the pointer to a block of
  53. workspace if you set a flag in e_mode. See E-Windows (w_mode0...) and E-Vars
  54. (opt_mode0...).
  55.  
  56. The entry points
  57. ================
  58.  
  59. e_module
  60. This gives the table offset from the module start so that the module start
  61. may be calculated by Zap. Ie, module start = address of table start - this
  62. offset.
  63.  
  64. e_title
  65. Offset of the mode title string to be used in the 'Mode' menu. It should be
  66. at most 7 chars long. (eg 'BASIC')
  67.  
  68. e_author
  69. Offset of the author name string (eg 'Dominic Symes').
  70.  
  71. e_basemode
  72. Gives the mode on which to base null entry points. Current modes are: 0=Text
  73. 1=byte 2=word 3=ascii 4=hex 5=basic 6=bastxt 7=cmode 11=throwback
  74. 12=taskwindow. Needless to say, if you wish to clone the BASIC mode, you'd
  75. better be sure that the Zap_Basic module initialised before yours!
  76.  
  77. e_mode
  78. Gives the mode number you would like to be in bits b0-b7. Bits 8-31 contain
  79. flags as follows:
  80.     b8    Set to receive RAW keyboard input. All key presses are sent
  81.         to e_char. Zap key codes greater than &FF are sent as a
  82.         zero byte followed by the low byte.
  83.     b9    Set to get taskwindow style keyboard input passed to e_chars.
  84.         This differs from normal e_chars entry in that:
  85.         1) Delete is passed on as &7F instead of calling e_delete
  86.         2) Characters &20-&FF are passed on regardless of mapping
  87.         3) If not in COPY mode then the cursor keys are passed on
  88.            as a 0 byte followed by bottom 8 bits of the wimp's code.
  89.            Similarly TAB.
  90.         4) Return and Escape are passed on as &0D and &1B.
  91.         This is subject to changes - contact me.
  92.     b10    Set to indicate that you use a mode word in a window block
  93.         (eg w_moden) to point to a block of data. See E-Windows
  94.         for the format this block must take.
  95.     b31    Set to overwrite any mode already using this mode number.
  96.     Others bits are reserved and should be set to 0.
  97.     If b31 is not set then you are allocated the next free mode if the
  98.     one you wanted is being used.
  99.  
  100. e_init
  101. Called at various points when Zap is starting up/dying or wants to give your
  102. mode a chance to intercept an operation. Note that Zap will automatically
  103. kill your module on dying unless you tell it otherwise. You should use reason
  104. code 2 to claim any buffers from Zap. I am at liberty to add extra reason
  105. codes so please return with all registers unaltered if you receive an
  106. unrecognised code.
  107.     \E R1=reason code (and other registers may hold values dependent on it)
  108.     \X Save R1-R11 as usual unless otherwise stated below.
  109.  The reason codes are:
  110.  R1=0 => Zap is quitting and about to kill your module.
  111.      Return R0=-1 to stop this (eg if you've more than one mode).
  112.  R1=1 => Zap has just started but not set up its heap yet.
  113.       R0=the mode number assigned to your mode.
  114.       You should note the mode number that has actually been assigned to
  115.       you and store it in your module somewhere. This is not guaranteed
  116.       to be the one you asked for.
  117.  R1=2 => Zap has started and set up its heap. On this call you should check
  118.      your mode word opt_moden to see if it's zero. If so then you should
  119.      initialise it to a sensible default value. (See E-Vars) You should
  120.      also use this call to claim any buffers you need.
  121.  R1=3 => Zap is deleting a file with your mode number in f_cmode. R9=file
  122.      block on entry. See E-File.
  123.  R1=4 => Zap is saving a file with your mode number in f_cmode. R8/R9=the
  124.      window being saved. Return R1=-1 if you wish to abort the save
  125.      (and handle it yourself). If you return R1=-1 then return R0=0 if
  126.      the save is safe (file can now be deleted) or -1 if unsafe (entered
  127.      data transfer protocol for example).
  128.  R1=5 => Zap wants to delete a file your mode number in f_cmode, but it
  129.       has the 'altered' flag set. Return R1=-1 to override and allow the
  130.       file to be killed anyway.
  131.  R1=6 => Zap is creating the colours submenu and wants to know what you
  132.       call colours >=9. Return in R1 pointer to a double zero terminated
  133.       list of zero terminated entries giving the names of the colours
  134.       starting from 9. Eg "REMs",0,"Strings",0,0. (Or leave R1 as 6
  135.       if this call is not supported).
  136.  
  137. e_menu
  138. Offset of submenu in Zap's format / 0 for none. This menu comes off the
  139. 'Mode' menu. See the file E-Menu for details of the menu format.
  140.  
  141. e_len
  142. Total length of the table data (>=32). (So that only entry points within the
  143. table are called and for forward compatibility). If zap finds an entry point
  144. is off the end of the table then it will call the corresponding base mode
  145. entry point.
  146.  
  147. If any of the following offsets are 0 then the corresponding offset for the
  148. basemode is called.
  149.  
  150. e_postload
  151. Called after a file is loaded and has had a window opened for it in your
  152. mode. It is also called after a file in your mode has been saved. It enables
  153. the file contents to be slightly altered before editing. (eg BASIC encrypts
  154. the line numbers and BASTXT detokenises the program). You may alter the data
  155. directly (ie, you needn't use Zap_Command).
  156.     \E R8/R9
  157.     
  158. e_presave
  159. Called before the file is saved. It enables file contents to be slightly
  160. altered, undoing the effect of e_postload. (eg BASTXT retokenises the program
  161. prior to saving). As above, you may alter the data directly.
  162.     \E R8/R9
  163.  
  164. e_loading
  165. This is called when a file is loaded off disc for dropping into a window. The
  166. file data is in a heap block. This enables you to change it before insertion
  167. takes place (eg BASTXT detokenises the file). You are only called if the file
  168. type of the file is claimed by your mode (in the 'keys' file).
  169.     \E R2=data length R3=data address
  170.     \X You may change the data, making it larger if necessary
  171.        provided that you enlarge the heap block R3. Return
  172.        updated R2 and R3.
  173.  
  174. e_start
  175. Called when a window enters your mode (eg via Zap_NewMode). You should
  176. restore the current w_flags and w_format options, and any other options you
  177. may have saved in your private word w_moden or block pointed to by w_moden.
  178. The call Zap_RestoreModeWord should be made as this restores the options kept
  179. track of by Zap using Zap_ModeData.
  180.     \E R8/R9=window mode is being changed in OR 0 if the mode on the
  181.          options menu is being changed and you should restore the
  182.          default options, of for example opt_flags and opt_format.
  183.  
  184. e_end
  185. Called when a window leaves your mode (eg via Zap_NewMode). This is similar
  186. to e_start except that you should save the current mode dependent
  187. options from w_format, w_flags. The call Zap_SaveModeWord should be made as
  188. this saves the options kept track of by Zap using Zap_ModeData. Again, if
  189. R8=0 then this all applies to the options menu and opt_flags,opt_format.
  190.     \E R8/R9=window / 0 for iconbar menu
  191.  
  192. e_width
  193. Called when a window is (re)created to find out the width of the work area in
  194. characters (excluding margin). You should read this either from your mode
  195. word or block, or using Zap_ModeData variable number 0 where Zap reserves
  196. space for a width value for you. If you support auto width and the auto width
  197. flag is set (see E-Flags) then you should work this width out from the file.
  198. Once you have calculated the width, it is advisable to store it in w_bpl, a
  199. variable reserved for this purpose.
  200.     \E R8/R9
  201.     \X R0=width of work area in characters (excluding margin)
  202.  
  203. e_linecol
  204. Converts a column offset on screen to file offset. This is called by
  205. Zap_FindOffset and other subs. The start offset of the physical line on which
  206. the column lies has been calculated (usually by e_clnoff).
  207.     \E R0=file offset of physical line start
  208.        R1=column offset on screen (exc margin) R8/R9
  209.     \X R0=file offset of nearest character on the left
  210.         
  211. e_lineoff
  212. Convert file offset to column on screen. This performs the inverse function
  213. to e_linecol. It is usually called by Zap_OffLineCol. Again the offset of the
  214. start of the physical line has been calculated (usually by e_clnphy). This
  215. call should also return the caret width for this mode.
  216.     \E R0=file offset of physical line start
  217.        R1=file offset (to convert to a column) R8/R9
  218.     \X R0=column offset on screen (exc margin)
  219.        R1=caret width (in characters - usually 1).
  220.  
  221. The next 3 subs do the main body of work of converting between screen display
  222. lines and file offsets. A physical line means the actual offset in lines from
  223. the top of the file when displayed - that is the actual 'y' coordinate.
  224. Counting starts at 0. Logical lines can be interpreted however the mode
  225. wishes. In text mode, a logical line is ended by a return (as opposed to the
  226. display wrapping). These are given as offsets from 0 as the first line. It is
  227. important that these routines are OPTIMISED as much as possible.
  228.  
  229. e_clnlog
  230. Converts a logical line number to a file offset/physical line. This is not as
  231. important as the other two. It is mainly used by the 'GOTO' box (F5). Ie,
  232. user asks to go to logical line (eg basic line) 500 and Zap wants to know the
  233. file offset of this.
  234.     \E R0=logical line number R8/R9
  235.     \X R0=file offset of line start
  236.        R1=physical line number
  237.  
  238. e_clnphy
  239. This converts a physical line number to a file offset. This is the most
  240. important of the 3 as it is called when updating a window. For example the
  241. wimp asks zap to redraw a rectangle. The top of the rectangle is at physical
  242. line 100 say. Zap needs to know the file offset of this line to call
  243. e_redrawline. It uses this call. Do NOT start counting from the start of the
  244. file, as the window being updated may be near the end. Instead, use the start
  245. of the w_txt cache as a reference. Ie, use the variables w_cline, w_coff,
  246. w_clogl as your start reference.
  247.     \E R0=physical line number R8/R9
  248.     \X R0=file offset of line start
  249.        R1=logical line number
  250.  
  251. e_clnoff
  252. Converts a file offset to a line number and offset. This call is used by
  253. Zap_OffLineCol and when a window is first opened. It should find out which
  254. physical line a file offset lies on. If the file offset is equal to the file
  255. length then it should return the line of an 'imaginary' last character. This
  256. is called when a window is initially opened to work out the w_height value.
  257. As with e_clnphy you should use the cache reference point as a starting
  258. point.
  259.     \E R0=file offset R8/R9
  260.     \X R0=physical line number
  261.        R1=file offset of physical line start
  262.        R2=logical line number
  263.  
  264. e_nextline
  265. This is called during a Zap_DoCommand operation. It is designed to work out
  266. the first line on screen which can be shifted down, following an insertion/
  267. deletion, without being redrawn. On entry you are told the first character
  268. which occurs after the altered region and the amount by which its offset will
  269. change due to the alteration. You must return the file offset of the first
  270. line which may be shifted on the screen without being redrawn. (Usually the
  271. first logical line with start offset > R0). In the case where there is no
  272. such line, return the end of file offset and the physical line containing
  273. this 'imaginary' character offset (as for e_clnoff).
  274.  See also e_prevline. e_prevline is called first, and the file block is
  275. set up as for e_prevline.
  276.     \E R0=file offset of first 'shiftable' character
  277.        R1=signed change in file offset of this character R8/R9
  278.     \X R0=file offset of first 'shiftable' line
  279.        R1=physical line number of this line #
  280.        You must preserve the split offset and split size of the file.
  281.        
  282. e_minus
  283. This is called when the user presses the left arrow key to work out the next
  284. cursor position. The buffering is done for you.
  285.     \E R0=physical line start file offset
  286.        R1=cursor file offset
  287.        R2=cursor column (exc margin) R8/R9
  288.        R10=cursor caret block
  289.     \X If R2>=0 then R1,R2 given new cursor position on the
  290.        same physical line.
  291.        If R2=-1 then R1=new file offset of cursor.
  292.        If R2=-2 then you have moved the cursor yourself.
  293.        If R2=-3 then R0,R1=new x,y for cursor.
  294.  
  295. e_plus        Perform cursor right (\E & \X as for e_minus)
  296. e_sminus    Perform cursor back a word (\E & \X as for e_minus)
  297. e_splus        Perform cursor forward a word (\E & \X as for e_minus)
  298. e_cminus    Move cursor to line start (\E & \X as for e_minus)
  299. e_cplus        Move cursor to line end (\E & \X as for e_minus)
  300.  
  301. e_redrawline
  302. This is called when your mode is required to redraw one (physical) line of
  303. the display - it is also here that you can specify the colour of each
  304. character. You are passed:
  305.  1) As input:
  306.     The physical line start (calculated via e_clnphy - or the previous call
  307.     to this sub). This is not passed as a file offset, but as an actual
  308.     ADDRESS in the file buffer (in R7). Recalling the split nature of the
  309.     buffer (see E-File) the text may not be continuous. R10 is set to the
  310.     end of this section of the split so the file is continuous up to R10.
  311.     R5=R7-the offset of the character - I call this the apparent buffer start
  312.     (where the start would be if the file were continuous).
  313.  2) For output:
  314.     The address of a buffer (in R6) in which to write the characters to
  315.     appear on the line (one byte per character). This buffer has been
  316.     cleared to spaces beforehand so you only need to write the non-space
  317.     characters. Line numbers have been dealt with. You told Zap the width
  318.     the buffer should be when your e_width entry point was called.
  319.  3) Colours:
  320.     As far as this call is concerned there are 16 colours numbered 0-15
  321.     available. These bear no resemblance to wimp colour numbers, but are
  322.     'internal' Zap colour numbers. Their actual physical appearance is chosen
  323.     by the user from the colours menu - and can be selected from a
  324.     palette. Colours 0-8 have a standard interpretation but colours 9-15
  325.     can be used as the mode sees fit. Eg, colour 9 may be used for IF
  326.     statements in a language editor for example. The standard colours are
  327.         0=Background colour 1 (default background colour + off end of text)
  328.         1=Background colour 2 (this should be used under text)
  329.         2=Standard foreground colour
  330.         3/4=selection bac/foreground 5/6=cursor bac/foreground
  331.         7=line numbers 8=control characters.
  332.     Let n be the value stored in R8,#w_txtw. Then the foreground colour of
  333.     the cached character stored at R6 is stored at R6+n and the background
  334.     colour at R6+2*n. These are initially cleared to bytes '2' and '0'
  335.     respectively - you should overwrite these bytes to change the colour.
  336.     Text mode puts colour 1 (background colour 2) under actual text and you
  337.     should do the same. See e_init for how to change the colours menu.
  338.  4) Other comments:
  339.     On exit you should update several registers to the start of the next
  340.     physical line. e_clnphy is only called for the first line in a group.
  341.     For a simple example of how to write this redraw code, see the code for
  342.     mode 3 (ascii mode).
  343.     \E R4=w_format (read from R8,#w_format)
  344.        R5=apparent buffer start (R7-offset of char in file)
  345.           (so it is either f_ptr or f_ptr+f_splits)
  346.        R6=address of cache line to draw line in (already blanked)
  347.        R7=address of start of (source) line (R5+file offset of line).
  348.        R8/R9
  349.        R10=address of end of this section of the buffer.
  350.            (so when you reach R10 you increase R5 and R7 by f_splits if
  351.            at the end of the first half or stop if at the file end).
  352.        R11=logical line number (for you to update for cache reference
  353.            and printing in the left hand column).
  354.     \X R0-R4,R6,R10 may be corrupted
  355.        R5,R7,R11 must be updated to the start of the next physical line
  356.        R8-R9,R12 must be preserved
  357.  
  358. e_redrawlnum
  359. This is called when the user wishes logical line numbers to be displayed on
  360. the left. You must decide whether the given physical line file offset it at
  361. the start of a logical line. This is called while redrawing the line numbers.
  362.     \E R7=file offset of start of physical line
  363.        R11=proposed logical line number (as calculated by e_clnphy)
  364.        R8/R9
  365.     \X CC if R7 is at the start of a logical line (so print it)
  366.        CS if the line number column should be left blank
  367.        You may corrupt R0-R4. You may also change R11 as BASIC does
  368.        but this is not advised as the w_clogl will get out of sync.
  369.        BASIC ignores the w_clogl as the line number is stored in the
  370.        file.
  371.  
  372. e_char
  373. This is called when the user types a string of ascii chars via the CHAR
  374. command. The characters have been concatenated for you. You should perform
  375. the relevant insertions/deletions via Zap_Command.
  376.     \E R4=w_flags
  377.        R5=number of bytes typed
  378.        R6=w_format
  379.        R7=address of typed data
  380.        R8-R10=input caret (ie this points to the block car_cursor or
  381.               car_input depending on the caret mode and where typed
  382.               text should go).
  383.     \X You may corrupt R0-R11
  384.  
  385. e_delete
  386. This is called when the user executes the commands DELETE or DELETENEXT. A
  387. sequence of deletes is concatenated for you. You should use Zap_Command to
  388. delete the text. Try and support the line edit mode.
  389.     \E R5=number of times pressed
  390.        R6=w_format
  391.        R7=0 for DELETE/1 for DELETENEXT
  392.        R8-R10=input caret
  393.     \X You may corrupt R0-R11
  394.  
  395. e_tab
  396. This is called when the user executes the command TAB. As usual, repetitions
  397. are concatenated. Use Zap_Command to perform the function.
  398.     \E R1=number of times pressed
  399.        R8-R10=input caret
  400.     \X You may corrupt R0-R11
  401.  
  402. e_return    Called when RETURN executed (\E \X as for e_tab)
  403. e_renumber    Called when RENUMBER executed (\E \X as for e_tab)
  404. e_saveandrun    Called when SAVEANDRUN executed (\E \X as for e_tab)
  405.  
  406. The next 4 subs are used by the various delete line calls. They each have
  407.     \E R0=current file offset in a line R8/R9
  408.     \X R0=new file offset (see below)
  409. This is how the subs are called:
  410.  
  411. DELLINE        Deletes from lineprev to linenext offsets.
  412. DELTOEND    Deletes from current offset to lineend unless this is empty
  413.         when it calls JOINLINE (as in emacs ctrl K)
  414. DELTOSTART    Deletes from linestart to current offset unless empty.
  415.  
  416. e_linestart    Called to find the lines first character.
  417. e_lineend    Called to find the lines last character.
  418. e_linenext    Called to find the lines actual end (eg after &0A)
  419. e_lineprev    Called to find the lines actual start (eg for basic lines)
  420.  
  421. e_copy
  422. Called when user wishes to copy characters via the COPY key. Is is called for
  423. finding the characters to copy and for inserting the copied characters.
  424. Reason code is in R0. When reading characters you must update the cursor
  425. yourself. Note the source window may be in a different mode to the
  426. destination window!
  427.         \E R0=1 => Fetch characters
  428.            R1=number of times copy pressed (number of chars to get)
  429.            R8-R10=copy cursor (car_cursor)
  430.         \X R3=pointer to buffer containing characters to 'type'
  431.            R2=number of characters to 'type'
  432.            Copy cursor updated to new position
  433.         OR
  434.         \E R0=2 => Write copied characters
  435.            R2=number of chars to type
  436.            R3=pointer to the chars
  437.            R8-R10=input cursor (car_input)
  438.         \X R0=0 means you've done it all yourself
  439.            R0=1 means please enter it for me via Zap_Command
  440.            R0=2 means please enter it for me by calling my e_chars
  441.  
  442. e_joinline    This is called when Joinline pressed (\E \X as for e_tab)
  443. e_splitline    This is called when Splitline pressed (\E \X as for e_tab)
  444.  
  445. e_aligncaret
  446. This is called before any commands are executed on a window in your mode.
  447. It serves two purposes. The first is to align the input caret offset to a
  448. sensible position (eg word align in word mode, put after line numbers in
  449. basic). The second is to reset any counters you may have. For example, the
  450. hex mode entry uses a counter to tell how many nibbles have been inserted in
  451. a word. This is cleared on e_aligncaret with the old value being saved. Then
  452. if the command 'insert 9' is executed it can retrieve and restore the saved
  453. value. If any other command is executed (eg LEFT) then the counter will
  454. remain reset.
  455.     \E R8-R10=caret
  456.     \X Input caret offset [R10,#c_off] can be updated.
  457.  
  458. e_command
  459. This entry point is called whenever anyone issues a Zap_Command call, or
  460. equivalent, to try and alter a file in a window in your mode. The easiest way
  461. to deal with this is to pass the call onto Zap_DoCommand which will perform
  462. the alteration. However, if you support wordwrap, you may wish to 'fiddle'
  463. the data, or even perform additional operations.
  464.     \E As for Zap_Command
  465.  
  466. e_compile    This is called when Compile pressed    (\E \X as for e_tab)
  467. The mode should save the file to disc and then try to compile/run it.
  468.  
  469. e_formattext    This is called when Formattext pressed    (\E \X as for e_tab)
  470. The mode should try and format the current paragraph for its particular
  471. language.
  472.  
  473. e_run        This is called when Run pressed        (\E \X as for e_tab)
  474. The mode should try and run the program without saving it. Revert to
  475. e_compile code if there is no difference.
  476.  
  477. e_runandquit    This is called when Runandquit pressed    (\E \X as for e_tab)
  478. This should act as e_run but add a -quit option if possible.
  479.  
  480. e_basic        This is called when Basic pressed    (\E \X as for e_tab)
  481. This should drop the file into the command line state of the current
  482. language.
  483.  
  484. e_search
  485. This handles string searches in your mode. R1 gives the reason code. It gives
  486. you a chance to 'doctor' the string. Eg, BASIC may tokenise it. It is also
  487. called to check a match is at a valid offset. Eg, BASIC checks it isn't in a
  488. line number.
  489.     \E R1=0 => Starting a search
  490.        R0=search string after macros replaced (in a heap block).
  491.     \X R0=possibly new search string.
  492.     OR
  493.     \E R1=1 => Found a match
  494.        R10=match offset
  495.        R9=file.
  496.     \X Return R0<0 if the offset invalid.
  497.  
  498. e_replace
  499. This is called when the user wishes to perform a search and replace. The
  500. replacement string has been calculated for you and it is your job to insert
  501. it. Your default action should be to call Zap_ReplaceArea.
  502.     \E R1=file offset (of match)
  503.        R2=length (of match)
  504.        R3=replacement data
  505.        R4=replacement length. R8/R9
  506.  
  507. e_selection
  508. This handles region selections/saving. You should check the validity of the
  509. selected area, confining it to lines/paragraphs if you wish.
  510.     \E R0=reason code R8/R9=window
  511.        R0=0 => starting selection
  512.            R10=proposed start caret. You can use the variable car_mode
  513.            to find out if the selection is mouse or keyboard (E-Vars).
  514.        R0=1 => updating selection size
  515.            R10=new selection block (car_selection)
  516.             You may alter the contents of the selection block.
  517.        R0=2 => saving selection
  518.            R3=data address (a heap block)
  519.            R2=data len
  520.                R4=proposed filetype
  521.             You may change these provided R3 remains a heap block.
  522.             (eg BASIC will tokenise it).
  523.  
  524. e_click
  525. This is called when the user clicks on your window. Default action should be
  526. to call Zap_DefaultClick which will handle R1=0,1 and ignore the rest. Clicks
  527. are registered to any depth so you should modulo the click number with the
  528. number of useful actions you support so they cycle round. Drags are also
  529. passed to you. If the user drags straight away (ie after 1 click) then you
  530. will be sent R1=0. If the user drags after a double click then you will
  531. be sent R1=2 and b3 of R4 will be set. After treble click R1=3 etc.
  532.     \E R1=click depth (0=simple drag 1=single click 2=double click etc)
  533.        R2=x column (including margin)
  534.        R3=y row of click in work area characters
  535.        R4=buttons   b0=adjust pressed
  536.                b1=undefined (menus are dealt with by Zap)
  537.                b2=select pressed
  538.                b3=drag after two or more clicks (given in R1)
  539.                b4-b31=reserved
  540.        R8/R9=window clicked on
  541.  
  542. e_message
  543. This entry point is called when an unrecognised wimp message is received by
  544. zap. The message is broadcast to all modes. Please IGNORE (ie return) unless
  545. you understand the message number!!
  546.     \E R0=your mode number
  547.        R1=message block (as sent by wimp)
  548.        R2=message number (ie R1!16)
  549.        R3=message type (17 or 19) as returned in R0 by wimp.
  550.  
  551. e_setwidth
  552. This entry point is used by the SETWIDTH command (Ctrl W) and the 'width'
  553. menu option on the display menu. It is called to read the currently
  554. configured width for this mode (of a window or the default according to R8),
  555. or in order to set the currently configured width. You should access this
  556. width by looking at your mode word w_moden if that's where you keep it, or
  557. using Zap_ModeData if you keep it in the place provided by Zap (this is the
  558. default action of the text mode entry point). Following this call, the editor
  559. window in question will be recreated automatically and your e_width entry
  560. point will be called to calculate the actual display width as usual.
  561.     \E R0=new width user wants or -1 to read the current width
  562.        R8-R9=window/0 if it is the default width being changed.
  563.     \X R0=current width if it was -1 on entry.
  564.  
  565. e_listfns
  566. This is called when the command LISTFNS is pressed. \E \X as for e_tab. The
  567. mode should open a throwback buffer with a list of function definitions in.
  568. (eg Use Zap_Search).
  569.  
  570. e_prevline
  571. This entry point is used in conjunction with e_nextline to find the area on
  572. the screen which needs to be updated after an insertion/deletion. It tells
  573. you in R0 the first file offset being changed and you must tell it the first
  574. file offset (<=R0) to start updating the screen from. Usually you will just
  575. leave R0 unchanged but in the case of a mode using colours - where changing a
  576. character later on in the line may affect earlier colours - you may want to
  577. set this to the start of the current logical line. The cache reference point
  578. (w_cline/w_coff) is moved so that it is most R0, and is thus not corrupted by
  579. the insertion/deletion. If you wish to move it further back (eg if a control
  580. code later in a line effects the formatting of earlier bits) then now is the
  581. time to do so - via Zap_ClipCache.
  582.  e_prevline is called before e_nextline. Complicated colouring modes (eg
  583. colour C mode) need to know what data is being inserted/deleted to decide
  584. what to return for e_prevline/e_nextline. To make this possible, the
  585. follwing data is available:
  586.  f_docom=the command currently being executed:
  587.  0,>5=none   => text not changing (just return with R0 preserved).
  588.  1=insertion => R0=offset that text is being inserted at
  589.          f_dolen=number of characters being inserted
  590.          f_dodata=pointer to the text being inserted
  591.          File is split at the offset R0 with split size >= f_dolen.
  592.  2=deletion  => R0=offset of start of block to delete
  593.          f_dolen=number of characters being deleted
  594.          File is split at R0+f_dolen with split size >=0.
  595.  3/4=replace => R0=offset of start of block to replace
  596.          f_dolen=number of characters to replace
  597.          f_dodata=replacement block
  598.          File is split at R0+f_dolen with split size >= f_dolen.
  599.     \E R0=First changed offset in the file. R8/R9
  600.     \X R0=Offset to start updating the screen from.
  601.        You must preserve the split offset and split size of the file.
  602.