home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / sharew / exoten / rec / cnvadv.hlp < prev    next >
Encoding:
Text File  |  1990-10-24  |  48.6 KB  |  1,099 lines

  1. Introduction.
  2. Patterns.
  3. Subroutine Groups.
  4. Conditional Skeletons.
  5. Iterative Skeletons.
  6. The "Same" Skeleton <=>.
  7. The (REC/.../) pattern and skeleton.
  8. Memory buffer, array and stack operations.
  9. Disk system and return to MS-DOS functions.
  10. Arithmetic Skeletons.
  11. Character "Arithmetic".
  12. Overlays.
  13. Priority Queues (Heaps).
  14. Skeletons for graphics and video control.
  15. Error messages.
  16. :Introduction.
  17.  
  18. This Help file describes advanced CNVRT features as well as additions and 
  19. changes made to the compiler after CNVPRG.HLP was prepared.  Among the most
  20. noteworthy changes the following may be mentioned:
  21.  
  22.     - Full functionality for pattern definitions and the Boolean
  23.       combinations OR and AND.
  24.  
  25.     - Generalization of skeletons if, nf, while and until.
  26.  
  27.     - Generalization of pattern <[n]>.
  28.  
  29.     - Inclusion of evaluation of general arithmetic expressions whose 
  30.       operands are constants (including floating point).
  31.  
  32.     - Acceptance of any functional skeleton as a pattern.
  33.  
  34. Many of the programs in CNVPRG.HLP and CNVRT.HLP may be written in a more
  35. compact form using some of the features described herein.
  36.  
  37. :Patterns
  38.  
  39. References to defined patterns and the Boolean OR now perform as expected, so
  40. that programs such as the following give results consistent with the formal
  41. definition of Convert:
  42.  
  43.     ((    ((OR,[<:e:>],<(><:e:><)>,[<0>],<(><0><)>)) e
  44.     )()(0)(    
  45.         ((^Z),);
  46.         (<:e:><0>,(%t, yes)(%r)):
  47.         (,(%t, no)(%r)):
  48.     ))
  49.     [end]
  50.  
  51. This programs answers "yes" if it finds the same string inside and to the
  52. right of a nest of possibly alternated parentheses and brackets and types "no"
  53. otherwise.  For example, ([[([(ab)])]])ab produces "yes", (b)c gives "no".
  54.  
  55. Making this program work requires that pattern <:e:> "know" what follows it
  56. at the place where it is referenced; this issue has been resolved, so that if
  57. pattern <0> in the second rule fails, the next alternative in the OR is tried
  58. out.
  59.  
  60. The effect on compiled programs, of having defined patterns check the patterns
  61. that follow references to them (in the example, that "e" take into account <0>
  62. in the concatenation <:e:><0>) is an object file requiring up to about 20%
  63. more space, so that CONVERT.REC allows selection of the type of treatment
  64. desired in the compilation of defined pattern references by a flag appended
  65. to the source file name in the command line tail; if no flag appears or is /s
  66. or /S, the code produced is simpler but less general.  A slash followed by
  67. anything other than an s or S indicates full treatment should be given.  For
  68. example, if the above example is placed in a file TEST.CNV, when compiling it
  69. with the command line
  70.  
  71.         REC86 CONVERT TEST/L
  72.  
  73. the program obtained would recognize the string [([ab])][ab], whereas the line
  74.  
  75.         REC86 CONVERT TEST
  76.  
  77. would result in a program in which <:e:><0> would not match that string
  78. (although it would match some simpler strings such as [([ab])]ab).
  79.  
  80. The default is the shorter compilation because most applications to date have
  81. only used simple pattern definitions not requiring the general treatment.
  82.  
  83. The other question now resolved is that of AND.  Consider a concatenation
  84. (AND,p1,...,pn)p, in which it could happen that there is more than one way in
  85. which the concatenation of p1 and p may match the text and that it may not be
  86. necessarily the first alternative (which would have p1 matching the shortest
  87. possible text) the one for which p2, ..., pn match the same text as p1.  In
  88. this case, one requires that if pi fails (i>1), a different way to match p1
  89. and p to the text be sought.  This is necessary even if p is the null, for
  90. consider the following patterns:
  91.  
  92.         (AND,<0>;,<1>ab;)
  93.  
  94.         (and,<0>;,<1>ab;)
  95.  
  96. The first one matches any text containing the substring "ab;"; the second
  97. matches only if no semicolon precedes the first occurrence of "ab;" because <0>
  98. will match the shortest substring left of a semicolon; for instance, the first
  99. pattern maches x;y;ab;z, whereas the second does not.  Notice however that
  100. (and,<1>ab;,<0>;) has the same effect as the AND shown above, illustrating the
  101. convenience of always analyzing the possibility of expressing the desired
  102. pattern in terms of (and,...) and (or,...), which produce less code and are
  103. less time-consuming.
  104.  
  105.  
  106. The length pattern <[n]> admits in place of n any skeleton.  The pattern will
  107. fail to match if the skeleton doesn't evaluate to a string of ASCII decimal
  108. digits, or if the skeleton does evaluate to such a string but there aren't
  109. that many characters in the text under scrutiny.  Some posibilities now
  110. allowed by this pattern are:
  111.  
  112.     <[128]>        A constant skeleton: its original definition.
  113.     <[<0>]>        A variable, which should be already bound to a 
  114.             string of ASCII digits.
  115.     <[(&!,<0>)]>    The length of the value of a variable.
  116.     <[(#f,2*<0>+1)]>    Twice the value of a variable, plus one 
  117.                 (the value of the variable here could be
  118.                 a string of ASCII digits or an arithmetic
  119.                 expression whose operands are integer
  120.                 constants).
  121.  
  122. Assuming <0> is bound to the two-digit string "32", the second pattern will
  123. match a 32-byte string, the third pattern will match a 2-byte string and the
  124. last pattern will match a string of 65 characters.  If the value of <0> is
  125. abc, the second and fourth patterns will fail, while the third one will match
  126. a 3-byte string.
  127.  
  128.  
  129. A variant on <[n]> has also been introduced: <[-n]>, where n is a string of
  130. decimal digits, or <[s]>, where s is a skeleton evaluating to a string of
  131. digits preceded by a minus sign matches all of the remaining text BUT the
  132. last n characters.  Reversing a string may now be non-recursively expressed
  133. using <[-1]> and a WHILE skeleton:
  134.  
  135.         (WHILE,(0 1),...,(and,<[-1]>,<0>)<1>,<1>,<0>)
  136.  
  137. where ... represents the string to be reversed.
  138.  
  139. Any functional, conditional or iterative skeleton may appear wherever a
  140. pattern is allowed.  A skeleton such as (a,<0>:k), (%r), (if,<0>,(^Z),<1>)
  141. or (until,(%r),(^Z),<=>,(%r),), when appearing on the pattern side of a rule
  142. or within a defined pattern, will have the same effect as if a constant 
  143. pattern equal to the value of the skeleton were present in its place.  
  144. Variables used within such skeletons must have been previously bound.
  145.  
  146. :Subroutine Groups.
  147. Since CNVRT inherits REC's features as regards the grouping of subroutines,
  148. groups of defined patterns, defined skeletons and whole programs may be built.
  149.  
  150. The following example shows a defined pattern group:
  151.  
  152.     { ((IVL,0,9)) d  (<:d:>(ITR,<:d:>)) i  ((or,+,-,)<:i:>) I
  153.       ((or,<:i:>.<:i:>,.<:i:>,<:i:>.)) r
  154.       ((or,<:i:>E<:I:>,<:r:>(or,E<:I:>,))) R
  155.       (<:@:>) } K
  156.  
  157. Notice that the main routine of the group must consist only of <:@:>. In this 
  158. example, d matches a decimal digit, i a decimal integer, I an optionally
  159. signed integer, r a decimal number with explicit point and R a general real
  160. constant in the fashion of FORTRAN.  External references to these patterns
  161. are accomplished by writing <:Kd:>, <:Ki:>, <:KI:>, <:Kr:>, and <:KR:>,
  162. respectively.  A reference to the main routine by itself (e.g., <:K:>) is
  163. meaningless and therefore not to be used, and references from within the group
  164. to definitions in the same group need not have the group name, as illustrated
  165. in the example. If no external access is desired to d, i, I or r, R could be
  166. the main program (removing the last line and placing the right brace before
  167. the R); in this case the only valid external reference would be <:R:>.
  168.  
  169. The next example shows a defined skeleton group:
  170.  
  171.     { ((%V,MEM:ll,<=>)) G
  172.       ((%V,MEM:sy,<=>)) Y
  173.       ((@)) } F
  174.  
  175. The main routine of the group must consist only of a reference to the
  176. "skeleton" @.  Outside references to G and Y may take any of the following
  177. forms:  (FG,s), (FG), (FY,s) or (FY), where s is a skeleton whose value will
  178. be passed as an argument to the corresponding skeleton in group F.  (FG) and 
  179. (FY) deliver a null argument to G and Y, respectively.  As with patterns,
  180. groups may be defined in which the main program is not (@), in which case
  181. outside access would only be allowed to the main program of the group,
  182. referenced by its one byte name.
  183.  
  184. Finally, program groups may also be formed:
  185.  
  186.     { (()()()()) a       (()()()()) b      (()()()()) } A
  187.  
  188. In this case, subroutines a and b are not directly available from outside
  189. the braces, but can only be called mutually and recursively, from the main
  190. program (A) and from any subroutine called from within this same group.
  191.  
  192. :Conditional skeletons.
  193.  
  194. Four conditional skeletons are provided: IF, NF, if and nf.  IF and NF require
  195. a variable list to be given, if and nf do not.  Their general forms are the
  196. following:
  197.  
  198.     (IF,(v),s0{,pj,sjt,sj}[,pF,sFt])
  199.     (if,s0{,pj,sjt,sj}[,pF,sFt])
  200.     (NF,(v),s0{,pj,sjt,sj}[,pF,sFt])
  201.     (nf,s0{,pj,sjt,sj}[,pF,sFt])
  202.  
  203. where v is list of variables (zero or more integers between 0 and 30 with one
  204. space between each pair of variables), the s's are skeletons and the p's are
  205. patterns; braces indicate 0 or more instances of the enclosed list and
  206. brackets indicate 0 or 1 instances of their contents. In IF and NF, the (v)
  207. list creates new instances of the listed variables after s0 has been evaluated;
  208. these instances persist during the execution of the IF or NF and disappear
  209. upon termination.  Otherwise, IF and NF execute like if and nf, respectively.
  210.  
  211.     The next panels describe the operation of if and nf; we repeat 
  212. the form of the corresponding skeleton for ease of reference.
  213.  
  214.  
  215.     (if,s0{,pj,sjt,sj}[,pF,sFt])
  216.  
  217. Skeleton s0 is evaluated and matched to the first pattern, p1.  If they match,
  218. s1t is evaluated and its value becomes the value of the entire skeleton; if
  219. the match fails s1 is evaluated and matched to p2.  This continues until a
  220. match obtains between some sk and p(k+1), in which case the result is s(k+1)t,
  221. or there are no more comparisons to be made, in which case the last skeleton
  222. evaluated for a comparison is left as the result.  In particular, if pF and
  223. sFt appear and pF does not match the last sk, the value of if is that of sk.
  224. The conditional skeleton
  225.  
  226.     (if,(%r),(^Z),<=>(%t,End of file encountered),(%T,<=>))
  227.  
  228. reads a line from the default file; if it finds and end-of-file marker
  229. (control-Z), it leaves it but types the message "End of file encountered"
  230. (the value of %t is the null string); otherwise, it leaves the line read by 
  231. (%r) after typing it.
  232.  
  233. The use of more than one triple [,p,st,s] allows constructs of the "elseif"
  234. type within a single (if,...).
  235.  
  236.  
  237.  
  238.     (nf,s0{,pj,sjt,sj}[,pF,sFt])
  239.  
  240. NF and nf are the negative forms of IF and if, repectively; that is, if s0
  241. does NOT match p1, s1t is substituted, else if s1 does not match p2, s2t is
  242. substituted, etc.  If each sk matches p(k+1), (k=0,...,n and pF=p(n+1)), sn
  243. is left as the result (This includes the case in which pF and sFt are present.)
  244.  
  245. Alternatively, "nf" may be read as "unless":  Unless s0 matches p1, s1t is 
  246. evaluated and delivered as the result, else unless s1 matches p2, s2t is
  247. given as the result, etc.
  248.  
  249. A useful example follows:
  250.  
  251.         (nf,(%Or),Not Found,(a,(%r)))
  252.  
  253. This skeleton will call function a, with argument equal to the first line of 
  254. the default file only if it is possible to open the default file for reading.
  255. Variants of this example include giving arguments to the %Or and %r 
  256. functions.  Notice that if the value of (%Or) is "Not Found", this string
  257. will be left as the value of the nf skeleton since no skeleton follows sFt.
  258.  
  259. :Iterative skeletons.
  260.  
  261. Four iterative skeletons are provided: WHILE, UNTIL, while and until. WHILE
  262. and UNTIL require a variable list to be given, while and until do not. Their
  263. general forms are the following:
  264.  
  265.     (WHILE,(v),sI{,pk,sk,skr}[,sf])
  266.     (while,sI{,pk,sk,skr}[,sf])
  267.     (UNTIL,(v),sI{,pk,sk,skr}[,sf])
  268.     (until,sI{,pk,sk,skr}[,sf])
  269.  
  270. where v is list of variables (zero or more integers between 0 and 30 with one
  271. space between each pair of variables), each s represents a skeleton and each p
  272. represents a pattern; braces denote 0 or more instances of their contents and
  273. brackets indicate 0 or 1 instance of the enclosed item.  In WHILE and UNTIL,
  274. the list v generates new instances of the indicated variables after the initial
  275. skeleton sI is evaluated; these instances persist during the execution of the
  276. iterative skeleton and disappear upon termination. Otherwise, WHILE and UNTIL
  277. perform as while and until, respectively.  
  278.  
  279.     The next panels describe the operation of while and until; we repeat 
  280. the form of the skeleton for ease of reference.
  281.  
  282.     (while,sI{,pk,sk,skr}[,sf])
  283.  
  284. 1.    The initial skeleton sI is evaluated.
  285.  
  286. 2.    If the first pk matches the text, sk is evaluated and put aside and
  287. a new text to match with pk is given by the repetition skeleton skr.  This 
  288. step is repeated until pk no longer matches the text presented to it.  
  289.  
  290. 3.    The last text skr from step 2 (or sI if pk did not match on the very
  291. first try) is used as initial text to match with the next pattern (if any) and
  292. a similar iteration as that of step 2 occurs on the next triple pk,sk,skr.
  293.  
  294. 4.    Similar iterations are performed for each triple pk,sk,pkr; when the 
  295. last pattern pn fails to match its text, its last residue pnr is left on the 
  296. workspace, unless the optional final skeleton sf is present, in which case 
  297. it replaces the text which last failed to match.  The text produced by 
  298. "while" will thus be a concatenation of 0 or more instances of s1, s2, ...
  299. sn and either of the last of snr or sf; the number of instances of each sk
  300. will depend on how many iterations of each triple took place.
  301.  
  302. "Until" performs in a similar manner, except that iteration occurs as long as
  303. the pattern does NOT match.  Examples follow in the next panel.
  304.  
  305. The following WHILE reads the standard input, leaving on the workspace its
  306. contents up to but not including the end-of-file marker.
  307.  
  308.     (WHILE,(0),(%r,,<[128]>),(NOT,<-->(^Z)),<=>,(%r,,<[128]>),<<
  309.             >><=>,<0>(^Z),<0>,)
  310.  
  311. The symbol <=> is the "same" skeleton, whose value is the text used in the
  312. last matching attempt (regardless of the outcome); this skeleton is described
  313. in the next section of this file.
  314.  
  315. The first triple in the above example leaves on the workspace, one by one,
  316. all full disk sectors of the file which do not contain ^Z.  The iteration
  317. ends when either no more sectors remain in the file or a sector is read which
  318. contains a control-Z.  The last text (which is either a null string or a sector
  319. containing a ^Z) is given to the next triple, in which the pattern is <0>(^Z);
  320. if there is a ^Z, <0> will match the text in the sector up to but not including
  321. the ^Z.  A null string is given as the repeat text (the skeleton skr in the
  322. second triple), which will not match <0>(^Z), so the last action of the WHILE
  323. will be to "append" this null text to the right of the contents of the
  324. workspace.
  325.  
  326. An example of until follows.
  327.  
  328.     (until,0,13,(,(%Ow,MEM:<=>)),(#p,<=>),)
  329.  
  330. This skeleton creates 13 memory buffers, named MEM:0 through MEM:12.  After
  331. each comparison, the value of <=> is the text used in the comparison; since
  332. #p increments by one its argument if it is a number, the value of <=> will
  333. succesively be 0, 1, 2,... up to 12; when #p increments 12 to 13 the pattern
  334. matches and the iteration ends.
  335.  
  336. The skeleton which would close these buffers and release the memory associated
  337. with them would be the following:
  338.  
  339.     (until,12,-1,(%C,MEM:<=>),(#m,<=>),)
  340.  
  341. #m decrements its argument by one; notice that closing is performed in the
  342. order opposite to the one followed when opening: since memory buffers
  343. are assigned space on the pushdown list, space must be released in order
  344. opposite to that of arrival.
  345.  
  346. The final value of the skeletons in both examples is the null string.
  347.  
  348. :The "Same" Skeleton <=>.
  349. The skeleton <=> may be used wherever a pattern match has taken place, and in
  350. skeletons appearing in the list of skeleton definitions.  It may not appear
  351. in skeletons used as patterns embedded in pattern definitions.  In particular,
  352. <=> may appear anywhere in the skeleton part of a rule and in any skeleton
  353. within a conditional or iterative skeleton.  Its value is the entirety of the
  354. text used in the latest comparison, except when appearing within a skeleton
  355. definition in a position in which such a definition does not apply, in which
  356. case its value is the text passed as argument to such a skeleton.
  357.  
  358. For example, if the skeleton definition list contains the definition
  359.  
  360.             ((%W,<8>.<9>,<=>(^MJ))) W
  361.  
  362. and a skeleton (W,abc) is executed at some point, its effect will be to write
  363. five bytes (a, b, c, CR and LF) into the file whose name and extension are
  364. given by variables 8 and 9.  However, in a definition such as
  365.  
  366.         ((if,<=>,<>,[Null],<(><=><)>)) X
  367.  
  368. the first <=> corresponds to the argument of an invocation (X,...), whereas
  369. the second <=> is the text used to match against <>.
  370.  
  371. :The (REC/.../) pattern and skeleton.
  372.  
  373. The (REC/.../) pattern and skeleton allows REC code to be inserted directly
  374. at the point where it appears.  The inserted code is that delimited by "/";
  375. any character may be used as a delimiter as long as it is not contained in
  376. the code to be inserted.  As a pattern, it can make certain searches faster
  377. than if they are left to the normal Convert mechanisms; as a skeleton it can
  378. help to produce more compact code.
  379.  
  380. The use of this feature requires a thorough knowledge of REC and of the
  381. translation from Convert to REC.  Examples of its use may be found in
  382. RCONVERT.CNV, a Convert compiler for Convert, and AYUDA.CNV, the help file
  383. utility in the disk containing this help file.
  384.  
  385. :Memory buffer, stack and array operations.
  386.  
  387. There are three kinds of pseudofiles allowing access to memory blocks:
  388. MEM:, STK: and ARR:.  Different blocks of a given type are distinguished
  389. by appending a name of up to 8 bytes following the colon.  Each kind of
  390. file responds in different ways to %r and %W operations:  MEM: files
  391. operate as sequential files; STK: files operate as stacks, ARR: blocks
  392. are accessed as one-dimensional arrays (vectors).
  393.  
  394. Open operations on MEM: and STK:-type pseudofiles may have an additional
  395. argument whose value should be a string of decimal digits indicating the size
  396. in bytes of the block desired.  This number is effective only at the time the
  397. block is actually allocated; it is ignored if the buffer already exists.  If
  398. omitted at the time of the initial opening, 1024 is assumed.
  399.  
  400. For ARR: pseudofiles, the opening operation may include up to two additional
  401. arguments: the number of elements in the array and the maximum number of
  402. bytes in each element; the first additional argument defaults to 1024, the
  403. second one defaults to 1.  Once allocated, a new %Or or %Ow operation on a
  404. STK: file will not redefine either dimension nor element size.
  405.  
  406.  
  407.  
  408. Associated with a memory buffer pseudofile there are two pointers: a read
  409. pointer and a write pointer.  When the buffer is first created, both pointers
  410. reflect an empty buffer.  Write operations start writing into a buffer at the 
  411. location indicated by the write pointer, update the pointer to the next
  412. available location when done and remove the written argument from the
  413. workspace, however, if the argument doesn't fit in what's left of the buffer,
  414. nothing is written, the argument remains in the workspace and the write
  415. pointer remains unaltered.  Read operations will transfer to the workspace
  416. that portion of the text starting at the read pointer and matching the pattern
  417. (implicit or explicit) associated with %r.  If the pattern does not match the
  418. text between the pointers, this whole text is returned with a ^Z appended to
  419. it (which is deleted if %r contains an explicit pattern) and the read pointer
  420. moves up to the write pointer.  When there is a match, the read pointer
  421. advances to the byte following the portion of text which matched.
  422.  
  423. When a read is attempted on a MEM: pseudo file in which both read and write
  424. pointers have the same value (either because the buffer is empty or it has
  425. been read out entirely), a single ^Z or the null string is returned, depending
  426. on whether the implicit pattern or an explicit one is used, respectively.  In
  427. any case, the final text returned by %r from a memory buffer will depend on the
  428. presence or absence of the optional skeletons which %r may include.
  429.  
  430.  
  431. Open operations may be performed on an open MEM: file, with the following
  432. effects:
  433.  
  434.     (%Or,MEM:...)    moves the read pointer to the beginning of the
  435.             buffer, thus making available all of its contents.
  436.  
  437.     (%Ow,MEM:...)    moves both pointers to the beginning of the buffer,
  438.             effectively leaving it empty.
  439.  
  440. The operation (%C,MEM:...) causes the pseudofile to be deallocated if it 
  441. was the last file to be allocated; otherwise, it simply moves the read
  442. pointer to the beginning.
  443.  
  444. STK: pseudofiles, which operate as stacks (pushdown lists) also have two
  445. pointers, which delimit the current top of the stack.  The possible operations
  446. are the following:
  447.  
  448.     (%Or,STK:xyz)    Creates a stack named xyz if it did not exists; will
  449.             not affect it if it did.  An additional argument may
  450.             be included, as mentioned earlier in this section.
  451.  
  452.  
  453.  
  454.     (%Ow,STK:xyz)    Creates a stack (with an implicit or explicit size)
  455.             if it does not exist; it nulls the stack (removes
  456.             all strings pushed onto it) if it already did exist.
  457.  
  458.  
  459.     (%r,STK:xyz)    Pops the top of stack xyz and returns the string
  460.             which was popped; returns the null string if the
  461.             stack was empty. (No patterns are allowed.)
  462.  
  463.     (%W,STK:xyz,s)    Pushes the value of skeleton s onto stack xyz only
  464.             if it fits in the space remaining; if it does not
  465.             fit, %W returns the entire string.  Pushing a string
  466.             of length n consumes n+2 bytes since the length of
  467.             the previous top of the stack must be preserved.
  468.  
  469.     (%C,STK:xyz)    Deallocates stack xyz if it was the last file to be
  470.             allocated; it has no effect otherwise.
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477. Finally, ARR: pseudofiles are affected by %Or, %Ow, %W, %r and %C as follows:
  478.  
  479.     (%Or,ARR:z,n,l)
  480.     (%Ow,ARR:z,n,l)    Both of thease allocate array z with n elements of
  481.             length l (subject to the above-mentioned defaults);
  482.             if the array was already allocated these functions
  483.             have no effect.  When first allocated, each element
  484.             is initialized to the null string.
  485.  
  486.     (%W,ARR:z[i],s) Assigns the value of skeleton s to element i (1≤i≤n)
  487.             and returns the null string.  If i<1 or i>n or the
  488.             length of the value of s is greater than l, ARR:z is
  489.             not changed and %W returns the value of s.
  490.  
  491.     (%r,ARR:z[i])    Returns the last value stored in element i (1≤i≤n) of
  492.             array z, a string of length between 0 and l.  If i<1,
  493.             i>n or the element has not been written into, a null
  494.             string is returned.  No patterns are allowed.
  495.  
  496.     (%C,ARR:z)    Deallocates array z if it was the last file allocated;
  497.             has no effect otherwise.
  498.  
  499. :Disk system and return to MS-DOS functions.
  500.  
  501.     (%Lr)    returns a single letter (A, B, ...) corresponding to the
  502.         identifier of the currently logged-in disk.
  503.  
  504.     (%Lw,x)    logs in the disk specified by the first letter of skeleton
  505.         x; if x is omitted or is null, A is assumed.
  506.  
  507.     (%M)    returns to MS-DOS after closing all files.
  508.  
  509. :Arithmetic Skeletons.
  510.  
  511. Arithmetic skeletons have the form
  512.  
  513.             (#x,s)
  514.  
  515. where x may be a string of one or more of the arithmetic functions and s is
  516. the argument to which the functions given by x are applied.  In the listing
  517. of arithmetic functions which follows, the term "constant" means a string of
  518. ASCII characters representing an integer when the program is run with REC86
  519. or an integer, long integer, single precision real or double precision real
  520. when the program is run with REC86F or REC87. Convert inherits REC86F's and
  521. REC87's default of promoting smaller-sized arguments to the size and type of
  522. the larger argument in operations involving arguments of different sizes.
  523.  
  524.     f    evaluates a formula.  Its argument must be an arithmetic
  525.         expression in which the operands are constants.  Parentheses
  526.         are allowed (and must be balanced if present); the operators
  527.         recognized are ** or ^ for raising to a power, * for product
  528.         / for division, % for remainder, + for addition or unary 
  529.         plus and - for subtraction or unary minus.  If the argument is
  530.         not an expression it is left unchanged.
  531.  
  532.         The usual rules for operator precedence and association are 
  533.         followed: ** or ^ precede *, / and %, all of which precede + 
  534.         and -.  Unary +'s are removed and unary -'s are replaced by 
  535.         0-.   *, /, %, + and - associate from left to right and ** 
  536.         or ^ associate from right to left.  Thus, (#f,2^3^2) yields 
  537.         512, (#f,(QUO\(2^3)^2\)) yields 64, (#f,2/4*6) gives 0 and
  538.         (#f,6*2/4) gives 3.  Exponents must be of integer type; a
  539.         floating point exponent is truncated and causes the message
  540.         "Xpterr" to be displayed on the console screen.
  541.         
  542.     +    Takes an argument of the form a+b, where a and b are 
  543.         constants and returns their sum.  The argument is unchanged
  544.         if it doesn't have the required form.
  545.  
  546.     -    Takes an argument of the form a-b, where a and b are 
  547.         constants and returns the indicated difference.  No change
  548.         is made in the argument if its form isn't a-b.
  549.  
  550.     *    Returns the product if the argument has the form a*b, with
  551.         a and b constant; otherwise the original argument remains.
  552.  
  553.  
  554.  
  555.     /    Returns the quotient given an argument a/b in which a and
  556.         b are constants; no change is effected if the argument
  557.         does not have the specified form.
  558.  
  559.     ^    Given an argument of the form a^b, where a is any constant 
  560.         and b is an integer, returns a raised to the power b.  The
  561.         argument is returned intact if it does not have the indicated
  562.         form.
  563.  
  564.     %    Returns the remainder of the division a/b if the argument
  565.         has the form a%b; otherwise the argument is left unchanged.
  566.         If either operand is a floating point number, the result
  567.         returned will be  a-(b*int(a/b)), where int(x) is the 
  568.         integer part of x. [e.g., int(3.5)=3; int(-4.8)=-4.]
  569.  
  570.     |    If its argument has the form a|b, where a and b are integer
  571.         constants, it returns the greatest common divisor of the
  572.         pair.  No change occurs if the argument lacks the prescribed
  573.         form and no check is made to ensure that a and b are 
  574.         integers; results are unpredictable in the latter case.
  575.         | may not be used as an operator in arithmetic expressions
  576.         to be evaluated by f.
  577.  
  578.     p    Accepts a single constant as argument and returns that
  579.         constant plus one, in a string of the same numeric type
  580.         as the original argument.  It will not alter its argument
  581.         if it isn't a constant.
  582.  
  583.     m    If its argument is a constant, it returns that constant minus
  584.         one, in a string of the same type; otherwise it leaves its
  585.         argument unchanged.
  586.  
  587.     =
  588.     >    These three skeletons take arguments in either of two
  589.     <    forms: a single number or two numbers separated by a comma.
  590.         In the case of a single number, say a, they return the 
  591.         letter t if a=0, a>0 or a<0, respectively, and the letter f
  592.         otherwise.  In the two-argument case of the form "a,b", t
  593.         is returned if a=b, a>b or a<b, respectively, and f if the
  594.         relation doesn't hold.  In this case, if a and b are two-byte
  595.         integers they are compared as unsigned operands, since 
  596.         two-byte integers are more often used in address 
  597.         calculations.  Arguments not having either of the allowed
  598.         forms are left unchanged.
  599.  
  600.  
  601.     l    Requires a single constant as argument; it converts it to
  602.         a string of the following larger numeric type.  For instance,
  603.         (#l,-1) yields 065535, (#l,010000000) yields 1.E7 and
  604.         (#l,3.14159) gives 3.14159D0.  Double precision constants and
  605.         non-numeric arguments remain unchanged, a null string as
  606.         argument returns the digit 0.
  607.  
  608.     s    Converts a single constant argument to next smaller numeric
  609.         type before rendering it back to ASCII.  Thus
  610.         (#s,3.141592653589D0) returns 3.14159265, (#s,-45.98) returns
  611.         -045, (#s,0100000) leaves 34464 (because of truncation modulo
  612.         2**16) and (#s,2000) leaves 208 (because of truncation modulo
  613.         256).  Non-numeric arguments remain unchanged; a null string
  614.         returns the digit 0.
  615.  
  616.     D    Leaves the binary form of a numeric constant in its place;
  617.         this will take the form of 2, 4, 5 or 8 bytes arranged in
  618.         Intel form (least significant byte first); the lengths
  619.         correspond to short integers, long integers, single precision
  620.         reals and double precision reals, respectively.  D is more
  621.         often used together with h to produce the ASCII hexadecimal
  622.         representation of a number.  
  623.  
  624.         No change takes place if the argument is non-numeric. 
  625.         Examples:    (#Dh,1.5)     produces     3FC0000000
  626.                 (#Dh,-1)     produces     FFFF
  627.                 (#Dh,01000000)     produces     000F4240
  628.  
  629.     H    Leaves the binary form of a string of ASCII hexadecimal 
  630.         digits (0-9, A-F).  Given a string of n bytes, it produces
  631.         a string of |_((n+1)/2_| bytes, where |_x_| is the greatest
  632.         integer not exceeding x.  H is often used together with d
  633.         to convert from ASCII hexadecimal to ASCII decimal.  No
  634.         change is effected if the argument contains characters other
  635.         than hex digits.  Examples:
  636.         (#H,414243)     gives    CBA     (when interpreted as ASCII)
  637.         (#Hd,3FC0000000) gives    1.5
  638.         (#Hd,F)         gives  15
  639.  
  640.     d    Assumes its argument is the binary representation of a number
  641.         and converts it to an ASCII decimal string.  If the argument 
  642.         length is not 0, 1, 2, 4, 5 or 8 no change takes place.  
  643.         Examples: (#d,(^MJ)) yields 2573 (10*256+13, due to Intel 
  644.         ordering of bytes in binary operands being assumed); 
  645.         (#Hd,FFFE) yields 65534.
  646.  
  647.     h    Assumes its argument to be binary and converts it to a string
  648.         of ASCII hex.  An n-byte argument produces a 2n-byte result.
  649.         Examples: (#Dh,1.) produces 3F80000000;    (#h,jkl) produces 
  650.         6C6B6A (because Intel ordering of binary operands is assumed)
  651.  
  652. As mentioned near the beginning of this section, in a skeleton of the form
  653. (#x,s), x may be a string.  When x consists of more than one character, each
  654. of the represented functions is applied to the argument from left to right;
  655. thus in (#Hd,FFFF), H is applied first to FFFF and d is then applied to the
  656. result left by H (the two byte binary representation of 65535).
  657.  
  658. As mentioned in CNVRT.HLP, a program using function #f and requiring handling
  659. of floating point constnats must have the pair #. in an [Include ..] comment;
  660. furthermore, if functions #^ and #% are not invoked explicitly but operators
  661. ** or ^ and % are to appear in formulas for #f, the pairs #^ and #% must be
  662. present in the "Include".  [Include #.#^#%] would serve in a program which
  663. only uses #f explicitly but is intended for computation of formulas involving
  664. floating point numbers and exponentiation and remainder operations.
  665.  
  666. :Character "Arithmetic".
  667.  
  668. Character arithmetic skeletons have the form
  669.  
  670.             (&x,s)
  671.  
  672. where x may be a string of one or more of the character arithmetic functions
  673. and s is the argument to which the functions given by x are applied.  When
  674. x consists of two or more characters, the function represented by each 
  675. character is applied in turn from left to right, the first one to the 
  676. original argument and the rest to the result left by the preceding function.
  677. For instance, (&D!,1.5) applies D to the string 1.5 and ! to the resulting
  678. string.
  679.  
  680. Functions available for character arithmetic are the following:
  681.  
  682.     D    Converts a string of one or more decimal integer ASCII
  683.         numbers optionally preceded by minus signs and separated by
  684.         commas or other nondecimal characters into binary, a pair
  685.         of bytes for each integer. Examples: (&D,2573<,>-1) yields  
  686.         4 consecutive bytes whose hex values are 0D, 0A, FF and FF;
  687.         (&D,ab) yields 6 zero bytes: a and b delimit 3 null strings.
  688.  
  689.     H    Converts a string of one or more hexadecimal ASCII numbers
  690.         into binary (modulo 2**16), a pair of bytes for each number.
  691.         For instance, (&H,F) yields two bytes whose values are, in
  692.         hex, 0F and 00; (&H,ABCDEf0123) produces 4 bytes whose
  693.         values expressed in hex are DE, BC, 23 and 01, in that order.
  694.         The inversion of high and low order bytes is due to the
  695.         Intel convention for binary data storage.  Notice also that
  696.         lowercase f is not considered a hex digit.
  697.  
  698.     d    Converts a string by pairs of bytes into ASCII decimal 
  699.         strings separated by commas; if the argument has an odd
  700.         number of bytes the rightmost byte is converted assuming
  701.         a zero high order byte.  Examples:
  702.             (#d,(^MJZ)) produces the string 2573,26
  703.             (#Hd,FFFE)  produces the string -2
  704.  
  705.     h    Converts a string by pairs of bytes into strings of 4 ASCII 
  706.         hexadecimal digits separated by commas; the rightmost byte
  707.         of a string of odd length gets converted to two hex digits.
  708.         Examples:
  709.             (#h,(^ABMJZ)) produces the string 0201,0A0D,1A
  710.             (#Dh,32767) produces the string 7FFF
  711.  
  712.     u    Shifts all lowercase letters (a-z) in its argument to
  713.         uppercase, e.g., (&u,Hello) yields HELLO.
  714.  
  715.     l    Shifts all uppercase letters (A-Z) in its argument to
  716.         lowercase, e.g., (&u,What IS it?) results in what is it?
  717.  
  718.     a    Turns off the sign bit of each byte in its argument.
  719.         For instance (&Dah,-1) results in the string 7F7F.
  720.  
  721.     s    Turns on the sign bit of each byte in its argument.
  722.         For instance (&sh,(^MJZ)) gives 8A8D,9A
  723.  
  724.     p    Substitutes a period for each byte in its argument whose
  725.         value is not a printable ASCII character (i.e., SP to ~)
  726.         Example: (&p,abc(^MJ)de) results in abc..de 
  727.  
  728.     n    Converts each byte in its argument into two ASCII hexadecimal
  729.         digits.  For example (&n,ABCDEF) produces 414243444546.
  730.  
  731.     b    Inverts the effect of n: converts pairs of ASCII hex digits
  732.         into bytes of the corresponding binary value.  Results are
  733.         unpredictable for odd-numbered arguments or non-hex digits.
  734.  
  735.     i    Converts a string of bytes into 3-digit ASCII octal numbers
  736.         (one for each byte) separated by commas; a null argument
  737.         produces 000.  Example:
  738.                 (&i,Zz) produces 132,172
  739.  
  740.     I    Converts a string of ASCII octal numbers separated by commas
  741.         to binary, a byte for each ASCII number.  For example,
  742.         (&I,116<,>117<,>77) yields the 3-byte ASCII string NO?
  743.  
  744.     8    Converts a string of bytes into 8-bit ASCII binary numbers 
  745.         (one for each byte) separated by commas; an isolated null
  746.         string produces 00000000.  Example:
  747.             (&8,Zz) produces 01011010,01111010
  748.  
  749.     B    Converts a string of ASCII binary numbers separated by commas
  750.         to binary, a byte to each ASCII number; a single null string 
  751.         produces a single zero byte.  For example,
  752.             (&Bh,01011010<,>01111010) yields 7A5A.
  753.  
  754.     =    Yields the letter f if its argument is the null string or at 
  755.         least one of its bytes is non-null; leaves the letter t if 
  756.         all of the argument's bytes are binary 0.
  757.  
  758.     >    Yields the letter f if its argument is the null string or if 
  759.         the sign bit of its rightmost byte is on; t if this byte's 
  760.         sign bit is off.
  761.  
  762.     <    Yields the letter f if its argument is the null string or if
  763.         the sign bit of the rightmost byte is off; the letter t is
  764.         returned if the rightmost byte's sign bit is on.
  765.  
  766.     !    Returns the length of its argument as an ASCII decimal 
  767.         number.  For example, (&!,What<,> me worry?) returns 15.
  768.  
  769.     #    Returns the value of a hash function of its argument as an
  770.         ASCII decimal number, always between 0 and 12.  The hash
  771.         function is currently defined as the remainder modulo 13 of
  772.         the exclusive or of all the bytes in the argument.
  773.  
  774. :Overlays.
  775.  
  776. Overlays are an extremely useful feature which allow the running of programs
  777. whose overall size is much larger than REC's compilation area (in MS-DOS,
  778. this is typically 64K minus the size of REC itself).  Overlays may be used
  779. when a program can be divided into three or more segments such that two or
  780. more of them are not needed simultaneously in memory.
  781.  
  782. For instance, suppose program A calls subroutines B and C, but neither B
  783. calls C nor C calls B.  Then program A could constitute a root program which
  784. loads B or C when either of them is required.  Thus B and C share the same
  785. memory area and the memory requirements for the entire program are smaller
  786. by the length of the smaller of B and C than the requirements for the
  787. non-overlaid A-B-C combination.  An overlay may load other overlays, and this
  788. way a very large program may be organized in a tree-like structure of
  789. overlays.  Since each overlay is a REC program that gets compiled when loaded,
  790. no relocatability issue arises and thus a given overlay may be loaded at
  791. different levels of an overlay tree.
  792.  
  793.     For the purpose of discussion, in what follows the root overlay
  794. will be called "driver" and the rest of the overlays will be called
  795. "segments".
  796.  
  797. The driver is the only program which should contain the initializing code
  798. inserted by the compiler; all segments must be compiled with an [Exclude LIB]
  799. comment in their source files appearing before the first subroutine or program,
  800. preventing thus insertion of the initializing code.
  801.  
  802. Automatic inclusion of library routines at runtime requires that the root
  803. inform the compiler which routines must be included in addition to those
  804. determined automatically by the compiler during compilation of the root.  This
  805. is accomplished by an [Include ....] comment near the beginning of the root's
  806. source file, where "...." is replaced by the strings inserted by the compiler
  807. (after enclosing them in square brackets) at the end of each segment's .REC
  808. file (which will always happen if the source file contains [Exclude LIB]).
  809.  
  810. For example, the quantum chemistry program HAMEL is made up of 9 programs;
  811. the root is HAMELD and the segments are HAMELx, where x is X, F, G1, G2, G3,
  812. G4, G5 and M.  Due to the [Exclude LIB] in the 8 segments, the compiler
  813. produced the following strings, inserted at the end of each file HAMELx.REC:
  814. [T # #*#|#/W 64O OrOwE ],    [T W 64O OrOwE ],       [W t T 64O OrOw E ],
  815. [T W 64O OrOwE ],         [T W 64O OrOwE ],       [t T W 64O OrOwE ],
  816. [# #*#|#/T W 64O OrOwE ] and [T W 64# #*#+#-#|#/O OrOwE ]; with these strings
  817. a comment [Include T t W 64# #+#-#*#/#|O OrOwE ] was formed for insertion in
  818. the program file of the root, HAMELD.CNV.
  819.  
  820. The "Include" comment in the example was built gathering all distinct pairs of
  821. characters appearing in the eight final strings generated for the segments;
  822. notice spaces are important because the automatic inclusion mechanism examines
  823. the "Include" string by pairs of characters.
  824.  
  825. Overlays may be read from disk files or memory buffers; the latter case
  826. essentially extends the compilation area into REC's pushdown list, from 
  827. which space is procured for memory buffers.  Storing overlays in memory 
  828. buffers also has the advantage that overlay loading from them is 
  829. substantially faster than loading from a disk file.  The following skeleton 
  830. fragment shows how an overlay in a file called FSY.REC is read from disk 
  831. and written into a MEM: pseudofile whose size is computed from the length
  832. of the original file itself:
  833.  
  834.     (IF,(0),(until,(%r,FSY.REC),(^Z),<=>,(%r,FSY.REC),),<0>,<<
  835.         >>(%C,FSY.REC)(,(%Ow,MEM:sy,(&!,<0>)))(%W,MEM:sy,<0>))
  836.  
  837. Closing FSY.REC before opening MEM:sy saves memory by releasing table and
  838. buffer space associated with FSY.REC; the length of MEM:sy is determined
  839. by the length of the contents of FSY.REC; <0> is bound to these contents.
  840.  
  841.  
  842.  
  843. An overlay is loaded and executed by the skeleton
  844.  
  845.             (%V,name,arg)
  846.  
  847. where 'name' is the name of the disk file (whose extension is assumed to be
  848. .REC if not explicitly given) or memory buffer containing the overlay and
  849. 'arg' is a skeleton whose value is the argument received by the overlay in
  850. the workspace; 'arg' is optional and when omitted, the preceding comma may
  851. also be omitted and the overlay will receive an empty workspace.
  852.  
  853. The last overlay loaded may be reexecuted any number of times without 
  854. recompiling it (as long as no other overlay is loaded) by calling it with the
  855. skeleton ( ,arg) in which a single blank space appears between the left
  856. parenthesis and the comma, and 'arg' is the argument to be passed to the
  857. overlay; the skeleton ( ) (with a single blank) may be used if no argument is
  858. to be passed (i.e., if the null string is to be passed).
  859.  
  860. The Convert compiler may be loaded as a segment: (%V,CONVERT,arg) compiles the
  861. program contained in the disk file given by 'arg', generating the corresponding
  862. REC file.  If X.CNV, Y.CNV and Z.CNV are to be compiled, the concatenation
  863. (%V,CONVERT,X)( ,Y)( ,Z) will load CONVERT.REC once and compile the three
  864. programs.  The default extension for 'arg' in this case is .CNV.
  865.  
  866. :Priority Queues (Heaps).
  867.  
  868. The following skeletons handle a MEM: pseudofile as a priority queue (or heap)
  869. of two-byte unsigned integers:
  870.  
  871.         (%Hi,m,d)        (%Hs,m)
  872.         (%Hr,m)            (%Hh,m)
  873.  
  874. In all four skeletons, m is a skeleton which must evaluate to a MEM: 
  875. pseudofile name; d in skeleton %Hi must be evaluate to a four byte ASCII 
  876. string representing a hexadecimal number (lower case a-f are not recognized).
  877.  
  878. %Hi inserts the two-byte binary representation of the ASCII hex number d 
  879. into the pseudofile m, sifting the file to maintain the heap condition.  If
  880. the pseudofile is viewed as an array P with N entries, maintaining the heap
  881. condition means requiring that P(i) > P(2*i) and P(i) > P(2*i+1) for i between
  882. 1 and floor(N/2).  After an insertion, the pseudofile read pointer is set to
  883. beginning of the buffer, so that a subsequent read from m will start from the
  884. top of the heap.  %Hi returns the null string.
  885.  
  886.  
  887.  
  888.  
  889. %Hr reads the next two-byte value from m, converting it to a four-byte ASCII
  890. string (hex).  This skeleton is essentially equivalent to (&h,(%r,m,<[2]>)),
  891. and is included for convenience.
  892.  
  893. %Hs sorts the contents of m, which are assumed to satisfy the heap condition.
  894. It returns the null string and does not affect the value of the pseudofile
  895. read and write pointers.
  896.  
  897. %Hh sorts the pseudofile m by the heapsort method assuming it to contain
  898. two-byte unsigned values.  The file need not satisfy the heap condition
  899. initially; a file suitable for sorting by %Hh may be produced by writing
  900. values with the skeleton (%W,m,(&H,h)), where h is a four-byte ASCII
  901. hexadecimal string, or with (%W,m,(&D,d)) where d is an ASCII decimal integer
  902. between 0 and 65535.
  903. :Skeletons for graphics and video control.
  904.  
  905. Function %G in Convert's library allows access to the video control functions 
  906. provided by MS-DOS through software interrupt 10H.  The general form for this 
  907. skeleton is 
  908.  
  909.                 (%G,func,list)
  910.  
  911. where func is the function number in decimal (a number from 0 to 15) and list 
  912. is a skeleton whose value must be a list whose form is
  913.  
  914.                 r=v,r=v,...,r=v
  915.  
  916. indicating the values to be loaded into the machine registers before 
  917. executing the software interrupt.  The value given as func is always loaded 
  918. into AH; each r in the list may be one of the following two-byte strings:
  919.  
  920.                 al
  921.         bl        bh        bx
  922.         cl        ch        cx
  923.         dl        dh        dx
  924.  
  925.  
  926. Each string represents the corresponding machine register and is recognized 
  927. only in lowercase letters.  The values, v, are interpreted as decimal 
  928. numbers; in any case the value loaded is v mod 256 or v mod 65536, according 
  929. to the register size.  Registers not appearing in the list are loaded with 
  930. zeros.
  931.  
  932. All functions return the null string except functions 3, 4, 8, 13 y 15, whose
  933. return value is described in what follows.
  934.  
  935. The available functions are the following
  936.  
  937. (%G,0,al=v)    Set video mode.  The possible values for v are:
  938.  
  939.             0    40 x 25, monochrome
  940.             1    40 x 25, color
  941.             2    80 x 25, monochrome
  942.             3    80 x 25, color
  943.             4    320 x 200, color
  944.             5    320 x 200, monochrome
  945.             6    640 x 200, monochrome
  946.  
  947.         The graphic modes correspond to v = 4, 5 and 6.
  948.  
  949. (%G,1,ch=v1,cl=v2)
  950. (%G,1,cx=v)    Set cursor appearance.  On monochrome screens, each byte in CX
  951.         may have any value between 0 and 15; on color screens the upper
  952.         bound is 7.  CH and CL provide the starting and ending raster 
  953.         lines, respectively.  Lines are numbered from top to bottom.
  954.  
  955. (%G,2,bh=p,dh=r,dl=c)
  956.         Set cursor position.  r and c indicate the row and column 
  957.         where the cursor is to be positioned; 0≤r≤24 and 0≤c≤39 or
  958.         0≤c≤79 depending on the active mode (39 is the maximum in the
  959.         graphic modes).  p indicates the page, which is 0 for the
  960.         graphic modes, 0 to 3 in the 80x25 modes and 0 to 7 in the
  961.         40x25 modes.
  962.  
  963. (%G,3,bh=p)    Reads the position and appearance of the cursor on page p
  964.         (see the preceding description regarding possible p values).
  965.         This function returns four decimal numbers separated by 
  966.         commas representing (in order) the values from registers DH
  967.             (row), DL (column), CH (starting line) and CL (ending line).
  968.         For example, if this function returns "24,0,0,7", the cursor
  969.         is a block the size of the row (on a color screen) and is
  970.         positioned on the first column of the bottom row.
  971.  
  972. (%G,4)        Reads the light pen position.  If there is no position, the
  973.         function returns the null string; otherwise it returns the
  974.         values (in decimal, separated by commas and in the order
  975.         given) of DH (the row, between 0 and 24), DL (the column,
  976.         between 0 and 39 or 79), CH (pixel row, between 0 and 199) and
  977.         BX (pixel column, between 0 and 319 or 639).
  978.  
  979. (%G,5,al=p)    Set the active page.  p may be a value between 0 and 7 for the
  980.         40x25 modes or between 0 and 3 for the 80x25 modes.  The 
  981.         selected page is displayed instantaneously.
  982.  
  983. (%G,6,list)    Scroll up (function 6) or down (function 7).  Values may be 
  984. (%G,7,list)    assigned in 'list' to AL, BH, CX (or CL and CH) and DX (or DL 
  985.         and DH).  Registers CX and DX determine the corners of the 
  986.         window to be scrolled:  CH and CL must be given the upper 
  987.         left corner row and column values, respectively; DH and DL 
  988.         must contain respectively the row and column values for the 
  989.         lower right corner.  The value in AL determines how many 
  990.         lines to scroll; 0 implies erasing the entire window.  BH may 
  991.         contain the attribute to be assigned to the lines which get 
  992.         erased by the scrolling.  For a monochrome screen, the 
  993.         attribute is a byte in the form
  994.  
  995.                     bffficcc
  996.  
  997.         where fff is the background color (000=black, 111=white), ccc
  998.         is the character's color (interpreted like fff), b indicates
  999.         whether the character should blink (0=no, 1=yes) and i 
  1000.         specifies the intensity (0=normal, 1=high).  Normal attribute 
  1001.         is bh=7.  On a color screen the attribute byte has the form
  1002.  
  1003.                     bRGBirgb
  1004.  
  1005.         where RGB and rgb denote the red, green and blue contributions
  1006.         to the backgraound and character colors, respectively (1=on, 
  1007.         0=off), and b and i are interpreted as in the monochrome mode.
  1008.  
  1009. (%G,8,bh=p)    Reads the character under the current cursor position on page 
  1010.         p.  This function returns the values of AL (the character's 
  1011.         code in decimal) and BL (the attribute in decimal), separated 
  1012.         by a comma.
  1013.  
  1014. (%G,9,al=c,bl=a,bh=p,cx=n)
  1015.         Writes n times the character whose code is c, with attribute a
  1016.         starting at the current cursor position on page p.
  1017.  
  1018. (%G,10,al=c,bh=p,cx=n)
  1019.         Writes n times the character whose code is c, starting at the 
  1020.         current cursor position on page p, using the attribute 
  1021.         already present in video memory.
  1022.  
  1023. (%G,11,bh=f,bl=c)
  1024.         Set color palette.  If bh=0, bl selects the color for the 
  1025.         background (0≤c≤15); if bh is nonzero, bl selects one of two 
  1026.         palettes from which pixel colors may be chosen (bl=0 selects 
  1027.         green, red and brown; bl=1 selects cyan, magenta and white).
  1028.  
  1029. (%G,12,dx=r,cx=c,al=C)
  1030.         Set a pixel with coordinates (r,c) to color C.  0≤r≤199 and 
  1031.         0≤c≤319 or 639 (depending on the current mode).  C may be 0
  1032.         (the background color), 1 (green or cyan), 2 (red or magenta) 
  1033.         or 3 (brown or white).  The choice of color for values 1, 2 
  1034.         and 3 depends on the palette selected by function 11.
  1035.  
  1036. (%G,13,dx=r,cx=c)
  1037.         Returns the color (a value between 0 and 3) of the pixel at 
  1038.         coordinates (r,c); row r and column c have limits as given in 
  1039.         the preceding description.
  1040.  
  1041. (%G,14,al=c,bh=p,bl=C)
  1042.         Puts a single character (whose code is c, in decimal) at the 
  1043.         current cursor position in page p.  If the screen is set to a 
  1044.         graphics mode, C indicates the character's color (0 to 3).
  1045.  
  1046. (%G,15)        Returns the current mode value, a number between 0 and 6.
  1047.  
  1048. :Error messages.  CONVERT.REC displays the following messages upon detecting
  1049. the corresponding errors:
  1050.  
  1051.     Unexpected EOF        End of file encountered in the middle of a
  1052.                 compilation, for instance, if there are
  1053.                 subroutines but no main program.
  1054.  
  1055.     Unbal {
  1056.  
  1057.     Excess }
  1058.  
  1059.     WS ovf            Workspace overflow.
  1060.  
  1061.     Unbal [
  1062.  
  1063.     Expected (, [, {    Spurious characters in the source file.
  1064.  
  1065.     Expected )
  1066.  
  1067.     Expected ","        Syntax violation in LAM, IF, WHILE, etc.
  1068.  
  1069.     Ill patt        Illegal pattern.
  1070.  
  1071.     Ill skel        Illegal skeleton.
  1072.  
  1073.     Ill rule        Rule lacking the comma separating pattern
  1074.                 from skeleton.
  1075.  
  1076.     Ill sep            Colon/semicolon missing after a rule.
  1077.  
  1078.     Ill var            Variable number not between 0 and 30.
  1079.  
  1080.     Ill var list        Badly formed variable list.
  1081.  
  1082.     Ill <=>            Illegal use of skeleton <=>.
  1083.  
  1084.     Dir full        Directory full reported by the operating
  1085.                 system when attempting to write.
  1086.  
  1087.     Disk full        Disk full reported by the operating system
  1088.                 when attempting to write.
  1089.  
  1090.     Not Found        Nonexistent source file.
  1091.  
  1092.     No file given        No source file name given to the compiler.
  1093.  
  1094. :[CNVADV.HLP]
  1095. [Gerardo Cisneros, 13.8.84]
  1096. [Rev.: G. Cisneros, 28.1.86]
  1097. [Rev. for MS-DOS: G. Cisneros, 10.90]
  1098. [end]
  1099.