home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / bbs / popmax1.zip / COMPILE.POP next >
Text File  |  1993-06-13  |  13KB  |  342 lines

  1. {:rit}
  2. {return}
  3.  
  4. {:writh}
  5. {writ ^(:top^)}
  6. {writ ^(call %%subnam^)}
  7. {writ ^(macl popmax.pop,wait^)}
  8. {return}
  9.  
  10. -------------------------------------------------------------------------------
  11. {:alk}
  12. {:maksubs}--make subroutines for new menu data file
  13. {clear}
  14. {disp 2,1,07,Note: Compile function is slow. Approximately 2 seconds per option!}
  15. {setv nsubct,0}
  16. {setv endthred,0}
  17. {setv counta,0}
  18. {setv key,abcdefghijklmnopqrstuvwxyz}
  19. {call opfil2}               open files for read/write
  20. {call writh}
  21. {call set2}                 setup for this sub
  22. {call ext2}                 read num from data file
  23. {setv writct,0}
  24. {wclos}
  25. {rclos}
  26. {wopen-a popdata.pop}
  27. {call appen}
  28. {macl popmax.pop,alj}
  29. {return}
  30.  
  31. {:opfil2}
  32. {wclos}
  33. {rclos}
  34. {wopen popdata.pop}
  35. {ropen outline.pop,rit}
  36. {return}
  37.  
  38. {:set2}---setvars
  39. {setv hilev,8}
  40. {setv lev,0}
  41. {setv ccl,0}
  42. {setv cc,0}
  43. {call setvars}
  44. {setv writct,0}
  45. {setv laslev,0}
  46. {setv xpoint,0}
  47. {return}
  48.  
  49. {:setvars}
  50. {incr cc}
  51. {comp cc,8}
  52. {ifco-g rit}
  53. {setv count%cc,0}
  54. {setv nxt%cc,0}
  55. {goto setvars}
  56.  
  57.  
  58.  
  59. {:ext2}---extract level number from read-in line
  60. {read %line}
  61. {call convert}
  62. {call comp2}           compare lastlevel and current
  63. {goto ext2}            repeat until EOF
  64.  
  65. {:setless}---set levels to the right (higher levels) to zero
  66. {incr writct}                          increment temp pointer
  67. {comp writct,%hilev}                   compare to last pointer pos
  68. {ifco-g rit}                           if greater, were done
  69. {setv count%writct,0}                  set value in this exp var to zero
  70. {goto setless}                         repeat
  71.  
  72. {:comp2}--compare level number read from file
  73. {disp 5,3,3,                                              }
  74. {disp 5,3,3,%text}
  75. {comp laslev,%lev}    compare val of lastlevel pointer to current level pointer
  76. {ifco-l uplev}        if last num < current, up level pointer
  77. {ifco-e upcnt}        if last num=current increment value held at pointer
  78. {ifco-g downlev}      if last num > current decrement level pointer
  79. {}
  80.  
  81. {:turnover}---turnover counter
  82. {incr endthred}                  increment new postion of aray to stor tie-end subs
  83. {setv pos%endthred,%nsubnam}     put sub name in tndthread aray for recall
  84. {setv lastopt,%lev}              put level number in var lastopt
  85. {setv writct,%lev}               mark beginning position of reset pointer
  86. {call setless}                   reset all vars to right back to zero
  87. {return}
  88.  
  89. {:upcnt}--increment value held at current level pointer
  90. {setv-s ccl,count%lev}           store current value at pointer in CCL
  91. {incr ccl}                       increment this value
  92. {setv count%lev,%ccl}            put it back into expanded var
  93. {setv writct,0}                  clear writct
  94. {setv lsubnam,%subnam}           get last subname
  95. {setv subnam}                    clear subname
  96. {setv nsubnam}                   clear out new subroutine name
  97. {call asm}                       assemble new subname
  98. {call subinfo}                   write info to file
  99. {return}
  100.  
  101.  
  102. {:subinfo}---write subroutine information
  103. {writ}
  104. {writ ^(:%subnam%^)---display data for this option}
  105. {writ ^(incr optc^)}                  write instruction to bump up counter
  106. {writ ^(setv txt%%optc,%text^)}        insert display information
  107. {writ ^(setv opt%%optc,%outext^)}      insert display information
  108. {writ ^(setv type%%optc%,%type%^)}            set type of command
  109. {writ ^(setv this%%optc%,%subnam%^)}            set type of command
  110. {writ ^(goto %nsubnam^)}
  111. {setv writct,0}
  112. {return}
  113.  
  114. --------------------
  115.  
  116. {:uplev}---increment level pointer
  117. {writ}
  118. {setv retopt,%subnam}
  119. {setv ty,%lev}
  120. {decr ty,%laslev}
  121. {writ Going up %ty% level(s) ,from level %laslev% to %lev% ----------->>>}
  122. {incr nsubct}
  123. {setv hold%nsubct,%nsubnam}
  124. {disp 1,3,3,Going up from level %laslev% to %lev% ----------->>>             }
  125. {setv laslev,%lev}               bring last level pointer to current level
  126. {incr count%lev}
  127. {setv writct,0}
  128. {setv lsubnam,%subnam}
  129. {setv subnam}
  130. {setv nsubnam}
  131. {call asm}
  132. {call subinfo}
  133. {return}
  134.  
  135.  
  136. {:downlev}-- decrement level pointer
  137. {writ ^(:%nsubnam%^)}
  138. {writ ^(return^)}
  139. {call turnover}                  turn over all vars to right (set to 0)
  140. {setv fcc,0}
  141. {setv ty,%laslev}
  142. {decr ty,%lev}
  143. {writ}
  144. {writ <<------ going back %ty% level(s) from level %laslev% to level %lev}
  145. {disp 1,3,2,<<------ going back from level %laslev% to %lev                   }
  146. {setv laslev,%lev}               make last level pointer current
  147. {incr count%lev}                 add 1 to val held at current counter pos
  148. {setv writct,0}                  reset our temp pointer
  149. {setv lsubnam,%subnam}
  150. {setv subnam}
  151. {setv nsubnam}
  152. {call asm}
  153. {call subinfo}
  154. {return}
  155.  
  156. --------------------------------------------
  157.  
  158. {:asm}---assemble sub name
  159. {setv point,0}
  160. {setv ccc,0}
  161. {call copynext}
  162. {incr nxt%lev}
  163. {call assemble}
  164. {comp lastopt,false}
  165. {ifco ,resxt}
  166. {disp 4,4,3,%subnam% %nsubnam}
  167. {return}
  168.  
  169. {:assemble}
  170. {incr writct}            increment position counter
  171. {comp writct,%hilev}     is counter greater than highest count?
  172. {ifco-g rit}             if true display
  173.  
  174. {setv-s cc,count%writct}     store current val under temp pointer to cc
  175. {setv-s ccc,nxt%writct}     store current val under temp pointer to cc2
  176.  
  177. {incr cc}                     add one to value so zero can be accounted for-count
  178. {incr ccc}                     add one to value so zero can be accounted for-nxt
  179. {subs c1,%cc%,1,%key}         find the representative letter in key  (count)
  180. {subs c2,%ccc%,1,%key}        find the representative letter in key  (nxt)
  181. {setv subnam,%subnam%%c1}    append subroutine name
  182. {setv nsubnam,%nsubnam%%c2}    append subroutine name
  183. {goto asm}
  184.  
  185. {:copynext}---copy array into second array for next presumed sub
  186. {incr point}
  187. {comp point,%hilev}
  188. {ifco-g rit}
  189. {setv-s tranum,count%point}
  190. {setv nxt%point,%tranum}
  191. {goto copynext}
  192.  
  193. {:resxt}--reset next option number, due to this being last option
  194. {comp lev,%lastopt}
  195. {ifco-e ,rit}
  196. {return}
  197.  
  198. {:appen}--append subs with leftover information
  199. {writ ^(:rit^)}
  200. {writ ^(return^)}
  201. {incr nsubct}
  202. {setv hold%nsubct,%nsubnam}
  203. {setv zcount,0}
  204. {call capit}
  205. {writ ^(return^)}
  206. {return}
  207.  
  208. {:capit} -- write all the possible varible names at end of file, so return can happen
  209. {incr zcount}
  210. {comp zcount,%nsubct}
  211. {ifco-g rit}
  212. {setv-s coop,hold%zcount}
  213. {writ ^(:%coop%^)}
  214. {goto capit}
  215.  
  216. {:capit2}----write all the direct sub names
  217. {incr zcount}
  218. {comp zcount,%xpoint}
  219. {ifco-g rit}
  220. {setv-s coop,xhold%zcount}
  221. {writ ^(:%coop%^)}
  222. {goto capit2}
  223.  
  224.  
  225. {:setall}-------
  226. {setv xsubnam}
  227. {setv flev,0}
  228. {setv point,0}
  229. {setv writct,0}
  230. {setv subnam}
  231. {call trans}      transfer COUNT array to ALL array
  232. {setv flev,%lev}
  233. {incr flev}
  234. {comp flev,%hilev}         is it bigger than Highest menu level?
  235. {ifco-g zout}            if so, assign it to zzzzz...
  236. {call assign}
  237. {call alsm}
  238. {return}
  239.  
  240. {:zout}----set rta keypress values to special subname
  241. {setv subnam,zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz}
  242. {subs xsubnam,1,%hilev%,%subnam}
  243. {return}
  244.  
  245.  
  246. {:assign}-------------assign aray to subname
  247. {setv-s fcc,count%flev}
  248. {incr fcc}
  249. {setv all%flev,%fcc}
  250. {return}
  251.  
  252. {:trans}----transfer values of top variable
  253. {incr point}
  254. {comp point,%hilev}
  255. {ifco-g rit}
  256. {setv-s tranum,count%point}
  257. {setv all%point%,%tranum}
  258. {goto trans}
  259.  
  260. -------------------------------------------------------------------------------
  261.                          Begin Compile
  262. -------------------------------------------------------------------------------
  263. {:convert}                      main body of conversion program
  264. {setv total,0}                  clear our write file line count
  265. {setv counter,0}                set dash-counter (menulevel) to zero
  266.  
  267. {:rcompile}                         begin compiling
  268. {setv ast,-}                        set value of menulevel char (-) to level one
  269.                                     drop through
  270. {:testagain}                    test line for menu level
  271. {inst line,%ast}              find first instance of sought menulev in line
  272. {comp %_pos,0}                  is the position result zero? (not in line)
  273. {ifco-e extract}                if it is, we have found menulevel; extract text
  274. {incr counter}                  if not, increment our menulevel counter
  275. {setv ast,%ast%-}               add another dash (menulev) to our search string
  276. {goto testagain}                recycle until we get result 0, or file end
  277.  
  278. {:extract}                        extract, write 3 fields from human file line
  279.                                     *general setup for this subroutine*
  280. {length %inline)                  get total length of input line we read
  281. {setv lenin,%_len}                put it in var LENIN
  282. {incr total}                      increment our write file line number
  283.                                                *get first field (menu level)*
  284. {setv lev,%counter%}
  285. {incr counter}                    increment menulev counter so it represents
  286.                                   the first character of the field next to the
  287.                                   dashes (first position of our next field
  288.                                   e.g. field#2,the menu option's text decription)
  289. {instr line,`}                  now find the first left small-quote in the
  290.                                   line, indicating the postion to the right of
  291.                                   the end of field#2.
  292. {comp %_pos,0}                    is there no "`"?
  293. {ifco-e closf}                  if not close files, end.
  294. {setv endpos2,%_pos}              put the bracket location (field#2
  295.                                   truncaton point) in ENDPOS2
  296. {setv lenfeld2,%endpos2}                             set the length of field 2
  297.                                                      (LENFELD2) to this value
  298. {decr lenfeld2,%counter}                             count back the num of
  299.                                                      dashes (COUNTER) to get
  300.                                                      actual length of field 2
  301.                                                      (LENFELD2)
  302. {subs text,%counter,%lenfeld2,%line}               extract text for field 2
  303.                                                      (TEXT)
  304.  
  305.                                   *get third field (selection output text)*
  306. {instr line,`}                  now re-find the first left smallquote in the
  307.                                   in our human input string, indicating the
  308.                                   start position of field #3 (menu option
  309.                                   hidden output string)
  310. {setv beginpos,%_pos}             store location of first leftsmallquote
  311. {incr beginpos}                   move over one position to locate first char
  312.                                   in 3rd field; we now have BEGINPOS
  313. {inst line,'}                   now find the first right small quote in the
  314.                                   human input line, indicating postion to the
  315.                                   right of the end of field#3
  316. {setv endpos,%_pos}               store location of first rightsmallquote
  317.                                   --our truncation point for this field
  318. {setv lenfeld3,%endpos}           set preliminary length of field3 to the
  319.                                   ending postion of field3
  320. {decr lenfeld3,%beginpos}                      get the actual length of field 3
  321.                                                by subtracting the beginning pos
  322.                                                from the end pos
  323. {subs outext,%beginpos%,%lenfeld3%,%line}    extract field#3 from within the
  324.                                                small quote chars in our human
  325.                                                input line. put in OUTEXT
  326. {setv counter,0}                        reset menulevel counter
  327. {comp outext}                           is outext nul?
  328. {ifco address}                          if so, set command status to indirect
  329. {setv type,direct}                      if not, set it to indirect
  330. {return}                                return
  331.  
  332. {:address}
  333. {setv type,indirect}
  334. {return}                         go back and compile more lines
  335. -------------------------------------------------------------------------------
  336.                             end compile
  337. -------------------------------------------------------------------------------
  338. {:stt}
  339. {}
  340.  
  341.  
  342.