home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / education / a / marks / !YMarks / !YMarks (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-02-25  |  66KB  |  2,250 lines

  1.  > <YMarks$Dir>.!YMarks 
  2.  Squished by Lofty's !Shrink vsn 3.02 on 25-Feb-94 
  3. &406C2:
  4. " at line: ";
  5. &406C0:
  6. &400EC,-1,-1
  7. progsize%:pagesize%=1<<&A:freespace%=&8000+progsize%:
  8. =freespace%+pagesize%:
  9. =freespace%:
  10. shell_HeapManagerInit("<Obey$Dir>.",freespace%):
  11. shell_Init:task%=
  12. shell_WimpInit_I(&C8,"YMarks"):
  13. shell_ResourcesInit:
  14. app_init
  15. +_closedown%=
  16. :changed%=
  17. shell_Error
  18. &406C1:
  19. shell_Action(
  20. shell_Poll_I(0,task%)):
  21. _closedown%:
  22. shell_Exit:
  23. app_init:
  24. initvar:
  25. SetUp_Menus:
  26. SetUp_Windows:
  27. SetUp_IconBar:
  28. shell_AttachDataLoad(-1,-1,512,"_DataLoad",
  29. shell_AttachDataLoad(mainw%,-1,512,"_DataLoad",
  30. initvar:file$="File":my_filetype%=512:num%=1:C%=0:nums%=-1:
  31. a$(&C8),b$(&C8,16),B$(&C8):text%=
  32. SetUp_Menus:
  33. void%:MenuHandle_IconBar%=
  34. shell_MenuNew(
  35. shell_MessageNoArgs("MTIBar")):MenuItem_Info%=
  36. shell_MenuAdd(0,
  37. shell_MessageNoArgs("Info"),""):void%=
  38. shell_MenuAdd(0,
  39. shell_MessageNoArgs("Quit"),"_MenuSelect_Quit")
  40. shell_AttachMenuDBox(MenuItem_Info%,"progInfo","_PreOpenInfo",""):MenuHandle_Main%=
  41. shell_MenuNew("Main Menu"):MenuItem_Info%=
  42. shell_MenuAdd(0,
  43. shell_MessageNoArgs("Info"),""):MenuItem_save%=
  44. shell_MenuAdd(0,"Save","MenuHandle_save%")
  45. MenuItem_search%=
  46. shell_MenuAdd(0,"Search",""):MenuItem_sort%=
  47. shell_MenuAdd(0,"Sort","MenuHandle_sort%"):void%=
  48. shell_MenuAdd(0,
  49. shell_MessageNoArgs("Quit"),"_MenuSelect_Quit"):
  50. shell_AttachMenuDBox(MenuItem_Info%,"progInfo","_PreOpenInfo","")
  51. MenuHandle_sort%=
  52. shell_MenuNew("Sort"):MenuItem_name%=
  53. shell_MenuAdd(0,"By Name","_sortn"):MenuItem_pos%=
  54. shell_MenuAdd(0,"By Position","_sortp"):MenuHandle_save%=
  55. shell_MenuNew("Save"):MenuItem_tex%=
  56. shell_MenuAdd(0,"Text","_savetex")
  57. MenuItem_tex%=
  58. shell_MenuAdd(0,"CSV","_savecsv"):
  59. shell_CreateWindowStatic("xfer_send",xfer%):
  60. shell_CreateWindowStatic("xfert",xfert%):
  61. shell_CreateWindow("search",search%):
  62. shell_AttachSubMenu(MenuItem_search%,search%,"")
  63. shell_AttachSubMenu(MenuItem_sort%,MenuHandle_sort%,""):
  64. shell_AttachSubMenu(MenuItem_save%,MenuHandle_save%,""):
  65. SetUp_Windows:
  66. shell_CreateWindowStatic("mainw",mainw%):
  67. shell_AttachClickSelect(mainw%,-1,"_ClickSelect_Mainw"):
  68. shell_AttachBumpHandler(mainw%,16,17,18,1,&C8,1,
  69. ,"",""):
  70. shell_AttachMenu(mainw%,-1,MenuHandle_Main%,0,0,0)
  71. shell_AttachClickSelect(search%,-1,"_ClickSelect_Search"):
  72. shell_AttachHotKey("F3",
  73. ,"xfert",xfert%,"",""):
  74. shell_AttachDataSave(xfert%,1,&C8,&FFF,2,"_dosave"):
  75. shell_AttachDataSave(xfer%,3,&C8,&DFE,2,"_dosaveCSV")
  76. shell_IconPutData(xfert%,2,file$,
  77. shell_IconPutData(xfer%,2,file$,
  78. shell_AttachHelpTag(mainw%,A%,"classes"):
  79. shell_AttachHelpTag(mainw%,20,"search"):
  80. shell_AttachHelpTag(mainw%,21,"sortp"):
  81. shell_AttachHelpTag(mainw%,22,"save")
  82. shell_AttachHelpTag(mainw%,23,"print"):
  83. shell_AttachHelpTag(mainw%,24,"sortn"):
  84. SetUp_IconBar:sicon=
  85. shell_Iconbar(-1,"!"+
  86. shell_GetAppName,"",&78,MenuHandle_IconBar%,0,0,0):
  87. shell_AttachHelpTag(-1,sicon,"iconbar"):
  88. shell_AttachClickSelect(-1,sicon,"_ClickSelect_IconBar"):
  89. _PreOpenInfo(wh%):
  90. shell_IconPutData(wh%,1,
  91. shell_MessageNoArgs("progInfo0"),0):
  92. shell_IconPutData(wh%,2,
  93. shell_MessageNoArgs("progInfo1"),0):
  94. shell_IconPutData(wh%,3,
  95. shell_MessageNoArgs("progInfo2"),0)
  96. shell_IconPutData(wh%,4,
  97. shell_MessageNoArgs("progInfo3"),0):=0
  98. _savetex(blk%):
  99. shell_OpenWindowStatic(xfert%):=0
  100. _savecsv(blk%):
  101. shell_OpenWindowStatic(xfer%):=0
  102. _sortn(blk%):
  103. sortn:
  104. redraw:=0
  105. _sortp(blk%):
  106. sortp:
  107. redraw:=0
  108. _ClickSelect_IconBar(wh%,icon%):
  109. shell_OpenWindowStatic(mainw%):=0
  110. _ClickSelect_Mainw(wh%,icon%):
  111. clickmainw:=0
  112. _ClickSelect_Search(wh%,icon%):
  113. clicksearch:=0
  114. _MenuSelect_Quit(blk%):_closedown%=
  115. _dosave(file$):
  116. savefile(file$):=0
  117. _dosaveCSV(file$):
  118. savefilecsv(file$)
  119. _DataLoad(loc%,file%,FileP$,Siz%):
  120. loadfile(FileP$):
  121. shell_OpenWindowStatic(mainw%):=0
  122. loadfile(File$):C%+=1:file$=
  123. shell_Leaf(File$):
  124. &406C0:X=
  125. (File$):
  126. :nums%+=1:
  127. #X,a$(nums%):a$(nums%)=
  128. _swop(a$(nums%)):
  129. #X,b$(nums%,B%):
  130. a$(nums%)="Totals: Test"
  131. nums%>2nums%-=1
  132. a$(nums%)="":nums%-=1:
  133. mean:
  134. NSort:
  135. sortn:
  136. redraw:
  137. shell_IconPutData(xfert%,2,file$,
  138. shell_IconPutData(xfer%,2,file$,
  139. &406C1:
  140. mean:@%=&2020104:
  141. nums%:X%=0:R%=0:H%=0:
  142. &D:R%+=1:
  143. (b$(A%,B%))<0.002
  144.  b$(A%,B%)="0.001":R%-=1:H%=0
  145. (b$(A%,B%))
  146. :X%=X%+H%:
  147. R%<>0b$(A%,&E)=
  148. (X%/R%)
  149. b$(A%,&E)="P"
  150. :@%=&20004:
  151. NSort:Q%=1:
  152. :MAX$="0":
  153. nums%:
  154. (b$(A%,&E))>
  155. (MAX$)
  156. MAX$=b$(A%,&E)
  157. :P%=0:
  158. nums%:
  159. (b$(A%,&E))=
  160. (MAX$)
  161. R@%=&20004:b$(A%,&F)=
  162. (Q%)):@%=&2020104:P%+=1:B$(A%)=b$(A%,&E):b$(A%,&E)="-1"
  163. :Q%=Q%+P%:
  164. Q%>nums%:
  165. nums%:@%=&20004:
  166. b$(A%,&E)>"0"b$(A%,&F)=
  167. (Q%))
  168. b$(A%,&E)=B$(A%):
  169. sortp:
  170. &406C0:
  171. nums%:
  172. (b$(A%,&E))<
  173. (b$(A%+1,&E))
  174. kX$=a$(A%):a$(A%)=a$(A%+1):a$(A%+1)=X$:
  175. &F:b$=b$(A%,B%):b$(A%,B%)=b$(A%+1,B%):b$(A%+1,B%)=b$:f%=
  176. &406C1:
  177. sortn:
  178. nums%:
  179. a$(A%+1)=""a$(A%+1)="ZZ"
  180. a$(A%)>a$(A%+1)
  181. kX$=a$(A%):a$(A%)=a$(A%+1):a$(A%+1)=X$:
  182. &F:b$=b$(A%,B%):b$(A%,B%)=b$(A%+1,B%):b$(A%+1,B%)=b$:
  183. a$(A%)="ZZ"a$(A%)=""
  184. clickmainw:num%=
  185. shell_IconGetData(mainw%,16)):
  186. a$(num%)="ZZ"a$(num%)=""
  187. icon%=23
  188. print
  189. icon%=20
  190. search
  191. icon%=21
  192. sortp
  193. icon%=22
  194. shell_OpenWindowStatic(xfert%)
  195. icon%=24
  196. sortn
  197. redraw:
  198. redraw:
  199. shell_IconPutData(mainw%,2+C%,file$,
  200. _swop(a$(num%)):
  201. shell_IconPutData(mainw%,&A,c$,
  202. shell_IconPutData(mainw%,&D,b$(num%,&E),
  203. shell_IconPutData(mainw%,&E,b$(num%,&F),
  204. print:
  205. "Name                   ",32);"Average              ";"Position";
  206. nums%:
  207. _swop(a$(A%))+"                        ",25);
  208. "   "+b$(A%,&E),4)+"                   ";
  209. b$(A%,&F)+"      ",3);
  210. (&A);
  211. (&D);:
  212. savefile(File$):*FX3,2
  213. "SPOOL "+File$:
  214. "Name                   ",32);"Average              ";"Position";
  215. nums%:
  216. _swop(a$(A%))+"                       ",25);
  217. "   "+b$(A%,&E),4)+"                   ";
  218. b$(A%,&F)+"      ",3);
  219. (&A);:
  220. :*SPOOL
  221. ("SetType "+File$+" &FFF"):*FX3,0
  222. savefilecsv(File$):*FX3,2
  223. "SPOOL "+File$:
  224. """"+"Name"+""""+","+""""+"Average"+""""+","+""""+"Position"+"""":
  225. nums%:
  226. """"+
  227. _swop(a$(A%))+""""+","+""""+b$(A%,&E)+""""+","+""""+b$(A%,&F)+"""":
  228. :*SPOOL
  229. ("SetType "+File$+" &DFE"):*FX3,0
  230. search:
  231. shell_OpenWindowDynamic(search%,1,1):
  232. clicksearch:
  233. sortn:
  234. icon%=0
  235. Bxa$=
  236. shell_IconGetData(search%,2):a$=
  237. _swop(a$):pupil%=
  238. shell_BinarySearch(a$,"_GetTerm","_Comp",1,nums%):
  239. pupil%=-1
  240. shell_IconPutData(mainw%,&A,"No such pupil",
  241. shell_IconPutData(mainw%,&D,"",
  242. shell_IconPutData(mainw%,&E,"",
  243. ):pupil%=num%
  244. _swop(a$(pupil%)):
  245. shell_IconPutData(mainw%,&A,c$,
  246. shell_IconPutData(mainw%,&D,b$(pupil%,&E),
  247. shell_IconPutData(mainw%,&E,b$(pupil%,&F),
  248. shell_IconPutData(mainw%,16,
  249. (pupil%),
  250. ):a$=
  251. _swop(a$)
  252. _GetTerm(D%):=a$(D%)
  253. _Comp(term1$,term2$):
  254. term2$>term1$
  255. _swop(A$):A$=A$+" ":L%=
  256. (A$):
  257. A$,L%-1)+
  258. A$,1):
  259. A$,1)=" ":A$=
  260. A$,L%-1):=A$
  261. shell_IconGetFlags(b%,g%):
  262. j%,a%:a%=
  263. shell_HeapBlockFetch(50):a%!0=b%:a%!4=g%:
  264. &400CE,,a%:j%=a%!24:
  265. shell_HeapBlockReturn(a%):=j%
  266. shell_HeapManagerInit(path$,space%):
  267. heap_code%900:
  268. ("LOAD "+path$+"heapcode "+
  269. ~heap_code%):
  270. heap_code%+0,space%:
  271. shell_Init:
  272. elist%,loop%,temp%,cmdline$:
  273. OSVarBuff%,shell_AppDir$,shell_AppName$:
  274. _U%330,_shell_blk%260:_Q%=
  275. shell_HeapBlockFetch(&BB8):elist%=
  276. shell_HeapBlockFetch(48):elist%!0=0:elist%!4=0:elist%!8=0:elist%!&C=0:elist%!16=0:elist%!20=0:elist%!24=0
  277. elist%!28=0:elist%!32=0:elist%!36=0:elist%!40=0:elist%!44=0:_U%!0=0:_U%!4=0:_U%!8=0:_U%!&C=elist%:_U%!16=1:_U%!20=0:_U%!24=0:_U%!28=0:_U%!32=0:_U%!36=0:_U%!40=0:_U%!44=-1:_U%!48=0:_U%!52=0:_U%!56=0:_U%!60=0:_U%!64=0:_U%!68=0:_U%!72=0
  278. _U%!76=
  279. shell_HeapBlockFetch(256):_U%!80=0:_U%!84=-1:_U%!88=0:_U%!92=0:_U%!96=0:_U%!&64=0:_U%!&68=0:_U%!&6C=-1:_U%!&70=-1:_U%!&74=-1:_U%!&78=-1:_U%!&7C=-1:_U%!&80=0:_U%!&84=0:_U%!&88=-1:_U%!&8C=-1:_U%!&90=-1:_U%!&94=0:_U%!&98=0:_U%!&9C=0:_U%!&A0=0
  280. _U%!&A4=0:_U%!&A8=0:_U%!&AC=0:_U%!&B0=0:_U%!&B4=0:_U%!&B8=0:_U%!&BC=0:_U%!&C0=0:_U%!&C4=0:_U%!&C8=0:_U%!&CC=0:_U%!&D0=-1:_U%!&D4=-1:_U%!&D8=0:_U%!&DC=0:_U%!&E0=0:_U%!&E4=0:_U%!&E8=
  281. shell_HeapBlockFetch(256):_U%!&EC=
  282. shell_HeapBlockFetch(256)
  283. _U%!&F0=-1:_U%!&F4=0:_U%!&F8=0:_U%!&FC=0:_U%!256=0:_U%!260=1:_U%!264=0:_U%!268=0:_U%!272=0:_U%!276=0:_U%!280=0:_U%!284=0:_U%!288=-1:_U%!292=-1:_U%!296=-1:_U%!300=0:_U%!304=0:_U%!308=0:_U%!312=0:_U%!316=0:_U%!320=0:_U%!324=0
  284. shell_MemFill(_U%!&E8,256,0):
  285. shell_MemFill(_U%!&EC,256,0):OSVarBuff%=
  286. shell_HeapBlockFetch(256):shell_AppDir$=
  287. shell_OSVarGetVal(OSVarBuff%,256,"Obey$Dir",1):
  288. shell_HeapBlockReturn(OSVarBuff%):shell_AppName$=
  289. shell_Leaf(shell_AppDir$),2)
  290. _U%!&BC=
  291. shell_HeapBlockFetch((
  292. shell_AppDir$)+1):_U%!&C4=
  293. shell_HeapBlockFetch((
  294. shell_AppName$)+1):temp%=_U%!&BC:$temp%=shell_AppDir$:temp%=_U%!&C4:$temp%=shell_AppName$:cmdline$=
  295. shell_OSReadCommandArg(1):
  296. cmdline$<>""
  297. a_U%!&64=_U%!&64
  298. 1<<5:temp%=
  299. shell_HeapBlockFetch(
  300. cmdline$+1):$(temp%)=cmdline$:_U%!324=temp%
  301. shell_WimpInit_I(Version%,TaskName$):
  302. &400C0,Version%,&4B534154,TaskName$
  303. Version%,Taskid%:_U%!&94=Taskid%:
  304. &81682,Taskid%:=Taskid%
  305. shell_ResourcesInit:
  306. shell_AppDataDir$,temp%,shell_AppName$,shell_AppDir$:
  307. OSVarBuff%,YEigFactor%,XEigFactor%:shell_AppName$=
  308. shell_GetAppName:shell_AppDir$=
  309. shell_GetAppDir:OSVarBuff%=
  310. shell_HeapBlockFetch(256)
  311. shell_OSVarExists(OSVarBuff%,shell_AppName$+"Res$Path")
  312. _U%!&64=_U%!&64
  313. shell_OSVarExists(OSVarBuff%,shell_AppName$+"Data$Dir")
  314. shell_AppDataDir$=
  315. shell_OSVarGetVal(OSVarBuff%,256,shell_AppName$+"Data$Dir",1):_U%!&C0=
  316. shell_HeapBlockFetch((
  317. shell_AppDataDir$)+1):temp%=_U%!&C0:$temp%=shell_AppDataDir$
  318. _U%!&C0=
  319. shell_HeapBlockFetch((
  320. shell_AppDir$)+1):temp%=_U%!&C0:$temp%=shell_AppDir$
  321. _U%!&64
  322. shell_FileExists(shell_AppName$+"Res:Messages")
  323. shell_MessagesInit(shell_AppName$+"Res:Messages",_U%!68,_U%!64)
  324. shell_FileExists(shell_AppName$+"Res:ShellMsgs")
  325. shell_MessagesInit(shell_AppName$+"Res:ShellMsgs",_U%!280,_U%!284)
  326. shell_MessagesInit("ShellSysRes:ShellMsgs",_U%!280,_U%!284)
  327. &20035,-1,4
  328. ,,XEigFactor%:
  329. &20035,-1,5
  330. ,,YEigFactor%:
  331. YEigFactor%=1
  332. shell_FileExists(shell_AppName$+"Res:Sprites22")
  333. @_U%!16=
  334. shell_SpriteAreaLoad(shell_AppName$+"Res:Sprites22")
  335. shell_FileExists(shell_AppName$+"Res:Sprites")
  336. >_U%!16=
  337. shell_SpriteAreaLoad(shell_AppName$+"Res:Sprites")
  338. _U%!16=1
  339. shell_FileExists(shell_AppName$+"Res:Templates")
  340. shell_TemplatesInit(shell_AppName$+"Res:Templates")
  341. shell_FileExists(shell_AppDir$+".Messages")
  342. shell_MessagesInit(shell_AppDir$+".Messages",_U%!68,_U%!64)
  343. shell_FileExists(shell_AppDir$+".ShellMsgs")
  344. shell_MessagesInit(shell_AppDir$+".ShellMsgs",_U%!280,_U%!284)
  345. shell_MessagesInit("ShellSysRes:ShellMsgs",_U%!280,_U%!284)
  346. &20035,-1,4
  347. ,,XEigFactor%:
  348. &20035,-1,5
  349. ,,YEigFactor%:
  350. YEigFactor%=1
  351. shell_FileExists(shell_AppDir$+".Sprites22")
  352. 0<_U%!16=
  353. shell_SpriteAreaLoad(shell_AppDir$+".Sprites22")
  354. shell_FileExists(shell_AppDir$+".Sprites")
  355. 3:_U%!16=
  356. shell_SpriteAreaLoad(shell_AppDir$+".Sprites")
  357. _U%!16=1
  358. shell_FileExists(shell_AppDir$+".Templates")
  359. shell_TemplatesInit(shell_AppDir$+".Templates")
  360. &45BC0:
  361. shell_HeapBlockReturn(_Q%):_Q%=
  362. shell_HeapBlockFetch(&400):
  363. shell_HeapBlockReturn(OSVarBuff%):
  364. shell_Error:
  365. pos%,report$:
  366. <>&D00
  367. <>&903
  368. &606C2:
  369. shell_OSCheckVersion(3)
  370. shell_FileExists("Resources:$.Resources.Edit.ThrowBack")
  371. shell_Exit:
  372. ("Set Basic$File <"+
  373. shell_GetAppName+"$BasicFile>"):
  374. "Edit:ThrowBack"
  375. shell_ErrorBox("Unexpected error:- "+
  376. $+" Internal error code "+
  377. pos%=
  378. $,"in "+
  379. 34+"EvntShellSystem:ShellLib"):
  380. pos%>0
  381. report$=
  382. $,pos%-1)
  383. shell_ErrorBox(report$)
  384. &606C2:
  385. shell_Action(evnt%):
  386. fn$,menu%,menu$,select$,menu_buffer%,mx%,my%,claimed%:
  387. wh%,ih%,void%,_temp28%,_temp32%,_temp24%,_temp%,fontmenuflag%:
  388. CheckSelect%,offset%:
  389. evnt%
  390. shell_RedrawWindow(_Q%!0)
  391. shell_OpenWindow(_Q%!0,
  392. shell_CloseWindow(_Q%!0)
  393. 6:_U%!28=_Q%!&C:_U%!32=_Q%!16:mx%=_Q%!0:my%=_Q%!4:_U%!272=_Q%!0:_U%!276=_Q%!4:_U%!320=_Q%!8:_temp28%=_Q%!&C:_temp32%=_Q%!16:ih%=_Q%!16:
  394. _Q%!&C=_U%!288
  395. _Q%!16=_U%!292
  396. shell_HandleBumpIcons(_U%!296,_Q%!&C,_Q%!16,_Q%!8)
  397. _U%!288=-1:_U%!292=-1:_U%!296=-1:
  398. _Q%!16>=0
  399. offset%=
  400. shell_GetEventListOffset(_Q%!&C,_Q%!16,_U%+&68,16,0):
  401. offset%>=0
  402. shell_HandleBumpIcons(offset%,_Q%!&C,_Q%!16,_Q%!8)
  403. (_Q%!8=64)
  404. t;result%=
  405. shell_IconIsDraggable(_Q%!&C,_Q%!16):
  406. result%
  407. v?mess$="Icon is draggable":
  408. shell_IconDragBox(_Q%!&C,_Q%!16)
  409. mess$="Icon is not draggable"
  410. shell_Tracef0("Action:"+mess$)
  411. _Q%!8
  412. shell_ActionSelectButton
  413. shell_ActionMenuButton
  414. shell_ActionAdjustButton
  415. _U%!&64
  416. &42401:_U%!&64=_U%!&64
  417. :_U%!&80=0:fn$=
  418. shell_GetEventHandler(_U%!28,_U%!32,6):
  419. fn$<>""
  420. shell_Tracef0("Action:Drag event detected - function is "+fn$):void%=
  421. ("FN"+fn$+"(_temp28%,_temp32%)")
  422. shell_Tracef0("Action:Drag event detected - no handler function"):
  423. shell_SendDataSave(_U%!28,_U%!32)
  424. shell_Tracef0("Action:keypress is="+
  425. _Q%!24):
  426. _Q%!24
  427. &D,394,398,399,410:claimed%=
  428. shell_WritableIconHandler(_Q%!0,_Q%!4,_Q%!24)
  429. claimed%=
  430. shell_HotKeyProcess(_Q%!24)
  431. claimed%
  432. shell_Tracef0("Action:Keypress not claimed, passing it on"):
  433. &400DC,_Q%!24
  434. shell_Tracef0("Action:Keypress claimed by this application")
  435. shell_ActionMenuSelect(_Q%)
  436. 17,18:
  437. shell_Receive(_Q%)
  438. shell_UserMessageAcknowledge(_Q%)
  439. shell_Poll_I(mask%,task%):
  440. &400C7,mask%,_Q%
  441. &81686,a%,,task%:=a%
  442. shell_Exit:
  443. ms_desc%:ms_desc%=_U%!68:
  444. &61504,ms_desc%:
  445. &2001E,7,,ms_desc%:
  446. shell_TraceExit:
  447. &606C2:
  448. &600D0,,-1:
  449. shell_WimpCloseDown_I(_U%!&94):
  450. shell_AttachDataLoad(wh%,ih%,type%,fn$,no_load%):
  451. blk%,temp%,offset%,cmdline$:
  452. shell_Tracef0("AttachDataLoad:Attaching DataLoad Handler"):
  453. wh%=-1
  454. wh%=-2
  455. no_load%
  456. type%=type%
  457. 1<<31
  458. boffset%=
  459. shell_GetEventListOffset(wh%,ih%,_U%+96,16,
  460. ):blk%=_U%!96+offset%:
  461. blk%!0=0
  462. blk%!4=0
  463. shell_Tracef0("AttachDataLoad:This is the first DataLoad Event..."):blk%!0=wh%:blk%!4=ih%:blk%!8=
  464. shell_HeapBlockFetch(8):temp%=blk%!8:temp%!0=type%:temp%!4=-1:blk%!&C=
  465. shell_HeapBlockFetch(8):temp%=blk%!&C:temp%!0=
  466. shell_HeapBlockFetch(
  467. (fn$)+1)
  468. 'temp%!4=-1:temp%=temp%!0:$temp%=fn$
  469. shell_Tracef0("AttachDataLoad:This is another DataLoad Event..."):blk%!8=
  470. shell_HeapBlockExtend(blk%!8,4):blk%!&C=
  471. shell_HeapBlockExtend(blk%!&C,4):ctr%=0:temp%=blk%!8:
  472. temp%!ctr%<>-1:ctr%+=4:
  473. :temp%!ctr%=type%:temp%!(ctr%+4)=-1:temp%=blk%!&C
  474. Htemp%!ctr%=
  475. shell_HeapBlockFetch(
  476. fn$+1):temp%=temp%!ctr%:$temp%=fn$
  477. :cmdline$=
  478. shell_GetCmdLineArgs:
  479. cmdline$<>""
  480. wh%<0
  481. (_U%!&64
  482. 1<<5)
  483. type%
  484. 1<<31
  485. temp%=type%
  486. 1<<31
  487. temp%=type%
  488. shell_FileType(cmdline$)=temp%
  489. shell_MessageSendDataLoad(temp%,cmdline$):_U%!&64=_U%!&64
  490. (1<<5)
  491. shell_MenuNew(title$):
  492. handle%:
  493. &45BC1,,title$
  494. handle%:=handle%
  495. shell_MessageNoArgs(tag$):=
  496. shell_MessageLookup(tag$,"","")
  497. shell_MenuAdd(handle%,item$,sel_fn$):
  498. ret_handle%:
  499. sel_fn$<>""
  500. &45BC2,handle%,item$,sel_fn$
  501. ret_handle%
  502. &45BC2,handle%,item$
  503. ret_handle%
  504. :=ret_handle%
  505. shell_AttachMenuDBox(item%,window$,preopenfn$,postopenfn$):
  506. blk%,temp%,addr%:
  507. shell_WindowLoaded(window$)
  508. shell_MessageOneArg("SHELLMSG03",window$)
  509. blk%=
  510. shell_HeapBlockFetch(&C):blk%!0=
  511. shell_HeapBlockFetch(
  512. window$+1):temp%=blk%!0:$temp%=window$:blk%!4=
  513. shell_HeapBlockFetch(
  514. preopenfn$+1):temp%=blk%!4:$temp%=preopenfn$:blk%!8=
  515. shell_HeapBlockFetch(
  516. postopenfn$+1):temp%=blk%!8:$temp%=postopenfn$
  517. &45BCE,item%,blk%:
  518. &45BCC,,
  519. shell_CreateWindowStatic(ident$,
  520. handle%):
  521. wb_ptr%,w_list%,temp%,offset%:wb_ptr%=
  522. shell_GetWB(ident$):wb_ptr%!64=_U%!16:
  523. &400C1,,wb_ptr%
  524. handle%:w_list%=_U%!&B8:
  525. w_list%=0
  526. !S_U%!&B8=
  527. shell_HeapBlockFetch(8):w_list%=_U%!&B8:w_list%!0=handle%:w_list%!4=-1
  528. offset%=
  529. shell_SearchStatic(_U%!&B8,handle%):
  530. offset%=-1
  531. )7offset%=
  532. shell_SearchStatic(_U%!&B8,0):
  533. offset%=-1
  534. +actr%=0:
  535. w_list%!ctr%<>-1:ctr%+=4:
  536. :_U%!&B8=
  537. shell_HeapBlockExtend(_U%!&B8,4):w_list%=_U%!&B8
  538. ctr%=offset%
  539. :temp%=w_list%+ctr%:temp%!0=handle%:temp%!4=-1
  540. shell_CreateWindow(ident$,
  541. handle%):
  542. wb_ptr%:wb_ptr%=
  543. shell_GetWB(ident$):wb_ptr%!64=_U%!16:
  544. &400C1,,wb_ptr%
  545. handle%:
  546. shell_AttachSubMenu(item%,submenu%,warn_fn$):
  547. &45BCE,item%,submenu%:
  548. warn_fn$<>""
  549. &45BCC,,
  550. shell_EventListMenuWarn(item%,submenu%,warn_fn$,"")
  551. shell_AttachClickSelect(wh%,ic%,fn$):
  552. shell_EventAdd(wh%,ic%,2,0,fn$):
  553. shell_AttachBumpHandler(wh%,ih%,incr%,decr%,l_limit%,u_limit%,step%,wrap%,disp_fn$,decode_fn$):
  554. e_blk%,offset%,temp%,temp2%,bump_info_blk%:offset%=
  555. shell_GetEventListOffset(wh%,incr%,_U%+&68,16,
  556. ):e_blk%=_U%!&68+offset%
  557. e_blk%!0=wh%:e_blk%!4=incr%:e_blk%!8=step%:e_blk%!&C=
  558. shell_HeapBlockFetch(24):bump_info_blk%=e_blk%!&C:bump_info_blk%!0=ih%:bump_info_blk%!4=l_limit%:bump_info_blk%!8=u_limit%:
  559. disp_fn$>0
  560. ldbump_info_blk%!&C=
  561. shell_HeapBlockFetch((
  562. disp_fn$)+1):temp2%=bump_info_blk%!&C:$temp2%=disp_fn$
  563. bump_info_blk%!&C=0
  564. decode_fn$>0
  565. rhbump_info_blk%!16=
  566. shell_HeapBlockFetch((
  567. decode_fn$)+1):temp2%=bump_info_blk%!16:$temp2%=decode_fn$
  568. bump_info_blk%!16=0
  569. wrap%=-1
  570. bump_info_blk%!20=1
  571. bump_info_blk%!20=0
  572. offset%=
  573. shell_GetEventListOffset(wh%,decr%,_U%+&68,16,
  574. ):e_blk%=_U%!&68+offset%:e_blk%!0=wh%:e_blk%!4=decr%:e_blk%!8=step%*(-1):e_blk%!&C=bump_info_blk%:
  575. shell_AttachMenu(wh%,ic%,menu%,shift%,ctrl%,alt%):
  576. offset%:
  577. wh%>0
  578. ic%>=0
  579. shell_IconSetButtonType(wh%,ic%,3)
  580. shell_EventAdd(wh%,ic%,0,menu%,""):
  581. shell_AttachHotKey(key$,shift%,ctrl%,alt%,window$,wh%,fn1$,fn2$):
  582. e_list%,offset%,temp%,temp2%,key%,f_key%:f_key%=
  583. _U%!60=0
  584. 8_U%!60=
  585. shell_HeapBlockFetch(24):offset%=0:_U%!&B4=1
  586. offset%=_U%!&B4*24:_U%!60=
  587. shell_HeapBlockExtend(_U%!60,24):_U%!&B4=(_U%!&B4)+1
  588. :e_list%=_U%!60:
  589. "F1":key%=385
  590. "F2":key%=386
  591. "F3":key%=387
  592. "F4":key%=388
  593. "F5":key%=389
  594. "F6":key%=390
  595. "F7":key%=391
  596. "F8":key%=392
  597. "F9":key%=393
  598. "F10":key%=458
  599. "F11":key%=459
  600. key%=(
  601. key$)-64:f_key%=
  602. f_key%
  603. shift%
  604. key%+=16
  605. ctrl%
  606. key%+=32
  607. :temp%=e_list%+offset%:temp%!0=key%:temp%?4=shift%:temp%?5=ctrl%:temp%?6=alt%:temp%!8=
  608. shell_HeapBlockFetch(
  609. window$+1):temp2%=temp%!8:$temp2%=window$:
  610. wh%>0
  611. _offset%=
  612. shell_SearchStatic(_U%!&B8,wh%):
  613. offset%=-1
  614. shell_MessageNoArgs("SHELLMSG09")
  615. :temp%!&C=wh%:temp%!16=
  616. shell_HeapBlockFetch(
  617. fn1$+1):temp2%=temp%!16:$temp2%=fn1$:temp%!20=
  618. shell_HeapBlockFetch(
  619. fn2$+1):temp2%=temp%!20:$temp2%=fn2$:
  620. shell_AttachDataSave(wh%,ih%,address%,type%,name_ic%,fn$):
  621. blk%,temp%,offset%:
  622. shell_IconIsSprite(wh%,ih%)
  623. shell_OK(
  624. shell_MessageNoArgs("SHELLMSG29"))
  625. shell_IconSetButtonType(wh%,ih%,6):
  626. address%=0
  627. address%=&64
  628. offset%=
  629. shell_GetEventListOffset(wh%,ih%,_U%+72,24,
  630. ):blk%=_U%!72+offset%:blk%!0=wh%:blk%!4=ih%:blk%!8=address%:blk%!&C=type%:blk%!16=name_ic%:blk%!20=
  631. shell_HeapBlockFetch(
  632. (fn$)+1):temp%=blk%!20:$temp%=fn$:
  633. type%
  634. &FF9:
  635. address%>&8000
  636. ,_U%!&88=
  637. shell_HeapBlockInfo(address%)-8
  638. _U%!&88=address%
  639. address%>&8000
  640. ,_U%!&88=
  641. shell_HeapBlockInfo(address%)-4
  642. _U%!&88=address%
  643. :_U%!&8C=type%:_U%!&90=address%:
  644. shell_IconPutData(whandle%,ihandle%,data$,redraw):
  645. blk%,old_str$:old_str$=
  646. shell_IconGetData(whandle%,ihandle%):
  647. data$<>old_str$
  648. gblk%=
  649. shell_HeapBlockFetch(40):blk%!0=whandle%:blk%!4=ihandle%:
  650. &400CE,,blk%:
  651. (blk%!24
  652. (1<<8))<>0
  653. data$>blk%!36
  654. shell_MessageNoArgs("SHELLMSG12")
  655. $(blk%!28)=data$
  656. $(blk%+28)=
  657. data$,&B)
  658. redraw<>0
  659. %blk%!8=0:blk%!&C=0:
  660. &400CD,,blk%
  661. shell_HeapBlockReturn(blk%)
  662. shell_AttachHelpTag(wh%,ic%,tag$):
  663. shell_EventAdd(wh%,ic%,8,0,tag$):
  664. shell_Iconbar(pos%,sname$,text$,w%,menu%,shift%,ctrl%,alt%):
  665. handle%:
  666. text$=""
  667. O!_Q%=pos%:_Q%!4=0:_Q%!8=0:_Q%!&C=70:_Q%!16=70:_Q%!20=&301A:$(_Q%+24)=sname$
  668. !_Q%=pos%:_Q%!4=0:_Q%!8=-16:_Q%!&C=w%:_Q%!16=90:_Q%!20=&1700210B:
  669. _Q%!24&C:
  670. _Q%!28
  671. (sname$)+2:$(_Q%!24)=text$:$(_Q%!28)="S"+sname$:_Q%!32=&C
  672. &400C2,,_Q%
  673. handle%:
  674. shell_AttachMenu(-2,handle%,menu%,shift%,ctrl%,alt%):=handle%
  675. shell_GetAppName:
  676. temp%:temp%=_U%!&C4:=$temp%
  677. shell_OpenWindowStatic(handle%):
  678. shell_SearchStatic(_U%!&B8,handle%)>-1
  679. shell_OpenWindow(handle%,0,-1)
  680. shell_Leaf(path$):
  681. path$,"."):path$=
  682. path$,
  683. path$,".")+1):
  684. :=path$
  685. shell_IconGetData(whandle%,ihandle%):
  686. result$,icon_blk%:icon_blk%=
  687. shell_HeapBlockFetch(40):icon_blk%!0=whandle%:icon_blk%!4=ihandle%:
  688. &400CE,,icon_blk%:
  689. (icon_blk%!24
  690. (1<<8))<>0
  691. result$=$(icon_blk%!28)
  692. result$=$(icon_blk%+28)
  693. shell_HeapBlockReturn(icon_blk%):=result$
  694. shell_OpenWindowDynamic(wh%,x_off%,y_off%):
  695. void%,ptr_blk%:ptr_blk%=
  696. shell_HeapBlockFetch(20):_U%!20=wh%:
  697. &400CF,,ptr_blk%:
  698. &400D4,,wh%,ptr_blk%!0+x_off%,ptr_blk%!4+y_off%:
  699. shell_HeapBlockReturn(ptr_blk%):
  700. shell_BinarySearch(_search_term$,get_termFN$,comp_FN$,lo%,hi%):
  701. _pos%,m%,_wp$,off%,p%,hipos%,lopos%,lp2%,found%,missing%:hi%+=1:missing%=
  702. :found%=
  703. :m%=hi%:off%=0:_pos%=m%
  704. 2:lopos%=lo%-1:hipos%=hi%:
  705. :_wp$=
  706. ("FN"+get_termFN$+"(_pos%)"):lastpos%=_pos%
  707. _search_term$=_wp$
  708. found%=
  709. ("FN"+comp_FN$+"(_search_term$,_wp$)")
  710. @0hipos%=_pos%:m%=_pos%-lopos%:_pos%=m%
  711. 2+off%
  712. lopos%=_pos%:off%=_pos%:m%=hipos%-_pos%:_pos%=m%
  713. 2+off%
  714. lp2%=lastpos%
  715. missing%=
  716. L9lp2%=lastpos%:
  717. found%
  718. missing%:
  719. found%
  720. =lastpos%
  721. shell_HeapBlockFetch(a%):
  722. addr%:
  723. heap_code%+4,addr%,a%:=addr%
  724. shell_MemFill(start%,nr_bytes%,value%):
  725. I%,nr_words%,remainder%:nr_words%=nr_bytes%
  726. 4:remainder%=nr_bytes%
  727. nr_words%>0
  728. (nr_words%*4)
  729. 4:start%!(I%-1)=value%:
  730. remainder%>0
  731. ^Gstart%=start%+(nr_words%*4):
  732. remainder%-1:start%?I%=value%:
  733. shell_OSVarGetVal(buffer%,size%,varname$,expand):
  734. value$,nr_bytes,nameptr%:
  735. &20023,varname$,buffer%,size%,0,-3*(expand=
  736. ,,nr_bytes,nameptr%,type%:
  737. loop%=0
  738. nr_bytes-1:value$=value$+
  739. (buffer%?loop%):
  740. loop%:=value$
  741. shell_HeapBlockReturn(
  742. shell_HeapBlockExists(a%)
  743. heap_code%+8,a%
  744. a%=0:
  745. shell_OSReadCommandArg(opt):
  746. pointer%,command$,offset%:command$="":offset%=0:
  747. pointer%:
  748. pointer%?offset%<>0:command$+=
  749. (pointer%?offset%):offset%+=1:
  750. 1:command$=
  751. command$,
  752. command$,
  753. 34)+1):command$=
  754. command$,
  755. command$,
  756. 34)+2)
  757. :=command$
  758. shell_GetAppDir:
  759. temp%:temp%=_U%!&BC:=$temp%
  760. shell_OSVarExists(buffer%,varname$):
  761. nr_bytes:
  762. &20023,varname$,buffer%,-1,0,0
  763. ,,nr_bytes:
  764. nr_bytes<0
  765. shell_FileExists(object$):
  766. shell_CatInfoRead(object$)="Not Found":=
  767. shell_MessagesInit(filename$,
  768. m_filedesc%,
  769. m_buffer%):
  770. size%,flags%:
  771. 3,"Cannot open message file '"+filename$+"'"
  772. &41500,,filename$
  773. flags%,,size%:
  774. flags%
  775. m_buffer%=0
  776. m_buffer%=
  777. shell_HeapBlockFetch(size%)
  778. 30,6,,,17+
  779. (filename$)
  780. ,,m_filedesc%:$(m_filedesc%+16)=filename$:
  781. &41501,m_filedesc%,m_filedesc%+16:
  782. shell_SpriteAreaLoad(filename$):
  783. sp%,S%,T%:S%=
  784. (filename$):T%=
  785. #S%+16:
  786. #S%:sp%=
  787. shell_HeapBlockFetch(T%):!sp%=T%:sp%!4=0:sp%!8=16:sp%!&C=16:
  788. 46,521,sp%:
  789. 46,522,sp%,filename$:=sp%
  790. shell_TemplatesInit(filename$):
  791. TemplatePtr%,IndirectPtr%,IndirectEnd%,X%,ptr%:
  792. filelen%,pos%,name_buffer%,name$,nr_templates%:
  793. file_offset%,data_size%,entry_type%,char%,identifier$,buff%:
  794. indirected_size%,nr_icons%,total_indirsize%,j%,largest_def%
  795. name_buffer%20:
  796. (name_buffer%
  797. 4):name_buffer%+=1:
  798. :pos%=0:nr_templates%=0:total_indirsize%=0:largest_def%=0:filelen%=
  799. shell_FileLength(filename$):buff%=
  800. shell_HeapBlockFetch(&D):X%=
  801. (filename$):
  802. #X%=16:
  803. :identifier$="":
  804. &C,4,X%,buff%,4
  805. gfile_offset%=!buff%:
  806. shell_Tracef0("TemplatesInit:file offset%  = "+
  807. file_offset%):
  808. file_offset%>0
  809. nr_templates%+=1:indirected_size%=0:
  810. &C,4,X%,buff%,4:data_size%=!buff%:
  811. shell_Tracef0("TemplatesInit:data_size% = "+
  812. data_size%):
  813. &C,4,X%,buff%,4:entry_type%=!buff%:
  814. &C,4,X%,buff%,&C:ctr%=0:
  815. :char%=buff%?ctr%:
  816. char%>31
  817. identifier$+=
  818. char%
  819. ctr%+=1:
  820. char%<32:old_ptr%=
  821. #X%=file_offset%+56:
  822. &C,4,X%,buff%,4:flags%=!buff%:
  823. #X%=file_offset%+72:
  824. &C,4,X%,buff%,&C:indirected_size%+=
  825. shell_IconIndirSize(file_offset%,flags%,buff%):
  826. #X%=file_offset%+84:
  827. &C,4,X%,buff%,4:nr_icons%=!buff%
  828. shell_Tracef0("TemplatesInit:nr icons        = "+
  829. nr_icons%):
  830. nr_icons%>0
  831. nr_icons%-1:
  832. #X%=file_offset%+88+(j%*32)+16:
  833. &C,4,X%,buff%,4:flags%=!buff%:
  834. #X%=file_offset%+88+(j%*32)+20:
  835. &C,4,X%,buff%,&C:indirected_size%+=
  836. shell_IconIndirSize(file_offset%,flags%,buff%):
  837. #X%=old_ptr%:
  838. shell_Tracef0("TemplatesInit:entry_type%     = "+
  839. entry_type%):
  840. shell_Tracef0("TemplatesInit:identifier$     = "+identifier$):
  841. shell_Tracef0("TemplatesInit:indirected size = "+
  842. indirected_size%):
  843. shell_Tracef0(" ")
  844. itotal_indirsize%+=indirected_size%:
  845. (88+(nr_icons%*32))>largest_def%
  846. largest_def%=(88+(nr_icons%*32))
  847. file_offset%=0:
  848. shell_HeapBlockReturn(buff%):
  849. shell_Tracef0("TemplatesInit:total indirected= "+
  850. total_indirsize%):TemplateBlk%=
  851. shell_HeapBlockFetch(filelen%):TemplatePtr%=TemplateBlk%:_U%!4=
  852. shell_HeapBlockFetch(20*nr_templates%)
  853. IndirectBlk%=
  854. shell_HeapBlockFetch(largest_def%+total_indirsize%):IndirectPtr%=IndirectBlk%:IndirectEnd%=IndirectBlk%+(largest_def%+total_indirsize%):nr_templates%=0:
  855. &400D9,,filename$:
  856. :$name_buffer%="*"
  857. &400DB,,TemplatePtr%,IndirectPtr%,IndirectEnd%,_U%!&E8,name_buffer%,pos%
  858. ,,IndirectPtr%,,,name$,pos%:
  859. pos%<>0
  860. !((_U%!4)+(16*nr_templates%))=TemplatePtr%:$(((_U%!4)+(16*nr_templates%))+4)=name$:TemplatePtr%+=(88+(TemplatePtr%!84)*32):nr_templates%+=1
  861. pos%=0:
  862. &400DA:_U%!0=nr_templates%:
  863. shell_OSCheckVersion(version%):=
  864. shell_OSModuleCheckVersion("UtilityModule",version%)
  865. shell_ErrorBox(r$):
  866. r%,err_blk%:err_blk%=_shell_blk%:!err_blk%=
  867. :$(err_blk%+4)=r$+
  868. =&D00
  869. =&903
  870. &600DF,err_blk%,17,"Message from "+
  871. shell_GetAppName
  872. &600DF,err_blk%,1,
  873. shell_GetAppName
  874. shell_RedrawWindow(handle%):
  875. more%,fn$,x0%,y0%,blk%,i_blk%:i_blk%=
  876. shell_HeapBlockFetch(&C):
  877. &400D6,handle%,i_blk%,&3F0000,&D<<16:
  878. !i_blk%<>-1
  879. +fn$=
  880. shell_IconGetData(handle%,!i_blk%)
  881. shell_HeapBlockReturn(i_blk%):blk%=
  882. shell_HeapBlockFetch(&64):
  883. fn$=""
  884. $,fn$=
  885. shell_GetEventHandler(handle%,-1,4)
  886. :blk%!0=handle%:
  887. &400C8,,blk%
  888. more%:x0%=blk%!4-blk%!20:y0%=blk%!16-blk%!24:
  889. more%:
  890. &81681,,blk%:
  891. fn$<>""
  892. void%=
  893. ("FN"+fn$+"("+
  894. blk%+","+
  895. x0%+","+
  896. y0%+")")
  897. &400CA,,blk%
  898. more%:
  899. shell_HeapBlockReturn(blk%):
  900. shell_OpenWindow(wh%,full%,front%):
  901. offset%,blk%,paneblk%,ctr%,first_pane%,behind%,height%,width%:
  902. flag%,toggle%,t%,last_pane%,prev_pane%,res%:offset%=
  903. shell_GetEventListOffset(wh%,-1,_U%+304,&C,
  904. offset%>=0
  905. 6Cblk%=_U%!304+offset%:temp%=blk%!8:res%=
  906. ("FN"+$temp%):
  907. res%=0
  908. :toggle%=
  909. shell_HeapBlockFetch(&64):t%!0=wh%:
  910. &400CB,,t%:
  911. (t%!32
  912. &80000)=&80000
  913. toggle%=
  914. toggle%=
  915. shell_HeapBlockReturn(t%):_Q%!0=wh%:
  916. full%
  917. &400CB,,_Q%
  918. toggle%
  919. &400C5,,_Q%
  920. :offset%=
  921. shell_GetEventListOffset(wh%,-1,_U%+92,24,
  922. offset%>-1
  923. blk%=(_U%!92)+offset%:ptr8%=blk%!8:ptr12%=blk%!&C:ptr16%=blk%!16:ptr20%=blk%!20:_Q%!0=wh%:
  924. front%
  925. behind%=-1
  926. behind%=_Q%!28
  927. full%
  928. &400C5,,_Q%:
  929. &400CB,,_Q%:
  930. &400C6,,_Q%
  931. :paneblk%=
  932. shell_HeapBlockFetch(&400):ctr%=0:
  933. ptr8%!ctr%<>-1:paneblk%!0=ptr8%!ctr%:
  934. first_pane%=0
  935. first_pane%=paneblk%!0
  936. WGlast_pane%=paneblk%!0:
  937. &400CB,,paneblk%:flag%=ptr12%!ctr%:
  938. flag%
  939. 0,1:height%=paneblk%!16-paneblk%!8:width%=paneblk%!&C-paneblk%!4:paneblk%!4=_Q%!4+ptr16%!ctr%:paneblk%!&C=paneblk%!4+width%:paneblk%!16=_Q%!16+ptr20%!ctr%:paneblk%!8=paneblk%!16-height%
  940. 2:height%=paneblk%!16-paneblk%!8:width%=_Q%!&C-_Q%!4:paneblk%!4=_Q%!4+ptr16%!ctr%:paneblk%!&C=_Q%!&C:paneblk%!16=_Q%!16+ptr20%!ctr%:paneblk%!8=paneblk%!16-height%
  941. 3:height%=_Q%!16-_Q%!8:width%=paneblk%!&C-paneblk%!4:paneblk%!4=_Q%!4+ptr16%!ctr%:paneblk%!&C=paneblk%!4+width%:paneblk%!16=_Q%!16:paneblk%!8=_Q%!8+ptr20%!ctr%
  942. 4:height%=paneblk%!16-paneblk%!8:width%=_Q%!&C-_Q%!4:paneblk%!4=_Q%!4+ptr16%!ctr%:paneblk%!&C=_Q%!&C:paneblk%!16=_Q%!8+height%+ptr20%!ctr%:paneblk%!8=paneblk%!16+height%
  943. 5:height%=_Q%!16-_Q%!8:width%=paneblk%!&C-paneblk%!4:paneblk%!4=_Q%!&C-width%+ptr16%!ctr%:paneblk%!&C=paneblk%!4+width%:paneblk%!16=_Q%!16:paneblk%!8=_Q%!8
  944. ctr%=0
  945. paneblk%!28=behind%
  946. paneblk%!28=prev_pane%
  947. &400C5,,paneblk%:prev_pane%=paneblk%!0:ctr%+=4:
  948. toggle%
  949. #_Q%!28=last_pane%:
  950. &400C5,,_Q%
  951. shell_HeapBlockReturn(paneblk%)
  952. _Q%!0=wh%:
  953. full%
  954. &400CB,,_Q%
  955. behind%=-2
  956. _Q%!28=-2
  957. front%=-1
  958. _Q%!28=-1
  959. &400C5,,_Q%
  960. shell_CloseWindow(wh%):
  961. offset%,blk%,ptr8%,ptr12%,ptr16%,ptr20%,win_blk%,res%:offset%=
  962. shell_GetEventListOffset(wh%,-1,_U%+308,&C,
  963. offset%>=0
  964. Cblk%=_U%!308+offset%:temp%=blk%!8:res%=
  965. ("FN"+$temp%):
  966. res%=0
  967. :win_blk%=
  968. shell_HeapBlockFetch(60):
  969. wh%>0
  970. Foffset%=
  971. shell_GetEventListOffset(wh%,-1,_U%+92,24,
  972. offset%>-1
  973. blk%=(_U%!92)+offset%:ptr12%=blk%!&C:ptr16%=blk%!16:ptr20%=blk%!20:ctr%=0:ptr8%=blk%!8:
  974. ptr8%!ctr%<>-1:win_blk%!0=ptr8%!ctr%:
  975. &400C6,,win_blk%:ctr%+=4:
  976. :win_blk%!0=wh%:
  977. &400C6,,win_blk%
  978. shell_HeapBlockReturn(win_blk%):
  979. shell_HandleBumpIcons(offset%,wh%,ih%,_button%):
  980. display_ih%,info_blk%,e_blk%,curr_val%,_temp$,fn2%:
  981. new_val%,fn%:
  982. _button%<>2
  983. re_blk%=_U%!&68+offset%:_U%!288=wh%:_U%!292=ih%:_U%!296=offset%:info_blk%=e_blk%!&C:fn2%=info_blk%!16:
  984. fn2%<>0
  985. Q_temp$=
  986. shell_IconGetData(wh%,info_blk%!0):curr_val%=
  987. ("FN"+$fn2%+"(_temp$)")
  988. curr_val%=
  989. shell_IconGetData(wh%,info_blk%!0))
  990. _button%=1
  991. )_new_val%=curr_val%+((e_blk%!8)*(-1))
  992. _new_val%=curr_val%+e_blk%!8
  993. info_blk%!20=0
  994. _new_val%>info_blk%!8
  995. _new_val%=info_blk%!8
  996. _new_val%<info_blk%!4
  997. _new_val%=info_blk%!4
  998. _new_val%>info_blk%!8
  999. _new_val%=info_blk%!4
  1000. _new_val%<info_blk%!4
  1001. _new_val%=info_blk%!8
  1002. :fn%=info_blk%!&C:
  1003. fn%<>0
  1004. 1_new_val$=
  1005. ("FN"+$fn%+"(_new_val%,_button%)")
  1006. _new_val$=
  1007. _new_val%
  1008. _new_val%<>curr_val%
  1009. shell_IconPutData(wh%,info_blk%!0,_new_val$,-1)
  1010. shell_GetEventListOffset(wh%,ih%,event_list%,rec_size%,add%):
  1011. list_size%,ptr%,found%,offset%,empty%,temp%:
  1012. (!event_list%=0
  1013. add%=
  1014. (!event_list%=0)
  1015. [!event_list%=
  1016. shell_HeapBlockFetch(rec_size%):temp%=!event_list%:temp%!0=0:temp%!4=0:=0
  1017. :list_size%=
  1018. shell_HeapBlockInfo(!event_list%)-8:ptr%=0:found%=
  1019. :offset%=-1:empty%=-1:temp%=!event_list%:
  1020. empty%<0
  1021. (temp%!ptr%=0
  1022. temp%!ptr%+4=0)
  1023. empty%=ptr%
  1024. (temp%!ptr%=wh%)
  1025. ih%=-1
  1026. offset%=ptr%:found%=
  1027. temp%!(ptr%+4)=ih%
  1028. offset%=ptr%:found%=
  1029. ptr%+=rec_size%
  1030. ptr%+=rec_size%
  1031. ((ptr%>=list_size%)
  1032. found%):
  1033. found%
  1034. (offset%=-1
  1035. add%)
  1036. empty%<0
  1037. offset%=list_size%:!event_list%=
  1038. shell_HeapBlockExtend(!event_list%,rec_size%):temp%=!event_list%:temp%+=offset%:temp%!0=0:temp%!4=0
  1039. offset%=empty%
  1040. :=offset%
  1041. shell_IconIsDraggable(wh%,ih%):
  1042. flags%:flags%=
  1043. shell_IconGetFlags(wh%,ih%):temp%=(flags%
  1044. &6000):
  1045. temp%=&6000=
  1046. shell_IconDragBox(wh%,ih%):
  1047. blk%,wex,wey,e_offset%,flags%,f%,DragASprite%,spr_area%,valid%,spr$:
  1048. name_ic%,name$:e_offset%=
  1049. shell_GetEventListOffset(wh%,ih%,_U%+72,24,
  1050. e_offset%>=0
  1051. blk%=_U%!72+e_offset%:name_ic%=blk%!16:name$=
  1052. shell_IconGetData(wh%,name_ic%):
  1053. name$=""
  1054. shell_OK(
  1055. shell_MessageNoArgs("SHELLMSG28"))
  1056. blk%=
  1057. shell_HeapBlockFetch(6000):!blk%=wh%:
  1058. &400CC,,blk%:wex=blk%!4-blk%!20:wey=blk%!16-blk%!24:spr_area%=blk%!68:blk%!4=ih%:
  1059. &400CE,,blk%:!blk%=wh%:blk%!4=5:flags%=blk%!24:valid%=blk%!32:blk%!8=blk%!8+wex:blk%!&C=blk%!&C+wey:blk%!16=blk%!16+wex
  1060. blk%!20=blk%!20+wey:blk%!24=0:blk%!28=0:blk%!32=&7FFFFFFF:blk%!36=&7FFFFFFF:
  1061. 6,&A1,28
  1062. ,,f%:DragASprite%=((f%
  1063. 2)=2):
  1064. DragASprite%
  1065. f%=flags%:
  1066. S*spr$=
  1067. shell_IconGetCommand(valid%,"s")
  1068. shell_OK(
  1069. shell_MessageNoArgs("SHELLMSG19"))
  1070. spr$<>""
  1071. &42400,&85,spr_area%,spr$,blk%+8:_U%!&64=_U%!&64
  1072. &400D0,,blk%
  1073. &400D0,,blk%
  1074. shell_HeapBlockReturn(blk%)
  1075. shell_Tracef0("IconDragBox:WARNING! no drag handler registered for this icon!")
  1076. shell_Tracef0(a$):
  1077. shell_TraceIsOn)
  1078. _U%!44<>-1
  1079. f%=_U%!44:
  1080. #f%,a$
  1081. _U%!&94>0
  1082. shell_BroadcastMessage(&43B00,"ShellDBug:Trace "+a$)
  1083. shell_ActionSelectButton:
  1084. shell_HandleAttachedMenu(_Q%,_U%!28,_U%!32):fn$=
  1085. shell_GetEventHandler(_U%!28,_U%!32,2):
  1086. _U%!32=0
  1087. shell_DataSaveCheckName(_U%!28,_U%!32)
  1088. fn$<>""
  1089. shell_IconSlab(4,_U%!28,_U%!32):void%=
  1090. ("FN"+fn$+"(_temp28%,_temp32%)")
  1091. _U%!32=0
  1092. _U%!28=_U%!20
  1093. &400D4,,-1
  1094. shell_ActionMenuButton:
  1095. temp%,menu%,popup%:popup%=
  1096. :temp%=
  1097. temp%=
  1098. shiftmenuclick(_Q%!&C,_Q%!16)
  1099. temp%
  1100. Zmenu%=
  1101. shell_GetEventMenu(_Q%!8,_Q%!&C,_Q%!16):
  1102. (menu%<>0
  1103. _Q%!&C>0
  1104. _Q%!16>=0)
  1105. popup%=
  1106. menu%=0
  1107. .menu%=
  1108. shell_GetEventMenu(_Q%!8,_Q%!&C,-1)
  1109. menu%<>0
  1110. shell_HandleMenuOpen(_Q%,menu%,_Q%!&C,_Q%!16,popup%)
  1111. shell_ActionAdjustButton:
  1112. flags%,fn$,void%,sel_blk%,ctr%:sel_blk%=
  1113. shell_HeapBlockFetch(&64):
  1114. shell_Tracef0("Action:Mouse Button was ADJUST"):
  1115. &400D6,_U%!28,sel_blk%,&F000,&B000:ctr%=0:
  1116. sel_blk%!ctr%<>-1
  1117. sel_blk%!ctr%=_U%!32
  1118. shell_IconSet(_U%!28,_U%!32,1)
  1119. Cctr%+=4:
  1120. :fn$=
  1121. shell_GetEventHandler(_U%!28,_U%!32,3):
  1122. fn$<>""
  1123. shell_IconSlab(1,_U%!28,_U%!32):void%=
  1124. ("FN"+fn$+"(_temp28%,_temp32%)")
  1125. shell_HeapBlockReturn(sel_blk%):
  1126. shell_GetEventHandler(wh%,ic%,e_type%):
  1127. ptr%,event_list%,found%,list_size%,fn$:
  1128. wh%=-1
  1129. wh%=-2
  1130. rlist_size%=
  1131. shell_HeapBlockInfo(_U%!&C)-8:ptr%=0:found%=
  1132. :event_list%=_U%!&C:fn$="":
  1133. (event_list%!ptr%=wh%)
  1134. event_list%!(ptr%+4)
  1135. event_list%!(ptr%+(&C+(e_type%*4)))>&8000
  1136. 7fn$=$(event_list%!(ptr%+(&C+(e_type%*4)))):found%=
  1137. ptr%+=48
  1138. event_list%!(ptr%+4)=ic%
  1139. event_list%!(ptr%+(&C+(e_type%*4)))>&8000
  1140. 7fn$=$(event_list%!(ptr%+(&C+(e_type%*4)))):found%=
  1141. ptr%+=48
  1142. ptr%+=48
  1143. ptr%+=48
  1144. ((ptr%>=list_size%)
  1145. found%):=fn$
  1146. shell_SendDataSave(wh%,ih%):
  1147. blk%,msgblk%,tmpblk%,offset%,FileSize%,void%:tmpblk%=
  1148. shell_HeapBlockFetch(30):
  1149. &400CF,,tmpblk%:offset%=
  1150. shell_GetEventListOffset(wh%,ih%,_U%+72,24,
  1151. offset%=-1
  1152. offset%=-2
  1153. gvoid%=
  1154. shell_MessageWindow(
  1155. shell_MessageNoArgs("SHELLMSG13"),0,"",
  1156. shell_MessageNoArgs("warning"))
  1157. blk%=(_U%!72)+offset%:
  1158. blk%!8>&8000
  1159. ,FileSize%=
  1160. shell_HeapBlockInfo(blk%!8)-4
  1161. FileSize%=blk%!8
  1162. :msgblk%=_U%!76:msgblk%!0=256:msgblk%!&C=0:msgblk%!16=1:msgblk%!20=tmpblk%!&C:msgblk%!24=tmpblk%!16:msgblk%!28=tmpblk%!0:msgblk%!32=tmpblk%!4:msgblk%!36=FileSize%:msgblk%!40=blk%!&C:$(msgblk%+44)=
  1163. shell_Leaf(
  1164. shell_IconGetData(wh%,blk%!16))
  1165. &400E7,18,msgblk%,msgblk%!20,msgblk%!24:_U%!&78=_Q%!8:_U%!&88=FileSize%:_U%!&8C=blk%!&C:_U%!&90=blk%!8:_U%!&9C=blk%!4:_U%!&C8=msgblk%!20:_U%!&CC=msgblk%!24
  1166. shell_HeapBlockReturn(tmpblk%):
  1167. shell_WritableIconHandler(wh%,ih%,key%):
  1168. nr_icons%,first_write%,last_write%,ctr%:
  1169. before%,after%,index%,mx%,my%,temp_blk%,caret_blk%:caret_blk%=
  1170. shell_HeapBlockFetch(&400):
  1171. &400D3,,caret_blk%:
  1172. caret_blk%!0=-1
  1173. shell_HeapBlockReturn(caret_blk%):=
  1174. &400D6,wh%,caret_blk%,&40E000,&E000:first_write%=caret_blk%!0:ctr%=0:
  1175. caret_blk%!ctr%=ih%
  1176. :before%=caret_blk%!(ctr%-4):after%=caret_blk%!(ctr%+4)
  1177. :ctr%+=4:
  1178. caret_blk%!ctr%=-1:last_write%=caret_blk%!(ctr%-4):
  1179. shell_FakeMouseClick(wh%,0,4)
  1180. 398,394:
  1181. ih%=last_write%
  1182. &400D2,wh%,first_write%,-1,-1,-1,
  1183. shell_IconGetData(wh%,first_write%))
  1184. &400D2,wh%,after%,-1,-1,-1,
  1185. shell_IconGetData(wh%,after%))
  1186. 399,410:
  1187. ih%=first_write%
  1188. &400D2,wh%,last_write%,-1,-1,-1,
  1189. shell_IconGetData(wh%,last_write%))
  1190. &400D2,wh%,before%,-1,-1,-1,
  1191. shell_IconGetData(wh%,before%))
  1192. shell_HeapBlockReturn(caret_blk%):=
  1193. shell_HotKeyProcess(key%):
  1194. e_list%,list_size%,found%,ptr%,h%,win$,fn1$,fn2$:
  1195. ctrl%,shift%,alt%,x_off%,y_off%,flag%,key_flags%,offset%:
  1196. result%,win_blk%:e_list%=_U%!60:list_size%=_U%!&B4*24:found%=
  1197. :ptr%=0:
  1198. e_list%!ptr%=key%
  1199. found%=
  1200. ptr%+=24
  1201. found%
  1202. ptr%>=list_size%:
  1203. found%
  1204. E>temp%=e_list%+ptr%:win$=$(temp%!8):
  1205. (win$<>""
  1206. temp%!&C=0)
  1207. shell_CreateWindow(win$,h%):win_blk%=
  1208. shell_HeapBlockFetch(36):win_blk%!0=h%:
  1209. &400CB,,win_blk%:x_off%=(win_blk%!4-win_blk%!&C)/2:y_off%=(win_blk%!16-win_blk%!8)/2:
  1210. shell_HeapBlockReturn(win_blk%)
  1211. :fn1$=$(temp%!16):
  1212. fn1$<>""
  1213. temp%!&C>0
  1214. U(void%=
  1215. ("FN"+fn1$+"("+
  1216. temp%!&C+")")
  1217. void%=
  1218. ("FN"+fn1$+"("+
  1219. h%+")")
  1220. :offset%=
  1221. shell_SearchStatic(_U%!&B8,temp%!&C):
  1222. offset%>-1
  1223. shell_OpenWindowStatic(temp%!&C)
  1224. temp%!&C>0
  1225. shell_MessageNoArgs("SHELLMSG09")
  1226. shell_OpenWindowDynamic(h%,x_off%,y_off%)
  1227. :fn2$=$(temp%!20):
  1228. fn2$<>""
  1229. temp%!&C>0
  1230. k(void%=
  1231. ("FN"+fn1$+"("+
  1232. temp%!&C+")")
  1233. void%=
  1234. ("FN"+fn2$+"("+
  1235. h%+")")
  1236. :result%=
  1237. win$="":fn1$="":fn2$="":result%=
  1238. :=result%
  1239. shell_ActionMenuSelect(_Q%):
  1240. handler%,menu_buffer%,CheckSelect%,fontmenuflag%,void%,h_blk%:h_blk%=
  1241. shell_HeapBlockFetch(256):
  1242. &400CF,,_shell_blk%:
  1243. _U%!264=0
  1244. &45BC4,_U%!24,_Q%
  1245. handler%,,h_blk%:
  1246. handler%
  1247. shell_MenuCallHandler(handler%,h_blk%)
  1248. _shell_blk%!8=1
  1249. shell_HeapBlockExists(_U%!&E0)
  1250.  _temp%=_U%!&E0:
  1251. $_temp%<>""
  1252. +void%=
  1253. ("FN"+$_temp%+"(_U%!52,_U%!56)")
  1254. shell_OpenMenu(_U%!36,_U%!40,_U%!24)
  1255. _shell_FontMenuSelFN$=""
  1256. shell_HeapBlockReturn(h_blk%):
  1257. shell_Receive(_Q%):
  1258. temp%,void%:
  1259. _Q%!16
  1260. shell_Exit:
  1261. shell_DataSave(_Q%)
  1262. shell_DataSaveAck(_Q%)
  1263. shell_DataLoad(_Q%,
  1264. shell_DataLoadAck(_Q%)
  1265. shell_DataLoad(_Q%,
  1266. shell_RAMFetch(_Q%)
  1267. shell_RAMTransmit(_Q%)
  1268. shell_Message_PreQuit(_Q%)
  1269. _U%!&A4>0
  1270. &temp%=_U%!&A4:void%=
  1271. ("FN"+$temp%)
  1272. shell_Message_SaveDesktop(_Q%)
  1273. shell_Message_Shutdown(_Q%)
  1274. &502:
  1275. shell_InteractiveHelp(_Q%)
  1276. &400C0:
  1277. shell_MenuWarning(_Q%)
  1278. &400C1:
  1279. shell_Message_ModeChange(_Q%)
  1280. &400C2:
  1281. _U%!&A8>0
  1282. \temp%=_U%!&A8:void%=
  1283. ("FN"+$temp%+"("+
  1284. (_Q%!4)+","+
  1285. shell_GetString(_Q%+28)+
  1286. 34+")")
  1287. _U%!&D0=-1
  1288. shell_GetString(_Q%+28)="StrongHelp"
  1289. _U%!&D0=_Q%!4:
  1290. shell_StrongHlpMsg("Help_Install -DieWithTask "+
  1291. shell_GetAppDir+"."+
  1292. shell_GetAppName):temp%=_U%!&D8:
  1293. $temp%<>""
  1294. shell_HelpWord($temp%):
  1295. shell_HeapBlockReturn(_U%!&D8):_U%!&D8=0
  1296. &400C3:
  1297. _U%!&AC>0
  1298. &temp%=_U%!&AC:void%=
  1299. ("FN"+$temp%)
  1300. _Q%!4=_U%!&D0
  1301. _U%!&D0=-1
  1302. &400C7:
  1303. shell_GetString(_Q%+28)="StrongHelp"
  1304. _U%!&D0=_Q%!20
  1305. shell_ScanForHelp
  1306. shell_HandleUnknownMessage2(_Q%)
  1307. shell_UserMessageAcknowledge(_Q%):
  1308. _Q%!16
  1309. shell_AckDataLoad(_Q%)
  1310. shell_AckRAMFetch(_Q%)
  1311. shell_TraceExit:
  1312. _U%!44<>-1
  1313. #(_U%!44):_U%!44=-1
  1314. shell_WimpCloseDown_I(Taskid%):
  1315. shell_LoseFonts:
  1316. &600DD,Taskid%,&4B534154:
  1317. &A1683,Taskid%:
  1318. _U%!&64
  1319. "XImpulse_CloseDown",_U%!&94
  1320. shell_HeapBlockExtend(a%,b%):
  1321. heap_code%+&C,a%,b%:=a%
  1322. shell_GetCmdLineArgs:
  1323. cmdline$:
  1324. _U%!324<>0
  1325. cmdline$=$(_U%!324)
  1326. :=cmdline$
  1327. shell_FileType(object$):
  1328. type%:
  1329. 8,5,object$
  1330. ,,type%:type%=(type%
  1331. &FFF00)>>>8:=type%
  1332. shell_MessageSendDataLoad(type%,name$):
  1333. m_blk%:m_blk%=
  1334. shell_HeapBlockFetch(256):m_blk%!0=256:m_blk%!4=0:m_blk%!16=5:m_blk%!20=0:m_blk%!28=0:m_blk%!32=0:m_blk%!36=0:m_blk%!40=type%:$(m_blk%+44)=name$+
  1335. &400E7,17,m_blk%,0
  1336. shell_HeapBlockReturn(m_blk%):
  1337. shell_MessageLookup(tag$,arg1$,arg2$):
  1338. flags%,L%,m$,ms_text%,ms_desc%:
  1339. tag$,8)="SHELLMSG"
  1340. %ms_text%=_U%!284:ms_desc%=_U%!280
  1341. ms_text%=_U%!64:ms_desc%=_U%!68
  1342. &61502,ms_desc%,tag$,ms_text%,256,arg1$,arg2$
  1343. ,,,L%;flags%:
  1344. flags%
  1345. ms_text%?L%=&D:m$=$(ms_text%)
  1346. shell_WindowLoaded(window$):
  1347. loop%,found%:
  1348. (window$)>&C
  1349. shell_MessageOneArg("SHELLMSG02",window$)
  1350. Cfound%=
  1351. loop%=0
  1352. (_U%!0)-1:
  1353. $(((_U%!4)+(16*loop%))+4)=window$
  1354. found%=
  1355. :loop%=(_U%!0)-1
  1356. loop%:=found%
  1357. shell_MessageOneArg(tag$,arg1$):=
  1358. shell_MessageLookup(tag$,arg1$,"")
  1359. shell_GetWB(window$):
  1360. loop%,found%:
  1361. (window$)>&C
  1362. shell_MessageOneArg("SHELLMSG02",window$)
  1363. Dfound%=-1:
  1364. loop%=0
  1365. (_U%!0)-1:
  1366. $(((_U%!4)+(16*loop%))+4)=window$
  1367.  found%=loop%:loop%=(_U%!0)-1
  1368. loop%:
  1369. found%>-1
  1370. =!((_U%!4)+(16*found%))
  1371. shell_MessageOneArg("SHELLMSG03",window$)
  1372. shell_SearchStatic(w_list%,handle%):
  1373. found%,ctr%:found%=-1:ctr%=0:
  1374. w_list%<>0
  1375. w_list%!ctr%<>-1:
  1376. w_list%!ctr%=handle%
  1377. found%=ctr%:=found%
  1378. :ctr%+=4:
  1379. :=found%
  1380. shell_EventListMenuWarn(item%,submenu_ptr%,warn_fn$,sel_fn$):
  1381. temp%,temp2%,ctr%,e_list%:
  1382. _U%!&DC=0
  1383. _U%!&DC=
  1384. shell_HeapBlockFetch(32):temp%=_U%!&DC:temp%!0=item%:temp%!4=
  1385. shell_HeapBlockFetch(
  1386. warn_fn$+1):$(temp%!4)=warn_fn$:temp%!8=submenu_ptr%:temp%!&C=
  1387. shell_HeapBlockFetch(
  1388. sel_fn$+1):$(temp%!&C)=sel_fn$
  1389. D3temp%!16=-1:temp%!20=-1:temp%!24=-1:temp%!28=-1
  1390. e_list%=
  1391. shell_HeapBlockExtend(_U%!&DC,32):_U%!&DC=e_list%:ctr%=0:
  1392. :ctr%+=16:
  1393. e_list%!ctr%=-1:temp%=_U%!&DC:temp%!ctr%=item%:temp%!(ctr%+4)=
  1394. shell_HeapBlockFetch(
  1395. warn_fn$+1):temp2%=temp%!(ctr%+4):$(temp2%)=warn_fn$:temp%!(ctr%+8)=submenu_ptr%
  1396. temp%!(ctr%+&C)=
  1397. shell_HeapBlockFetch(
  1398. sel_fn$+1):temp2%=temp%!(ctr%+&C):$(temp2%)=sel_fn$:temp%!(ctr%+16)=-1:temp%!(ctr%+20)=-1:temp%!(ctr%+24)=-1:temp%!(ctr%+28)=-1
  1399. shell_EventAdd(wh%,ic%,e_type%,menu%,fn$):
  1400. ptr%,fn%,event_list%,list_size%,found%:
  1401. fn_addr%:ptr%=0:found%=
  1402. wh%=-1
  1403. wh%=-2
  1404. ][list_size%=
  1405. shell_HeapBlockInfo(_U%!&C)-8:event_list%=_U%!&C:
  1406. (event_list%!ptr%=wh%)
  1407. event_list%!(ptr%+4)=ic%
  1408. found%=
  1409. ptr%+=48
  1410. ptr%+=48
  1411. (ptr%>=list_size%
  1412. found%):
  1413. found%=
  1414. n>ptr%=0:
  1415. (event_list%!ptr%<>0):ptr%+=48:
  1416. ptr%>=list_size%
  1417. _U%!&C=
  1418. shell_HeapBlockExtend(_U%!&C,48):event_list%=_U%!&C:event_list%!(ptr%+0)=0:event_list%!(ptr%+4)=0:event_list%!(ptr%+8)=0:event_list%!(ptr%+&C)=0:event_list%!(ptr%+16)=0:event_list%!(ptr%+20)=0:event_list%!(ptr%+24)=0:event_list%!(ptr%+28)=0
  1419. |cevent_list%!(ptr%+32)=0:event_list%!(ptr%+36)=0:event_list%!(ptr%+40)=0:event_list%!(ptr%+44)=0
  1420. :event_list%!(ptr%+0)=wh%:event_list%!(ptr%+4)=ic%:
  1421. menu%<>0
  1422. event_list%!(ptr%+8)=menu%
  1423. :fn_addr%=ptr%+(&C+(e_type%*4)):
  1424. event_list%!fn_addr%<>0
  1425. shell_HeapBlockReturn(event_list%!fn_addr%)
  1426. :fn%=
  1427. shell_HeapBlockFetch(
  1428. fn$+1):$fn%=fn$:event_list%!fn_addr%=fn%:
  1429. shell_IconSetButtonType(wh%,ih%,button_type%):
  1430. button_type%=&C
  1431. button_type%=&D
  1432. shell_MessageOneArg("SHELLMSG23","PROCshell_IconSetButtonType")
  1433. button_type%<0
  1434. button_type%>&F
  1435. shell_MessageOneArg("SHELLMSG22","PROCshell_IconSetButtonType")
  1436. shell_IconSetState(wh%,ih%,button_type%<<&C,&F000):
  1437. shell_IconIsSprite(wh%,ih%):
  1438. flags%,temp%:flags%=
  1439. shell_IconGetFlags(wh%,ih%):temp%=(flags%
  1440. 1<<1):
  1441. temp%=(1<<1)
  1442. shell_OK(e$):
  1443. &D00,e$
  1444. shell_HeapBlockInfo(a%):
  1445. 29,6,!(heap_code%+28),a%
  1446. ,,,r3:=r3
  1447. shell_HeapBlockExists(addr%):
  1448. void%:
  1449. addr%<&8000
  1450. 99,"No heapblock defined at this address"
  1451. +void%=
  1452. shell_HeapBlockInfo(addr%):
  1453. shell_CatInfoRead(object$):
  1454. type%,load_addr%,exec_addr%,length%,atts%,string$:
  1455. 8,5,object$
  1456. type%,,load_addr%,exec_addr%,length%,atts%:
  1457. type%=0
  1458. ="Not Found"
  1459. atts%=51
  1460. string$+="WR "
  1461. atts%=&BB
  1462. string$+="LWR"
  1463. atts%=&88
  1464. string$+="DL "
  1465. string$+=" "+
  1466. shell_StringPadLeading(
  1467. ~load_addr%,"0",8):string$+=" "+
  1468. shell_StringPadLeading(
  1469. ~exec_addr%,"0",8):string$+=" "+
  1470. shell_StringPadLeading(
  1471. ~length%,"0",8):=string$
  1472. shell_FileLength(object$):
  1473. type%,load_addr%,exec_addr%,length%,atts%,string$:
  1474. 8,5,object$
  1475. type%,,load_addr%,exec_addr%,length%,atts%:=length%
  1476. shell_IconIndirSize(file_offset%,flags%,data%):
  1477. size%,valid_offset%,valid_buff%,ctr%,char%:
  1478. (flags%
  1479. &800100)=256
  1480. ,size%=data%!8:
  1481. (flags%
  1482. (data%!4<>-1)
  1483. valid_offset%=data%!4:valid_buff%=
  1484. shell_HeapBlockFetch(256):
  1485. #X%=file_offset%+valid_offset%:
  1486. &C,4,X%,valid_buff%,512:ctr%=0:
  1487. :char%=valid_buff%?ctr%:ctr%+=1:
  1488. char%<32:size%=size%+ctr%:
  1489. shell_HeapBlockReturn(valid_buff%)
  1490. size%=0
  1491. :=size%
  1492. shell_OSModuleCheckVersion(module$,version%):
  1493. blk%,len%:blk%=
  1494. shell_HeapBlockFetch(256):
  1495. ("Set AppName$RISCOS Y"):
  1496. ("RMEnsure "+module$+" "+
  1497. version%+" Set AppName$RISCOS N"):
  1498. &20023,"AppName$RISCOS",blk%,256,0,0
  1499. ,,len%:blk%?len%=&D
  1500. ("Unset AppName$RISCOS"):
  1501. shell_HeapBlockReturn(blk%):
  1502. $blk%="N"
  1503. shell_IconGetFlags(file_offset%,wh%,ih%):
  1504. flags%,blk%:blk%=
  1505. shell_HeapBlockFetch(50):blk%!0=wh%:blk%!4=ih%:
  1506. &400CE,,blk%:flags%=blk%!24:
  1507. shell_HeapBlockReturn(blk%):=flags%
  1508. shell_IconGetCommand(v%,c$):
  1509. I%,result$:
  1510. v%<=0
  1511. result$=""
  1512. shell_StringUpperCase($v%),";"+
  1513. shell_StringUpperCase(c$)):
  1514. result$=""
  1515. result$=
  1516. $(v%+I%),
  1517. $(v%+I%)+";",";")-1)
  1518. :=result$
  1519. shell_TraceIsOn:=_U%!48
  1520. shell_BroadcastMessage(reason_code%,msg$):
  1521. m_blk%,m_len%:m_len%=(
  1522. msg$+30)
  1523. 3:m_blk%=
  1524. shell_HeapBlockFetch(m_len%):m_blk%!&C=0:m_blk%!16=reason_code%:$(m_blk%+20)=msg$+
  1525. (0):m_blk%!0=m_len%:
  1526. &600E7,17,m_blk%,0:
  1527. shell_HeapBlockReturn(m_blk%):
  1528. shell_HandleAttachedMenu(_Q%,wh%,ih%):
  1529. menu%:
  1530. ih%<>-1
  1531. wh%>-1
  1532. 7menu%=
  1533. shell_GetEventMenu(_Q%!8,wh%,ih%):
  1534. menu%<>0
  1535. shell_HandleMenuOpen(_Q%,menu%,wh%,ih%,
  1536. shell_DataSaveCheckName(wh%,ih%):
  1537. offset%,blk%,list_size%:blk%=_U%!72:offset%=0:
  1538. blk%<>0
  1539. Clist_size%=
  1540. shell_HeapBlockInfo(blk%)-8:
  1541. !(blk%+offset%)=wh%
  1542.     %hname$=
  1543. shell_IconGetData(!blk%,blk%!16):
  1544. name$,".")=0
  1545. shell_OK(
  1546. shell_MessageNoArgs("SHELLMSG01"))
  1547. offset%=list_size%
  1548. :offset%+=24:
  1549. offset%>=list_size%
  1550. shell_IconSlab(button%,wh%,ih%):
  1551. blk%:blk%=
  1552. shell_HeapBlockFetch(50):blk%!8=button%:blk%!&C=wh%:blk%!16=ih%:
  1553. &81680,,blk%:blk%!8=0:
  1554. &81680,,blk%:
  1555. shell_HeapBlockReturn(blk%):
  1556. shiftmenuclick(wh%,ih%):=
  1557. shell_GetEventMenu(button%,wh%,ic%):
  1558. ptr%,event_list%,found%,list_size%,menu%:
  1559. wh%=-1
  1560. wh%=-2
  1561.     >rlist_size%=
  1562. shell_HeapBlockInfo(_U%!&C)-8:ptr%=0:found%=
  1563. :event_list%=_U%!&C:fn$="":
  1564. (event_list%!ptr%=wh%)
  1565. shell_Tracef0("GetEventMenu:window handle matched.."):
  1566. event_list%!(ptr%+4)=ic%
  1567.     L6menu%=event_list%!(ptr%+8):
  1568. menu%=-2
  1569. menu%=_U%!&FC
  1570. found%=
  1571. :ptr%+=48:
  1572. (ptr%>=list_size%
  1573. found%):=menu%
  1574. shell_HandleMenuOpen(_Q%,menu%,wh%,ih%,popup%):
  1575. i_blk%,w_blk%:
  1576. popup%=
  1577. shell_OpenMenu(_Q%!0,_Q%!4,menu%)
  1578. i_blk%=
  1579. shell_HeapBlockFetch(50):w_blk%=
  1580. shell_HeapBlockFetch(36):i_blk%!0=wh%:i_blk%!4=ih%:
  1581. &400CE,,i_blk%:w_blk%!0=wh%:
  1582. &400CB,,w_blk%:
  1583. shell_OpenMenu(w_blk%!4+i_blk%!16+64,_Q%!4,menu%):
  1584. w_blk%!4+i_blk%!16+64,_Q%!4
  1585. shell_HeapBlockReturn(i_blk%):
  1586. shell_HeapBlockReturn(w_blk%)
  1587. shell_IconSet(wh%,ih%,state%):
  1588. state%=0
  1589. shell_IconDeselect(wh%,ih%)
  1590. shell_IconSelect(wh%,ih%)
  1591. shell_MessageWindow(text$,cancel%,progname$,head$):
  1592. keys%,err_blk%:err_blk%=
  1593. shell_HeapBlockFetch(260):!err_blk%=0:$(err_blk%+4)=text$+
  1594. head$=""
  1595. head$="Message from "+progname$
  1596. cancel%
  1597. &400DF,err_blk%,19,head$
  1598. ,keys%
  1599. &400DF,err_blk%,17,head$
  1600. ,keys%
  1601. shell_HeapBlockReturn(err_blk%):=keys%
  1602. shell_FakeMouseClick(wh%,ih%,button%):
  1603. 6,&F,1:_Q%!8=button%:_Q%!&C=wh%:_Q%!16=ih%:
  1604. shell_Action(6):
  1605. shell_MenuCallHandler(h%,_h_blk%):
  1606. ("FN"+$h%+"(_h_blk%)")
  1607. shell_OpenMenu(x%,y%,m%):
  1608. fn$:fn$=
  1609. shell_GetEventHandler(_U%!28,_U%!32,1):
  1610. fn$<>""
  1611. 'void%=
  1612. ("FN"+fn$+"(_U%!28,_U%!32)")
  1613. shell_Tracef0("OpenMenu:no menumaker function registered")
  1614. m%<>_U%!24
  1615. shell_HeapBlockExists(_U%!256)
  1616. shell_HeapBlockReturn(_U%!256):_U%!256=0
  1617. shell_HeapBlockExists(_U%!&F4)
  1618. shell_HeapBlockReturn(_U%!&F4):_U%!&F4=0
  1619. m%=_U%!&FC
  1620. &400D4,,m%,x%-64,y%:_U%!264=1
  1621. _Q%!0=x%:_Q%!4=y%:
  1622. &45BC5,m%,_Q%:_U%!264=0
  1623. :_U%!24=m%:_U%!36=x%:_U%!40=y%:_U%!52=_U%!28:_U%!56=_U%!32:
  1624. shell_DataSave(_Q%):
  1625. temp%,offset%,blk%,loop%:
  1626. _Q%!4<>_U%!&94
  1627. Moffset%=
  1628. shell_GetEventListOffset(_Q%!20,_Q%!24,_U%+96,16,
  1629. offset%>-1
  1630. ;blk%=_U%!96+offset%:
  1631. shell_CheckType(_Q%!40,blk%!8,
  1632. shell_TopBitLoadInProgress
  1633. n_Q%!0=256:_Q%!&C=_Q%!8:_Q%!36=-1:_Q%!16=2:$(_Q%+44)=
  1634. shell_GetAppDir+".ScrapFile"+
  1635. &400E7,18,_Q%,_Q%!4
  1636. shell_HeapBlockReturn(_U%!&9C):_U%!&9C=
  1637. shell_HeapBlockFetch((_Q%!0)+8):temp%=_U%!&9C:
  1638. loop%=0
  1639. _Q%!0
  1640. 4:temp%!loop%=_Q%!loop%:
  1641. loop%:_U%!28=_Q%!20:_U%!32=_Q%!24:_U%!&80=0:_U%!&84=_Q%!36:_U%!&98=
  1642. shell_HeapBlockFetch(_Q%!36):_Q%!0=28:_Q%!&C=_Q%!8
  1643. V_Q%!16=6:_Q%!20=_U%!&98+_U%!&80:_Q%!24=_U%!&84:
  1644. &400E7,18,_Q%,_Q%!4:_U%!&70=_Q%!8
  1645. shell_DataSaveAck(_Q%):
  1646. _fullname$,a%,b%,blk%,temp%,void%:a%=0:b%=_Q%?(44+a%):
  1647. b%<>0:_fullname$+=
  1648. (b%):a%+=1:b%=_Q%?(44+a%):
  1649. :offset%=
  1650. shell_GetEventListOffset(_U%!28,_U%!32,_U%+72,24,
  1651. offset%=-1
  1652. offset%=-2
  1653. shell_MessageNoArgs("SHELLMSG05")
  1654. 4blk%=(_U%!72)+offset%:temp%=blk%!20:
  1655. $temp%<>""
  1656. 'void%=
  1657. ("FN"+$temp%+"(_fullname$)")
  1658. shell_HeapBlockExists(blk%!8)
  1659. 8,&A,_fullname$,blk%!&C,,blk%!8,blk%!8+
  1660. shell_HeapBlockInfo(blk%!8)+1
  1661. shell_MessageNoArgs("SHELLMSG21")
  1662. _Q%!36>-1
  1663. _U%!80<>0
  1664. shell_HeapBlockReturn(_U%!80)
  1665. N_U%!80=
  1666. shell_HeapBlockFetch(
  1667. _fullname$+1):temp%=_U%!80:$temp%=_fullname$
  1668. :_Q%!16=3:!_Q%=256:_Q%!20=_U%!&C8:_Q%!24=_U%!&CC:_Q%!40=_U%!&8C:_Q%!36=
  1669. shell_FileLength(_fullname$):_Q%!&C=_Q%!8:$(_Q%+44)=_fullname$+
  1670. (0):_U%!84=_Q%!8:
  1671. &400E7,18,_Q%,_Q%!20,_Q%!24:
  1672. _U%!28<>_U%!20
  1673. shell_CloseWindow(_U%!28)
  1674. &400D4,,-1:
  1675. shell_DataLoad(_Q%,DataOpen%):
  1676. reference%,offset%,blk%,_temp%,type_list%,type%,fname$:type%=_Q%!40:fname$=
  1677. shell_GetString(_Q%+44):
  1678. DataOpen%
  1679. _U%!96<>0
  1680. offset%=0
  1681. offset%=-1
  1682. offset%=
  1683. shell_GetEventListOffset(_Q%!20,_Q%!24,_U%+96,16,
  1684. offset%=-1
  1685. :<offset%=
  1686. shell_GetEventListOffset(_Q%!20,-1,_U%+96,16,
  1687. offset%>-1
  1688. ?Cblk%=_U%!96+offset%:
  1689. shell_CheckType(_Q%!40,blk%!8,DataOpen%)
  1690. BPReference%=_Q%!&C:_Q%!&C=_Q%!8:_Q%!16=4:
  1691. &400E7,18,_Q%,_Q%!4:
  1692. _U%!&64
  1693. G$loadloc%=-1:_U%!&64=_U%!&64
  1694. loadloc%=
  1695. shell_LoadFile(Reference%=_U%!&6C)
  1696. shell_UserFNLoadFile(type%,loadloc%,blk%!8,fname$,_Q%!36,blk%):
  1697. _U%!&9C<>0
  1698. shell_HeapBlockReturn(_U%!&9C):_U%!&9C=0
  1699. shell_DataLoadAck(_Q%):
  1700. shell_RAMFetch(_Q%):
  1701. RAMFetch_buffer%,len_data%,done%:done%=
  1702. _U%!&90>&8000
  1703. e:_Q%!&C=_Q%!8:_Q%!16=7:len_data%=_U%!&88:
  1704. _U%!&8C=&FF9
  1705. _U%!&90+=4
  1706. (len_data%-_U%!&80)<_Q%!24
  1707. r$_Q%!24=len_data%-_U%!&80:done%=
  1708. &400F1,_U%!&94,_U%!&90+_U%!&80,_Q%!4,_Q%!20,_Q%!24:
  1709. &400E7,17,_Q%,_Q%!4:_U%!&78=_Q%!8:_U%!&80+=_Q%!24:
  1710. done%
  1711. _U%!&80=0
  1712. shell_RAMTransmit(_Q%):
  1713. offset%,blk%,f_name$,temp%:
  1714. _Q%!&C=_U%!&70
  1715. $_U%!&80+=_Q%!24:
  1716. _Q%!24<_U%!&84
  1717. offset%=
  1718. shell_GetEventListOffset(_U%!28,_U%!32,_U%+96,16,
  1719. ):blk%=_U%!96+offset%:temp%=_U%!&9C:f_name$=
  1720. shell_GetString(temp%+44):
  1721. shell_UserFNLoadFile(temp%!40,_U%!&98,blk%!8,f_name$,_U%!&84,blk%)
  1722. _U%!&80>_U%!&84
  1723. ;_U%!&98=
  1724. shell_HeapBlockExtend(_U%!&98,_U%!&80,_U%!&84)
  1725. :_Q%!&C=_Q%!8:_Q%!16=6:_Q%!20=_U%!&98+_U%!&80:_Q%!24=_U%!&84:
  1726. &400E7,18,_Q%,_Q%!4:_U%!&70=_Q%!8
  1727. shell_HeapBlockReturn(_U%!&98):_U%!&98=0:
  1728. shell_OK(
  1729. shell_MessageNoArgs("SHELLMSG15"))
  1730. shell_Message_PreQuit(_Q%):
  1731. temp%,quitsender%,blk%,loop%,flagword%:
  1732. _U%!300>0
  1733. blk%=
  1734. shell_HeapBlockFetch(256):
  1735. loop%=0
  1736. _Q%!0
  1737. 4:blk%!loop%=_Q%!loop%:
  1738. loop%:temp%=_U%!300:quitsender%=blk%!4:
  1739. !blk%<24
  1740. flagword%=0
  1741. flagword%=blk%!20
  1742. Cblk%!&C=blk%!8:
  1743. &400E7,19,blk%,quitsender%:
  1744. ("FN"+$temp%)<>0
  1745. flagword%
  1746. _closedown%=
  1747. !blk%=24:blk%!24=508:
  1748. &400E7,8,blk%,quitsender%:_closedown%=
  1749. shell_HeapBlockReturn(blk%)
  1750. shell_Message_SaveDesktop(Q%):
  1751. boot$:boot$="Run "+
  1752. shell_GetAppDir+
  1753. &C,2,Q%!20,boot$,
  1754. boot$:
  1755. shell_Message_Shutdown(_Q%):
  1756. _U%!312>0
  1757. shell_Tracef0("Message_Shutdown:Shutdown message received"):temp%=_U%!312:void%=
  1758. ("FN"+$temp%)
  1759. shell_InteractiveHelp(_Q%):
  1760. tag$,mess$,validation$,pos1%,pos2%,help$,i_blk%:i_blk%=
  1761. shell_HeapBlockFetch(&C):
  1762. &400D6,_Q%!32,i_blk%,&3F0000,&C<<16:
  1763. !i_blk%<>-1
  1764. +tag$=
  1765. shell_IconGetData(_Q%!32,!i_blk%)
  1766. shell_HeapBlockReturn(i_blk%):
  1767. tag$=""
  1768. tag$=
  1769. shell_GetEventHandler(_Q%!32,_Q%!36,8)
  1770. Ivalidation$=
  1771. shell_IconGetValidation(_Q%!32,_Q%!36):
  1772. validation$<>""
  1773. shell_StringUpperCase(
  1774. validation$,1))="I"
  1775. %pos1%=
  1776. validation$,";"):
  1777. pos1%=0
  1778. tag$=
  1779. validation$,2)
  1780. tag$=
  1781. validation$,2,pos1%-2)
  1782. pos1%=
  1783. shell_StringUpperCase(validation$),
  1784. shell_StringUpperCase(";i")):pos2%=
  1785. shell_StringUpperCase(validation$),
  1786. shell_StringUpperCase(";"),pos1%+1):
  1787. pos1%>0
  1788. pos2%>0
  1789. ,tag$=
  1790. validation$,pos1%+2,pos2%-pos1%-2)
  1791. tag$=
  1792. validation$,pos1%+2)
  1793. tag$<>""
  1794. _Q%!16=&503:_Q%!&C=_Q%!8:mess$=
  1795. shell_MessageLookup(tag$,"",""):mess$=
  1796. shell_MessageExpand(mess$):$(_Q%+20)=mess$:!_Q%=(
  1797. mess$+25)
  1798. &400E7,17,_Q%,_Q%!4
  1799. shell_MenuWarning(_Q%):
  1800. fn$,menu_buffer%,x%,y%,void%,_temp%,a%,warn_fn$,item_addr%,blk%:x%=_Q%!24:y%=_Q%!28:_U%!264=0:
  1801. _U%!20<>0
  1802. %void%=
  1803. shell_DeleteWindow(_U%!20)
  1804. _Q%!20
  1805. _U%!&E4:
  1806. shell_WindowRetitle(_U%!&E4,
  1807. shell_MessageNoArgs("warning")):
  1808. shell_IconPutData(_U%!&E4,1,
  1809. shell_MessageNoArgs("SHELLMSG07"),0):
  1810. &400E8,,_U%!&E4,x%,y%
  1811. item_addr%=
  1812. shell_MenuGetItemAddress(_U%!24,_Q%+32):
  1813. shell_HeapBlockExists(item_addr%!4)
  1814. shell_MenuWarnDBox(item_addr%,x%,y%)
  1815. blk%=
  1816. shell_HeapBlockFetch(32):
  1817. &45BC4,_U%!24,_Q%+32
  1818. ,,blk%:
  1819. shell_FindMenuWarnEvent(blk%!8,warn_fn$,sel_fn$):
  1820. shell_HeapBlockReturn(blk%):
  1821. shell_MenuWarnSubMenu(_Q%!20,x%,y%,warn_fn$,sel_fn$)
  1822. shell_Message_ModeChange(_Q%):
  1823. offset%,ctr%,sw_list%,w_blk%:sw_list%=_U%!&B8:
  1824. _U%!&A0>0
  1825. shell_Tracef0("Message_ModeChange:ModeChange message received"):temp%=_U%!&A0:void%=
  1826. ("FN"+$temp%)
  1827. :w_blk%=
  1828. shell_HeapBlockFetch(&64):
  1829. sw_list%<>0
  1830. sw_list%!ctr%<>-1:offset%=
  1831. shell_GetEventListOffset(sw_list%!ctr%,-1,_U%+92,24,
  1832. offset%>-1
  1833. shell_WindowIsOpen(sw_list%!ctr%)
  1834. 0P!w_blk%=sw_list%!ctr%:
  1835. &400C6,,w_blk%:
  1836. shell_OpenWindow(sw_list%!ctr%,0,-1)
  1837. :ctr%+=4:
  1838. shell_HeapBlockReturn(w_blk%):
  1839. shell_GetString(Address%):
  1840. String$,Len%:
  1841. ((Address%?Len%)>31
  1842. Len%<&FF):String$+=
  1843. (Address%?Len%):Len%+=1:
  1844. :=String$
  1845. shell_StrongHlpMsg(msg$):
  1846. shell_BroadcastMessage(&43B00,msg$):
  1847. shell_HelpWord(word$):
  1848. read%,temp%,buff%:buff%=
  1849. shell_HeapBlockFetch(512):
  1850. _U%!&D0=-1
  1851. shell_OSVarExists(buff%,"StrongHelp$Dir")
  1852. &600DE,"<StrongHelp$Dir>":
  1853. _U%!&D8<>0
  1854. shell_HeapBlockReturn(_U%!&D8)
  1855. PF_U%!&D8=
  1856. shell_HeapBlockFetch(
  1857. word$+1):temp%=_U%!&D8:$temp%=word$
  1858. shell_HeapBlockReturn(buff%):
  1859. shell_OK(
  1860. shell_MessageNoArgs("SHELLMSG11"))
  1861. shell_StrongHlpMsg("Help_Word "+word$)
  1862. shell_HeapBlockReturn(buff%):
  1863. shell_ScanForHelp:
  1864. wrk%,owner_taskhandle%:wrk%=
  1865. shell_HeapBlockFetch(256):
  1866. :wrk%!&C=0:
  1867. &400E7,19,wrk%,-2,_U%!&D4
  1868. ,,owner_taskhandle%:_U%!&D4=_U%!&D4+1:
  1869. owner_taskhandle%<>-1
  1870. (_U%!&D4)>64:
  1871. owner_taskhandle%<>-1
  1872. sSwrk%!0=24:wrk%!&C=0:wrk%!16=&400C6:wrk%!20=owner_taskhandle%:
  1873. &400E7,17,wrk%,0
  1874. shell_HeapBlockReturn(wrk%):
  1875. shell_HandleUnknownMessage2(_Q%):
  1876. message$:
  1877. _Q%!16
  1878. &43B00:message$=$(_Q%+20):
  1879. message$,30)="EvntShellLib:ShellDBug started"
  1880. _U%!&64
  1881. r_U%!&64=(_U%!&64
  1882. 1<<4):
  1883. shell_BroadcastMessage(&43B00,"ShellDBug:Init Debug messages from "+
  1884. shell_GetAppName)
  1885. message$,25)="EvntShellLib:TraceInitAck"
  1886. _U%!&64=(_U%!&64
  1887. 1<<4)
  1888. message$,20)="EvntShellLib:TraceOn"
  1889. shell_TraceOn
  1890. message$,21)="EvntShellLib:TraceOff"
  1891. shell_TraceOff
  1892. message$,28)="EvntShellLib:ListClickSelect"
  1893. shell_ListClickSelect
  1894. message$,28)="EvntShellLib:ListClickAdjust"
  1895. shell_ListClickAdjust
  1896. message$,25)="EvntShellLib:ListHelpTags"
  1897. shell_ListHelpTags
  1898. shell_HandleUnknownMessage(_Q%):
  1899. shell_AckDataLoad(_Q%):
  1900. _Q%!&C<>_U%!84
  1901. &20008,6,"<Wimp$Scrap>":
  1902. &FF,"Data Transfer failed: Receiver died"
  1903. shell_AckRAMFetch(_Q%):
  1904. Exist%,temp%:temp%=_U%!&9C:
  1905. _Q%!&C<>_U%!&70
  1906. _U%!&80=0
  1907. &20023,"Wimp$Scrap",,-1,0,3
  1908. ,,Exist%:
  1909. Exist%<>0
  1910. $(temp%+44)="<Wimp$Scrap>"+
  1911. (0):temp%!0=(49+
  1912. shell_GetString(temp%+44)))
  1913. 3:temp%!&C=temp%!8:temp%!16=2:temp%!36=-1:
  1914. &400E7,18,temp%,temp%!4:_U%!&6C=temp%!8
  1915. shell_OK(
  1916. shell_MessageNoArgs("SHELLMSG14"))
  1917. shell_HeapBlockReturn(_U%!&98):_U%!&98=0:
  1918. shell_OK("SHELLMSG06")
  1919. shell_LoseFonts:
  1920. loop%,temp%:temp%=_U%!&E8:
  1921. loop%=0
  1922. temp%?loop%>0:
  1923. &40082,loop%:temp%?loop%-=1:
  1924. loop%:
  1925. shell_IconSetState(WindowHandle%,IconHandle%,EorWord%,ClearWord%):
  1926. icon_blk%:icon_blk%=
  1927. shell_HeapBlockFetch(16):!icon_blk%=WindowHandle%:icon_blk%!4=IconHandle%:icon_blk%!8=EorWord%:icon_blk%!&C=ClearWord%:
  1928. &400CD,,icon_blk%
  1929. shell_HeapBlockReturn(icon_blk%):
  1930. shell_StringPadLeading(string$,char$,length%):
  1931. (string$)<length%:string$=
  1932. length%-
  1933. (string$),char$)+string$:
  1934. :=string$
  1935. shell_StringUpperCase(string$):
  1936. loop%:
  1937. (string$)>0
  1938. loop%=1
  1939. (string$):
  1940. string$,loop%,1)>="a"
  1941. string$,loop%,1)<="z"
  1942. string$,loop%,1)=
  1943. string$,loop%,1))
  1944. loop%
  1945. :=string$
  1946. shell_IconDeselect(WindowHandle%,IconHandle%):
  1947. shell_IconSetState(WindowHandle%,IconHandle%,0,&200000):
  1948. shell_IconSelect(WindowHandle%,IconHandle%):
  1949. shell_IconSetState(WindowHandle%,IconHandle%,&200000,&200000):
  1950. shell_CheckType(type%,type_list%,DataOpen%):
  1951. Ok%,ctr%,found%,temp%,topbit_load%:ctr%=0:found%=-1:topbit_load%=
  1952. _U%!&64
  1953. _U%!&64=_U%!&64
  1954. type_list%!ctr%<>-1:temp%=type_list%!ctr%:
  1955. temp%
  1956. 1<<31
  1957. $temp%=temp%
  1958. 1<<31:topbit_load%=
  1959. topbit_load%=
  1960. temp%=type%
  1961. found%=ctr%:
  1962. topbit_load%
  1963. _U%!&64=_U%!&64
  1964. :ctr%+=4:
  1965. DataOpen%
  1966. (type%>=4096)
  1967. found%=-1
  1968. found%<>-1
  1969. shell_TopBitLoadInProgress:
  1970. _U%!&64
  1971. shell_LoadFile(Scrap%):
  1972. Name$,FileSize%,Flags%,loadloc%:Name$=
  1973. shell_GetString(_Q%+44):FileSize%=
  1974. shell_FileLength(Name$):
  1975. FileSize%<0
  1976. shell_OK(
  1977. shell_MessageNoArgs("SHELLMSG16"))
  1978. iloadloc%=
  1979. shell_HeapBlockFetch(FileSize%):
  1980. &20008,16,Name$,loadloc%,0
  1981. ;Flags%:
  1982. shell_VFlag(Flags%)
  1983. shell_HeapBlockReturn(loadloc%):
  1984. shell_OK(
  1985. shell_MessageNoArgs("SHELLMSG17"))
  1986. :=loadloc%
  1987. shell_UserFNLoadFile(type%,loadloc%,type_list%,_filename$,_file_size%,blk%):
  1988. ctr%,found%,temp%,void%:ctr%=0:found%=-1:
  1989. type_list%!ctr%<>-1:temp%=type_list%!ctr%:
  1990. temp%
  1991. 1<<31
  1992. temp%=temp%
  1993. 1<<31
  1994. temp%=type%
  1995. found%=ctr%
  1996. 7tctr%+=4:
  1997. :temp%=blk%!&C:void%=
  1998. ("FN"+$(temp%!found%)+"("+
  1999. loadloc%+","+
  2000. type%+",_filename$,"+
  2001. _file_size%+")"):
  2002. shell_IconGetValidation(wh%,ih%):
  2003. blk%,validation$,flags%:
  2004. ih%=-1
  2005. @svalidation$="":blk%=
  2006. shell_HeapBlockFetch(&64):blk%!0=wh%:blk%!4=ih%:
  2007. &400CE,,blk%:flags%=blk%!24:
  2008. flags%
  2009. blk%!32>0
  2010. validation$=$(blk%!32)
  2011. shell_HeapBlockReturn(blk%):=validation$
  2012. shell_MessageExpand(h$):
  2013. s$,m$,index%:s$="":
  2014. h$,"\")>0:index%=
  2015. h$,"\"):s$+=
  2016. h$,index%-1):m$=
  2017. h$,index%+1,1):h$=
  2018. h$,index%+2):
  2019. "A":s$+="Click ADJUST to"
  2020. "a":s$+="ADJUST"
  2021. "D":s$+="Drag with SELECT to"
  2022. "d":s$+="Drag with ADJUST to"
  2023. "G":s$+="This option is greyed out because"
  2024. "R":s$+="Move the pointer right"
  2025. "S":s$+="Click SELECT to"
  2026. "s":s$+="SELECT"
  2027. "T":s$+="This is the"
  2028. "W":s$+="This window is"
  2029. "w":s$+="window"
  2030. s$+="\"+m$
  2031. :=s$+h$
  2032. shell_DeleteWindow(handle%):
  2033. win_blk%:win_blk%=
  2034. shell_HeapBlockFetch(20):
  2035. handle%<>0
  2036. oktodeletew(handle%)
  2037. shell_EventDeleteAll(handle%):
  2038. handle%=_U%!20
  2039. _U%!20=0
  2040. p=offset%=
  2041. shell_SearchStatic(_U%!&B8,handle%):
  2042. offset%>-1
  2043. r#temp%=_U%!&B8+offset%:temp%!0=0
  2044. :win_blk%!0=handle%:
  2045. &400C3,,win_blk%:handle%=0
  2046. shell_HeapBlockReturn(win_blk%):=handle%
  2047. shell_WindowRetitle(
  2048. whandle%,title$):
  2049. temp%,win_blk%,handle%,t_buffer_len%:win_blk%=
  2050. shell_HeapBlockFetch(6000):win_blk%!0=whandle%:
  2051. &400CC,,win_blk%:
  2052. ((win_blk%!60)
  2053. 256)=0
  2054. ltemp%=win_blk%+76:$temp%=
  2055. title$,&B):
  2056. &400C3,,win_blk%:
  2057. &400C1,,win_blk%+4
  2058. handle%:
  2059. handle%<>whandle%
  2060. shell_UpdateWindowHandle(whandle%,handle%):whandle%=handle%
  2061. t_buffer_len%=win_blk%!84:$(!(win_blk%+76))=
  2062. title$,t_buffer_len%-1):
  2063. ((win_blk%!32)
  2064. (1<<16))<>0
  2065. &400D1,-1,win_blk%!4,win_blk%!16,win_blk%!&C,win_blk%!16+44
  2066. shell_HeapBlockReturn(win_blk%)
  2067. shell_MenuGetItemAddress(menu%,selection%):
  2068. ctr%,item_addr%:
  2069. &45BC7,menu%
  2070. menu%:
  2071. :item_addr%=menu%+28+((selection%!ctr%)*24):menu%=item_addr%!4:ctr%+=4:
  2072. selection%!ctr%=-1:=item_addr%
  2073. shell_MenuWarnDBox(addr%,x%,y%):
  2074. temp%,h%,void%:
  2075. Dtemp%=addr%!4:
  2076. shell_CreateWindow($temp%!0,h%):
  2077. $temp%!4<>""
  2078. &void%=
  2079. ("FN"+$temp%!4+"("+
  2080. h%+")")
  2081. $temp%!8<>""
  2082. &void%=
  2083. ("FN"+$temp%!8+"("+
  2084. h%+")")
  2085. &400E8,,h%,x%,y%:_U%!20=h%:
  2086. shell_FindMenuWarnEvent(item_handle%,
  2087. warn_fn$,
  2088. sel_fn$):
  2089. result%,e_list%,temp%,offset%,found%,list_size%,temp2%,ctr%:
  2090. submenu%:submenu%=0:e_list%=_U%!&DC:offset%=0:found%=
  2091. :warn_fn$="":submenu%=0:
  2092. shell_HeapBlockExists(e_list%)
  2093. :ctr%+=4:
  2094. e_list%!ctr%=-1:list_size%=ctr%:ctr%=0:
  2095. :temp%=!(e_list%+offset%+0):
  2096. temp%<>-1
  2097. temp%=item_handle%
  2098. found%=
  2099. :temp2%=e_list%!(offset%+4):warn_fn$=$temp2%:submenu%=e_list%!(offset%+8):temp2%=e_list%!(offset%+&C):sel_fn$=$temp2%
  2100. :offset%+=16
  2101. offset%=list_size%
  2102. found%
  2103. offset%>=list_size%
  2104. warn_fn$="":sel_fn$=""
  2105. shell_MenuWarnSubMenu(s_menu%,x%,y%,warn_fn$,sel_fn$):
  2106. void%,temp%,f_menu%,ctr%:_shell_FontMenuSelFN$=sel_fn$:
  2107. shell_HeapBlockExists(_U%!&E0)
  2108. shell_HeapBlockReturn(_U%!&E0)
  2109. [_U%!&E0=
  2110. shell_HeapBlockFetch(
  2111. warn_fn$+1):temp%=_U%!&E0:$temp%=warn_fn$:
  2112. warn_fn$<>""
  2113. ,void%=
  2114. ("FN"+warn_fn$+"(_U%!52,_U%!56)")
  2115. &400E8,,s_menu%,x%,y%:
  2116. shell_WindowIsOpen(wh%):=(
  2117. shell_WindowGetFlags(wh%)
  2118. 1<<16)
  2119. shell_TraceOn:_U%!48=
  2120. shell_BroadcastMessage(&43B00,"ShellDBug:TraceOn"):
  2121. shell_TraceOff:_U%!48=
  2122. shell_BroadcastMessage(&43B00,"ShellDBug:TraceOff"):
  2123. shell_ListClickSelect:
  2124. e_list%,ptr%,list_size%,temp%,temp2%:e_list%=_U%!&C:list_size%=
  2125. shell_HeapBlockInfo(e_list%):ptr%=0:
  2126. :temp%=e_list%!(ptr%+20):temp2%=e_list%+ptr%:
  2127. shell_HeapBlockExists(temp%)
  2128. $temp%<>""
  2129. :ptr%+=48:
  2130. (ptr%>=list_size%):
  2131. shell_ListClickAdjust:
  2132. e_list%,ptr%,list_size%,temp%,temp2%:e_list%=_U%!&C:list_size%=
  2133. shell_HeapBlockInfo(e_list%):ptr%=0:
  2134. :temp%=e_list%!(ptr%+24):temp2%=e_list%+ptr%:
  2135. shell_HeapBlockExists(temp%)
  2136. $temp%<>""
  2137. :ptr%+=48:
  2138. (ptr%>=list_size%):
  2139. shell_ListHelpTags:
  2140. e_list%,ptr%,list_size%,temp%,temp2%:e_list%=_U%!&C:list_size%=
  2141. shell_HeapBlockInfo(e_list%):ptr%=0:
  2142. :temp%=e_list%!(ptr%+44):temp2%=e_list%+ptr%:
  2143. shell_HeapBlockExists(temp%)
  2144. $temp%<>""
  2145. :ptr%+=48:
  2146. (ptr%>=list_size%):
  2147. shell_HandleUnknownMessage(_Q%):
  2148. shell_VFlag(Flags%):=((Flags%
  2149. 1)=1)
  2150. oktodeletew(handle%):=-1
  2151. shell_EventDeleteAll(wh%):
  2152. ptr%,menu%,found%,list_size%,event_list%,loop%:ptr%=0:menu%=0:found%=
  2153. wh%=-1
  2154. wh%=-2
  2155. '[list_size%=
  2156. shell_HeapBlockInfo(_U%!&C)-8:event_list%=_U%!&C:
  2157. (event_list%!ptr%=wh%)
  2158. found%=
  2159. ptr%+=48
  2160. (ptr%>=list_size%
  2161. found%):
  2162. found%
  2163. 1uevent_list%!(ptr%+0)=0:event_list%!(ptr%+4)=0:event_list%!(ptr%+8)=0:
  2164. loop%=&C
  2165. event_list%!(ptr%+loop%)<>0
  2166. shell_HeapBlockReturn(event_list%!(ptr%+loop%)):event_list%!(ptr%+loop%)=0
  2167. loop%
  2168. shell_Tracef0("EventDeleteAll:wh%=&"+
  2169. ~wh%):
  2170. shell_DeleteEventDataSave(wh%,-1):
  2171. shell_DeleteEventBump(wh%,-1):
  2172. shell_UpdateWindowHandle(old_handle%,new_handle%):
  2173. new_handle%<>old_handle%
  2174. _U%!28=old_handle%
  2175. _U%!28=new_handle%
  2176. shell_FixEventBlock(old_handle%,new_handle%,_U%!&C,48):
  2177. shell_FixEventBlock(old_handle%,new_handle%,_U%!96,16):
  2178. shell_FixEventBlock(old_handle%,new_handle%,_U%!72,24):
  2179. shell_FixEventBlock(old_handle%,new_handle%,_U%!92,24)
  2180. shell_FixEventBlock(old_handle%,new_handle%,_U%!&68,16):
  2181. shell_UpdateStaticWindows(old_handle%,new_handle%)
  2182. shell_WindowGetFlags(wh%):
  2183. flags%,blk%:blk%=
  2184. shell_HeapBlockFetch(36):blk%!0=wh%:
  2185. &400CB,,blk%:flags%=blk%!32:
  2186. shell_HeapBlockReturn(blk%):=flags%
  2187. shell_DeleteEventDataSave(wh%,ih%):
  2188. offset%,blk%,list_size%:
  2189. :offset%=
  2190. shell_GetEventListOffset(wh%,ih%,_U%+72,24,
  2191. offset%>=0
  2192. ih%=-1
  2193. shell_Tracef0("DeleteEventDataSave:Deleting DataSave Event (all events for window handle &"+
  2194. ~wh%+")")
  2195. shell_Tracef0("DeleteEventDataSave:Deleting DataSave Event (window handle was &"+
  2196. ~wh%+" icon handle was "+
  2197. ih%+")")
  2198. :list_size%=
  2199. shell_HeapBlockInfo(_U%!72)-8:
  2200. offset%=list_size%-24
  2201. offset%=0
  2202. shell_HeapBlockReturn(_U%!72):_U%!72=0
  2203. _U%!72=
  2204. shell_HeapBlockExtend(_U%!72,-24)
  2205. blk%=event_list%+offset%:blk%!0=0:blk%!4=0:blk%!8=0:blk%!&C=0:blk%!16=0:
  2206. shell_HeapBlockReturn(blk%!20):blk%!20=0
  2207. offset%<0:
  2208. shell_DeleteEventBump(wh%,ih%):
  2209. offset%,blk%,list_size%,event_list%,temp%:event_list%=_U%!&68:
  2210. :offset%=
  2211. shell_GetEventListOffset(wh%,ih%,_U%+&68,16,
  2212. shell_Tracef0("DeleteEventBump:offset%="+
  2213. offset%):
  2214. offset%>=0
  2215. ih%=-1
  2216. shell_Tracef0("DeleteEventBump:Deleting Bump Event (all events for window handle &"+
  2217. ~wh%+")")
  2218. shell_Tracef0("DeleteEventBump:Deleting Bump Event (window handle was &"+
  2219. ~wh%+" icon handle was "+
  2220. ih%+")")
  2221. :list_size%=
  2222. shell_HeapBlockInfo(_U%!&68)-8:
  2223. offset%=list_size%-16
  2224. offset%=0
  2225. info_blk%=event_list%!&C:temp%=info_blk%!&C:
  2226. shell_HeapBlockReturn(temp%!&C):
  2227. shell_HeapBlockReturn(temp%!16):
  2228. shell_HeapBlockReturn(temp%):
  2229. shell_HeapBlockReturn(_U%!&68):_U%!&68=0:
  2230. shell_Tracef0("DeleteEventDataSave:No Bump events now registered")
  2231. _U%!&68=
  2232. shell_HeapBlockExtend(_U%!&68,-16)
  2233. blk%=event_list%+offset%:blk%!0=0:blk%!4=0:blk%!8=0:info_blk%=blk%!&C:
  2234. shell_HeapBlockReturn(info_blk%!&C):
  2235. shell_HeapBlockReturn(info_blk%!16):
  2236. shell_HeapBlockReturn(info_blk%)
  2237. offset%<0:
  2238. shell_FixEventBlock(old_handle%,new_handle%,event_list%,offset%):
  2239. ptr%,list_size%:
  2240. shell_HeapBlockExists(event_list%)
  2241. Ulist_size%=
  2242. shell_HeapBlockInfo(event_list%)-8:
  2243. (event_list%!ptr%=old_handle%)
  2244.  event_list%!ptr%=new_handle%
  2245. :ptr%+=offset%:
  2246. (ptr%>=list_size%)
  2247. shell_UpdateStaticWindows(old_handle%,new_handle%):
  2248. offset%,w_list%:w_list%=_U%!&B8:offset%=
  2249. shell_SearchStatic(_U%!&B8,old_handle%):w_list%!offset%=new_handle%:
  2250.