home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / utilities / zap / !Zap / !Help < prev    next >
Encoding:
Text File  |  1994-03-17  |  59.2 KB  |  1,380 lines

  1. *****************************************************************************
  2. * >!Help file for !Zap version 1.10                        *
  3. * Copyright Dominic Symes 1992/1993/1994. See 'Copyright' file.              *
  4. * NB This program needs the COLOURS module to run. It is in !System.Modules *
  5. *   on Acorn's Application disc 1. If in doubt, double click on !System.    *
  6. *****************************************************************************
  7.  
  8. This is the 5th release version of the text editor !Zap.
  9.  
  10. Main features:    * Display may be in text, byte or disassembly format.
  11.         * All key short cuts are user redefinable.
  12.         * Automatic updating line numbers & file addresses.
  13.         * Full (unix style) wildcard search with your own definable
  14.           macros and search 'throwback' buffers.
  15.         * Proper unix tabs and true scrollbar operation.
  16.         * Full undo on all operations.
  17.         * COPY key causes standard cursor editing.
  18.         * Fast redraw in system or anti-aliased fonts.
  19.         * Any number of markers on each file, and a facility for
  20.           following branches in disassembly mode.
  21.         * Full ARMBE style BASIC Editor.
  22.         * Search as you type with minibuffer.
  23.         * Learns keys sequences.
  24.         * Emacs style Yank (Cut & Paste) and !Edit style move and
  25.           copy implemented.
  26.         * C throwback/info supported.
  27.         * Reads disc sectors/tracks and memory of other tasks.
  28.         * Keyboard selection of regions.
  29.         * Taskwindow supports control characters / line-editor.
  30.         * Emacs compatible keymap.
  31.         * Auto indent.
  32.         * Can edit assembler instructions when in code mode.
  33.         * Tested on Risc Os 2 and 3.
  34.         
  35. *************************************************************************
  36. * Important:                                *
  37. *************************************************************************
  38.  
  39. (1)    If you find this help file too technical, then please look in the
  40.     ZapPrimer directory. This contains a 'beginners manual', aimed at
  41.     those used to !Edit. Thanks to David Holden for writing this.
  42.  
  43. (2)    This file does NOT contain help on the menu items and dialogue
  44.     boxes. See the Helpdata file or run the !Help application to
  45.     find out about these.
  46.     
  47. (3)    The 3rdParty extension modes each have their own help file in the
  48.     3rdParty directory.
  49.     
  50. (4)    If you are changing versions of Zap then please read the 'Changes'
  51.     file first!
  52.  
  53. *************************************************************************
  54. * Contents:                                                             *
  55. *************************************************************************
  56.  
  57.     Section A    Keys and options.
  58.             A.1 Summary of default key actions.
  59.             A.2 How to (re)define more keys.
  60.             A.3 How to change Zap's default options.
  61.             A.4 Differences RISCOS 2/3.
  62.             A.5 Multiple keymaps / the Emacs keymap.
  63.             A.6 Colour and changing the default colours.
  64.             
  65.     Section B    Loading/saving/printing/editing files
  66.             B.1 Loading files/creating files.
  67.             B.2 Saving files.
  68.             B.3 Dumping/printing files.
  69.             B.4 Selecting regions.
  70.             B.5 Copying/cutting/pasting/yanking.
  71.             B.6 Inserting text/control codes
  72.             
  73.     Section C    Editing BASIC - PLEASE READ
  74.             C.1 How to change editors/options.
  75.             C.2 Using BASIC in ARMBE mode.
  76.             C.3 Testing BASIC programs.
  77.             
  78.     Section D    Individual mode help.
  79.             D.0 Text mode
  80.             D.1 Byte mode .. etc ..
  81.             
  82.     Section E    Search and Replace.
  83.             E.1 The Search window.
  84.             E.2 The Replace window.
  85.             E.3 Keyboard (incremental) search.
  86.             
  87.     Section F    Other features.
  88.             F.1 Learning key sequences - very useful.
  89.             F.2 Tabs and indenting.
  90.             F.3 Fonts and font sizes.
  91.             F.4 Universal arguments.
  92.             F.5 The minibuffer
  93.             
  94.     Section G    How to find out more.
  95.             G.1 Other help files - MENU help.
  96.             G.2 Obtaining future versions of Zap.
  97.             G.3 Contacting me with suggestions/bugs.
  98.             
  99. *************************************************************************
  100. * Section A:    Keys and options.                    *
  101. *************************************************************************
  102.  
  103. A.1 Default key actions
  104. -----------------------
  105.  
  106. When Zap is loaded, it reads in the 'keys' file, and uses this to create the
  107. current key bindings. Many other options are also stored in this file. See
  108. section A.3 for more details. Each key mentioned in the 'keys' file has a
  109. command name following it. By editing the file and moving the command names
  110. about, you can change the action of any key. See section A.2 for more details
  111. (the format of a 'keys' file entry and how to define multiple keymaps).
  112.  
  113. Please note that the key short cuts given in the menus are automatically
  114. updated to reflect your new choice of keys (for whatever you have set as the
  115. default keymap). A summary of the default key bindings is given below.
  116. (s=Shift c=Ctrl sc=Shift+Ctrl).
  117.  
  118. Key:        Command:    Action:
  119.  
  120. Return        RETURN        Splits line / inserts new line in line edit
  121.                 mode. Also indents in auto-indent mode.
  122.                 Edits an instruction in code mode.
  123. sReturn        RETURN        As above.
  124. cReturn        RETURNNOINDENT    As RETURN except doesn't auto-indent.
  125.  
  126. Delete        DELETE        Delete last character.
  127. sDelete        DELETENEXT    Delete next character.
  128. cDelete        DELLINE        Delete current line.
  129. scDelete    DELTOEND    Delete to end of line.
  130.  
  131. Tab        TAB        Inserts a variety of tabs - see tab menu.
  132. sTab        SWITCHTAB    Switches between Unix and !Edit tab modes.
  133. cTab        -        Reserved for !Larger/!Menon users.
  134.                 (!Larger - Virtual desktop with many extra
  135.                 features. 10 pounds from Robin Watts/Warm
  136.                 Silence Software 0865-54382).
  137.  
  138. Escape           ESCAPE        Stops copy modes/selection modes/search
  139.                 as you type mode/yank mode.
  140. sEscape           CANCEL        Cancel operation and return to start posn.
  141. cEscape        COMMAND        Brings up a minibuffer in which you can type
  142.                 any Zap command. Equivalent of Emacs M-X.
  143.                 
  144. <-|        DELETE        Delete last character.
  145. s<-|        LASTMARK    Jump to last marker
  146. c<-|        FASTUNDO    Undo last operation.
  147.  
  148. Copy        COPY        Initiates split cursor copying. Move cursor
  149.                 with cursor keys and use COPY key to copy.
  150.                 Note that you may copy from one window to
  151.                 another by pressing SELECT on the other.
  152. sCopy        COPY        For those who wish to redefine Copy to be
  153.                 DELETENEXT. Copy key still ok in copy mode.
  154. cCopy        SELREGION    Starts selection of a region via cursor keys.
  155.                 Press Escape/cCopy to end the selection.
  156. scCopy        DUMPFILE    Produce text version of the display.
  157.  
  158. Insert        TOGGLEINSERT    Toggle insert and overwrite modes.
  159.  
  160. Print        QUICKPRINT    Send file directly to printer.
  161. sPrint        PRINTFILE    Print file through printer driver.
  162. cPrint        OPENPRINTER    Open 'printer:$' filer window.
  163. scPrint        CLOSEPRINTER    Close 'printer:$' filer window.
  164.  
  165. Space bar    CHAR &20    Inserts a space.
  166. sSpace        CHAR &20    As above.
  167. cSpace        TOGGLEMARK    Emacs compatible.
  168.  
  169. Cursor keys:
  170.  
  171. Left            LEFT        Moves 1 left / goto last mark in code mode.
  172. Right        RIGHT        Moves 1 right / goto address in code mode.
  173. Down        DOWN        Move 1 line down.
  174. Up        UP        Move 1 line up.
  175. sLeft          SLEFT        Move back one word.
  176. sRight        SRIGHT        Move forward one word.
  177. sDown/PageDown    SDOWN        Move down a page.
  178. sUp/PageUp        SUP        Move up a page.
  179. cLeft        CLEFT        Move to start of logical line.
  180. cRight        CRIGHT        Move to end of logical line.
  181. cDown        CDOWN        Move to end of text (and leave marker).
  182. cUp        CUP        Move to start of text (and leave marker).
  183. scLeft        SCLEFT        Move to the left without moving cursor.
  184. scRight        SCRIGHT        Move to the right without moving cursor.
  185. scDown        SCDOWN        Move down without moving cursor.
  186. scUp        SCUP        Move up without moving cursor.
  187.  
  188. Function keys:
  189.  
  190. F1        EXECUTE        Execute learnt key sequence (see F.1).
  191. F2        FINDFILE    Load a named file (Emacs C-X C-F).
  192. F3        SAVE        Brings up save box. See save box help.
  193. F4        SEARCHCUR    Brings up Search by Goto box. (See E.1).
  194. F5         GOTO        Brings up Goto line/address box.
  195. F6         TOGGLEMARK    Inserts marker in text/deletes marker.
  196. F7        SEARCHBUF    Brings up Search to buffer box. (See E.1)
  197. F8        FULLUNDO    Full undo (takes longest path in undo tree).
  198. F9        REDO        Redo (undo last undo whether full or fast).
  199. F10        DELLINE        Delete current line.
  200.  
  201. sF1        SPLITLINE    Split line (useful in Basic mode).
  202. sF2        SWAPWINDOW    Swap window (to next window/last used).
  203. sF3        HEXASCII    Toggles hex entry mode when byte/word modes.
  204. sF4        REPLACE        Brings up search and replace box. (See E.2).
  205. sF5        HELP        Brings up this help text.
  206. sF6        LASTMARK    Last mark (eg after ctrl-down by mistake).
  207. sF7        NEXTMATCH    Next match (after an F4 or F7 search).
  208. sF8        RENUMBER    Renumbers a BASIC file.
  209. sF9        NEXTMARK    Jump to next set marker.
  210. sF10        DELTOSTART    Delete to start of line.
  211.  
  212. cF1        JOINLINE    Join line (useful in Basic mode).
  213. cF2        CLOSEWINDOW    Close current window (and jump to next).
  214. cF3        QUICKSAVE    Save the file with no prompt.
  215. cF4        NEWVIEW        New view (open new window on this file).
  216. cF5        WORDWRAP    Toggle wordwrap mode (w in title).
  217. cF6        FORMATTEXT    Format text to start of next paragraph.
  218. cF7        LASTMATCH    Previous match (see sF7).
  219. cF8        BINDTOKEY    Bind learnt sequence to a key.
  220. cF9        SAVESEL        Open the 'save selection' window.
  221. cF10        DELTOEND    Delete to end of line (emacs style ctrl K).
  222.  
  223. scF1        MODE0        Text mode   (display in text format)
  224. scF2        MODE1        Byte mode   (display in hex bytes)
  225. scF3        MODE2        Word mode   (display in hex words)
  226. scF4        MODE3        Ascii mode  (display in characters)
  227. scF5        MODE4        Code mode   (display in disassembled code)
  228. scF6        MODE5        BASIC mode  (display tokenised Basic)
  229. scF7        MODE6        BASTXT mode (display detokenised Basic)
  230. scF8        MODE7        C mode      (bracket matching + fn listing)
  231. scF9        MODE8        Colour C mode.
  232. scF10        MODE9        Colour Acorn assembler mode.
  233.  
  234. Ctrl letters:
  235.  
  236. cA        CLEFT        Start of line   - emacs compatibility.
  237. cB        LEFT        Back a char     - emacs compatibility.
  238. cC         COPYSEL        Copy selected region to current position.
  239. cD        DELETENEXT    Delete next char- emacs compatibility.
  240. cE        CRIGHT        Line end    - emacs compatibility.
  241. cF        RIGHT        Forward a char  - emacs compatibility.
  242. cG        CANCEL        Cancel search 'as you type' and return to
  243.                 start. Also cancel any yank operations.
  244.                 Escape from minibuffer.
  245. cH        OUTDENT        Outdent selection by current indent string.
  246. cI        INDIRECT    Indirect (move to the address given by word
  247.                 at cursor - useful in Code mode).
  248. cJ        INDENT        Indent selection by string (see selection
  249.                 menu).
  250. cK        DELTOEND    Kill line    - emacs compatibility.
  251. cL        LEARN        Learn key sequence (see F.1).
  252. cM        RETURN        Performs return action for current mode.
  253. cN        DOWN        Next line    - emacs compatibility.
  254. cO        TOFRONT        Bring editor window to front of windows.
  255. cP        UP        Previous line    - emacs compatibility.
  256. cQ        QUOTE        Insert next character into text (even if it
  257.                 is a ctrl character. eg cQ,cA inserts #1).
  258. cR        SEARCHBACK    Reverse search 'as you type'.
  259. cS        SEARCHFORWARD    Search 'as you type' forwards.
  260. cT        SELECTBUFFER    Select entire buffer.
  261. cU        UNIVERSALARG    Perform next instruction 'n' times. Eg
  262.                 cU 4 RETURN A inserts 4 A's.
  263. cV        MOVESEL        Move selected region to current position.
  264. cW        SETWIDTH    Set the window width.
  265. cX        CUT        Delete/Cut selected region.
  266. cY        PASTE        Paste/Yank once selected region.
  267. cZ        CLEARSEL    Clear selection.
  268.  
  269. scA        ADDRESSES    Addresses shown at line start.
  270. scB        BASIC        Drop into Basic with program downloaded.
  271. scC        COMPILE        Saves then chains/compiles a program.
  272. scD        INSERTDATE    Insert current date (format in 'keys' file).
  273. scE        SAVEANDRUN    Saves then runs a program then exits.
  274. scF        RUNANDEXIT    Runs a program and then exits.
  275. scG        TOGGLEWIND    Toggle window size.
  276. scH        LISTFNS        List function definitions.
  277. scI        NEXTTRACK    Move forward one track.
  278. scJ        LASTSECTOR    Move back one sector.
  279. scK        NEXTSECTOR    Move forward one sector.
  280. scL        LOGICAL        Logical line numbers shown at line start.
  281. scM        LASTTRACK    Move back one track.
  282. scN        NOLINENOS    Removes line numbers/addresses.
  283. scO        TOGGLEHEX    Line numbers shown in hex/decimal.
  284. scP        PHYSICAL    Physical line numbers shown at line start.
  285. scQ        SWAPCHARS    Swap next two characters around.
  286. scR        READONLY    Toggle read only state (r in title).
  287. scS        SWAPCASE    Swap case of next character/selected region.
  288. scT        INSERTTIME    Insert current time (format in 'Keys' file).
  289. scU        RUN        Run a basic program from memory.
  290. scV        -        Reserved.
  291. scW        KEEPREGION    Put selected region into yank buffer.
  292. scX        CLOSEOTHER    Close other open window.
  293. scY        YANK        Yank cyclically through deleted regions.
  294. scZ        KEYMAP 1    Emacs prefix key (eg scZ ESC X).
  295. sc- (c_)    FULLUNDO    Undo - emacs compatibility.
  296.  
  297. A.2 How to redefine more keys
  298. -----------------------------
  299.  
  300. At the start of the 'keys' file, the keys for keymap 0 (the default key map)
  301. are defined. Each line is of the form "comment &xxx command" where 'comment'
  302. is any text without a '&' describing the key, 'xxx' is the number of the key
  303. in hexadecimal (Zap key number - see below), ' ' is any number of spaces and
  304. tabs, and 'command' is the command (or list of commands) to be attached to
  305. that key. You may edit the file to add/remove keys as you please.  If a key
  306. is not mentioned in the keys file then it is passed on to the next task. Thus
  307. DO NOT put F12 in the 'keys' file (or if you do then bind it to the command
  308. SUSPEND :-).
  309.  
  310. A list of the valid commands you can use and their actions is given in the
  311. file 'Commands' within the 'Docs' directory. This also gives full details of
  312. the syntax used. To summarise these details, string parameters must be in
  313. double quotes (or omitted if you wish the minibuffer to be opened), and
  314. commands can be strung together with the ':' separator (as in BASIC).
  315.  
  316. The Zap key numbers lie in the range &000-&1FF and are based on those
  317. returned by Wimp_Poll. Thus, the function keys return &180-&1FF, as
  318. documented in the PRMs. Just look at the 'keys' file if you don't have a copy
  319. of the PRMs. Standard characters return their ascii value &20-&FF as usual.
  320. &7F stands for unshifted DELETE. Internally Zap uses some extra codes in the
  321. range &00-&1F and &100-&17F which differ from the Wimp's. These are
  322. documented in the file E-Keycodes in the docs directory.
  323.  
  324. Example: Suppose you wished ctrl-] to enter the code &1D into the file. Then
  325. you would enter the line: "c]        &12D CHAR &1D".
  326.  
  327. The keys c0-c9 and sc0-sc9 have been left intentionally blank. I suggest
  328. these are used for user commands/macros or binding the learnt sequence to via
  329. cF8. See the section A.5 on how to define multiple keymaps and switch between
  330. them.
  331.  
  332. A.3 Changing the default options
  333. --------------------------------
  334.  
  335. The Zap menu you get when you click the MENU button on a window contains the
  336. status for that window only. Any options changed on this menu will be lost
  337. immediately the window is closed. To change any option permanently, use the
  338. 'options' menu obtained by clicking on the Zap icon on the iconbar. After you
  339. have changed the option on this menu click the 'save options' entry.
  340.  
  341. Please note that some options are stored MODE dependantly. To change these
  342. options it is first necessary to SWITCH TO THE MODE WHOSE OPTIONS YOU WANT TO
  343. CHANGE ON THE OPTIONS.MODE MENU. The options you need to do this for include:
  344.     1) Display width.
  345.     2) Line number status.
  346.     3) Auto indent status.
  347.     4) Line edit/Non standard edit status.
  348.     5) Hex entry and Overwrite status.
  349.     6) Tab display status.
  350.     7) Colours.
  351.     
  352. When you change mode, the other options menus will be updated to give the
  353. status of the flags for this mode.
  354.     
  355. Example: To turn the line numbers off in Basic editing mode use the sequence
  356. of clicks:
  357.  
  358.     zap.options.mode.basic
  359.     zap.options.display.linenumbers.none
  360.     zap.options.mode.text
  361.     
  362. The mode set on the 'Options.Mode' menu will also be the mode used for
  363. loading files whose type is not recognised, or when you hold down the CTRL
  364. key. In general you should always put this mode back to TEXT after changing
  365. options of other modes.
  366.  
  367. Other options that are saved by clicking Save Settings include:
  368.     1) Whether searches are case sensitive or not.
  369.     2) Whether quick print adds a title header or not.
  370.     
  371. To change the default display width for mode n, use the options.mode.width
  372. menus. To change the size of an opened window for mode n, create a template
  373. in the template file called mode_n. The size and position of this template
  374. determines the opening size and position (modulo stacking) of your window.
  375. The other template flags are not looked at.
  376.  
  377. Some other options are stored in the 'keys' file. The file entries are in the
  378. form: "<comment> &xxx <arg1> <arg2> ... <argn>" where 'xxx' is a number I
  379. will call the key variable number. The variable numbers in the keys file are
  380. documented below:
  381.  
  382.  &000-&1FF    The default keymap.
  383.          arg1=the command attached to that key code.
  384.  
  385.  &200-&20F    These give the 16 search macros.
  386.          arg1=the macro string (up to 3 chars)
  387.          arg2=the replacement string.
  388.  &300        The date format to use for scD.
  389.          arg1=format string as used by the SWI OS_ConvertDateAndTime
  390.  &301        The time format to use for scT.
  391.          arg1=format string as used by the SWI OS_ConvertDateAndTime
  392.  &302        The default font name to use in font display modes.
  393.  &303        The number of blank lines to leave at the end of a window.
  394.  &304        The default font size in points.
  395.  &305        The number of pixels to shave off the top of a font char.
  396.  &306        The number of pixels to shave off the bottom of a font char.
  397.  &307        The codes to send to the printer at the end of a line for
  398.          'quick print'. arg1=string to be GS transed.
  399.  &308        Number of characters to keep cursor from the left margin.
  400.  &309        Number of characters to keep cursor from the right margin.
  401.  &30A        Number of characters to keep cursor from the top.
  402.  &30B        Number of characters to keep cursor from the bottom.
  403.  &30D        Right hand margin in pixels.
  404.  &30E        Filetype of file to be created when SELECT clicked on
  405.          the iconbar.
  406.  &30F        Filetype of file to be created when ADJUST clicked on
  407.          the iconbar.
  408.  &310        The number of pixels to shave off the left of a font char.
  409.  &311        The number of pixels to shave off the right of a font char.
  410.  &314        The minibuffer size in characters.
  411.  &315        The default indent string.
  412.  &316        Flashing cursor on period in centiseconds.
  413.  &317        Flashing cursor off period in centiseconds.
  414.  
  415.  &400        The number of the default key map (usually 0).
  416.  &4xx (xx<>0)    Range of keymap xx (see A.5)
  417.          arg1=smallest Zap keynumber to be supported
  418.          arg2=largest Zap keynumber to be supported (inclusive)
  419.          
  420.  &5xx        These say which mode to load a file on dependent on the path.
  421.          arg1=filetype to match (-1 for match any)
  422.         arg2=filename to match - the string can contain any of
  423.              the wildcards documented under searching.
  424.         arg3=[+]<mode name> as for arg1 in the 1xxx's below.
  425.         NB The order in which the names appear is important - the
  426.         first match will be taken.
  427.  
  428.  &1xxx        These specify which of the Zap modes a file of filetype xxx
  429.          should be loaded in as (when CTRL not pressed).
  430.          arg1=[+]<mode name>
  431.          If the optional '+' is present then the file will be loaded
  432.          even if SHIFT is not held when you double click.
  433.          The mode name is CASE SENSITIVE.
  434.          Place the &1xxx variable before the &5xx ones if you want
  435.          the filetype to be checked before the pathname.
  436.          
  437.  &2000        As for &1xxx, but the mode to use for UNTYPED files.
  438.  
  439.  &10000+    These specify alternate keymaps (see A.5).
  440.  &y0xxx        arg1=the command to be mapped to key with code &xxx in
  441.          keymap number &y.
  442.  
  443. A.4 Differences with RISCOS 2/3
  444. -------------------------------
  445.  
  446. If using fonts, then Zap will need the outline font manager vsn 2.42. This is
  447. used by Impression and other DTP programs. If using task windows, then Zap
  448. will expect to find the module 'Task' in the System:Modules directory. This
  449. should be the Task module supplied with DDE. Of course ^F12 will not bring up
  450. the taskwindow on Risc Os 2. I'm sorry about this, but it's a lot of hassle
  451. for me to find a Risc Os 2 machine to work on. You can always map ^F12 to the
  452. command TASKWINDOW.
  453.  
  454. Please note that only left shift double click will load a non text file.
  455. Right shift is deliberately not tested for as some people use it for other
  456. things. I have no control over this on Risc Os 3.
  457.  
  458. Another set of templates has been provided for Risc Os 3 users. These are
  459. called TemplatesE and I must thank Martin Ebourne for allowing me to
  460. include them.
  461.  
  462. A.5 Multiple keymaps / the Emacs keymap.
  463. ----------------------------------------
  464.  
  465. Zap can support several keymaps at once. Each keymap is numbered 0-255.
  466. In the default 'keys' file, keymap 0 is the standard Zap keymap and keymap 1
  467. an Emacs emulation keymap. Keymaps 2-4 form part of the Emacs keymap as I
  468. will describe below. To switch to keymap n, use the command "BASEMAP n" (by
  469. pressing Ctrl-Escape or binding the command to a key). The commands
  470. DEFAULTMAP and EMACS act as BASEMAP 0 and BASEMAP 1 respectively.
  471.  
  472. The default keymap to use when Zap starts up is given by variable number &400
  473. in the keys file. Set this to 1 if you wish to use the Emacs keymap all the
  474. time.
  475.  
  476. To define a new keymap, keymap number &yy say, you need to do two things.
  477. First you must enter a line in the 'keys' file reserving space for the keys.
  478. This takes the form:
  479.  
  480.     &4yy    &aa    &bb
  481.     
  482. where &aa is the smallest keynumber you wish to use and &bb the largest
  483. (inclusive). See entry &401 for an example.
  484.  
  485. Next you must define the keys. To define key number &xxx you must enter a
  486. line in the 'keys' file of the form:
  487.  
  488.     &yy0xxx        <command>
  489.     
  490. where <command> is the name of the command to be attached to the key. The
  491. format of the <command> field is described in A.1 and the 'Commands' file.
  492.  
  493. By using multiple keymaps you can provide for a sequence of keys to execute a
  494. command. To do this you need the 'KEYMAP' command. The command 'KEYMAP n'
  495. switches the current keymap to 'n'. However, after the next key has been
  496. read, the current keymap is restored to whatever basemap you have set with
  497. the basemap command. Thus in effect, the keymap only changes for the next
  498. keypress (unless that two has a KEYMAP command).
  499.  
  500. For example, in Emacs "Ctrl-X 4 F" loads a file. This is accomplished by
  501. setting:
  502.  
  503.     Ctrl-X in keymap 1 is bound to     KEYMAP 2
  504.     4 in keymap 2 is bound to     KEYMAP 4
  505.     F in keymap 4 is bound to     FINDFILE
  506.  
  507. After the command FINDFILE has been executed, the keymap will be restored to
  508. 1 for the next key press.
  509.  
  510. A.6 Colour
  511. ----------
  512.  
  513. Colour is changed using the 'Colour' menu off the 'Display' menu, both on
  514. the main Zap window menu. The first 9 colours you can change are the same
  515. for all modes, being:
  516.  
  517. Colour    Action
  518.  
  519. 0    Background1    The colour used for squares containing no text.
  520. 1    Background2    The colour used for squares containing text.
  521. 2    Foreground    The standard foreground colour.
  522. 3    Selection-B    Selection background colour.
  523. 4    Selection-F    Selection foreground colour.
  524. 5    Cursor-Bac    Cursor background colour (ie the cursor colour).
  525. 6    Cursor-For    Cursor foreground colour.
  526. 7    Line nums    Colour used for line numbers (eg in Basic mode).
  527. 8    Ctrl chars    Colour used for control characters (0-31).
  528.  
  529. Colours 9-15 are mode dependant and lie below a dotted line. If the 'all
  530. modes' flag at the top of the menu is set then when you change one of the
  531. colours 0-8 (as above) then it is changed for all modes, not just that one
  532. mode. Colours 9-15 only set the colour for that mode regardless of the status
  533. of this flag. You will need to change modes to set up the colours for
  534. different modes differently.
  535.  
  536. Of course, if you change colours from the window menu, then the colours are
  537. only changed for that window and are lost when the window is closed. To
  538. change them permanently, use the Display menu off the options menu and then
  539. click on 'save options'.
  540.  
  541. *************************************************************************
  542. * Section B:    Loading,Saving,Printing,Editing files            *
  543. *************************************************************************
  544.  
  545. B.1 Loading/creating files
  546. --------------------------
  547.  
  548. These are the ways to load a file into Zap:
  549.  (a) If the file is a text file then double click on it.
  550.      (or more generally if there is a '+' for this type in the keys file).
  551.  (b) If the file is typed then hold down left shift and double click on it.
  552.  (c) If the file is untyped then drag it onto the Zap icon on the iconbar.
  553.  (d) Press F2 then type the name of the file and RETURN (TAB completes the
  554.      filename).
  555.  
  556. When you load a file into Zap, it works out the best mode to load it into. At
  557. the moment there are two mechanisms for doing this, both specified in the
  558. 'keys' file. These are: (see A.3 for more details).
  559.  
  560. (i) By filename: The keys variables &5xx are followed by a filetype then a
  561.     filename and then a mode to use. If the (wildcarded) filename matches
  562.     and the filetype matches then that mode is used.
  563.     
  564. (ii) By filetype: The keys variable &1xxx is followed by the mode name to
  565.      use for type &xxx. If the name is preceded by a '+' then the file is
  566.      loaded even if shift is not held.
  567.      
  568. If the file satisfies more than one of the above criterion, then the first
  569. one mentioned in the keys file will be used.
  570.  
  571. Sometimes you may wish to load a file in a mode other than its default one.
  572. To do this, set the required mode on the 'Options.Mode' menu, and then hold
  573. down the CTRL key while loading the file. (Eg Shift-Ctrl double click on the
  574. file). It will then be loaded in the selected mode (usually text).
  575.  
  576. Dragging a file into an open window inserts the data at the current cursor
  577. position. RAM loads/saves are fully supported and you may even save a file
  578. into itself. If you are short of memory then I suggest you switch the undo
  579. buffer off before performing such drags. (Use the File menu).
  580.  
  581. In any mode the window title is of the form:
  582.  
  583.      "<filename> [*] ([options]) [view number/number of views]".
  584.  
  585. The title is centered unless the window is small when it is right aligned so
  586. you can see the leaf name and options of the file. A '*' indicates that the
  587. file has been altered since last saved. The options characters are described
  588. below. The view number is only shown if you have more than one view on a
  589. file.
  590.  
  591.  R        Read only and fixed as read only.
  592.  r        Read only but can be toggled to read/write by scR.
  593.  u        Undo supported by this file (so cX acts as cut, not delete).
  594.  o        Overwrite mode active (toggle via Insert key).
  595.  h        Hex entry mode active for Byte/Word (toggle via F2).
  596.  w        Wordwrap mode active (toggle via cF5).
  597.  l        Line edit mode active (return inserts new line).
  598.  a        Auto indent mode active (see the Edit submenu).
  599.  n        Non standard mode active (used by ARMBE emulation mode).
  600.  L        Line wrap mode.
  601.  
  602. You may also create files of a given type using the 'Create.Type' menu, or
  603. grab modules using the 'Create.Getmodule' menu. Zap can also read disc
  604. sectors and other applications memory. Click SELECT on the Zap icon to create
  605. a new text file and ADJUST on the Zap icon to create a new BASIC file. You
  606. can change the type of file created by SELECT/ADJUST click in the 'keys'
  607. file.
  608.  
  609. Zap will warn you before overwriting a file of the same name if it is
  610. altered. If it is unaltered then the newly loaded file will replace the one
  611. currently loaded as in !Edit.
  612.  
  613. When a file is loaded, OS_FSControl, Canonicalise_Path will be called to
  614. convert any path references into full path names (unless you have RISC OS 2).
  615.  
  616. B.2 Saving files
  617. ----------------
  618.  
  619. Press F3 (or click on the menu option 'File') to open the save box. You may
  620. change the file type either by clicking the MENU button, or by moving to the
  621. type name window, typing the new type name and pressing RETURN. Zap will warn
  622. you if you are about to overwrite a more recent file (if you have the
  623. check-dates option on - see the options.misc menu), or if the file contains
  624. no path. If you ignore the warning then it will save the file to the
  625. currently selected directory.
  626.  
  627. Ctrl-F3 (or clicking on 'File.Save') does a direct save. Ctrl-F2 deletes the
  628. current file and Shift-Ctrl-X deletes the other file being viewed. Please
  629. note that when the SAVE,DISCARD,CANCEL box pops up you may simply press
  630. 'S','D',or 'C' instead of using the mouse. The same holds for other dialogue
  631. boxes (ctrl S,D,C are also valid).
  632.  
  633. If you are using one of the basic modes then please note that you must save
  634. from a window in the correct mode. If you switch to text mode and then save,
  635. your file will be saved as a text file and not a Basic program.
  636.  
  637. B.3 Dumping, printing files
  638. ---------------------------
  639.  
  640. First note that any window display may be turned into a text file simply by
  641. pressing SHIFT-CTRL-COPY. Once you have done this you could print a file
  642. simply by saving it to a printer driver, or by opening the 'printer:$' filing
  643. system (press ctrl-print) and saving the file into it. Zap also provides two
  644. other printout commands.
  645.  
  646. The first, 'quick print' can be got by pressing the 'Print' key. When you
  647. press Return, or click 'PRINT', it will send the display to the printer
  648. directly. It sends a LF and a CR to the printer at the end of each line. You
  649. may configure the codes sent by altering the 'keys' file variable &307.
  650.  
  651. The second, 'fancy print' can be got by pressing 'Shift-Print'. You must have
  652. a printer driver loaded. The file will then be output via the printer driver
  653. in the current outline font selected via the 'Display.Font.Othername' menu.
  654.  
  655. B.4 Selecting regions
  656. ---------------------
  657.  
  658. There are several ways to mark regions in Zap. The most obvious is to use the
  659. mouse.
  660.  
  661. If there is no region selected then DRAG SELECT will mark a new region, and
  662. ADJUST CLICK/DRAG will select between the clicked point and the cursor. If
  663. there is already a region selected then DRAG SELECT will start selecting a
  664. new region, ADJUST CLICK/DRAG will alter the old region. In either case, hold
  665. down the CTRL key to leave the cursor unaffected by the selection.
  666.  
  667. The second method is to use the keyboard. This method is much faster when
  668. you have got used to it. First move to the start of the region you wish to
  669. mark. Then press CTRL-COPY and move (via the cursor keys) to the end of the
  670. region. Then press ESCAPE (or CTRL-COPY).
  671.  
  672. The third method is to use multiple clicks. Double click marks a word, triple
  673. click a line, quadruple click a paragraph and quintuple click the whole
  674. file. If you do a drag selection after the second/third click, then the text
  675. will be selected in words/lines. Note that the BASIC mode limits selected
  676. regions across lines to full Basic lines (like the ARMBE).
  677.  
  678. B.5 Copying/pasting/cutting/yanking
  679. -----------------------------------
  680.  
  681. Zap implements both the !Edit style copy/move and the Emacs style paste/yank.
  682.  
  683. The !Edit method: To move a region to the cursor position press ctrl-V. To
  684. copy a region press ctrl-C.
  685.  
  686. The Emacs method: To move a region cut it with ctrl-X and then paste it with
  687. ctrl-Y (the undo buffer must be on to do this). To copy a region, grab it
  688. with shift-ctrl-W (Emacs meta-W) and paste it with ctrl-Y. Press shift-ctrl-Y
  689. (Emacs meta-Y) to cycle through the previously deleted regions. Also note
  690. that multiple presses of ctrl-K or F10 produce data which can be yanked by
  691. ctrl-Y.
  692.  
  693. Another way to copy text is via the COPY key. This is faster for copying
  694. small sections of other lines. First press the COPY key to split the cursor
  695. into two. One cursor can be moved about by the cursor keys. Move this to the
  696. area you wish to copy from and press the COPY key once for each character.
  697. Press ESCAPE or RETURN to cancel the copy mode. Please note that you can also
  698. use this method across windows and even across modes!
  699.  
  700. B.6 Inserting text/control codes
  701. --------------------------------
  702.  
  703. In text mode there are two features to help you format text as you type it.
  704. The first is called 'word wrap' and is toggled on and off via cF5. The second
  705. is called 'line wrap' and can be toggled on and off via the 'Edit' menu (or
  706. you can bind the LINEWRAP command to a key if you wish). Whilst either of
  707. these modes are active, text typed beyond the 'wrap width' margin (set via
  708. the 'Edit' menu) is automatically split at spaces and placed on the next
  709. line. 'Wordwrap' differs from 'linewrap' in that when you delete characters,
  710. the paragraph will be formatted in wordwrap mode (thus pulling text back) but
  711. not in linewrap mode.
  712.  
  713. There are two ways to insert control characters. The first is to 'quote' the
  714. character. To do this, press ctrl-Q and then type the control character you
  715. want to insert. Eg, ctrl-Q ctrl-A will insert the byte 1. The second is to
  716. switch to byte mode (scF2), type the digits in hex and then switch back to
  717. text mode (scF1). This assumes that 'hex entry mode' is active in byte mode.
  718.  
  719. When creating macros, by binding a list of commands to a key, you may find
  720. the commands INSERT and INSERTGS useful. The first inserts a string into the
  721. text and the second GS-Trans's it first.
  722.  
  723. *************************************************************************
  724. * Section C:    Editing BASIC - PLEASE READ                *
  725. *************************************************************************
  726.  
  727. C.1 Changing editors/options
  728. ----------------------------
  729.  
  730. There are essentially 3 ways to edit basic programs in Zap. Do not be put off
  731. if you dislike the default configuration. You may change most things to your
  732. preference.
  733.  
  734. In the default configuration, basic programs are edited in the zap extension
  735. mode called BASIC. This is designed to be a desktop version of Acorn's ARMBE.
  736. Those people used to ARMBE should find this mode very easy to use. The main
  737. points are that is edits the program while tokenised, and acts as a line
  738. editor. Ie, RETURN inserts a new line after the current one, and the
  739. functions SPLIT,JOIN on shift-F1 and ctrl-F1 are used to manipulate lines.
  740.  
  741. For those people who wish to edit BASIC in tokenised form, and thus with line
  742. numbers accessible, but who do not like 'line editors' as described above,
  743. perform the option changes indicated by the clicks:
  744.  
  745.     options.mode.BASIC         ; configure basic mode
  746.     options.edit.line edit         ; turn off line editor mode
  747.     options.edit.non standard     ; turn off non standard split/join
  748.     options.display.linenumbers.none ; turn off line numbers
  749.     options.mode.TEXT         ; return config mode to text
  750.     options.save options         ; save your !Config file
  751.     
  752. This will result in a mode where the BASIC program is still tokenised, but
  753. RETURN and DELETE act normally as split and join operators. Also the line
  754. numbers have been switched off.
  755.  
  756. For those who prefer to edit basic in detokenised form, there is a separate
  757. mode named BASTXT which accomplishes this. To load a single file in using
  758. this mode it is easiest to set the options menu mode to BASTXT and hold down
  759. CTRL key while loading the file. To change to the BASTXT mode permanently,
  760. change the line of the 'Keys' file which reads:
  761.  
  762.     Basic        &1FFB    BASIC
  763.     
  764. to read:
  765.  
  766.     Basic        &1FFB    BASTXT
  767.     
  768. In this mode, whenever a file is loaded it is converted into text with line
  769. numbers striped. Saving is the converse. Please note that if the program
  770. contained line number references, then Zap will beep before forcing the BASIC
  771. mode described in C.2.
  772.  
  773. C.2 Using BASIC in ARMBE mode
  774. -----------------------------
  775.  
  776. In it's default setup the BASIC mode is designed to emulate ARMBE. Thus line
  777. numbers are displayed in the left margin, and automatic renumbering takes
  778. place as lines are added to the file. All GOTO and GOSUB line number
  779. references are automatically updated.
  780.  
  781. In line editor mode, the RETURN key inserts a new logical line. To split the
  782. line in two at the current cursor position press SHIFT-F1 and to join two
  783. lines press CTRL-F1. When two lines are joined, a ':' is inserted between the
  784. statements. If you do not like this, it can be switched off by turning off
  785. the line-edit and non-standard flags on the edit menu. See above.
  786.  
  787. Text is typed as usual with the proviso that tokens are automatically
  788. expanded. For example 'P.' will be expanded to 'PRINT' when you press the
  789. dot. Also note that in non-standard editing mode excess spaces are
  790. automatically removed from the end of a line (except when this would prevent
  791. the line wrapping onto the next). 'Unix' tab mode just advances the cursor to
  792. the next tab stop as in ARMBE. The other tab modes, !Edit and Coltab work as
  793. in the text mode.
  794.  
  795. Copying bits out of the middle of lines is performed using the COPY key.
  796. Groups of lines are selected, cut and moved/copied as usual for any text
  797. region. The regions are automatically renumbered internally. For those (like
  798. me) used to the ARMBE way of moving regions, there is a natural replacement.
  799. For example suppose you wish to move lines 10-50, to before line 100. In the
  800. ARMBE you would do:
  801.  
  802.   Move to line 10, cM cM, move to line 50, cM cM, move to line 100, cB, f12
  803.   
  804. In Zap you do:
  805.  
  806.   Move to line 10, cCOPY, move to line 60, ESCAPE, move to line 100, cV
  807.  
  808. Goto's are automatically updated. For example copy the lines 10 and 20 below
  809. several times in a basic program.
  810.  
  811.     10 PRINT "HELLO"
  812.     20 GOTO 10
  813.     
  814. Shift-F8 renumbers any program in steps of 10. Please note that line numbers
  815. are not stored in the undo buffer as this would be a waste of space. Thus
  816. after multiple undo's, the line numbers may get out of order. This can be
  817. rectified by Shift-F8. Basic programs can be appended by simply dropping them
  818. into the window.
  819.     
  820. C.3 Testing BASIC programs
  821. --------------------------
  822.  
  823. Zap provides a number of functions to test out basic programs while they are
  824. being edited. The first 3 start up a new BASIC task and ram transfers your
  825. program to the new task, loading it a PAGE:
  826.     
  827.  scB    This drops you into basic with your program loaded at PAGE.
  828.  scU    This acts as cB and then Runs the program.
  829.  scF    This acts as cU but automatically quits BASIC when finished.
  830.  
  831. The other two commands save the program first, and then run them from disc.
  832. These are of course slower:
  833.  
  834.  scC    This acts as cU but saves the program first and chains it from disc.
  835.  scE    This acts as cF but saves the program first and chains it from disc.
  836.  
  837. Zap calculates the amount of room needed to run the program as the maximum
  838. of: 1) Next slot size 2) Program size+16k 3) Program size * 1.5.
  839.  
  840. *************************************************************************
  841. * Section D:    Individual mode help                    *
  842. *************************************************************************
  843.  
  844. Zap can handle up to 256 text processing modes. I have currently allocated
  845. space for 16. For details on how to write your own mode see the 'Docs'
  846. directory. The currently defined modes are described below.
  847.  
  848. D.0 Text Mode
  849. -------------
  850.  
  851. This is a basic text editing mode. Most of the functions associated with this
  852. mode are detailed elsewhere. See the 'Helpdata' file for a detailed listing
  853. of menu options. To insert control characters in the text it is easiest to
  854. switch temporarily to byte mode. The character &09 in a text file is taken to
  855. denote a tab to next column of 8. You may change this character and the way
  856. it is displayed from the display menu. Tab action may be changed by the
  857. 'Misc.Tabs' menu.
  858.  
  859. D.1 Byte Mode
  860. -------------
  861.  
  862. This mode gives displays the file in hex bytes and is used for examining data
  863. or inserting control characters. The hex-entry flag (toggled by shift F3)
  864. controls this action. If it is off and you type '0B' then the letters '0' and
  865. 'B' will be inserted. If hex-entry is on (h in title) then the byte &0B will
  866. be inserted. Use the overwrite mode (toggled via the insert key) to change
  867. the data without shifting the file.
  868.  
  869. D.2 Word Mode
  870. -------------
  871.  
  872. This is similar to byte mode except the data is shown in word form. Typing
  873. characters with hex-entry mode off has no effect, but typing with it on
  874. inserts the given word in hex.
  875.  
  876. D.3 Ascii Mode
  877. --------------
  878.  
  879. This mode displays data in ascii dump form. Letters typed are inserted as
  880. usual.
  881.  
  882. D.4 Code Mode
  883. -------------
  884.  
  885. This mode displays data in disassembled format with 1 instruction per line.
  886. Please note that in RISCOS 3, the debugger adds some extra information after
  887. some instructions, but some of this only appears if you disassemble
  888. sequentially. Eg TEQP R0,#0 followed by MOV R8,#0 gives the warning 'Not
  889. r8-r14'. However this may vanish if you are moving backwards up the file
  890. instead of forwards. This happens very rarely but it may cause confusion if
  891. you don't understand what's happening.
  892.  
  893. The four most useful keys in code mode are cI,Left,Right,Return. For example
  894. if you are at the start of a module then pressing cI will cause you to jump
  895. to the start offset of the module. If you are on an instruction 'BL
  896. &00012345' or 'ADR r0,&01822445' then pressing Right will jump to the
  897. indicated address. At any time, Left will move you back to your previous
  898. position. This jumping uses the marker buffer and can be done to any depth
  899. you require.
  900.  
  901. The RETURN key enables you to edit an instruction (via the ASSEMBLE command).
  902. When you press it, the minibuffer will be opened with the current instruction
  903. entered as default. You should then edit the instruction and press RETURN
  904. again for it to be assembled and written back. The assembling is done by the
  905. ZapBasic module which tokenises the instruction and then uses the BASIC
  906. assembler. Hence you may use the basic functions ASC,EQUD,ADR etc.
  907.  
  908. If the file is typed 'Module' then the first few offsets display the module
  909. entry point name rather than the instruction. 
  910.  
  911. D.5 BASIC Mode
  912. --------------
  913.  
  914. See sections C.1, C.2 and C.3 for details about how to use this mode.
  915.  
  916. A slight modification is made to the BASIC program on loading. The actual
  917. file format edited is  a number of lines of the form:
  918.  
  919.  xx yy zz "Tokenised line" &0D
  920.  
  921. Where xx yy zz is the line number in 3 byte text form as stored after a GOTO
  922. or GOSUB statement.
  923.  
  924. D.6 BASTXT Mode
  925. ---------------
  926.  
  927. This edits Basic files in detokenised form. See sections C.1 and C.3 for
  928. details.
  929.  
  930. D.7 CMODE Mode
  931. --------------
  932.  
  933. This mode provides facilities for editing C, TeX, and Gopher files including
  934. bracket/dollar matching and function listing. The mode is written by Bryan
  935. Scattergood. Please see the file '3rdParty.CModeHelp' for details about this
  936. mode.
  937.  
  938. D.8 C Mode
  939. ----------
  940.  
  941. This provides a coloured C mode. See the file '3rdParty.ZapMjeHelp' for more
  942. details.
  943.  
  944. D.9 Assembler Mode
  945. ------------------
  946.  
  947. This provides a coloured Acorn Assembler mode. See the file
  948. '3rdParty.ZapMjeHelp' for more details.
  949.  
  950. D.10 Pascal Mode
  951. ----------------
  952.  
  953. See the file '3rdParty.ZapMjeHelp' for more details.
  954.  
  955. D.11 THROWBACK Mode
  956. -------------------
  957.  
  958. This mode handles the files generated by Zap's search to buffer, C throwback
  959. and !Find info output. Double clicking on an item will jump to that item in
  960. the source file. Shift double clicking will jump to the item and then kill
  961. the throwback buffer. Clicking ADJUST on a line will remove the line from the
  962. file.
  963.  
  964. Also note that RETURN acts in the same way as double click and DELETE in the
  965. same way as adjust if you move into the file.
  966.  
  967. D.12 Taskwindow Mode
  968. --------------------
  969.  
  970. This mode handles task windows. To create a task window use the
  971. 'Create.Taskwindow' menu option or press ctrl-F12. At any time, changing mode
  972. to TEXT will suspend the task, and changing mode back to TASKWINDOW will
  973. resume it. The taskwindow output supports the COPY key and the following VDU
  974. actions:
  975.  
  976.     07 CTRL G    Bell.
  977.     08 CTRL H    Move back one character.
  978.     09 CTRL I    Move forward one character.
  979.     10 CTRL J    Move down a line.
  980.     11 CTRL K    Move up a line.
  981.     12 CTRL L    Clear text window.
  982.     13 CTRL M    Move to line start.
  983.     22 CTRL V    Change mode.
  984.     26 CTRL Z    Restore text window.
  985.     28        Define text window.
  986.     30        Home cursor.
  987.     31        Move to x,y (TAB).
  988.     
  989. If you use Richard K. Lloyd's wonderful 'Line Editor' module then you'll find
  990. it now works within the taskwindow. There is a problem in that it changes the
  991. FX 4 value and thus the COPY key will not work in the taskwindow if you have
  992. the line editor loaded. The solution is to press F12 then RETURN to reset the
  993. FX 4 value before using the copy key. Mode changes are reflected by changing
  994. the width and height of the window.
  995.  
  996. Control keys and function keys are NOT passed on to the taskwindow so you
  997. can use CTRL-C to copy commands to the current taskwindow line. If you
  998. want to send a control key or function key to the taskwindow then this can
  999. be done by quoting it with CTRL-Q. For example, CTRL-Q CTRL-L will clear
  1000. the screen, and CTRL-Q F1 will cause function key F1 to be expanded in the
  1001. taskwindow.
  1002.  
  1003. D.13-D.15 These modes are reserved
  1004. ----------------------------------
  1005.  
  1006. *************************************************************************
  1007. * Section E:    Search and Replace                    *
  1008. *************************************************************************
  1009.  
  1010. E.1 The Search window
  1011. ---------------------
  1012.  
  1013. Zap has quite a powerful search facility which is based loosely on emacs
  1014. search, allowing 'OR' constructs and character ranges. The search window can
  1015. created by pressing F4 or F7 or using the 'file' menu. Pressing F4 will
  1016. ensure that search matches are jumped to, whereas pressing F7 will cause all
  1017. matches to be placed in a separate throwback buffer. Double clicking on a
  1018. match in the buffer then jumps to the match. See section D.11.
  1019.  
  1020. The first column of the search window selects whether you wish to search for
  1021. a string, instruction or word (4 bytes). In the first two cases enter the
  1022. string to match. In the third case enter an expression evaluating to a number
  1023. to search for.
  1024.  
  1025. The second column selects where the search should start and the direction of
  1026. the search. You may start at the beginning of the text or forwards/backwards
  1027. from the current cursor position. If you wish to change the default option
  1028. for this then just edit the template file.
  1029.  
  1030. The third column selects the output. If you choose cursor output (F4) then
  1031. the cursor will be moved to the first match and subsequent matches may be
  1032. got by sF7 (Next match) and scF7 (Previous match) as in the Basic Editor. A
  1033. beep will sound if there are no more matches and the cursor will not move. If
  1034. you choose 'to buffer' (F7) then all matches are placed in a new (text) file.
  1035. Double clicking on entries in this text file cause the cursor to be moved to
  1036. the corresponding match.
  1037.  
  1038. Now to the search string. In order that the user may have any search syntax
  1039. he/she chooses, I have adopted the following approach:
  1040.  
  1041.  * All wildcards/commands begin with a '\' as listed below.
  1042.  * The user may define up to 16 macros (aliases) in terms of these commands.
  1043.  * When the search string is entered, all the users macros are substituted
  1044.    before the search takes place.
  1045.  
  1046. The macros may be examined and altered by clicking on the 'Show Macros'
  1047. button. The default macro definitions are stored in the 'Keys' file and may
  1048. be altered there. The macros can be temporarily turned off in the 'Macros'
  1049. window. This window also controls whether the search is case sensitive or
  1050. not. These options are stored in the !Config file and saved via the menu
  1051. option 'Options.Save options'.
  1052.  
  1053. For example; I have * as a standard macro for \.\*. Thus if I typed in a*b,
  1054. the string would be converted to a\.\*b. However a\*b would remain as a\*b as
  1055. the * follows a \ and is thus treated as a command.
  1056.  
  1057. The table below details all the escape characters and commands. In it I will
  1058. use 'x' to stand for any ascii character unless otherwise mentioned.
  1059.  
  1060. x    Matches character 'x' (according to case sensitivity).
  1061. \x    Matches 'x' case sensitively, unless \x mentioned below.
  1062. `x    Matches 'x' only (without any replacement of macros).
  1063. \( \)    Act as brackets for nesting expressions.
  1064. \{ \}    Act as the normal brackets above, but may be referred
  1065.     to in the replace string during a search and replace. See E.2.
  1066. \#    Matches any character. Eg a\#d matches 'and','aad' but not 'ad'.
  1067. \.    Matches any character except the return character.
  1068. \*    Matches any number of the previous expression. Eg fo\* matches
  1069.     'f','fo','foo' etc. and \(and\)\* matches '','and','andand' etc.
  1070. \%    Matches the most number of repetitions of the previous expression.
  1071.     Thus \[0-9]\% matches '1' in '1pt' and the '395' in 'ab395rty'.
  1072. \|    Matches one expression OR another. Eg hello\|goodbye\|fred.
  1073.     Eg \(a\|b\)\* matches 'abababa','abbba' etc.
  1074. \[..]    Matches a range of characters. Eg \[a-zA-Z%] matches any letter or
  1075.     a '%'. If a '^' is given after the opening bracket then
  1076.     it acts as a NOT. Thus \[^abc] matches any character except a,b,c.
  1077. \<    Matches null string at line start (and file start).
  1078. \>    Matches null string at line end.
  1079. \+    Turns on case sensitivity for the following letters ONLY. It's
  1080.     effect stops at the next wildcard/bracket/command. It doesn't
  1081.     affect nested/bracketed statements - this will be improved.
  1082.     Eg \+Fred\|Bill matches Fred case sensitively but not Bill.
  1083. \-    As above, but turns off case sensitivity.
  1084. \\    Matches a '\'.
  1085. \ddd    Where d is any decimal digit matches that number.
  1086.     Eg '\0alf' matches byte 0,'alf' and \233 matches byte 233.
  1087.     Please note that \999 matches byte 99 followed by '9' as 999>255.
  1088. \&hh    As above but matches the hex byte hh when h are valid hex chars.
  1089. \xhh    Matches hex numbers as above (where 'x' is the letter 'x').
  1090. \A-\Z    Match ctrl A to ctrl Z.
  1091. \b    Matches backspace (8)
  1092. \f    Matches a form feed (12)
  1093. \n    Matches a new line (10)
  1094. \o    Matches any character except a '.' (useful for matching filenames).
  1095. \r    Matches a return (13)
  1096. \t    Matches a tab (9)
  1097. \v    Matches a vertical tab (11)
  1098.  
  1099. In most cases you will wish to macro '|' as being '\|' and '(' as '\(' etc.
  1100. This is how the default macros are set up. Macros can be switched off in the
  1101. macro box. In the examples below, the default macros are assumed. Please note
  1102. that you may macro the macros! Eg, you could define '(' to be '\(' and '\( to
  1103. be '(' if you wished.
  1104.  
  1105. Examples:
  1106.  
  1107.  cat|mat        Matches cat or mat.
  1108.  re*ment        Matches any occurrence of 're' then 'ment' on a line.
  1109.  SWI                Matches any SWI (in code mode).
  1110.  LDR|STR        Matches any load or store instruction.
  1111.  R6            Matches any instruction using R6.
  1112.  BL*&0000A95C        Matches any call to &0000A95C.
  1113.  \&0A            Matches the byte &0A.
  1114.  \<fred            Matches fred, but only at the start of a line.
  1115.  main`(            Matches 'main('
  1116.  \d\%            Matches any number (where \d is macroed as \[0-9]).
  1117.  
  1118. Hints:
  1119.  
  1120. The search will be MUCH faster if you give a definite first character to
  1121. start with. Eg 'a\(nd\|pple\)' will be a lot faster than 'and\|apple'.
  1122. If the search takes longer than 1/3 second, then an hourglass will come up
  1123. displaying the position in the file as a percentage underneath. You may stop
  1124. the search by pressing Escape, and the partial results will be displayed if
  1125. you are using 'Search to buffer'.
  1126.  
  1127. E.2 The Replace window
  1128. ----------------------
  1129.  
  1130. A Search and Replace window can be created by pressing shift-F4 or from the
  1131. 'file' menu. The first column sets the search start position and direction as
  1132. in the Search window described above. The second column selects either
  1133. selective or global replace.
  1134.  
  1135. For a selective replace, each match will be highlighted and a 'Replace ?'
  1136. window will appear. Press 'R' to replace that match and move onto the next
  1137. match. Press 'S' to skip to the next match without replacement. Press 'T' or
  1138. 'E' to replace all matches from this point (inclusive) to the end of the
  1139. file. Press 'C' or ESCAPE to stop the selective replace.
  1140.  
  1141. The format of the search string is described in section E.2. In the replace
  1142. string, MACROS ARE NOT EXPANDED and you may use the following control
  1143. sequences:
  1144.  
  1145. \ddd    Replace with the decimal byte ddd.
  1146. \&hh    Replace with the hex byte hh.
  1147. \x    Replace with character 'x' (eg '\\' -> '\').
  1148. &n    Replace with the n'th \{,\} expression in the search string (n<10).
  1149. &&    replace with an '&'
  1150.  
  1151. If you wish to include parts of the match string in the replacement string
  1152. then you must surround the relevant sections in the search string with {,}
  1153. type brackets (assuming the standard macros). Note that macros like '\n'
  1154. should not be inserted in a replace string, you will just get 'n'.
  1155.  
  1156. Examples:
  1157.  
  1158.  Search string:    Replace string:    Action:
  1159.  
  1160.  'cat'        ''        Removes all occurrences of 'cat'
  1161.  '{cat}'    '&1s'        Replaces 'cat' with 'cats' preserving case.
  1162.  'time={#}'    'time is &1'    Replaces 'time=58' with 'time is 58' etc.
  1163.  
  1164. To convert spaces between columns of figures in a table into tab characters
  1165. make the find string '{\d}  \*' and the replace string '&1\9'. Another way
  1166. to do this is replace '{\d} \%' with '&1\9'.
  1167.  
  1168. E.3 Keyboard (incremental/interactive) search
  1169. ---------------------------------------------
  1170.  
  1171. Incremental search is activated by pressing ctrl-S (Search forward) or ctrl-R
  1172. (Reverse search). When you do this a minibuffer will be opened for you to
  1173. type the search string into. As you type the search string, Zap will
  1174. search through the text placing the cursor at the end of the next match.
  1175. If there is no match then Zap will beep and print "(fail)". You may use the
  1176. DELETE key to remove characters from the search string.
  1177.  
  1178. To halt the search at the current position, press Escape or Return. If you
  1179. press an arrow or function key then the search will be halted and the key
  1180. then acted upon. Alternatively, pressing cG (Cancel) will cause the search to
  1181. be cancelled and the cursor returned to its initial position. This setup
  1182. should be familiar to users of Emacs.
  1183.  
  1184. Pressing ctrl-S or ctrl-R whilst in search mode will move you to the
  1185. next/previous matches. If the search string was empty then the previous
  1186. search string will be placed in the buffer.
  1187.  
  1188. Macros are turned off during the search so ('s etc act as normal. However,
  1189. \( and all other \-starting commands will still work so you must type \\
  1190. to search for a \.
  1191.  
  1192. *************************************************************************
  1193. * Section F:    Other features                        *
  1194. *************************************************************************
  1195.  
  1196. F.1 Learning key sequences
  1197. --------------------------
  1198.  
  1199. This feature of Zap is very simple to use, and very useful. To start
  1200. 'learning' a key sequence, simply press ctrl-L. Type the sequence you wish to
  1201. learn and then press ctrl-L again. Press F1 to execute the learnt sequence.
  1202.  
  1203. Note firstly that Zap will beep after every keypress you make to remind you
  1204. that it is being stored. Secondly note that the ESCAPE key will NOT stop the
  1205. learning process. Only ctrl-L will stop it. Thus you can learn sequences
  1206. which use incremental search, or keyboard selection of regions. Both these
  1207. actions involve the Escape key.
  1208.  
  1209. Once you have learnt a sequence, you may 'bind' that sequence to a key so
  1210. that pressing that key in future causes the same series of actions to take
  1211. place. To do this press CTRL F8 and then press the key you want to bind the
  1212. sequence to (or Escape if it was a mistake - Escape won't be bound).
  1213.  
  1214. The learn feature has many uses:
  1215.  
  1216. Example 1:
  1217.  
  1218. Suppose you wanted to insert a tab at the beginning of a group of lines. One
  1219. way would be to use the indent region option. Another way however would be to
  1220. learn the sequence: TAB,DOWN,CLEFT and then press F1 a number of times.
  1221.  
  1222. Example 2:
  1223.  
  1224. Suppose you wanted to go to the next match of 'cat' and switch the case of
  1225. the letters. You could learn the sequence:
  1226.  
  1227.  ctrl-S C A T ESCAPE LEFT LEFT LEFT scS scS scS
  1228.  
  1229. and then press F1 a number of times.
  1230.  
  1231. Exercise (for the reader):
  1232.  
  1233. When editing this !Help file I decided to switch the columns labelled 'Key:'
  1234. and 'Command:' around in section A.1. I did this by learning a key sequence
  1235. and then I only had to press F1 once for each line. What was the sequence?
  1236. (no prizes unfortunately).
  1237.  
  1238. F.2 Tabs and indenting
  1239. ----------------------
  1240.  
  1241. The standard tab character is taken to be &09. You may alter this from the
  1242. 'Display.Tabs' menu. This menu also allows you to alter the appearance of
  1243. Tabs. The menu 'Misc.Tab mode' controls how tabs are entered when you press
  1244. the TAB key. In 'Unix' mode the character &09 is inserted. In '!Edit' mode,
  1245. the cursor moves to the column which starts the next word on the above line.
  1246. In coltab mode, the cursor moves forward 'n' characters where 'n' is the
  1247. current coltab width. In the latter two, as many tab characters as possible
  1248. are inserted. If you wish spaces only to be inserted, then tick the 'as
  1249. spaces' menu option. Use shift-TAB to switch between 'Unix' and '!Edit' tab
  1250. modes.
  1251.  
  1252. To indent a region, first select it and the use the 'Selection.Indent' menu
  1253. option (or Ctrl J). Type 'n' to indent by n spaces, '-n' to remove n spaces,
  1254. or type a string to indent by that string. To outdent a region use Ctrl H.
  1255. The region is outdented by the length of the current indent string (thus a
  1256. negative indent string will cause outdent to indent :-).
  1257.  
  1258. F.3 Fonts and font sizes
  1259. ------------------------
  1260.  
  1261. The font used in a Zap window is determined by the 'Display.Font' menu. The
  1262. first 3 items select the system font drawn in a number of different ways. The
  1263. first two use direct screen access and the latter uses the VDU drivers. The
  1264. cached system font may be updated by clicking on 'Options.Ctrlchars.Default'.
  1265.  
  1266. To use a font other than the system font select either the fourth or fifth
  1267. items. The fourth displays an anti-aliased font by direct screen access (and
  1268. thus uses quite a bit of memory) and the fifth via normal Font_Paint call.
  1269. The font name and size can be selected via the last two items. If you type in
  1270. a ludicrously large size, then weird things may happen!
  1271.  
  1272. To configure the font name and size, change variables &302 and &304 in the
  1273. keys file. You may also use variables &305/306/310/311 to shave off surplus
  1274. spacing around font characters. Fonts are monospaced.
  1275.  
  1276. When using the FAST FONT option, it should be noted that the font is only
  1277. cached in one set of anti aliased colours. These are taken to be the default
  1278. colours for text mode foreground and background. All other colours are drawn,
  1279. but not anti-aliased.
  1280.  
  1281. F.4 Universal arguments.
  1282. ------------------------
  1283.  
  1284. The universal argument feature enables you to execute a keypress an arbitrary
  1285. number of times. Suppose for example you wanted to insert 100 spaces. The
  1286. quick way to do this is to type:
  1287.  
  1288.     CTRL-U 100 SPACE
  1289.     
  1290. In general you type CTRL-U then the number of times you want the key to be
  1291. executed, then press Return, then press the key to execute. The 'pressing
  1292. Return' step can be omitted if the key you want to repeat is not delete or a
  1293. digit or another valid key for editing the number you are typing (as in the
  1294. example above).
  1295.  
  1296. F.5 The minibuffer
  1297. ------------------
  1298.  
  1299. Some Zap commands can take parameters. In order that these parameters can
  1300. be entered at run time, a minibuffer is provided. If you type a command into
  1301. the 'keys' file without specifying its parameter then, when you press that
  1302. key, the minibuffer opens. You should type in the command argument and then
  1303. press RETURN. Several examples keys are cESC,cS,cR,cW,F2.
  1304.  
  1305. Several control keys have default meanings in the minibuffer. These can not
  1306. at the moment be reconfigured, but are compatible with the Emacs minibuffer
  1307. keys:
  1308.  
  1309.     cA / cLeft    Move to start of line
  1310.     cB / Left    Move back a character
  1311.     cD / sDelete    Delete the next character
  1312.     cE / cRight    Move to end of line
  1313.     cF / Right    Move forward a character
  1314.     cG / Escape    Quit the minibuffer
  1315.     cK        Delete to end of line
  1316.     cU        Clear minibuffer
  1317.     TAB        Complete key (eg after F2, TAB will complete
  1318.             filenames)
  1319.     RETURN        Execute the command.
  1320.  
  1321. These keys can be redefined by commands, but should remain as consistent as
  1322. possible with the above.
  1323.  
  1324. *************************************************************************
  1325. * Section G:    How to find out more                    *
  1326. *************************************************************************
  1327.  
  1328. G.1 Other help files
  1329. --------------------
  1330.  
  1331. The 'Helpdata' file contains help for all the leaf windows, main windows, and
  1332. MENU entries. You can view this by using Acorn's !Help application, or just
  1333. by loading the text file. On RISC OS 2/3.0 you cannot get help on the menu
  1334. entries, only the windows (but you can just read the file directly).
  1335.  
  1336. The 'Docs.Commands' file gives a list of all currently defined Zap commands
  1337. and their syntax. These will be useful for turning keys into macros. For
  1338. example INSERT "Hello":RETURN. 
  1339.  
  1340. For those interested in writing an extension mode, or adding new commands, or
  1341. Zap's internal workings, please look in the Docs directory. You should start
  1342. with the file called ReadMe. This directory also contains a Zap keystrip in
  1343. the form of a Draw file.
  1344.  
  1345. Please see the file 'Changes' for my future plans for Zap.
  1346.  
  1347. G.2 Obtaining future versions of Zap
  1348. ------------------------------------
  1349.  
  1350. I will be sending any future versions (>1) of Zap to:
  1351.  
  1352. 1) Hensa: e-mail: archive-server@micros.hensa.ac.uk (send message 'help')
  1353.       ftp   : micros.hensa.ac.uk (IP 148.88.8.84)
  1354.  
  1355. (The Newcastle Info Server has unfortunately been closed down :-( ).
  1356.  
  1357. 2) The Archimedes Public Domain Library:
  1358.    39 Knighton Park Road
  1359.    Sydenham
  1360.    London
  1361.    SE26 5RN
  1362.    
  1363. Please look at the 'Changes' file for the anticipated release date.
  1364.  
  1365. G.3 Contacting me with suggestions/bugs
  1366. ---------------------------------------
  1367.  
  1368. Suggestions and bug reports are welcome. See the Copyright file for my
  1369. address (E-Mail preferred). Before sending suggestions please read the
  1370. 'Changes' file where I list the things currently on my 'wish list'. If you
  1371. find a bug then please give me as many details as possible as to the
  1372. circumstances that cause it - try and get it repeatable. If you have a
  1373. comment on a Zap extension mode not written by me then please write to the
  1374. author (see 3rdParty.ReadMe).
  1375.  
  1376. I hope you find Zap a useful program.
  1377.  
  1378. Dominic Symes
  1379. March 1994
  1380.