home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilsd / evntshell / Tools / !Shrink_PD / !Help_2-10 next >
Encoding:
Text File  |  1991-08-28  |  15.5 KB  |  425 lines

  1.           !BasShrink - a BASIC program compactor
  2.           ======================================
  3.  
  4.   The purpose of !BasShrink is to provide a simple method
  5. of squashing BASIC programs by the usual methods of
  6. shortening variable/procedure/function names, deleting
  7. blank lines, REMs and spaces and concatenating lines (ie
  8. joining them together!).
  9.  
  10.   The procedure to squash a BASIC program is then:
  11.  
  12. 1) Load !BasShrink if it is not already loaded.  It will
  13.     appear on the icon bar.
  14. 2) The main input window may be opened by clicking on the
  15.     icon on the icon-bar.
  16. 3) Drag the BASIC file either to the icon on the icon-bar
  17.     or to the main input window.  If the main data window
  18.     is not open then it will opened automatically.
  19. 4) Amend the options if necessary.
  20. 5) Amend the filename to save the squashed as and/or drag
  21.     the file to the destination directory, or just click
  22.     OK to overwrite the original program.
  23. 6) Wait while the program is squashed.
  24.  
  25. Notes for version 2
  26.  
  27.   i) The 'Multi-task' option is non-functional.
  28.  
  29. ----------------------------------------------------------
  30. OPTIONS
  31. -------
  32. c       : concatenate lines            : implemented
  33. l       : remove blank lines           : implemented fully
  34. -p <str>: don't shorten if start <str> : implemented fully
  35. r       : remove REM statements        : implemented fully
  36. *       : remove *| statements         : implemented fully
  37. s       : remove spaces                : implemented fully
  38. -v      : verbose                      : implemented
  39. A       : ASC("<char>") -> <number>    : implemented fully
  40. D       : affect DATA statements       : implemented fully
  41. F       : shorten function names       : implemented fully
  42. I       : represent integers shortest  : implemented fully
  43. M       : multi-task                   : not implemented
  44. P       : shorten procedure names      : implemented fully
  45. S       : SWI "<name>" -> SWI <number> : implemented fully
  46. V       : shorten variable names       : implemented fully
  47.  
  48. Saving the options
  49. ------------------
  50.   To save the current state of the options then click on
  51. the 'Save options' icon.  This will then be start up state
  52. when !BasShrink is next run.  It is possible to reset the
  53. options to the start up state by dragging the !Choices
  54. file onto the icon-bar icon or the main input window.
  55.   If the !Choices file is deleted then the default state
  56. as set up in the template file is used.
  57.  
  58. Concatenating lines
  59. -------------------
  60.   By default lines within a program are joined together
  61. wherever possible.  Exceptions include lines which are
  62. referenced by GOTO,GOSUB,etc. statements, DATA statements
  63. and comments.
  64.   Use -c to prevent lines from being concatenated.
  65.  
  66. Blank lines
  67. -----------
  68.   By default blank lines within a program (whether blank
  69. to begin with or becoming blank during shrinking) are
  70. removed.  The exception to this are those lines which are
  71. directly referenced in GOTO and RESTORE statements as a
  72. tokenised line number.
  73.   Use -l to prevent blank lines from being deleted.
  74.  
  75. Preserving names
  76. ----------------
  77.   Use -p followed by a string of characters which
  78. represents the start sequence of characters of variable/
  79. procedure/function names which are not to be shortened.
  80.   This is useful if you are using libraries and don't want
  81. names starting with '_Wimp', for example, being shortened
  82. as they reference variable names and procedure/function
  83. calls to those libraries.
  84. example: using -p _Wimp
  85.          10 PROC_Wimp_InitTask
  86.          20 PROC_MyInit
  87. becomes: 10 PROC_Wimp_InitTask
  88.          20 PROCA
  89.  
  90. REM statements
  91. --------------
  92.   By default a REM and all following text on that line is
  93. removed.
  94.   Use -r to prevent REM statements from being deleted.
  95.  
  96. *| statements
  97. -------------
  98.   These are the equivalent of a REM but for a star command
  99. instead.  By default a *| and all following text on that
  100. line is removed.
  101.   Use -* to prevent *| statements from being deleted.
  102.  
  103. Spaces
  104. ------
  105.   By default all unnecessary spaces within a line are
  106. removed.
  107.   Use -s to prevent spaces from being deleted.
  108.  
  109. Progress display
  110. ----------------
  111.   By default there is no output from !Shrink.  Use -v to
  112. switch the 'verbose' option on.  This displays the progess
  113. of the compaction on the BASIC file.  There are three
  114. passes, and on each pass the line number currently being
  115. processed is displayed.
  116.  
  117. Converting ASC("<char>") to a number
  118. ------------------------------------
  119.   By default whenever the token ASC occurs on a line, an
  120. attempt will be made to evaluate it.  !Shrink can handle
  121. both ASC"<char>" and ASC("<char>"), and if there is more
  122. than one character between the doubele quotes, then only
  123. the first character is used, the others being ignored.
  124.   Use -A to prevent the token ASC being evaluated.
  125. example: 10 space = ASC" "
  126. becomes: 10 space = 32
  127.  
  128. DATA statements
  129. ---------------
  130.   By default the text following a DATA keyword is treated
  131. as though it were on a 'normal' line, and is shrunk as
  132. dictated by the other options.  The exception to this is
  133. that on the first pass (when creating the name tables), no
  134. attempt will be made to parse the DATA line, so only names
  135. which occur on 'normal' lines and on the DATA line are
  136. shrunk (is requested), all other names are left as found.
  137.   Use -D to prevent the DATA line being affected.
  138. example: 10 var_names = 2
  139.          20 DATA var_names,"Fred",Jim
  140. becomes: 10 A = 2
  141.          20 DATA A,"Fred",Jim
  142.  
  143. Function names
  144. --------------
  145.   By default function names are shortened.
  146.   Use -F to prevent function names from being shortened.
  147.  
  148. Integers
  149. --------
  150.   By default any integer (binary, decimal or hex) numbers
  151. are converted to their shortest form.  This is done by
  152. representing numbers from 0 to 99999999 in decimal and
  153. numbers geater than 99999999 in hex.
  154.   Use -I to prevent integers from being converted.
  155. example: 10 big_number   = 199999999
  156.          20 small_number = &10
  157.          30 binary_value = %1111
  158. becomes: 10 big_number   = &BEBC1FF
  159.          20 small_number = 16
  160.          30 binary_value = 15
  161.  
  162. Procedure names
  163. ---------------
  164.   By default procedure names are shortened.
  165.   Use -P to prevent procedure names from being shortened.
  166.  
  167. Converting a swi "<name>" to a swi <number>
  168. -------------------------------------------
  169.   By default whenever the token SYS or the mnemonic SWI
  170. occurs on a line, and it is followed by a string, then the
  171. string is passed to OS_SWINumberFromString.  If valid, the
  172. string will be replaced by the relevant number.
  173.   Note that you may have to load in a module that contains
  174. swi's before using !BasShrink, so that all swi names are
  175. recognised.
  176.   Use -S to prevent the name being converted to a number.
  177. example: 10 SYS "OS_WriteN"
  178.          90 SWI "OS_WriteN"
  179. becomes: 10 SYS 70
  180.          90 SWI 70
  181.  
  182. Variable and register names
  183. ---------------------------
  184.   By default variable names are shortened.  This includes
  185. the shortening of register names within assembly language.
  186.   Use -V to prevent variable names from being shortened.
  187. example: 10 LogicState = TRUE
  188.          80 LDMFD R13!,{R0-R12,R14,PC}
  189. becomes: 10 A = TRUE
  190.          80 LDMFD 13!,{0-12,14,PC}
  191.  
  192. ----------------------------------------------------------
  193. HISTORY
  194. -------
  195. Version 0.21 : 10-Jul-91
  196.   What !BasShrink will do:
  197.  * Variable/FN/PROC names are shortened
  198.  * Blank lines are removed
  199.  * Preserving names using the -p <str> option
  200.  * REM and *| statements are removed
  201.  * Unnecessary spaces are removed
  202.  * Representing integers as their shortest form
  203.  
  204. Version 0.22 : 11-Jul-91
  205.   Bug fix: A blank line in a program (that's one with
  206. just a space on it) used to be interpreted incorrectly and
  207. a line of garbage put in its place.
  208.   Bug fix: Colons at the end of a line weren't removed.
  209.   Bug fix: Comments within assembly language were not 
  210. recognised.  They are now also removed if required.
  211.   Rewrite: The integer conversion routine now uses SWIs.
  212.  
  213.   Mike Harrison's basic cruncher seems to break the rules
  214. for the assignment of variable names.  He uses '`' as one
  215. of the characters, which is not documented in the User
  216. Guide on page 21.  This states that the rules for variable
  217. names are:
  218.  - There must be no space within the name
  219.  - They can contain digits and unaccented upper- and
  220.     lower-case letters
  221.  - An additional 'letter' is '_'
  222.  - They must not start with a digit
  223.  - They must not start with a BASIC keyword
  224. I will allow my code to recognise '`' as a legal character
  225. within a variable name, but I won't as yet use it as a
  226. character in my variable name assignments.  I may keep it
  227. as a special start or end character for use with variables
  228. used in assembly language.
  229.  
  230. Version 0.23 : 12-Jul-91
  231.   ARMcode: The function getName, giving a saving of
  232. approximately 5 seconds per pass.
  233.   Bug fix: The BASIC keyword ASC is now allowable inside
  234. assembly language.
  235.   Bug fix: in procedure addStringToLine which did not
  236. remove all unnecessary spaces.
  237.   Bug fix: Some comments were left in assembly language.
  238.  
  239. Version 0.24 : 12-Jul-91
  240.   Rewrite: Tidying up the code which shrinks the lines.
  241.   Bug fix: Spaces between two integer variable names are
  242. now properly.
  243.  
  244.   One thing which needs to be seen to is that inside
  245. assembly language there does not need to be a space
  246. between mnemonics and variable/register names or numbers.
  247.  
  248. Version 0.25 : 13-Jul-91
  249.   SWI name to number now works (are you happy now Mark!).
  250.   Bug fix: A bug was introduced earlier when decoding the
  251. 'ASC' keyword.
  252.  
  253. Version 0.26 : 15-Jul-91
  254.   ARMcode: The routine which builds up the short name from
  255. its index position.  This saves a few seconds, but nothing
  256. major (oh well, such is life!).
  257.   Rewrite: Tidying up the code dealing with variable names
  258. saving a bit of time and making the code more readable.
  259.   Problem: The routine which decodes ARM mnemonics needs
  260. to be totally rewritten as it can't cope with 'TEQ', as it
  261. reads the 'EQ' part as being the condition part of the
  262. instruction.
  263.  
  264. Version 0.27 : 16-Jul-91
  265.   As a fudge to the above problem, 'T' is considered as an
  266. instruction.  A rewrite is needed in a later version.
  267.   ARMcode: The routine which searches for a name in the
  268. linked list, giving a significant time saving, in the
  269. order of 25% (better than expected!).
  270.   Bug fix: If there was no terminating double quote then
  271. the error 'line too long' would occur.
  272.  
  273. Version 0.28 : 23-Jul-91
  274.   Bug fix: CHR$... would cause an error to be generated if
  275. found in assembly language.  Thanks to Mark for spotting
  276. that one.  It can now cope with many other 'valid' tokens
  277. within assembly language, such as AND, TRUE, NOT, etc.
  278.   Bug fix: Blank lines were be removed, even when the line
  279. number was referenced (ie by GOTO RESTORE GOSUB etc).
  280.  
  281. Version 0.29 : 23-Jul-91
  282.   ARMcode: More routines have been re-written in ARM code,
  283. namely adding a name and finding a line number.
  284.   Rewrite: Tidying up of the CASE statement for checking
  285. assembly language code has saved a lot of time.
  286.  
  287. Version 0.29a: 23-Jul-91
  288.   Rewrite: The routines which create the name tables.
  289.  
  290. Version 0.30 : 28-Jul-91
  291.   Bug fix: Decimal numbers which begin with a decimal
  292. point are now recognised properly.
  293.   Problem: Certain assembler mnemonics are not recognised,
  294. such as ORRS and EORS.  I've no idea what the problem is.
  295. The routine which decodes mnemonics is going to be
  296. rewritten anyway in a later version.
  297.   If the first line of the program being squished begins
  298. with a REM statement, then the string:
  299. ' ¤¤¤ Squished by Lofty's !Shrink vsn <vsn> on <date> ¤¤¤'
  300. is added to the end of that line.
  301.   The conversion of ASC"<char>" to the relevant number now
  302. works, in both lines of BASIC and assembly language.
  303.  
  304. Version 0.31 : 31-Jul-91
  305.   The option 'affect DATA' has been implemented.
  306.  
  307. Version 0.32 : 02-Aug-91
  308.   Update : The first line is only amended now if the line
  309. is a REM and does not already contain '¤¤¤...'.
  310.  
  311. Version 0.33 : 09-Aug-91
  312.   Bug fix: Tokens are now fully recognised within assembly
  313. language.
  314.   Rewrite: The routines which shorten lines, improving the
  315. overall performance of the program.
  316.  
  317. Version 0.34 : 10-Aug-91
  318.   Update : The first line is updated with '¤¤¤...', with
  319. the previous '¤¤¤...' being removed.
  320.  
  321. Version 0.35 : 12-Aug-91 (2.00)
  322.   Concatenation of lines now works.
  323.  
  324. Version 0.36 : 16-Aug-91 (2.01)
  325.   Bug fix: A DATA line could be added to the previous line
  326. during concatenation.
  327.   Update : A query box now pops up if the source file will
  328. be overwritten, asking for confirmation.
  329.   Rewrite: Most of the 'front-end' code.
  330.  
  331. Version 0.37 : 20-Aug-91 (2.02)
  332.   Rewrite: The routine which converts numbers to their
  333. shortest form.  It calculates all possible representations
  334. and chooses the shortest.
  335.   Update : The front-end now copes with most errors which
  336. are likely to occur.
  337.   Update : The !BasShrink small and normal icons have been
  338. decreased in height to conform to the Acorn standard.
  339.  
  340. 22-Aug-91
  341.   Update : The front-end 'Other Options' toggle works.
  342.  
  343. Version 0.38 : 24-Aug-91
  344.   Bug fix: A space is required after the mnemonic 'SWI'
  345. and before a following double quote.
  346.   Update : If there is not enough memory for the DIM then
  347. a more useful error message is generated.
  348.  
  349. Version 0.39 : 27-Aug-91 (2.03)
  350.   Bug fix: It's a forward slash '\' (not a backslash '/')
  351. which represents a comment in assembly language.
  352.   Update : r0,...,r15 and pc are now valid register names.
  353.   Feature: If 'shorten variables' is set then the register
  354. names r0,...,r15 and R0,...,R15 are shortened to 0,...,15.
  355.  
  356. Version 0.40 : 28-Aug-91 (2.10)
  357.   Feature: SWI "<name>" -> SWI <number> has been added.
  358.   Update : The front-end 'Save options' button works.
  359.  
  360. ----------------------------------------------------------
  361.  
  362. COPYRIGHT
  363. ---------
  364. !BasShrink designed and written by John 'Lofty' Wallace,
  365. with help from Mark Bright and Stuart Hickinbottom.
  366.  
  367. Version 1 of this program has been placed into the public
  368. domain.  It may be freely copied and distributed for non-
  369. profit making purposes (a small charge to cover cost of
  370. distribution is allowed, however), so long as the code is
  371. not altered (apart from customising !Run/!Boot files) and
  372. this text file remains present and unaltered.
  373.  
  374. The source code remains copyright © John Wallace and
  375. Architype Software, 1991.
  376.  
  377. Version 2 of !BasShrink, which allows concatenation of
  378. lines, is available at £5.00 (this includes the full
  379. source code).
  380.  
  381. Version 3 of !BasShrink will soon be available, which will
  382. multi-task under the desktop.  This will be £5.00, with a
  383. discount of £2.50 for version 2 owners.
  384.  
  385. Due to the continued development of !BasShrink, there will
  386. be new versions made available from time to time (for both
  387. version 2 and 3).  Registered users will be notified of
  388. major new releases and can receive the latest version by
  389. sending a formatted disc and a cheque for £1.00 (to cover
  390. adminstration and P&P costs).
  391.  
  392. End User Licence Conditions
  393. ---------------------------
  394.   'Software' refers to the source code for all versions of
  395. !BasShrink and related software.
  396.   'User' refers to the person who has purchased the
  397. software.
  398.   The conditions of use are:
  399.   1. Only the User may use the Software, and must not make
  400. the Software available to any third party by way of gift
  401. or loan or hire.
  402.   2. Sections of the Software can only be included within
  403. PUBLIC DOMAIN programs written by the User, and they must
  404. include in a readme file these End User Licence Conditions
  405. stating clearly which sections of the User's program the
  406. conditions covers (ie those taken from the Software).
  407.   3. If the User wishes to include sections of the
  408. Software in programs they wish to sell, permission must
  409. be sort from Architype Software (by writing to the address
  410. below) for a distribution licence.
  411.   4.  No liability will be accepted by John Wallace or
  412. Architype Software for the suitability of the Software for
  413. any purpose or for any loss due to the use or mis-use of
  414. the Software.
  415.  
  416. If you have any queries/suggestions then write to:
  417.  
  418. John Wallace
  419.  Architype Software
  420.   54 Parkes Hall Road
  421.    Woodsetton
  422.     Dudley
  423.      West Midlands
  424.       DY1 3SR
  425.