home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / utilities / zap / !Zap / 3rdParty / ZapMJEHelp < prev    next >
Encoding:
Text File  |  1994-06-06  |  20.3 KB  |  534 lines

  1. ZapMJE 0.56 help file
  2. © Martin Ebourne, 1994
  3.  
  4.                               -=-=-=-=-=-=-=-
  5. This software is COPYRIGHT, but has been released as FREEWARE. Please see the
  6. end of this file for conditions of use and distribution.
  7.                               -=-=-=-=-=-=-=-
  8.  
  9.  
  10.  
  11. Introduction
  12. ============
  13.  
  14. ZapMJE provides several new modes and various other extensions for the Zap
  15. text editor. In brief, these are:
  16.  
  17.   • C, Acorn Assembler and Pascal source editing modes
  18.   • Colour, compilation, indenting, bracket matching, function browsers,
  19.     next/last function, swap to header, auto header file generation, strip
  20.     spaces at end of lines on save, improved shift-left and right arrow
  21.     (previous and next word), tab type mode specific, auto mode detection,
  22.     and various commenting features for the new modes (not all features in
  23.     all modes)
  24.   • Support for using StrongHelp directly
  25.   • A command to enable keys to have different bindings for different modes
  26.   • A command to alter the current selection (the same as Edit's F6)
  27.  
  28. Please note that ZapMJE requires Zap version 1.08 or greater to work.
  29.  
  30.  
  31. Mode specific features
  32. ==== ======== ========
  33.  
  34. Colour
  35. ------
  36.  
  37. This is currently available in the C and assembler modes. Pascal will be
  38. implemented one day (when someone has told me or I have figured out the
  39. precise syntax). For C, the colours are as follows:
  40.  
  41.   Foreground  : Used for anything which doesn't classify below
  42.   Comments    : Anything in /* */
  43.   Strings     : Strings, character constants and include filenames
  44.                 (ie. anything in "", '' or, after a #include, <>)
  45.   Instructions: Reserved words (eg. switch, void)
  46.   Preprocessor: Anything on preprocessor lines not under any other category
  47.                 (including preprocessor keywords such as #define)
  48.   Functions   : Function name in definitions, calls and macros. Not however,
  49.                 when used as a pointer
  50.   Variables   : Any other user defined word, including parameter-less macros
  51.   Numbers     : Things like 6.5!
  52.  
  53. The assembler colours are:
  54.  
  55.   Foreground  : Used for anything which doesn't classify below
  56.   Comments    : Anything after ;
  57.   Strings     : Strings and character constants (ie. anything in "" or '')
  58.   Instructions: Anything in the instruction field (first section of line
  59.                 following whitespace), plus anything else which is part of
  60.                 the instruction (eg. {, }, !). Also instruction shifts
  61.                 (eg. ASL)
  62.   Operators   : Assembler expression operators (eg. :SHL:)
  63.   Labels      : Anything in the label field (text at very start of line)
  64.   Names       : Any user defined words in the parameters of an instruction
  65.   Numbers     : Things like 2_1101
  66.  
  67. Colouring is automatic, and if you want to switch it off you will have to set
  68. all the foreground colours the same. A problem you are bound to have is
  69. finding enough usable colours to display. In C they are best as all
  70. different (in assembler some of them are very closely related and hence are
  71. best coloured the same), but unfortunately there are only 5 usable colours in
  72. the normal Wimp palette. Hence the defaults include some grey ones. I
  73. recommend you re-define the colours in the palette to make them usable if you
  74. intend to use it seriously.
  75.  
  76. Please note that the colouring is defined to colour CORRECT source code
  77. correctly. What it does with incorrect source is arbitrary since then even
  78. the compiler/assembler will not accept it and it is hence not source code.
  79.  
  80.  
  81. Compilation
  82. -----------
  83.  
  84. This is very powerful and is designed to cater for every situation. The way
  85. it operates is as follows (in order):
  86.  
  87. 1. Look for sourcefile.^.^.MakeFile (standard name and location for a
  88. makefile)
  89.  
  90. 2. If it is type Text (FFF) or Makefile (FE1) then pass it round as a message
  91. Data Open for either Make or AMU to pick up on. Note that it is passed round
  92. as type FE1 regardless of whether it is Text or not. This is because a lot of
  93. makefiles are typed to Text, and Make and AMU will not pick these up (but Zap
  94. will!). Also note that for AMU to intercept this message, it needs a
  95. 'filetype &FE1;' line inserted into the top section of the description file.
  96.  
  97. 3. If no task claims the message then amu is invoked from the command line in
  98. a task window. The default amu options used are '-desktop -k'. The taskwindow
  99. options used are '-display -quit'.
  100.  
  101. 4. If sourcefile.^.^.MakeFile file is not of type Text or Makefile, then it
  102. is run using Wimp_StartTask. This allows for obey files and the like to be
  103. used, giving absolute flexibility.
  104.  
  105. 5. If sourcefile.^.^.MakeFile file does not exist, then the source file is
  106. compiled/assembled direct. It cannot be passed round as a Wimp message
  107. because it is text, and so cannot be claimed by CC or whatever. Thus it is
  108. compiled/assembled in a task window along the same lines as amu if invoked
  109. above. The options used depend on the mode and are as follows:
  110.  
  111.   C      - '-IC: -throwback -LC:o.RISC_OSlib,C:o.stubs -Desktop ^'
  112.   Asm    - Assembly does not work at the moment. Makefiles are still ok
  113.            though
  114.   Pascal - '-ranprv -LC:o.Stubs -throwback -desktop ^'
  115.  
  116. 6. There is one last feature to ensure 100% flexibility. If the characters
  117. '/*+ ', ';+ ' or '(*+ ' (depending on mode) are found within the first 1k of
  118. the source file when invoking amu or compilation/assembly directly in a task
  119. window, then the following characters until the next close comment or end
  120. of line are used INSTEAD of the default options string. This means that if
  121. you don't like the default options, you can supply your own. (For instance,
  122. if you include extra libraries or want debug code generated.)
  123.  
  124. Note that the maximum length for the command issued is 256 characters,
  125. including the filename, commands and the various options. Also, NO
  126. translation is carried out in copying the options. However, when calling
  127. *TaskWindow, the command is placed in quotes - so if any were required in the
  128. options string they would have to be doubled up originally.
  129.  
  130.  
  131. There are two commands to invoke compilation; COMPILE which saves and then
  132. compiles (assuming the save was ok), and RUN which compiles without saving
  133. the current file. (These correspond to the equivalent BASIC commands.)
  134.  
  135.  
  136. Indenting
  137. ---------
  138.  
  139. This is currently only present in the C mode, and simply puts the requested
  140. number of extra spaces onto the indent for the line following a {, and
  141. aligns }s up with the corresponding {. The indent is set via the C mode
  142. menu, and should have the value 0 to disable the feature.
  143.  
  144.  
  145. Bracket matching
  146. ------- --------
  147.  
  148. Currently only the 'as you type' matching is implemented and then only in the
  149. C mode. When you type a close bracket (either ), } or ]) the cursor will jump
  150. to the corresponding open bracket for the time specified in the pause entry
  151. in the C mode menu (in centiseconds). The pause will be truncated if you
  152. carry on typing. To disable it, set the pause to 0 centiseconds.
  153.  
  154.  
  155. Function browsers
  156. -------- --------
  157.  
  158. This feature works on all three modes, and simply provides a browser of all
  159. the function definitions in the source file. C mode correctly copes with old
  160. and new style function definitions, as well as contrived statements such as:
  161.  
  162. #ifdef __STDC__
  163. int wibble(int wobble)
  164. #else
  165. int wibble(wobble)
  166. int wobble;
  167. #endif
  168. {
  169.   ...
  170.  
  171. which are designed to work under both pcc and ANSI compilers. Assembler mode
  172. simply lists all the lines on which labels are defined. This feature is
  173. invoked with the standard command LISTFNS.
  174.  
  175.  
  176. Next/last function
  177. ---- ---- --------
  178.  
  179. These work in the same way as the function browser, but place the cursor at
  180. the definition of the next or previous function in the source file. They are
  181. invoked with MJE_NEXTFUNC and MJE_LASTFUNC respectively.
  182.  
  183.  
  184. Swap to header
  185. ---- -- ------
  186.  
  187. This moves the input focus onto the corresponding header/source file (ie.
  188. with the same leafname) for the current source/header file (assuming one
  189. exists). It also loads the file if necessary. The corresponding header file
  190. is of the form sourcefile.^.^.h.sourcefile, and the corresponding sourcefile
  191. is of the form headerfile.^.^.x.headerfile where x is c, s or p depending on
  192. mode. This feature is invoked with MJE_SWAPTOHEADER.
  193.  
  194.  
  195. Auto header file generation
  196. ---- ------ ---- ----------
  197.  
  198. This is only in its simple stages at the moment, but on executing
  199. MJE_GENERATEHEADER (C mode only), function prototypes will automatically be
  200. generated and appended to the respective header file (see MJE_SWAPTOHEADER).
  201. The prototypes are appended immediately after the first occurrence of the
  202. sequence '/* Auto */', deleting everything following it. If the sequence is
  203. not found in the file, then it will be appended along with the prototypes.
  204.  
  205. Currently this only deals with functions, but variables will be included at a
  206. later date. Note also that if the header file does not exist, one will NOT be
  207. created. This is done deliberately so that you can't accidentally generate
  208. unwanted header files.
  209.  
  210.  
  211. Excess space removal
  212. ------ ----- -------
  213.  
  214. This automatically occurs on saving the file, and simply removes any excess
  215. whitespace on the ends of lines. These serve no purpose other than to waste
  216. memory and slow things down, and since they are easily generated with the
  217. auto-indentation, it needs some way of easy removal. This is present only as
  218. a stop-gap until Zap supports it properly.
  219.  
  220.  
  221. Previous and next word
  222. -------- --- ---- ----
  223.  
  224. The previous and next word commands (shift-left & shift-right) of Zap are
  225. intended for use when text editing, and as such only stop after whitespace or
  226. parentheses. This is fine for text, but totally unsuitable for program
  227. editing unless you are liberal with your spaces (I'm not). For instance,
  228. previous/next word would jump right over 'whatever=this+that/something_else;'
  229. which is not very useful. For that reason all three of the extra modes have a
  230. much more powerful implementation as standard. It can be thought of as
  231. working like this:
  232.  
  233. There are 5 categories of character, classified in descending order as:
  234.  
  235.   5: Newline character
  236.   4: Letters and numbers
  237.   3: Anything else non-whitespace (ie. symbols)
  238.   2: Whitespace (space and tab)
  239.   1: Newline character
  240.  
  241. When you press shift-left or shift-right, the cursor will be moved in that
  242. direction until the classification of the next character (in the direction it
  243. is moving) is greater than that of the current character, upon which it will
  244. stop. Newline appears twice in order to ensure that the cursor will always
  245. stop on each side of it. (ie. at start & end of line).
  246.  
  247. This probably sounds quite complicated, but it is in actual fact very easy,
  248. and very intuitive to use. As an example, these are the points that the
  249. cursor would stop at:
  250.  
  251. Line:  if((char2=getchar())!=0 && char2!=line_terminator)
  252. Fwd :  ^   ^     ^           ^ ^  ^      ^    ^          ^
  253. Back:^   ^      ^       ^     ^  ^     ^     ^          ^
  254.  
  255.  
  256. Tab type mode specific
  257. --- ---- ---- --------
  258.  
  259. A problem with Zap which should be fixed soon is that not enough options are
  260. mode specific. eg. tab type. This is bound to be different for different
  261. modes (eg. column/Unix tab in assembler, Edit tab in C), so these modes
  262. support it as mode specific. Normally this will be fine, but you may notice
  263. that if you switch from text to one of these modes and back to text, the tab
  264. type will have changed. This is because text does not have a setting for it.
  265.  
  266.  
  267. Auto mode detection
  268. ---- ---- ---------
  269.  
  270. This is hopefully only temporary, and is provided so that header files are
  271. loaded into the correct mode. Currently Zap can only detect mode on filetype
  272. and file name. However, header files have type text and are in a h directory,
  273. but they can be any of the three modes. Thus if header files are set to C,
  274. then on loading if an assembler or Pascal comment is found as the first
  275. non-whitespace character in the file, the appropriate mode will be used
  276. instead.
  277.  
  278.  
  279. Various commenting features
  280. ------- ---------- --------
  281.  
  282. These all work in all three modes and are:
  283.  
  284. MJE_OPENCOMMENT
  285.   This inserts the appropriate open comment text (ie. '/* ', '; ' or '(* ').
  286.  
  287. MJE_CLOSECOMMENT
  288.   Inserts appropriate close comment (' */' or ' *)' [none for assembler]).
  289.  
  290. MJE_IF
  291.   Inserts 'pre-processor comment'. ie. uses conditional compilation/assembly
  292. to effectively comment out the stuff ahead.. (Handy if there are comments
  293. around, since you can't nest them in C). Inserts '#if 0\n' or ' [ 1=0\n'
  294. depending on mode.
  295.  
  296. MJE_ENDIF
  297.   Finishes 'pre-processor comment'. (ie. inserts '#endif\n' or ' ]\n'.)
  298.  
  299. MJE_COMMENTLINE
  300.   Comments out line and moves onto next. (ie. inserts '/* ' & ' */', '; ', or
  301. '(* ' & ' *)' at start and end of line.)
  302.  
  303. MJE_UNCOMMENTLINE
  304.   Reverses above. (ie. removes '/* ' & ' */', '; ' or '(* ' & ' *)' if
  305. present and moves onto next line)
  306.  
  307.  
  308. Non-standard option
  309. --- -------- ------
  310.  
  311. This will not be very useful to many people, except if they lay their
  312. assembler source out the same way as I do. Basically, if enabled then on
  313. pressing tab you will be advanced to the next 'source column' rather than tab
  314. stop. It only works sensibly with Unix or column tab, and the 'source
  315. columns' are laid out as follows (using Unix tab):
  316.  
  317. Label ->------->Ins --->Operands ------>------->------->Comment
  318.  
  319. (ie. 2, 1 and 4 tab stops)
  320.  
  321. If your source looks like that, then try it, you might like it. If it doesn't
  322. then don't switch it on and no harm done. The only reason it is in there is
  323. because it is easier than disabling it for release. Also, Dominic wanted me
  324. to use the non-standard option in order to justify its existence. I bet he'll
  325. remove it now just to spite me. ;-) This feature is probably only a stop-gap
  326. until Zap supports variable tab stops properly.
  327.  
  328.  
  329.  
  330. Help commands
  331. ==== ========
  332.  
  333. These work in all modes (except tokenised BASIC at the moment).
  334. Together, they provide a more comprehensive interface to StrongHelp than
  335. StrongEd does. :-)
  336.  
  337.  
  338. Context sensitive
  339. ------- ---------
  340.  
  341. This provides help on whatever is by the cursor. Currently it only works if
  342. the cursor is on text of some description, but it is subject to improvement
  343. when I have time. It is invoked with the command
  344. MJE_HELPCONTEXT.
  345.  
  346.  
  347. Previous
  348. --------
  349.  
  350. This doesn't work at the moment, though it will do one day. MJE_HELPLAST is
  351. the command, and it will re-produce the last x previous help screens going
  352. back up a stack. (This is more for the native system.)
  353.  
  354.  
  355. Topic/keyword
  356. ----- -------
  357.  
  358. This has 3 modes of operation:
  359.  
  360. The command MJE_HELPTOPIC "text" will look for help on the keyword text. This
  361. is handy to have keys for a main menu, etc.
  362.  
  363. The command MJE_HELPTOPIC with no parameter will search for help on whatever
  364. is selected, assuming it is in the current window and not too long. (This
  365. allows help on words with symbols in, which MJE_HELPCONTEXT would discard as
  366. irrelevant.)
  367.  
  368. If it still hasn't worked out what to search for, a minibuffer will be opened
  369. for you to type in the appropriate topic.
  370.  
  371.  
  372.  
  373. General features
  374. ======= ========
  375.  
  376. MJE_IFMODE
  377. ----------
  378.  
  379. This enables you to use keys for different functions in different modes, or
  380. more normally, provide the same function in several modes where one or more
  381. of them doesn't check the mode before performing the function. eg. A mapping
  382. for next function could be:
  383.  
  384. MJE_NEXTFUNC:MJE_IFMODE "7:C_NEXT_FUNCTION"
  385.  
  386. This is needed because the C_NEXT_FUNCTION command executes regardless of
  387. mode and would thus mess things up in any of the other modes.
  388.  
  389. The syntax is:
  390.  
  391. MJE_IFMODE "Modelist:Commands"
  392.  
  393. Modelist is a comma separated list of mode numbers for which the commands are
  394. to execute in. You can also use a hyphen for ranges. eg. "1,3-5,7:..." No
  395. other characters, not even spaces are allowed before the colon, apart from
  396. the option of a ! immediately before it. This has the effect of negating
  397. the condition. eg. "0,2,6,8-255!:" is the same as the previous example.
  398.  
  399. Commands is a list of commands in the normal way.
  400.  
  401.  
  402. MJE_ALTERSEL
  403. ------------
  404.  
  405. This works in the same way as Edit's F6. If there is no selection, the
  406. character after the cursor is selected, else the operation is equivalent to
  407. clicking adjust with the mouse. This is very handy if you select something
  408. with the keyboard but get it slightly wrong - it saves you re-selecting the
  409. whole lot. Another essential use is to select a line/several lines with the
  410. following command sequence:
  411.  
  412. CLEFT:MJE_ALTERSEL:CRIGHT:DOWN:CLEFT:MJE_ALTERSEL
  413.  
  414.  
  415.  
  416. Copyright
  417. =========
  418.  
  419. The conditions of copying this program and its associated documentation are
  420. the same as those of the main Zap application, except you do not need my
  421. permission to copy it if you have Dominic's.
  422.  
  423. This software is provided as is with no warranty as to its suitability or
  424. otherwise for any particular task. If it does anything nasty then I want to
  425. know so I can fix it, but I'm not taking any responsibility. (Besides,
  426. there's no point in suing me since I've got no money.)
  427.  
  428. Non-release versions of this module (identify themselves as test versions on
  429. *Help ZapMJE) are *NOT* distributable without my express permission. They are
  430. also more likely to fall over. ;-) [Note that such versions have various bits
  431. of debugging code included, and will not work on RISC OS 2 due to the use of
  432. pipes for debugging. They might also do other strange (intended) things.]
  433.  
  434. Please note that I reserve the right to make alterations to this program, its
  435. operation, documentation, and/or conditions of use without notice in any way
  436. I see fit. Hopefully it will be an improvement.
  437.  
  438.  
  439. Acknowledgements
  440. ================
  441.  
  442. Thanks to Dominic for writing Zap and not even charging for it! (Though he's
  443. partly responsible for a rather large amount of damage to my 'phone bill.
  444. :-()
  445.  
  446. Thanks to Brian Scattergood for writing his Cmode which this originally came
  447. from - it made initial development a lot easier (although I did have to hack
  448. it first :-]). There's even some original (slightly modified) code left!
  449. (Most of the stuff which is C mode only.) This will have to be replaced in
  450. the course of making it work on all modes sooner or later. :-(
  451.  
  452. Thanks to Mercury for not charging quite as much as BT. (It means I'm just
  453. broke rather than completely bankrupt. :-]  Correction: It means it took me
  454. very slightly longer to become completely bankrupt.)
  455.  
  456.  
  457. Contacting
  458. ==========
  459.  
  460. I can be contacted through email to mje@soton.ac.uk all year round (faster
  461. response time during term). Alternatively, snail to:
  462.  
  463. Martin Ebourne,
  464. 1 Malvern Road
  465. Acocks Green
  466. Birmingham
  467. B27 6EG
  468.  
  469. I can also be contacted on Arcade, though only through private messages since
  470. I hardly ever read the public ones. (It's bad enough trying to keep up with
  471. Usenet/NetNews, and that's free!) A much faster response by modem can be
  472. obtained by calling Challenger on 021 445 3913 [user #3]. 24hr; V21, V22,
  473. V22bis, V23, V32, V32bis, with MNP1-5, V42 or V42bis; 7E1. Oh, and it's
  474. Viewdata. :-)
  475.  
  476. Please let me know of any bugs or undocumented features if you ever find any
  477. (and they aren't listed at the end of the file - that's the hard bit!). Also,
  478. ideas for improvement are welcome. A few of my current ideas are:
  479.  
  480.   • Completely re-written and vastly superior indenting code
  481.   • A really cool native help system of which the details are secret at the
  482.     moment... ;-) If you've got any ideas for it however, then now's the time
  483.     to let me have them
  484.   • A pretty nifty selection mechanism for C & Pascal (possibly even
  485.     assembler)
  486.   • Colour redraw for Pascal
  487.   • Bracket matching correctly on all modes
  488.   • Remove any features which aren't listed in this help file
  489.  
  490. If anybody wants to help me pay off some of the 'phone bill this module has
  491. incurred, then all donations are gratefully accepted at the address above.
  492. (Well you can't blame me for trying, can you!)
  493.  
  494.  
  495. Known mis-features
  496. ===== === ========
  497.  
  498. (These are just the important ones :-()
  499.  
  500. Assembler:
  501.  
  502.   • Assembling with no make file doesn't work
  503.   • Function finding cheats (uses search)
  504.  
  505. C:
  506.  
  507.   • Auto header generation is very basic (yes, it's intentional!)
  508.   • The syntax colouring is slow with large files and multiple views of the
  509.     same file, but then when constructs such as:
  510.     #inc\
  511.     lude /* *\
  512.     / <std\
  513.     io.h>
  514.     are valid (try it, it works!), its hardly surprising. However, this will
  515.     be improved in later versions.
  516.   • Problems with function finding:
  517.     1) Preprocessor # not at start of line not recognised
  518.     2) foo () isn't found
  519.     3) It doesn't cope with \ outside of preprocessor
  520.     These 'bugs' are due to me not knowing precisely how the C syntax worked
  521.     when I wrote it. Unfortunately, the deadline has been very tight & it's
  522.     been close to get the colouring work, let alone the function finding
  523.   • There are a multitude of bugs in the colouring, but I bet you won't find
  524.     many! :-)
  525.  
  526. Pascal:
  527.  
  528.   • Function finding cheats (like assembler)
  529.  
  530. Miscellaneous:
  531.  
  532.   • This is Zap's fault, but swap to header doesn't load file into correct
  533.     mode
  534.