Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2 » StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/WimpLib

StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/WimpLib

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Regulars2
Filename: StarInfo/Fletcher/!Setup/Files/Disc1/Program/NetGame/!NetGame/BasicLib/WimpLib
Read OK:
File size: 8A2B bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >WimpLib
   20REM LEN Justin Fletcher
   30REM Version : 1.73 (12 Jun 1997)
   40REM This version for RO3
   50ERROR &803,"Do not run the Wimp Library"
   60:
   70REM ******** Main Application Procedures ************
   80:
   90REM PROCinitlibrary : Initialise library variables
  100DEFPROCinitlibrary
  110DIM message_buffer% 1024
  120rmafontarea=-2:msgbuffer%=-1:msgbuffer2%=-1:ftblk=-2
  130ENDPROC
  140:
  150REM PROCnotemessage : Mark the given message as receiveable
  160DEFPROCnotemessage(n):messagelist%!messptr%=n:ENDPROC
  170:
  180REM FNloadtemplate : load the specified template
  190REM sprblk% should be 1 for the standard sprites
  200DEFFNloadtemplate(n$,sprblk%):LOCAL tsize%,blk%,ok%
  210SYS "Wimp_OpenTemplate",,Appdir$+".Templates"
  220SYS "Wimp_LoadTemplate",,0,,,,n$,0 TO ,,tsize%
  230DIM blk% tsize%
  240SYS "Wimp_LoadTemplate",,wspc%,blk%,blk% + tsize%,-1,n$,0 TO ,,,,,,ok%
  250SYS "Wimp_CloseTemplate"
  260IF ok%=0 THENERROR &803, "Template file "+n$+" not found"
  270wspc%!64=sprblk%:SYS "Wimp_CreateWindow",,wspc% TO blk%
  280=blk%
  290:
  300REM FNloadsprites : Load sprite file into new area
  310DEFFNloadsprites(file$):LOCAL len%,o%,sprblk%
  320o%=OPENIN(file$):IF o%=0 THEN=1
  330len%=EXT#o%+16:CLOSE#o%
  340DIM sprblk% len%:!sprblk%=len%:sprblk%!8=0
  350SYS"OS_SpriteOp",&109,sprblk%
  360SYS"OS_SpriteOp",&10A,sprblk%,file$
  370=sprblk%
  380:
  390REM FNGetEnv : Return the environment string stripped of loader
  400DEFFNGetEnv:LOCAL com$,I,p$
  410SYS "OS_GetEnv" TO com$
  420p$="":I=INSTR(com$," -quit ")
  430IF I>0 THEN
  440 p$=MID$(com$,INSTR(com$," ",I+LEN" -quit ")+1)
  450 WHILE LEFT$(p$,1)=" ":p$=MID$(p$,2):ENDWHILE
  460ENDIF
  470=p$
  480:
  490REM FNsystemvar : Return the contents of any string system var
  500DEFFNsystemvar(Var$):LOCAL len
  510SYS "XOS_ReadVarVal",Var$,message_buffer%,255,0,3TO,,len
  520message_buffer%?len=13
  530=$message_buffer%
  540:
  550REM PROCeerror : External error routine
  560REM should be called when errors occur during initialisation
  570DEFPROCeerror
  580LOCAL ERROR
  590ON ERROR LOCAL:PROCclosemessages:VDU4:ERROR EXT 0,REPORT$+" at line "+STR$ERL+" in error handler"
  600mess$="Internal error : ("+STR$ERL+") "+REPORT$
  610OSCLI("Set Error$ "+mess$):OSCLI("Set Error$Task Not known")
  620message_buffer%!0=ERR:$(message_buffer%+4)=mess$+" whilst initialising"+CHR$0
  630ON ERROR LOCAL:Appname$="uninitialised task"
  640a$=Appname$
  650ON ERROR LOCAL:PROCclosemessages:VDU4:ERROR EXT 0,REPORT$+" at line "+STR$ERL+" in error handler"
  660SYS "Wimp_ReportError",message_buffer%,9,Appname$
  670ENDPROC
  680:
  690REM PROCerror : Called at any BASIC error inside the desktop
  700REM ERROR numbers &800+ :
  710REM 0 = OK
  720REM 1 = Cancel
  730REM 2 = OK and Cancel (to quit)
  740REM Shift, Ctrl, Q and click to exit program
  750DEFPROCerror:LOCAL errcode,mess$,reply%
  760LOCAL ERROR
  770ON ERROR LOCAL:PROCclosemessages:VDU4:ERROR EXT 0,REPORT$+" at line "+STR$ERL+" in error handler"
  780SYS "OS_Byte",124
  790IF ERR>&7FF AND ERR<&803 THEN
  800 errcode=ERR-&7FF:mess$=REPORT$
  810 IF errcode=3 THENmess$+=" (Cancel to Quit)"
  820 reply%=FNerrorbox(Appname$,mess$,errcode)
  830 IF reply%=2 AND errcode=3 THENquit%=TRUE
  840ELSE
  850 mess$="Internal error : ("+STR$ERL+") "+REPORT$+" Cancel to Quit"
  860 reply%=FNerrorbox(Appname$,mess$,%11)
  870 IF reply%<>1 THEN
  880  quit%=TRUE:OSCLI("Set Error$ "+mess$)
  890  OSCLI("Set Error$Task "+Appname$)
  900 ENDIF
  910 IF INKEY(-1) AND INKEY(-2) AND INKEY(-17) THENOSCLI("Spool"):END
  920ENDIF
  930ENDPROC
  940:
  950REM FNerrorbox : create an error box with up to 2 buttons
  960REM Bit Value Effect if set
  970REM  0    1   Include an OK option    } if both unset then as
  980REM  1    2   Include a Cancel option } bit 0 set
  990REM  2    4   Reversed buttons, OK=White, Cancel=Yellow and action
 1000REM  3    8   ?
 1010REM  4    16  Title is just title (not Error from title)
 1020REM  5    32  Dangerous, do not use
 1030REM  6    64  No error box ?
 1040REM  7   128  Don't beep
 1050DEFFNerrorbox(title$,message$,button%):title$=FNmsgtext(title$)
 1060message$=FNmsgtext(message$)
 1070$(message_buffer%+4)=message$:!message_buffer%=0
 1080SYS "Wimp_ReportError",message_buffer%,button%,title$ TO ,reply%
 1090=reply%
 1100:
 1110REM PROCshowfree : display in infobox% the free space
 1120DEFPROCshowfree
 1130LOCAL ERROR
 1140ON ERROR LOCAL:IF ERR=&803 THENPROCseticontext(infobox%,4,"Old template"):ENDPROC ELSEENDPROC
 1150PROCseticontext(infobox%,5,"Program")
 1160PROCseticontext(infobox%,1,STR$(TOP-PAGE)+" bytes, "+STR$((TOP-PAGE)DIV&400)+"K")
 1170PROCseticontext(infobox%,6,"Vars")
 1180PROCseticontext(infobox%,2,STR$(END-LOMEM)+" bytes, "+STR$((END-LOMEM)DIV&400)+"K")
 1190PROCseticontext(infobox%,7,"Free")
 1200PROCseticontext(infobox%,3,STR$(HIMEM-END)+" bytes, "+STR$((HIMEM-END)DIV&400)+"K")
 1210PROCheap_free(heapsize,heapfree)
 1220PROCseticontext(infobox%,8,"Heap")
 1230PROCseticontext(infobox%,4,STR$(heapsize-heapfree)+" bytes, "+STR$((heapsize-heapfree)DIV&400)+"K of "+STR$(heapsize DIV&400)+"K")
 1240ENDPROC
 1250:
 1260REM ******** Menu manipulation procedures ***********
 1270:
 1280REM FNcreatemenu : Create a menu given a control string
 1290REM Menu Format :
 1300REM Title|Item|Item|Item
 1310REM Item consists of :
 1320REM Entry or Entry]Flags
 1330REM Flags can be : (separated by commas)
 1340REM  T for ticked
 1350REM  D for dotted underneath
 1360REM  W for writable
 1370REM  S for shaded
 1380REM  K for key shortcut (^=ctrl, FN=shift)
 1390REM  > followed by variable for sub-menu (Item]>submenu%|)
 1400REM  } followed by a sprite name (Item]}sprite|)
 1410REM NB:The last two flags can be used together if comma seperated
 1420REM    eg. Info]>info%,}!Help|
 1430REM NB:If the spritename starts with sm then the sprite will be
 1440REM    displayed using its small form, otherwise it will be
 1450REM    shrunk to half size.
 1460DEFFNcreatemenu(A$)
 1470LOCAL pointer,p2,p3,l,lk,O$,C$,oind%,oindl%,ks%,k$,S$
 1480oind%=ind%:oindl%=indl%:ks%=FALSE
 1490pointer=menu%:l=0:A$+="|"
 1500PROCmenuputs(FNmget(A$,C$))
 1510PROCmenuputw(&70207)
 1520p2=menu%:PROCmenuputw(&80)
 1530PROCmenuputw(&2C)
 1540PROCmenuputw(0):options%=0:S$=A$:lk=0
 1550REPEAT
 1560 IF ks%=TRUE THENks%=TRUE*2
 1570 REPEAT
 1580  O$=FNmget(A$,C$):options%=options%+1
 1590  flags=FNmdecode(C$,p3,s$,k$)+((-(A$=""))<<7)
 1600  IF ks%=TRUE*2 AND k$<>"" THEN
 1610   O$+=STRING$(l+lk-(LEN(O$)+LEN(k$))+1," ")
 1620   IF LEFT$(k$,1)="�" THENMID$(k$,1,1)=CHR$(139)
 1630   O$+=k$
 1640  ELSE
 1650   IF k$<>"" THENks%=TRUE:IF lk<LEN(k$) THENlk=LEN(k$)
 1660  ENDIF
 1670  flags2=&7000021+((-(LEN(O$)>11))<<8)+(1<<14)*(flags AND256)
 1680  IF (flags AND 4)<>0 THENflags2=flags2 OR 256
 1690  PROCmenuputw(flags AND 255)
 1700  PROCmenuputw(p3)
 1710  IFLEN(O$)>l AND ks%<>TRUE*2 THENl=LEN(O$)
 1720  PROCmenuputw(flags2)
 1730  PROCmenustring(O$,s$,(flags AND 4))
 1740 UNTILA$=""
 1750 IF ks%=TRUE*2 THENl+=lk+1 ELSEIFks%=TRUE THENind%=oind%:indl%=oindl%:menul%+=menu%-p2-12:menu%=p2+12:options%=0:A$=S$
 1760UNTIL ks%<>TRUE
 1770!p2=l*16+16
 1780=pointer
 1790DEFPROCmenustring(T$,s$,flag):IF LEFT$(T$,1)="�" THENT$=EVAL(MID$(T$,2))
 1800IFLEN(T$)<12 AND s$="" AND flag=0THEN
 1810 PROCmenuputs(T$)
 1820ELSE
 1830 PROCmenuputw(FNindirect(T$))
 1840 IF s$<>"" THEN
 1850  menu%!-8=menu%!-8 OR &803
 1860  IFLEFT$(FNlower(s$),2)="sm" THENmenu%!-8=menu%!-8 EOR &800
 1870  PROCmenuputw(FNindirect("S"+s$))
 1880 ELSE
 1890  PROCmenuputw(-1)
 1900 ENDIF
 1910 PROCmenuputw(LEN(T$)+1)
 1920ENDIF
 1930ENDPROC
 1940DEFFNmget(RETURN A$,RETURN C$)
 1950LOCAL B$:B$=LEFT$(A$,INSTR(A$,"|")-1)
 1960A$=MID$(A$,LEN(B$)+2):IFINSTR(B$,"]")<1THENB$+="]"
 1970C$=MID$(B$,INSTR(B$,"]")+1):B$=LEFT$(B$,INSTR(B$,"]")-1)
 1980=FNmsgtext(B$)
 1990DEFPROCmenuputs(T$):IFLEN(T$)>11 THENERROR &803,"Menu entry too long"
 2000$menu%=T$:menu%+=12:menul%-=12
 2010IFmenul%<=4 THENERROR &803,"Not enough memory for menus"
 2020ENDPROC
 2030DEFPROCmenuputw(W%)
 2040!menu%=W%:menu%+=4:menul%-=4
 2050IFmenul%<=4 THENERROR &803,"Not enough memory for menus"
 2060ENDPROC
 2070DEFFNmdecode(A$,RETURN p,RETURN s$,RETURN k$)
 2080LOCAL B$,C$,V:p=-1:s$="":k$="":A$=A$+","
 2090WHILE A$<>""
 2100 B$=LEFT$(A$,1):A$=MID$(A$,2)
 2110 CASE B$ OF
 2120  WHEN "T":V=V OR 1
 2130  WHEN "D":V=V OR 2
 2140  WHEN "W":V=V OR 4
 2150  WHEN "M":V=V OR 8
 2160  WHEN "S":V=V OR 256
 2170  WHEN "K":k$=LEFT$(A$,INSTR(A$,",")-1):A$=MID$(A$,INSTR(A$,",")+1)
 2180  WHEN ">":p=EVAL(LEFT$(A$,INSTR(A$,",")-1)):A$=MID$(A$,INSTR(A$,",")+1)
 2190  WHEN "}":s$=LEFT$(A$,INSTR(A$,",")-1)+" ":A$=MID$(A$,INSTR(A$,",")+1)
 2200 ENDCASE
 2210ENDWHILE
 2220=V
 2230:
 2240REM FNindirect : Place a string in indirection buffer (ret. loc)
 2250DEFFNindirect(a$):LOCAL i:i=ind%
 2260IFLEN(a$)>indl%-1 THENERROR &803,"Not enough room for indirection"
 2270$ind%=a$:ind%+=LEN(a$)+1:indl%-=LEN(a$)+1
 2280=i
 2290:
 2300REM PROCibmenu       : Create an iconbar menu from ibmenu%
 2310REM PROCmenu         : Create the menu at co-ords or mouse if x=-1
 2320REM PROCrecreatemenu : Recreate the menu just used
 2330DEFPROCibmenu
 2340SYS "Wimp_GetPointerInfo",,b%:curmenu%=ibmenu%:cmenux%=b%!0-64:cmenuy%=96+&2C*iboptions%
 2350SYS "Wimp_CreateMenu",,ibmenu%,b%!0-64,96+&2C*iboptions%
 2360ENDPROC
 2370DEFPROCmenu(menu%,x,y)
 2380IF x=-1 THEN
 2390 SYS "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4
 2400ENDIF
 2410curmenu%=menu%:cmenux%=x-64:cmenuy%=y+20
 2420SYS "Wimp_CreateMenu",,menu%,x-64,y+20
 2430ENDPROC
 2440DEFPROCrecreatemenu
 2450SYS "Wimp_CreateMenu",,curmenu%,cmenux%,cmenuy%
 2460ENDPROC
 2470:
 2480REM PROCmenuuntick: Untick a group of options
 2490REM PROCmenutick  : Tick/untick option on menu
 2500REM PROCmenushade : Shade/unshade option on menu
 2510REM FNmenuticked  : Return TRUE if menu item is ticked
 2520REM FNmenushaded  : Return TRUE if menu item is shaded
 2530REM type = 0 for untick
 2540REM type = 1 for tick (also -1)
 2550REM type = 2 for toggle
 2560DEFPROCmenuuntick(menu,start,end)
 2570menu+=start*24+28
 2580REPEAT
 2590 !menu=!menu AND -2:start+=1:menu+=24
 2600UNTIL (end<>-1 AND start>end) OR ((menu!-24) AND &80)=&80
 2610ENDPROC
 2620DEFPROCmenutick(menu,option,toggle):menu+=option*24+28
 2630CASE toggle OF
 2640 WHEN 0:!menu=!menu AND -2
 2650 WHEN -1,1:!menu=!menu OR 1
 2660 WHEN 2:!menu=!menu EOR 1
 2670ENDCASE
 2680ENDPROC
 2690DEFPROCmenushade(menu,option,toggle):menu+=option*24+36
 2700CASE toggle OF
 2710 WHEN 0:!menu=!menu AND NOT(1<<22)
 2720 WHEN -1,1:!menu=!menu OR (1<<22)
 2730 WHEN 2:!menu=!menu EOR (1<<22)
 2740ENDCASE
 2750ENDPROC
 2760DEFFNmenuticked(menu%,item%)
 2770=((menu%!(28+24*item%)) AND 1)=1
 2780DEFFNmenushaded(menu%,item%)
 2790=((menu%!(28+24*item%)) AND 4)=4
 2800:
 2810REM PROCsetmenutext : Set the text for menu option
 2820REM FNgetmenutext   : Read the text for menu option
 2830DEFPROCsetmenutext(menu,option,text$):menu+=option*24+36
 2840IF (!menu AND&100)>0 THEN$(menu!4)=text$ ELSE$(menu+4)=text$
 2850ENDPROC
 2860DEFFNgetmenutext(menu,option):menu+=option*24+36:LOCAL text$
 2870IF (!menu AND&100)>0 THENtext$=$(menu!4) ELSEtext$=$(menu+4)
 2880=text$
 2890:
 2900REM FNdecodemenu : Return menu selection as string
 2910REM also returns for font if menu is fontmenu
 2920DEFFNdecodemenu(menu%):LOCAL cp%,ptr,b$,c$:cp%=menu%:ptr=0
 2930WHILE (b%!ptr>-1 AND cp%<>rmafontarea)
 2940 cp%=cp%!(32+(b%!ptr)*24):ptr+=4
 2950ENDWHILE
 2960IF cp%=rmafontarea AND b%!ptr<>0 THEN
 2970 SYS "Font_DecodeMenu",,rmafontarea,b%+ptr,STRING$(255,CHR$0),255 TO,,,m$
 2980ELSE
 2990 SYS "Wimp_DecodeMenu",,menu%,b%,STRING$(255,CHR$0),255 TO,,,m$
 3000 b$=""
 3010 REPEAT
 3020  c$=LEFT$(m$,INSTR(m$+".",".")-1):m$=MID$(m$,LEN(c$)+2)
 3030  c$=LEFT$(c$,INSTR(c$+" ^"," ^")-1)
 3040  c$=LEFT$(c$,INSTR(c$+" "+CHR$139," "+CHR$139)-1)
 3050  CASE RIGHT$(c$,3) OF
 3060   WHEN "Esc","Del","Ins","End","Hom","Cpy","F10","F11","F12","F13","Prt","Tab","Ret":c$=LEFT$(c$,LEN(c$)-4)
 3070  ENDCASE
 3080  IF MID$(c$,LEN(c$)-2,2)=" F" THENIFRIGHT$(c$)="0" OR VAL(RIGHT$(c$))<>0 THENc$=LEFT$(c$,LEN(c$)-3)
 3090  WHILE RIGHT$(c$)=" ":c$=LEFT$(c$):ENDWHILE
 3100  b$+=c$+"."
 3110 UNTILm$="" OR m$="."
 3120 IF m$="." THENb$+=".."
 3130 m$=LEFT$(b$)
 3140ENDIF
 3150=m$
 3160:
 3170REM FNgetfontmenu       : Return memory location of font menu
 3180REM PROCreleasefontmenu : Release memory used by fontmenu
 3190DEFFNgetfontmenu(font$):LOCAL space,ind
 3200SYS "Hourglass_On"
 3210SYS "Font_ListFonts",,,7<<19,,,,1 TO ,,,space,,ind
 3220PROCrelease(rmafontarea):rmafontarea=FNclaim(space+ind)
 3230IF rmafontarea<0 THENSYS "Hourglass_Off":=-1
 3240IF font$<>"" AND font$<>"System font" THEN
 3250 SYS "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,font$
 3260ELSE
 3270 SYS "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,-(font$="System font")
 3280ENDIF
 3290SYS "Hourglass_Off"
 3300=rmafontarea
 3310DEFPROCreleasefontmenu:PROCrelease(rmafontarea):ENDPROC
 3320:
 3330REM FNcreateftmenu    : Create a filetype menu
 3340REM PROCreleaseftmenu : Release space used by FT menu
 3350DEFFNcreateftmenu
 3360LOCAL len,name,type,flags,mlen,ilen,n$,v$,mst
 3370SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256 TO ,,len,name,type;flags
 3380mlen=28+24:ilen=9
 3390WHILE (flags AND1)<>1
 3400 IF type=0 THEN
 3410  mlen+=24:n$=RIGHT$(FNstring0(name),3)
 3420  SYS "XWimp_SpriteOp",24,,"Small_"+n$ TO;f
 3430  IF (f AND1)=1THEN
 3440   SYS "XWimp_SpriteOp",24,,"File_"+n$ TO;f
 3450   IF (f AND1)=0THENilen+=11+len ELSEilen+=len+11
 3460  ELSE
 3470   ilen+=12+len
 3480  ENDIF
 3490 ENDIF
 3500 SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name TO ,,len,name,type;flags
 3510ENDWHILE
 3520ftblk=FNclaim(mlen+ilen)
 3530IF ftblk=-1 THEN
 3540 ftblk=FNclaim(28+24+9)
 3550 $ftblk="File types":ftblk!12=&70207
 3560 ftblk!16=16*12:ftblk!20=&28:ftblk!24=0
 3570 ftblk!28=&80:ftblk!32=-1:ftblk!36=&7000121
 3580 ftblk!40=ftblk+28+24:ftblk!44=0:ftblk!48=9
 3590 $(ftblk+28+24)=""
 3600ELSE
 3610 $ftblk="File types":ftblk!12=&70207
 3620 ftblk!16=16*12:ftblk!20=&28:ftblk!24=0
 3630 ilen=mlen+ftblk:mlen=ilen-24:mst=mlen
 3640 SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,0 TO ,,len,name,type;flags
 3650 WHILE (flags AND1)<>1
 3660  IF type=0 THEN
 3670   message_buffer%!len=0:n$=RIGHT$(FNstring0(name),3):v$=FNstring0(message_buffer%)
 3680   mlen!0=0:mlen!4=-1
 3690   SYS "XWimp_SpriteOp",24,,"Small_"+n$ TO;f
 3700   IF (f AND1)=1THEN
 3710    SYS "XWimp_SpriteOp",24,,"File_"+n$ TO;f
 3720    IF (f AND1)=0THENn$="File_"+n$ ELSEn$="File_xxx"
 3730    mlen!8=&7000933
 3740   ELSE
 3750    n$="Small_"+n$:mlen!8=&7000133
 3760   ENDIF
 3770   mlen!12=ilen:$ilen=v$:ilen+=LEN(v$)+1
 3780   mlen!16=ilen:$ilen="s"+n$:ilen+=LEN(n$)+2
 3790   mlen!20=LEN(v$)+1:mlen-=24
 3800  ENDIF
 3810  SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name TO ,,len,name,type;flags
 3820 ENDWHILE
 3830 mlen!0=4:mlen!4=-1:mlen!8=&7000121:mlen!12=ilen
 3840 $ilen="":ilen+=9:mlen!16=-1:mlen!20=9:mlen-=24:!mst=&80
 3850ENDIF
 3860=ftblk
 3870DEFPROCreleaseftmenu:PROCrelease(ftblk):ENDPROC
 3880:
 3890REM ******** Window manipulation routines ***********
 3900:
 3910REM PROCclosewin      : Close a window
 3920REM PROCopenwin       : Open a window at top of stack
 3930REM PROCopenwinat     : Open a window at top-left corner x,y
 3940REM PROCopenwincentre : Open window in centre of screen
 3950REM PROCopenwinto     : Open window at position within TWA
 3960DEFPROCclosewin(win%)
 3970!b%=win%:SYS "Wimp_CloseWindow",,b%
 3980ENDPROC
 3990DEFPROCopenwin(win%)
 4000!b%=win%:SYS "Wimp_GetWindowState",,b%
 4010b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4020ENDPROC
 4030DEFPROCopenwinat(win%,x,y):LOCAL width,height
 4040!b%=win%:SYS "Wimp_GetWindowState",,b%
 4050width=b%!4-b%!12:height=b%!16-b%!8
 4060b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
 4070b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4080ENDPROC
 4090DEFPROCopenwincentre(win%):LOCAL width,height,top,right
 4100!b%=4:b%!4=5:b%!8=11:b%!12=12:b%!16=-1
 4110SYS "OS_ReadVduVariables",b%,b%+20
 4120right=b%!28+1<<b%!20:top=b%!32+1<<b%!24
 4130!b%=win%:SYS "Wimp_GetWindowState",,b%
 4140width=b%!4-b%!12:height=b%!16-b%!8
 4150x=(right-width)/2+width:y=(top-height)/2+height
 4160b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
 4170b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4180ENDPROC
 4190REM l=left of VWA in TWA, t=top of VWA in TWA
 4200REM r=right of VWA in TWA, b=bottom of VWA in TWA
 4210REM Window does not move, but its size is altered to difference
 4220REM between l&w and t&h. Top left of VWA is positioned to tl.
 4230REM If rb = -1 then no actual size change, just position.
 4240DEFPROCopenwinto(win%,l,t,r,b)
 4250!b%=win%:SYS "Wimp_GetWindowState",,b%
 4260IF l=-1 THENl=b%!20
 4270IF t=-1 THENb=b%!24
 4280IF r=-1 THENr=b%!12-b%!4
 4290IF b=-1 THENt=b%!8-b%!16
 4300b%!12=b%!4+r-l:b%!8=b%!16+b-t:b%!20=l:b%!24=t
 4310SYS"Wimp_OpenWindow",,b%
 4320ENDPROC
 4330:
 4340REM PROCresizewinto : Resizes window and re-opens if needed
 4350REM Will keep to full size if possible
 4360DEFPROCresizewinto(win%,l,t,r,b)
 4370LOCAL full%,open%
 4380!b%=win%:SYS "Wimp_GetWindowState",,b%
 4390REM If full size, open full size, and if open, re-open
 4400open%=(b%!32 AND (1<<16))>0:IF NOT open% THENb%!28=-3
 4410SYS "Wimp_OpenWindow",,b%:SYS "Wimp_GetWindowState",,b%
 4420full%=(b%!32 AND (1<<18))>0
 4430b%!68=l:b%!72=b:b%!76=r:b%!80=t
 4440SYS "Wimp_SetExtent",win%,b%+68
 4450IF full% THENb%!8=b%!16+b-t:b%!12=b%!4+r-l
 4460SYS "Wimp_OpenWindow",,b%
 4470IF open% THENSYS "Wimp_ForceRedraw",win%,l,b,r,t ELSESYS "Wimp_CloseWindow",,b%
 4480ENDPROC
 4490REMfull%=( (((b%!12)-(b%!4))=b%!52) AND (((b%!16)-(b%!8))=b%!56) )
 4500:
 4510REM PROCwinsetextent : Set the maximum extent of window (TWA)
 4520DEFPROCwinsetextent(win%,l,t,r,b)
 4530!b%=win%:SYS "Wimp_GetWindowInfo",,b%+1
 4540IF l=-1 THENl=b%!44
 4550IF b=-1 THENb=b%!48
 4560IF r=-1 THENr=b%!52
 4570IF t=-1 THENt=b%!56
 4580b%!44=l:b%!48=b:b%!52=r:b%!56=t
 4590SYS"XWimp_SetExtent",win%,b%+44
 4600ENDPROC
 4610:
 4620REM PROCforceredraw : Redraw the specified part of the window
 4630DEFPROCforceredraw(win%,l,t,r,b)
 4640SYS "Wimp_ForceRedraw",win%,l,b,r,t
 4650ENDPROC
 4660:
 4670REM PROCwindowtitle : Set window title (only if indirected)
 4680DEF PROCwindowtitle(win%,title$)
 4690LOCAL loc%,a$
 4700b%!0=win%:SYS "Wimp_GetWindowInfo",,b%+1
 4710loc%=!(b%+76):a$=FNmsgtext(title$)
 4720IF FNstring0(loc%)<>a$ THEN
 4730 $loc%=a$:b%!32=win%:SYS "Wimp_GetWindowOutline",,b%+32
 4740 SYS "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
 4750ENDIF
 4760ENDPROC
 4770:
 4780REM ************ Nested Window Manager specific ************
 4790REM PROCembedwin   : embeds a window within another
 4800REM PROCembedwin   : embeds a window within another with winflags
 4810REM PROCunembedwin : unembed a window from another
 4820REM FNparentwin    : Returns the parent window of a child
 4830DEFPROCembedwin(parent%,child%,flags%)
 4840!b%=child%:SYS "Wimp_GetWindowState",,b%
 4850SYS "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% AND NOT 1
 4860ENDPROC
 4870DEFPROCembedwinwith(parent%,child%,flags%,winflags%)
 4880!b%=child%:SYS "Wimp_GetWindowState",,b%:b%!32=winflags%
 4890SYS "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% OR 1
 4900ENDPROC
 4910DEFPROCunembedwin(parent%,child%)
 4920!b%=child%:SYS "Wimp_GetWindowState",,b%
 4930SYS "Wimp_CloseWindow",,b%,&4B534154,parent%
 4940ENDPROC
 4950DEFFNparentwin(child%)
 4960LOCAL parent%
 4970!b%=child%:SYS "Wimp_GetWindowState",,b%,&4B534154 TO ,,,parent%
 4980=parent%
 4990:
 5000REM ******** Icon manipulation routines *************
 5010:
 5020REM FNcreateicon : Create an icon with set parameters
 5030REM window,x,y, width, height, title, validation, colours,
 5040REM ESG, button type, flags
 5050REM col could be font handle if use font is set
 5060REM otherwise col is &BF (B=background, F=foreground) (usu. &17)
 5070REM Quick flags : %AFVHB00 (A=Font, F=Filled, B=Border)
 5080REM Flags :
 5090REM 0 : Text           8 : N/A
 5100REM 1 : Sprite         9 : Right Justified
 5110REM 2 : Bordered      10 : Multiple selection with adjust
 5120REM 3 : H Centre      11 : Small sprite
 5130REM 4 : V Centre      20 : ?
 5140REM 5 : Filled        21 : Inverted
 5150REM 6 : Use fonts     22 : Shaded
 5160REM 7 : N/A           23 : ?
 5170REM Button types :
 5180REM 0 : Ignore clicks
 5190REM 1 : Notify when over
 5200REM 2 : Clicks repeat & notify
 5210REM 3 : Clicks debounce & notify
 5220REM 4 : Click selects, release notifies, or deselect if moved
 5230REM 5 : Click selects, 2 clicks notifies
 5240REM 6 : As 3 but will drag
 5250REM 7 : As 4 but will drag
 5260REM 8 : As 5 but will drag
 5270REM 9 : Menu icon
 5280REM 10: Click=but*256,drag=but*16,2 clicks=but
 5290REM 11: Radio (Validation format : Soptoff,opton)
 5300REM 12/13 : N/A
 5310REM 14: Writeable/Clickable/Draggable
 5320REM 15: Writeable
 5330DEFFNcreateicon(win,x,y,w,h,title$,valid$,col,esg,but,flags)
 5340LOCAL handle:title$=FNmsgtext(title$)
 5350b%!0=win:b%!4=x:b%!8=y-h:b%!12=x+w:b%!16=y
 5360b%!20=(flags AND (%111001111111+(15<<20)))+(col<<24)
 5370b%!20+=(esg<<16)+(but<<12)
 5380IF valid$<>"" OR LEN(title$)>11 OR title$=CHR$0 THEN
 5390 IF title$=CHR$0 THEN
 5400  b%!24=FNindirect(STRING$(255,CHR$0)):b%!32=256
 5410 ELSE
 5420  b%!24=FNindirect(title$):b%!32=LEN(title$)+1
 5430 ENDIF
 5440 b%!28=FNindirect(valid$):b%!20+=1<<8
 5450ELSE
 5460 $(b%+24)=title$
 5470ENDIF
 5480IF ((b%!20) AND &103)=&3 THENERROR &803,"Cannot make a sprite/text icon without validation"
 5490IF (flags AND 3)=0 THENb%!20+=1
 5500IF FNlower(LEFT$(valid$,1))="s" THEN b%!20=b%!20 OR 2
 5510SYS "Wimp_CreateIcon",,b% TO handle
 5520=handle
 5530:
 5540REM PROCdeleteicon : Delete the icon from the window
 5550DEFPROCdeleteicon(win,icon)
 5560!b%=win:b%!4=icon:SYS "Wimp_DeleteIcon",,b%
 5570ENDPROC
 5580:
 5590REM FNCreateIconBarIcon : Create an icon for the icon bar
 5600REM Icon-bar positions (low byte)
 5610REM 1 = right, 2 = left
 5620REM 3 = left relative to (high byte) icon
 5630REM 4 = right relative to (high byte) icon
 5640REM 5 = left, high priority (high byte=priority value)
 5650REM 6 = left, low priority (ditto)
 5660REM 7 = right, low priority (ditto)
 5670REM 8 = right, high priority (ditto)
 5680DEFFNCreateIconBarIcon(Spr$,title$,pos%):LOCAL ic%,w%,m%,e%
 5690title$=FNmsgtext(title$):b%!0=-(ABS(pos%) AND &FF)
 5700b%!4=0:b%!8=-16:b%!12=12+16*LEN(title$):b%!16=88
 5710IFb%!12<12+16*4 THEN b%!12=12+16*4
 5720IF title$<>"" THEN
 5730 b%!20=(1<<28)+(7<<24)+(3<<12)+(%01011)+(1<<8)
 5740 b%!24=FNindirect(title$)
 5750 b%!28=FNindirect("S"+Spr$)
 5760 b%!32=LEN(title$)+1
 5770ELSE
 5780 b%!20=(1<<28)+(7<<24)+(3<<12)+(%11010)
 5790 $(b%+24)=Spr$
 5800ENDIF
 5810SYS "Wimp_SpriteOp",&128,,LEFT$(Spr$,INSTR(Spr$+",",",")) TO,,,w%,m%
 5820SYS "XOS_ReadModeVariable",m%,4 TO ,,e%:w%=(w%+1)<<e%
 5830IF w%>b%!12 THENb%!12=w%
 5840IF (ABS(pos%)AND&FF)=3 OR (ABS(pos%)AND&FF)=4 THENpos%=ABS(pos%)>>8 ELSEpos%=(ABS(pos%) AND &FF00)<<16
 5850SYS "Wimp_CreateIcon",pos%,b% TO ic%
 5860=ic%
 5870:
 5880REM FNgeticonstate : Return -1 if icon is selected,0 otherwise
 5890DEF FNgeticonstate(win%,icon%)
 5900!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 5910=(b%!24>>21 AND 1)>0
 5920:
 5930REM PROCiconshade  : unshade/shade/toggle an icon
 5940REM PROCiconstate  : unselect/select/toggle an icon
 5950REM PROCseticonbit : set/unset/toggle a bit in an icon
 5960DEFPROCiconshade(win%,icon%,type%)
 5970PROCseticonbit(win%,icon%,22,type%)
 5980ENDPROC
 5990DEFPROCiconstate(win%,icon%,type%)
 6000PROCseticonbit(win%,icon%,21,type%)
 6010ENDPROC
 6020REM type = 0 for untick
 6030REM type = 1 for tick (also -1)
 6040REM type = 2 for toggle
 6050DEFPROCseticonbit(win%,icon%,bit%,type%)
 6060LOCAL s%,t%
 6070CASE type% OF
 6080 WHEN 0:s%=0<<bit%:t%=1<<bit%
 6090 WHEN -1,1:s%=1<<bit%:t%=1<<bit%
 6100 WHEN 2:s%=1<<bit%:t%=0<<bit%
 6110ENDCASE
 6120b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
 6130SYS "Wimp_SetIconState",,b%
 6140ENDPROC
 6150:
 6160REM PROCpressicon  : Make the icon pressed and released
 6170REM PROCredrawicon : Force the redraw of the icon
 6180DEFPROCpressicon(win%,icon%)
 6190LOCAL t%:PROCseticonbit(win%,icon%,21,1)
 6200t%=TIME:REPEAT:UNTILTIME>t%+15:PROCseticonbit(win%,icon%,21,0)
 6210ENDPROC
 6220DEFPROCredrawicon(win%,icon%)
 6230win%+=win%=-1:!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6240SYS "Wimp_ForceRedraw",win%,b%!8,b%!12,b%!16,b%!20
 6250ENDPROC
 6260:
 6270REM FNgeticontext   : return icons text string (or sprite)
 6280REM PROCseticontext : set icons text string (or sprite)
 6290DEFFNgeticontext(win%,icon%)
 6300b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6310IF ((b%!24) AND &100)=0 THEN=FNstring0(b%+28)
 6320=FNstring0(b%!28)
 6330DEFPROCseticontext(win%,icon%,text$):LOCAL i%
 6340text$=FNmsgtext(text$):SYS "Wimp_GetCaretPosition",,b%
 6350i%=(!b%=win%) AND (icon%=b%!4)
 6360b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6370IF ((b%!24) AND &100)=0 THEN ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6380IF FNstring0(b%!28)<>text$ THEN
 6390 IF LEN(text$)<b%!36 THEN$(b%!28)=text$ ELSEERROR &803,"Text too long for icon (#"+STR$icon%+")"
 6400 !b%=win%:b%!4=icon%:b%!8=0:b%!12=0:SYS "Wimp_SetIconState",,b%
 6410 IF i% AND (b%!24 AND 1)=1 THENSYS "Wimp_SetCaretPosition",win%,icon%,-1,-1,-1,LEN(text$)
 6420ENDIF
 6430ENDPROC
 6440:
 6450REM FNgeticonvalid   : return icons validation string
 6460REM PROCseticonvalid : set icons validation string
 6470REM Remember not to exceed the original validation string's
 6480REM length.
 6490DEFFNgeticonvalid(win%,icon%)
 6500b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6510IF ((b%!24) AND &100)=0 ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6520=FNstring0(b%!32)
 6530DEFPROCseticonvalid(win%,icon%,text$)
 6540b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6550IF ((b%!24) AND &100)=0 THEN ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6560$(b%!32)=text$:PROCredrawicon(win%,icon%)
 6570ENDPROC
 6580:
 6590REM PROCdragicon : Start a drag box
 6600REM bound% should be TRUE if you wish the icon to stay within the
 6610REM window
 6620DEFPROCdragicon(win%,icon%,bound%)
 6630!b%=win%:SYS "Wimp_GetWindowState",,b%
 6640sx%=b%!20:sy%=b%!24
 6650x0%=b%!4-sx%:y0%=b%!8-sy%:x1%=b%!12-sx%:y1%=b%!16-sy%
 6660!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6670b%!8+=x0%:b%!12+=y1%:b%!16+=x0%:b%!20+=y1%
 6680IF bound%=TRUE THEN
 6690 b%!24=x0%+sx%:b%!28=y0%+sy%:b%!32=x1%+sx%:b%!36=y1%+sy%
 6700ELSE
 6710 b%!40=4:b%!44=5:b%!48=11:b%!52=12:b%!56=-1
 6720 SYS "OS_ReadVduVariables",b%+40,b%+40
 6730 b%!24=0:b%!28=0:b%!32=b%!48+1<<b%!40:b%!36=b%!52+1<<b%!44
 6740ENDIF
 6750b%!4=5:REM Drag type
 6760SYS "Wimp_DragBox",,b%
 6770ENDPROC
 6780:
 6790REM PROCdragsave : Initiate a save after DragDone event
 6800DEFPROCdragsave(win%,icon%,type%,size%)
 6810PROCgetptrpos(x,y,win,icon):REM Get drag to location
 6820f$=FNleafname(FNgeticontext(win%,icon%))
 6830!b%=(48+LEN(f$)) AND NOT3
 6840b%!12=0:b%!16=1:b%!20=win:b%!24=icon:b%!28=x:b%!32=y
 6850b%!36=size%:b%!40=type%:$(b%+44)=f$
 6860SYS "Wimp_SendMessage",18,b%,win,icon
 6870ENDPROC
 6880:
 6890REM ******** !Help responsive routines **************
 6900:
 6910REM PROCreadhelp : read help from application and send
 6920REM PROCsendhelp : send help to application
 6930REM \S for "Click SELECT to "
 6940REM \R for "Move the pointer right to "
 6950REM \A for "Click ADJUST to "
 6960REM \T for "This is the "
 6970REM \G for "This option is greyed out because "
 6980REM \W for "This window is "
 6990REM \D for "Drag SELECT to "
 7000REM \d for "Drag ADJUST to "
 7010REM \w for "window"
 7020REM \s for "SELECT"
 7030REM \a for "ADJUST"
 7040REM |M for return
 7050REM FNString$FN to include string
 7060REM > prefix to look up in message file
 7070REM Menu help icons will be searched as HM<menustring>, with
 7080REM spaces replaced with _'s
 7090REM NB if no full stop then one will be added
 7100REM Format for help :
 7110REM  { window,help message for no icon
 7120REM    { icon number, message } repeated
 7130REM  } repeated
 7140REM  { -2, {iconbar message} } by choice
 7150REM  -1,-1 to end
 7160REM NB window submenus must have help strings
 7170REM Format for menu help :
 7180REM  { menu, -1,-1,-1 or menu, -1,0,help for all the items
 7190REM    { opt1,opt2,opt3,help
 7200REM   or -1,string,-1,help } repeated
 7210REM  } repeated
 7220REM  -2,-2,-2,-2
 7230DEFPROCreadhelp(win,icon,to)
 7240LOCAL lwin,val,help$,found,a$,m$,m2$,mh$:found=FALSE:lwin=-1
 7250REPEAT
 7260 READ val,help$
 7270 IF val>(1<<16) OR val<0 THEN
 7280  IF lwin=win THEN
 7290   val=icon:help$="":m2$=m$
 7300  ELSE
 7310   lwin=val:m$=help$
 7320  ENDIF
 7330 ENDIF
 7340 IF val=icon AND lwin=win THEN
 7350  IF icon=-1 OR help$="" THEN
 7360   PROCsendhelp(FNmsgtext(m$)+"|M",to)
 7370  ELSE
 7380   m$=FNmsgtext(m$):IF INSTR(m$,"|M")>0 THENm$=LEFT$(m$,INSTR(m$,"|M")-1)
 7390   PROCsendhelp(FNmsgtext(m$)+"|M"+FNmsgtext(help$),to)
 7400  ENDIF
 7410  found=TRUE
 7420 ENDIF
 7430UNTIL help$="-1" OR found=TRUE
 7440IF NOT found THEN
 7450 !message_buffer%=-1:message_buffer%!4=-1:message_buffer%!8=-1
 7460 SYS "Wimp_GetMenuState",1,message_buffer%,win,icon
 7470 IF !message_buffer%<>-1 THEN
 7480  val=b%:b%=message_buffer%:mh$=FNdecodemenu(curmenu%):b%=val
 7490  m$=mh$:WHILE INSTR(m$," ")>0:MID$(m$,INSTR(m$," "),1)="_":ENDWHILE
 7500  help$=FNmsgtoken("HM"+m$)
 7510  IF help$<>"HM"+m$ THEN
 7520   PROCsendhelp(help$,to)
 7530  ELSE
 7540   REPEAT
 7550    READ m$,val,help$,help$
 7560   UNTIL EVAL(m$)=curmenu% OR m$="-2"
 7570   IF m$<>"-2" THEN
 7580    IF val>-1 THEN
 7590     PROCsendhelp(help$,to):found=TRUE
 7600    ELSE
 7610     REPEAT
 7620      READ lwin,m$,val,help$
 7630      IF VAL(m$)=0 AND m$<>"0" THEN
 7640       IF mh$=m$ THENPROCsendhelp(help$,to):found=TRUE
 7650      ELSE
 7660       IF lwin=message_buffer%!0 AND VAL(m$)=message_buffer%!4 AND val=message_buffer%!8 THEN
 7670        PROCsendhelp(help$,to):found=TRUE
 7680       ENDIF
 7690      ENDIF
 7700     UNTILfound=TRUE OR lwin=-2 OR lwin >&8000
 7710    ENDIF
 7720   ENDIF
 7730  ENDIF
 7740 ENDIF
 7750ENDIF
 7760ENDPROC
 7770DEFPROCsendhelp(help$,to):help$=FNmsgtext(help$)
 7780IF RIGHT$(help$,2)<>"|M" THENhelp$+="|M"
 7790LOCAL b$,c$
 7800help$=FNsubstvars(help$)
 7810WHILE INSTR(help$,"|M")>0
 7820 b$=LEFT$(help$,INSTR(help$,"|M")-1):help$=MID$(help$,LEN(b$)+3)
 7830 IF INSTR("!.?",RIGHT$(b$,1))=0 THENb$+="."
 7840 c$+=b$+"|M"
 7850ENDWHILE
 7860b%!12=b%!8:b%!4=to:b%!16=&503:$(b%+20)=c$+CHR$0
 7870b%!0=20+(LEN(c$)+4) AND -4
 7880SYS "Wimp_SendMessage",17,b%,b%!4
 7890ENDPROC
 7900:
 7910REM ******** MessageTrans interface routines ********
 7920:
 7930REM PROCopenmessages  : open a MessageTrans file for input
 7940REM PROCclosemessages : close a MessageTrans file
 7950DEFPROCopenmessages:LOCAL f,l
 7960IF msgbuffer%<>-1 THENERROR &803,"Message file already open"
 7970SYS "MessageTrans_FileInfo",,Appdir$+".Messages" TO f,,l
 7980IF (f AND1)=1 THENmsgbuffer2%=0 ELSEmsgbuffer2%=FNclaim(l)
 7990IF msgbuffer2%=-1 THENERROR &803,"No room for secondary MessageTrans buffer"
 8000msgbuffer%=FNclaim(16):IF msgbuffer%=-1 THENPROCrelease(msgbuffer2%):ERROR &803,"No room for primary MessageTrans buffer"
 8010SYS "MessageTrans_OpenFile",msgbuffer%,Appdir$+".Messages",msgbuffer2%
 8020ENDPROC
 8030DEFPROCclosemessages
 8040LOCAL ERROR
 8050ON ERROR LOCAL:VDU4:REPORT:PRINT" at ";ERL:G=GET:ENDPROC
 8060IF msgbuffer%>-1 THEN
 8070 SYS "XMessageTrans_CloseFile",msgbuffer%
 8080 PROCrelease(msgbuffer%):PROCrelease(msgbuffer2%)
 8090ENDIF
 8100ENDPROC
 8110:
 8120REM FNmsgtoken        : translate a token into a string
 8130REM FNmsgtext         : translate text to a token if prefix is >
 8140DEFFNmsgtoken(t$):LOCAL s1$,s2$,s3$,a$,len%,f
 8150IF msgbuffer%=-1 THEN=t$
 8160a$=MID$(t$,INSTR(t$+":",":")+1):t$=LEFT$(t$,INSTR(t$+":",":")-1)
 8170s1$=LEFT$(a$,INSTR(a$+":",":")-1)
 8180IF LEFT$(s1$,1)="|" THEN
 8190 s1$=MID$(a$,2):s2$="":s3$=""
 8200ELSE
 8210 a$=MID$(a$,LEN(s1$)+2):s2$=LEFT$(a$,INSTR(a$+":",":")-1)
 8220 IF LEFT$(s2$,1)="|" THENs2$=MID$(a$,2):s3$="" ELSEs3$=MID$(a$,LEN(s2$)+2)
 8230ENDIF
 8240SYS "XMessageTrans_Lookup",msgbuffer%,t$,message_buffer%,256,s1$,s2$,s3$ TO ,,,len%;f
 8250IF (f AND1)=1 THEN=t$ ELSEmessage_buffer%?len%=13
 8260=FNsubstvars($message_buffer%)
 8270DEFFNmsgtext(a$)
 8280IF LEFT$(a$,1)=">" THENa$=FNmsgtoken(MID$(a$,2))
 8290=a$
 8300:
 8310REM ******** String manipulation routines ***********
 8320:
 8330REM FNstring0 : Return 0-terminated string at location
 8340DEFFNstring0(a%):LOCAL a$:IF a%=0 THEN=""
 8350WHILE?a%>31 ANDLEN(a$)<255:a$=a$+CHR$?a%:a%=a%+1:ENDWHILE
 8360=a$
 8370:
 8380REM FNlower       : Return given string in lower case
 8390REM FNupper       : Return given string in upper case
 8400REM FNtidy        : Return given string in tidy format
 8410REM FNstripspaces : Remove spaces from start and end of string
 8420DEFFNlower(a$):LOCAL c$,b$,I
 8430FORI=1TOLEN(a$)
 8440c$=MID$(a$,I,1):IF c$>="A"ANDc$<="Z"THENc$=CHR$(ASC(c$)+32)
 8450b$+=c$:NEXT:=b$
 8460DEFFNupper(a$):LOCAL c$,b$,I
 8470FORI=1TOLEN(a$)
 8480c$=MID$(a$,I,1):IF c$>="a"ANDc$<="z"THENc$=CHR$(ASC(c$)-32)
 8490b$+=c$:NEXT:=b$
 8500DEFFNtidy(a$):LOCAL cap,b$,I,c$
 8510cap=TRUE
 8520FORI=1TOLEN(a$)
 8530 b$=MID$(a$,I,1):IF b$>="a"ANDb$<="z" THENb$=CHR$(ASC(b$)-32)
 8540 IF (b$<"A" ORb$>"Z") AND b$<>"'" THEN
 8550  cap=TRUE
 8560 ELSE
 8570  IF cap=FALSE AND b$<>"'" THENb$=CHR$(ASC(b$)+32) ELSEcap=FALSE
 8580 ENDIF:c$+=b$
 8590NEXT:=c$
 8600DEFFNstripspaces(f$)
 8610WHILE RIGHT$(f$,1)=" " OR RIGHT$(f$,1)=CHR$9:f$=LEFT$(f$):ENDWHILE
 8620WHILE LEFT$(f$,1)=" " OR LEFT$(f$,1)=CHR$9:f$=MID$(f$,2):ENDWHILE
 8630=f$
 8640:
 8650REM FNsubstvars  : Substitute string for FNvar$FN
 8660REM FNsubstvarsp : Substitute string for FNvar$FN with prefix
 8670REM FNgstrans    : Perform GSTrans on string specified
 8680DEFFNsubstvarsp(a$,c$)
 8690LOCAL b$,d$:LOCAL ERROR:ON ERROR LOCAL:=a$
 8700WHILE INSTR(a$,"�")>0
 8710 b$=MID$(a$,INSTR(a$,"�")+1):b$=LEFT$(b$,INSTR(b$,"�")-1)
 8720 d$=c$+b$:IF RIGHT$(d$,1)<>"$" THENd$="STR$("+d$+")"
 8730 a$=LEFT$(a$,INSTR(a$,"�")-1)+EVAL(d$)+MID$(a$,INSTR(a$,"�")+LEN(b$)+2)
 8740ENDWHILE
 8750=a$
 8760DEFFNsubstvars(a$)
 8770LOCAL b$,d$:LOCAL ERROR:ON ERROR LOCAL:=a$
 8780WHILE INSTR(a$,"�")>0
 8790 b$=MID$(a$,INSTR(a$,"�")+1):b$=LEFT$(b$,INSTR(b$,"�")-1)
 8800 d$=b$:IF RIGHT$(d$,1)<>"$" THENd$="STR$("+d$+")"
 8810 a$=LEFT$(a$,INSTR(a$,"�")-1)+EVAL(d$)+MID$(a$,INSTR(a$,"�")+LEN(b$)+2)
 8820ENDWHILE
 8830=a$
 8840DEFFNgstrans(a$):LOCAL p%,len
 8850SYS "OS_GSTrans",a$,message_buffer%,256+(1<<31) TO ,,len
 8860a$="":p%=message_buffer%
 8870WHILE LEN(a$)<len:a$+=CHR$?p%:p%+=1:ENDWHILE
 8880=a$
 8890:
 8900REM FNswinumber : Return the SWI number, given its string
 8910DEFFNswinumber(swi$):LOCAL n
 8920SYS "XOS_SWINumberFromString",,swi$ TO n;flags
 8930IF (flags AND1)>0 THENn=-1
 8940=n
 8950:
 8960REM ******** File information routines **************
 8970:
 8980REM FNfiletype : Return the file type of a file
 8990REM -2=not found, -1=untyped, &1000=dir or image
 9000DEF FNfiletype(f$):LOCAL f%,type%,fl%
 9010SYS "XOS_File",20,f$ TO type%,,,,,,f%;fl%
 9020CASE type% OF
 9030 WHEN 0:type%=-2
 9040 WHEN 1:type%=f%
 9050 WHEN 2,3:type%=&1000
 9060ENDCASE
 9070IF (fl%AND1)=1 THENtype%=-2
 9080=type%
 9090:
 9100REM FNbasetype : Return the file type of a directory or image
 9110REM -2=not found, -1=file, &1000 for dir, type for image
 9120DEF FNbasetype(f$):LOCAL f%,type%,fl%
 9130SYS "XOS_File",5,f$ TO type%,,f%;fl%
 9140CASE type% OF
 9150 WHEN 0:type%=-2
 9160 WHEN 1:type%=-1
 9170 WHEN 2:type%=&1000
 9180 WHEN 3:type%=(f% AND &FFF00)>>8
 9190ENDCASE
 9200IF (fl%AND1)=1 THENtype%=-2
 9210=type%
 9220:
 9230REM FNfilelength : Return the length of a file
 9240REM -1 if not found
 9250DEF FNfilelength(f$):LOCAL len%,ex,f
 9260SYS "XOS_File",5,f$ TO ex,,,,len%;f
 9270IF ex=0 OR (f AND 1)=1 THENlen%=-1
 9280=len%
 9290:
 9300REM FNleafname : Return the leafname of the file
 9310REM FNpathname : Return the directory containing the file
 9320REM FNlongfilename : Return the full pathname of a file
 9330DEF FNleafname(f$):LOCAL r$
 9340IF INSTR(f$,":")>0 THENf$=MID$(f$,INSTR(f$,":")+1)
 9350CASE INSTR(f$,".") OF
 9360 WHEN 0    :r$=f$
 9370 OTHERWISE :r$=FNleafname(RIGHT$(f$,LEN(f$)-INSTR(f$,".")))
 9380ENDCASE
 9390=r$
 9400DEF FNpathname(f$)
 9410IF INSTR(f$,":")>0 AND INSTR(f$,".")=0 THEN=LEFT$(f$,INSTR(f$,":")) ELSEIF INSTR(f$,":")=0 AND INSTR(f$,".")=0 THEN="@"
 9420=LEFT$(f$,LEN(f$)-LEN(FNleafname(f$))-1)
 9430REM Removes identifiers such as Scrap:...
 9440DEFFNlongfilename(f$)
 9450SYS "XOS_FSControl",37,f$,message_buffer%,,,256 TO ,,f$ ;flags
 9460IF (flags AND 1)=1 THENf$=""
 9470=f$
 9480:
 9490REM ******** Module workspace manipulation routine **
 9500:
 9510REM FNclaim   : Claim an area of RMA
 9520REM FNrelease : Release a claimed area of RMA
 9530DEFFNclaim(length%)
 9540LOCAL flags:IF length%<1THENERROR &803,"Cannot claim negative RMA"
 9550SYS "XOS_Module",6,,,length% TO ,,area%;flags
 9560IF (flags AND1)>0 THENarea%=-1
 9570=area%
 9580DEFPROCrelease(RETURN area%)
 9590IF area%>0 THENSYS "OS_Module",7,,area%:area%=-1
 9600ENDPROC
 9610:
 9620REM ******** Task interaction routines **************
 9630:
 9640REM FNtaskname        : return a given tasks name
 9650REM FNwindowtask      : return task handle who owns window
 9660REM FNreadtaskstring  : read a string from given task
 9670REM PROCreadtaskarea  : read a block from given task
 9680REM FNfindtask        : return task handle of named task
 9690DEFFNtaskname(task%):LOCAL name$,f
 9700SYS "XTaskManager_TaskNameFromHandle",task% TO name$;f
 9710IF (f AND1) THENname$="None"
 9720=name$
 9730DEFFNwindowtask(win%):LOCAL task%
 9740message_buffer%!0=20:message_buffer%!12=0
 9750SYS "Wimp_SendMessage",19,message_buffer%,win%,-1 TO ,,task%
 9760=task%
 9770DEFFNreadtaskstring(task%,loc%):LOCAL p$
 9780SYS"Wimp_TransferBlock",task%,loc%,handle,message_buffer%,256
 9790=FNstring0(message_buffer%)
 9800DEFPROCreadtaskarea(task%,loc%,to%,len%)
 9810SYS"Wimp_TransferBlock",task%,loc%,handle,to%,len%
 9820ENDPROC
 9830DEFFNfindtask(a$)
 9840LOCAL th,cnt,t$
 9850SYS "TaskManager_EnumerateTasks",,message_buffer%,16 TO cnt
 9860WHILE cnt<>-1
 9870 th=!message_buffer%:t$=FNstring0(message_buffer%!4)
 9880 SYS "TaskManager_EnumerateTasks",cnt,message_buffer%,16 TO cnt
 9890 IF t$=a$ THENcnt=-1 ELSEIFcnt=-1 THENth=-1
 9900ENDWHILE
 9910=th
 9920:
 9930REM FNbackofwinstack : return win handle of back of win stack
 9940REM FNwinstacknext   : return win handle of next win forward
 9950DEFFNbackofwinstack:LOCAL I
 9960!b%=infobox%:SYS"Wimp_GetWindowState",,b%
 9970FORI=4TO16STEP4
 9980 b%!I=(b%!I)-4096
 9990NEXTI
10000b%!28=-2:SYS"Wimp_OpenWindow",,b%
10010SYS"Wimp_GetWindowState",,b%:zc%=b%!28
10020SYS"Wimp_CloseWindow",,b%
10030=zc%
10040DEFFNwinstacknext(win%):!b%=win%:SYS"Wimp_GetWindowState",,b%:=b%!28
10050:
10060REM ******** Caret and pointer control procedures ***
10070:
10080REM PROCsetcaretend : Place the caret at the end of the text
10090REM PROCsetcaretpos : Place the caret at pos within the text
10100REM PROCgetcaretpos : Return the position of the caret
10110REM PROCgetptrpos   : Return the location of the pointer
10120DEFPROCsetcaretend(win,icon)
10130PROCsetcaretpos(win,icon,LEN(FNgeticontext(win,icon)))
10140ENDPROC
10150DEFPROCsetcaretpos(win,icon,chars)
10160SYS "Wimp_SetCaretPosition",win,icon,0,0,-1,chars
10170ENDPROC
10180DEFPROCgetcaretpos(RETURN win,RETURN icon,RETURN chars)
10190SYS "Wimp_GetCaretPosition",,b%:win=!b%:icon=b%!4:chars=b%!20
10200ENDPROC
10210DEFPROCgetptrpos(RETURN x,RETURN y,RETURN win,RETURN icon)
10220SYS "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4:win=b%!12:icon=b%!16
10230ENDPROC
10240:
10250REM ******** Configuration settings control *********
10260:
10270REM FNreadcmos    : Read a byte of configuration info
10280REM PROCwritecmos : Write a byte of configuration info
10290DEFFNreadcmos(byte)
10300SYS "OS_Byte",161,byte TO ,,value
10310=value
10320DEFPROCwritecmos(byte,value)
10330SYS "OS_Byte",162,byte,value
10340ENDPROC
10350:
10360REM ******** Status file control routines ***********
10370:
10380REM PROCmakestatusfile  : Create a status file
10390REM PROCclosestatusfile : Close the status file
10400REM FNreadstatusfile    : Open a status file read
10410DEFPROCmakestatusfile(f$)
10420OSCLI("Create "+f$):OSCLI("SetType "+f$+" FFF")
10430statfile%=OPENOUT(f$):BPUT#statfile%,"Program:"+Appname$
10440ENDPROC
10450DEFPROCclosestatusfile
10460CLOSE#statfile%
10470ENDPROC
10480REM Return FALSE if not correct or not found
10490DEFFNreadstatusfile(f$):LOCAL a$
10500LOCAL ERROR:ON ERROR LOCAL:=FALSE
10510statfile%=OPENIN(f$)
10520IF statfile%=0 THEN=FALSE
10530a$=FNstatusget("Program")
10540IF a$<>Appname$ THENCLOSE#statfile%:=FALSE
10550=TRUE
10560:
10570REM PROCstatusput    : Put the string in status file
10580REM PROCstatusoption : Put the value in status file
10590REM PROCstatusflag   : Put the flag in status file
10600DEFPROCstatusput(e$,d$)
10610BPUT#statfile%,e$+":"+d$
10620ENDPROC
10630DEFPROCstatusoption(e$,v%)
10640BPUT#statfile%,e$+":%"+STR$v%
10650ENDPROC
10660DEFPROCstatusflag(e$,v%)
10670IF v% THENBPUT#statfile%,e$+":On" ELSEBPUT#statfile%,e$+":Off"
10680ENDPROC
10690:
10700REM PROCstatusnext   : Read the next status entry
10710DEFPROCstatusnext(RETURN a$,RETURN b$)
10720IF EOF#statfile% THENa$="*E*N*D*":b$="":ENDPROC
10730REPEAT:a$=GET$#statfile%:UNTILLEFT$(a$,1)<>"#"
10740b$=MID$(a$,INSTR(a$,":")+1)
10750a$=FNupper(LEFT$(a$,INSTR(a$,":")-1))
10760ENDPROC
10770:
10780REM FNstatusget      : Read an entry from status file
10790REM FNstatusgetv     : Read a value from staus file
10800REM FNstatusgetflag  : Read a flag from status file
10810DEFFNstatusget(a$)
10820LOCAL b$,c$:a$=FNupper(a$):PROCstatusnext(b$,c$)
10830IF a$<>b$ THEN
10840 PTR#statfile%=0:b$=""
10850 WHILE a$<>b$ AND b$<>"*E*N*D*"
10860  PROCstatusnext(b$,c$)
10870 ENDWHILE
10880ENDIF
10890=c$
10900DEFFNstatusgetv(a$):a$=FNstatusget(a$)
10910IF LEFT$(a$,1)="%" THEN=VAL(MID$(a$,2))
10920=0
10930DEFFNstatusgetflag(a$):a$=FNstatusget(a$)
10940IF a$="%1"ORFNupper(a$)="ON"THEN=TRUE
10950=FALSE

� >WimpLib
� � Justin Fletcher
"� Version : 1.73 (12 Jun 1997)
(� This version for RO3
2(� &803,"Do not run the Wimp Library"
<:
F7� ******** Main Application Procedures ************
P:
Z4� PROCinitlibrary : Initialise library variables
d��initlibrary
n� message_buffer% 1024
x8rmafontarea=-2:msgbuffer%=-1:msgbuffer2%=-1:ftblk=-2
��
�:
�=� PROCnotemessage : Mark the given message as receiveable
�.��notemessage(n):messagelist%!messptr%=n:�
�:
�2� FNloadtemplate : load the specified template
�2� sprblk% should be 1 for the standard sprites
�0ݤloadtemplate(n$,sprblk%):� tsize%,blk%,ok%
�0ș "Wimp_OpenTemplate",,Appdir$+".Templates"
�0ș "Wimp_LoadTemplate",,0,,,,n$,0 � ,,tsize%
�� blk% tsize%
�Hș "Wimp_LoadTemplate",,wspc%,blk%,blk% + tsize%,-1,n$,0 � ,,,,,,ok%
�ș "Wimp_CloseTemplate"
5� ok%=0 �� &803, "Template file "+n$+" not found"
9wspc%!64=sprblk%:ș "Wimp_CreateWindow",,wspc% � blk%
	=blk%
":
,4� FNloadsprites : Load sprite file into new area
6*ݤloadsprites(file$):� len%,o%,sprblk%
@o%=�(file$):� o%=0 �=1
Jlen%=�#o%+16:�#o%
T,� sprblk% len%:!sprblk%=len%:sprblk%!8=0
^ ș"OS_SpriteOp",&109,sprblk%
h&ș"OS_SpriteOp",&10A,sprblk%,file$
r=sprblk%
|:
�A� FNGetEnv : Return the environment string stripped of loader
�ݤGetEnv:� com$,I,p$
�ș "OS_GetEnv" � com$
�p$="":I=�com$," -quit ")
�� I>0 �
�( p$=�com$,�com$," ",I+�" -quit ")+1)
� ȕ �p$,1)=" ":p$=�p$,2):�
��
�=p$
�:
�@� FNsystemvar : Return the contents of any string system var
�ݤsystemvar(Var$):� len
�:ș "XOS_ReadVarVal",Var$,message_buffer%,255,0,3�,,len
message_buffer%?len=13
=$message_buffer%
:
&)� PROCeerror : External error routine
0>� should be called when errors occur during initialisation
:��eerror
D� �
NG� � �:�closemessages:�4:� � 0,�$+" at line "+Þ+" in error handler"
X)mess$="Internal error : ("+Þ+") "+�$
b8�("Set Error$ "+mess$):�("Set Error$Task Not known")
lLmessage_buffer%!0=�:$(message_buffer%+4)=mess$+" whilst initialising"+�0
v'� � �:Appname$="uninitialised task"
�a$=Appname$
�G� � �:�closemessages:�4:� � 0,�$+" at line "+Þ+" in error handler"
�4ș "Wimp_ReportError",message_buffer%,9,Appname$
��
�:
�>� PROCerror : Called at any BASIC error inside the desktop
�� ERROR numbers &800+ :
�� 0 = OK
�� 1 = Cancel
�!� 2 = OK and Cancel (to quit)
�.� Shift, Ctrl, Q and click to exit program
�"��error:� errcode,mess$,reply%
�� �
G� � �:�closemessages:�4:� � 0,�$+" at line "+Þ+" in error handler"
ș "OS_Byte",124
� �>&7FF � �<&803 �
  errcode=�-&7FF:mess$=�$
*, � errcode=3 �mess$+=" (Cancel to Quit)"
4- reply%=�errorbox(Appname$,mess$,errcode)
>$ � reply%=2 � errcode=3 �quit%=�
H�
R< mess$="Internal error : ("+Þ+") "+�$+" Cancel to Quit"
\) reply%=�errorbox(Appname$,mess$,%11)
f � reply%<>1 �
p$  quit%=�:�("Set Error$ "+mess$)
z#  �("Set Error$Task "+Appname$)
� �
�+ � �(-1) � �(-2) � �(-17) ��("Spool"):�
��
��
�:
�;� FNerrorbox : create an error box with up to 2 buttons
�� Bit Value Effect if set
�?�  0    1   Include an OK option    } if both unset then as
�3�  1    2   Include a Cancel option } bit 0 set
�D�  2    4   Reversed buttons, OK=White, Cancel=Yellow and action
��  3    8   ?
�:�  4    16  Title is just title (not Error from title)
�%�  5    32  Dangerous, do not use
�  6    64  No error box ?
�  7   128  Don't beep
?ݤerrorbox(title$,message$,button%):title$=�msgtext(title$)
$message$=�msgtext(message$)
.4$(message_buffer%+4)=message$:!message_buffer%=0
8Bș "Wimp_ReportError",message_buffer%,button%,title$ � ,reply%
B=reply%
L:
V7� PROCshowfree : display in infobox% the free space
`��showfree
j� �
t@� � �:� �=&803 ��seticontext(infobox%,4,"Old template"):� ��
~&�seticontext(infobox%,5,"Program")
�B�seticontext(infobox%,1,�(�P-�)+" bytes, "+�((�P-�)�&400)+"K")
�#�seticontext(infobox%,6,"Vars")
�@�seticontext(infobox%,2,�(�-�)+" bytes, "+�((�-�)�&400)+"K")
�#�seticontext(infobox%,7,"Free")
�@�seticontext(infobox%,3,�(�-�)+" bytes, "+�((�-�)�&400)+"K")
�!�heap_free(heapsize,heapfree)
�#�seticontext(infobox%,8,"Heap")
�v�seticontext(infobox%,4,�(heapsize-heapfree)+" bytes, "+�((heapsize-heapfree)�&400)+"K of "+�(heapsize �&400)+"K")
��
�:
�7� ******** Menu manipulation procedures ***********
�:
9� FNcreatemenu : Create a menu given a control string

� Menu Format :
� Title|Item|Item|Item
� Item consists of :
(� Entry or Entry]Flags
2*� Flags can be : (separated by commas)
<�  T for ticked
F�  D for dotted underneath
P�  W for writable
Z�  S for shaded
d+�  K for key shortcut (^=ctrl, �=shift)
n<�  > followed by variable for sub-menu (Item]>submenu%|)
x2�  } followed by a sprite name (Item]}sprite|)
�C� NB:The last two flags can be used together if comma seperated
� �    eg. Info]>info%,}!Help|
�A� NB:If the spritename starts with sm then the sprite will be
�=�    displayed using its small form, otherwise it will be
��    shrunk to half size.
�ݤcreatemenu(A$)
�5� pointer,p2,p3,l,lk,O$,C$,oind%,oindl%,ks%,k$,S$
�!oind%=ind%:oindl%=indl%:ks%=�
�pointer=menu%:l=0:A$+="|"
��menuputs(�mget(A$,C$))
��menuputw(&70207)
�p2=menu%:�menuputw(&80)
��menuputw(&2C)
&�menuputw(0):options%=0:S$=A$:lk=0
�
 � ks%=� �ks%=�*2
" �
,)  O$=�mget(A$,C$):options%=options%+1
61  flags=�mdecode(C$,p3,s$,k$)+((-(A$=""))<<7)
@  � ks%=�*2 � k$<>"" �
J%   O$+=�l+lk-(�(O$)+�(k$))+1," ")
T$   � �k$,1)="�" ��k$,1,1)=�(139)
^
   O$+=k$
h  �
r+   � k$<>"" �ks%=�:� lk<�(k$) �lk=�(k$)
|  �
�=  flags2=&7000021+((-(�(O$)>11))<<8)+(1<<14)*(flags �256)
�+  � (flags � 4)<>0 �flags2=flags2 � 256
�  �menuputw(flags � 255)
�  �menuputw(p3)
�"  �(O$)>l � ks%<>�*2 �l=�(O$)
�  �menuputw(flags2)
�$  �menustring(O$,s$,(flags � 4))
� �A$=""
�i � ks%=�*2 �l+=lk+1 ��ks%=� �ind%=oind%:indl%=oindl%:menul%+=menu%-p2-12:menu%=p2+12:options%=0:A$=S$
�� ks%<>�
�!p2=l*16+16
�=pointer
�7��menustring(T$,s$,flag):� �T$,1)="�" �T$=�(�T$,2))
�(T$)<12 � s$="" � flag=0�
 �menuputs(T$)
�
& �menuputw(�indirect(T$))
0 � s$<>"" �
:  menu%!-8=menu%!-8 � &803
D4  �lower(s$),2)="sm" �menu%!-8=menu%!-8 � &800
N"  �menuputw(�indirect("S"+s$))
X �
b  �menuputw(-1)
l �
v �menuputw(�(T$)+1)
��
��
�ݤmget(� A$,� C$)
�� B$:B$=�A$,�A$,"|")-1)
�'A$=�A$,�(B$)+2):�B$,"]")<1�B$+="]"
�)C$=�B$,�B$,"]")+1):B$=�B$,�B$,"]")-1)
�=�msgtext(B$)
�:��menuputs(T$):�(T$)>11 �� &803,"Menu entry too long"
�"$menu%=T$:menu%+=12:menul%-=12
�4�menul%<=4 �� &803,"Not enough memory for menus"
��
���menuputw(W%)
� !menu%=W%:menu%+=4:menul%-=4
4�menul%<=4 �� &803,"Not enough memory for menus"
�
ݤmdecode(A$,� p,� s$,� k$)
 (� B$,C$,V:p=-1:s$="":k$="":A$=A$+","
*
ȕ A$<>""
4 B$=�A$,1):A$=�A$,2)
> Ȏ B$ �
H  � "T":V=V � 1
R  � "D":V=V � 2
\  � "W":V=V � 4
f  � "M":V=V � 8
p  � "S":V=V � 256
z1  � "K":k$=�A$,�A$,",")-1):A$=�A$,�A$,",")+1)
�3  � ">":p=�(�A$,�A$,",")-1)):A$=�A$,�A$,",")+1)
�5  � "}":s$=�A$,�A$,",")-1)+" ":A$=�A$,�A$,",")+1)
� �
��
�=V
�:
�B� FNindirect : Place a string in indirection buffer (ret. loc)
�ݤindirect(a$):� i:i=ind%
�<�(a$)>indl%-1 �� &803,"Not enough room for indirection"
�)$ind%=a$:ind%+=�(a$)+1:indl%-=�(a$)+1
�=i
�:
�<� PROCibmenu       : Create an iconbar menu from ibmenu%
	D� PROCmenu         : Create the menu at co-ords or mouse if x=-1
	4� PROCrecreatemenu : Recreate the menu just used
	��ibmenu
	$[ș "Wimp_GetPointerInfo",,b%:curmenu%=ibmenu%:cmenux%=b%!0-64:cmenuy%=96+&2C*iboptions%
	.;ș "Wimp_CreateMenu",,ibmenu%,b%!0-64,96+&2C*iboptions%
	8�
	B��menu(menu%,x,y)
	L� x=-1 �
	V/ ș "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4
	`�
	j,curmenu%=menu%:cmenux%=x-64:cmenuy%=y+20
	t)ș "Wimp_CreateMenu",,menu%,x-64,y+20
	~�
	���recreatemenu
	�2ș "Wimp_CreateMenu",,curmenu%,cmenux%,cmenuy%
	��
	�:
	�/� PROCmenuuntick: Untick a group of options
	�0� PROCmenutick  : Tick/untick option on menu
	�2� PROCmenushade : Shade/unshade option on menu
	�8� FNmenuticked  : Return TRUE if menu item is ticked
	�8� FNmenushaded  : Return TRUE if menu item is shaded
	�� type = 0 for untick
	�!� type = 1 for tick (also -1)
	�� type = 2 for toggle
 ��menuuntick(menu,start,end)

menu+=start*24+28
�
' !menu=!menu � -2:start+=1:menu+=24
(4� (end<>-1 � start>end) � ((menu!-24) � &80)=&80
2�
<5��menutick(menu,option,toggle):menu+=option*24+28
FȎ toggle �
P � 0:!menu=!menu � -2
Z � -1,1:!menu=!menu � 1
d � 2:!menu=!menu � 1
n�
x�
�6��menushade(menu,option,toggle):menu+=option*24+36
�Ȏ toggle �
� � 0:!menu=!menu � �(1<<22)
�! � -1,1:!menu=!menu � (1<<22)
� � 2:!menu=!menu � (1<<22)
��
��
�ݤmenuticked(menu%,item%)
�"=((menu%!(28+24*item%)) � 1)=1
�ݤmenushaded(menu%,item%)
�"=((menu%!(28+24*item%)) � 4)=4
�:
�4� PROCsetmenutext : Set the text for menu option
5� FNgetmenutext   : Read the text for menu option
7��setmenutext(menu,option,text$):menu+=option*24+36
7� (!menu �&100)>0 �$(menu!4)=text$ �$(menu+4)=text$
"�
,9ݤgetmenutext(menu,option):menu+=option*24+36:� text$
67� (!menu �&100)>0 �text$=$(menu!4) �text$=$(menu+4)
@
=text$
J:
T4� FNdecodemenu : Return menu selection as string
^/� also returns for font if menu is fontmenu
h7ݤdecodemenu(menu%):� cp%,ptr,b$,c$:cp%=menu%:ptr=0
r%ȕ (b%!ptr>-1 � cp%<>rmafontarea)
|$ cp%=cp%!(32+(b%!ptr)*24):ptr+=4
��
�#� cp%=rmafontarea � b%!ptr<>0 �
�A ș "Font_DecodeMenu",,rmafontarea,b%+ptr,�255,�0),255 �,,,m$
��
�7 ș "Wimp_DecodeMenu",,menu%,b%,�255,�0),255 �,,,m$
�
 b$=""
� �
�,  c$=�m$,�m$+".",".")-1):m$=�m$,�(c$)+2)
�  c$=�c$,�c$+" ^"," ^")-1)
�&  c$=�c$,�c$+" "+�139," "+�139)-1)
�  Ȏ �c$,3) �
�f   � "Esc","Del","Ins","End","Hom","Cpy","F10","F11","F12","F13","Prt","Tab","Ret":c$=�c$,�(c$)-4)
�  �
D  � �c$,�(c$)-2,2)=" F" ���c$)="0" � �(�c$))<>0 �c$=�c$,�(c$)-3)
  ȕ �c$)=" ":c$=�c$):�
  b$+=c$+"."
& �m$="" � m$="."
0 � m$="." �b$+=".."
: m$=�b$)
D�
N=m$
X:
b?� FNgetfontmenu       : Return memory location of font menu
l;� PROCreleasefontmenu : Release memory used by fontmenu
v$ݤgetfontmenu(font$):� space,ind
�ș "Hourglass_On"
�4ș "Font_ListFonts",,,7<<19,,,,1 � ,,,space,,ind
�7�release(rmafontarea):rmafontarea=�claim(space+ind)
�+� rmafontarea<0 �ș "Hourglass_Off":=-1
�(� font$<>"" � font$<>"System font" �
�M ș "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,font$
��
�^ ș "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,-(font$="System font")
��
�ș "Hourglass_Off"
�=rmafontarea
�-��releasefontmenu:�release(rmafontarea):�
�:

0� FNcreateftmenu    : Create a filetype menu

7� PROCreleaseftmenu : Release space used by FT menu

ݤcreateftmenu

 -� len,name,type,flags,mlen,ilen,n$,v$,mst

*Qș "XOS_ReadVarVal","File$Type_*",message_buffer%,256 � ,,len,name,type;flags

4mlen=28+24:ilen=9

>ȕ (flags �1)<>1

H � type=0 �

R$  mlen+=24:n$=¤string0(name),3)

\-  ș "XWimp_SpriteOp",24,,"Small_"+n$ �;f

f  � (f �1)=1�

p-   ș "XWimp_SpriteOp",24,,"File_"+n$ �;f

z,   � (f �1)=0�ilen+=11+len �ilen+=len+11

�  �

�   ilen+=12+len

�  �

� �

�W ș "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name � ,,len,name,type;flags

��

�ftblk=�claim(mlen+ilen)

�� ftblk=-1 �

� ftblk=�claim(28+24+9)

�( $ftblk="File types":ftblk!12=&70207

�+ ftblk!16=16*12:ftblk!20=&28:ftblk!24=0

�/ ftblk!28=&80:ftblk!32=-1:ftblk!36=&7000121

�/ ftblk!40=ftblk+28+24:ftblk!44=0:ftblk!48=9
 $(ftblk+28+24)=""
�
( $ftblk="File types":ftblk!12=&70207
$+ ftblk!16=16*12:ftblk!20=&28:ftblk!24=0
.* ilen=mlen+ftblk:mlen=ilen-24:mst=mlen
8T ș "XOS_ReadVarVal","File$Type_*",message_buffer%,256,0 � ,,len,name,type;flags
B ȕ (flags �1)<>1
L  � type=0 �
VO   message_buffer%!len=0:n$=¤string0(name),3):v$=�string0(message_buffer%)
`   mlen!0=0:mlen!4=-1
j.   ș "XWimp_SpriteOp",24,,"Small_"+n$ �;f
t   � (f �1)=1�
~.    ș "XWimp_SpriteOp",24,,"File_"+n$ �;f
�/    � (f �1)=0�n$="File_"+n$ �n$="File_xxx"
�    mlen!8=&7000933
�   �
�&    n$="Small_"+n$:mlen!8=&7000133
�   �
�*   mlen!12=ilen:$ilen=v$:ilen+=�(v$)+1
�.   mlen!16=ilen:$ilen="s"+n$:ilen+=�(n$)+2
�   mlen!20=�(v$)+1:mlen-=24
�  �
�X  ș "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name � ,,len,name,type;flags
� �
�4 mlen!0=4:mlen!4=-1:mlen!8=&7000121:mlen!12=ilen
< $ilen="":ilen+=9:mlen!16=-1:mlen!20=9:mlen-=24:!mst=&80

�

=ftblk
%��releaseftmenu:�release(ftblk):�
(:
27� ******** Window manipulation routines ***********
<:
F(� PROCclosewin      : Close a window
P7� PROCopenwin       : Open a window at top of stack
Z>� PROCopenwinat     : Open a window at top-left corner x,y
d9� PROCopenwincentre : Open window in centre of screen
n<� PROCopenwinto     : Open window at position within TWA
x��closewin(win%)
�&!b%=win%:ș "Wimp_CloseWindow",,b%
��
���openwin(win%)
�)!b%=win%:ș "Wimp_GetWindowState",,b%
�%b%!28=-1:ș "Wimp_OpenWindow",,b%
��
�(��openwinat(win%,x,y):� width,height
�)!b%=win%:ș "Wimp_GetWindowState",,b%
�&width=b%!4-b%!12:height=b%!16-b%!8
�.b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
�%b%!28=-1:ș "Wimp_OpenWindow",,b%
��
�2��openwincentre(win%):� width,height,top,right
*!b%=4:b%!4=5:b%!8=11:b%!12=12:b%!16=-1
%ș "OS_ReadVduVariables",b%,b%+20
+right=b%!28+1<<b%!20:top=b%!32+1<<b%!24
")!b%=win%:ș "Wimp_GetWindowState",,b%
,&width=b%!4-b%!12:height=b%!16-b%!8
63x=(right-width)/2+width:y=(top-height)/2+height
@.b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
J%b%!28=-1:ș "Wimp_OpenWindow",,b%
T�
^/� l=left of VWA in TWA, t=top of VWA in TWA
h3� r=right of VWA in TWA, b=bottom of VWA in TWA
rA� Window does not move, but its size is altered to difference
|?� between l&w and t&h. Top left of VWA is positioned to tl.
�;� If rb = -1 then no actual size change, just position.
���openwinto(win%,l,t,r,b)
�)!b%=win%:ș "Wimp_GetWindowState",,b%
�� l=-1 �l=b%!20
�� t=-1 �b=b%!24
�� r=-1 �r=b%!12-b%!4
�� b=-1 �t=b%!8-b%!16
�1b%!12=b%!4+r-l:b%!8=b%!16+b-t:b%!20=l:b%!24=t
�ș"Wimp_OpenWindow",,b%
��
�:
�=� PROCresizewinto : Resizes window and re-opens if needed
�(� Will keep to full size if possible
��resizewinto(win%,l,t,r,b)
� full%,open%
)!b%=win%:ș "Wimp_GetWindowState",,b%
&8� If full size, open full size, and if open, re-open
01open%=(b%!32 � (1<<16))>0:� � open% �b%!28=-3
:9ș "Wimp_OpenWindow",,b%:ș "Wimp_GetWindowState",,b%
Dfull%=(b%!32 � (1<<18))>0
N#b%!68=l:b%!72=b:b%!76=r:b%!80=t
X"ș "Wimp_SetExtent",win%,b%+68
b*� full% �b%!8=b%!16+b-t:b%!12=b%!4+r-l
lș "Wimp_OpenWindow",,b%
vJ� open% �ș "Wimp_ForceRedraw",win%,l,b,r,t �ș "Wimp_CloseWindow",,b%
��
�D�full%=( (((b%!12)-(b%!4))=b%!52) AND (((b%!16)-(b%!8))=b%!56) )
�:
�?� PROCwinsetextent : Set the maximum extent of window (TWA)
� ��winsetextent(win%,l,t,r,b)
�*!b%=win%:ș "Wimp_GetWindowInfo",,b%+1
�� l=-1 �l=b%!44
�� b=-1 �b=b%!48
�� r=-1 �r=b%!52
�� t=-1 �t=b%!56
�#b%!44=l:b%!48=b:b%!52=r:b%!56=t
�"ș"XWimp_SetExtent",win%,b%+44
��
:
?� PROCforceredraw : Redraw the specified part of the window
��forceredraw(win%,l,t,r,b)
 &ș "Wimp_ForceRedraw",win%,l,b,r,t
*�
4:
>=� PROCwindowtitle : Set window title (only if indirected)
H� �windowtitle(win%,title$)
R
� loc%,a$
\+b%!0=win%:ș "Wimp_GetWindowInfo",,b%+1
f%loc%=!(b%+76):a$=�msgtext(title$)
p� �string0(loc%)<>a$ �
z: $loc%=a$:b%!32=win%:ș "Wimp_GetWindowOutline",,b%+32
�5 ș "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
��
��
�:
�>� ************ Nested Window Manager specific ************
�5� PROCembedwin   : embeds a window within another
�C� PROCembedwin   : embeds a window within another with winflags
�4� PROCunembedwin : unembed a window from another
�;� FNparentwin    : Returns the parent window of a child
�%��embedwin(parent%,child%,flags%)
�+!b%=child%:ș "Wimp_GetWindowState",,b%
�;ș "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% � � 1
��
3��embedwinwith(parent%,child%,flags%,winflags%)
;!b%=child%:ș "Wimp_GetWindowState",,b%:b%!32=winflags%
9ș "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% � 1
$�
. ��unembedwin(parent%,child%)
8+!b%=child%:ș "Wimp_GetWindowState",,b%
B/ș "Wimp_CloseWindow",,b%,&4B534154,parent%
L�
Vݤparentwin(child%)
`
� parent%
jB!b%=child%:ș "Wimp_GetWindowState",,b%,&4B534154 � ,,,parent%
t=parent%
~:
�7� ******** Icon manipulation routines *************
�:
�7� FNcreateicon : Create an icon with set parameters
�<� window,x,y, width, height, title, validation, colours,
�� ESG, button type, flags
�1� col could be font handle if use font is set
�B� otherwise col is &BF (B=background, F=foreground) (usu. &17)
�9� Quick flags : %AFVHB00 (A=Font, F=Filled, B=Border)
�
� Flags :
� � 0 : Text           8 : N/A
�,� 1 : Sprite         9 : Right Justified
�;� 2 : Bordered      10 : Multiple selection with adjust
)� 3 : H Centre      11 : Small sprite

� 4 : V Centre      20 : ?
%� 5 : Filled        21 : Inverted
#� 6 : Use fonts     22 : Shaded
(� 7 : N/A           23 : ?
2� Button types :
<� 0 : Ignore clicks
F� 1 : Notify when over
P � 2 : Clicks repeat & notify
Z"� 3 : Clicks debounce & notify
d?� 4 : Click selects, release notifies, or deselect if moved
n*� 5 : Click selects, 2 clicks notifies
x� 6 : As 3 but will drag
�� 7 : As 4 but will drag
�� 8 : As 5 but will drag
�� 9 : Menu icon
�0� 10: Click=but*256,drag=but*16,2 clicks=but
�3� 11: Radio (Validation format : Soptoff,opton)
�� 12/13 : N/A
�'� 14: Writeable/Clickable/Draggable
�� 15: Writeable
�=ݤcreateicon(win,x,y,w,h,title$,valid$,col,esg,but,flags)
�$� handle:title$=�msgtext(title$)
�.b%!0=win:b%!4=x:b%!8=y-h:b%!12=x+w:b%!16=y
�6b%!20=(flags � (%111001111111+(15<<20)))+(col<<24)
�b%!20+=(esg<<16)+(but<<12)
-� valid$<>"" � �(title$)>11 � title$=�0 �
 � title$=�0 �
)  b%!24=�indirect(�255,�0)):b%!32=256
" �
,/  b%!24=�indirect(title$):b%!32=�(title$)+1
6 �
@( b%!28=�indirect(valid$):b%!20+=1<<8
J�
T $(b%+24)=title$
^�
hU� ((b%!20) � &103)=&3 �� &803,"Cannot make a sprite/text icon without validation"
r� (flags � 3)=0 �b%!20+=1
|.� �lower(�valid$,1))="s" � b%!20=b%!20 � 2
�%ș "Wimp_CreateIcon",,b% � handle
�=handle
�:
�6� PROCdeleteicon : Delete the icon from the window
���deleteicon(win,icon)
�.!b%=win:b%!4=icon:ș "Wimp_DeleteIcon",,b%
��
�:
�;� FNCreateIconBarIcon : Create an icon for the icon bar
�#� Icon-bar positions (low byte)
�� 1 = right, 2 = left
�+� 3 = left relative to (high byte) icon
�,� 4 = right relative to (high byte) icon
8� 5 = left, high priority (high byte=priority value)
$� 6 = left, low priority (ditto)
%� 7 = right, low priority (ditto)
&&� 8 = right, high priority (ditto)
08ݤCreateIconBarIcon(Spr$,title$,pos%):� ic%,w%,m%,e%
:1title$=�msgtext(title$):b%!0=-(�(pos%) � &FF)
D2b%!4=0:b%!8=-16:b%!12=12+16*�(title$):b%!16=88
N"�b%!12<12+16*4 � b%!12=12+16*4
X� title$<>"" �
b2 b%!20=(1<<28)+(7<<24)+(3<<12)+(%01011)+(1<<8)
l b%!24=�indirect(title$)
v b%!28=�indirect("S"+Spr$)
� b%!32=�(title$)+1
��
�+ b%!20=(1<<28)+(7<<24)+(3<<12)+(%11010)
� $(b%+24)=Spr$
��
�<ș "Wimp_SpriteOp",&128,,�Spr$,�Spr$+",",",")) �,,,w%,m%
�7ș "XOS_ReadModeVariable",m%,4 � ,,e%:w%=(w%+1)<<e%
�� w%>b%!12 �b%!12=w%
�T� (�(pos%)�&FF)=3 � (�(pos%)�&FF)=4 �pos%=�(pos%)>>8 �pos%=(�(pos%) � &FF00)<<16
�&ș "Wimp_CreateIcon",pos%,b% � ic%
�=ic%
�:
�@� FNgeticonstate : Return -1 if icon is selected,0 otherwise
� �geticonstate(win%,icon%)
2!b%=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
=(b%!24>>21 � 1)>0
 :
*3� PROCiconshade  : unshade/shade/toggle an icon
45� PROCiconstate  : unselect/select/toggle an icon
>8� PROCseticonbit : set/unset/toggle a bit in an icon
H!��iconshade(win%,icon%,type%)
R$�seticonbit(win%,icon%,22,type%)
\�
f!��iconstate(win%,icon%,type%)
p$�seticonbit(win%,icon%,21,type%)
z�
�� type = 0 for untick
�!� type = 1 for tick (also -1)
�� type = 2 for toggle
�'��seticonbit(win%,icon%,bit%,type%)
�� s%,t%
�Ȏ type% �
� � 0:s%=0<<bit%:t%=1<<bit%
�! � -1,1:s%=1<<bit%:t%=1<<bit%
� � 2:s%=1<<bit%:t%=0<<bit%
��
�)b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
�ș "Wimp_SetIconState",,b%
��
:
9� PROCpressicon  : Make the icon pressed and released
3� PROCredrawicon : Force the redraw of the icon
$��pressicon(win%,icon%)
.%� t%:�seticonbit(win%,icon%,21,1)
80t%=�:�:��>t%+15:�seticonbit(win%,icon%,21,0)
B�
L��redrawicon(win%,icon%)
V@win%+=win%=-1:!b%=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
`5ș "Wimp_ForceRedraw",win%,b%!8,b%!12,b%!16,b%!20
j�
t:
~<� FNgeticontext   : return icons text string (or sprite)
�9� PROCseticontext : set icons text string (or sprite)
�ݤgeticontext(win%,icon%)
�3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
�*� ((b%!24) � &100)=0 �=�string0(b%+28)
�=�string0(b%!28)
�(��seticontext(win%,icon%,text$):� i%
�8text$=�msgtext(text$):ș "Wimp_GetCaretPosition",,b%
� i%=(!b%=win%) � (icon%=b%!4)
�3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
�G� ((b%!24) � &100)=0 � � &803,"Icon isn't indirected (#"+�icon%+")"
�� �string0(b%!28)<>text$ �
�T � �(text$)<b%!36 �$(b%!28)=text$ �� &803,"Text too long for icon (#"+�icon%+")"
B !b%=win%:b%!4=icon%:b%!8=0:b%!12=0:ș "Wimp_SetIconState",,b%

R � i% � (b%!24 � 1)=1 �ș "Wimp_SetCaretPosition",win%,icon%,-1,-1,-1,�(text$)
�
�
(:
27� FNgeticonvalid   : return icons validation string
<4� PROCseticonvalid : set icons validation string
F=� Remember not to exceed the original validation string's
P
� length.
Zݤgeticonvalid(win%,icon%)
d3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
nE� ((b%!24) � &100)=0 � &803,"Icon isn't indirected (#"+�icon%+")"
x=�string0(b%!32)
�$��seticonvalid(win%,icon%,text$)
�3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
�G� ((b%!24) � &100)=0 � � &803,"Icon isn't indirected (#"+�icon%+")"
�*$(b%!32)=text$:�redrawicon(win%,icon%)
��
�:
�%� PROCdragicon : Start a drag box
�C� bound% should be TRUE if you wish the icon to stay within the
�� window
�!��dragicon(win%,icon%,bound%)
�)!b%=win%:ș "Wimp_GetWindowState",,b%
�sx%=b%!20:sy%=b%!24
�9x0%=b%!4-sx%:y0%=b%!8-sy%:x1%=b%!12-sx%:y1%=b%!16-sy%
2!b%=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
.b%!8+=x0%:b%!12+=y1%:b%!16+=x0%:b%!20+=y1%
� bound%=� �
"< b%!24=x0%+sx%:b%!28=y0%+sy%:b%!32=x1%+sx%:b%!36=y1%+sy%
,�
6/ b%!40=4:b%!44=5:b%!48=11:b%!52=12:b%!56=-1
@) ș "OS_ReadVduVariables",b%+40,b%+40
J> b%!24=0:b%!28=0:b%!32=b%!48+1<<b%!40:b%!36=b%!52+1<<b%!44
T�
^b%!4=5:� Drag type
hș "Wimp_DragBox",,b%
r�
|:
�9� PROCdragsave : Initiate a save after DragDone event
�&��dragsave(win%,icon%,type%,size%)
�3�getptrpos(x,y,win,icon):� Get drag to location
�*f$=�leafname(�geticontext(win%,icon%))
�!b%=(48+�(f$)) � �3
�8b%!12=0:b%!16=1:b%!20=win:b%!24=icon:b%!28=x:b%!32=y
�'b%!36=size%:b%!40=type%:$(b%+44)=f$
�(ș "Wimp_SendMessage",18,b%,win,icon
��
�:
�7� ******** !Help responsive routines **************
�:
�8� PROCreadhelp : read help from application and send
-� PROCsendhelp : send help to application
� \S for "Click SELECT to "
)� \R for "Move the pointer right to "
&� \A for "Click ADJUST to "
0� \T for "This is the "
:1� \G for "This option is greyed out because "
D� \W for "This window is "
N� \D for "Drag SELECT to "
X� \d for "Drag ADJUST to "
b� \w for "window"
l� \s for "SELECT"
v� \a for "ADJUST"
�� |M for return
�!� �String$� to include string
�)� > prefix to look up in message file
�>� Menu help icons will be searched as HM<menustring>, with
�� spaces replaced with _'s
�/� NB if no full stop then one will be added
�� Format for help :
�(�  { window,help message for no icon
�*�    { icon number, message } repeated
��  } repeated
�*�  { -2, {iconbar message} } by choice
��  -1,-1 to end
�/� NB window submenus must have help strings
� Format for menu help :
<�  { menu, -1,-1,-1 or menu, -1,0,help for all the items
�    { opt1,opt2,opt3,help
 '�   or -1,string,-1,help } repeated
*�  } repeated
4�  -2,-2,-2,-2
>��readhelp(win,icon,to)
H8� lwin,val,help$,found,a$,m$,m2$,mh$:found=�:lwin=-1
R�
\ � val,help$
f � val>(1<<16) � val<0 �
p  � lwin=win �
z   val=icon:help$="":m2$=m$
�  �
�   lwin=val:m$=help$
�  �
� �
� � val=icon � lwin=win �
�  � icon=-1 � help$="" �
�&   �sendhelp(�msgtext(m$)+"|M",to)
�  �
�9   m$=�msgtext(m$):� �m$,"|M")>0 �m$=�m$,�m$,"|M")-1)
�6   �sendhelp(�msgtext(m$)+"|M"+�msgtext(help$),to)
�  �
�
  found=�
� �
� help$="-1" � found=�
� � found �
B !message_buffer%=-1:message_buffer%!4=-1:message_buffer%!8=-1
$6 ș "Wimp_GetMenuState",1,message_buffer%,win,icon
. � !message_buffer%<>-1 �
8@  val=b%:b%=message_buffer%:mh$=�decodemenu(curmenu%):b%=val
B0  m$=mh$:ȕ �m$," ")>0:�m$,�m$," "),1)="_":�
L  help$=�msgtoken("HM"+m$)
V  � help$<>"HM"+m$ �
`   �sendhelp(help$,to)
j  �
t   �
~    � m$,val,help$,help$
�!   � �(m$)=curmenu% � m$="-2"
�   � m$<>"-2" �
�    � val>-1 �
�$     �sendhelp(help$,to):found=�
�	    �
�
     �
�      � lwin,m$,val,help$
�      � �(m$)=0 � m$<>"0" �
�0       � mh$=m$ ��sendhelp(help$,to):found=�
�      �
�W       � lwin=message_buffer%!0 � �(m$)=message_buffer%!4 � val=message_buffer%!8 �
�'        �sendhelp(help$,to):found=�
       �

      �
)     �found=� � lwin=-2 � lwin >&8000
	    �
(   �
2  �
< �
F�
P�
Z.��sendhelp(help$,to):help$=�msgtext(help$)
d"� �help$,2)<>"|M" �help$+="|M"
n� b$,c$
xhelp$=�substvars(help$)
�ȕ �help$,"|M")>0
�4 b$=�help$,�help$,"|M")-1):help$=�help$,�(b$)+3)
�  � �"!.?",�b$,1))=0 �b$+="."
� c$+=b$+"|M"
��
�0b%!12=b%!8:b%!4=to:b%!16=&503:$(b%+20)=c$+�0
�b%!0=20+(�(c$)+4) � -4
�$ș "Wimp_SendMessage",17,b%,b%!4
��
�:
�7� ******** MessageTrans interface routines ********
�:
�<� PROCopenmessages  : open a MessageTrans file for input
3� PROCclosemessages : close a MessageTrans file
��openmessages:� f,l
8� msgbuffer%<>-1 �� &803,"Message file already open"
":ș "MessageTrans_FileInfo",,Appdir$+".Messages" � f,,l
,4� (f �1)=1 �msgbuffer2%=0 �msgbuffer2%=�claim(l)
6H� msgbuffer2%=-1 �� &803,"No room for secondary MessageTrans buffer"
@qmsgbuffer%=�claim(16):� msgbuffer%=-1 ��release(msgbuffer2%):� &803,"No room for primary MessageTrans buffer"
JIș "MessageTrans_OpenFile",msgbuffer%,Appdir$+".Messages",msgbuffer2%
T�
^��closemessages
h� �
r� � �:�4:�:�" at ";�:G=�:�
|� msgbuffer%>-1 �
�, ș "XMessageTrans_CloseFile",msgbuffer%
�/ �release(msgbuffer%):�release(msgbuffer2%)
��
��
�:
�9� FNmsgtoken        : translate a token into a string
�B� FNmsgtext         : translate text to a token if prefix is >
�*ݤmsgtoken(t$):� s1$,s2$,s3$,a$,len%,f
�� msgbuffer%=-1 �=t$
�1a$=�t$,�t$+":",":")+1):t$=�t$,�t$+":",":")-1)
�s1$=�a$,�a$+":",":")-1)
�� �s1$,1)="|" �
� s1$=�a$,2):s2$="":s3$=""
 �
 - a$=�a$,�(s1$)+2):s2$=�a$,�a$+":",":")-1)
 8 � �s2$,1)="|" �s2$=�a$,2):s3$="" �s3$=�a$,�(s2$)+2)
 &�
 0Wș "XMessageTrans_Lookup",msgbuffer%,t$,message_buffer%,256,s1$,s2$,s3$ � ,,,len%;f
 :,� (f �1)=1 �=t$ �message_buffer%?len%=13
 D!=�substvars($message_buffer%)
 Nݤmsgtext(a$)
 X&� �a$,1)=">" �a$=�msgtoken(�a$,2))
 b=a$
 l:
 v7� ******** String manipulation routines ***********
 �:
 �8� FNstring0 : Return 0-terminated string at location
 �"ݤstring0(a%):� a$:� a%=0 �=""
 �,ȕ?a%>31 ��(a$)<255:a$=a$+�?a%:a%=a%+1:�
 �=a$
 �:
 �7� FNlower       : Return given string in lower case
 �7� FNupper       : Return given string in upper case
 �8� FNtidy        : Return given string in tidy format
 �@� FNstripspaces : Remove spaces from start and end of string
 �ݤlower(a$):� c$,b$,I
 ��I=1��(a$)
 �0c$=�a$,I,1):� c$>="A"�c$<="Z"�c$=�(�(c$)+32)
!b$+=c$:�:=b$
!ݤupper(a$):� c$,b$,I
!�I=1��(a$)
! 0c$=�a$,I,1):� c$>="a"�c$<="z"�c$=�(�(c$)-32)
!*b$+=c$:�:=b$
!4ݤtidy(a$):� cap,b$,I,c$
!>	cap=�
!H�I=1��(a$)
!R2 b$=�a$,I,1):� b$>="a"�b$<="z" �b$=�(�(b$)-32)
!\# � (b$<"A" �b$>"Z") � b$<>"'" �
!f  cap=�
!p �
!z.  � cap=� � b$<>"'" �b$=�(�(b$)+32) �cap=�
!�
 �:c$+=b$
!�	�:=c$
!�ݤstripspaces(f$)
!�'ȕ �f$,1)=" " � �f$,1)=�9:f$=�f$):�
!�)ȕ �f$,1)=" " � �f$,1)=�9:f$=�f$,2):�
!�=f$
!�:
!�1� FNsubstvars  : Substitute string for �var$�
!�=� FNsubstvarsp : Substitute string for �var$� with prefix
!�8� FNgstrans    : Perform GSTrans on string specified
!�ݤsubstvarsp(a$,c$)
!�� b$,d$:� �:� � �:=a$
!�ȕ �a$,"�")>0
"* b$=�a$,�a$,"�")+1):b$=�b$,�b$,"�")-1)
". d$=c$+b$:� �d$,1)<>"$" �d$="STR$("+d$+")"
"3 a$=�a$,�a$,"�")-1)+�(d$)+�a$,�a$,"�")+�(b$)+2)
"$�
".=a$
"8ݤsubstvars(a$)
"B� b$,d$:� �:� � �:=a$
"Lȕ �a$,"�")>0
"V* b$=�a$,�a$,"�")+1):b$=�b$,�b$,"�")-1)
"`+ d$=b$:� �d$,1)<>"$" �d$="STR$("+d$+")"
"j3 a$=�a$,�a$,"�")-1)+�(d$)+�a$,�a$,"�")+�(b$)+2)
"t�
"~=a$
"�ݤgstrans(a$):� p%,len
"�:ș "OS_GSTrans",a$,message_buffer%,256+(1<<31) � ,,len
"�a$="":p%=message_buffer%
"�!ȕ �(a$)<len:a$+=�?p%:p%+=1:�
"�=a$
"�:
"�;� FNswinumber : Return the SWI number, given its string
"�ݤswinumber(swi$):� n
"�0ș "XOS_SWINumberFromString",,swi$ � n;flags
"�� (flags �1)>0 �n=-1
"�=n
"�:
#7� ******** File information routines **************
#
:
#1� FNfiletype : Return the file type of a file
#2� -2=not found, -1=untyped, &1000=dir or image
#("� �filetype(f$):� f%,type%,fl%
#2+ș "XOS_File",20,f$ � type%,,,,,,f%;fl%
#<Ȏ type% �
#F � 0:type%=-2
#P � 1:type%=f%
#Z � 2,3:type%=&1000
#d�
#n� (fl%�1)=1 �type%=-2
#x
=type%
#�:
#�?� FNbasetype : Return the file type of a directory or image
#�:� -2=not found, -1=file, &1000 for dir, type for image
#�"� �basetype(f$):� f%,type%,fl%
#�&ș "XOS_File",5,f$ � type%,,f%;fl%
#�Ȏ type% �
#� � 0:type%=-2
#� � 1:type%=-1
#� � 2:type%=&1000
#� � 3:type%=(f% � &FFF00)>>8
#��
#�� (fl%�1)=1 �type%=-2
#�
=type%
$:
$0� FNfilelength : Return the length of a file
$� -1 if not found
$"!� �filelength(f$):� len%,ex,f
$,%ș "XOS_File",5,f$ � ex,,,,len%;f
$6� ex=0 � (f � 1)=1 �len%=-1
$@	=len%
$J:
$T2� FNleafname : Return the leafname of the file
$^;� FNpathname : Return the directory containing the file
$h9� FNlongfilename : Return the full pathname of a file
$r� �leafname(f$):� r$
$|$� �f$,":")>0 �f$=�f$,�f$,":")+1)
$�Ȏ �f$,".") �
$� � 0    :r$=f$
$�)  :r$=�leafname(�f$,�(f$)-�f$,".")))
$��
$�=r$
$�� �pathname(f$)
$�N� �f$,":")>0 � �f$,".")=0 �=�f$,�f$,":")) �� �f$,":")=0 � �f$,".")=0 �="@"
$�"=�f$,�(f$)-�(�leafname(f$))-1)
$�+� Removes identifiers such as Scrap:...
$�ݤlongfilename(f$)
$�@ș "XOS_FSControl",37,f$,message_buffer%,,,256 � ,,f$ ;flags
$�� (flags � 1)=1 �f$=""
$�=f$
%:
%7� ******** Module workspace manipulation routine **
%:
%&&� FNclaim   : Claim an area of RMA
%0/� FNrelease : Release a claimed area of RMA
%:ݤclaim(length%)
%D:� flags:� length%<1�� &803,"Cannot claim negative RMA"
%N/ș "XOS_Module",6,,,length% � ,,area%;flags
%X� (flags �1)>0 �area%=-1
%b
=area%
%l��release(� area%)
%v/� area%>0 �ș "OS_Module",7,,area%:area%=-1
%��
%�:
%�7� ******** Task interaction routines **************
%�:
%�3� FNtaskname        : return a given tasks name
%�<� FNwindowtask      : return task handle who owns window
%�7� FNreadtaskstring  : read a string from given task
%�6� PROCreadtaskarea  : read a block from given task
%�:� FNfindtask        : return task handle of named task
%�ݤtaskname(task%):� name$,f
%�8ș "XTaskManager_TaskNameFromHandle",task% � name$;f
%�� (f �1) �name$="None"
%�
=name$
&ݤwindowtask(win%):� task%
&-message_buffer%!0=20:message_buffer%!12=0
&>ș "Wimp_SendMessage",19,message_buffer%,win%,-1 � ,,task%
& 
=task%
&*%ݤreadtaskstring(task%,loc%):� p$
&4@ș"Wimp_TransferBlock",task%,loc%,handle,message_buffer%,256
&>=�string0(message_buffer%)
&H'��readtaskarea(task%,loc%,to%,len%)
&R5ș"Wimp_TransferBlock",task%,loc%,handle,to%,len%
&\�
&fݤfindtask(a$)
&p� th,cnt,t$
&z=ș "TaskManager_EnumerateTasks",,message_buffer%,16 � cnt
&�ȕ cnt<>-1
&�7 th=!message_buffer%:t$=�string0(message_buffer%!4)
&�A ș "TaskManager_EnumerateTasks",cnt,message_buffer%,16 � cnt
&�$ � t$=a$ �cnt=-1 ��cnt=-1 �th=-1
&��
&�=th
&�:
&�?� FNbackofwinstack : return win handle of back of win stack
&�>� FNwinstacknext   : return win handle of next win forward
&�ݤbackofwinstack:� I
&�,!b%=infobox%:ș"Wimp_GetWindowState",,b%
&�
�I=4�16�4
&� b%!I=(b%!I)-4096
'�I
'$b%!28=-2:ș"Wimp_OpenWindow",,b%
')ș"Wimp_GetWindowState",,b%:zc%=b%!28
'$ș"Wimp_CloseWindow",,b%
'.=zc%
'8Dݤwinstacknext(win%):!b%=win%:ș"Wimp_GetWindowState",,b%:=b%!28
'B:
'L7� ******** Caret and pointer control procedures ***
'V:
'`>� PROCsetcaretend : Place the caret at the end of the text
'j>� PROCsetcaretpos : Place the caret at pos within the text
't8� PROCgetcaretpos : Return the position of the caret
'~:� PROCgetptrpos   : Return the location of the pointer
'���setcaretend(win,icon)
'�4�setcaretpos(win,icon,�(�geticontext(win,icon)))
'��
'�!��setcaretpos(win,icon,chars)
'�4ș "Wimp_SetCaretPosition",win,icon,0,0,-1,chars
'��
'�'��getcaretpos(� win,� icon,� chars)
'�@ș "Wimp_GetCaretPosition",,b%:win=!b%:icon=b%!4:chars=b%!20
'��
'�%��getptrpos(� x,� y,� win,� icon)
'�Cș "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4:win=b%!12:icon=b%!16
'��
(:
(
7� ******** Configuration settings control *********
(:
(7� FNreadcmos    : Read a byte of configuration info
((8� PROCwritecmos : Write a byte of configuration info
(2ݤreadcmos(byte)
(<#ș "OS_Byte",161,byte � ,,value
(F
=value
(P��writecmos(byte,value)
(Zș "OS_Byte",162,byte,value
(d�
(n:
(x7� ******** Status file control routines ***********
(�:
(�0� PROCmakestatusfile  : Create a status file
(�1� PROCclosestatusfile : Close the status file
(�3� FNreadstatusfile    : Open a status file read
(���makestatusfile(f$)
(�+�("Create "+f$):�("SetType "+f$+" FFF")
(�3statfile%=�(f$):�#statfile%,"Program:"+Appname$
(��
(���closestatusfile
(��#statfile%
(��
(�.� Return FALSE if not correct or not found
(�ݤreadstatusfile(f$):� a$
)� �:� � �:=�
)statfile%=�(f$)
)� statfile%=0 �=�
)"a$=�statusget("Program")
),"� a$<>Appname$ ��#statfile%:=�
)6=�
)@:
)J6� PROCstatusput    : Put the string in status file
)T5� PROCstatusoption : Put the value in status file
)^4� PROCstatusflag   : Put the flag in status file
)h��statusput(e$,d$)
)r�#statfile%,e$+":"+d$
)|�
)���statusoption(e$,v%)
)��#statfile%,e$+":%"+�v%
)��
)���statusflag(e$,v%)
)�5� v% ��#statfile%,e$+":On" ��#statfile%,e$+":Off"
)��
)�:
)�3� PROCstatusnext   : Read the next status entry
)���statusnext(� a$,� b$)
)�'� �#statfile% �a$="*E*N*D*":b$="":�
)�!�:a$=�#statfile%:��a$,1)<>"#"
)�b$=�a$,�a$,":")+1)
)�a$=�upper(�a$,�a$,":")-1))
*�
*:
*7� FNstatusget      : Read an entry from status file
*&5� FNstatusgetv     : Read a value from staus file
*05� FNstatusgetflag  : Read a flag from status file
*:ݤstatusget(a$)
*D,� b$,c$:a$=�upper(a$):�statusnext(b$,c$)
*N� a$<>b$ �
*X �#statfile%=0:b$=""
*b ȕ a$<>b$ � b$<>"*E*N*D*"
*l  �statusnext(b$,c$)
*v �
*��
*�=c$
*�&ݤstatusgetv(a$):a$=�statusget(a$)
*�� �a$,1)="%" �=�(�a$,2))
*�=0
*�)ݤstatusgetflag(a$):a$=�statusget(a$)
*� � a$="%1"��upper(a$)="ON"�=�
*�=�
�
00000000  0d 00 0a 0e f4 20 3e 57  69 6d 70 4c 69 62 0d 00  |..... >WimpLib..|
00000010  14 17 f4 20 a9 20 4a 75  73 74 69 6e 20 46 6c 65  |... . Justin Fle|
00000020  74 63 68 65 72 0d 00 1e  22 f4 20 56 65 72 73 69  |tcher...". Versi|
00000030  6f 6e 20 3a 20 31 2e 37  33 20 28 31 32 20 4a 75  |on : 1.73 (12 Ju|
00000040  6e 20 31 39 39 37 29 0d  00 28 1a f4 20 54 68 69  |n 1997)..(.. Thi|
00000050  73 20 76 65 72 73 69 6f  6e 20 66 6f 72 20 52 4f  |s version for RO|
00000060  33 0d 00 32 28 85 20 26  38 30 33 2c 22 44 6f 20  |3..2(. &803,"Do |
00000070  6e 6f 74 20 72 75 6e 20  74 68 65 20 57 69 6d 70  |not run the Wimp|
00000080  20 4c 69 62 72 61 72 79  22 0d 00 3c 05 3a 0d 00  | Library"..<.:..|
00000090  46 37 f4 20 2a 2a 2a 2a  2a 2a 2a 2a 20 4d 61 69  |F7. ******** Mai|
000000a0  6e 20 41 70 70 6c 69 63  61 74 69 6f 6e 20 50 72  |n Application Pr|
000000b0  6f 63 65 64 75 72 65 73  20 2a 2a 2a 2a 2a 2a 2a  |ocedures *******|
000000c0  2a 2a 2a 2a 2a 0d 00 50  05 3a 0d 00 5a 34 f4 20  |*****..P.:..Z4. |
000000d0  50 52 4f 43 69 6e 69 74  6c 69 62 72 61 72 79 20  |PROCinitlibrary |
000000e0  3a 20 49 6e 69 74 69 61  6c 69 73 65 20 6c 69 62  |: Initialise lib|
000000f0  72 61 72 79 20 76 61 72  69 61 62 6c 65 73 0d 00  |rary variables..|
00000100  64 11 dd f2 69 6e 69 74  6c 69 62 72 61 72 79 0d  |d...initlibrary.|
00000110  00 6e 1a de 20 6d 65 73  73 61 67 65 5f 62 75 66  |.n.. message_buf|
00000120  66 65 72 25 20 31 30 32  34 0d 00 78 38 72 6d 61  |fer% 1024..x8rma|
00000130  66 6f 6e 74 61 72 65 61  3d 2d 32 3a 6d 73 67 62  |fontarea=-2:msgb|
00000140  75 66 66 65 72 25 3d 2d  31 3a 6d 73 67 62 75 66  |uffer%=-1:msgbuf|
00000150  66 65 72 32 25 3d 2d 31  3a 66 74 62 6c 6b 3d 2d  |fer2%=-1:ftblk=-|
00000160  32 0d 00 82 05 e1 0d 00  8c 05 3a 0d 00 96 3d f4  |2.........:...=.|
00000170  20 50 52 4f 43 6e 6f 74  65 6d 65 73 73 61 67 65  | PROCnotemessage|
00000180  20 3a 20 4d 61 72 6b 20  74 68 65 20 67 69 76 65  | : Mark the give|
00000190  6e 20 6d 65 73 73 61 67  65 20 61 73 20 72 65 63  |n message as rec|
000001a0  65 69 76 65 61 62 6c 65  0d 00 a0 2e dd f2 6e 6f  |eiveable......no|
000001b0  74 65 6d 65 73 73 61 67  65 28 6e 29 3a 6d 65 73  |temessage(n):mes|
000001c0  73 61 67 65 6c 69 73 74  25 21 6d 65 73 73 70 74  |sagelist%!messpt|
000001d0  72 25 3d 6e 3a e1 0d 00  aa 05 3a 0d 00 b4 32 f4  |r%=n:.....:...2.|
000001e0  20 46 4e 6c 6f 61 64 74  65 6d 70 6c 61 74 65 20  | FNloadtemplate |
000001f0  3a 20 6c 6f 61 64 20 74  68 65 20 73 70 65 63 69  |: load the speci|
00000200  66 69 65 64 20 74 65 6d  70 6c 61 74 65 0d 00 be  |fied template...|
00000210  32 f4 20 73 70 72 62 6c  6b 25 20 73 68 6f 75 6c  |2. sprblk% shoul|
00000220  64 20 62 65 20 31 20 66  6f 72 20 74 68 65 20 73  |d be 1 for the s|
00000230  74 61 6e 64 61 72 64 20  73 70 72 69 74 65 73 0d  |tandard sprites.|
00000240  00 c8 30 dd a4 6c 6f 61  64 74 65 6d 70 6c 61 74  |..0..loadtemplat|
00000250  65 28 6e 24 2c 73 70 72  62 6c 6b 25 29 3a ea 20  |e(n$,sprblk%):. |
00000260  74 73 69 7a 65 25 2c 62  6c 6b 25 2c 6f 6b 25 0d  |tsize%,blk%,ok%.|
00000270  00 d2 30 c8 99 20 22 57  69 6d 70 5f 4f 70 65 6e  |..0.. "Wimp_Open|
00000280  54 65 6d 70 6c 61 74 65  22 2c 2c 41 70 70 64 69  |Template",,Appdi|
00000290  72 24 2b 22 2e 54 65 6d  70 6c 61 74 65 73 22 0d  |r$+".Templates".|
000002a0  00 dc 30 c8 99 20 22 57  69 6d 70 5f 4c 6f 61 64  |..0.. "Wimp_Load|
000002b0  54 65 6d 70 6c 61 74 65  22 2c 2c 30 2c 2c 2c 2c  |Template",,0,,,,|
000002c0  6e 24 2c 30 20 b8 20 2c  2c 74 73 69 7a 65 25 0d  |n$,0 . ,,tsize%.|
000002d0  00 e6 11 de 20 62 6c 6b  25 20 74 73 69 7a 65 25  |.... blk% tsize%|
000002e0  0d 00 f0 48 c8 99 20 22  57 69 6d 70 5f 4c 6f 61  |...H.. "Wimp_Loa|
000002f0  64 54 65 6d 70 6c 61 74  65 22 2c 2c 77 73 70 63  |dTemplate",,wspc|
00000300  25 2c 62 6c 6b 25 2c 62  6c 6b 25 20 2b 20 74 73  |%,blk%,blk% + ts|
00000310  69 7a 65 25 2c 2d 31 2c  6e 24 2c 30 20 b8 20 2c  |ize%,-1,n$,0 . ,|
00000320  2c 2c 2c 2c 2c 6f 6b 25  0d 00 fa 1b c8 99 20 22  |,,,,,ok%...... "|
00000330  57 69 6d 70 5f 43 6c 6f  73 65 54 65 6d 70 6c 61  |Wimp_CloseTempla|
00000340  74 65 22 0d 01 04 35 e7  20 6f 6b 25 3d 30 20 8c  |te"...5. ok%=0 .|
00000350  85 20 26 38 30 33 2c 20  22 54 65 6d 70 6c 61 74  |. &803, "Templat|
00000360  65 20 66 69 6c 65 20 22  2b 6e 24 2b 22 20 6e 6f  |e file "+n$+" no|
00000370  74 20 66 6f 75 6e 64 22  0d 01 0e 39 77 73 70 63  |t found"...9wspc|
00000380  25 21 36 34 3d 73 70 72  62 6c 6b 25 3a c8 99 20  |%!64=sprblk%:.. |
00000390  22 57 69 6d 70 5f 43 72  65 61 74 65 57 69 6e 64  |"Wimp_CreateWind|
000003a0  6f 77 22 2c 2c 77 73 70  63 25 20 b8 20 62 6c 6b  |ow",,wspc% . blk|
000003b0  25 0d 01 18 09 3d 62 6c  6b 25 0d 01 22 05 3a 0d  |%....=blk%..".:.|
000003c0  01 2c 34 f4 20 46 4e 6c  6f 61 64 73 70 72 69 74  |.,4. FNloadsprit|
000003d0  65 73 20 3a 20 4c 6f 61  64 20 73 70 72 69 74 65  |es : Load sprite|
000003e0  20 66 69 6c 65 20 69 6e  74 6f 20 6e 65 77 20 61  | file into new a|
000003f0  72 65 61 0d 01 36 2a dd  a4 6c 6f 61 64 73 70 72  |rea..6*..loadspr|
00000400  69 74 65 73 28 66 69 6c  65 24 29 3a ea 20 6c 65  |ites(file$):. le|
00000410  6e 25 2c 6f 25 2c 73 70  72 62 6c 6b 25 0d 01 40  |n%,o%,sprblk%..@|
00000420  1a 6f 25 3d 8e 28 66 69  6c 65 24 29 3a e7 20 6f  |.o%=.(file$):. o|
00000430  25 3d 30 20 8c 3d 31 0d  01 4a 15 6c 65 6e 25 3d  |%=0 .=1..J.len%=|
00000440  a2 23 6f 25 2b 31 36 3a  d9 23 6f 25 0d 01 54 2c  |.#o%+16:.#o%..T,|
00000450  de 20 73 70 72 62 6c 6b  25 20 6c 65 6e 25 3a 21  |. sprblk% len%:!|
00000460  73 70 72 62 6c 6b 25 3d  6c 65 6e 25 3a 73 70 72  |sprblk%=len%:spr|
00000470  62 6c 6b 25 21 38 3d 30  0d 01 5e 20 c8 99 22 4f  |blk%!8=0..^ .."O|
00000480  53 5f 53 70 72 69 74 65  4f 70 22 2c 26 31 30 39  |S_SpriteOp",&109|
00000490  2c 73 70 72 62 6c 6b 25  0d 01 68 26 c8 99 22 4f  |,sprblk%..h&.."O|
000004a0  53 5f 53 70 72 69 74 65  4f 70 22 2c 26 31 30 41  |S_SpriteOp",&10A|
000004b0  2c 73 70 72 62 6c 6b 25  2c 66 69 6c 65 24 0d 01  |,sprblk%,file$..|
000004c0  72 0c 3d 73 70 72 62 6c  6b 25 0d 01 7c 05 3a 0d  |r.=sprblk%..|.:.|
000004d0  01 86 41 f4 20 46 4e 47  65 74 45 6e 76 20 3a 20  |..A. FNGetEnv : |
000004e0  52 65 74 75 72 6e 20 74  68 65 20 65 6e 76 69 72  |Return the envir|
000004f0  6f 6e 6d 65 6e 74 20 73  74 72 69 6e 67 20 73 74  |onment string st|
00000500  72 69 70 70 65 64 20 6f  66 20 6c 6f 61 64 65 72  |ripped of loader|
00000510  0d 01 90 18 dd a4 47 65  74 45 6e 76 3a ea 20 63  |......GetEnv:. c|
00000520  6f 6d 24 2c 49 2c 70 24  0d 01 9a 19 c8 99 20 22  |om$,I,p$...... "|
00000530  4f 53 5f 47 65 74 45 6e  76 22 20 b8 20 63 6f 6d  |OS_GetEnv" . com|
00000540  24 0d 01 a4 1c 70 24 3d  22 22 3a 49 3d a7 63 6f  |$....p$="":I=.co|
00000550  6d 24 2c 22 20 2d 71 75  69 74 20 22 29 0d 01 ae  |m$," -quit ")...|
00000560  0b e7 20 49 3e 30 20 8c  0d 01 b8 28 20 70 24 3d  |.. I>0 ....( p$=|
00000570  c1 63 6f 6d 24 2c a7 63  6f 6d 24 2c 22 20 22 2c  |.com$,.com$," ",|
00000580  49 2b a9 22 20 2d 71 75  69 74 20 22 29 2b 31 29  |I+." -quit ")+1)|
00000590  0d 01 c2 1e 20 c8 95 20  c0 70 24 2c 31 29 3d 22  |.... .. .p$,1)="|
000005a0  20 22 3a 70 24 3d c1 70  24 2c 32 29 3a ce 0d 01  | ":p$=.p$,2):...|
000005b0  cc 05 cd 0d 01 d6 07 3d  70 24 0d 01 e0 05 3a 0d  |.......=p$....:.|
000005c0  01 ea 40 f4 20 46 4e 73  79 73 74 65 6d 76 61 72  |..@. FNsystemvar|
000005d0  20 3a 20 52 65 74 75 72  6e 20 74 68 65 20 63 6f  | : Return the co|
000005e0  6e 74 65 6e 74 73 20 6f  66 20 61 6e 79 20 73 74  |ntents of any st|
000005f0  72 69 6e 67 20 73 79 73  74 65 6d 20 76 61 72 0d  |ring system var.|
00000600  01 f4 1b dd a4 73 79 73  74 65 6d 76 61 72 28 56  |.....systemvar(V|
00000610  61 72 24 29 3a ea 20 6c  65 6e 0d 01 fe 3a c8 99  |ar$):. len...:..|
00000620  20 22 58 4f 53 5f 52 65  61 64 56 61 72 56 61 6c  | "XOS_ReadVarVal|
00000630  22 2c 56 61 72 24 2c 6d  65 73 73 61 67 65 5f 62  |",Var$,message_b|
00000640  75 66 66 65 72 25 2c 32  35 35 2c 30 2c 33 b8 2c  |uffer%,255,0,3.,|
00000650  2c 6c 65 6e 0d 02 08 1a  6d 65 73 73 61 67 65 5f  |,len....message_|
00000660  62 75 66 66 65 72 25 3f  6c 65 6e 3d 31 33 0d 02  |buffer%?len=13..|
00000670  12 15 3d 24 6d 65 73 73  61 67 65 5f 62 75 66 66  |..=$message_buff|
00000680  65 72 25 0d 02 1c 05 3a  0d 02 26 29 f4 20 50 52  |er%....:..&). PR|
00000690  4f 43 65 65 72 72 6f 72  20 3a 20 45 78 74 65 72  |OCeerror : Exter|
000006a0  6e 61 6c 20 65 72 72 6f  72 20 72 6f 75 74 69 6e  |nal error routin|
000006b0  65 0d 02 30 3e f4 20 73  68 6f 75 6c 64 20 62 65  |e..0>. should be|
000006c0  20 63 61 6c 6c 65 64 20  77 68 65 6e 20 65 72 72  | called when err|
000006d0  6f 72 73 20 6f 63 63 75  72 20 64 75 72 69 6e 67  |ors occur during|
000006e0  20 69 6e 69 74 69 61 6c  69 73 61 74 69 6f 6e 0d  | initialisation.|
000006f0  02 3a 0c dd f2 65 65 72  72 6f 72 0d 02 44 07 ea  |.:...eerror..D..|
00000700  20 85 0d 02 4e 47 ee 20  85 20 ea 3a f2 63 6c 6f  | ...NG. . .:.clo|
00000710  73 65 6d 65 73 73 61 67  65 73 3a ef 34 3a 85 20  |semessages:.4:. |
00000720  a2 20 30 2c f6 24 2b 22  20 61 74 20 6c 69 6e 65  |. 0,.$+" at line|
00000730  20 22 2b c3 9e 2b 22 20  69 6e 20 65 72 72 6f 72  | "+..+" in error|
00000740  20 68 61 6e 64 6c 65 72  22 0d 02 58 29 6d 65 73  | handler"..X)mes|
00000750  73 24 3d 22 49 6e 74 65  72 6e 61 6c 20 65 72 72  |s$="Internal err|
00000760  6f 72 20 3a 20 28 22 2b  c3 9e 2b 22 29 20 22 2b  |or : ("+..+") "+|
00000770  f6 24 0d 02 62 38 ff 28  22 53 65 74 20 45 72 72  |.$..b8.("Set Err|
00000780  6f 72 24 20 22 2b 6d 65  73 73 24 29 3a ff 28 22  |or$ "+mess$):.("|
00000790  53 65 74 20 45 72 72 6f  72 24 54 61 73 6b 20 4e  |Set Error$Task N|
000007a0  6f 74 20 6b 6e 6f 77 6e  22 29 0d 02 6c 4c 6d 65  |ot known")..lLme|
000007b0  73 73 61 67 65 5f 62 75  66 66 65 72 25 21 30 3d  |ssage_buffer%!0=|
000007c0  9f 3a 24 28 6d 65 73 73  61 67 65 5f 62 75 66 66  |.:$(message_buff|
000007d0  65 72 25 2b 34 29 3d 6d  65 73 73 24 2b 22 20 77  |er%+4)=mess$+" w|
000007e0  68 69 6c 73 74 20 69 6e  69 74 69 61 6c 69 73 69  |hilst initialisi|
000007f0  6e 67 22 2b bd 30 0d 02  76 27 ee 20 85 20 ea 3a  |ng"+.0..v'. . .:|
00000800  41 70 70 6e 61 6d 65 24  3d 22 75 6e 69 6e 69 74  |Appname$="uninit|
00000810  69 61 6c 69 73 65 64 20  74 61 73 6b 22 0d 02 80  |ialised task"...|
00000820  0f 61 24 3d 41 70 70 6e  61 6d 65 24 0d 02 8a 47  |.a$=Appname$...G|
00000830  ee 20 85 20 ea 3a f2 63  6c 6f 73 65 6d 65 73 73  |. . .:.closemess|
00000840  61 67 65 73 3a ef 34 3a  85 20 a2 20 30 2c f6 24  |ages:.4:. . 0,.$|
00000850  2b 22 20 61 74 20 6c 69  6e 65 20 22 2b c3 9e 2b  |+" at line "+..+|
00000860  22 20 69 6e 20 65 72 72  6f 72 20 68 61 6e 64 6c  |" in error handl|
00000870  65 72 22 0d 02 94 34 c8  99 20 22 57 69 6d 70 5f  |er"...4.. "Wimp_|
00000880  52 65 70 6f 72 74 45 72  72 6f 72 22 2c 6d 65 73  |ReportError",mes|
00000890  73 61 67 65 5f 62 75 66  66 65 72 25 2c 39 2c 41  |sage_buffer%,9,A|
000008a0  70 70 6e 61 6d 65 24 0d  02 9e 05 e1 0d 02 a8 05  |ppname$.........|
000008b0  3a 0d 02 b2 3e f4 20 50  52 4f 43 65 72 72 6f 72  |:...>. PROCerror|
000008c0  20 3a 20 43 61 6c 6c 65  64 20 61 74 20 61 6e 79  | : Called at any|
000008d0  20 42 41 53 49 43 20 65  72 72 6f 72 20 69 6e 73  | BASIC error ins|
000008e0  69 64 65 20 74 68 65 20  64 65 73 6b 74 6f 70 0d  |ide the desktop.|
000008f0  02 bc 1b f4 20 45 52 52  4f 52 20 6e 75 6d 62 65  |.... ERROR numbe|
00000900  72 73 20 26 38 30 30 2b  20 3a 0d 02 c6 0c f4 20  |rs &800+ :..... |
00000910  30 20 3d 20 4f 4b 0d 02  d0 10 f4 20 31 20 3d 20  |0 = OK..... 1 = |
00000920  43 61 6e 63 65 6c 0d 02  da 21 f4 20 32 20 3d 20  |Cancel...!. 2 = |
00000930  4f 4b 20 61 6e 64 20 43  61 6e 63 65 6c 20 28 74  |OK and Cancel (t|
00000940  6f 20 71 75 69 74 29 0d  02 e4 2e f4 20 53 68 69  |o quit)..... Shi|
00000950  66 74 2c 20 43 74 72 6c  2c 20 51 20 61 6e 64 20  |ft, Ctrl, Q and |
00000960  63 6c 69 63 6b 20 74 6f  20 65 78 69 74 20 70 72  |click to exit pr|
00000970  6f 67 72 61 6d 0d 02 ee  22 dd f2 65 72 72 6f 72  |ogram..."..error|
00000980  3a ea 20 65 72 72 63 6f  64 65 2c 6d 65 73 73 24  |:. errcode,mess$|
00000990  2c 72 65 70 6c 79 25 0d  02 f8 07 ea 20 85 0d 03  |,reply%..... ...|
000009a0  02 47 ee 20 85 20 ea 3a  f2 63 6c 6f 73 65 6d 65  |.G. . .:.closeme|
000009b0  73 73 61 67 65 73 3a ef  34 3a 85 20 a2 20 30 2c  |ssages:.4:. . 0,|
000009c0  f6 24 2b 22 20 61 74 20  6c 69 6e 65 20 22 2b c3  |.$+" at line "+.|
000009d0  9e 2b 22 20 69 6e 20 65  72 72 6f 72 20 68 61 6e  |.+" in error han|
000009e0  64 6c 65 72 22 0d 03 0c  14 c8 99 20 22 4f 53 5f  |dler"...... "OS_|
000009f0  42 79 74 65 22 2c 31 32  34 0d 03 16 17 e7 20 9f  |Byte",124..... .|
00000a00  3e 26 37 46 46 20 80 20  9f 3c 26 38 30 33 20 8c  |>&7FF . .<&803 .|
00000a10  0d 03 20 1c 20 65 72 72  63 6f 64 65 3d 9f 2d 26  |.. . errcode=.-&|
00000a20  37 46 46 3a 6d 65 73 73  24 3d f6 24 0d 03 2a 2c  |7FF:mess$=.$..*,|
00000a30  20 e7 20 65 72 72 63 6f  64 65 3d 33 20 8c 6d 65  | . errcode=3 .me|
00000a40  73 73 24 2b 3d 22 20 28  43 61 6e 63 65 6c 20 74  |ss$+=" (Cancel t|
00000a50  6f 20 51 75 69 74 29 22  0d 03 34 2d 20 72 65 70  |o Quit)"..4- rep|
00000a60  6c 79 25 3d a4 65 72 72  6f 72 62 6f 78 28 41 70  |ly%=.errorbox(Ap|
00000a70  70 6e 61 6d 65 24 2c 6d  65 73 73 24 2c 65 72 72  |pname$,mess$,err|
00000a80  63 6f 64 65 29 0d 03 3e  24 20 e7 20 72 65 70 6c  |code)..>$ . repl|
00000a90  79 25 3d 32 20 80 20 65  72 72 63 6f 64 65 3d 33  |y%=2 . errcode=3|
00000aa0  20 8c 71 75 69 74 25 3d  b9 0d 03 48 05 cc 0d 03  | .quit%=...H....|
00000ab0  52 3c 20 6d 65 73 73 24  3d 22 49 6e 74 65 72 6e  |R< mess$="Intern|
00000ac0  61 6c 20 65 72 72 6f 72  20 3a 20 28 22 2b c3 9e  |al error : ("+..|
00000ad0  2b 22 29 20 22 2b f6 24  2b 22 20 43 61 6e 63 65  |+") "+.$+" Cance|
00000ae0  6c 20 74 6f 20 51 75 69  74 22 0d 03 5c 29 20 72  |l to Quit"..\) r|
00000af0  65 70 6c 79 25 3d a4 65  72 72 6f 72 62 6f 78 28  |eply%=.errorbox(|
00000b00  41 70 70 6e 61 6d 65 24  2c 6d 65 73 73 24 2c 25  |Appname$,mess$,%|
00000b10  31 31 29 0d 03 66 12 20  e7 20 72 65 70 6c 79 25  |11)..f. . reply%|
00000b20  3c 3e 31 20 8c 0d 03 70  24 20 20 71 75 69 74 25  |<>1 ...p$  quit%|
00000b30  3d b9 3a ff 28 22 53 65  74 20 45 72 72 6f 72 24  |=.:.("Set Error$|
00000b40  20 22 2b 6d 65 73 73 24  29 0d 03 7a 23 20 20 ff  | "+mess$)..z#  .|
00000b50  28 22 53 65 74 20 45 72  72 6f 72 24 54 61 73 6b  |("Set Error$Task|
00000b60  20 22 2b 41 70 70 6e 61  6d 65 24 29 0d 03 84 06  | "+Appname$)....|
00000b70  20 cd 0d 03 8e 2b 20 e7  20 a6 28 2d 31 29 20 80  | ....+ . .(-1) .|
00000b80  20 a6 28 2d 32 29 20 80  20 a6 28 2d 31 37 29 20  | .(-2) . .(-17) |
00000b90  8c ff 28 22 53 70 6f 6f  6c 22 29 3a e0 0d 03 98  |..("Spool"):....|
00000ba0  05 cd 0d 03 a2 05 e1 0d  03 ac 05 3a 0d 03 b6 3b  |...........:...;|
00000bb0  f4 20 46 4e 65 72 72 6f  72 62 6f 78 20 3a 20 63  |. FNerrorbox : c|
00000bc0  72 65 61 74 65 20 61 6e  20 65 72 72 6f 72 20 62  |reate an error b|
00000bd0  6f 78 20 77 69 74 68 20  75 70 20 74 6f 20 32 20  |ox with up to 2 |
00000be0  62 75 74 74 6f 6e 73 0d  03 c0 1d f4 20 42 69 74  |buttons..... Bit|
00000bf0  20 56 61 6c 75 65 20 45  66 66 65 63 74 20 69 66  | Value Effect if|
00000c00  20 73 65 74 0d 03 ca 3f  f4 20 20 30 20 20 20 20  | set...?.  0    |
00000c10  31 20 20 20 49 6e 63 6c  75 64 65 20 61 6e 20 4f  |1   Include an O|
00000c20  4b 20 6f 70 74 69 6f 6e  20 20 20 20 7d 20 69 66  |K option    } if|
00000c30  20 62 6f 74 68 20 75 6e  73 65 74 20 74 68 65 6e  | both unset then|
00000c40  20 61 73 0d 03 d4 33 f4  20 20 31 20 20 20 20 32  | as...3.  1    2|
00000c50  20 20 20 49 6e 63 6c 75  64 65 20 61 20 43 61 6e  |   Include a Can|
00000c60  63 65 6c 20 6f 70 74 69  6f 6e 20 7d 20 62 69 74  |cel option } bit|
00000c70  20 30 20 73 65 74 0d 03  de 44 f4 20 20 32 20 20  | 0 set...D.  2  |
00000c80  20 20 34 20 20 20 52 65  76 65 72 73 65 64 20 62  |  4   Reversed b|
00000c90  75 74 74 6f 6e 73 2c 20  4f 4b 3d 57 68 69 74 65  |uttons, OK=White|
00000ca0  2c 20 43 61 6e 63 65 6c  3d 59 65 6c 6c 6f 77 20  |, Cancel=Yellow |
00000cb0  61 6e 64 20 61 63 74 69  6f 6e 0d 03 e8 11 f4 20  |and action..... |
00000cc0  20 33 20 20 20 20 38 20  20 20 3f 0d 03 f2 3a f4  | 3    8   ?...:.|
00000cd0  20 20 34 20 20 20 20 31  36 20 20 54 69 74 6c 65  |  4    16  Title|
00000ce0  20 69 73 20 6a 75 73 74  20 74 69 74 6c 65 20 28  | is just title (|
00000cf0  6e 6f 74 20 45 72 72 6f  72 20 66 72 6f 6d 20 74  |not Error from t|
00000d00  69 74 6c 65 29 0d 03 fc  25 f4 20 20 35 20 20 20  |itle)...%.  5   |
00000d10  20 33 32 20 20 44 61 6e  67 65 72 6f 75 73 2c 20  | 32  Dangerous, |
00000d20  64 6f 20 6e 6f 74 20 75  73 65 0d 04 06 1e f4 20  |do not use..... |
00000d30  20 36 20 20 20 20 36 34  20 20 4e 6f 20 65 72 72  | 6    64  No err|
00000d40  6f 72 20 62 6f 78 20 3f  0d 04 10 1a f4 20 20 37  |or box ?.....  7|
00000d50  20 20 20 31 32 38 20 20  44 6f 6e 27 74 20 62 65  |   128  Don't be|
00000d60  65 70 0d 04 1a 3f dd a4  65 72 72 6f 72 62 6f 78  |ep...?..errorbox|
00000d70  28 74 69 74 6c 65 24 2c  6d 65 73 73 61 67 65 24  |(title$,message$|
00000d80  2c 62 75 74 74 6f 6e 25  29 3a 74 69 74 6c 65 24  |,button%):title$|
00000d90  3d a4 6d 73 67 74 65 78  74 28 74 69 74 6c 65 24  |=.msgtext(title$|
00000da0  29 0d 04 24 1f 6d 65 73  73 61 67 65 24 3d a4 6d  |)..$.message$=.m|
00000db0  73 67 74 65 78 74 28 6d  65 73 73 61 67 65 24 29  |sgtext(message$)|
00000dc0  0d 04 2e 34 24 28 6d 65  73 73 61 67 65 5f 62 75  |...4$(message_bu|
00000dd0  66 66 65 72 25 2b 34 29  3d 6d 65 73 73 61 67 65  |ffer%+4)=message|
00000de0  24 3a 21 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |$:!message_buffe|
00000df0  72 25 3d 30 0d 04 38 42  c8 99 20 22 57 69 6d 70  |r%=0..8B.. "Wimp|
00000e00  5f 52 65 70 6f 72 74 45  72 72 6f 72 22 2c 6d 65  |_ReportError",me|
00000e10  73 73 61 67 65 5f 62 75  66 66 65 72 25 2c 62 75  |ssage_buffer%,bu|
00000e20  74 74 6f 6e 25 2c 74 69  74 6c 65 24 20 b8 20 2c  |tton%,title$ . ,|
00000e30  72 65 70 6c 79 25 0d 04  42 0b 3d 72 65 70 6c 79  |reply%..B.=reply|
00000e40  25 0d 04 4c 05 3a 0d 04  56 37 f4 20 50 52 4f 43  |%..L.:..V7. PROC|
00000e50  73 68 6f 77 66 72 65 65  20 3a 20 64 69 73 70 6c  |showfree : displ|
00000e60  61 79 20 69 6e 20 69 6e  66 6f 62 6f 78 25 20 74  |ay in infobox% t|
00000e70  68 65 20 66 72 65 65 20  73 70 61 63 65 0d 04 60  |he free space..`|
00000e80  0e dd f2 73 68 6f 77 66  72 65 65 0d 04 6a 07 ea  |...showfree..j..|
00000e90  20 85 0d 04 74 40 ee 20  85 20 ea 3a e7 20 9f 3d  | ...t@. . .:. .=|
00000ea0  26 38 30 33 20 8c f2 73  65 74 69 63 6f 6e 74 65  |&803 ..seticonte|
00000eb0  78 74 28 69 6e 66 6f 62  6f 78 25 2c 34 2c 22 4f  |xt(infobox%,4,"O|
00000ec0  6c 64 20 74 65 6d 70 6c  61 74 65 22 29 3a e1 20  |ld template"):. |
00000ed0  8b e1 0d 04 7e 26 f2 73  65 74 69 63 6f 6e 74 65  |....~&.seticonte|
00000ee0  78 74 28 69 6e 66 6f 62  6f 78 25 2c 35 2c 22 50  |xt(infobox%,5,"P|
00000ef0  72 6f 67 72 61 6d 22 29  0d 04 88 42 f2 73 65 74  |rogram")...B.set|
00000f00  69 63 6f 6e 74 65 78 74  28 69 6e 66 6f 62 6f 78  |icontext(infobox|
00000f10  25 2c 31 2c c3 28 b8 50  2d 90 29 2b 22 20 62 79  |%,1,.(.P-.)+" by|
00000f20  74 65 73 2c 20 22 2b c3  28 28 b8 50 2d 90 29 81  |tes, "+.((.P-.).|
00000f30  26 34 30 30 29 2b 22 4b  22 29 0d 04 92 23 f2 73  |&400)+"K")...#.s|
00000f40  65 74 69 63 6f 6e 74 65  78 74 28 69 6e 66 6f 62  |eticontext(infob|
00000f50  6f 78 25 2c 36 2c 22 56  61 72 73 22 29 0d 04 9c  |ox%,6,"Vars")...|
00000f60  40 f2 73 65 74 69 63 6f  6e 74 65 78 74 28 69 6e  |@.seticontext(in|
00000f70  66 6f 62 6f 78 25 2c 32  2c c3 28 e0 2d 92 29 2b  |fobox%,2,.(.-.)+|
00000f80  22 20 62 79 74 65 73 2c  20 22 2b c3 28 28 e0 2d  |" bytes, "+.((.-|
00000f90  92 29 81 26 34 30 30 29  2b 22 4b 22 29 0d 04 a6  |.).&400)+"K")...|
00000fa0  23 f2 73 65 74 69 63 6f  6e 74 65 78 74 28 69 6e  |#.seticontext(in|
00000fb0  66 6f 62 6f 78 25 2c 37  2c 22 46 72 65 65 22 29  |fobox%,7,"Free")|
00000fc0  0d 04 b0 40 f2 73 65 74  69 63 6f 6e 74 65 78 74  |...@.seticontext|
00000fd0  28 69 6e 66 6f 62 6f 78  25 2c 33 2c c3 28 93 2d  |(infobox%,3,.(.-|
00000fe0  e0 29 2b 22 20 62 79 74  65 73 2c 20 22 2b c3 28  |.)+" bytes, "+.(|
00000ff0  28 93 2d e0 29 81 26 34  30 30 29 2b 22 4b 22 29  |(.-.).&400)+"K")|
00001000  0d 04 ba 21 f2 68 65 61  70 5f 66 72 65 65 28 68  |...!.heap_free(h|
00001010  65 61 70 73 69 7a 65 2c  68 65 61 70 66 72 65 65  |eapsize,heapfree|
00001020  29 0d 04 c4 23 f2 73 65  74 69 63 6f 6e 74 65 78  |)...#.seticontex|
00001030  74 28 69 6e 66 6f 62 6f  78 25 2c 38 2c 22 48 65  |t(infobox%,8,"He|
00001040  61 70 22 29 0d 04 ce 76  f2 73 65 74 69 63 6f 6e  |ap")...v.seticon|
00001050  74 65 78 74 28 69 6e 66  6f 62 6f 78 25 2c 34 2c  |text(infobox%,4,|
00001060  c3 28 68 65 61 70 73 69  7a 65 2d 68 65 61 70 66  |.(heapsize-heapf|
00001070  72 65 65 29 2b 22 20 62  79 74 65 73 2c 20 22 2b  |ree)+" bytes, "+|
00001080  c3 28 28 68 65 61 70 73  69 7a 65 2d 68 65 61 70  |.((heapsize-heap|
00001090  66 72 65 65 29 81 26 34  30 30 29 2b 22 4b 20 6f  |free).&400)+"K o|
000010a0  66 20 22 2b c3 28 68 65  61 70 73 69 7a 65 20 81  |f "+.(heapsize .|
000010b0  26 34 30 30 29 2b 22 4b  22 29 0d 04 d8 05 e1 0d  |&400)+"K")......|
000010c0  04 e2 05 3a 0d 04 ec 37  f4 20 2a 2a 2a 2a 2a 2a  |...:...7. ******|
000010d0  2a 2a 20 4d 65 6e 75 20  6d 61 6e 69 70 75 6c 61  |** Menu manipula|
000010e0  74 69 6f 6e 20 70 72 6f  63 65 64 75 72 65 73 20  |tion procedures |
000010f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 0d 04 f6 05 3a  |***********....:|
00001100  0d 05 00 39 f4 20 46 4e  63 72 65 61 74 65 6d 65  |...9. FNcreateme|
00001110  6e 75 20 3a 20 43 72 65  61 74 65 20 61 20 6d 65  |nu : Create a me|
00001120  6e 75 20 67 69 76 65 6e  20 61 20 63 6f 6e 74 72  |nu given a contr|
00001130  6f 6c 20 73 74 72 69 6e  67 0d 05 0a 13 f4 20 4d  |ol string..... M|
00001140  65 6e 75 20 46 6f 72 6d  61 74 20 3a 0d 05 14 1a  |enu Format :....|
00001150  f4 20 54 69 74 6c 65 7c  49 74 65 6d 7c 49 74 65  |. Title|Item|Ite|
00001160  6d 7c 49 74 65 6d 0d 05  1e 18 f4 20 49 74 65 6d  |m|Item..... Item|
00001170  20 63 6f 6e 73 69 73 74  73 20 6f 66 20 3a 0d 05  | consists of :..|
00001180  28 1a f4 20 45 6e 74 72  79 20 6f 72 20 45 6e 74  |(.. Entry or Ent|
00001190  72 79 5d 46 6c 61 67 73  0d 05 32 2a f4 20 46 6c  |ry]Flags..2*. Fl|
000011a0  61 67 73 20 63 61 6e 20  62 65 20 3a 20 28 73 65  |ags can be : (se|
000011b0  70 61 72 61 74 65 64 20  62 79 20 63 6f 6d 6d 61  |parated by comma|
000011c0  73 29 0d 05 3c 13 f4 20  20 54 20 66 6f 72 20 74  |s)..<..  T for t|
000011d0  69 63 6b 65 64 0d 05 46  1e f4 20 20 44 20 66 6f  |icked..F..  D fo|
000011e0  72 20 64 6f 74 74 65 64  20 75 6e 64 65 72 6e 65  |r dotted underne|
000011f0  61 74 68 0d 05 50 15 f4  20 20 57 20 66 6f 72 20  |ath..P..  W for |
00001200  77 72 69 74 61 62 6c 65  0d 05 5a 13 f4 20 20 53  |writable..Z..  S|
00001210  20 66 6f 72 20 73 68 61  64 65 64 0d 05 64 2b f4  | for shaded..d+.|
00001220  20 20 4b 20 66 6f 72 20  6b 65 79 20 73 68 6f 72  |  K for key shor|
00001230  74 63 75 74 20 28 5e 3d  63 74 72 6c 2c 20 a4 3d  |tcut (^=ctrl, .=|
00001240  73 68 69 66 74 29 0d 05  6e 3c f4 20 20 3e 20 66  |shift)..n<.  > f|
00001250  6f 6c 6c 6f 77 65 64 20  62 79 20 76 61 72 69 61  |ollowed by varia|
00001260  62 6c 65 20 66 6f 72 20  73 75 62 2d 6d 65 6e 75  |ble for sub-menu|
00001270  20 28 49 74 65 6d 5d 3e  73 75 62 6d 65 6e 75 25  | (Item]>submenu%|
00001280  7c 29 0d 05 78 32 f4 20  20 7d 20 66 6f 6c 6c 6f  ||)..x2.  } follo|
00001290  77 65 64 20 62 79 20 61  20 73 70 72 69 74 65 20  |wed by a sprite |
000012a0  6e 61 6d 65 20 28 49 74  65 6d 5d 7d 73 70 72 69  |name (Item]}spri|
000012b0  74 65 7c 29 0d 05 82 43  f4 20 4e 42 3a 54 68 65  |te|)...C. NB:The|
000012c0  20 6c 61 73 74 20 74 77  6f 20 66 6c 61 67 73 20  | last two flags |
000012d0  63 61 6e 20 62 65 20 75  73 65 64 20 74 6f 67 65  |can be used toge|
000012e0  74 68 65 72 20 69 66 20  63 6f 6d 6d 61 20 73 65  |ther if comma se|
000012f0  70 65 72 61 74 65 64 0d  05 8c 20 f4 20 20 20 20  |perated... .    |
00001300  65 67 2e 20 49 6e 66 6f  5d 3e 69 6e 66 6f 25 2c  |eg. Info]>info%,|
00001310  7d 21 48 65 6c 70 7c 0d  05 96 41 f4 20 4e 42 3a  |}!Help|...A. NB:|
00001320  49 66 20 74 68 65 20 73  70 72 69 74 65 6e 61 6d  |If the spritenam|
00001330  65 20 73 74 61 72 74 73  20 77 69 74 68 20 73 6d  |e starts with sm|
00001340  20 74 68 65 6e 20 74 68  65 20 73 70 72 69 74 65  | then the sprite|
00001350  20 77 69 6c 6c 20 62 65  0d 05 a0 3d f4 20 20 20  | will be...=.   |
00001360  20 64 69 73 70 6c 61 79  65 64 20 75 73 69 6e 67  | displayed using|
00001370  20 69 74 73 20 73 6d 61  6c 6c 20 66 6f 72 6d 2c  | its small form,|
00001380  20 6f 74 68 65 72 77 69  73 65 20 69 74 20 77 69  | otherwise it wi|
00001390  6c 6c 20 62 65 0d 05 aa  1d f4 20 20 20 20 73 68  |ll be.....    sh|
000013a0  72 75 6e 6b 20 74 6f 20  68 61 6c 66 20 73 69 7a  |runk to half siz|
000013b0  65 2e 0d 05 b4 14 dd a4  63 72 65 61 74 65 6d 65  |e.......createme|
000013c0  6e 75 28 41 24 29 0d 05  be 35 ea 20 70 6f 69 6e  |nu(A$)...5. poin|
000013d0  74 65 72 2c 70 32 2c 70  33 2c 6c 2c 6c 6b 2c 4f  |ter,p2,p3,l,lk,O|
000013e0  24 2c 43 24 2c 6f 69 6e  64 25 2c 6f 69 6e 64 6c  |$,C$,oind%,oindl|
000013f0  25 2c 6b 73 25 2c 6b 24  2c 53 24 0d 05 c8 21 6f  |%,ks%,k$,S$...!o|
00001400  69 6e 64 25 3d 69 6e 64  25 3a 6f 69 6e 64 6c 25  |ind%=ind%:oindl%|
00001410  3d 69 6e 64 6c 25 3a 6b  73 25 3d a3 0d 05 d2 1d  |=indl%:ks%=.....|
00001420  70 6f 69 6e 74 65 72 3d  6d 65 6e 75 25 3a 6c 3d  |pointer=menu%:l=|
00001430  30 3a 41 24 2b 3d 22 7c  22 0d 05 dc 1b f2 6d 65  |0:A$+="|".....me|
00001440  6e 75 70 75 74 73 28 a4  6d 67 65 74 28 41 24 2c  |nuputs(.mget(A$,|
00001450  43 24 29 29 0d 05 e6 15  f2 6d 65 6e 75 70 75 74  |C$)).....menuput|
00001460  77 28 26 37 30 32 30 37  29 0d 05 f0 1b 70 32 3d  |w(&70207)....p2=|
00001470  6d 65 6e 75 25 3a f2 6d  65 6e 75 70 75 74 77 28  |menu%:.menuputw(|
00001480  26 38 30 29 0d 05 fa 12  f2 6d 65 6e 75 70 75 74  |&80).....menuput|
00001490  77 28 26 32 43 29 0d 06  04 26 f2 6d 65 6e 75 70  |w(&2C)...&.menup|
000014a0  75 74 77 28 30 29 3a 6f  70 74 69 6f 6e 73 25 3d  |utw(0):options%=|
000014b0  30 3a 53 24 3d 41 24 3a  6c 6b 3d 30 0d 06 0e 05  |0:S$=A$:lk=0....|
000014c0  f5 0d 06 18 15 20 e7 20  6b 73 25 3d b9 20 8c 6b  |..... . ks%=. .k|
000014d0  73 25 3d b9 2a 32 0d 06  22 06 20 f5 0d 06 2c 29  |s%=.*2..". ...,)|
000014e0  20 20 4f 24 3d a4 6d 67  65 74 28 41 24 2c 43 24  |  O$=.mget(A$,C$|
000014f0  29 3a 6f 70 74 69 6f 6e  73 25 3d 6f 70 74 69 6f  |):options%=optio|
00001500  6e 73 25 2b 31 0d 06 36  31 20 20 66 6c 61 67 73  |ns%+1..61  flags|
00001510  3d a4 6d 64 65 63 6f 64  65 28 43 24 2c 70 33 2c  |=.mdecode(C$,p3,|
00001520  73 24 2c 6b 24 29 2b 28  28 2d 28 41 24 3d 22 22  |s$,k$)+((-(A$=""|
00001530  29 29 3c 3c 37 29 0d 06  40 1a 20 20 e7 20 6b 73  |))<<7)..@.  . ks|
00001540  25 3d b9 2a 32 20 80 20  6b 24 3c 3e 22 22 20 8c  |%=.*2 . k$<>"" .|
00001550  0d 06 4a 25 20 20 20 4f  24 2b 3d c4 6c 2b 6c 6b  |..J%   O$+=.l+lk|
00001560  2d 28 a9 28 4f 24 29 2b  a9 28 6b 24 29 29 2b 31  |-(.(O$)+.(k$))+1|
00001570  2c 22 20 22 29 0d 06 54  24 20 20 20 e7 20 c0 6b  |," ")..T$   . .k|
00001580  24 2c 31 29 3d 22 a4 22  20 8c c1 6b 24 2c 31 2c  |$,1)="." ..k$,1,|
00001590  31 29 3d bd 28 31 33 39  29 0d 06 5e 0d 20 20 20  |1)=.(139)..^.   |
000015a0  4f 24 2b 3d 6b 24 0d 06  68 07 20 20 cc 0d 06 72  |O$+=k$..h.  ...r|
000015b0  2b 20 20 20 e7 20 6b 24  3c 3e 22 22 20 8c 6b 73  |+   . k$<>"" .ks|
000015c0  25 3d b9 3a e7 20 6c 6b  3c a9 28 6b 24 29 20 8c  |%=.:. lk<.(k$) .|
000015d0  6c 6b 3d a9 28 6b 24 29  0d 06 7c 07 20 20 cd 0d  |lk=.(k$)..|.  ..|
000015e0  06 86 3d 20 20 66 6c 61  67 73 32 3d 26 37 30 30  |..=  flags2=&700|
000015f0  30 30 32 31 2b 28 28 2d  28 a9 28 4f 24 29 3e 31  |0021+((-(.(O$)>1|
00001600  31 29 29 3c 3c 38 29 2b  28 31 3c 3c 31 34 29 2a  |1))<<8)+(1<<14)*|
00001610  28 66 6c 61 67 73 20 80  32 35 36 29 0d 06 90 2b  |(flags .256)...+|
00001620  20 20 e7 20 28 66 6c 61  67 73 20 80 20 34 29 3c  |  . (flags . 4)<|
00001630  3e 30 20 8c 66 6c 61 67  73 32 3d 66 6c 61 67 73  |>0 .flags2=flags|
00001640  32 20 84 20 32 35 36 0d  06 9a 1c 20 20 f2 6d 65  |2 . 256....  .me|
00001650  6e 75 70 75 74 77 28 66  6c 61 67 73 20 80 20 32  |nuputw(flags . 2|
00001660  35 35 29 0d 06 a4 13 20  20 f2 6d 65 6e 75 70 75  |55)....  .menupu|
00001670  74 77 28 70 33 29 0d 06  ae 22 20 20 e7 a9 28 4f  |tw(p3)..."  ..(O|
00001680  24 29 3e 6c 20 80 20 6b  73 25 3c 3e b9 2a 32 20  |$)>l . ks%<>.*2 |
00001690  8c 6c 3d a9 28 4f 24 29  0d 06 b8 17 20 20 f2 6d  |.l=.(O$)....  .m|
000016a0  65 6e 75 70 75 74 77 28  66 6c 61 67 73 32 29 0d  |enuputw(flags2).|
000016b0  06 c2 24 20 20 f2 6d 65  6e 75 73 74 72 69 6e 67  |..$  .menustring|
000016c0  28 4f 24 2c 73 24 2c 28  66 6c 61 67 73 20 80 20  |(O$,s$,(flags . |
000016d0  34 29 29 0d 06 cc 0b 20  fd 41 24 3d 22 22 0d 06  |4)).... .A$=""..|
000016e0  d6 69 20 e7 20 6b 73 25  3d b9 2a 32 20 8c 6c 2b  |.i . ks%=.*2 .l+|
000016f0  3d 6c 6b 2b 31 20 8b e7  6b 73 25 3d b9 20 8c 69  |=lk+1 ..ks%=. .i|
00001700  6e 64 25 3d 6f 69 6e 64  25 3a 69 6e 64 6c 25 3d  |nd%=oind%:indl%=|
00001710  6f 69 6e 64 6c 25 3a 6d  65 6e 75 6c 25 2b 3d 6d  |oindl%:menul%+=m|
00001720  65 6e 75 25 2d 70 32 2d  31 32 3a 6d 65 6e 75 25  |enu%-p2-12:menu%|
00001730  3d 70 32 2b 31 32 3a 6f  70 74 69 6f 6e 73 25 3d  |=p2+12:options%=|
00001740  30 3a 41 24 3d 53 24 0d  06 e0 0c fd 20 6b 73 25  |0:A$=S$..... ks%|
00001750  3c 3e b9 0d 06 ea 0f 21  70 32 3d 6c 2a 31 36 2b  |<>.....!p2=l*16+|
00001760  31 36 0d 06 f4 0c 3d 70  6f 69 6e 74 65 72 0d 06  |16....=pointer..|
00001770  fe 37 dd f2 6d 65 6e 75  73 74 72 69 6e 67 28 54  |.7..menustring(T|
00001780  24 2c 73 24 2c 66 6c 61  67 29 3a e7 20 c0 54 24  |$,s$,flag):. .T$|
00001790  2c 31 29 3d 22 a4 22 20  8c 54 24 3d a0 28 c1 54  |,1)="." .T$=.(.T|
000017a0  24 2c 32 29 29 0d 07 08  1f e7 a9 28 54 24 29 3c  |$,2))......(T$)<|
000017b0  31 32 20 80 20 73 24 3d  22 22 20 80 20 66 6c 61  |12 . s$="" . fla|
000017c0  67 3d 30 8c 0d 07 12 12  20 f2 6d 65 6e 75 70 75  |g=0..... .menupu|
000017d0  74 73 28 54 24 29 0d 07  1c 05 cc 0d 07 26 1d 20  |ts(T$).......&. |
000017e0  f2 6d 65 6e 75 70 75 74  77 28 a4 69 6e 64 69 72  |.menuputw(.indir|
000017f0  65 63 74 28 54 24 29 29  0d 07 30 0f 20 e7 20 73  |ect(T$))..0. . s|
00001800  24 3c 3e 22 22 20 8c 0d  07 3a 1e 20 20 6d 65 6e  |$<>"" ...:.  men|
00001810  75 25 21 2d 38 3d 6d 65  6e 75 25 21 2d 38 20 84  |u%!-8=menu%!-8 .|
00001820  20 26 38 30 33 0d 07 44  34 20 20 e7 c0 a4 6c 6f  | &803..D4  ...lo|
00001830  77 65 72 28 73 24 29 2c  32 29 3d 22 73 6d 22 20  |wer(s$),2)="sm" |
00001840  8c 6d 65 6e 75 25 21 2d  38 3d 6d 65 6e 75 25 21  |.menu%!-8=menu%!|
00001850  2d 38 20 82 20 26 38 30  30 0d 07 4e 22 20 20 f2  |-8 . &800..N"  .|
00001860  6d 65 6e 75 70 75 74 77  28 a4 69 6e 64 69 72 65  |menuputw(.indire|
00001870  63 74 28 22 53 22 2b 73  24 29 29 0d 07 58 06 20  |ct("S"+s$))..X. |
00001880  cc 0d 07 62 13 20 20 f2  6d 65 6e 75 70 75 74 77  |...b.  .menuputw|
00001890  28 2d 31 29 0d 07 6c 06  20 cd 0d 07 76 17 20 f2  |(-1)..l. ...v. .|
000018a0  6d 65 6e 75 70 75 74 77  28 a9 28 54 24 29 2b 31  |menuputw(.(T$)+1|
000018b0  29 0d 07 80 05 cd 0d 07  8a 05 e1 0d 07 94 15 dd  |)...............|
000018c0  a4 6d 67 65 74 28 f8 20  41 24 2c f8 20 43 24 29  |.mget(. A$,. C$)|
000018d0  0d 07 9e 1b ea 20 42 24  3a 42 24 3d c0 41 24 2c  |..... B$:B$=.A$,|
000018e0  a7 41 24 2c 22 7c 22 29  2d 31 29 0d 07 a8 27 41  |.A$,"|")-1)...'A|
000018f0  24 3d c1 41 24 2c a9 28  42 24 29 2b 32 29 3a e7  |$=.A$,.(B$)+2):.|
00001900  a7 42 24 2c 22 5d 22 29  3c 31 8c 42 24 2b 3d 22  |.B$,"]")<1.B$+="|
00001910  5d 22 0d 07 b2 29 43 24  3d c1 42 24 2c a7 42 24  |]"...)C$=.B$,.B$|
00001920  2c 22 5d 22 29 2b 31 29  3a 42 24 3d c0 42 24 2c  |,"]")+1):B$=.B$,|
00001930  a7 42 24 2c 22 5d 22 29  2d 31 29 0d 07 bc 11 3d  |.B$,"]")-1)....=|
00001940  a4 6d 73 67 74 65 78 74  28 42 24 29 0d 07 c6 3a  |.msgtext(B$)...:|
00001950  dd f2 6d 65 6e 75 70 75  74 73 28 54 24 29 3a e7  |..menuputs(T$):.|
00001960  a9 28 54 24 29 3e 31 31  20 8c 85 20 26 38 30 33  |.(T$)>11 .. &803|
00001970  2c 22 4d 65 6e 75 20 65  6e 74 72 79 20 74 6f 6f  |,"Menu entry too|
00001980  20 6c 6f 6e 67 22 0d 07  d0 22 24 6d 65 6e 75 25  | long"..."$menu%|
00001990  3d 54 24 3a 6d 65 6e 75  25 2b 3d 31 32 3a 6d 65  |=T$:menu%+=12:me|
000019a0  6e 75 6c 25 2d 3d 31 32  0d 07 da 34 e7 6d 65 6e  |nul%-=12...4.men|
000019b0  75 6c 25 3c 3d 34 20 8c  85 20 26 38 30 33 2c 22  |ul%<=4 .. &803,"|
000019c0  4e 6f 74 20 65 6e 6f 75  67 68 20 6d 65 6d 6f 72  |Not enough memor|
000019d0  79 20 66 6f 72 20 6d 65  6e 75 73 22 0d 07 e4 05  |y for menus"....|
000019e0  e1 0d 07 ee 12 dd f2 6d  65 6e 75 70 75 74 77 28  |.......menuputw(|
000019f0  57 25 29 0d 07 f8 20 21  6d 65 6e 75 25 3d 57 25  |W%)... !menu%=W%|
00001a00  3a 6d 65 6e 75 25 2b 3d  34 3a 6d 65 6e 75 6c 25  |:menu%+=4:menul%|
00001a10  2d 3d 34 0d 08 02 34 e7  6d 65 6e 75 6c 25 3c 3d  |-=4...4.menul%<=|
00001a20  34 20 8c 85 20 26 38 30  33 2c 22 4e 6f 74 20 65  |4 .. &803,"Not e|
00001a30  6e 6f 75 67 68 20 6d 65  6d 6f 72 79 20 66 6f 72  |nough memory for|
00001a40  20 6d 65 6e 75 73 22 0d  08 0c 05 e1 0d 08 16 1f  | menus".........|
00001a50  dd a4 6d 64 65 63 6f 64  65 28 41 24 2c f8 20 70  |..mdecode(A$,. p|
00001a60  2c f8 20 73 24 2c f8 20  6b 24 29 0d 08 20 28 ea  |,. s$,. k$).. (.|
00001a70  20 42 24 2c 43 24 2c 56  3a 70 3d 2d 31 3a 73 24  | B$,C$,V:p=-1:s$|
00001a80  3d 22 22 3a 6b 24 3d 22  22 3a 41 24 3d 41 24 2b  |="":k$="":A$=A$+|
00001a90  22 2c 22 0d 08 2a 0d c8  95 20 41 24 3c 3e 22 22  |","..*... A$<>""|
00001aa0  0d 08 34 18 20 42 24 3d  c0 41 24 2c 31 29 3a 41  |..4. B$=.A$,1):A|
00001ab0  24 3d c1 41 24 2c 32 29  0d 08 3e 0c 20 c8 8e 20  |$=.A$,2)..>. .. |
00001ac0  42 24 20 ca 0d 08 48 13  20 20 c9 20 22 54 22 3a  |B$ ...H.  . "T":|
00001ad0  56 3d 56 20 84 20 31 0d  08 52 13 20 20 c9 20 22  |V=V . 1..R.  . "|
00001ae0  44 22 3a 56 3d 56 20 84  20 32 0d 08 5c 13 20 20  |D":V=V . 2..\.  |
00001af0  c9 20 22 57 22 3a 56 3d  56 20 84 20 34 0d 08 66  |. "W":V=V . 4..f|
00001b00  13 20 20 c9 20 22 4d 22  3a 56 3d 56 20 84 20 38  |.  . "M":V=V . 8|
00001b10  0d 08 70 15 20 20 c9 20  22 53 22 3a 56 3d 56 20  |..p.  . "S":V=V |
00001b20  84 20 32 35 36 0d 08 7a  31 20 20 c9 20 22 4b 22  |. 256..z1  . "K"|
00001b30  3a 6b 24 3d c0 41 24 2c  a7 41 24 2c 22 2c 22 29  |:k$=.A$,.A$,",")|
00001b40  2d 31 29 3a 41 24 3d c1  41 24 2c a7 41 24 2c 22  |-1):A$=.A$,.A$,"|
00001b50  2c 22 29 2b 31 29 0d 08  84 33 20 20 c9 20 22 3e  |,")+1)...3  . ">|
00001b60  22 3a 70 3d a0 28 c0 41  24 2c a7 41 24 2c 22 2c  |":p=.(.A$,.A$,",|
00001b70  22 29 2d 31 29 29 3a 41  24 3d c1 41 24 2c a7 41  |")-1)):A$=.A$,.A|
00001b80  24 2c 22 2c 22 29 2b 31  29 0d 08 8e 35 20 20 c9  |$,",")+1)...5  .|
00001b90  20 22 7d 22 3a 73 24 3d  c0 41 24 2c a7 41 24 2c  | "}":s$=.A$,.A$,|
00001ba0  22 2c 22 29 2d 31 29 2b  22 20 22 3a 41 24 3d c1  |",")-1)+" ":A$=.|
00001bb0  41 24 2c a7 41 24 2c 22  2c 22 29 2b 31 29 0d 08  |A$,.A$,",")+1)..|
00001bc0  98 06 20 cb 0d 08 a2 05  ce 0d 08 ac 06 3d 56 0d  |.. ..........=V.|
00001bd0  08 b6 05 3a 0d 08 c0 42  f4 20 46 4e 69 6e 64 69  |...:...B. FNindi|
00001be0  72 65 63 74 20 3a 20 50  6c 61 63 65 20 61 20 73  |rect : Place a s|
00001bf0  74 72 69 6e 67 20 69 6e  20 69 6e 64 69 72 65 63  |tring in indirec|
00001c00  74 69 6f 6e 20 62 75 66  66 65 72 20 28 72 65 74  |tion buffer (ret|
00001c10  2e 20 6c 6f 63 29 0d 08  ca 1d dd a4 69 6e 64 69  |. loc)......indi|
00001c20  72 65 63 74 28 61 24 29  3a ea 20 69 3a 69 3d 69  |rect(a$):. i:i=i|
00001c30  6e 64 25 0d 08 d4 3c e7  a9 28 61 24 29 3e 69 6e  |nd%...<..(a$)>in|
00001c40  64 6c 25 2d 31 20 8c 85  20 26 38 30 33 2c 22 4e  |dl%-1 .. &803,"N|
00001c50  6f 74 20 65 6e 6f 75 67  68 20 72 6f 6f 6d 20 66  |ot enough room f|
00001c60  6f 72 20 69 6e 64 69 72  65 63 74 69 6f 6e 22 0d  |or indirection".|
00001c70  08 de 29 24 69 6e 64 25  3d 61 24 3a 69 6e 64 25  |..)$ind%=a$:ind%|
00001c80  2b 3d a9 28 61 24 29 2b  31 3a 69 6e 64 6c 25 2d  |+=.(a$)+1:indl%-|
00001c90  3d a9 28 61 24 29 2b 31  0d 08 e8 06 3d 69 0d 08  |=.(a$)+1....=i..|
00001ca0  f2 05 3a 0d 08 fc 3c f4  20 50 52 4f 43 69 62 6d  |..:...<. PROCibm|
00001cb0  65 6e 75 20 20 20 20 20  20 20 3a 20 43 72 65 61  |enu       : Crea|
00001cc0  74 65 20 61 6e 20 69 63  6f 6e 62 61 72 20 6d 65  |te an iconbar me|
00001cd0  6e 75 20 66 72 6f 6d 20  69 62 6d 65 6e 75 25 0d  |nu from ibmenu%.|
00001ce0  09 06 44 f4 20 50 52 4f  43 6d 65 6e 75 20 20 20  |..D. PROCmenu   |
00001cf0  20 20 20 20 20 20 3a 20  43 72 65 61 74 65 20 74  |      : Create t|
00001d00  68 65 20 6d 65 6e 75 20  61 74 20 63 6f 2d 6f 72  |he menu at co-or|
00001d10  64 73 20 6f 72 20 6d 6f  75 73 65 20 69 66 20 78  |ds or mouse if x|
00001d20  3d 2d 31 0d 09 10 34 f4  20 50 52 4f 43 72 65 63  |=-1...4. PROCrec|
00001d30  72 65 61 74 65 6d 65 6e  75 20 3a 20 52 65 63 72  |reatemenu : Recr|
00001d40  65 61 74 65 20 74 68 65  20 6d 65 6e 75 20 6a 75  |eate the menu ju|
00001d50  73 74 20 75 73 65 64 0d  09 1a 0c dd f2 69 62 6d  |st used......ibm|
00001d60  65 6e 75 0d 09 24 5b c8  99 20 22 57 69 6d 70 5f  |enu..$[.. "Wimp_|
00001d70  47 65 74 50 6f 69 6e 74  65 72 49 6e 66 6f 22 2c  |GetPointerInfo",|
00001d80  2c 62 25 3a 63 75 72 6d  65 6e 75 25 3d 69 62 6d  |,b%:curmenu%=ibm|
00001d90  65 6e 75 25 3a 63 6d 65  6e 75 78 25 3d 62 25 21  |enu%:cmenux%=b%!|
00001da0  30 2d 36 34 3a 63 6d 65  6e 75 79 25 3d 39 36 2b  |0-64:cmenuy%=96+|
00001db0  26 32 43 2a 69 62 6f 70  74 69 6f 6e 73 25 0d 09  |&2C*iboptions%..|
00001dc0  2e 3b c8 99 20 22 57 69  6d 70 5f 43 72 65 61 74  |.;.. "Wimp_Creat|
00001dd0  65 4d 65 6e 75 22 2c 2c  69 62 6d 65 6e 75 25 2c  |eMenu",,ibmenu%,|
00001de0  62 25 21 30 2d 36 34 2c  39 36 2b 26 32 43 2a 69  |b%!0-64,96+&2C*i|
00001df0  62 6f 70 74 69 6f 6e 73  25 0d 09 38 05 e1 0d 09  |boptions%..8....|
00001e00  42 15 dd f2 6d 65 6e 75  28 6d 65 6e 75 25 2c 78  |B...menu(menu%,x|
00001e10  2c 79 29 0d 09 4c 0c e7  20 78 3d 2d 31 20 8c 0d  |,y)..L.. x=-1 ..|
00001e20  09 56 2f 20 c8 99 20 22  57 69 6d 70 5f 47 65 74  |.V/ .. "Wimp_Get|
00001e30  50 6f 69 6e 74 65 72 49  6e 66 6f 22 2c 2c 62 25  |PointerInfo",,b%|
00001e40  3a 78 3d 62 25 21 30 3a  79 3d 62 25 21 34 0d 09  |:x=b%!0:y=b%!4..|
00001e50  60 05 cd 0d 09 6a 2c 63  75 72 6d 65 6e 75 25 3d  |`....j,curmenu%=|
00001e60  6d 65 6e 75 25 3a 63 6d  65 6e 75 78 25 3d 78 2d  |menu%:cmenux%=x-|
00001e70  36 34 3a 63 6d 65 6e 75  79 25 3d 79 2b 32 30 0d  |64:cmenuy%=y+20.|
00001e80  09 74 29 c8 99 20 22 57  69 6d 70 5f 43 72 65 61  |.t).. "Wimp_Crea|
00001e90  74 65 4d 65 6e 75 22 2c  2c 6d 65 6e 75 25 2c 78  |teMenu",,menu%,x|
00001ea0  2d 36 34 2c 79 2b 32 30  0d 09 7e 05 e1 0d 09 88  |-64,y+20..~.....|
00001eb0  12 dd f2 72 65 63 72 65  61 74 65 6d 65 6e 75 0d  |...recreatemenu.|
00001ec0  09 92 32 c8 99 20 22 57  69 6d 70 5f 43 72 65 61  |..2.. "Wimp_Crea|
00001ed0  74 65 4d 65 6e 75 22 2c  2c 63 75 72 6d 65 6e 75  |teMenu",,curmenu|
00001ee0  25 2c 63 6d 65 6e 75 78  25 2c 63 6d 65 6e 75 79  |%,cmenux%,cmenuy|
00001ef0  25 0d 09 9c 05 e1 0d 09  a6 05 3a 0d 09 b0 2f f4  |%.........:.../.|
00001f00  20 50 52 4f 43 6d 65 6e  75 75 6e 74 69 63 6b 3a  | PROCmenuuntick:|
00001f10  20 55 6e 74 69 63 6b 20  61 20 67 72 6f 75 70 20  | Untick a group |
00001f20  6f 66 20 6f 70 74 69 6f  6e 73 0d 09 ba 30 f4 20  |of options...0. |
00001f30  50 52 4f 43 6d 65 6e 75  74 69 63 6b 20 20 3a 20  |PROCmenutick  : |
00001f40  54 69 63 6b 2f 75 6e 74  69 63 6b 20 6f 70 74 69  |Tick/untick opti|
00001f50  6f 6e 20 6f 6e 20 6d 65  6e 75 0d 09 c4 32 f4 20  |on on menu...2. |
00001f60  50 52 4f 43 6d 65 6e 75  73 68 61 64 65 20 3a 20  |PROCmenushade : |
00001f70  53 68 61 64 65 2f 75 6e  73 68 61 64 65 20 6f 70  |Shade/unshade op|
00001f80  74 69 6f 6e 20 6f 6e 20  6d 65 6e 75 0d 09 ce 38  |tion on menu...8|
00001f90  f4 20 46 4e 6d 65 6e 75  74 69 63 6b 65 64 20 20  |. FNmenuticked  |
00001fa0  3a 20 52 65 74 75 72 6e  20 54 52 55 45 20 69 66  |: Return TRUE if|
00001fb0  20 6d 65 6e 75 20 69 74  65 6d 20 69 73 20 74 69  | menu item is ti|
00001fc0  63 6b 65 64 0d 09 d8 38  f4 20 46 4e 6d 65 6e 75  |cked...8. FNmenu|
00001fd0  73 68 61 64 65 64 20 20  3a 20 52 65 74 75 72 6e  |shaded  : Return|
00001fe0  20 54 52 55 45 20 69 66  20 6d 65 6e 75 20 69 74  | TRUE if menu it|
00001ff0  65 6d 20 69 73 20 73 68  61 64 65 64 0d 09 e2 19  |em is shaded....|
00002000  f4 20 74 79 70 65 20 3d  20 30 20 66 6f 72 20 75  |. type = 0 for u|
00002010  6e 74 69 63 6b 0d 09 ec  21 f4 20 74 79 70 65 20  |ntick...!. type |
00002020  3d 20 31 20 66 6f 72 20  74 69 63 6b 20 28 61 6c  |= 1 for tick (al|
00002030  73 6f 20 2d 31 29 0d 09  f6 19 f4 20 74 79 70 65  |so -1)..... type|
00002040  20 3d 20 32 20 66 6f 72  20 74 6f 67 67 6c 65 0d  | = 2 for toggle.|
00002050  0a 00 20 dd f2 6d 65 6e  75 75 6e 74 69 63 6b 28  |.. ..menuuntick(|
00002060  6d 65 6e 75 2c 73 74 61  72 74 2c 65 6e 64 29 0d  |menu,start,end).|
00002070  0a 0a 15 6d 65 6e 75 2b  3d 73 74 61 72 74 2a 32  |...menu+=start*2|
00002080  34 2b 32 38 0d 0a 14 05  f5 0d 0a 1e 27 20 21 6d  |4+28........' !m|
00002090  65 6e 75 3d 21 6d 65 6e  75 20 80 20 2d 32 3a 73  |enu=!menu . -2:s|
000020a0  74 61 72 74 2b 3d 31 3a  6d 65 6e 75 2b 3d 32 34  |tart+=1:menu+=24|
000020b0  0d 0a 28 34 fd 20 28 65  6e 64 3c 3e 2d 31 20 80  |..(4. (end<>-1 .|
000020c0  20 73 74 61 72 74 3e 65  6e 64 29 20 84 20 28 28  | start>end) . ((|
000020d0  6d 65 6e 75 21 2d 32 34  29 20 80 20 26 38 30 29  |menu!-24) . &80)|
000020e0  3d 26 38 30 0d 0a 32 05  e1 0d 0a 3c 35 dd f2 6d  |=&80..2....<5..m|
000020f0  65 6e 75 74 69 63 6b 28  6d 65 6e 75 2c 6f 70 74  |enutick(menu,opt|
00002100  69 6f 6e 2c 74 6f 67 67  6c 65 29 3a 6d 65 6e 75  |ion,toggle):menu|
00002110  2b 3d 6f 70 74 69 6f 6e  2a 32 34 2b 32 38 0d 0a  |+=option*24+28..|
00002120  46 0f c8 8e 20 74 6f 67  67 6c 65 20 ca 0d 0a 50  |F... toggle ...P|
00002130  19 20 c9 20 30 3a 21 6d  65 6e 75 3d 21 6d 65 6e  |. . 0:!menu=!men|
00002140  75 20 80 20 2d 32 0d 0a  5a 1b 20 c9 20 2d 31 2c  |u . -2..Z. . -1,|
00002150  31 3a 21 6d 65 6e 75 3d  21 6d 65 6e 75 20 84 20  |1:!menu=!menu . |
00002160  31 0d 0a 64 18 20 c9 20  32 3a 21 6d 65 6e 75 3d  |1..d. . 2:!menu=|
00002170  21 6d 65 6e 75 20 82 20  31 0d 0a 6e 05 cb 0d 0a  |!menu . 1..n....|
00002180  78 05 e1 0d 0a 82 36 dd  f2 6d 65 6e 75 73 68 61  |x.....6..menusha|
00002190  64 65 28 6d 65 6e 75 2c  6f 70 74 69 6f 6e 2c 74  |de(menu,option,t|
000021a0  6f 67 67 6c 65 29 3a 6d  65 6e 75 2b 3d 6f 70 74  |oggle):menu+=opt|
000021b0  69 6f 6e 2a 32 34 2b 33  36 0d 0a 8c 0f c8 8e 20  |ion*24+36...... |
000021c0  74 6f 67 67 6c 65 20 ca  0d 0a 96 1f 20 c9 20 30  |toggle ..... . 0|
000021d0  3a 21 6d 65 6e 75 3d 21  6d 65 6e 75 20 80 20 ac  |:!menu=!menu . .|
000021e0  28 31 3c 3c 32 32 29 0d  0a a0 21 20 c9 20 2d 31  |(1<<22)...! . -1|
000021f0  2c 31 3a 21 6d 65 6e 75  3d 21 6d 65 6e 75 20 84  |,1:!menu=!menu .|
00002200  20 28 31 3c 3c 32 32 29  0d 0a aa 1e 20 c9 20 32  | (1<<22).... . 2|
00002210  3a 21 6d 65 6e 75 3d 21  6d 65 6e 75 20 82 20 28  |:!menu=!menu . (|
00002220  31 3c 3c 32 32 29 0d 0a  b4 05 cb 0d 0a be 05 e1  |1<<22)..........|
00002230  0d 0a c8 1d dd a4 6d 65  6e 75 74 69 63 6b 65 64  |......menuticked|
00002240  28 6d 65 6e 75 25 2c 69  74 65 6d 25 29 0d 0a d2  |(menu%,item%)...|
00002250  22 3d 28 28 6d 65 6e 75  25 21 28 32 38 2b 32 34  |"=((menu%!(28+24|
00002260  2a 69 74 65 6d 25 29 29  20 80 20 31 29 3d 31 0d  |*item%)) . 1)=1.|
00002270  0a dc 1d dd a4 6d 65 6e  75 73 68 61 64 65 64 28  |.....menushaded(|
00002280  6d 65 6e 75 25 2c 69 74  65 6d 25 29 0d 0a e6 22  |menu%,item%)..."|
00002290  3d 28 28 6d 65 6e 75 25  21 28 32 38 2b 32 34 2a  |=((menu%!(28+24*|
000022a0  69 74 65 6d 25 29 29 20  80 20 34 29 3d 34 0d 0a  |item%)) . 4)=4..|
000022b0  f0 05 3a 0d 0a fa 34 f4  20 50 52 4f 43 73 65 74  |..:...4. PROCset|
000022c0  6d 65 6e 75 74 65 78 74  20 3a 20 53 65 74 20 74  |menutext : Set t|
000022d0  68 65 20 74 65 78 74 20  66 6f 72 20 6d 65 6e 75  |he text for menu|
000022e0  20 6f 70 74 69 6f 6e 0d  0b 04 35 f4 20 46 4e 67  | option...5. FNg|
000022f0  65 74 6d 65 6e 75 74 65  78 74 20 20 20 3a 20 52  |etmenutext   : R|
00002300  65 61 64 20 74 68 65 20  74 65 78 74 20 66 6f 72  |ead the text for|
00002310  20 6d 65 6e 75 20 6f 70  74 69 6f 6e 0d 0b 0e 37  | menu option...7|
00002320  dd f2 73 65 74 6d 65 6e  75 74 65 78 74 28 6d 65  |..setmenutext(me|
00002330  6e 75 2c 6f 70 74 69 6f  6e 2c 74 65 78 74 24 29  |nu,option,text$)|
00002340  3a 6d 65 6e 75 2b 3d 6f  70 74 69 6f 6e 2a 32 34  |:menu+=option*24|
00002350  2b 33 36 0d 0b 18 37 e7  20 28 21 6d 65 6e 75 20  |+36...7. (!menu |
00002360  80 26 31 30 30 29 3e 30  20 8c 24 28 6d 65 6e 75  |.&100)>0 .$(menu|
00002370  21 34 29 3d 74 65 78 74  24 20 8b 24 28 6d 65 6e  |!4)=text$ .$(men|
00002380  75 2b 34 29 3d 74 65 78  74 24 0d 0b 22 05 e1 0d  |u+4)=text$.."...|
00002390  0b 2c 39 dd a4 67 65 74  6d 65 6e 75 74 65 78 74  |.,9..getmenutext|
000023a0  28 6d 65 6e 75 2c 6f 70  74 69 6f 6e 29 3a 6d 65  |(menu,option):me|
000023b0  6e 75 2b 3d 6f 70 74 69  6f 6e 2a 32 34 2b 33 36  |nu+=option*24+36|
000023c0  3a ea 20 74 65 78 74 24  0d 0b 36 37 e7 20 28 21  |:. text$..67. (!|
000023d0  6d 65 6e 75 20 80 26 31  30 30 29 3e 30 20 8c 74  |menu .&100)>0 .t|
000023e0  65 78 74 24 3d 24 28 6d  65 6e 75 21 34 29 20 8b  |ext$=$(menu!4) .|
000023f0  74 65 78 74 24 3d 24 28  6d 65 6e 75 2b 34 29 0d  |text$=$(menu+4).|
00002400  0b 40 0a 3d 74 65 78 74  24 0d 0b 4a 05 3a 0d 0b  |.@.=text$..J.:..|
00002410  54 34 f4 20 46 4e 64 65  63 6f 64 65 6d 65 6e 75  |T4. FNdecodemenu|
00002420  20 3a 20 52 65 74 75 72  6e 20 6d 65 6e 75 20 73  | : Return menu s|
00002430  65 6c 65 63 74 69 6f 6e  20 61 73 20 73 74 72 69  |election as stri|
00002440  6e 67 0d 0b 5e 2f f4 20  61 6c 73 6f 20 72 65 74  |ng..^/. also ret|
00002450  75 72 6e 73 20 66 6f 72  20 66 6f 6e 74 20 69 66  |urns for font if|
00002460  20 6d 65 6e 75 20 69 73  20 66 6f 6e 74 6d 65 6e  | menu is fontmen|
00002470  75 0d 0b 68 37 dd a4 64  65 63 6f 64 65 6d 65 6e  |u..h7..decodemen|
00002480  75 28 6d 65 6e 75 25 29  3a ea 20 63 70 25 2c 70  |u(menu%):. cp%,p|
00002490  74 72 2c 62 24 2c 63 24  3a 63 70 25 3d 6d 65 6e  |tr,b$,c$:cp%=men|
000024a0  75 25 3a 70 74 72 3d 30  0d 0b 72 25 c8 95 20 28  |u%:ptr=0..r%.. (|
000024b0  62 25 21 70 74 72 3e 2d  31 20 80 20 63 70 25 3c  |b%!ptr>-1 . cp%<|
000024c0  3e 72 6d 61 66 6f 6e 74  61 72 65 61 29 0d 0b 7c  |>rmafontarea)..||
000024d0  24 20 63 70 25 3d 63 70  25 21 28 33 32 2b 28 62  |$ cp%=cp%!(32+(b|
000024e0  25 21 70 74 72 29 2a 32  34 29 3a 70 74 72 2b 3d  |%!ptr)*24):ptr+=|
000024f0  34 0d 0b 86 05 ce 0d 0b  90 23 e7 20 63 70 25 3d  |4........#. cp%=|
00002500  72 6d 61 66 6f 6e 74 61  72 65 61 20 80 20 62 25  |rmafontarea . b%|
00002510  21 70 74 72 3c 3e 30 20  8c 0d 0b 9a 41 20 c8 99  |!ptr<>0 ....A ..|
00002520  20 22 46 6f 6e 74 5f 44  65 63 6f 64 65 4d 65 6e  | "Font_DecodeMen|
00002530  75 22 2c 2c 72 6d 61 66  6f 6e 74 61 72 65 61 2c  |u",,rmafontarea,|
00002540  62 25 2b 70 74 72 2c c4  32 35 35 2c bd 30 29 2c  |b%+ptr,.255,.0),|
00002550  32 35 35 20 b8 2c 2c 2c  6d 24 0d 0b a4 05 cc 0d  |255 .,,,m$......|
00002560  0b ae 37 20 c8 99 20 22  57 69 6d 70 5f 44 65 63  |..7 .. "Wimp_Dec|
00002570  6f 64 65 4d 65 6e 75 22  2c 2c 6d 65 6e 75 25 2c  |odeMenu",,menu%,|
00002580  62 25 2c c4 32 35 35 2c  bd 30 29 2c 32 35 35 20  |b%,.255,.0),255 |
00002590  b8 2c 2c 2c 6d 24 0d 0b  b8 0a 20 62 24 3d 22 22  |.,,,m$.... b$=""|
000025a0  0d 0b c2 06 20 f5 0d 0b  cc 2c 20 20 63 24 3d c0  |.... ....,  c$=.|
000025b0  6d 24 2c a7 6d 24 2b 22  2e 22 2c 22 2e 22 29 2d  |m$,.m$+".",".")-|
000025c0  31 29 3a 6d 24 3d c1 6d  24 2c a9 28 63 24 29 2b  |1):m$=.m$,.(c$)+|
000025d0  32 29 0d 0b d6 1e 20 20  63 24 3d c0 63 24 2c a7  |2)....  c$=.c$,.|
000025e0  63 24 2b 22 20 5e 22 2c  22 20 5e 22 29 2d 31 29  |c$+" ^"," ^")-1)|
000025f0  0d 0b e0 26 20 20 63 24  3d c0 63 24 2c a7 63 24  |...&  c$=.c$,.c$|
00002600  2b 22 20 22 2b bd 31 33  39 2c 22 20 22 2b bd 31  |+" "+.139," "+.1|
00002610  33 39 29 2d 31 29 0d 0b  ea 11 20 20 c8 8e 20 c2  |39)-1)....  .. .|
00002620  63 24 2c 33 29 20 ca 0d  0b f4 66 20 20 20 c9 20  |c$,3) ....f   . |
00002630  22 45 73 63 22 2c 22 44  65 6c 22 2c 22 49 6e 73  |"Esc","Del","Ins|
00002640  22 2c 22 45 6e 64 22 2c  22 48 6f 6d 22 2c 22 43  |","End","Hom","C|
00002650  70 79 22 2c 22 46 31 30  22 2c 22 46 31 31 22 2c  |py","F10","F11",|
00002660  22 46 31 32 22 2c 22 46  31 33 22 2c 22 50 72 74  |"F12","F13","Prt|
00002670  22 2c 22 54 61 62 22 2c  22 52 65 74 22 3a 63 24  |","Tab","Ret":c$|
00002680  3d c0 63 24 2c a9 28 63  24 29 2d 34 29 0d 0b fe  |=.c$,.(c$)-4)...|
00002690  07 20 20 cb 0d 0c 08 44  20 20 e7 20 c1 63 24 2c  |.  ....D  . .c$,|
000026a0  a9 28 63 24 29 2d 32 2c  32 29 3d 22 20 46 22 20  |.(c$)-2,2)=" F" |
000026b0  8c e7 c2 63 24 29 3d 22  30 22 20 84 20 bb 28 c2  |...c$)="0" . .(.|
000026c0  63 24 29 29 3c 3e 30 20  8c 63 24 3d c0 63 24 2c  |c$))<>0 .c$=.c$,|
000026d0  a9 28 63 24 29 2d 33 29  0d 0c 12 1b 20 20 c8 95  |.(c$)-3)....  ..|
000026e0  20 c2 63 24 29 3d 22 20  22 3a 63 24 3d c0 63 24  | .c$)=" ":c$=.c$|
000026f0  29 3a ce 0d 0c 1c 10 20  20 62 24 2b 3d 63 24 2b  |):.....  b$+=c$+|
00002700  22 2e 22 0d 0c 26 14 20  fd 6d 24 3d 22 22 20 84  |"."..&. .m$="" .|
00002710  20 6d 24 3d 22 2e 22 0d  0c 30 17 20 e7 20 6d 24  | m$="."..0. . m$|
00002720  3d 22 2e 22 20 8c 62 24  2b 3d 22 2e 2e 22 0d 0c  |="." .b$+=".."..|
00002730  3a 0c 20 6d 24 3d c0 62  24 29 0d 0c 44 05 cd 0d  |:. m$=.b$)..D...|
00002740  0c 4e 07 3d 6d 24 0d 0c  58 05 3a 0d 0c 62 3f f4  |.N.=m$..X.:..b?.|
00002750  20 46 4e 67 65 74 66 6f  6e 74 6d 65 6e 75 20 20  | FNgetfontmenu  |
00002760  20 20 20 20 20 3a 20 52  65 74 75 72 6e 20 6d 65  |     : Return me|
00002770  6d 6f 72 79 20 6c 6f 63  61 74 69 6f 6e 20 6f 66  |mory location of|
00002780  20 66 6f 6e 74 20 6d 65  6e 75 0d 0c 6c 3b f4 20  | font menu..l;. |
00002790  50 52 4f 43 72 65 6c 65  61 73 65 66 6f 6e 74 6d  |PROCreleasefontm|
000027a0  65 6e 75 20 3a 20 52 65  6c 65 61 73 65 20 6d 65  |enu : Release me|
000027b0  6d 6f 72 79 20 75 73 65  64 20 62 79 20 66 6f 6e  |mory used by fon|
000027c0  74 6d 65 6e 75 0d 0c 76  24 dd a4 67 65 74 66 6f  |tmenu..v$..getfo|
000027d0  6e 74 6d 65 6e 75 28 66  6f 6e 74 24 29 3a ea 20  |ntmenu(font$):. |
000027e0  73 70 61 63 65 2c 69 6e  64 0d 0c 80 15 c8 99 20  |space,ind...... |
000027f0  22 48 6f 75 72 67 6c 61  73 73 5f 4f 6e 22 0d 0c  |"Hourglass_On"..|
00002800  8a 34 c8 99 20 22 46 6f  6e 74 5f 4c 69 73 74 46  |.4.. "Font_ListF|
00002810  6f 6e 74 73 22 2c 2c 2c  37 3c 3c 31 39 2c 2c 2c  |onts",,,7<<19,,,|
00002820  2c 31 20 b8 20 2c 2c 2c  73 70 61 63 65 2c 2c 69  |,1 . ,,,space,,i|
00002830  6e 64 0d 0c 94 37 f2 72  65 6c 65 61 73 65 28 72  |nd...7.release(r|
00002840  6d 61 66 6f 6e 74 61 72  65 61 29 3a 72 6d 61 66  |mafontarea):rmaf|
00002850  6f 6e 74 61 72 65 61 3d  a4 63 6c 61 69 6d 28 73  |ontarea=.claim(s|
00002860  70 61 63 65 2b 69 6e 64  29 0d 0c 9e 2b e7 20 72  |pace+ind)...+. r|
00002870  6d 61 66 6f 6e 74 61 72  65 61 3c 30 20 8c c8 99  |mafontarea<0 ...|
00002880  20 22 48 6f 75 72 67 6c  61 73 73 5f 4f 66 66 22  | "Hourglass_Off"|
00002890  3a 3d 2d 31 0d 0c a8 28  e7 20 66 6f 6e 74 24 3c  |:=-1...(. font$<|
000028a0  3e 22 22 20 80 20 66 6f  6e 74 24 3c 3e 22 53 79  |>"" . font$<>"Sy|
000028b0  73 74 65 6d 20 66 6f 6e  74 22 20 8c 0d 0c b2 4d  |stem font" ....M|
000028c0  20 c8 99 20 22 46 6f 6e  74 5f 4c 69 73 74 46 6f  | .. "Font_ListFo|
000028d0  6e 74 73 22 2c 2c 72 6d  61 66 6f 6e 74 61 72 65  |nts",,rmafontare|
000028e0  61 2c 37 3c 3c 31 39 2c  73 70 61 63 65 2c 72 6d  |a,7<<19,space,rm|
000028f0  61 66 6f 6e 74 61 72 65  61 2b 73 70 61 63 65 2c  |afontarea+space,|
00002900  69 6e 64 2c 66 6f 6e 74  24 0d 0c bc 05 cc 0d 0c  |ind,font$.......|
00002910  c6 5e 20 c8 99 20 22 46  6f 6e 74 5f 4c 69 73 74  |.^ .. "Font_List|
00002920  46 6f 6e 74 73 22 2c 2c  72 6d 61 66 6f 6e 74 61  |Fonts",,rmafonta|
00002930  72 65 61 2c 37 3c 3c 31  39 2c 73 70 61 63 65 2c  |rea,7<<19,space,|
00002940  72 6d 61 66 6f 6e 74 61  72 65 61 2b 73 70 61 63  |rmafontarea+spac|
00002950  65 2c 69 6e 64 2c 2d 28  66 6f 6e 74 24 3d 22 53  |e,ind,-(font$="S|
00002960  79 73 74 65 6d 20 66 6f  6e 74 22 29 0d 0c d0 05  |ystem font")....|
00002970  cd 0d 0c da 16 c8 99 20  22 48 6f 75 72 67 6c 61  |....... "Hourgla|
00002980  73 73 5f 4f 66 66 22 0d  0c e4 10 3d 72 6d 61 66  |ss_Off"....=rmaf|
00002990  6f 6e 74 61 72 65 61 0d  0c ee 2d dd f2 72 65 6c  |ontarea...-..rel|
000029a0  65 61 73 65 66 6f 6e 74  6d 65 6e 75 3a f2 72 65  |easefontmenu:.re|
000029b0  6c 65 61 73 65 28 72 6d  61 66 6f 6e 74 61 72 65  |lease(rmafontare|
000029c0  61 29 3a e1 0d 0c f8 05  3a 0d 0d 02 30 f4 20 46  |a):.....:...0. F|
000029d0  4e 63 72 65 61 74 65 66  74 6d 65 6e 75 20 20 20  |Ncreateftmenu   |
000029e0  20 3a 20 43 72 65 61 74  65 20 61 20 66 69 6c 65  | : Create a file|
000029f0  74 79 70 65 20 6d 65 6e  75 0d 0d 0c 37 f4 20 50  |type menu...7. P|
00002a00  52 4f 43 72 65 6c 65 61  73 65 66 74 6d 65 6e 75  |ROCreleaseftmenu|
00002a10  20 3a 20 52 65 6c 65 61  73 65 20 73 70 61 63 65  | : Release space|
00002a20  20 75 73 65 64 20 62 79  20 46 54 20 6d 65 6e 75  | used by FT menu|
00002a30  0d 0d 16 12 dd a4 63 72  65 61 74 65 66 74 6d 65  |......createftme|
00002a40  6e 75 0d 0d 20 2d ea 20  6c 65 6e 2c 6e 61 6d 65  |nu.. -. len,name|
00002a50  2c 74 79 70 65 2c 66 6c  61 67 73 2c 6d 6c 65 6e  |,type,flags,mlen|
00002a60  2c 69 6c 65 6e 2c 6e 24  2c 76 24 2c 6d 73 74 0d  |,ilen,n$,v$,mst.|
00002a70  0d 2a 51 c8 99 20 22 58  4f 53 5f 52 65 61 64 56  |.*Q.. "XOS_ReadV|
00002a80  61 72 56 61 6c 22 2c 22  46 69 6c 65 24 54 79 70  |arVal","File$Typ|
00002a90  65 5f 2a 22 2c 6d 65 73  73 61 67 65 5f 62 75 66  |e_*",message_buf|
00002aa0  66 65 72 25 2c 32 35 36  20 b8 20 2c 2c 6c 65 6e  |fer%,256 . ,,len|
00002ab0  2c 6e 61 6d 65 2c 74 79  70 65 3b 66 6c 61 67 73  |,name,type;flags|
00002ac0  0d 0d 34 15 6d 6c 65 6e  3d 32 38 2b 32 34 3a 69  |..4.mlen=28+24:i|
00002ad0  6c 65 6e 3d 39 0d 0d 3e  14 c8 95 20 28 66 6c 61  |len=9..>... (fla|
00002ae0  67 73 20 80 31 29 3c 3e  31 0d 0d 48 0f 20 e7 20  |gs .1)<>1..H. . |
00002af0  74 79 70 65 3d 30 20 8c  0d 0d 52 24 20 20 6d 6c  |type=0 ...R$  ml|
00002b00  65 6e 2b 3d 32 34 3a 6e  24 3d c2 a4 73 74 72 69  |en+=24:n$=..stri|
00002b10  6e 67 30 28 6e 61 6d 65  29 2c 33 29 0d 0d 5c 2d  |ng0(name),3)..\-|
00002b20  20 20 c8 99 20 22 58 57  69 6d 70 5f 53 70 72 69  |  .. "XWimp_Spri|
00002b30  74 65 4f 70 22 2c 32 34  2c 2c 22 53 6d 61 6c 6c  |teOp",24,,"Small|
00002b40  5f 22 2b 6e 24 20 b8 3b  66 0d 0d 66 11 20 20 e7  |_"+n$ .;f..f.  .|
00002b50  20 28 66 20 80 31 29 3d  31 8c 0d 0d 70 2d 20 20  | (f .1)=1...p-  |
00002b60  20 c8 99 20 22 58 57 69  6d 70 5f 53 70 72 69 74  | .. "XWimp_Sprit|
00002b70  65 4f 70 22 2c 32 34 2c  2c 22 46 69 6c 65 5f 22  |eOp",24,,"File_"|
00002b80  2b 6e 24 20 b8 3b 66 0d  0d 7a 2c 20 20 20 e7 20  |+n$ .;f..z,   . |
00002b90  28 66 20 80 31 29 3d 30  8c 69 6c 65 6e 2b 3d 31  |(f .1)=0.ilen+=1|
00002ba0  31 2b 6c 65 6e 20 8b 69  6c 65 6e 2b 3d 6c 65 6e  |1+len .ilen+=len|
00002bb0  2b 31 31 0d 0d 84 07 20  20 cc 0d 0d 8e 13 20 20  |+11....  .....  |
00002bc0  20 69 6c 65 6e 2b 3d 31  32 2b 6c 65 6e 0d 0d 98  | ilen+=12+len...|
00002bd0  07 20 20 cd 0d 0d a2 06  20 cd 0d 0d ac 57 20 c8  |.  ..... ....W .|
00002be0  99 20 22 58 4f 53 5f 52  65 61 64 56 61 72 56 61  |. "XOS_ReadVarVa|
00002bf0  6c 22 2c 22 46 69 6c 65  24 54 79 70 65 5f 2a 22  |l","File$Type_*"|
00002c00  2c 6d 65 73 73 61 67 65  5f 62 75 66 66 65 72 25  |,message_buffer%|
00002c10  2c 32 35 36 2c 6e 61 6d  65 20 b8 20 2c 2c 6c 65  |,256,name . ,,le|
00002c20  6e 2c 6e 61 6d 65 2c 74  79 70 65 3b 66 6c 61 67  |n,name,type;flag|
00002c30  73 0d 0d b6 05 ce 0d 0d  c0 1b 66 74 62 6c 6b 3d  |s.........ftblk=|
00002c40  a4 63 6c 61 69 6d 28 6d  6c 65 6e 2b 69 6c 65 6e  |.claim(mlen+ilen|
00002c50  29 0d 0d ca 10 e7 20 66  74 62 6c 6b 3d 2d 31 20  |)..... ftblk=-1 |
00002c60  8c 0d 0d d4 1a 20 66 74  62 6c 6b 3d a4 63 6c 61  |..... ftblk=.cla|
00002c70  69 6d 28 32 38 2b 32 34  2b 39 29 0d 0d de 28 20  |im(28+24+9)...( |
00002c80  24 66 74 62 6c 6b 3d 22  46 69 6c 65 20 74 79 70  |$ftblk="File typ|
00002c90  65 73 22 3a 66 74 62 6c  6b 21 31 32 3d 26 37 30  |es":ftblk!12=&70|
00002ca0  32 30 37 0d 0d e8 2b 20  66 74 62 6c 6b 21 31 36  |207...+ ftblk!16|
00002cb0  3d 31 36 2a 31 32 3a 66  74 62 6c 6b 21 32 30 3d  |=16*12:ftblk!20=|
00002cc0  26 32 38 3a 66 74 62 6c  6b 21 32 34 3d 30 0d 0d  |&28:ftblk!24=0..|
00002cd0  f2 2f 20 66 74 62 6c 6b  21 32 38 3d 26 38 30 3a  |./ ftblk!28=&80:|
00002ce0  66 74 62 6c 6b 21 33 32  3d 2d 31 3a 66 74 62 6c  |ftblk!32=-1:ftbl|
00002cf0  6b 21 33 36 3d 26 37 30  30 30 31 32 31 0d 0d fc  |k!36=&7000121...|
00002d00  2f 20 66 74 62 6c 6b 21  34 30 3d 66 74 62 6c 6b  |/ ftblk!40=ftblk|
00002d10  2b 32 38 2b 32 34 3a 66  74 62 6c 6b 21 34 34 3d  |+28+24:ftblk!44=|
00002d20  30 3a 66 74 62 6c 6b 21  34 38 3d 39 0d 0e 06 16  |0:ftblk!48=9....|
00002d30  20 24 28 66 74 62 6c 6b  2b 32 38 2b 32 34 29 3d  | $(ftblk+28+24)=|
00002d40  22 22 0d 0e 10 05 cc 0d  0e 1a 28 20 24 66 74 62  |""........( $ftb|
00002d50  6c 6b 3d 22 46 69 6c 65  20 74 79 70 65 73 22 3a  |lk="File types":|
00002d60  66 74 62 6c 6b 21 31 32  3d 26 37 30 32 30 37 0d  |ftblk!12=&70207.|
00002d70  0e 24 2b 20 66 74 62 6c  6b 21 31 36 3d 31 36 2a  |.$+ ftblk!16=16*|
00002d80  31 32 3a 66 74 62 6c 6b  21 32 30 3d 26 32 38 3a  |12:ftblk!20=&28:|
00002d90  66 74 62 6c 6b 21 32 34  3d 30 0d 0e 2e 2a 20 69  |ftblk!24=0...* i|
00002da0  6c 65 6e 3d 6d 6c 65 6e  2b 66 74 62 6c 6b 3a 6d  |len=mlen+ftblk:m|
00002db0  6c 65 6e 3d 69 6c 65 6e  2d 32 34 3a 6d 73 74 3d  |len=ilen-24:mst=|
00002dc0  6d 6c 65 6e 0d 0e 38 54  20 c8 99 20 22 58 4f 53  |mlen..8T .. "XOS|
00002dd0  5f 52 65 61 64 56 61 72  56 61 6c 22 2c 22 46 69  |_ReadVarVal","Fi|
00002de0  6c 65 24 54 79 70 65 5f  2a 22 2c 6d 65 73 73 61  |le$Type_*",messa|
00002df0  67 65 5f 62 75 66 66 65  72 25 2c 32 35 36 2c 30  |ge_buffer%,256,0|
00002e00  20 b8 20 2c 2c 6c 65 6e  2c 6e 61 6d 65 2c 74 79  | . ,,len,name,ty|
00002e10  70 65 3b 66 6c 61 67 73  0d 0e 42 15 20 c8 95 20  |pe;flags..B. .. |
00002e20  28 66 6c 61 67 73 20 80  31 29 3c 3e 31 0d 0e 4c  |(flags .1)<>1..L|
00002e30  10 20 20 e7 20 74 79 70  65 3d 30 20 8c 0d 0e 56  |.  . type=0 ...V|
00002e40  4f 20 20 20 6d 65 73 73  61 67 65 5f 62 75 66 66  |O   message_buff|
00002e50  65 72 25 21 6c 65 6e 3d  30 3a 6e 24 3d c2 a4 73  |er%!len=0:n$=..s|
00002e60  74 72 69 6e 67 30 28 6e  61 6d 65 29 2c 33 29 3a  |tring0(name),3):|
00002e70  76 24 3d a4 73 74 72 69  6e 67 30 28 6d 65 73 73  |v$=.string0(mess|
00002e80  61 67 65 5f 62 75 66 66  65 72 25 29 0d 0e 60 19  |age_buffer%)..`.|
00002e90  20 20 20 6d 6c 65 6e 21  30 3d 30 3a 6d 6c 65 6e  |   mlen!0=0:mlen|
00002ea0  21 34 3d 2d 31 0d 0e 6a  2e 20 20 20 c8 99 20 22  |!4=-1..j.   .. "|
00002eb0  58 57 69 6d 70 5f 53 70  72 69 74 65 4f 70 22 2c  |XWimp_SpriteOp",|
00002ec0  32 34 2c 2c 22 53 6d 61  6c 6c 5f 22 2b 6e 24 20  |24,,"Small_"+n$ |
00002ed0  b8 3b 66 0d 0e 74 12 20  20 20 e7 20 28 66 20 80  |.;f..t.   . (f .|
00002ee0  31 29 3d 31 8c 0d 0e 7e  2e 20 20 20 20 c8 99 20  |1)=1...~.    .. |
00002ef0  22 58 57 69 6d 70 5f 53  70 72 69 74 65 4f 70 22  |"XWimp_SpriteOp"|
00002f00  2c 32 34 2c 2c 22 46 69  6c 65 5f 22 2b 6e 24 20  |,24,,"File_"+n$ |
00002f10  b8 3b 66 0d 0e 88 2f 20  20 20 20 e7 20 28 66 20  |.;f.../    . (f |
00002f20  80 31 29 3d 30 8c 6e 24  3d 22 46 69 6c 65 5f 22  |.1)=0.n$="File_"|
00002f30  2b 6e 24 20 8b 6e 24 3d  22 46 69 6c 65 5f 78 78  |+n$ .n$="File_xx|
00002f40  78 22 0d 0e 92 17 20 20  20 20 6d 6c 65 6e 21 38  |x"....    mlen!8|
00002f50  3d 26 37 30 30 30 39 33  33 0d 0e 9c 08 20 20 20  |=&7000933....   |
00002f60  cc 0d 0e a6 26 20 20 20  20 6e 24 3d 22 53 6d 61  |....&    n$="Sma|
00002f70  6c 6c 5f 22 2b 6e 24 3a  6d 6c 65 6e 21 38 3d 26  |ll_"+n$:mlen!8=&|
00002f80  37 30 30 30 31 33 33 0d  0e b0 08 20 20 20 cd 0d  |7000133....   ..|
00002f90  0e ba 2a 20 20 20 6d 6c  65 6e 21 31 32 3d 69 6c  |..*   mlen!12=il|
00002fa0  65 6e 3a 24 69 6c 65 6e  3d 76 24 3a 69 6c 65 6e  |en:$ilen=v$:ilen|
00002fb0  2b 3d a9 28 76 24 29 2b  31 0d 0e c4 2e 20 20 20  |+=.(v$)+1....   |
00002fc0  6d 6c 65 6e 21 31 36 3d  69 6c 65 6e 3a 24 69 6c  |mlen!16=ilen:$il|
00002fd0  65 6e 3d 22 73 22 2b 6e  24 3a 69 6c 65 6e 2b 3d  |en="s"+n$:ilen+=|
00002fe0  a9 28 6e 24 29 2b 32 0d  0e ce 1f 20 20 20 6d 6c  |.(n$)+2....   ml|
00002ff0  65 6e 21 32 30 3d a9 28  76 24 29 2b 31 3a 6d 6c  |en!20=.(v$)+1:ml|
00003000  65 6e 2d 3d 32 34 0d 0e  d8 07 20 20 cd 0d 0e e2  |en-=24....  ....|
00003010  58 20 20 c8 99 20 22 58  4f 53 5f 52 65 61 64 56  |X  .. "XOS_ReadV|
00003020  61 72 56 61 6c 22 2c 22  46 69 6c 65 24 54 79 70  |arVal","File$Typ|
00003030  65 5f 2a 22 2c 6d 65 73  73 61 67 65 5f 62 75 66  |e_*",message_buf|
00003040  66 65 72 25 2c 32 35 36  2c 6e 61 6d 65 20 b8 20  |fer%,256,name . |
00003050  2c 2c 6c 65 6e 2c 6e 61  6d 65 2c 74 79 70 65 3b  |,,len,name,type;|
00003060  66 6c 61 67 73 0d 0e ec  06 20 ce 0d 0e f6 34 20  |flags.... ....4 |
00003070  6d 6c 65 6e 21 30 3d 34  3a 6d 6c 65 6e 21 34 3d  |mlen!0=4:mlen!4=|
00003080  2d 31 3a 6d 6c 65 6e 21  38 3d 26 37 30 30 30 31  |-1:mlen!8=&70001|
00003090  32 31 3a 6d 6c 65 6e 21  31 32 3d 69 6c 65 6e 0d  |21:mlen!12=ilen.|
000030a0  0f 00 3c 20 24 69 6c 65  6e 3d 22 22 3a 69 6c 65  |..< $ilen="":ile|
000030b0  6e 2b 3d 39 3a 6d 6c 65  6e 21 31 36 3d 2d 31 3a  |n+=9:mlen!16=-1:|
000030c0  6d 6c 65 6e 21 32 30 3d  39 3a 6d 6c 65 6e 2d 3d  |mlen!20=9:mlen-=|
000030d0  32 34 3a 21 6d 73 74 3d  26 38 30 0d 0f 0a 05 cd  |24:!mst=&80.....|
000030e0  0d 0f 14 0a 3d 66 74 62  6c 6b 0d 0f 1e 25 dd f2  |....=ftblk...%..|
000030f0  72 65 6c 65 61 73 65 66  74 6d 65 6e 75 3a f2 72  |releaseftmenu:.r|
00003100  65 6c 65 61 73 65 28 66  74 62 6c 6b 29 3a e1 0d  |elease(ftblk):..|
00003110  0f 28 05 3a 0d 0f 32 37  f4 20 2a 2a 2a 2a 2a 2a  |.(.:..27. ******|
00003120  2a 2a 20 57 69 6e 64 6f  77 20 6d 61 6e 69 70 75  |** Window manipu|
00003130  6c 61 74 69 6f 6e 20 72  6f 75 74 69 6e 65 73 20  |lation routines |
00003140  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 0d 0f 3c 05 3a  |***********..<.:|
00003150  0d 0f 46 28 f4 20 50 52  4f 43 63 6c 6f 73 65 77  |..F(. PROCclosew|
00003160  69 6e 20 20 20 20 20 20  3a 20 43 6c 6f 73 65 20  |in      : Close |
00003170  61 20 77 69 6e 64 6f 77  0d 0f 50 37 f4 20 50 52  |a window..P7. PR|
00003180  4f 43 6f 70 65 6e 77 69  6e 20 20 20 20 20 20 20  |OCopenwin       |
00003190  3a 20 4f 70 65 6e 20 61  20 77 69 6e 64 6f 77 20  |: Open a window |
000031a0  61 74 20 74 6f 70 20 6f  66 20 73 74 61 63 6b 0d  |at top of stack.|
000031b0  0f 5a 3e f4 20 50 52 4f  43 6f 70 65 6e 77 69 6e  |.Z>. PROCopenwin|
000031c0  61 74 20 20 20 20 20 3a  20 4f 70 65 6e 20 61 20  |at     : Open a |
000031d0  77 69 6e 64 6f 77 20 61  74 20 74 6f 70 2d 6c 65  |window at top-le|
000031e0  66 74 20 63 6f 72 6e 65  72 20 78 2c 79 0d 0f 64  |ft corner x,y..d|
000031f0  39 f4 20 50 52 4f 43 6f  70 65 6e 77 69 6e 63 65  |9. PROCopenwince|
00003200  6e 74 72 65 20 3a 20 4f  70 65 6e 20 77 69 6e 64  |ntre : Open wind|
00003210  6f 77 20 69 6e 20 63 65  6e 74 72 65 20 6f 66 20  |ow in centre of |
00003220  73 63 72 65 65 6e 0d 0f  6e 3c f4 20 50 52 4f 43  |screen..n<. PROC|
00003230  6f 70 65 6e 77 69 6e 74  6f 20 20 20 20 20 3a 20  |openwinto     : |
00003240  4f 70 65 6e 20 77 69 6e  64 6f 77 20 61 74 20 70  |Open window at p|
00003250  6f 73 69 74 69 6f 6e 20  77 69 74 68 69 6e 20 54  |osition within T|
00003260  57 41 0d 0f 78 14 dd f2  63 6c 6f 73 65 77 69 6e  |WA..x...closewin|
00003270  28 77 69 6e 25 29 0d 0f  82 26 21 62 25 3d 77 69  |(win%)...&!b%=wi|
00003280  6e 25 3a c8 99 20 22 57  69 6d 70 5f 43 6c 6f 73  |n%:.. "Wimp_Clos|
00003290  65 57 69 6e 64 6f 77 22  2c 2c 62 25 0d 0f 8c 05  |eWindow",,b%....|
000032a0  e1 0d 0f 96 13 dd f2 6f  70 65 6e 77 69 6e 28 77  |.......openwin(w|
000032b0  69 6e 25 29 0d 0f a0 29  21 62 25 3d 77 69 6e 25  |in%)...)!b%=win%|
000032c0  3a c8 99 20 22 57 69 6d  70 5f 47 65 74 57 69 6e  |:.. "Wimp_GetWin|
000032d0  64 6f 77 53 74 61 74 65  22 2c 2c 62 25 0d 0f aa  |dowState",,b%...|
000032e0  25 62 25 21 32 38 3d 2d  31 3a c8 99 20 22 57 69  |%b%!28=-1:.. "Wi|
000032f0  6d 70 5f 4f 70 65 6e 57  69 6e 64 6f 77 22 2c 2c  |mp_OpenWindow",,|
00003300  62 25 0d 0f b4 05 e1 0d  0f be 28 dd f2 6f 70 65  |b%........(..ope|
00003310  6e 77 69 6e 61 74 28 77  69 6e 25 2c 78 2c 79 29  |nwinat(win%,x,y)|
00003320  3a ea 20 77 69 64 74 68  2c 68 65 69 67 68 74 0d  |:. width,height.|
00003330  0f c8 29 21 62 25 3d 77  69 6e 25 3a c8 99 20 22  |..)!b%=win%:.. "|
00003340  57 69 6d 70 5f 47 65 74  57 69 6e 64 6f 77 53 74  |Wimp_GetWindowSt|
00003350  61 74 65 22 2c 2c 62 25  0d 0f d2 26 77 69 64 74  |ate",,b%...&widt|
00003360  68 3d 62 25 21 34 2d 62  25 21 31 32 3a 68 65 69  |h=b%!4-b%!12:hei|
00003370  67 68 74 3d 62 25 21 31  36 2d 62 25 21 38 0d 0f  |ght=b%!16-b%!8..|
00003380  dc 2e 62 25 21 34 3d 78  3a 62 25 21 38 3d 79 2d  |..b%!4=x:b%!8=y-|
00003390  68 65 69 67 68 74 3a 62  25 21 31 32 3d 78 2d 77  |height:b%!12=x-w|
000033a0  69 64 74 68 3a 62 25 21  31 36 3d 79 0d 0f e6 25  |idth:b%!16=y...%|
000033b0  62 25 21 32 38 3d 2d 31  3a c8 99 20 22 57 69 6d  |b%!28=-1:.. "Wim|
000033c0  70 5f 4f 70 65 6e 57 69  6e 64 6f 77 22 2c 2c 62  |p_OpenWindow",,b|
000033d0  25 0d 0f f0 05 e1 0d 0f  fa 32 dd f2 6f 70 65 6e  |%........2..open|
000033e0  77 69 6e 63 65 6e 74 72  65 28 77 69 6e 25 29 3a  |wincentre(win%):|
000033f0  ea 20 77 69 64 74 68 2c  68 65 69 67 68 74 2c 74  |. width,height,t|
00003400  6f 70 2c 72 69 67 68 74  0d 10 04 2a 21 62 25 3d  |op,right...*!b%=|
00003410  34 3a 62 25 21 34 3d 35  3a 62 25 21 38 3d 31 31  |4:b%!4=5:b%!8=11|
00003420  3a 62 25 21 31 32 3d 31  32 3a 62 25 21 31 36 3d  |:b%!12=12:b%!16=|
00003430  2d 31 0d 10 0e 25 c8 99  20 22 4f 53 5f 52 65 61  |-1...%.. "OS_Rea|
00003440  64 56 64 75 56 61 72 69  61 62 6c 65 73 22 2c 62  |dVduVariables",b|
00003450  25 2c 62 25 2b 32 30 0d  10 18 2b 72 69 67 68 74  |%,b%+20...+right|
00003460  3d 62 25 21 32 38 2b 31  3c 3c 62 25 21 32 30 3a  |=b%!28+1<<b%!20:|
00003470  74 6f 70 3d 62 25 21 33  32 2b 31 3c 3c 62 25 21  |top=b%!32+1<<b%!|
00003480  32 34 0d 10 22 29 21 62  25 3d 77 69 6e 25 3a c8  |24..")!b%=win%:.|
00003490  99 20 22 57 69 6d 70 5f  47 65 74 57 69 6e 64 6f  |. "Wimp_GetWindo|
000034a0  77 53 74 61 74 65 22 2c  2c 62 25 0d 10 2c 26 77  |wState",,b%..,&w|
000034b0  69 64 74 68 3d 62 25 21  34 2d 62 25 21 31 32 3a  |idth=b%!4-b%!12:|
000034c0  68 65 69 67 68 74 3d 62  25 21 31 36 2d 62 25 21  |height=b%!16-b%!|
000034d0  38 0d 10 36 33 78 3d 28  72 69 67 68 74 2d 77 69  |8..63x=(right-wi|
000034e0  64 74 68 29 2f 32 2b 77  69 64 74 68 3a 79 3d 28  |dth)/2+width:y=(|
000034f0  74 6f 70 2d 68 65 69 67  68 74 29 2f 32 2b 68 65  |top-height)/2+he|
00003500  69 67 68 74 0d 10 40 2e  62 25 21 34 3d 78 3a 62  |ight..@.b%!4=x:b|
00003510  25 21 38 3d 79 2d 68 65  69 67 68 74 3a 62 25 21  |%!8=y-height:b%!|
00003520  31 32 3d 78 2d 77 69 64  74 68 3a 62 25 21 31 36  |12=x-width:b%!16|
00003530  3d 79 0d 10 4a 25 62 25  21 32 38 3d 2d 31 3a c8  |=y..J%b%!28=-1:.|
00003540  99 20 22 57 69 6d 70 5f  4f 70 65 6e 57 69 6e 64  |. "Wimp_OpenWind|
00003550  6f 77 22 2c 2c 62 25 0d  10 54 05 e1 0d 10 5e 2f  |ow",,b%..T....^/|
00003560  f4 20 6c 3d 6c 65 66 74  20 6f 66 20 56 57 41 20  |. l=left of VWA |
00003570  69 6e 20 54 57 41 2c 20  74 3d 74 6f 70 20 6f 66  |in TWA, t=top of|
00003580  20 56 57 41 20 69 6e 20  54 57 41 0d 10 68 33 f4  | VWA in TWA..h3.|
00003590  20 72 3d 72 69 67 68 74  20 6f 66 20 56 57 41 20  | r=right of VWA |
000035a0  69 6e 20 54 57 41 2c 20  62 3d 62 6f 74 74 6f 6d  |in TWA, b=bottom|
000035b0  20 6f 66 20 56 57 41 20  69 6e 20 54 57 41 0d 10  | of VWA in TWA..|
000035c0  72 41 f4 20 57 69 6e 64  6f 77 20 64 6f 65 73 20  |rA. Window does |
000035d0  6e 6f 74 20 6d 6f 76 65  2c 20 62 75 74 20 69 74  |not move, but it|
000035e0  73 20 73 69 7a 65 20 69  73 20 61 6c 74 65 72 65  |s size is altere|
000035f0  64 20 74 6f 20 64 69 66  66 65 72 65 6e 63 65 0d  |d to difference.|
00003600  10 7c 3f f4 20 62 65 74  77 65 65 6e 20 6c 26 77  |.|?. between l&w|
00003610  20 61 6e 64 20 74 26 68  2e 20 54 6f 70 20 6c 65  | and t&h. Top le|
00003620  66 74 20 6f 66 20 56 57  41 20 69 73 20 70 6f 73  |ft of VWA is pos|
00003630  69 74 69 6f 6e 65 64 20  74 6f 20 74 6c 2e 0d 10  |itioned to tl...|
00003640  86 3b f4 20 49 66 20 72  62 20 3d 20 2d 31 20 74  |.;. If rb = -1 t|
00003650  68 65 6e 20 6e 6f 20 61  63 74 75 61 6c 20 73 69  |hen no actual si|
00003660  7a 65 20 63 68 61 6e 67  65 2c 20 6a 75 73 74 20  |ze change, just |
00003670  70 6f 73 69 74 69 6f 6e  2e 0d 10 90 1d dd f2 6f  |position.......o|
00003680  70 65 6e 77 69 6e 74 6f  28 77 69 6e 25 2c 6c 2c  |penwinto(win%,l,|
00003690  74 2c 72 2c 62 29 0d 10  9a 29 21 62 25 3d 77 69  |t,r,b)...)!b%=wi|
000036a0  6e 25 3a c8 99 20 22 57  69 6d 70 5f 47 65 74 57  |n%:.. "Wimp_GetW|
000036b0  69 6e 64 6f 77 53 74 61  74 65 22 2c 2c 62 25 0d  |indowState",,b%.|
000036c0  10 a4 13 e7 20 6c 3d 2d  31 20 8c 6c 3d 62 25 21  |.... l=-1 .l=b%!|
000036d0  32 30 0d 10 ae 13 e7 20  74 3d 2d 31 20 8c 62 3d  |20..... t=-1 .b=|
000036e0  62 25 21 32 34 0d 10 b8  18 e7 20 72 3d 2d 31 20  |b%!24..... r=-1 |
000036f0  8c 72 3d 62 25 21 31 32  2d 62 25 21 34 0d 10 c2  |.r=b%!12-b%!4...|
00003700  18 e7 20 62 3d 2d 31 20  8c 74 3d 62 25 21 38 2d  |.. b=-1 .t=b%!8-|
00003710  62 25 21 31 36 0d 10 cc  31 62 25 21 31 32 3d 62  |b%!16...1b%!12=b|
00003720  25 21 34 2b 72 2d 6c 3a  62 25 21 38 3d 62 25 21  |%!4+r-l:b%!8=b%!|
00003730  31 36 2b 62 2d 74 3a 62  25 21 32 30 3d 6c 3a 62  |16+b-t:b%!20=l:b|
00003740  25 21 32 34 3d 74 0d 10  d6 1b c8 99 22 57 69 6d  |%!24=t......"Wim|
00003750  70 5f 4f 70 65 6e 57 69  6e 64 6f 77 22 2c 2c 62  |p_OpenWindow",,b|
00003760  25 0d 10 e0 05 e1 0d 10  ea 05 3a 0d 10 f4 3d f4  |%.........:...=.|
00003770  20 50 52 4f 43 72 65 73  69 7a 65 77 69 6e 74 6f  | PROCresizewinto|
00003780  20 3a 20 52 65 73 69 7a  65 73 20 77 69 6e 64 6f  | : Resizes windo|
00003790  77 20 61 6e 64 20 72 65  2d 6f 70 65 6e 73 20 69  |w and re-opens i|
000037a0  66 20 6e 65 65 64 65 64  0d 10 fe 28 f4 20 57 69  |f needed...(. Wi|
000037b0  6c 6c 20 6b 65 65 70 20  74 6f 20 66 75 6c 6c 20  |ll keep to full |
000037c0  73 69 7a 65 20 69 66 20  70 6f 73 73 69 62 6c 65  |size if possible|
000037d0  0d 11 08 1f dd f2 72 65  73 69 7a 65 77 69 6e 74  |......resizewint|
000037e0  6f 28 77 69 6e 25 2c 6c  2c 74 2c 72 2c 62 29 0d  |o(win%,l,t,r,b).|
000037f0  11 12 11 ea 20 66 75 6c  6c 25 2c 6f 70 65 6e 25  |.... full%,open%|
00003800  0d 11 1c 29 21 62 25 3d  77 69 6e 25 3a c8 99 20  |...)!b%=win%:.. |
00003810  22 57 69 6d 70 5f 47 65  74 57 69 6e 64 6f 77 53  |"Wimp_GetWindowS|
00003820  74 61 74 65 22 2c 2c 62  25 0d 11 26 38 f4 20 49  |tate",,b%..&8. I|
00003830  66 20 66 75 6c 6c 20 73  69 7a 65 2c 20 6f 70 65  |f full size, ope|
00003840  6e 20 66 75 6c 6c 20 73  69 7a 65 2c 20 61 6e 64  |n full size, and|
00003850  20 69 66 20 6f 70 65 6e  2c 20 72 65 2d 6f 70 65  | if open, re-ope|
00003860  6e 0d 11 30 31 6f 70 65  6e 25 3d 28 62 25 21 33  |n..01open%=(b%!3|
00003870  32 20 80 20 28 31 3c 3c  31 36 29 29 3e 30 3a e7  |2 . (1<<16))>0:.|
00003880  20 ac 20 6f 70 65 6e 25  20 8c 62 25 21 32 38 3d  | . open% .b%!28=|
00003890  2d 33 0d 11 3a 39 c8 99  20 22 57 69 6d 70 5f 4f  |-3..:9.. "Wimp_O|
000038a0  70 65 6e 57 69 6e 64 6f  77 22 2c 2c 62 25 3a c8  |penWindow",,b%:.|
000038b0  99 20 22 57 69 6d 70 5f  47 65 74 57 69 6e 64 6f  |. "Wimp_GetWindo|
000038c0  77 53 74 61 74 65 22 2c  2c 62 25 0d 11 44 1d 66  |wState",,b%..D.f|
000038d0  75 6c 6c 25 3d 28 62 25  21 33 32 20 80 20 28 31  |ull%=(b%!32 . (1|
000038e0  3c 3c 31 38 29 29 3e 30  0d 11 4e 23 62 25 21 36  |<<18))>0..N#b%!6|
000038f0  38 3d 6c 3a 62 25 21 37  32 3d 62 3a 62 25 21 37  |8=l:b%!72=b:b%!7|
00003900  36 3d 72 3a 62 25 21 38  30 3d 74 0d 11 58 22 c8  |6=r:b%!80=t..X".|
00003910  99 20 22 57 69 6d 70 5f  53 65 74 45 78 74 65 6e  |. "Wimp_SetExten|
00003920  74 22 2c 77 69 6e 25 2c  62 25 2b 36 38 0d 11 62  |t",win%,b%+68..b|
00003930  2a e7 20 66 75 6c 6c 25  20 8c 62 25 21 38 3d 62  |*. full% .b%!8=b|
00003940  25 21 31 36 2b 62 2d 74  3a 62 25 21 31 32 3d 62  |%!16+b-t:b%!12=b|
00003950  25 21 34 2b 72 2d 6c 0d  11 6c 1c c8 99 20 22 57  |%!4+r-l..l... "W|
00003960  69 6d 70 5f 4f 70 65 6e  57 69 6e 64 6f 77 22 2c  |imp_OpenWindow",|
00003970  2c 62 25 0d 11 76 4a e7  20 6f 70 65 6e 25 20 8c  |,b%..vJ. open% .|
00003980  c8 99 20 22 57 69 6d 70  5f 46 6f 72 63 65 52 65  |.. "Wimp_ForceRe|
00003990  64 72 61 77 22 2c 77 69  6e 25 2c 6c 2c 62 2c 72  |draw",win%,l,b,r|
000039a0  2c 74 20 8b c8 99 20 22  57 69 6d 70 5f 43 6c 6f  |,t ... "Wimp_Clo|
000039b0  73 65 57 69 6e 64 6f 77  22 2c 2c 62 25 0d 11 80  |seWindow",,b%...|
000039c0  05 e1 0d 11 8a 44 f4 66  75 6c 6c 25 3d 28 20 28  |.....D.full%=( (|
000039d0  28 28 62 25 21 31 32 29  2d 28 62 25 21 34 29 29  |((b%!12)-(b%!4))|
000039e0  3d 62 25 21 35 32 29 20  41 4e 44 20 28 28 28 62  |=b%!52) AND (((b|
000039f0  25 21 31 36 29 2d 28 62  25 21 38 29 29 3d 62 25  |%!16)-(b%!8))=b%|
00003a00  21 35 36 29 20 29 0d 11  94 05 3a 0d 11 9e 3f f4  |!56) )....:...?.|
00003a10  20 50 52 4f 43 77 69 6e  73 65 74 65 78 74 65 6e  | PROCwinsetexten|
00003a20  74 20 3a 20 53 65 74 20  74 68 65 20 6d 61 78 69  |t : Set the maxi|
00003a30  6d 75 6d 20 65 78 74 65  6e 74 20 6f 66 20 77 69  |mum extent of wi|
00003a40  6e 64 6f 77 20 28 54 57  41 29 0d 11 a8 20 dd f2  |ndow (TWA)... ..|
00003a50  77 69 6e 73 65 74 65 78  74 65 6e 74 28 77 69 6e  |winsetextent(win|
00003a60  25 2c 6c 2c 74 2c 72 2c  62 29 0d 11 b2 2a 21 62  |%,l,t,r,b)...*!b|
00003a70  25 3d 77 69 6e 25 3a c8  99 20 22 57 69 6d 70 5f  |%=win%:.. "Wimp_|
00003a80  47 65 74 57 69 6e 64 6f  77 49 6e 66 6f 22 2c 2c  |GetWindowInfo",,|
00003a90  62 25 2b 31 0d 11 bc 13  e7 20 6c 3d 2d 31 20 8c  |b%+1..... l=-1 .|
00003aa0  6c 3d 62 25 21 34 34 0d  11 c6 13 e7 20 62 3d 2d  |l=b%!44..... b=-|
00003ab0  31 20 8c 62 3d 62 25 21  34 38 0d 11 d0 13 e7 20  |1 .b=b%!48..... |
00003ac0  72 3d 2d 31 20 8c 72 3d  62 25 21 35 32 0d 11 da  |r=-1 .r=b%!52...|
00003ad0  13 e7 20 74 3d 2d 31 20  8c 74 3d 62 25 21 35 36  |.. t=-1 .t=b%!56|
00003ae0  0d 11 e4 23 62 25 21 34  34 3d 6c 3a 62 25 21 34  |...#b%!44=l:b%!4|
00003af0  38 3d 62 3a 62 25 21 35  32 3d 72 3a 62 25 21 35  |8=b:b%!52=r:b%!5|
00003b00  36 3d 74 0d 11 ee 22 c8  99 22 58 57 69 6d 70 5f  |6=t...".."XWimp_|
00003b10  53 65 74 45 78 74 65 6e  74 22 2c 77 69 6e 25 2c  |SetExtent",win%,|
00003b20  62 25 2b 34 34 0d 11 f8  05 e1 0d 12 02 05 3a 0d  |b%+44.........:.|
00003b30  12 0c 3f f4 20 50 52 4f  43 66 6f 72 63 65 72 65  |..?. PROCforcere|
00003b40  64 72 61 77 20 3a 20 52  65 64 72 61 77 20 74 68  |draw : Redraw th|
00003b50  65 20 73 70 65 63 69 66  69 65 64 20 70 61 72 74  |e specified part|
00003b60  20 6f 66 20 74 68 65 20  77 69 6e 64 6f 77 0d 12  | of the window..|
00003b70  16 1f dd f2 66 6f 72 63  65 72 65 64 72 61 77 28  |....forceredraw(|
00003b80  77 69 6e 25 2c 6c 2c 74  2c 72 2c 62 29 0d 12 20  |win%,l,t,r,b).. |
00003b90  26 c8 99 20 22 57 69 6d  70 5f 46 6f 72 63 65 52  |&.. "Wimp_ForceR|
00003ba0  65 64 72 61 77 22 2c 77  69 6e 25 2c 6c 2c 62 2c  |edraw",win%,l,b,|
00003bb0  72 2c 74 0d 12 2a 05 e1  0d 12 34 05 3a 0d 12 3e  |r,t..*....4.:..>|
00003bc0  3d f4 20 50 52 4f 43 77  69 6e 64 6f 77 74 69 74  |=. PROCwindowtit|
00003bd0  6c 65 20 3a 20 53 65 74  20 77 69 6e 64 6f 77 20  |le : Set window |
00003be0  74 69 74 6c 65 20 28 6f  6e 6c 79 20 69 66 20 69  |title (only if i|
00003bf0  6e 64 69 72 65 63 74 65  64 29 0d 12 48 1f dd 20  |ndirected)..H.. |
00003c00  f2 77 69 6e 64 6f 77 74  69 74 6c 65 28 77 69 6e  |.windowtitle(win|
00003c10  25 2c 74 69 74 6c 65 24  29 0d 12 52 0d ea 20 6c  |%,title$)..R.. l|
00003c20  6f 63 25 2c 61 24 0d 12  5c 2b 62 25 21 30 3d 77  |oc%,a$..\+b%!0=w|
00003c30  69 6e 25 3a c8 99 20 22  57 69 6d 70 5f 47 65 74  |in%:.. "Wimp_Get|
00003c40  57 69 6e 64 6f 77 49 6e  66 6f 22 2c 2c 62 25 2b  |WindowInfo",,b%+|
00003c50  31 0d 12 66 25 6c 6f 63  25 3d 21 28 62 25 2b 37  |1..f%loc%=!(b%+7|
00003c60  36 29 3a 61 24 3d a4 6d  73 67 74 65 78 74 28 74  |6):a$=.msgtext(t|
00003c70  69 74 6c 65 24 29 0d 12  70 1a e7 20 a4 73 74 72  |itle$)..p.. .str|
00003c80  69 6e 67 30 28 6c 6f 63  25 29 3c 3e 61 24 20 8c  |ing0(loc%)<>a$ .|
00003c90  0d 12 7a 3a 20 24 6c 6f  63 25 3d 61 24 3a 62 25  |..z: $loc%=a$:b%|
00003ca0  21 33 32 3d 77 69 6e 25  3a c8 99 20 22 57 69 6d  |!32=win%:.. "Wim|
00003cb0  70 5f 47 65 74 57 69 6e  64 6f 77 4f 75 74 6c 69  |p_GetWindowOutli|
00003cc0  6e 65 22 2c 2c 62 25 2b  33 32 0d 12 84 35 20 c8  |ne",,b%+32...5 .|
00003cd0  99 20 22 57 69 6d 70 5f  46 6f 72 63 65 52 65 64  |. "Wimp_ForceRed|
00003ce0  72 61 77 22 2c 2d 31 2c  62 25 21 33 36 2c 62 25  |raw",-1,b%!36,b%|
00003cf0  21 31 36 2c 62 25 21 34  34 2c 62 25 21 34 38 0d  |!16,b%!44,b%!48.|
00003d00  12 8e 05 cd 0d 12 98 05  e1 0d 12 a2 05 3a 0d 12  |.............:..|
00003d10  ac 3e f4 20 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |.>. ************|
00003d20  20 4e 65 73 74 65 64 20  57 69 6e 64 6f 77 20 4d  | Nested Window M|
00003d30  61 6e 61 67 65 72 20 73  70 65 63 69 66 69 63 20  |anager specific |
00003d40  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 12 b6 35  |************...5|
00003d50  f4 20 50 52 4f 43 65 6d  62 65 64 77 69 6e 20 20  |. PROCembedwin  |
00003d60  20 3a 20 65 6d 62 65 64  73 20 61 20 77 69 6e 64  | : embeds a wind|
00003d70  6f 77 20 77 69 74 68 69  6e 20 61 6e 6f 74 68 65  |ow within anothe|
00003d80  72 0d 12 c0 43 f4 20 50  52 4f 43 65 6d 62 65 64  |r...C. PROCembed|
00003d90  77 69 6e 20 20 20 3a 20  65 6d 62 65 64 73 20 61  |win   : embeds a|
00003da0  20 77 69 6e 64 6f 77 20  77 69 74 68 69 6e 20 61  | window within a|
00003db0  6e 6f 74 68 65 72 20 77  69 74 68 20 77 69 6e 66  |nother with winf|
00003dc0  6c 61 67 73 0d 12 ca 34  f4 20 50 52 4f 43 75 6e  |lags...4. PROCun|
00003dd0  65 6d 62 65 64 77 69 6e  20 3a 20 75 6e 65 6d 62  |embedwin : unemb|
00003de0  65 64 20 61 20 77 69 6e  64 6f 77 20 66 72 6f 6d  |ed a window from|
00003df0  20 61 6e 6f 74 68 65 72  0d 12 d4 3b f4 20 46 4e  | another...;. FN|
00003e00  70 61 72 65 6e 74 77 69  6e 20 20 20 20 3a 20 52  |parentwin    : R|
00003e10  65 74 75 72 6e 73 20 74  68 65 20 70 61 72 65 6e  |eturns the paren|
00003e20  74 20 77 69 6e 64 6f 77  20 6f 66 20 61 20 63 68  |t window of a ch|
00003e30  69 6c 64 0d 12 de 25 dd  f2 65 6d 62 65 64 77 69  |ild...%..embedwi|
00003e40  6e 28 70 61 72 65 6e 74  25 2c 63 68 69 6c 64 25  |n(parent%,child%|
00003e50  2c 66 6c 61 67 73 25 29  0d 12 e8 2b 21 62 25 3d  |,flags%)...+!b%=|
00003e60  63 68 69 6c 64 25 3a c8  99 20 22 57 69 6d 70 5f  |child%:.. "Wimp_|
00003e70  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 22 2c  |GetWindowState",|
00003e80  2c 62 25 0d 12 f2 3b c8  99 20 22 57 69 6d 70 5f  |,b%...;.. "Wimp_|
00003e90  4f 70 65 6e 57 69 6e 64  6f 77 22 2c 2c 62 25 2c  |OpenWindow",,b%,|
00003ea0  26 34 42 35 33 34 31 35  34 2c 70 61 72 65 6e 74  |&4B534154,parent|
00003eb0  25 2c 66 6c 61 67 73 25  20 80 20 ac 20 31 0d 12  |%,flags% . . 1..|
00003ec0  fc 05 e1 0d 13 06 33 dd  f2 65 6d 62 65 64 77 69  |......3..embedwi|
00003ed0  6e 77 69 74 68 28 70 61  72 65 6e 74 25 2c 63 68  |nwith(parent%,ch|
00003ee0  69 6c 64 25 2c 66 6c 61  67 73 25 2c 77 69 6e 66  |ild%,flags%,winf|
00003ef0  6c 61 67 73 25 29 0d 13  10 3b 21 62 25 3d 63 68  |lags%)...;!b%=ch|
00003f00  69 6c 64 25 3a c8 99 20  22 57 69 6d 70 5f 47 65  |ild%:.. "Wimp_Ge|
00003f10  74 57 69 6e 64 6f 77 53  74 61 74 65 22 2c 2c 62  |tWindowState",,b|
00003f20  25 3a 62 25 21 33 32 3d  77 69 6e 66 6c 61 67 73  |%:b%!32=winflags|
00003f30  25 0d 13 1a 39 c8 99 20  22 57 69 6d 70 5f 4f 70  |%...9.. "Wimp_Op|
00003f40  65 6e 57 69 6e 64 6f 77  22 2c 2c 62 25 2c 26 34  |enWindow",,b%,&4|
00003f50  42 35 33 34 31 35 34 2c  70 61 72 65 6e 74 25 2c  |B534154,parent%,|
00003f60  66 6c 61 67 73 25 20 84  20 31 0d 13 24 05 e1 0d  |flags% . 1..$...|
00003f70  13 2e 20 dd f2 75 6e 65  6d 62 65 64 77 69 6e 28  |.. ..unembedwin(|
00003f80  70 61 72 65 6e 74 25 2c  63 68 69 6c 64 25 29 0d  |parent%,child%).|
00003f90  13 38 2b 21 62 25 3d 63  68 69 6c 64 25 3a c8 99  |.8+!b%=child%:..|
00003fa0  20 22 57 69 6d 70 5f 47  65 74 57 69 6e 64 6f 77  | "Wimp_GetWindow|
00003fb0  53 74 61 74 65 22 2c 2c  62 25 0d 13 42 2f c8 99  |State",,b%..B/..|
00003fc0  20 22 57 69 6d 70 5f 43  6c 6f 73 65 57 69 6e 64  | "Wimp_CloseWind|
00003fd0  6f 77 22 2c 2c 62 25 2c  26 34 42 35 33 34 31 35  |ow",,b%,&4B53415|
00003fe0  34 2c 70 61 72 65 6e 74  25 0d 13 4c 05 e1 0d 13  |4,parent%..L....|
00003ff0  56 17 dd a4 70 61 72 65  6e 74 77 69 6e 28 63 68  |V...parentwin(ch|
00004000  69 6c 64 25 29 0d 13 60  0d ea 20 70 61 72 65 6e  |ild%)..`.. paren|
00004010  74 25 0d 13 6a 42 21 62  25 3d 63 68 69 6c 64 25  |t%..jB!b%=child%|
00004020  3a c8 99 20 22 57 69 6d  70 5f 47 65 74 57 69 6e  |:.. "Wimp_GetWin|
00004030  64 6f 77 53 74 61 74 65  22 2c 2c 62 25 2c 26 34  |dowState",,b%,&4|
00004040  42 35 33 34 31 35 34 20  b8 20 2c 2c 2c 70 61 72  |B534154 . ,,,par|
00004050  65 6e 74 25 0d 13 74 0c  3d 70 61 72 65 6e 74 25  |ent%..t.=parent%|
00004060  0d 13 7e 05 3a 0d 13 88  37 f4 20 2a 2a 2a 2a 2a  |..~.:...7. *****|
00004070  2a 2a 2a 20 49 63 6f 6e  20 6d 61 6e 69 70 75 6c  |*** Icon manipul|
00004080  61 74 69 6f 6e 20 72 6f  75 74 69 6e 65 73 20 2a  |ation routines *|
00004090  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 13 92 05  |************....|
000040a0  3a 0d 13 9c 37 f4 20 46  4e 63 72 65 61 74 65 69  |:...7. FNcreatei|
000040b0  63 6f 6e 20 3a 20 43 72  65 61 74 65 20 61 6e 20  |con : Create an |
000040c0  69 63 6f 6e 20 77 69 74  68 20 73 65 74 20 70 61  |icon with set pa|
000040d0  72 61 6d 65 74 65 72 73  0d 13 a6 3c f4 20 77 69  |rameters...<. wi|
000040e0  6e 64 6f 77 2c 78 2c 79  2c 20 77 69 64 74 68 2c  |ndow,x,y, width,|
000040f0  20 68 65 69 67 68 74 2c  20 74 69 74 6c 65 2c 20  | height, title, |
00004100  76 61 6c 69 64 61 74 69  6f 6e 2c 20 63 6f 6c 6f  |validation, colo|
00004110  75 72 73 2c 0d 13 b0 1d  f4 20 45 53 47 2c 20 62  |urs,..... ESG, b|
00004120  75 74 74 6f 6e 20 74 79  70 65 2c 20 66 6c 61 67  |utton type, flag|
00004130  73 0d 13 ba 31 f4 20 63  6f 6c 20 63 6f 75 6c 64  |s...1. col could|
00004140  20 62 65 20 66 6f 6e 74  20 68 61 6e 64 6c 65 20  | be font handle |
00004150  69 66 20 75 73 65 20 66  6f 6e 74 20 69 73 20 73  |if use font is s|
00004160  65 74 0d 13 c4 42 f4 20  6f 74 68 65 72 77 69 73  |et...B. otherwis|
00004170  65 20 63 6f 6c 20 69 73  20 26 42 46 20 28 42 3d  |e col is &BF (B=|
00004180  62 61 63 6b 67 72 6f 75  6e 64 2c 20 46 3d 66 6f  |background, F=fo|
00004190  72 65 67 72 6f 75 6e 64  29 20 28 75 73 75 2e 20  |reground) (usu. |
000041a0  26 31 37 29 0d 13 ce 39  f4 20 51 75 69 63 6b 20  |&17)...9. Quick |
000041b0  66 6c 61 67 73 20 3a 20  25 41 46 56 48 42 30 30  |flags : %AFVHB00|
000041c0  20 28 41 3d 46 6f 6e 74  2c 20 46 3d 46 69 6c 6c  | (A=Font, F=Fill|
000041d0  65 64 2c 20 42 3d 42 6f  72 64 65 72 29 0d 13 d8  |ed, B=Border)...|
000041e0  0d f4 20 46 6c 61 67 73  20 3a 0d 13 e2 20 f4 20  |.. Flags :... . |
000041f0  30 20 3a 20 54 65 78 74  20 20 20 20 20 20 20 20  |0 : Text        |
00004200  20 20 20 38 20 3a 20 4e  2f 41 0d 13 ec 2c f4 20  |   8 : N/A...,. |
00004210  31 20 3a 20 53 70 72 69  74 65 20 20 20 20 20 20  |1 : Sprite      |
00004220  20 20 20 39 20 3a 20 52  69 67 68 74 20 4a 75 73  |   9 : Right Jus|
00004230  74 69 66 69 65 64 0d 13  f6 3b f4 20 32 20 3a 20  |tified...;. 2 : |
00004240  42 6f 72 64 65 72 65 64  20 20 20 20 20 20 31 30  |Bordered      10|
00004250  20 3a 20 4d 75 6c 74 69  70 6c 65 20 73 65 6c 65  | : Multiple sele|
00004260  63 74 69 6f 6e 20 77 69  74 68 20 61 64 6a 75 73  |ction with adjus|
00004270  74 0d 14 00 29 f4 20 33  20 3a 20 48 20 43 65 6e  |t...). 3 : H Cen|
00004280  74 72 65 20 20 20 20 20  20 31 31 20 3a 20 53 6d  |tre      11 : Sm|
00004290  61 6c 6c 20 73 70 72 69  74 65 0d 14 0a 1e f4 20  |all sprite..... |
000042a0  34 20 3a 20 56 20 43 65  6e 74 72 65 20 20 20 20  |4 : V Centre    |
000042b0  20 20 32 30 20 3a 20 3f  0d 14 14 25 f4 20 35 20  |  20 : ?...%. 5 |
000042c0  3a 20 46 69 6c 6c 65 64  20 20 20 20 20 20 20 20  |: Filled        |
000042d0  32 31 20 3a 20 49 6e 76  65 72 74 65 64 0d 14 1e  |21 : Inverted...|
000042e0  23 f4 20 36 20 3a 20 55  73 65 20 66 6f 6e 74 73  |#. 6 : Use fonts|
000042f0  20 20 20 20 20 32 32 20  3a 20 53 68 61 64 65 64  |     22 : Shaded|
00004300  0d 14 28 1e f4 20 37 20  3a 20 4e 2f 41 20 20 20  |..(.. 7 : N/A   |
00004310  20 20 20 20 20 20 20 20  32 33 20 3a 20 3f 0d 14  |        23 : ?..|
00004320  32 14 f4 20 42 75 74 74  6f 6e 20 74 79 70 65 73  |2.. Button types|
00004330  20 3a 0d 14 3c 17 f4 20  30 20 3a 20 49 67 6e 6f  | :..<.. 0 : Igno|
00004340  72 65 20 63 6c 69 63 6b  73 0d 14 46 1a f4 20 31  |re clicks..F.. 1|
00004350  20 3a 20 4e 6f 74 69 66  79 20 77 68 65 6e 20 6f  | : Notify when o|
00004360  76 65 72 0d 14 50 20 f4  20 32 20 3a 20 43 6c 69  |ver..P . 2 : Cli|
00004370  63 6b 73 20 72 65 70 65  61 74 20 26 20 6e 6f 74  |cks repeat & not|
00004380  69 66 79 0d 14 5a 22 f4  20 33 20 3a 20 43 6c 69  |ify..Z". 3 : Cli|
00004390  63 6b 73 20 64 65 62 6f  75 6e 63 65 20 26 20 6e  |cks debounce & n|
000043a0  6f 74 69 66 79 0d 14 64  3f f4 20 34 20 3a 20 43  |otify..d?. 4 : C|
000043b0  6c 69 63 6b 20 73 65 6c  65 63 74 73 2c 20 72 65  |lick selects, re|
000043c0  6c 65 61 73 65 20 6e 6f  74 69 66 69 65 73 2c 20  |lease notifies, |
000043d0  6f 72 20 64 65 73 65 6c  65 63 74 20 69 66 20 6d  |or deselect if m|
000043e0  6f 76 65 64 0d 14 6e 2a  f4 20 35 20 3a 20 43 6c  |oved..n*. 5 : Cl|
000043f0  69 63 6b 20 73 65 6c 65  63 74 73 2c 20 32 20 63  |ick selects, 2 c|
00004400  6c 69 63 6b 73 20 6e 6f  74 69 66 69 65 73 0d 14  |licks notifies..|
00004410  78 1c f4 20 36 20 3a 20  41 73 20 33 20 62 75 74  |x.. 6 : As 3 but|
00004420  20 77 69 6c 6c 20 64 72  61 67 0d 14 82 1c f4 20  | will drag..... |
00004430  37 20 3a 20 41 73 20 34  20 62 75 74 20 77 69 6c  |7 : As 4 but wil|
00004440  6c 20 64 72 61 67 0d 14  8c 1c f4 20 38 20 3a 20  |l drag..... 8 : |
00004450  41 73 20 35 20 62 75 74  20 77 69 6c 6c 20 64 72  |As 5 but will dr|
00004460  61 67 0d 14 96 13 f4 20  39 20 3a 20 4d 65 6e 75  |ag..... 9 : Menu|
00004470  20 69 63 6f 6e 0d 14 a0  30 f4 20 31 30 3a 20 43  | icon...0. 10: C|
00004480  6c 69 63 6b 3d 62 75 74  2a 32 35 36 2c 64 72 61  |lick=but*256,dra|
00004490  67 3d 62 75 74 2a 31 36  2c 32 20 63 6c 69 63 6b  |g=but*16,2 click|
000044a0  73 3d 62 75 74 0d 14 aa  33 f4 20 31 31 3a 20 52  |s=but...3. 11: R|
000044b0  61 64 69 6f 20 28 56 61  6c 69 64 61 74 69 6f 6e  |adio (Validation|
000044c0  20 66 6f 72 6d 61 74 20  3a 20 53 6f 70 74 6f 66  | format : Soptof|
000044d0  66 2c 6f 70 74 6f 6e 29  0d 14 b4 11 f4 20 31 32  |f,opton)..... 12|
000044e0  2f 31 33 20 3a 20 4e 2f  41 0d 14 be 27 f4 20 31  |/13 : N/A...'. 1|
000044f0  34 3a 20 57 72 69 74 65  61 62 6c 65 2f 43 6c 69  |4: Writeable/Cli|
00004500  63 6b 61 62 6c 65 2f 44  72 61 67 67 61 62 6c 65  |ckable/Draggable|
00004510  0d 14 c8 13 f4 20 31 35  3a 20 57 72 69 74 65 61  |..... 15: Writea|
00004520  62 6c 65 0d 14 d2 3d dd  a4 63 72 65 61 74 65 69  |ble...=..createi|
00004530  63 6f 6e 28 77 69 6e 2c  78 2c 79 2c 77 2c 68 2c  |con(win,x,y,w,h,|
00004540  74 69 74 6c 65 24 2c 76  61 6c 69 64 24 2c 63 6f  |title$,valid$,co|
00004550  6c 2c 65 73 67 2c 62 75  74 2c 66 6c 61 67 73 29  |l,esg,but,flags)|
00004560  0d 14 dc 24 ea 20 68 61  6e 64 6c 65 3a 74 69 74  |...$. handle:tit|
00004570  6c 65 24 3d a4 6d 73 67  74 65 78 74 28 74 69 74  |le$=.msgtext(tit|
00004580  6c 65 24 29 0d 14 e6 2e  62 25 21 30 3d 77 69 6e  |le$)....b%!0=win|
00004590  3a 62 25 21 34 3d 78 3a  62 25 21 38 3d 79 2d 68  |:b%!4=x:b%!8=y-h|
000045a0  3a 62 25 21 31 32 3d 78  2b 77 3a 62 25 21 31 36  |:b%!12=x+w:b%!16|
000045b0  3d 79 0d 14 f0 36 62 25  21 32 30 3d 28 66 6c 61  |=y...6b%!20=(fla|
000045c0  67 73 20 80 20 28 25 31  31 31 30 30 31 31 31 31  |gs . (%111001111|
000045d0  31 31 31 2b 28 31 35 3c  3c 32 30 29 29 29 2b 28  |111+(15<<20)))+(|
000045e0  63 6f 6c 3c 3c 32 34 29  0d 14 fa 1e 62 25 21 32  |col<<24)....b%!2|
000045f0  30 2b 3d 28 65 73 67 3c  3c 31 36 29 2b 28 62 75  |0+=(esg<<16)+(bu|
00004600  74 3c 3c 31 32 29 0d 15  04 2d e7 20 76 61 6c 69  |t<<12)...-. vali|
00004610  64 24 3c 3e 22 22 20 84  20 a9 28 74 69 74 6c 65  |d$<>"" . .(title|
00004620  24 29 3e 31 31 20 84 20  74 69 74 6c 65 24 3d bd  |$)>11 . title$=.|
00004630  30 20 8c 0d 15 0e 12 20  e7 20 74 69 74 6c 65 24  |0 ..... . title$|
00004640  3d bd 30 20 8c 0d 15 18  29 20 20 62 25 21 32 34  |=.0 ....)  b%!24|
00004650  3d a4 69 6e 64 69 72 65  63 74 28 c4 32 35 35 2c  |=.indirect(.255,|
00004660  bd 30 29 29 3a 62 25 21  33 32 3d 32 35 36 0d 15  |.0)):b%!32=256..|
00004670  22 06 20 cc 0d 15 2c 2f  20 20 62 25 21 32 34 3d  |". ...,/  b%!24=|
00004680  a4 69 6e 64 69 72 65 63  74 28 74 69 74 6c 65 24  |.indirect(title$|
00004690  29 3a 62 25 21 33 32 3d  a9 28 74 69 74 6c 65 24  |):b%!32=.(title$|
000046a0  29 2b 31 0d 15 36 06 20  cd 0d 15 40 28 20 62 25  |)+1..6. ...@( b%|
000046b0  21 32 38 3d a4 69 6e 64  69 72 65 63 74 28 76 61  |!28=.indirect(va|
000046c0  6c 69 64 24 29 3a 62 25  21 32 30 2b 3d 31 3c 3c  |lid$):b%!20+=1<<|
000046d0  38 0d 15 4a 05 cc 0d 15  54 14 20 24 28 62 25 2b  |8..J....T. $(b%+|
000046e0  32 34 29 3d 74 69 74 6c  65 24 0d 15 5e 05 cd 0d  |24)=title$..^...|
000046f0  15 68 55 e7 20 28 28 62  25 21 32 30 29 20 80 20  |.hU. ((b%!20) . |
00004700  26 31 30 33 29 3d 26 33  20 8c 85 20 26 38 30 33  |&103)=&3 .. &803|
00004710  2c 22 43 61 6e 6e 6f 74  20 6d 61 6b 65 20 61 20  |,"Cannot make a |
00004720  73 70 72 69 74 65 2f 74  65 78 74 20 69 63 6f 6e  |sprite/text icon|
00004730  20 77 69 74 68 6f 75 74  20 76 61 6c 69 64 61 74  | without validat|
00004740  69 6f 6e 22 0d 15 72 1d  e7 20 28 66 6c 61 67 73  |ion"..r.. (flags|
00004750  20 80 20 33 29 3d 30 20  8c 62 25 21 32 30 2b 3d  | . 3)=0 .b%!20+=|
00004760  31 0d 15 7c 2e e7 20 a4  6c 6f 77 65 72 28 c0 76  |1..|.. .lower(.v|
00004770  61 6c 69 64 24 2c 31 29  29 3d 22 73 22 20 8c 20  |alid$,1))="s" . |
00004780  62 25 21 32 30 3d 62 25  21 32 30 20 84 20 32 0d  |b%!20=b%!20 . 2.|
00004790  15 86 25 c8 99 20 22 57  69 6d 70 5f 43 72 65 61  |..%.. "Wimp_Crea|
000047a0  74 65 49 63 6f 6e 22 2c  2c 62 25 20 b8 20 68 61  |teIcon",,b% . ha|
000047b0  6e 64 6c 65 0d 15 90 0b  3d 68 61 6e 64 6c 65 0d  |ndle....=handle.|
000047c0  15 9a 05 3a 0d 15 a4 36  f4 20 50 52 4f 43 64 65  |...:...6. PROCde|
000047d0  6c 65 74 65 69 63 6f 6e  20 3a 20 44 65 6c 65 74  |leteicon : Delet|
000047e0  65 20 74 68 65 20 69 63  6f 6e 20 66 72 6f 6d 20  |e the icon from |
000047f0  74 68 65 20 77 69 6e 64  6f 77 0d 15 ae 1a dd f2  |the window......|
00004800  64 65 6c 65 74 65 69 63  6f 6e 28 77 69 6e 2c 69  |deleteicon(win,i|
00004810  63 6f 6e 29 0d 15 b8 2e  21 62 25 3d 77 69 6e 3a  |con)....!b%=win:|
00004820  62 25 21 34 3d 69 63 6f  6e 3a c8 99 20 22 57 69  |b%!4=icon:.. "Wi|
00004830  6d 70 5f 44 65 6c 65 74  65 49 63 6f 6e 22 2c 2c  |mp_DeleteIcon",,|
00004840  62 25 0d 15 c2 05 e1 0d  15 cc 05 3a 0d 15 d6 3b  |b%.........:...;|
00004850  f4 20 46 4e 43 72 65 61  74 65 49 63 6f 6e 42 61  |. FNCreateIconBa|
00004860  72 49 63 6f 6e 20 3a 20  43 72 65 61 74 65 20 61  |rIcon : Create a|
00004870  6e 20 69 63 6f 6e 20 66  6f 72 20 74 68 65 20 69  |n icon for the i|
00004880  63 6f 6e 20 62 61 72 0d  15 e0 23 f4 20 49 63 6f  |con bar...#. Ico|
00004890  6e 2d 62 61 72 20 70 6f  73 69 74 69 6f 6e 73 20  |n-bar positions |
000048a0  28 6c 6f 77 20 62 79 74  65 29 0d 15 ea 19 f4 20  |(low byte)..... |
000048b0  31 20 3d 20 72 69 67 68  74 2c 20 32 20 3d 20 6c  |1 = right, 2 = l|
000048c0  65 66 74 0d 15 f4 2b f4  20 33 20 3d 20 6c 65 66  |eft...+. 3 = lef|
000048d0  74 20 72 65 6c 61 74 69  76 65 20 74 6f 20 28 68  |t relative to (h|
000048e0  69 67 68 20 62 79 74 65  29 20 69 63 6f 6e 0d 15  |igh byte) icon..|
000048f0  fe 2c f4 20 34 20 3d 20  72 69 67 68 74 20 72 65  |.,. 4 = right re|
00004900  6c 61 74 69 76 65 20 74  6f 20 28 68 69 67 68 20  |lative to (high |
00004910  62 79 74 65 29 20 69 63  6f 6e 0d 16 08 38 f4 20  |byte) icon...8. |
00004920  35 20 3d 20 6c 65 66 74  2c 20 68 69 67 68 20 70  |5 = left, high p|
00004930  72 69 6f 72 69 74 79 20  28 68 69 67 68 20 62 79  |riority (high by|
00004940  74 65 3d 70 72 69 6f 72  69 74 79 20 76 61 6c 75  |te=priority valu|
00004950  65 29 0d 16 12 24 f4 20  36 20 3d 20 6c 65 66 74  |e)...$. 6 = left|
00004960  2c 20 6c 6f 77 20 70 72  69 6f 72 69 74 79 20 28  |, low priority (|
00004970  64 69 74 74 6f 29 0d 16  1c 25 f4 20 37 20 3d 20  |ditto)...%. 7 = |
00004980  72 69 67 68 74 2c 20 6c  6f 77 20 70 72 69 6f 72  |right, low prior|
00004990  69 74 79 20 28 64 69 74  74 6f 29 0d 16 26 26 f4  |ity (ditto)..&&.|
000049a0  20 38 20 3d 20 72 69 67  68 74 2c 20 68 69 67 68  | 8 = right, high|
000049b0  20 70 72 69 6f 72 69 74  79 20 28 64 69 74 74 6f  | priority (ditto|
000049c0  29 0d 16 30 38 dd a4 43  72 65 61 74 65 49 63 6f  |)..08..CreateIco|
000049d0  6e 42 61 72 49 63 6f 6e  28 53 70 72 24 2c 74 69  |nBarIcon(Spr$,ti|
000049e0  74 6c 65 24 2c 70 6f 73  25 29 3a ea 20 69 63 25  |tle$,pos%):. ic%|
000049f0  2c 77 25 2c 6d 25 2c 65  25 0d 16 3a 31 74 69 74  |,w%,m%,e%..:1tit|
00004a00  6c 65 24 3d a4 6d 73 67  74 65 78 74 28 74 69 74  |le$=.msgtext(tit|
00004a10  6c 65 24 29 3a 62 25 21  30 3d 2d 28 94 28 70 6f  |le$):b%!0=-(.(po|
00004a20  73 25 29 20 80 20 26 46  46 29 0d 16 44 32 62 25  |s%) . &FF)..D2b%|
00004a30  21 34 3d 30 3a 62 25 21  38 3d 2d 31 36 3a 62 25  |!4=0:b%!8=-16:b%|
00004a40  21 31 32 3d 31 32 2b 31  36 2a a9 28 74 69 74 6c  |!12=12+16*.(titl|
00004a50  65 24 29 3a 62 25 21 31  36 3d 38 38 0d 16 4e 22  |e$):b%!16=88..N"|
00004a60  e7 62 25 21 31 32 3c 31  32 2b 31 36 2a 34 20 8c  |.b%!12<12+16*4 .|
00004a70  20 62 25 21 31 32 3d 31  32 2b 31 36 2a 34 0d 16  | b%!12=12+16*4..|
00004a80  58 12 e7 20 74 69 74 6c  65 24 3c 3e 22 22 20 8c  |X.. title$<>"" .|
00004a90  0d 16 62 32 20 62 25 21  32 30 3d 28 31 3c 3c 32  |..b2 b%!20=(1<<2|
00004aa0  38 29 2b 28 37 3c 3c 32  34 29 2b 28 33 3c 3c 31  |8)+(7<<24)+(3<<1|
00004ab0  32 29 2b 28 25 30 31 30  31 31 29 2b 28 31 3c 3c  |2)+(%01011)+(1<<|
00004ac0  38 29 0d 16 6c 1c 20 62  25 21 32 34 3d a4 69 6e  |8)..l. b%!24=.in|
00004ad0  64 69 72 65 63 74 28 74  69 74 6c 65 24 29 0d 16  |direct(title$)..|
00004ae0  76 1e 20 62 25 21 32 38  3d a4 69 6e 64 69 72 65  |v. b%!28=.indire|
00004af0  63 74 28 22 53 22 2b 53  70 72 24 29 0d 16 80 16  |ct("S"+Spr$)....|
00004b00  20 62 25 21 33 32 3d a9  28 74 69 74 6c 65 24 29  | b%!32=.(title$)|
00004b10  2b 31 0d 16 8a 05 cc 0d  16 94 2b 20 62 25 21 32  |+1........+ b%!2|
00004b20  30 3d 28 31 3c 3c 32 38  29 2b 28 37 3c 3c 32 34  |0=(1<<28)+(7<<24|
00004b30  29 2b 28 33 3c 3c 31 32  29 2b 28 25 31 31 30 31  |)+(3<<12)+(%1101|
00004b40  30 29 0d 16 9e 12 20 24  28 62 25 2b 32 34 29 3d  |0).... $(b%+24)=|
00004b50  53 70 72 24 0d 16 a8 05  cd 0d 16 b2 3c c8 99 20  |Spr$........<.. |
00004b60  22 57 69 6d 70 5f 53 70  72 69 74 65 4f 70 22 2c  |"Wimp_SpriteOp",|
00004b70  26 31 32 38 2c 2c c0 53  70 72 24 2c a7 53 70 72  |&128,,.Spr$,.Spr|
00004b80  24 2b 22 2c 22 2c 22 2c  22 29 29 20 b8 2c 2c 2c  |$+",",",")) .,,,|
00004b90  77 25 2c 6d 25 0d 16 bc  37 c8 99 20 22 58 4f 53  |w%,m%...7.. "XOS|
00004ba0  5f 52 65 61 64 4d 6f 64  65 56 61 72 69 61 62 6c  |_ReadModeVariabl|
00004bb0  65 22 2c 6d 25 2c 34 20  b8 20 2c 2c 65 25 3a 77  |e",m%,4 . ,,e%:w|
00004bc0  25 3d 28 77 25 2b 31 29  3c 3c 65 25 0d 16 c6 18  |%=(w%+1)<<e%....|
00004bd0  e7 20 77 25 3e 62 25 21  31 32 20 8c 62 25 21 31  |. w%>b%!12 .b%!1|
00004be0  32 3d 77 25 0d 16 d0 54  e7 20 28 94 28 70 6f 73  |2=w%...T. (.(pos|
00004bf0  25 29 80 26 46 46 29 3d  33 20 84 20 28 94 28 70  |%).&FF)=3 . (.(p|
00004c00  6f 73 25 29 80 26 46 46  29 3d 34 20 8c 70 6f 73  |os%).&FF)=4 .pos|
00004c10  25 3d 94 28 70 6f 73 25  29 3e 3e 38 20 8b 70 6f  |%=.(pos%)>>8 .po|
00004c20  73 25 3d 28 94 28 70 6f  73 25 29 20 80 20 26 46  |s%=(.(pos%) . &F|
00004c30  46 30 30 29 3c 3c 31 36  0d 16 da 26 c8 99 20 22  |F00)<<16...&.. "|
00004c40  57 69 6d 70 5f 43 72 65  61 74 65 49 63 6f 6e 22  |Wimp_CreateIcon"|
00004c50  2c 70 6f 73 25 2c 62 25  20 b8 20 69 63 25 0d 16  |,pos%,b% . ic%..|
00004c60  e4 08 3d 69 63 25 0d 16  ee 05 3a 0d 16 f8 40 f4  |..=ic%....:...@.|
00004c70  20 46 4e 67 65 74 69 63  6f 6e 73 74 61 74 65 20  | FNgeticonstate |
00004c80  3a 20 52 65 74 75 72 6e  20 2d 31 20 69 66 20 69  |: Return -1 if i|
00004c90  63 6f 6e 20 69 73 20 73  65 6c 65 63 74 65 64 2c  |con is selected,|
00004ca0  30 20 6f 74 68 65 72 77  69 73 65 0d 17 02 1f dd  |0 otherwise.....|
00004cb0  20 a4 67 65 74 69 63 6f  6e 73 74 61 74 65 28 77  | .geticonstate(w|
00004cc0  69 6e 25 2c 69 63 6f 6e  25 29 0d 17 0c 32 21 62  |in%,icon%)...2!b|
00004cd0  25 3d 77 69 6e 25 3a 62  25 21 34 3d 69 63 6f 6e  |%=win%:b%!4=icon|
00004ce0  25 3a c8 99 20 22 57 69  6d 70 5f 47 65 74 49 63  |%:.. "Wimp_GetIc|
00004cf0  6f 6e 53 74 61 74 65 22  2c 2c 62 25 0d 17 16 16  |onState",,b%....|
00004d00  3d 28 62 25 21 32 34 3e  3e 32 31 20 80 20 31 29  |=(b%!24>>21 . 1)|
00004d10  3e 30 0d 17 20 05 3a 0d  17 2a 33 f4 20 50 52 4f  |>0.. .:..*3. PRO|
00004d20  43 69 63 6f 6e 73 68 61  64 65 20 20 3a 20 75 6e  |Ciconshade  : un|
00004d30  73 68 61 64 65 2f 73 68  61 64 65 2f 74 6f 67 67  |shade/shade/togg|
00004d40  6c 65 20 61 6e 20 69 63  6f 6e 0d 17 34 35 f4 20  |le an icon..45. |
00004d50  50 52 4f 43 69 63 6f 6e  73 74 61 74 65 20 20 3a  |PROCiconstate  :|
00004d60  20 75 6e 73 65 6c 65 63  74 2f 73 65 6c 65 63 74  | unselect/select|
00004d70  2f 74 6f 67 67 6c 65 20  61 6e 20 69 63 6f 6e 0d  |/toggle an icon.|
00004d80  17 3e 38 f4 20 50 52 4f  43 73 65 74 69 63 6f 6e  |.>8. PROCseticon|
00004d90  62 69 74 20 3a 20 73 65  74 2f 75 6e 73 65 74 2f  |bit : set/unset/|
00004da0  74 6f 67 67 6c 65 20 61  20 62 69 74 20 69 6e 20  |toggle a bit in |
00004db0  61 6e 20 69 63 6f 6e 0d  17 48 21 dd f2 69 63 6f  |an icon..H!..ico|
00004dc0  6e 73 68 61 64 65 28 77  69 6e 25 2c 69 63 6f 6e  |nshade(win%,icon|
00004dd0  25 2c 74 79 70 65 25 29  0d 17 52 24 f2 73 65 74  |%,type%)..R$.set|
00004de0  69 63 6f 6e 62 69 74 28  77 69 6e 25 2c 69 63 6f  |iconbit(win%,ico|
00004df0  6e 25 2c 32 32 2c 74 79  70 65 25 29 0d 17 5c 05  |n%,22,type%)..\.|
00004e00  e1 0d 17 66 21 dd f2 69  63 6f 6e 73 74 61 74 65  |...f!..iconstate|
00004e10  28 77 69 6e 25 2c 69 63  6f 6e 25 2c 74 79 70 65  |(win%,icon%,type|
00004e20  25 29 0d 17 70 24 f2 73  65 74 69 63 6f 6e 62 69  |%)..p$.seticonbi|
00004e30  74 28 77 69 6e 25 2c 69  63 6f 6e 25 2c 32 31 2c  |t(win%,icon%,21,|
00004e40  74 79 70 65 25 29 0d 17  7a 05 e1 0d 17 84 19 f4  |type%)..z.......|
00004e50  20 74 79 70 65 20 3d 20  30 20 66 6f 72 20 75 6e  | type = 0 for un|
00004e60  74 69 63 6b 0d 17 8e 21  f4 20 74 79 70 65 20 3d  |tick...!. type =|
00004e70  20 31 20 66 6f 72 20 74  69 63 6b 20 28 61 6c 73  | 1 for tick (als|
00004e80  6f 20 2d 31 29 0d 17 98  19 f4 20 74 79 70 65 20  |o -1)..... type |
00004e90  3d 20 32 20 66 6f 72 20  74 6f 67 67 6c 65 0d 17  |= 2 for toggle..|
00004ea0  a2 27 dd f2 73 65 74 69  63 6f 6e 62 69 74 28 77  |.'..seticonbit(w|
00004eb0  69 6e 25 2c 69 63 6f 6e  25 2c 62 69 74 25 2c 74  |in%,icon%,bit%,t|
00004ec0  79 70 65 25 29 0d 17 ac  0b ea 20 73 25 2c 74 25  |ype%)..... s%,t%|
00004ed0  0d 17 b6 0e c8 8e 20 74  79 70 65 25 20 ca 0d 17  |...... type% ...|
00004ee0  c0 1e 20 c9 20 30 3a 73  25 3d 30 3c 3c 62 69 74  |.. . 0:s%=0<<bit|
00004ef0  25 3a 74 25 3d 31 3c 3c  62 69 74 25 0d 17 ca 21  |%:t%=1<<bit%...!|
00004f00  20 c9 20 2d 31 2c 31 3a  73 25 3d 31 3c 3c 62 69  | . -1,1:s%=1<<bi|
00004f10  74 25 3a 74 25 3d 31 3c  3c 62 69 74 25 0d 17 d4  |t%:t%=1<<bit%...|
00004f20  1e 20 c9 20 32 3a 73 25  3d 31 3c 3c 62 69 74 25  |. . 2:s%=1<<bit%|
00004f30  3a 74 25 3d 30 3c 3c 62  69 74 25 0d 17 de 05 cb  |:t%=0<<bit%.....|
00004f40  0d 17 e8 29 62 25 21 30  3d 77 69 6e 25 3a 62 25  |...)b%!0=win%:b%|
00004f50  21 34 3d 69 63 6f 6e 25  3a 62 25 21 38 3d 73 25  |!4=icon%:b%!8=s%|
00004f60  3a 62 25 21 31 32 3d 74  25 0d 17 f2 1e c8 99 20  |:b%!12=t%...... |
00004f70  22 57 69 6d 70 5f 53 65  74 49 63 6f 6e 53 74 61  |"Wimp_SetIconSta|
00004f80  74 65 22 2c 2c 62 25 0d  17 fc 05 e1 0d 18 06 05  |te",,b%.........|
00004f90  3a 0d 18 10 39 f4 20 50  52 4f 43 70 72 65 73 73  |:...9. PROCpress|
00004fa0  69 63 6f 6e 20 20 3a 20  4d 61 6b 65 20 74 68 65  |icon  : Make the|
00004fb0  20 69 63 6f 6e 20 70 72  65 73 73 65 64 20 61 6e  | icon pressed an|
00004fc0  64 20 72 65 6c 65 61 73  65 64 0d 18 1a 33 f4 20  |d released...3. |
00004fd0  50 52 4f 43 72 65 64 72  61 77 69 63 6f 6e 20 3a  |PROCredrawicon :|
00004fe0  20 46 6f 72 63 65 20 74  68 65 20 72 65 64 72 61  | Force the redra|
00004ff0  77 20 6f 66 20 74 68 65  20 69 63 6f 6e 0d 18 24  |w of the icon..$|
00005000  1b dd f2 70 72 65 73 73  69 63 6f 6e 28 77 69 6e  |...pressicon(win|
00005010  25 2c 69 63 6f 6e 25 29  0d 18 2e 25 ea 20 74 25  |%,icon%)...%. t%|
00005020  3a f2 73 65 74 69 63 6f  6e 62 69 74 28 77 69 6e  |:.seticonbit(win|
00005030  25 2c 69 63 6f 6e 25 2c  32 31 2c 31 29 0d 18 38  |%,icon%,21,1)..8|
00005040  30 74 25 3d 91 3a f5 3a  fd 91 3e 74 25 2b 31 35  |0t%=.:.:..>t%+15|
00005050  3a f2 73 65 74 69 63 6f  6e 62 69 74 28 77 69 6e  |:.seticonbit(win|
00005060  25 2c 69 63 6f 6e 25 2c  32 31 2c 30 29 0d 18 42  |%,icon%,21,0)..B|
00005070  05 e1 0d 18 4c 1c dd f2  72 65 64 72 61 77 69 63  |....L...redrawic|
00005080  6f 6e 28 77 69 6e 25 2c  69 63 6f 6e 25 29 0d 18  |on(win%,icon%)..|
00005090  56 40 77 69 6e 25 2b 3d  77 69 6e 25 3d 2d 31 3a  |V@win%+=win%=-1:|
000050a0  21 62 25 3d 77 69 6e 25  3a 62 25 21 34 3d 69 63  |!b%=win%:b%!4=ic|
000050b0  6f 6e 25 3a c8 99 20 22  57 69 6d 70 5f 47 65 74  |on%:.. "Wimp_Get|
000050c0  49 63 6f 6e 53 74 61 74  65 22 2c 2c 62 25 0d 18  |IconState",,b%..|
000050d0  60 35 c8 99 20 22 57 69  6d 70 5f 46 6f 72 63 65  |`5.. "Wimp_Force|
000050e0  52 65 64 72 61 77 22 2c  77 69 6e 25 2c 62 25 21  |Redraw",win%,b%!|
000050f0  38 2c 62 25 21 31 32 2c  62 25 21 31 36 2c 62 25  |8,b%!12,b%!16,b%|
00005100  21 32 30 0d 18 6a 05 e1  0d 18 74 05 3a 0d 18 7e  |!20..j....t.:..~|
00005110  3c f4 20 46 4e 67 65 74  69 63 6f 6e 74 65 78 74  |<. FNgeticontext|
00005120  20 20 20 3a 20 72 65 74  75 72 6e 20 69 63 6f 6e  |   : return icon|
00005130  73 20 74 65 78 74 20 73  74 72 69 6e 67 20 28 6f  |s text string (o|
00005140  72 20 73 70 72 69 74 65  29 0d 18 88 39 f4 20 50  |r sprite)...9. P|
00005150  52 4f 43 73 65 74 69 63  6f 6e 74 65 78 74 20 3a  |ROCseticontext :|
00005160  20 73 65 74 20 69 63 6f  6e 73 20 74 65 78 74 20  | set icons text |
00005170  73 74 72 69 6e 67 20 28  6f 72 20 73 70 72 69 74  |string (or sprit|
00005180  65 29 0d 18 92 1d dd a4  67 65 74 69 63 6f 6e 74  |e)......geticont|
00005190  65 78 74 28 77 69 6e 25  2c 69 63 6f 6e 25 29 0d  |ext(win%,icon%).|
000051a0  18 9c 33 62 25 21 30 3d  77 69 6e 25 3a 62 25 21  |..3b%!0=win%:b%!|
000051b0  34 3d 69 63 6f 6e 25 3a  c8 99 20 22 57 69 6d 70  |4=icon%:.. "Wimp|
000051c0  5f 47 65 74 49 63 6f 6e  53 74 61 74 65 22 2c 2c  |_GetIconState",,|
000051d0  62 25 0d 18 a6 2a e7 20  28 28 62 25 21 32 34 29  |b%...*. ((b%!24)|
000051e0  20 80 20 26 31 30 30 29  3d 30 20 8c 3d a4 73 74  | . &100)=0 .=.st|
000051f0  72 69 6e 67 30 28 62 25  2b 32 38 29 0d 18 b0 14  |ring0(b%+28)....|
00005200  3d a4 73 74 72 69 6e 67  30 28 62 25 21 32 38 29  |=.string0(b%!28)|
00005210  0d 18 ba 28 dd f2 73 65  74 69 63 6f 6e 74 65 78  |...(..seticontex|
00005220  74 28 77 69 6e 25 2c 69  63 6f 6e 25 2c 74 65 78  |t(win%,icon%,tex|
00005230  74 24 29 3a ea 20 69 25  0d 18 c4 38 74 65 78 74  |t$):. i%...8text|
00005240  24 3d a4 6d 73 67 74 65  78 74 28 74 65 78 74 24  |$=.msgtext(text$|
00005250  29 3a c8 99 20 22 57 69  6d 70 5f 47 65 74 43 61  |):.. "Wimp_GetCa|
00005260  72 65 74 50 6f 73 69 74  69 6f 6e 22 2c 2c 62 25  |retPosition",,b%|
00005270  0d 18 ce 20 69 25 3d 28  21 62 25 3d 77 69 6e 25  |... i%=(!b%=win%|
00005280  29 20 80 20 28 69 63 6f  6e 25 3d 62 25 21 34 29  |) . (icon%=b%!4)|
00005290  0d 18 d8 33 62 25 21 30  3d 77 69 6e 25 3a 62 25  |...3b%!0=win%:b%|
000052a0  21 34 3d 69 63 6f 6e 25  3a c8 99 20 22 57 69 6d  |!4=icon%:.. "Wim|
000052b0  70 5f 47 65 74 49 63 6f  6e 53 74 61 74 65 22 2c  |p_GetIconState",|
000052c0  2c 62 25 0d 18 e2 47 e7  20 28 28 62 25 21 32 34  |,b%...G. ((b%!24|
000052d0  29 20 80 20 26 31 30 30  29 3d 30 20 8c 20 85 20  |) . &100)=0 . . |
000052e0  26 38 30 33 2c 22 49 63  6f 6e 20 69 73 6e 27 74  |&803,"Icon isn't|
000052f0  20 69 6e 64 69 72 65 63  74 65 64 20 28 23 22 2b  | indirected (#"+|
00005300  c3 69 63 6f 6e 25 2b 22  29 22 0d 18 ec 1e e7 20  |.icon%+")"..... |
00005310  a4 73 74 72 69 6e 67 30  28 62 25 21 32 38 29 3c  |.string0(b%!28)<|
00005320  3e 74 65 78 74 24 20 8c  0d 18 f6 54 20 e7 20 a9  |>text$ ....T . .|
00005330  28 74 65 78 74 24 29 3c  62 25 21 33 36 20 8c 24  |(text$)<b%!36 .$|
00005340  28 62 25 21 32 38 29 3d  74 65 78 74 24 20 8b 85  |(b%!28)=text$ ..|
00005350  20 26 38 30 33 2c 22 54  65 78 74 20 74 6f 6f 20  | &803,"Text too |
00005360  6c 6f 6e 67 20 66 6f 72  20 69 63 6f 6e 20 28 23  |long for icon (#|
00005370  22 2b c3 69 63 6f 6e 25  2b 22 29 22 0d 19 00 42  |"+.icon%+")"...B|
00005380  20 21 62 25 3d 77 69 6e  25 3a 62 25 21 34 3d 69  | !b%=win%:b%!4=i|
00005390  63 6f 6e 25 3a 62 25 21  38 3d 30 3a 62 25 21 31  |con%:b%!8=0:b%!1|
000053a0  32 3d 30 3a c8 99 20 22  57 69 6d 70 5f 53 65 74  |2=0:.. "Wimp_Set|
000053b0  49 63 6f 6e 53 74 61 74  65 22 2c 2c 62 25 0d 19  |IconState",,b%..|
000053c0  0a 52 20 e7 20 69 25 20  80 20 28 62 25 21 32 34  |.R . i% . (b%!24|
000053d0  20 80 20 31 29 3d 31 20  8c c8 99 20 22 57 69 6d  | . 1)=1 ... "Wim|
000053e0  70 5f 53 65 74 43 61 72  65 74 50 6f 73 69 74 69  |p_SetCaretPositi|
000053f0  6f 6e 22 2c 77 69 6e 25  2c 69 63 6f 6e 25 2c 2d  |on",win%,icon%,-|
00005400  31 2c 2d 31 2c 2d 31 2c  a9 28 74 65 78 74 24 29  |1,-1,-1,.(text$)|
00005410  0d 19 14 05 cd 0d 19 1e  05 e1 0d 19 28 05 3a 0d  |............(.:.|
00005420  19 32 37 f4 20 46 4e 67  65 74 69 63 6f 6e 76 61  |.27. FNgeticonva|
00005430  6c 69 64 20 20 20 3a 20  72 65 74 75 72 6e 20 69  |lid   : return i|
00005440  63 6f 6e 73 20 76 61 6c  69 64 61 74 69 6f 6e 20  |cons validation |
00005450  73 74 72 69 6e 67 0d 19  3c 34 f4 20 50 52 4f 43  |string..<4. PROC|
00005460  73 65 74 69 63 6f 6e 76  61 6c 69 64 20 3a 20 73  |seticonvalid : s|
00005470  65 74 20 69 63 6f 6e 73  20 76 61 6c 69 64 61 74  |et icons validat|
00005480  69 6f 6e 20 73 74 72 69  6e 67 0d 19 46 3d f4 20  |ion string..F=. |
00005490  52 65 6d 65 6d 62 65 72  20 6e 6f 74 20 74 6f 20  |Remember not to |
000054a0  65 78 63 65 65 64 20 74  68 65 20 6f 72 69 67 69  |exceed the origi|
000054b0  6e 61 6c 20 76 61 6c 69  64 61 74 69 6f 6e 20 73  |nal validation s|
000054c0  74 72 69 6e 67 27 73 0d  19 50 0d f4 20 6c 65 6e  |tring's..P.. len|
000054d0  67 74 68 2e 0d 19 5a 1e  dd a4 67 65 74 69 63 6f  |gth...Z...getico|
000054e0  6e 76 61 6c 69 64 28 77  69 6e 25 2c 69 63 6f 6e  |nvalid(win%,icon|
000054f0  25 29 0d 19 64 33 62 25  21 30 3d 77 69 6e 25 3a  |%)..d3b%!0=win%:|
00005500  62 25 21 34 3d 69 63 6f  6e 25 3a c8 99 20 22 57  |b%!4=icon%:.. "W|
00005510  69 6d 70 5f 47 65 74 49  63 6f 6e 53 74 61 74 65  |imp_GetIconState|
00005520  22 2c 2c 62 25 0d 19 6e  45 e7 20 28 28 62 25 21  |",,b%..nE. ((b%!|
00005530  32 34 29 20 80 20 26 31  30 30 29 3d 30 20 85 20  |24) . &100)=0 . |
00005540  26 38 30 33 2c 22 49 63  6f 6e 20 69 73 6e 27 74  |&803,"Icon isn't|
00005550  20 69 6e 64 69 72 65 63  74 65 64 20 28 23 22 2b  | indirected (#"+|
00005560  c3 69 63 6f 6e 25 2b 22  29 22 0d 19 78 14 3d a4  |.icon%+")"..x.=.|
00005570  73 74 72 69 6e 67 30 28  62 25 21 33 32 29 0d 19  |string0(b%!32)..|
00005580  82 24 dd f2 73 65 74 69  63 6f 6e 76 61 6c 69 64  |.$..seticonvalid|
00005590  28 77 69 6e 25 2c 69 63  6f 6e 25 2c 74 65 78 74  |(win%,icon%,text|
000055a0  24 29 0d 19 8c 33 62 25  21 30 3d 77 69 6e 25 3a  |$)...3b%!0=win%:|
000055b0  62 25 21 34 3d 69 63 6f  6e 25 3a c8 99 20 22 57  |b%!4=icon%:.. "W|
000055c0  69 6d 70 5f 47 65 74 49  63 6f 6e 53 74 61 74 65  |imp_GetIconState|
000055d0  22 2c 2c 62 25 0d 19 96  47 e7 20 28 28 62 25 21  |",,b%...G. ((b%!|
000055e0  32 34 29 20 80 20 26 31  30 30 29 3d 30 20 8c 20  |24) . &100)=0 . |
000055f0  85 20 26 38 30 33 2c 22  49 63 6f 6e 20 69 73 6e  |. &803,"Icon isn|
00005600  27 74 20 69 6e 64 69 72  65 63 74 65 64 20 28 23  |'t indirected (#|
00005610  22 2b c3 69 63 6f 6e 25  2b 22 29 22 0d 19 a0 2a  |"+.icon%+")"...*|
00005620  24 28 62 25 21 33 32 29  3d 74 65 78 74 24 3a f2  |$(b%!32)=text$:.|
00005630  72 65 64 72 61 77 69 63  6f 6e 28 77 69 6e 25 2c  |redrawicon(win%,|
00005640  69 63 6f 6e 25 29 0d 19  aa 05 e1 0d 19 b4 05 3a  |icon%).........:|
00005650  0d 19 be 25 f4 20 50 52  4f 43 64 72 61 67 69 63  |...%. PROCdragic|
00005660  6f 6e 20 3a 20 53 74 61  72 74 20 61 20 64 72 61  |on : Start a dra|
00005670  67 20 62 6f 78 0d 19 c8  43 f4 20 62 6f 75 6e 64  |g box...C. bound|
00005680  25 20 73 68 6f 75 6c 64  20 62 65 20 54 52 55 45  |% should be TRUE|
00005690  20 69 66 20 79 6f 75 20  77 69 73 68 20 74 68 65  | if you wish the|
000056a0  20 69 63 6f 6e 20 74 6f  20 73 74 61 79 20 77 69  | icon to stay wi|
000056b0  74 68 69 6e 20 74 68 65  0d 19 d2 0c f4 20 77 69  |thin the..... wi|
000056c0  6e 64 6f 77 0d 19 dc 21  dd f2 64 72 61 67 69 63  |ndow...!..dragic|
000056d0  6f 6e 28 77 69 6e 25 2c  69 63 6f 6e 25 2c 62 6f  |on(win%,icon%,bo|
000056e0  75 6e 64 25 29 0d 19 e6  29 21 62 25 3d 77 69 6e  |und%)...)!b%=win|
000056f0  25 3a c8 99 20 22 57 69  6d 70 5f 47 65 74 57 69  |%:.. "Wimp_GetWi|
00005700  6e 64 6f 77 53 74 61 74  65 22 2c 2c 62 25 0d 19  |ndowState",,b%..|
00005710  f0 17 73 78 25 3d 62 25  21 32 30 3a 73 79 25 3d  |..sx%=b%!20:sy%=|
00005720  62 25 21 32 34 0d 19 fa  39 78 30 25 3d 62 25 21  |b%!24...9x0%=b%!|
00005730  34 2d 73 78 25 3a 79 30  25 3d 62 25 21 38 2d 73  |4-sx%:y0%=b%!8-s|
00005740  79 25 3a 78 31 25 3d 62  25 21 31 32 2d 73 78 25  |y%:x1%=b%!12-sx%|
00005750  3a 79 31 25 3d 62 25 21  31 36 2d 73 79 25 0d 1a  |:y1%=b%!16-sy%..|
00005760  04 32 21 62 25 3d 77 69  6e 25 3a 62 25 21 34 3d  |.2!b%=win%:b%!4=|
00005770  69 63 6f 6e 25 3a c8 99  20 22 57 69 6d 70 5f 47  |icon%:.. "Wimp_G|
00005780  65 74 49 63 6f 6e 53 74  61 74 65 22 2c 2c 62 25  |etIconState",,b%|
00005790  0d 1a 0e 2e 62 25 21 38  2b 3d 78 30 25 3a 62 25  |....b%!8+=x0%:b%|
000057a0  21 31 32 2b 3d 79 31 25  3a 62 25 21 31 36 2b 3d  |!12+=y1%:b%!16+=|
000057b0  78 30 25 3a 62 25 21 32  30 2b 3d 79 31 25 0d 1a  |x0%:b%!20+=y1%..|
000057c0  18 10 e7 20 62 6f 75 6e  64 25 3d b9 20 8c 0d 1a  |... bound%=. ...|
000057d0  22 3c 20 62 25 21 32 34  3d 78 30 25 2b 73 78 25  |"< b%!24=x0%+sx%|
000057e0  3a 62 25 21 32 38 3d 79  30 25 2b 73 79 25 3a 62  |:b%!28=y0%+sy%:b|
000057f0  25 21 33 32 3d 78 31 25  2b 73 78 25 3a 62 25 21  |%!32=x1%+sx%:b%!|
00005800  33 36 3d 79 31 25 2b 73  79 25 0d 1a 2c 05 cc 0d  |36=y1%+sy%..,...|
00005810  1a 36 2f 20 62 25 21 34  30 3d 34 3a 62 25 21 34  |.6/ b%!40=4:b%!4|
00005820  34 3d 35 3a 62 25 21 34  38 3d 31 31 3a 62 25 21  |4=5:b%!48=11:b%!|
00005830  35 32 3d 31 32 3a 62 25  21 35 36 3d 2d 31 0d 1a  |52=12:b%!56=-1..|
00005840  40 29 20 c8 99 20 22 4f  53 5f 52 65 61 64 56 64  |@) .. "OS_ReadVd|
00005850  75 56 61 72 69 61 62 6c  65 73 22 2c 62 25 2b 34  |uVariables",b%+4|
00005860  30 2c 62 25 2b 34 30 0d  1a 4a 3e 20 62 25 21 32  |0,b%+40..J> b%!2|
00005870  34 3d 30 3a 62 25 21 32  38 3d 30 3a 62 25 21 33  |4=0:b%!28=0:b%!3|
00005880  32 3d 62 25 21 34 38 2b  31 3c 3c 62 25 21 34 30  |2=b%!48+1<<b%!40|
00005890  3a 62 25 21 33 36 3d 62  25 21 35 32 2b 31 3c 3c  |:b%!36=b%!52+1<<|
000058a0  62 25 21 34 34 0d 1a 54  05 cd 0d 1a 5e 16 62 25  |b%!44..T....^.b%|
000058b0  21 34 3d 35 3a f4 20 44  72 61 67 20 74 79 70 65  |!4=5:. Drag type|
000058c0  0d 1a 68 19 c8 99 20 22  57 69 6d 70 5f 44 72 61  |..h... "Wimp_Dra|
000058d0  67 42 6f 78 22 2c 2c 62  25 0d 1a 72 05 e1 0d 1a  |gBox",,b%..r....|
000058e0  7c 05 3a 0d 1a 86 39 f4  20 50 52 4f 43 64 72 61  ||.:...9. PROCdra|
000058f0  67 73 61 76 65 20 3a 20  49 6e 69 74 69 61 74 65  |gsave : Initiate|
00005900  20 61 20 73 61 76 65 20  61 66 74 65 72 20 44 72  | a save after Dr|
00005910  61 67 44 6f 6e 65 20 65  76 65 6e 74 0d 1a 90 26  |agDone event...&|
00005920  dd f2 64 72 61 67 73 61  76 65 28 77 69 6e 25 2c  |..dragsave(win%,|
00005930  69 63 6f 6e 25 2c 74 79  70 65 25 2c 73 69 7a 65  |icon%,type%,size|
00005940  25 29 0d 1a 9a 33 f2 67  65 74 70 74 72 70 6f 73  |%)...3.getptrpos|
00005950  28 78 2c 79 2c 77 69 6e  2c 69 63 6f 6e 29 3a f4  |(x,y,win,icon):.|
00005960  20 47 65 74 20 64 72 61  67 20 74 6f 20 6c 6f 63  | Get drag to loc|
00005970  61 74 69 6f 6e 0d 1a a4  2a 66 24 3d a4 6c 65 61  |ation...*f$=.lea|
00005980  66 6e 61 6d 65 28 a4 67  65 74 69 63 6f 6e 74 65  |fname(.geticonte|
00005990  78 74 28 77 69 6e 25 2c  69 63 6f 6e 25 29 29 0d  |xt(win%,icon%)).|
000059a0  1a ae 17 21 62 25 3d 28  34 38 2b a9 28 66 24 29  |...!b%=(48+.(f$)|
000059b0  29 20 80 20 ac 33 0d 1a  b8 38 62 25 21 31 32 3d  |) . .3...8b%!12=|
000059c0  30 3a 62 25 21 31 36 3d  31 3a 62 25 21 32 30 3d  |0:b%!16=1:b%!20=|
000059d0  77 69 6e 3a 62 25 21 32  34 3d 69 63 6f 6e 3a 62  |win:b%!24=icon:b|
000059e0  25 21 32 38 3d 78 3a 62  25 21 33 32 3d 79 0d 1a  |%!28=x:b%!32=y..|
000059f0  c2 27 62 25 21 33 36 3d  73 69 7a 65 25 3a 62 25  |.'b%!36=size%:b%|
00005a00  21 34 30 3d 74 79 70 65  25 3a 24 28 62 25 2b 34  |!40=type%:$(b%+4|
00005a10  34 29 3d 66 24 0d 1a cc  28 c8 99 20 22 57 69 6d  |4)=f$...(.. "Wim|
00005a20  70 5f 53 65 6e 64 4d 65  73 73 61 67 65 22 2c 31  |p_SendMessage",1|
00005a30  38 2c 62 25 2c 77 69 6e  2c 69 63 6f 6e 0d 1a d6  |8,b%,win,icon...|
00005a40  05 e1 0d 1a e0 05 3a 0d  1a ea 37 f4 20 2a 2a 2a  |......:...7. ***|
00005a50  2a 2a 2a 2a 2a 20 21 48  65 6c 70 20 72 65 73 70  |***** !Help resp|
00005a60  6f 6e 73 69 76 65 20 72  6f 75 74 69 6e 65 73 20  |onsive routines |
00005a70  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 0d 1a  |**************..|
00005a80  f4 05 3a 0d 1a fe 38 f4  20 50 52 4f 43 72 65 61  |..:...8. PROCrea|
00005a90  64 68 65 6c 70 20 3a 20  72 65 61 64 20 68 65 6c  |dhelp : read hel|
00005aa0  70 20 66 72 6f 6d 20 61  70 70 6c 69 63 61 74 69  |p from applicati|
00005ab0  6f 6e 20 61 6e 64 20 73  65 6e 64 0d 1b 08 2d f4  |on and send...-.|
00005ac0  20 50 52 4f 43 73 65 6e  64 68 65 6c 70 20 3a 20  | PROCsendhelp : |
00005ad0  73 65 6e 64 20 68 65 6c  70 20 74 6f 20 61 70 70  |send help to app|
00005ae0  6c 69 63 61 74 69 6f 6e  0d 1b 12 1f f4 20 5c 53  |lication..... \S|
00005af0  20 66 6f 72 20 22 43 6c  69 63 6b 20 53 45 4c 45  | for "Click SELE|
00005b00  43 54 20 74 6f 20 22 0d  1b 1c 29 f4 20 5c 52 20  |CT to "...). \R |
00005b10  66 6f 72 20 22 4d 6f 76  65 20 74 68 65 20 70 6f  |for "Move the po|
00005b20  69 6e 74 65 72 20 72 69  67 68 74 20 74 6f 20 22  |inter right to "|
00005b30  0d 1b 26 1f f4 20 5c 41  20 66 6f 72 20 22 43 6c  |..&.. \A for "Cl|
00005b40  69 63 6b 20 41 44 4a 55  53 54 20 74 6f 20 22 0d  |ick ADJUST to ".|
00005b50  1b 30 1b f4 20 5c 54 20  66 6f 72 20 22 54 68 69  |.0.. \T for "Thi|
00005b60  73 20 69 73 20 74 68 65  20 22 0d 1b 3a 31 f4 20  |s is the "..:1. |
00005b70  5c 47 20 66 6f 72 20 22  54 68 69 73 20 6f 70 74  |\G for "This opt|
00005b80  69 6f 6e 20 69 73 20 67  72 65 79 65 64 20 6f 75  |ion is greyed ou|
00005b90  74 20 62 65 63 61 75 73  65 20 22 0d 1b 44 1e f4  |t because "..D..|
00005ba0  20 5c 57 20 66 6f 72 20  22 54 68 69 73 20 77 69  | \W for "This wi|
00005bb0  6e 64 6f 77 20 69 73 20  22 0d 1b 4e 1e f4 20 5c  |ndow is "..N.. \|
00005bc0  44 20 66 6f 72 20 22 44  72 61 67 20 53 45 4c 45  |D for "Drag SELE|
00005bd0  43 54 20 74 6f 20 22 0d  1b 58 1e f4 20 5c 64 20  |CT to "..X.. \d |
00005be0  66 6f 72 20 22 44 72 61  67 20 41 44 4a 55 53 54  |for "Drag ADJUST|
00005bf0  20 74 6f 20 22 0d 1b 62  15 f4 20 5c 77 20 66 6f  | to "..b.. \w fo|
00005c00  72 20 22 77 69 6e 64 6f  77 22 0d 1b 6c 15 f4 20  |r "window"..l.. |
00005c10  5c 73 20 66 6f 72 20 22  53 45 4c 45 43 54 22 0d  |\s for "SELECT".|
00005c20  1b 76 15 f4 20 5c 61 20  66 6f 72 20 22 41 44 4a  |.v.. \a for "ADJ|
00005c30  55 53 54 22 0d 1b 80 13  f4 20 7c 4d 20 66 6f 72  |UST"..... |M for|
00005c40  20 72 65 74 75 72 6e 0d  1b 8a 21 f4 20 a4 53 74  | return...!. .St|
00005c50  72 69 6e 67 24 a4 20 74  6f 20 69 6e 63 6c 75 64  |ring$. to includ|
00005c60  65 20 73 74 72 69 6e 67  0d 1b 94 29 f4 20 3e 20  |e string...). > |
00005c70  70 72 65 66 69 78 20 74  6f 20 6c 6f 6f 6b 20 75  |prefix to look u|
00005c80  70 20 69 6e 20 6d 65 73  73 61 67 65 20 66 69 6c  |p in message fil|
00005c90  65 0d 1b 9e 3e f4 20 4d  65 6e 75 20 68 65 6c 70  |e...>. Menu help|
00005ca0  20 69 63 6f 6e 73 20 77  69 6c 6c 20 62 65 20 73  | icons will be s|
00005cb0  65 61 72 63 68 65 64 20  61 73 20 48 4d 3c 6d 65  |earched as HM<me|
00005cc0  6e 75 73 74 72 69 6e 67  3e 2c 20 77 69 74 68 0d  |nustring>, with.|
00005cd0  1b a8 1e f4 20 73 70 61  63 65 73 20 72 65 70 6c  |.... spaces repl|
00005ce0  61 63 65 64 20 77 69 74  68 20 5f 27 73 0d 1b b2  |aced with _'s...|
00005cf0  2f f4 20 4e 42 20 69 66  20 6e 6f 20 66 75 6c 6c  |/. NB if no full|
00005d00  20 73 74 6f 70 20 74 68  65 6e 20 6f 6e 65 20 77  | stop then one w|
00005d10  69 6c 6c 20 62 65 20 61  64 64 65 64 0d 1b bc 17  |ill be added....|
00005d20  f4 20 46 6f 72 6d 61 74  20 66 6f 72 20 68 65 6c  |. Format for hel|
00005d30  70 20 3a 0d 1b c6 28 f4  20 20 7b 20 77 69 6e 64  |p :...(.  { wind|
00005d40  6f 77 2c 68 65 6c 70 20  6d 65 73 73 61 67 65 20  |ow,help message |
00005d50  66 6f 72 20 6e 6f 20 69  63 6f 6e 0d 1b d0 2a f4  |for no icon...*.|
00005d60  20 20 20 20 7b 20 69 63  6f 6e 20 6e 75 6d 62 65  |    { icon numbe|
00005d70  72 2c 20 6d 65 73 73 61  67 65 20 7d 20 72 65 70  |r, message } rep|
00005d80  65 61 74 65 64 0d 1b da  11 f4 20 20 7d 20 72 65  |eated.....  } re|
00005d90  70 65 61 74 65 64 0d 1b  e4 2a f4 20 20 7b 20 2d  |peated...*.  { -|
00005da0  32 2c 20 7b 69 63 6f 6e  62 61 72 20 6d 65 73 73  |2, {iconbar mess|
00005db0  61 67 65 7d 20 7d 20 62  79 20 63 68 6f 69 63 65  |age} } by choice|
00005dc0  0d 1b ee 13 f4 20 20 2d  31 2c 2d 31 20 74 6f 20  |.....  -1,-1 to |
00005dd0  65 6e 64 0d 1b f8 2f f4  20 4e 42 20 77 69 6e 64  |end.../. NB wind|
00005de0  6f 77 20 73 75 62 6d 65  6e 75 73 20 6d 75 73 74  |ow submenus must|
00005df0  20 68 61 76 65 20 68 65  6c 70 20 73 74 72 69 6e  | have help strin|
00005e00  67 73 0d 1c 02 1c f4 20  46 6f 72 6d 61 74 20 66  |gs..... Format f|
00005e10  6f 72 20 6d 65 6e 75 20  68 65 6c 70 20 3a 0d 1c  |or menu help :..|
00005e20  0c 3c f4 20 20 7b 20 6d  65 6e 75 2c 20 2d 31 2c  |.<.  { menu, -1,|
00005e30  2d 31 2c 2d 31 20 6f 72  20 6d 65 6e 75 2c 20 2d  |-1,-1 or menu, -|
00005e40  31 2c 30 2c 68 65 6c 70  20 66 6f 72 20 61 6c 6c  |1,0,help for all|
00005e50  20 74 68 65 20 69 74 65  6d 73 0d 1c 16 1e f4 20  | the items..... |
00005e60  20 20 20 7b 20 6f 70 74  31 2c 6f 70 74 32 2c 6f  |   { opt1,opt2,o|
00005e70  70 74 33 2c 68 65 6c 70  0d 1c 20 27 f4 20 20 20  |pt3,help.. '.   |
00005e80  6f 72 20 2d 31 2c 73 74  72 69 6e 67 2c 2d 31 2c  |or -1,string,-1,|
00005e90  68 65 6c 70 20 7d 20 72  65 70 65 61 74 65 64 0d  |help } repeated.|
00005ea0  1c 2a 11 f4 20 20 7d 20  72 65 70 65 61 74 65 64  |.*..  } repeated|
00005eb0  0d 1c 34 12 f4 20 20 2d  32 2c 2d 32 2c 2d 32 2c  |..4..  -2,-2,-2,|
00005ec0  2d 32 0d 1c 3e 1b dd f2  72 65 61 64 68 65 6c 70  |-2..>...readhelp|
00005ed0  28 77 69 6e 2c 69 63 6f  6e 2c 74 6f 29 0d 1c 48  |(win,icon,to)..H|
00005ee0  38 ea 20 6c 77 69 6e 2c  76 61 6c 2c 68 65 6c 70  |8. lwin,val,help|
00005ef0  24 2c 66 6f 75 6e 64 2c  61 24 2c 6d 24 2c 6d 32  |$,found,a$,m$,m2|
00005f00  24 2c 6d 68 24 3a 66 6f  75 6e 64 3d a3 3a 6c 77  |$,mh$:found=.:lw|
00005f10  69 6e 3d 2d 31 0d 1c 52  05 f5 0d 1c 5c 10 20 f3  |in=-1..R....\. .|
00005f20  20 76 61 6c 2c 68 65 6c  70 24 0d 1c 66 1c 20 e7  | val,help$..f. .|
00005f30  20 76 61 6c 3e 28 31 3c  3c 31 36 29 20 84 20 76  | val>(1<<16) . v|
00005f40  61 6c 3c 30 20 8c 0d 1c  70 12 20 20 e7 20 6c 77  |al<0 ...p.  . lw|
00005f50  69 6e 3d 77 69 6e 20 8c  0d 1c 7a 1f 20 20 20 76  |in=win ...z.   v|
00005f60  61 6c 3d 69 63 6f 6e 3a  68 65 6c 70 24 3d 22 22  |al=icon:help$=""|
00005f70  3a 6d 32 24 3d 6d 24 0d  1c 84 07 20 20 cc 0d 1c  |:m2$=m$....  ...|
00005f80  8e 18 20 20 20 6c 77 69  6e 3d 76 61 6c 3a 6d 24  |..   lwin=val:m$|
00005f90  3d 68 65 6c 70 24 0d 1c  98 07 20 20 cd 0d 1c a2  |=help$....  ....|
00005fa0  06 20 cd 0d 1c ac 1c 20  e7 20 76 61 6c 3d 69 63  |. ..... . val=ic|
00005fb0  6f 6e 20 80 20 6c 77 69  6e 3d 77 69 6e 20 8c 0d  |on . lwin=win ..|
00005fc0  1c b6 1c 20 20 e7 20 69  63 6f 6e 3d 2d 31 20 84  |...  . icon=-1 .|
00005fd0  20 68 65 6c 70 24 3d 22  22 20 8c 0d 1c c0 26 20  | help$="" ....& |
00005fe0  20 20 f2 73 65 6e 64 68  65 6c 70 28 a4 6d 73 67  |  .sendhelp(.msg|
00005ff0  74 65 78 74 28 6d 24 29  2b 22 7c 4d 22 2c 74 6f  |text(m$)+"|M",to|
00006000  29 0d 1c ca 07 20 20 cc  0d 1c d4 39 20 20 20 6d  |)....  ....9   m|
00006010  24 3d a4 6d 73 67 74 65  78 74 28 6d 24 29 3a e7  |$=.msgtext(m$):.|
00006020  20 a7 6d 24 2c 22 7c 4d  22 29 3e 30 20 8c 6d 24  | .m$,"|M")>0 .m$|
00006030  3d c0 6d 24 2c a7 6d 24  2c 22 7c 4d 22 29 2d 31  |=.m$,.m$,"|M")-1|
00006040  29 0d 1c de 36 20 20 20  f2 73 65 6e 64 68 65 6c  |)...6   .sendhel|
00006050  70 28 a4 6d 73 67 74 65  78 74 28 6d 24 29 2b 22  |p(.msgtext(m$)+"|
00006060  7c 4d 22 2b a4 6d 73 67  74 65 78 74 28 68 65 6c  ||M"+.msgtext(hel|
00006070  70 24 29 2c 74 6f 29 0d  1c e8 07 20 20 cd 0d 1c  |p$),to)....  ...|
00006080  f2 0d 20 20 66 6f 75 6e  64 3d b9 0d 1c fc 06 20  |..  found=..... |
00006090  cd 0d 1d 06 1a fd 20 68  65 6c 70 24 3d 22 2d 31  |...... help$="-1|
000060a0  22 20 84 20 66 6f 75 6e  64 3d b9 0d 1d 10 0f e7  |" . found=......|
000060b0  20 ac 20 66 6f 75 6e 64  20 8c 0d 1d 1a 42 20 21  | . found ....B !|
000060c0  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 3d  |message_buffer%=|
000060d0  2d 31 3a 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |-1:message_buffe|
000060e0  72 25 21 34 3d 2d 31 3a  6d 65 73 73 61 67 65 5f  |r%!4=-1:message_|
000060f0  62 75 66 66 65 72 25 21  38 3d 2d 31 0d 1d 24 36  |buffer%!8=-1..$6|
00006100  20 c8 99 20 22 57 69 6d  70 5f 47 65 74 4d 65 6e  | .. "Wimp_GetMen|
00006110  75 53 74 61 74 65 22 2c  31 2c 6d 65 73 73 61 67  |uState",1,messag|
00006120  65 5f 62 75 66 66 65 72  25 2c 77 69 6e 2c 69 63  |e_buffer%,win,ic|
00006130  6f 6e 0d 1d 2e 1d 20 e7  20 21 6d 65 73 73 61 67  |on.... . !messag|
00006140  65 5f 62 75 66 66 65 72  25 3c 3e 2d 31 20 8c 0d  |e_buffer%<>-1 ..|
00006150  1d 38 40 20 20 76 61 6c  3d 62 25 3a 62 25 3d 6d  |.8@  val=b%:b%=m|
00006160  65 73 73 61 67 65 5f 62  75 66 66 65 72 25 3a 6d  |essage_buffer%:m|
00006170  68 24 3d a4 64 65 63 6f  64 65 6d 65 6e 75 28 63  |h$=.decodemenu(c|
00006180  75 72 6d 65 6e 75 25 29  3a 62 25 3d 76 61 6c 0d  |urmenu%):b%=val.|
00006190  1d 42 30 20 20 6d 24 3d  6d 68 24 3a c8 95 20 a7  |.B0  m$=mh$:.. .|
000061a0  6d 24 2c 22 20 22 29 3e  30 3a c1 6d 24 2c a7 6d  |m$," ")>0:.m$,.m|
000061b0  24 2c 22 20 22 29 2c 31  29 3d 22 5f 22 3a ce 0d  |$," "),1)="_":..|
000061c0  1d 4c 1e 20 20 68 65 6c  70 24 3d a4 6d 73 67 74  |.L.  help$=.msgt|
000061d0  6f 6b 65 6e 28 22 48 4d  22 2b 6d 24 29 0d 1d 56  |oken("HM"+m$)..V|
000061e0  18 20 20 e7 20 68 65 6c  70 24 3c 3e 22 48 4d 22  |.  . help$<>"HM"|
000061f0  2b 6d 24 20 8c 0d 1d 60  1a 20 20 20 f2 73 65 6e  |+m$ ...`.   .sen|
00006200  64 68 65 6c 70 28 68 65  6c 70 24 2c 74 6f 29 0d  |dhelp(help$,to).|
00006210  1d 6a 07 20 20 cc 0d 1d  74 08 20 20 20 f5 0d 1d  |.j.  ...t.   ...|
00006220  7e 1c 20 20 20 20 f3 20  6d 24 2c 76 61 6c 2c 68  |~.    . m$,val,h|
00006230  65 6c 70 24 2c 68 65 6c  70 24 0d 1d 88 21 20 20  |elp$,help$...!  |
00006240  20 fd 20 a0 28 6d 24 29  3d 63 75 72 6d 65 6e 75  | . .(m$)=curmenu|
00006250  25 20 84 20 6d 24 3d 22  2d 32 22 0d 1d 92 13 20  |% . m$="-2".... |
00006260  20 20 e7 20 6d 24 3c 3e  22 2d 32 22 20 8c 0d 1d  |  . m$<>"-2" ...|
00006270  9c 12 20 20 20 20 e7 20  76 61 6c 3e 2d 31 20 8c  |..    . val>-1 .|
00006280  0d 1d a6 24 20 20 20 20  20 f2 73 65 6e 64 68 65  |...$     .sendhe|
00006290  6c 70 28 68 65 6c 70 24  2c 74 6f 29 3a 66 6f 75  |lp(help$,to):fou|
000062a0  6e 64 3d b9 0d 1d b0 09  20 20 20 20 cc 0d 1d ba  |nd=.....    ....|
000062b0  0a 20 20 20 20 20 f5 0d  1d c4 1d 20 20 20 20 20  |.     .....     |
000062c0  20 f3 20 6c 77 69 6e 2c  6d 24 2c 76 61 6c 2c 68  | . lwin,m$,val,h|
000062d0  65 6c 70 24 0d 1d ce 1f  20 20 20 20 20 20 e7 20  |elp$....      . |
000062e0  bb 28 6d 24 29 3d 30 20  80 20 6d 24 3c 3e 22 30  |.(m$)=0 . m$<>"0|
000062f0  22 20 8c 0d 1d d8 30 20  20 20 20 20 20 20 e7 20  |" ....0       . |
00006300  6d 68 24 3d 6d 24 20 8c  f2 73 65 6e 64 68 65 6c  |mh$=m$ ..sendhel|
00006310  70 28 68 65 6c 70 24 2c  74 6f 29 3a 66 6f 75 6e  |p(help$,to):foun|
00006320  64 3d b9 0d 1d e2 0b 20  20 20 20 20 20 cc 0d 1d  |d=.....      ...|
00006330  ec 57 20 20 20 20 20 20  20 e7 20 6c 77 69 6e 3d  |.W       . lwin=|
00006340  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 21  |message_buffer%!|
00006350  30 20 80 20 bb 28 6d 24  29 3d 6d 65 73 73 61 67  |0 . .(m$)=messag|
00006360  65 5f 62 75 66 66 65 72  25 21 34 20 80 20 76 61  |e_buffer%!4 . va|
00006370  6c 3d 6d 65 73 73 61 67  65 5f 62 75 66 66 65 72  |l=message_buffer|
00006380  25 21 38 20 8c 0d 1d f6  27 20 20 20 20 20 20 20  |%!8 ....'       |
00006390  20 f2 73 65 6e 64 68 65  6c 70 28 68 65 6c 70 24  | .sendhelp(help$|
000063a0  2c 74 6f 29 3a 66 6f 75  6e 64 3d b9 0d 1e 00 0c  |,to):found=.....|
000063b0  20 20 20 20 20 20 20 cd  0d 1e 0a 0b 20 20 20 20  |       .....    |
000063c0  20 20 cd 0d 1e 14 29 20  20 20 20 20 fd 66 6f 75  |  ....)     .fou|
000063d0  6e 64 3d b9 20 84 20 6c  77 69 6e 3d 2d 32 20 84  |nd=. . lwin=-2 .|
000063e0  20 6c 77 69 6e 20 3e 26  38 30 30 30 0d 1e 1e 09  | lwin >&8000....|
000063f0  20 20 20 20 cd 0d 1e 28  08 20 20 20 cd 0d 1e 32  |    ...(.   ...2|
00006400  07 20 20 cd 0d 1e 3c 06  20 cd 0d 1e 46 05 cd 0d  |.  ...<. ...F...|
00006410  1e 50 05 e1 0d 1e 5a 2e  dd f2 73 65 6e 64 68 65  |.P....Z...sendhe|
00006420  6c 70 28 68 65 6c 70 24  2c 74 6f 29 3a 68 65 6c  |lp(help$,to):hel|
00006430  70 24 3d a4 6d 73 67 74  65 78 74 28 68 65 6c 70  |p$=.msgtext(help|
00006440  24 29 0d 1e 64 22 e7 20  c2 68 65 6c 70 24 2c 32  |$)..d". .help$,2|
00006450  29 3c 3e 22 7c 4d 22 20  8c 68 65 6c 70 24 2b 3d  |)<>"|M" .help$+=|
00006460  22 7c 4d 22 0d 1e 6e 0b  ea 20 62 24 2c 63 24 0d  |"|M"..n.. b$,c$.|
00006470  1e 78 1b 68 65 6c 70 24  3d a4 73 75 62 73 74 76  |.x.help$=.substv|
00006480  61 72 73 28 68 65 6c 70  24 29 0d 1e 82 15 c8 95  |ars(help$)......|
00006490  20 a7 68 65 6c 70 24 2c  22 7c 4d 22 29 3e 30 0d  | .help$,"|M")>0.|
000064a0  1e 8c 34 20 62 24 3d c0  68 65 6c 70 24 2c a7 68  |..4 b$=.help$,.h|
000064b0  65 6c 70 24 2c 22 7c 4d  22 29 2d 31 29 3a 68 65  |elp$,"|M")-1):he|
000064c0  6c 70 24 3d c1 68 65 6c  70 24 2c a9 28 62 24 29  |lp$=.help$,.(b$)|
000064d0  2b 33 29 0d 1e 96 20 20  e7 20 a7 22 21 2e 3f 22  |+3)...  . ."!.?"|
000064e0  2c c2 62 24 2c 31 29 29  3d 30 20 8c 62 24 2b 3d  |,.b$,1))=0 .b$+=|
000064f0  22 2e 22 0d 1e a0 10 20  63 24 2b 3d 62 24 2b 22  |".".... c$+=b$+"|
00006500  7c 4d 22 0d 1e aa 05 ce  0d 1e b4 30 62 25 21 31  ||M"........0b%!1|
00006510  32 3d 62 25 21 38 3a 62  25 21 34 3d 74 6f 3a 62  |2=b%!8:b%!4=to:b|
00006520  25 21 31 36 3d 26 35 30  33 3a 24 28 62 25 2b 32  |%!16=&503:$(b%+2|
00006530  30 29 3d 63 24 2b bd 30  0d 1e be 1a 62 25 21 30  |0)=c$+.0....b%!0|
00006540  3d 32 30 2b 28 a9 28 63  24 29 2b 34 29 20 80 20  |=20+(.(c$)+4) . |
00006550  2d 34 0d 1e c8 24 c8 99  20 22 57 69 6d 70 5f 53  |-4...$.. "Wimp_S|
00006560  65 6e 64 4d 65 73 73 61  67 65 22 2c 31 37 2c 62  |endMessage",17,b|
00006570  25 2c 62 25 21 34 0d 1e  d2 05 e1 0d 1e dc 05 3a  |%,b%!4.........:|
00006580  0d 1e e6 37 f4 20 2a 2a  2a 2a 2a 2a 2a 2a 20 4d  |...7. ******** M|
00006590  65 73 73 61 67 65 54 72  61 6e 73 20 69 6e 74 65  |essageTrans inte|
000065a0  72 66 61 63 65 20 72 6f  75 74 69 6e 65 73 20 2a  |rface routines *|
000065b0  2a 2a 2a 2a 2a 2a 2a 0d  1e f0 05 3a 0d 1e fa 3c  |*******....:...<|
000065c0  f4 20 50 52 4f 43 6f 70  65 6e 6d 65 73 73 61 67  |. PROCopenmessag|
000065d0  65 73 20 20 3a 20 6f 70  65 6e 20 61 20 4d 65 73  |es  : open a Mes|
000065e0  73 61 67 65 54 72 61 6e  73 20 66 69 6c 65 20 66  |sageTrans file f|
000065f0  6f 72 20 69 6e 70 75 74  0d 1f 04 33 f4 20 50 52  |or input...3. PR|
00006600  4f 43 63 6c 6f 73 65 6d  65 73 73 61 67 65 73 20  |OCclosemessages |
00006610  3a 20 63 6c 6f 73 65 20  61 20 4d 65 73 73 61 67  |: close a Messag|
00006620  65 54 72 61 6e 73 20 66  69 6c 65 0d 1f 0e 18 dd  |eTrans file.....|
00006630  f2 6f 70 65 6e 6d 65 73  73 61 67 65 73 3a ea 20  |.openmessages:. |
00006640  66 2c 6c 0d 1f 18 38 e7  20 6d 73 67 62 75 66 66  |f,l...8. msgbuff|
00006650  65 72 25 3c 3e 2d 31 20  8c 85 20 26 38 30 33 2c  |er%<>-1 .. &803,|
00006660  22 4d 65 73 73 61 67 65  20 66 69 6c 65 20 61 6c  |"Message file al|
00006670  72 65 61 64 79 20 6f 70  65 6e 22 0d 1f 22 3a c8  |ready open"..":.|
00006680  99 20 22 4d 65 73 73 61  67 65 54 72 61 6e 73 5f  |. "MessageTrans_|
00006690  46 69 6c 65 49 6e 66 6f  22 2c 2c 41 70 70 64 69  |FileInfo",,Appdi|
000066a0  72 24 2b 22 2e 4d 65 73  73 61 67 65 73 22 20 b8  |r$+".Messages" .|
000066b0  20 66 2c 2c 6c 0d 1f 2c  34 e7 20 28 66 20 80 31  | f,,l..,4. (f .1|
000066c0  29 3d 31 20 8c 6d 73 67  62 75 66 66 65 72 32 25  |)=1 .msgbuffer2%|
000066d0  3d 30 20 8b 6d 73 67 62  75 66 66 65 72 32 25 3d  |=0 .msgbuffer2%=|
000066e0  a4 63 6c 61 69 6d 28 6c  29 0d 1f 36 48 e7 20 6d  |.claim(l)..6H. m|
000066f0  73 67 62 75 66 66 65 72  32 25 3d 2d 31 20 8c 85  |sgbuffer2%=-1 ..|
00006700  20 26 38 30 33 2c 22 4e  6f 20 72 6f 6f 6d 20 66  | &803,"No room f|
00006710  6f 72 20 73 65 63 6f 6e  64 61 72 79 20 4d 65 73  |or secondary Mes|
00006720  73 61 67 65 54 72 61 6e  73 20 62 75 66 66 65 72  |sageTrans buffer|
00006730  22 0d 1f 40 71 6d 73 67  62 75 66 66 65 72 25 3d  |"..@qmsgbuffer%=|
00006740  a4 63 6c 61 69 6d 28 31  36 29 3a e7 20 6d 73 67  |.claim(16):. msg|
00006750  62 75 66 66 65 72 25 3d  2d 31 20 8c f2 72 65 6c  |buffer%=-1 ..rel|
00006760  65 61 73 65 28 6d 73 67  62 75 66 66 65 72 32 25  |ease(msgbuffer2%|
00006770  29 3a 85 20 26 38 30 33  2c 22 4e 6f 20 72 6f 6f  |):. &803,"No roo|
00006780  6d 20 66 6f 72 20 70 72  69 6d 61 72 79 20 4d 65  |m for primary Me|
00006790  73 73 61 67 65 54 72 61  6e 73 20 62 75 66 66 65  |ssageTrans buffe|
000067a0  72 22 0d 1f 4a 49 c8 99  20 22 4d 65 73 73 61 67  |r"..JI.. "Messag|
000067b0  65 54 72 61 6e 73 5f 4f  70 65 6e 46 69 6c 65 22  |eTrans_OpenFile"|
000067c0  2c 6d 73 67 62 75 66 66  65 72 25 2c 41 70 70 64  |,msgbuffer%,Appd|
000067d0  69 72 24 2b 22 2e 4d 65  73 73 61 67 65 73 22 2c  |ir$+".Messages",|
000067e0  6d 73 67 62 75 66 66 65  72 32 25 0d 1f 54 05 e1  |msgbuffer2%..T..|
000067f0  0d 1f 5e 13 dd f2 63 6c  6f 73 65 6d 65 73 73 61  |..^...closemessa|
00006800  67 65 73 0d 1f 68 07 ea  20 85 0d 1f 72 1e ee 20  |ges..h.. ...r.. |
00006810  85 20 ea 3a ef 34 3a f6  3a f1 22 20 61 74 20 22  |. .:.4:.:." at "|
00006820  3b 9e 3a 47 3d a5 3a e1  0d 1f 7c 15 e7 20 6d 73  |;.:G=.:...|.. ms|
00006830  67 62 75 66 66 65 72 25  3e 2d 31 20 8c 0d 1f 86  |gbuffer%>-1 ....|
00006840  2c 20 c8 99 20 22 58 4d  65 73 73 61 67 65 54 72  |, .. "XMessageTr|
00006850  61 6e 73 5f 43 6c 6f 73  65 46 69 6c 65 22 2c 6d  |ans_CloseFile",m|
00006860  73 67 62 75 66 66 65 72  25 0d 1f 90 2f 20 f2 72  |sgbuffer%.../ .r|
00006870  65 6c 65 61 73 65 28 6d  73 67 62 75 66 66 65 72  |elease(msgbuffer|
00006880  25 29 3a f2 72 65 6c 65  61 73 65 28 6d 73 67 62  |%):.release(msgb|
00006890  75 66 66 65 72 32 25 29  0d 1f 9a 05 cd 0d 1f a4  |uffer2%)........|
000068a0  05 e1 0d 1f ae 05 3a 0d  1f b8 39 f4 20 46 4e 6d  |......:...9. FNm|
000068b0  73 67 74 6f 6b 65 6e 20  20 20 20 20 20 20 20 3a  |sgtoken        :|
000068c0  20 74 72 61 6e 73 6c 61  74 65 20 61 20 74 6f 6b  | translate a tok|
000068d0  65 6e 20 69 6e 74 6f 20  61 20 73 74 72 69 6e 67  |en into a string|
000068e0  0d 1f c2 42 f4 20 46 4e  6d 73 67 74 65 78 74 20  |...B. FNmsgtext |
000068f0  20 20 20 20 20 20 20 20  3a 20 74 72 61 6e 73 6c  |        : transl|
00006900  61 74 65 20 74 65 78 74  20 74 6f 20 61 20 74 6f  |ate text to a to|
00006910  6b 65 6e 20 69 66 20 70  72 65 66 69 78 20 69 73  |ken if prefix is|
00006920  20 3e 0d 1f cc 2a dd a4  6d 73 67 74 6f 6b 65 6e  | >...*..msgtoken|
00006930  28 74 24 29 3a ea 20 73  31 24 2c 73 32 24 2c 73  |(t$):. s1$,s2$,s|
00006940  33 24 2c 61 24 2c 6c 65  6e 25 2c 66 0d 1f d6 18  |3$,a$,len%,f....|
00006950  e7 20 6d 73 67 62 75 66  66 65 72 25 3d 2d 31 20  |. msgbuffer%=-1 |
00006960  8c 3d 74 24 0d 1f e0 31  61 24 3d c1 74 24 2c a7  |.=t$...1a$=.t$,.|
00006970  74 24 2b 22 3a 22 2c 22  3a 22 29 2b 31 29 3a 74  |t$+":",":")+1):t|
00006980  24 3d c0 74 24 2c a7 74  24 2b 22 3a 22 2c 22 3a  |$=.t$,.t$+":",":|
00006990  22 29 2d 31 29 0d 1f ea  1b 73 31 24 3d c0 61 24  |")-1)....s1$=.a$|
000069a0  2c a7 61 24 2b 22 3a 22  2c 22 3a 22 29 2d 31 29  |,.a$+":",":")-1)|
000069b0  0d 1f f4 13 e7 20 c0 73  31 24 2c 31 29 3d 22 7c  |..... .s1$,1)="||
000069c0  22 20 8c 0d 1f fe 1d 20  73 31 24 3d c1 61 24 2c  |" ..... s1$=.a$,|
000069d0  32 29 3a 73 32 24 3d 22  22 3a 73 33 24 3d 22 22  |2):s2$="":s3$=""|
000069e0  0d 20 08 05 cc 0d 20 12  2d 20 61 24 3d c1 61 24  |. .... .- a$=.a$|
000069f0  2c a9 28 73 31 24 29 2b  32 29 3a 73 32 24 3d c0  |,.(s1$)+2):s2$=.|
00006a00  61 24 2c a7 61 24 2b 22  3a 22 2c 22 3a 22 29 2d  |a$,.a$+":",":")-|
00006a10  31 29 0d 20 1c 38 20 e7  20 c0 73 32 24 2c 31 29  |1). .8 . .s2$,1)|
00006a20  3d 22 7c 22 20 8c 73 32  24 3d c1 61 24 2c 32 29  |="|" .s2$=.a$,2)|
00006a30  3a 73 33 24 3d 22 22 20  8b 73 33 24 3d c1 61 24  |:s3$="" .s3$=.a$|
00006a40  2c a9 28 73 32 24 29 2b  32 29 0d 20 26 05 cd 0d  |,.(s2$)+2). &...|
00006a50  20 30 57 c8 99 20 22 58  4d 65 73 73 61 67 65 54  | 0W.. "XMessageT|
00006a60  72 61 6e 73 5f 4c 6f 6f  6b 75 70 22 2c 6d 73 67  |rans_Lookup",msg|
00006a70  62 75 66 66 65 72 25 2c  74 24 2c 6d 65 73 73 61  |buffer%,t$,messa|
00006a80  67 65 5f 62 75 66 66 65  72 25 2c 32 35 36 2c 73  |ge_buffer%,256,s|
00006a90  31 24 2c 73 32 24 2c 73  33 24 20 b8 20 2c 2c 2c  |1$,s2$,s3$ . ,,,|
00006aa0  6c 65 6e 25 3b 66 0d 20  3a 2c e7 20 28 66 20 80  |len%;f. :,. (f .|
00006ab0  31 29 3d 31 20 8c 3d 74  24 20 8b 6d 65 73 73 61  |1)=1 .=t$ .messa|
00006ac0  67 65 5f 62 75 66 66 65  72 25 3f 6c 65 6e 25 3d  |ge_buffer%?len%=|
00006ad0  31 33 0d 20 44 21 3d a4  73 75 62 73 74 76 61 72  |13. D!=.substvar|
00006ae0  73 28 24 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |s($message_buffe|
00006af0  72 25 29 0d 20 4e 11 dd  a4 6d 73 67 74 65 78 74  |r%). N...msgtext|
00006b00  28 61 24 29 0d 20 58 26  e7 20 c0 61 24 2c 31 29  |(a$). X&. .a$,1)|
00006b10  3d 22 3e 22 20 8c 61 24  3d a4 6d 73 67 74 6f 6b  |=">" .a$=.msgtok|
00006b20  65 6e 28 c1 61 24 2c 32  29 29 0d 20 62 07 3d 61  |en(.a$,2)). b.=a|
00006b30  24 0d 20 6c 05 3a 0d 20  76 37 f4 20 2a 2a 2a 2a  |$. l.:. v7. ****|
00006b40  2a 2a 2a 2a 20 53 74 72  69 6e 67 20 6d 61 6e 69  |**** String mani|
00006b50  70 75 6c 61 74 69 6f 6e  20 72 6f 75 74 69 6e 65  |pulation routine|
00006b60  73 20 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 0d 20 80  |s ***********. .|
00006b70  05 3a 0d 20 8a 38 f4 20  46 4e 73 74 72 69 6e 67  |.:. .8. FNstring|
00006b80  30 20 3a 20 52 65 74 75  72 6e 20 30 2d 74 65 72  |0 : Return 0-ter|
00006b90  6d 69 6e 61 74 65 64 20  73 74 72 69 6e 67 20 61  |minated string a|
00006ba0  74 20 6c 6f 63 61 74 69  6f 6e 0d 20 94 22 dd a4  |t location. ."..|
00006bb0  73 74 72 69 6e 67 30 28  61 25 29 3a ea 20 61 24  |string0(a%):. a$|
00006bc0  3a e7 20 61 25 3d 30 20  8c 3d 22 22 0d 20 9e 2c  |:. a%=0 .="". .,|
00006bd0  c8 95 3f 61 25 3e 33 31  20 80 a9 28 61 24 29 3c  |..?a%>31 ..(a$)<|
00006be0  32 35 35 3a 61 24 3d 61  24 2b bd 3f 61 25 3a 61  |255:a$=a$+.?a%:a|
00006bf0  25 3d 61 25 2b 31 3a ce  0d 20 a8 07 3d 61 24 0d  |%=a%+1:.. ..=a$.|
00006c00  20 b2 05 3a 0d 20 bc 37  f4 20 46 4e 6c 6f 77 65  | ..:. .7. FNlowe|
00006c10  72 20 20 20 20 20 20 20  3a 20 52 65 74 75 72 6e  |r       : Return|
00006c20  20 67 69 76 65 6e 20 73  74 72 69 6e 67 20 69 6e  | given string in|
00006c30  20 6c 6f 77 65 72 20 63  61 73 65 0d 20 c6 37 f4  | lower case. .7.|
00006c40  20 46 4e 75 70 70 65 72  20 20 20 20 20 20 20 3a  | FNupper       :|
00006c50  20 52 65 74 75 72 6e 20  67 69 76 65 6e 20 73 74  | Return given st|
00006c60  72 69 6e 67 20 69 6e 20  75 70 70 65 72 20 63 61  |ring in upper ca|
00006c70  73 65 0d 20 d0 38 f4 20  46 4e 74 69 64 79 20 20  |se. .8. FNtidy  |
00006c80  20 20 20 20 20 20 3a 20  52 65 74 75 72 6e 20 67  |      : Return g|
00006c90  69 76 65 6e 20 73 74 72  69 6e 67 20 69 6e 20 74  |iven string in t|
00006ca0  69 64 79 20 66 6f 72 6d  61 74 0d 20 da 40 f4 20  |idy format. .@. |
00006cb0  46 4e 73 74 72 69 70 73  70 61 63 65 73 20 3a 20  |FNstripspaces : |
00006cc0  52 65 6d 6f 76 65 20 73  70 61 63 65 73 20 66 72  |Remove spaces fr|
00006cd0  6f 6d 20 73 74 61 72 74  20 61 6e 64 20 65 6e 64  |om start and end|
00006ce0  20 6f 66 20 73 74 72 69  6e 67 0d 20 e4 19 dd a4  | of string. ....|
00006cf0  6c 6f 77 65 72 28 61 24  29 3a ea 20 63 24 2c 62  |lower(a$):. c$,b|
00006d00  24 2c 49 0d 20 ee 0e e3  49 3d 31 b8 a9 28 61 24  |$,I. ...I=1..(a$|
00006d10  29 0d 20 f8 30 63 24 3d  c1 61 24 2c 49 2c 31 29  |). .0c$=.a$,I,1)|
00006d20  3a e7 20 63 24 3e 3d 22  41 22 80 63 24 3c 3d 22  |:. c$>="A".c$<="|
00006d30  5a 22 8c 63 24 3d bd 28  97 28 63 24 29 2b 33 32  |Z".c$=.(.(c$)+32|
00006d40  29 0d 21 02 10 62 24 2b  3d 63 24 3a ed 3a 3d 62  |).!..b$+=c$:.:=b|
00006d50  24 0d 21 0c 19 dd a4 75  70 70 65 72 28 61 24 29  |$.!....upper(a$)|
00006d60  3a ea 20 63 24 2c 62 24  2c 49 0d 21 16 0e e3 49  |:. c$,b$,I.!...I|
00006d70  3d 31 b8 a9 28 61 24 29  0d 21 20 30 63 24 3d c1  |=1..(a$).! 0c$=.|
00006d80  61 24 2c 49 2c 31 29 3a  e7 20 63 24 3e 3d 22 61  |a$,I,1):. c$>="a|
00006d90  22 80 63 24 3c 3d 22 7a  22 8c 63 24 3d bd 28 97  |".c$<="z".c$=.(.|
00006da0  28 63 24 29 2d 33 32 29  0d 21 2a 10 62 24 2b 3d  |(c$)-32).!*.b$+=|
00006db0  63 24 3a ed 3a 3d 62 24  0d 21 34 1c dd a4 74 69  |c$:.:=b$.!4...ti|
00006dc0  64 79 28 61 24 29 3a ea  20 63 61 70 2c 62 24 2c  |dy(a$):. cap,b$,|
00006dd0  49 2c 63 24 0d 21 3e 09  63 61 70 3d b9 0d 21 48  |I,c$.!>.cap=..!H|
00006de0  0e e3 49 3d 31 b8 a9 28  61 24 29 0d 21 52 32 20  |..I=1..(a$).!R2 |
00006df0  62 24 3d c1 61 24 2c 49  2c 31 29 3a e7 20 62 24  |b$=.a$,I,1):. b$|
00006e00  3e 3d 22 61 22 80 62 24  3c 3d 22 7a 22 20 8c 62  |>="a".b$<="z" .b|
00006e10  24 3d bd 28 97 28 62 24  29 2d 33 32 29 0d 21 5c  |$=.(.(b$)-32).!\|
00006e20  23 20 e7 20 28 62 24 3c  22 41 22 20 84 62 24 3e  |# . (b$<"A" .b$>|
00006e30  22 5a 22 29 20 80 20 62  24 3c 3e 22 27 22 20 8c  |"Z") . b$<>"'" .|
00006e40  0d 21 66 0b 20 20 63 61  70 3d b9 0d 21 70 06 20  |.!f.  cap=..!p. |
00006e50  cc 0d 21 7a 2e 20 20 e7  20 63 61 70 3d a3 20 80  |..!z.  . cap=. .|
00006e60  20 62 24 3c 3e 22 27 22  20 8c 62 24 3d bd 28 97  | b$<>"'" .b$=.(.|
00006e70  28 62 24 29 2b 33 32 29  20 8b 63 61 70 3d a3 0d  |(b$)+32) .cap=..|
00006e80  21 84 0d 20 cd 3a 63 24  2b 3d 62 24 0d 21 8e 09  |!.. .:c$+=b$.!..|
00006e90  ed 3a 3d 63 24 0d 21 98  15 dd a4 73 74 72 69 70  |.:=c$.!....strip|
00006ea0  73 70 61 63 65 73 28 66  24 29 0d 21 a2 27 c8 95  |spaces(f$).!.'..|
00006eb0  20 c2 66 24 2c 31 29 3d  22 20 22 20 84 20 c2 66  | .f$,1)=" " . .f|
00006ec0  24 2c 31 29 3d bd 39 3a  66 24 3d c0 66 24 29 3a  |$,1)=.9:f$=.f$):|
00006ed0  ce 0d 21 ac 29 c8 95 20  c0 66 24 2c 31 29 3d 22  |..!.).. .f$,1)="|
00006ee0  20 22 20 84 20 c0 66 24  2c 31 29 3d bd 39 3a 66  | " . .f$,1)=.9:f|
00006ef0  24 3d c1 66 24 2c 32 29  3a ce 0d 21 b6 07 3d 66  |$=.f$,2):..!..=f|
00006f00  24 0d 21 c0 05 3a 0d 21  ca 31 f4 20 46 4e 73 75  |$.!..:.!.1. FNsu|
00006f10  62 73 74 76 61 72 73 20  20 3a 20 53 75 62 73 74  |bstvars  : Subst|
00006f20  69 74 75 74 65 20 73 74  72 69 6e 67 20 66 6f 72  |itute string for|
00006f30  20 a4 76 61 72 24 a4 0d  21 d4 3d f4 20 46 4e 73  | .var$..!.=. FNs|
00006f40  75 62 73 74 76 61 72 73  70 20 3a 20 53 75 62 73  |ubstvarsp : Subs|
00006f50  74 69 74 75 74 65 20 73  74 72 69 6e 67 20 66 6f  |titute string fo|
00006f60  72 20 a4 76 61 72 24 a4  20 77 69 74 68 20 70 72  |r .var$. with pr|
00006f70  65 66 69 78 0d 21 de 38  f4 20 46 4e 67 73 74 72  |efix.!.8. FNgstr|
00006f80  61 6e 73 20 20 20 20 3a  20 50 65 72 66 6f 72 6d  |ans    : Perform|
00006f90  20 47 53 54 72 61 6e 73  20 6f 6e 20 73 74 72 69  | GSTrans on stri|
00006fa0  6e 67 20 73 70 65 63 69  66 69 65 64 0d 21 e8 17  |ng specified.!..|
00006fb0  dd a4 73 75 62 73 74 76  61 72 73 70 28 61 24 2c  |..substvarsp(a$,|
00006fc0  63 24 29 0d 21 f2 19 ea  20 62 24 2c 64 24 3a ea  |c$).!... b$,d$:.|
00006fd0  20 85 3a ee 20 85 20 ea  3a 3d 61 24 0d 21 fc 11  | .:. . .:=a$.!..|
00006fe0  c8 95 20 a7 61 24 2c 22  a4 22 29 3e 30 0d 22 06  |.. .a$,".")>0.".|
00006ff0  2a 20 62 24 3d c1 61 24  2c a7 61 24 2c 22 a4 22  |* b$=.a$,.a$,"."|
00007000  29 2b 31 29 3a 62 24 3d  c0 62 24 2c a7 62 24 2c  |)+1):b$=.b$,.b$,|
00007010  22 a4 22 29 2d 31 29 0d  22 10 2e 20 64 24 3d 63  |".")-1).".. d$=c|
00007020  24 2b 62 24 3a e7 20 c2  64 24 2c 31 29 3c 3e 22  |$+b$:. .d$,1)<>"|
00007030  24 22 20 8c 64 24 3d 22  53 54 52 24 28 22 2b 64  |$" .d$="STR$("+d|
00007040  24 2b 22 29 22 0d 22 1a  33 20 61 24 3d c0 61 24  |$+")".".3 a$=.a$|
00007050  2c a7 61 24 2c 22 a4 22  29 2d 31 29 2b a0 28 64  |,.a$,".")-1)+.(d|
00007060  24 29 2b c1 61 24 2c a7  61 24 2c 22 a4 22 29 2b  |$)+.a$,.a$,".")+|
00007070  a9 28 62 24 29 2b 32 29  0d 22 24 05 ce 0d 22 2e  |.(b$)+2)."$...".|
00007080  07 3d 61 24 0d 22 38 13  dd a4 73 75 62 73 74 76  |.=a$."8...substv|
00007090  61 72 73 28 61 24 29 0d  22 42 19 ea 20 62 24 2c  |ars(a$)."B.. b$,|
000070a0  64 24 3a ea 20 85 3a ee  20 85 20 ea 3a 3d 61 24  |d$:. .:. . .:=a$|
000070b0  0d 22 4c 11 c8 95 20 a7  61 24 2c 22 a4 22 29 3e  |."L... .a$,".")>|
000070c0  30 0d 22 56 2a 20 62 24  3d c1 61 24 2c a7 61 24  |0."V* b$=.a$,.a$|
000070d0  2c 22 a4 22 29 2b 31 29  3a 62 24 3d c0 62 24 2c  |,".")+1):b$=.b$,|
000070e0  a7 62 24 2c 22 a4 22 29  2d 31 29 0d 22 60 2b 20  |.b$,".")-1)."`+ |
000070f0  64 24 3d 62 24 3a e7 20  c2 64 24 2c 31 29 3c 3e  |d$=b$:. .d$,1)<>|
00007100  22 24 22 20 8c 64 24 3d  22 53 54 52 24 28 22 2b  |"$" .d$="STR$("+|
00007110  64 24 2b 22 29 22 0d 22  6a 33 20 61 24 3d c0 61  |d$+")"."j3 a$=.a|
00007120  24 2c a7 61 24 2c 22 a4  22 29 2d 31 29 2b a0 28  |$,.a$,".")-1)+.(|
00007130  64 24 29 2b c1 61 24 2c  a7 61 24 2c 22 a4 22 29  |d$)+.a$,.a$,".")|
00007140  2b a9 28 62 24 29 2b 32  29 0d 22 74 05 ce 0d 22  |+.(b$)+2)."t..."|
00007150  7e 07 3d 61 24 0d 22 88  1a dd a4 67 73 74 72 61  |~.=a$."....gstra|
00007160  6e 73 28 61 24 29 3a ea  20 70 25 2c 6c 65 6e 0d  |ns(a$):. p%,len.|
00007170  22 92 3a c8 99 20 22 4f  53 5f 47 53 54 72 61 6e  |".:.. "OS_GSTran|
00007180  73 22 2c 61 24 2c 6d 65  73 73 61 67 65 5f 62 75  |s",a$,message_bu|
00007190  66 66 65 72 25 2c 32 35  36 2b 28 31 3c 3c 33 31  |ffer%,256+(1<<31|
000071a0  29 20 b8 20 2c 2c 6c 65  6e 0d 22 9c 1c 61 24 3d  |) . ,,len."..a$=|
000071b0  22 22 3a 70 25 3d 6d 65  73 73 61 67 65 5f 62 75  |"":p%=message_bu|
000071c0  66 66 65 72 25 0d 22 a6  21 c8 95 20 a9 28 61 24  |ffer%.".!.. .(a$|
000071d0  29 3c 6c 65 6e 3a 61 24  2b 3d bd 3f 70 25 3a 70  |)<len:a$+=.?p%:p|
000071e0  25 2b 3d 31 3a ce 0d 22  b0 07 3d 61 24 0d 22 ba  |%+=1:.."..=a$.".|
000071f0  05 3a 0d 22 c4 3b f4 20  46 4e 73 77 69 6e 75 6d  |.:.".;. FNswinum|
00007200  62 65 72 20 3a 20 52 65  74 75 72 6e 20 74 68 65  |ber : Return the|
00007210  20 53 57 49 20 6e 75 6d  62 65 72 2c 20 67 69 76  | SWI number, giv|
00007220  65 6e 20 69 74 73 20 73  74 72 69 6e 67 0d 22 ce  |en its string.".|
00007230  19 dd a4 73 77 69 6e 75  6d 62 65 72 28 73 77 69  |...swinumber(swi|
00007240  24 29 3a ea 20 6e 0d 22  d8 30 c8 99 20 22 58 4f  |$):. n.".0.. "XO|
00007250  53 5f 53 57 49 4e 75 6d  62 65 72 46 72 6f 6d 53  |S_SWINumberFromS|
00007260  74 72 69 6e 67 22 2c 2c  73 77 69 24 20 b8 20 6e  |tring",,swi$ . n|
00007270  3b 66 6c 61 67 73 0d 22  e2 18 e7 20 28 66 6c 61  |;flags."... (fla|
00007280  67 73 20 80 31 29 3e 30  20 8c 6e 3d 2d 31 0d 22  |gs .1)>0 .n=-1."|
00007290  ec 06 3d 6e 0d 22 f6 05  3a 0d 23 00 37 f4 20 2a  |..=n."..:.#.7. *|
000072a0  2a 2a 2a 2a 2a 2a 2a 20  46 69 6c 65 20 69 6e 66  |******* File inf|
000072b0  6f 72 6d 61 74 69 6f 6e  20 72 6f 75 74 69 6e 65  |ormation routine|
000072c0  73 20 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |s **************|
000072d0  0d 23 0a 05 3a 0d 23 14  31 f4 20 46 4e 66 69 6c  |.#..:.#.1. FNfil|
000072e0  65 74 79 70 65 20 3a 20  52 65 74 75 72 6e 20 74  |etype : Return t|
000072f0  68 65 20 66 69 6c 65 20  74 79 70 65 20 6f 66 20  |he file type of |
00007300  61 20 66 69 6c 65 0d 23  1e 32 f4 20 2d 32 3d 6e  |a file.#.2. -2=n|
00007310  6f 74 20 66 6f 75 6e 64  2c 20 2d 31 3d 75 6e 74  |ot found, -1=unt|
00007320  79 70 65 64 2c 20 26 31  30 30 30 3d 64 69 72 20  |yped, &1000=dir |
00007330  6f 72 20 69 6d 61 67 65  0d 23 28 22 dd 20 a4 66  |or image.#(". .f|
00007340  69 6c 65 74 79 70 65 28  66 24 29 3a ea 20 66 25  |iletype(f$):. f%|
00007350  2c 74 79 70 65 25 2c 66  6c 25 0d 23 32 2b c8 99  |,type%,fl%.#2+..|
00007360  20 22 58 4f 53 5f 46 69  6c 65 22 2c 32 30 2c 66  | "XOS_File",20,f|
00007370  24 20 b8 20 74 79 70 65  25 2c 2c 2c 2c 2c 2c 66  |$ . type%,,,,,,f|
00007380  25 3b 66 6c 25 0d 23 3c  0e c8 8e 20 74 79 70 65  |%;fl%.#<... type|
00007390  25 20 ca 0d 23 46 11 20  c9 20 30 3a 74 79 70 65  |% ..#F. . 0:type|
000073a0  25 3d 2d 32 0d 23 50 11  20 c9 20 31 3a 74 79 70  |%=-2.#P. . 1:typ|
000073b0  65 25 3d 66 25 0d 23 5a  16 20 c9 20 32 2c 33 3a  |e%=f%.#Z. . 2,3:|
000073c0  74 79 70 65 25 3d 26 31  30 30 30 0d 23 64 05 cb  |type%=&1000.#d..|
000073d0  0d 23 6e 19 e7 20 28 66  6c 25 80 31 29 3d 31 20  |.#n.. (fl%.1)=1 |
000073e0  8c 74 79 70 65 25 3d 2d  32 0d 23 78 0a 3d 74 79  |.type%=-2.#x.=ty|
000073f0  70 65 25 0d 23 82 05 3a  0d 23 8c 3f f4 20 46 4e  |pe%.#..:.#.?. FN|
00007400  62 61 73 65 74 79 70 65  20 3a 20 52 65 74 75 72  |basetype : Retur|
00007410  6e 20 74 68 65 20 66 69  6c 65 20 74 79 70 65 20  |n the file type |
00007420  6f 66 20 61 20 64 69 72  65 63 74 6f 72 79 20 6f  |of a directory o|
00007430  72 20 69 6d 61 67 65 0d  23 96 3a f4 20 2d 32 3d  |r image.#.:. -2=|
00007440  6e 6f 74 20 66 6f 75 6e  64 2c 20 2d 31 3d 66 69  |not found, -1=fi|
00007450  6c 65 2c 20 26 31 30 30  30 20 66 6f 72 20 64 69  |le, &1000 for di|
00007460  72 2c 20 74 79 70 65 20  66 6f 72 20 69 6d 61 67  |r, type for imag|
00007470  65 0d 23 a0 22 dd 20 a4  62 61 73 65 74 79 70 65  |e.#.". .basetype|
00007480  28 66 24 29 3a ea 20 66  25 2c 74 79 70 65 25 2c  |(f$):. f%,type%,|
00007490  66 6c 25 0d 23 aa 26 c8  99 20 22 58 4f 53 5f 46  |fl%.#.&.. "XOS_F|
000074a0  69 6c 65 22 2c 35 2c 66  24 20 b8 20 74 79 70 65  |ile",5,f$ . type|
000074b0  25 2c 2c 66 25 3b 66 6c  25 0d 23 b4 0e c8 8e 20  |%,,f%;fl%.#.... |
000074c0  74 79 70 65 25 20 ca 0d  23 be 11 20 c9 20 30 3a  |type% ..#.. . 0:|
000074d0  74 79 70 65 25 3d 2d 32  0d 23 c8 11 20 c9 20 31  |type%=-2.#.. . 1|
000074e0  3a 74 79 70 65 25 3d 2d  31 0d 23 d2 14 20 c9 20  |:type%=-1.#.. . |
000074f0  32 3a 74 79 70 65 25 3d  26 31 30 30 30 0d 23 dc  |2:type%=&1000.#.|
00007500  1f 20 c9 20 33 3a 74 79  70 65 25 3d 28 66 25 20  |. . 3:type%=(f% |
00007510  80 20 26 46 46 46 30 30  29 3e 3e 38 0d 23 e6 05  |. &FFF00)>>8.#..|
00007520  cb 0d 23 f0 19 e7 20 28  66 6c 25 80 31 29 3d 31  |..#... (fl%.1)=1|
00007530  20 8c 74 79 70 65 25 3d  2d 32 0d 23 fa 0a 3d 74  | .type%=-2.#..=t|
00007540  79 70 65 25 0d 24 04 05  3a 0d 24 0e 30 f4 20 46  |ype%.$..:.$.0. F|
00007550  4e 66 69 6c 65 6c 65 6e  67 74 68 20 3a 20 52 65  |Nfilelength : Re|
00007560  74 75 72 6e 20 74 68 65  20 6c 65 6e 67 74 68 20  |turn the length |
00007570  6f 66 20 61 20 66 69 6c  65 0d 24 18 15 f4 20 2d  |of a file.$... -|
00007580  31 20 69 66 20 6e 6f 74  20 66 6f 75 6e 64 0d 24  |1 if not found.$|
00007590  22 21 dd 20 a4 66 69 6c  65 6c 65 6e 67 74 68 28  |"!. .filelength(|
000075a0  66 24 29 3a ea 20 6c 65  6e 25 2c 65 78 2c 66 0d  |f$):. len%,ex,f.|
000075b0  24 2c 25 c8 99 20 22 58  4f 53 5f 46 69 6c 65 22  |$,%.. "XOS_File"|
000075c0  2c 35 2c 66 24 20 b8 20  65 78 2c 2c 2c 2c 6c 65  |,5,f$ . ex,,,,le|
000075d0  6e 25 3b 66 0d 24 36 1f  e7 20 65 78 3d 30 20 84  |n%;f.$6.. ex=0 .|
000075e0  20 28 66 20 80 20 31 29  3d 31 20 8c 6c 65 6e 25  | (f . 1)=1 .len%|
000075f0  3d 2d 31 0d 24 40 09 3d  6c 65 6e 25 0d 24 4a 05  |=-1.$@.=len%.$J.|
00007600  3a 0d 24 54 32 f4 20 46  4e 6c 65 61 66 6e 61 6d  |:.$T2. FNleafnam|
00007610  65 20 3a 20 52 65 74 75  72 6e 20 74 68 65 20 6c  |e : Return the l|
00007620  65 61 66 6e 61 6d 65 20  6f 66 20 74 68 65 20 66  |eafname of the f|
00007630  69 6c 65 0d 24 5e 3b f4  20 46 4e 70 61 74 68 6e  |ile.$^;. FNpathn|
00007640  61 6d 65 20 3a 20 52 65  74 75 72 6e 20 74 68 65  |ame : Return the|
00007650  20 64 69 72 65 63 74 6f  72 79 20 63 6f 6e 74 61  | directory conta|
00007660  69 6e 69 6e 67 20 74 68  65 20 66 69 6c 65 0d 24  |ining the file.$|
00007670  68 39 f4 20 46 4e 6c 6f  6e 67 66 69 6c 65 6e 61  |h9. FNlongfilena|
00007680  6d 65 20 3a 20 52 65 74  75 72 6e 20 74 68 65 20  |me : Return the |
00007690  66 75 6c 6c 20 70 61 74  68 6e 61 6d 65 20 6f 66  |full pathname of|
000076a0  20 61 20 66 69 6c 65 0d  24 72 18 dd 20 a4 6c 65  | a file.$r.. .le|
000076b0  61 66 6e 61 6d 65 28 66  24 29 3a ea 20 72 24 0d  |afname(f$):. r$.|
000076c0  24 7c 24 e7 20 a7 66 24  2c 22 3a 22 29 3e 30 20  |$|$. .f$,":")>0 |
000076d0  8c 66 24 3d c1 66 24 2c  a7 66 24 2c 22 3a 22 29  |.f$=.f$,.f$,":")|
000076e0  2b 31 29 0d 24 86 11 c8  8e 20 a7 66 24 2c 22 2e  |+1).$.... .f$,".|
000076f0  22 29 20 ca 0d 24 90 12  20 c9 20 30 20 20 20 20  |") ..$.. . 0    |
00007700  3a 72 24 3d 66 24 0d 24  9a 29 20 7f 20 3a 72 24  |:r$=f$.$.) . :r$|
00007710  3d a4 6c 65 61 66 6e 61  6d 65 28 c2 66 24 2c a9  |=.leafname(.f$,.|
00007720  28 66 24 29 2d a7 66 24  2c 22 2e 22 29 29 29 0d  |(f$)-.f$,"."))).|
00007730  24 a4 05 cb 0d 24 ae 07  3d 72 24 0d 24 b8 13 dd  |$....$..=r$.$...|
00007740  20 a4 70 61 74 68 6e 61  6d 65 28 66 24 29 0d 24  | .pathname(f$).$|
00007750  c2 4e e7 20 a7 66 24 2c  22 3a 22 29 3e 30 20 80  |.N. .f$,":")>0 .|
00007760  20 a7 66 24 2c 22 2e 22  29 3d 30 20 8c 3d c0 66  | .f$,".")=0 .=.f|
00007770  24 2c a7 66 24 2c 22 3a  22 29 29 20 8b e7 20 a7  |$,.f$,":")) .. .|
00007780  66 24 2c 22 3a 22 29 3d  30 20 80 20 a7 66 24 2c  |f$,":")=0 . .f$,|
00007790  22 2e 22 29 3d 30 20 8c  3d 22 40 22 0d 24 cc 22  |".")=0 .="@".$."|
000077a0  3d c0 66 24 2c a9 28 66  24 29 2d a9 28 a4 6c 65  |=.f$,.(f$)-.(.le|
000077b0  61 66 6e 61 6d 65 28 66  24 29 29 2d 31 29 0d 24  |afname(f$))-1).$|
000077c0  d6 2b f4 20 52 65 6d 6f  76 65 73 20 69 64 65 6e  |.+. Removes iden|
000077d0  74 69 66 69 65 72 73 20  73 75 63 68 20 61 73 20  |tifiers such as |
000077e0  53 63 72 61 70 3a 2e 2e  2e 0d 24 e0 16 dd a4 6c  |Scrap:....$....l|
000077f0  6f 6e 67 66 69 6c 65 6e  61 6d 65 28 66 24 29 0d  |ongfilename(f$).|
00007800  24 ea 40 c8 99 20 22 58  4f 53 5f 46 53 43 6f 6e  |$.@.. "XOS_FSCon|
00007810  74 72 6f 6c 22 2c 33 37  2c 66 24 2c 6d 65 73 73  |trol",37,f$,mess|
00007820  61 67 65 5f 62 75 66 66  65 72 25 2c 2c 2c 32 35  |age_buffer%,,,25|
00007830  36 20 b8 20 2c 2c 66 24  20 3b 66 6c 61 67 73 0d  |6 . ,,f$ ;flags.|
00007840  24 f4 1a e7 20 28 66 6c  61 67 73 20 80 20 31 29  |$... (flags . 1)|
00007850  3d 31 20 8c 66 24 3d 22  22 0d 24 fe 07 3d 66 24  |=1 .f$="".$..=f$|
00007860  0d 25 08 05 3a 0d 25 12  37 f4 20 2a 2a 2a 2a 2a  |.%..:.%.7. *****|
00007870  2a 2a 2a 20 4d 6f 64 75  6c 65 20 77 6f 72 6b 73  |*** Module works|
00007880  70 61 63 65 20 6d 61 6e  69 70 75 6c 61 74 69 6f  |pace manipulatio|
00007890  6e 20 72 6f 75 74 69 6e  65 20 2a 2a 0d 25 1c 05  |n routine **.%..|
000078a0  3a 0d 25 26 26 f4 20 46  4e 63 6c 61 69 6d 20 20  |:.%&&. FNclaim  |
000078b0  20 3a 20 43 6c 61 69 6d  20 61 6e 20 61 72 65 61  | : Claim an area|
000078c0  20 6f 66 20 52 4d 41 0d  25 30 2f f4 20 46 4e 72  | of RMA.%0/. FNr|
000078d0  65 6c 65 61 73 65 20 3a  20 52 65 6c 65 61 73 65  |elease : Release|
000078e0  20 61 20 63 6c 61 69 6d  65 64 20 61 72 65 61 20  | a claimed area |
000078f0  6f 66 20 52 4d 41 0d 25  3a 14 dd a4 63 6c 61 69  |of RMA.%:...clai|
00007900  6d 28 6c 65 6e 67 74 68  25 29 0d 25 44 3a ea 20  |m(length%).%D:. |
00007910  66 6c 61 67 73 3a e7 20  6c 65 6e 67 74 68 25 3c  |flags:. length%<|
00007920  31 8c 85 20 26 38 30 33  2c 22 43 61 6e 6e 6f 74  |1.. &803,"Cannot|
00007930  20 63 6c 61 69 6d 20 6e  65 67 61 74 69 76 65 20  | claim negative |
00007940  52 4d 41 22 0d 25 4e 2f  c8 99 20 22 58 4f 53 5f  |RMA".%N/.. "XOS_|
00007950  4d 6f 64 75 6c 65 22 2c  36 2c 2c 2c 6c 65 6e 67  |Module",6,,,leng|
00007960  74 68 25 20 b8 20 2c 2c  61 72 65 61 25 3b 66 6c  |th% . ,,area%;fl|
00007970  61 67 73 0d 25 58 1c e7  20 28 66 6c 61 67 73 20  |ags.%X.. (flags |
00007980  80 31 29 3e 30 20 8c 61  72 65 61 25 3d 2d 31 0d  |.1)>0 .area%=-1.|
00007990  25 62 0a 3d 61 72 65 61  25 0d 25 6c 16 dd f2 72  |%b.=area%.%l...r|
000079a0  65 6c 65 61 73 65 28 f8  20 61 72 65 61 25 29 0d  |elease(. area%).|
000079b0  25 76 2f e7 20 61 72 65  61 25 3e 30 20 8c c8 99  |%v/. area%>0 ...|
000079c0  20 22 4f 53 5f 4d 6f 64  75 6c 65 22 2c 37 2c 2c  | "OS_Module",7,,|
000079d0  61 72 65 61 25 3a 61 72  65 61 25 3d 2d 31 0d 25  |area%:area%=-1.%|
000079e0  80 05 e1 0d 25 8a 05 3a  0d 25 94 37 f4 20 2a 2a  |....%..:.%.7. **|
000079f0  2a 2a 2a 2a 2a 2a 20 54  61 73 6b 20 69 6e 74 65  |****** Task inte|
00007a00  72 61 63 74 69 6f 6e 20  72 6f 75 74 69 6e 65 73  |raction routines|
00007a10  20 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 0d  | **************.|
00007a20  25 9e 05 3a 0d 25 a8 33  f4 20 46 4e 74 61 73 6b  |%..:.%.3. FNtask|
00007a30  6e 61 6d 65 20 20 20 20  20 20 20 20 3a 20 72 65  |name        : re|
00007a40  74 75 72 6e 20 61 20 67  69 76 65 6e 20 74 61 73  |turn a given tas|
00007a50  6b 73 20 6e 61 6d 65 0d  25 b2 3c f4 20 46 4e 77  |ks name.%.<. FNw|
00007a60  69 6e 64 6f 77 74 61 73  6b 20 20 20 20 20 20 3a  |indowtask      :|
00007a70  20 72 65 74 75 72 6e 20  74 61 73 6b 20 68 61 6e  | return task han|
00007a80  64 6c 65 20 77 68 6f 20  6f 77 6e 73 20 77 69 6e  |dle who owns win|
00007a90  64 6f 77 0d 25 bc 37 f4  20 46 4e 72 65 61 64 74  |dow.%.7. FNreadt|
00007aa0  61 73 6b 73 74 72 69 6e  67 20 20 3a 20 72 65 61  |askstring  : rea|
00007ab0  64 20 61 20 73 74 72 69  6e 67 20 66 72 6f 6d 20  |d a string from |
00007ac0  67 69 76 65 6e 20 74 61  73 6b 0d 25 c6 36 f4 20  |given task.%.6. |
00007ad0  50 52 4f 43 72 65 61 64  74 61 73 6b 61 72 65 61  |PROCreadtaskarea|
00007ae0  20 20 3a 20 72 65 61 64  20 61 20 62 6c 6f 63 6b  |  : read a block|
00007af0  20 66 72 6f 6d 20 67 69  76 65 6e 20 74 61 73 6b  | from given task|
00007b00  0d 25 d0 3a f4 20 46 4e  66 69 6e 64 74 61 73 6b  |.%.:. FNfindtask|
00007b10  20 20 20 20 20 20 20 20  3a 20 72 65 74 75 72 6e  |        : return|
00007b20  20 74 61 73 6b 20 68 61  6e 64 6c 65 20 6f 66 20  | task handle of |
00007b30  6e 61 6d 65 64 20 74 61  73 6b 0d 25 da 1f dd a4  |named task.%....|
00007b40  74 61 73 6b 6e 61 6d 65  28 74 61 73 6b 25 29 3a  |taskname(task%):|
00007b50  ea 20 6e 61 6d 65 24 2c  66 0d 25 e4 38 c8 99 20  |. name$,f.%.8.. |
00007b60  22 58 54 61 73 6b 4d 61  6e 61 67 65 72 5f 54 61  |"XTaskManager_Ta|
00007b70  73 6b 4e 61 6d 65 46 72  6f 6d 48 61 6e 64 6c 65  |skNameFromHandle|
00007b80  22 2c 74 61 73 6b 25 20  b8 20 6e 61 6d 65 24 3b  |",task% . name$;|
00007b90  66 0d 25 ee 1a e7 20 28  66 20 80 31 29 20 8c 6e  |f.%... (f .1) .n|
00007ba0  61 6d 65 24 3d 22 4e 6f  6e 65 22 0d 25 f8 0a 3d  |ame$="None".%..=|
00007bb0  6e 61 6d 65 24 0d 26 02  1e dd a4 77 69 6e 64 6f  |name$.&....windo|
00007bc0  77 74 61 73 6b 28 77 69  6e 25 29 3a ea 20 74 61  |wtask(win%):. ta|
00007bd0  73 6b 25 0d 26 0c 2d 6d  65 73 73 61 67 65 5f 62  |sk%.&.-message_b|
00007be0  75 66 66 65 72 25 21 30  3d 32 30 3a 6d 65 73 73  |uffer%!0=20:mess|
00007bf0  61 67 65 5f 62 75 66 66  65 72 25 21 31 32 3d 30  |age_buffer%!12=0|
00007c00  0d 26 16 3e c8 99 20 22  57 69 6d 70 5f 53 65 6e  |.&.>.. "Wimp_Sen|
00007c10  64 4d 65 73 73 61 67 65  22 2c 31 39 2c 6d 65 73  |dMessage",19,mes|
00007c20  73 61 67 65 5f 62 75 66  66 65 72 25 2c 77 69 6e  |sage_buffer%,win|
00007c30  25 2c 2d 31 20 b8 20 2c  2c 74 61 73 6b 25 0d 26  |%,-1 . ,,task%.&|
00007c40  20 0a 3d 74 61 73 6b 25  0d 26 2a 25 dd a4 72 65  | .=task%.&*%..re|
00007c50  61 64 74 61 73 6b 73 74  72 69 6e 67 28 74 61 73  |adtaskstring(tas|
00007c60  6b 25 2c 6c 6f 63 25 29  3a ea 20 70 24 0d 26 34  |k%,loc%):. p$.&4|
00007c70  40 c8 99 22 57 69 6d 70  5f 54 72 61 6e 73 66 65  |@.."Wimp_Transfe|
00007c80  72 42 6c 6f 63 6b 22 2c  74 61 73 6b 25 2c 6c 6f  |rBlock",task%,lo|
00007c90  63 25 2c 68 61 6e 64 6c  65 2c 6d 65 73 73 61 67  |c%,handle,messag|
00007ca0  65 5f 62 75 66 66 65 72  25 2c 32 35 36 0d 26 3e  |e_buffer%,256.&>|
00007cb0  1e 3d a4 73 74 72 69 6e  67 30 28 6d 65 73 73 61  |.=.string0(messa|
00007cc0  67 65 5f 62 75 66 66 65  72 25 29 0d 26 48 27 dd  |ge_buffer%).&H'.|
00007cd0  f2 72 65 61 64 74 61 73  6b 61 72 65 61 28 74 61  |.readtaskarea(ta|
00007ce0  73 6b 25 2c 6c 6f 63 25  2c 74 6f 25 2c 6c 65 6e  |sk%,loc%,to%,len|
00007cf0  25 29 0d 26 52 35 c8 99  22 57 69 6d 70 5f 54 72  |%).&R5.."Wimp_Tr|
00007d00  61 6e 73 66 65 72 42 6c  6f 63 6b 22 2c 74 61 73  |ansferBlock",tas|
00007d10  6b 25 2c 6c 6f 63 25 2c  68 61 6e 64 6c 65 2c 74  |k%,loc%,handle,t|
00007d20  6f 25 2c 6c 65 6e 25 0d  26 5c 05 e1 0d 26 66 12  |o%,len%.&\...&f.|
00007d30  dd a4 66 69 6e 64 74 61  73 6b 28 61 24 29 0d 26  |..findtask(a$).&|
00007d40  70 0f ea 20 74 68 2c 63  6e 74 2c 74 24 0d 26 7a  |p.. th,cnt,t$.&z|
00007d50  3d c8 99 20 22 54 61 73  6b 4d 61 6e 61 67 65 72  |=.. "TaskManager|
00007d60  5f 45 6e 75 6d 65 72 61  74 65 54 61 73 6b 73 22  |_EnumerateTasks"|
00007d70  2c 2c 6d 65 73 73 61 67  65 5f 62 75 66 66 65 72  |,,message_buffer|
00007d80  25 2c 31 36 20 b8 20 63  6e 74 0d 26 84 0e c8 95  |%,16 . cnt.&....|
00007d90  20 63 6e 74 3c 3e 2d 31  0d 26 8e 37 20 74 68 3d  | cnt<>-1.&.7 th=|
00007da0  21 6d 65 73 73 61 67 65  5f 62 75 66 66 65 72 25  |!message_buffer%|
00007db0  3a 74 24 3d a4 73 74 72  69 6e 67 30 28 6d 65 73  |:t$=.string0(mes|
00007dc0  73 61 67 65 5f 62 75 66  66 65 72 25 21 34 29 0d  |sage_buffer%!4).|
00007dd0  26 98 41 20 c8 99 20 22  54 61 73 6b 4d 61 6e 61  |&.A .. "TaskMana|
00007de0  67 65 72 5f 45 6e 75 6d  65 72 61 74 65 54 61 73  |ger_EnumerateTas|
00007df0  6b 73 22 2c 63 6e 74 2c  6d 65 73 73 61 67 65 5f  |ks",cnt,message_|
00007e00  62 75 66 66 65 72 25 2c  31 36 20 b8 20 63 6e 74  |buffer%,16 . cnt|
00007e10  0d 26 a2 24 20 e7 20 74  24 3d 61 24 20 8c 63 6e  |.&.$ . t$=a$ .cn|
00007e20  74 3d 2d 31 20 8b e7 63  6e 74 3d 2d 31 20 8c 74  |t=-1 ..cnt=-1 .t|
00007e30  68 3d 2d 31 0d 26 ac 05  ce 0d 26 b6 07 3d 74 68  |h=-1.&....&..=th|
00007e40  0d 26 c0 05 3a 0d 26 ca  3f f4 20 46 4e 62 61 63  |.&..:.&.?. FNbac|
00007e50  6b 6f 66 77 69 6e 73 74  61 63 6b 20 3a 20 72 65  |kofwinstack : re|
00007e60  74 75 72 6e 20 77 69 6e  20 68 61 6e 64 6c 65 20  |turn win handle |
00007e70  6f 66 20 62 61 63 6b 20  6f 66 20 77 69 6e 20 73  |of back of win s|
00007e80  74 61 63 6b 0d 26 d4 3e  f4 20 46 4e 77 69 6e 73  |tack.&.>. FNwins|
00007e90  74 61 63 6b 6e 65 78 74  20 20 20 3a 20 72 65 74  |tacknext   : ret|
00007ea0  75 72 6e 20 77 69 6e 20  68 61 6e 64 6c 65 20 6f  |urn win handle o|
00007eb0  66 20 6e 65 78 74 20 77  69 6e 20 66 6f 72 77 61  |f next win forwa|
00007ec0  72 64 0d 26 de 18 dd a4  62 61 63 6b 6f 66 77 69  |rd.&....backofwi|
00007ed0  6e 73 74 61 63 6b 3a ea  20 49 0d 26 e8 2c 21 62  |nstack:. I.&.,!b|
00007ee0  25 3d 69 6e 66 6f 62 6f  78 25 3a c8 99 22 57 69  |%=infobox%:.."Wi|
00007ef0  6d 70 5f 47 65 74 57 69  6e 64 6f 77 53 74 61 74  |mp_GetWindowStat|
00007f00  65 22 2c 2c 62 25 0d 26  f2 0d e3 49 3d 34 b8 31  |e",,b%.&...I=4.1|
00007f10  36 88 34 0d 26 fc 15 20  62 25 21 49 3d 28 62 25  |6.4.&.. b%!I=(b%|
00007f20  21 49 29 2d 34 30 39 36  0d 27 06 06 ed 49 0d 27  |!I)-4096.'...I.'|
00007f30  10 24 62 25 21 32 38 3d  2d 32 3a c8 99 22 57 69  |.$b%!28=-2:.."Wi|
00007f40  6d 70 5f 4f 70 65 6e 57  69 6e 64 6f 77 22 2c 2c  |mp_OpenWindow",,|
00007f50  62 25 0d 27 1a 29 c8 99  22 57 69 6d 70 5f 47 65  |b%.'.).."Wimp_Ge|
00007f60  74 57 69 6e 64 6f 77 53  74 61 74 65 22 2c 2c 62  |tWindowState",,b|
00007f70  25 3a 7a 63 25 3d 62 25  21 32 38 0d 27 24 1c c8  |%:zc%=b%!28.'$..|
00007f80  99 22 57 69 6d 70 5f 43  6c 6f 73 65 57 69 6e 64  |."Wimp_CloseWind|
00007f90  6f 77 22 2c 2c 62 25 0d  27 2e 08 3d 7a 63 25 0d  |ow",,b%.'..=zc%.|
00007fa0  27 38 44 dd a4 77 69 6e  73 74 61 63 6b 6e 65 78  |'8D..winstacknex|
00007fb0  74 28 77 69 6e 25 29 3a  21 62 25 3d 77 69 6e 25  |t(win%):!b%=win%|
00007fc0  3a c8 99 22 57 69 6d 70  5f 47 65 74 57 69 6e 64  |:.."Wimp_GetWind|
00007fd0  6f 77 53 74 61 74 65 22  2c 2c 62 25 3a 3d 62 25  |owState",,b%:=b%|
00007fe0  21 32 38 0d 27 42 05 3a  0d 27 4c 37 f4 20 2a 2a  |!28.'B.:.'L7. **|
00007ff0  2a 2a 2a 2a 2a 2a 20 43  61 72 65 74 20 61 6e 64  |****** Caret and|
00008000  20 70 6f 69 6e 74 65 72  20 63 6f 6e 74 72 6f 6c  | pointer control|
00008010  20 70 72 6f 63 65 64 75  72 65 73 20 2a 2a 2a 0d  | procedures ***.|
00008020  27 56 05 3a 0d 27 60 3e  f4 20 50 52 4f 43 73 65  |'V.:.'`>. PROCse|
00008030  74 63 61 72 65 74 65 6e  64 20 3a 20 50 6c 61 63  |tcaretend : Plac|
00008040  65 20 74 68 65 20 63 61  72 65 74 20 61 74 20 74  |e the caret at t|
00008050  68 65 20 65 6e 64 20 6f  66 20 74 68 65 20 74 65  |he end of the te|
00008060  78 74 0d 27 6a 3e f4 20  50 52 4f 43 73 65 74 63  |xt.'j>. PROCsetc|
00008070  61 72 65 74 70 6f 73 20  3a 20 50 6c 61 63 65 20  |aretpos : Place |
00008080  74 68 65 20 63 61 72 65  74 20 61 74 20 70 6f 73  |the caret at pos|
00008090  20 77 69 74 68 69 6e 20  74 68 65 20 74 65 78 74  | within the text|
000080a0  0d 27 74 38 f4 20 50 52  4f 43 67 65 74 63 61 72  |.'t8. PROCgetcar|
000080b0  65 74 70 6f 73 20 3a 20  52 65 74 75 72 6e 20 74  |etpos : Return t|
000080c0  68 65 20 70 6f 73 69 74  69 6f 6e 20 6f 66 20 74  |he position of t|
000080d0  68 65 20 63 61 72 65 74  0d 27 7e 3a f4 20 50 52  |he caret.'~:. PR|
000080e0  4f 43 67 65 74 70 74 72  70 6f 73 20 20 20 3a 20  |OCgetptrpos   : |
000080f0  52 65 74 75 72 6e 20 74  68 65 20 6c 6f 63 61 74  |Return the locat|
00008100  69 6f 6e 20 6f 66 20 74  68 65 20 70 6f 69 6e 74  |ion of the point|
00008110  65 72 0d 27 88 1b dd f2  73 65 74 63 61 72 65 74  |er.'....setcaret|
00008120  65 6e 64 28 77 69 6e 2c  69 63 6f 6e 29 0d 27 92  |end(win,icon).'.|
00008130  34 f2 73 65 74 63 61 72  65 74 70 6f 73 28 77 69  |4.setcaretpos(wi|
00008140  6e 2c 69 63 6f 6e 2c a9  28 a4 67 65 74 69 63 6f  |n,icon,.(.getico|
00008150  6e 74 65 78 74 28 77 69  6e 2c 69 63 6f 6e 29 29  |ntext(win,icon))|
00008160  29 0d 27 9c 05 e1 0d 27  a6 21 dd f2 73 65 74 63  |).'....'.!..setc|
00008170  61 72 65 74 70 6f 73 28  77 69 6e 2c 69 63 6f 6e  |aretpos(win,icon|
00008180  2c 63 68 61 72 73 29 0d  27 b0 34 c8 99 20 22 57  |,chars).'.4.. "W|
00008190  69 6d 70 5f 53 65 74 43  61 72 65 74 50 6f 73 69  |imp_SetCaretPosi|
000081a0  74 69 6f 6e 22 2c 77 69  6e 2c 69 63 6f 6e 2c 30  |tion",win,icon,0|
000081b0  2c 30 2c 2d 31 2c 63 68  61 72 73 0d 27 ba 05 e1  |,0,-1,chars.'...|
000081c0  0d 27 c4 27 dd f2 67 65  74 63 61 72 65 74 70 6f  |.'.'..getcaretpo|
000081d0  73 28 f8 20 77 69 6e 2c  f8 20 69 63 6f 6e 2c f8  |s(. win,. icon,.|
000081e0  20 63 68 61 72 73 29 0d  27 ce 40 c8 99 20 22 57  | chars).'.@.. "W|
000081f0  69 6d 70 5f 47 65 74 43  61 72 65 74 50 6f 73 69  |imp_GetCaretPosi|
00008200  74 69 6f 6e 22 2c 2c 62  25 3a 77 69 6e 3d 21 62  |tion",,b%:win=!b|
00008210  25 3a 69 63 6f 6e 3d 62  25 21 34 3a 63 68 61 72  |%:icon=b%!4:char|
00008220  73 3d 62 25 21 32 30 0d  27 d8 05 e1 0d 27 e2 25  |s=b%!20.'....'.%|
00008230  dd f2 67 65 74 70 74 72  70 6f 73 28 f8 20 78 2c  |..getptrpos(. x,|
00008240  f8 20 79 2c f8 20 77 69  6e 2c f8 20 69 63 6f 6e  |. y,. win,. icon|
00008250  29 0d 27 ec 43 c8 99 20  22 57 69 6d 70 5f 47 65  |).'.C.. "Wimp_Ge|
00008260  74 50 6f 69 6e 74 65 72  49 6e 66 6f 22 2c 2c 62  |tPointerInfo",,b|
00008270  25 3a 78 3d 62 25 21 30  3a 79 3d 62 25 21 34 3a  |%:x=b%!0:y=b%!4:|
00008280  77 69 6e 3d 62 25 21 31  32 3a 69 63 6f 6e 3d 62  |win=b%!12:icon=b|
00008290  25 21 31 36 0d 27 f6 05  e1 0d 28 00 05 3a 0d 28  |%!16.'....(..:.(|
000082a0  0a 37 f4 20 2a 2a 2a 2a  2a 2a 2a 2a 20 43 6f 6e  |.7. ******** Con|
000082b0  66 69 67 75 72 61 74 69  6f 6e 20 73 65 74 74 69  |figuration setti|
000082c0  6e 67 73 20 63 6f 6e 74  72 6f 6c 20 2a 2a 2a 2a  |ngs control ****|
000082d0  2a 2a 2a 2a 2a 0d 28 14  05 3a 0d 28 1e 37 f4 20  |*****.(..:.(.7. |
000082e0  46 4e 72 65 61 64 63 6d  6f 73 20 20 20 20 3a 20  |FNreadcmos    : |
000082f0  52 65 61 64 20 61 20 62  79 74 65 20 6f 66 20 63  |Read a byte of c|
00008300  6f 6e 66 69 67 75 72 61  74 69 6f 6e 20 69 6e 66  |onfiguration inf|
00008310  6f 0d 28 28 38 f4 20 50  52 4f 43 77 72 69 74 65  |o.((8. PROCwrite|
00008320  63 6d 6f 73 20 3a 20 57  72 69 74 65 20 61 20 62  |cmos : Write a b|
00008330  79 74 65 20 6f 66 20 63  6f 6e 66 69 67 75 72 61  |yte of configura|
00008340  74 69 6f 6e 20 69 6e 66  6f 0d 28 32 14 dd a4 72  |tion info.(2...r|
00008350  65 61 64 63 6d 6f 73 28  62 79 74 65 29 0d 28 3c  |eadcmos(byte).(<|
00008360  23 c8 99 20 22 4f 53 5f  42 79 74 65 22 2c 31 36  |#.. "OS_Byte",16|
00008370  31 2c 62 79 74 65 20 b8  20 2c 2c 76 61 6c 75 65  |1,byte . ,,value|
00008380  0d 28 46 0a 3d 76 61 6c  75 65 0d 28 50 1b dd f2  |.(F.=value.(P...|
00008390  77 72 69 74 65 63 6d 6f  73 28 62 79 74 65 2c 76  |writecmos(byte,v|
000083a0  61 6c 75 65 29 0d 28 5a  1f c8 99 20 22 4f 53 5f  |alue).(Z... "OS_|
000083b0  42 79 74 65 22 2c 31 36  32 2c 62 79 74 65 2c 76  |Byte",162,byte,v|
000083c0  61 6c 75 65 0d 28 64 05  e1 0d 28 6e 05 3a 0d 28  |alue.(d...(n.:.(|
000083d0  78 37 f4 20 2a 2a 2a 2a  2a 2a 2a 2a 20 53 74 61  |x7. ******** Sta|
000083e0  74 75 73 20 66 69 6c 65  20 63 6f 6e 74 72 6f 6c  |tus file control|
000083f0  20 72 6f 75 74 69 6e 65  73 20 2a 2a 2a 2a 2a 2a  | routines ******|
00008400  2a 2a 2a 2a 2a 0d 28 82  05 3a 0d 28 8c 30 f4 20  |*****.(..:.(.0. |
00008410  50 52 4f 43 6d 61 6b 65  73 74 61 74 75 73 66 69  |PROCmakestatusfi|
00008420  6c 65 20 20 3a 20 43 72  65 61 74 65 20 61 20 73  |le  : Create a s|
00008430  74 61 74 75 73 20 66 69  6c 65 0d 28 96 31 f4 20  |tatus file.(.1. |
00008440  50 52 4f 43 63 6c 6f 73  65 73 74 61 74 75 73 66  |PROCclosestatusf|
00008450  69 6c 65 20 3a 20 43 6c  6f 73 65 20 74 68 65 20  |ile : Close the |
00008460  73 74 61 74 75 73 20 66  69 6c 65 0d 28 a0 33 f4  |status file.(.3.|
00008470  20 46 4e 72 65 61 64 73  74 61 74 75 73 66 69 6c  | FNreadstatusfil|
00008480  65 20 20 20 20 3a 20 4f  70 65 6e 20 61 20 73 74  |e    : Open a st|
00008490  61 74 75 73 20 66 69 6c  65 20 72 65 61 64 0d 28  |atus file read.(|
000084a0  aa 18 dd f2 6d 61 6b 65  73 74 61 74 75 73 66 69  |....makestatusfi|
000084b0  6c 65 28 66 24 29 0d 28  b4 2b ff 28 22 43 72 65  |le(f$).(.+.("Cre|
000084c0  61 74 65 20 22 2b 66 24  29 3a ff 28 22 53 65 74  |ate "+f$):.("Set|
000084d0  54 79 70 65 20 22 2b 66  24 2b 22 20 46 46 46 22  |Type "+f$+" FFF"|
000084e0  29 0d 28 be 33 73 74 61  74 66 69 6c 65 25 3d ae  |).(.3statfile%=.|
000084f0  28 66 24 29 3a d5 23 73  74 61 74 66 69 6c 65 25  |(f$):.#statfile%|
00008500  2c 22 50 72 6f 67 72 61  6d 3a 22 2b 41 70 70 6e  |,"Program:"+Appn|
00008510  61 6d 65 24 0d 28 c8 05  e1 0d 28 d2 15 dd f2 63  |ame$.(....(....c|
00008520  6c 6f 73 65 73 74 61 74  75 73 66 69 6c 65 0d 28  |losestatusfile.(|
00008530  dc 0f d9 23 73 74 61 74  66 69 6c 65 25 0d 28 e6  |...#statfile%.(.|
00008540  05 e1 0d 28 f0 2e f4 20  52 65 74 75 72 6e 20 46  |...(... Return F|
00008550  41 4c 53 45 20 69 66 20  6e 6f 74 20 63 6f 72 72  |ALSE if not corr|
00008560  65 63 74 20 6f 72 20 6e  6f 74 20 66 6f 75 6e 64  |ect or not found|
00008570  0d 28 fa 1d dd a4 72 65  61 64 73 74 61 74 75 73  |.(....readstatus|
00008580  66 69 6c 65 28 66 24 29  3a ea 20 61 24 0d 29 04  |file(f$):. a$.).|
00008590  10 ea 20 85 3a ee 20 85  20 ea 3a 3d a3 0d 29 0e  |.. .:. . .:=..).|
000085a0  13 73 74 61 74 66 69 6c  65 25 3d 8e 28 66 24 29  |.statfile%=.(f$)|
000085b0  0d 29 18 15 e7 20 73 74  61 74 66 69 6c 65 25 3d  |.)... statfile%=|
000085c0  30 20 8c 3d a3 0d 29 22  1c 61 24 3d a4 73 74 61  |0 .=..)".a$=.sta|
000085d0  74 75 73 67 65 74 28 22  50 72 6f 67 72 61 6d 22  |tusget("Program"|
000085e0  29 0d 29 2c 22 e7 20 61  24 3c 3e 41 70 70 6e 61  |).),". a$<>Appna|
000085f0  6d 65 24 20 8c d9 23 73  74 61 74 66 69 6c 65 25  |me$ ..#statfile%|
00008600  3a 3d a3 0d 29 36 06 3d  b9 0d 29 40 05 3a 0d 29  |:=..)6.=..)@.:.)|
00008610  4a 36 f4 20 50 52 4f 43  73 74 61 74 75 73 70 75  |J6. PROCstatuspu|
00008620  74 20 20 20 20 3a 20 50  75 74 20 74 68 65 20 73  |t    : Put the s|
00008630  74 72 69 6e 67 20 69 6e  20 73 74 61 74 75 73 20  |tring in status |
00008640  66 69 6c 65 0d 29 54 35  f4 20 50 52 4f 43 73 74  |file.)T5. PROCst|
00008650  61 74 75 73 6f 70 74 69  6f 6e 20 3a 20 50 75 74  |atusoption : Put|
00008660  20 74 68 65 20 76 61 6c  75 65 20 69 6e 20 73 74  | the value in st|
00008670  61 74 75 73 20 66 69 6c  65 0d 29 5e 34 f4 20 50  |atus file.)^4. P|
00008680  52 4f 43 73 74 61 74 75  73 66 6c 61 67 20 20 20  |ROCstatusflag   |
00008690  3a 20 50 75 74 20 74 68  65 20 66 6c 61 67 20 69  |: Put the flag i|
000086a0  6e 20 73 74 61 74 75 73  20 66 69 6c 65 0d 29 68  |n status file.)h|
000086b0  16 dd f2 73 74 61 74 75  73 70 75 74 28 65 24 2c  |...statusput(e$,|
000086c0  64 24 29 0d 29 72 19 d5  23 73 74 61 74 66 69 6c  |d$).)r..#statfil|
000086d0  65 25 2c 65 24 2b 22 3a  22 2b 64 24 0d 29 7c 05  |e%,e$+":"+d$.)|.|
000086e0  e1 0d 29 86 19 dd f2 73  74 61 74 75 73 6f 70 74  |..)....statusopt|
000086f0  69 6f 6e 28 65 24 2c 76  25 29 0d 29 90 1b d5 23  |ion(e$,v%).)...#|
00008700  73 74 61 74 66 69 6c 65  25 2c 65 24 2b 22 3a 25  |statfile%,e$+":%|
00008710  22 2b c3 76 25 0d 29 9a  05 e1 0d 29 a4 17 dd f2  |"+.v%.)....)....|
00008720  73 74 61 74 75 73 66 6c  61 67 28 65 24 2c 76 25  |statusflag(e$,v%|
00008730  29 0d 29 ae 35 e7 20 76  25 20 8c d5 23 73 74 61  |).).5. v% ..#sta|
00008740  74 66 69 6c 65 25 2c 65  24 2b 22 3a 4f 6e 22 20  |tfile%,e$+":On" |
00008750  8b d5 23 73 74 61 74 66  69 6c 65 25 2c 65 24 2b  |..#statfile%,e$+|
00008760  22 3a 4f 66 66 22 0d 29  b8 05 e1 0d 29 c2 05 3a  |":Off".)....)..:|
00008770  0d 29 cc 33 f4 20 50 52  4f 43 73 74 61 74 75 73  |.).3. PROCstatus|
00008780  6e 65 78 74 20 20 20 3a  20 52 65 61 64 20 74 68  |next   : Read th|
00008790  65 20 6e 65 78 74 20 73  74 61 74 75 73 20 65 6e  |e next status en|
000087a0  74 72 79 0d 29 d6 1b dd  f2 73 74 61 74 75 73 6e  |try.)....statusn|
000087b0  65 78 74 28 f8 20 61 24  2c f8 20 62 24 29 0d 29  |ext(. a$,. b$).)|
000087c0  e0 27 e7 20 c5 23 73 74  61 74 66 69 6c 65 25 20  |.'. .#statfile% |
000087d0  8c 61 24 3d 22 2a 45 2a  4e 2a 44 2a 22 3a 62 24  |.a$="*E*N*D*":b$|
000087e0  3d 22 22 3a e1 0d 29 ea  21 f5 3a 61 24 3d be 23  |="":..).!.:a$=.#|
000087f0  73 74 61 74 66 69 6c 65  25 3a fd c0 61 24 2c 31  |statfile%:..a$,1|
00008800  29 3c 3e 22 23 22 0d 29  f4 16 62 24 3d c1 61 24  |)<>"#".)..b$=.a$|
00008810  2c a7 61 24 2c 22 3a 22  29 2b 31 29 0d 29 fe 1e  |,.a$,":")+1).)..|
00008820  61 24 3d a4 75 70 70 65  72 28 c0 61 24 2c a7 61  |a$=.upper(.a$,.a|
00008830  24 2c 22 3a 22 29 2d 31  29 29 0d 2a 08 05 e1 0d  |$,":")-1)).*....|
00008840  2a 12 05 3a 0d 2a 1c 37  f4 20 46 4e 73 74 61 74  |*..:.*.7. FNstat|
00008850  75 73 67 65 74 20 20 20  20 20 20 3a 20 52 65 61  |usget      : Rea|
00008860  64 20 61 6e 20 65 6e 74  72 79 20 66 72 6f 6d 20  |d an entry from |
00008870  73 74 61 74 75 73 20 66  69 6c 65 0d 2a 26 35 f4  |status file.*&5.|
00008880  20 46 4e 73 74 61 74 75  73 67 65 74 76 20 20 20  | FNstatusgetv   |
00008890  20 20 3a 20 52 65 61 64  20 61 20 76 61 6c 75 65  |  : Read a value|
000088a0  20 66 72 6f 6d 20 73 74  61 75 73 20 66 69 6c 65  | from staus file|
000088b0  0d 2a 30 35 f4 20 46 4e  73 74 61 74 75 73 67 65  |.*05. FNstatusge|
000088c0  74 66 6c 61 67 20 20 3a  20 52 65 61 64 20 61 20  |tflag  : Read a |
000088d0  66 6c 61 67 20 66 72 6f  6d 20 73 74 61 74 75 73  |flag from status|
000088e0  20 66 69 6c 65 0d 2a 3a  13 dd a4 73 74 61 74 75  | file.*:...statu|
000088f0  73 67 65 74 28 61 24 29  0d 2a 44 2c ea 20 62 24  |sget(a$).*D,. b$|
00008900  2c 63 24 3a 61 24 3d a4  75 70 70 65 72 28 61 24  |,c$:a$=.upper(a$|
00008910  29 3a f2 73 74 61 74 75  73 6e 65 78 74 28 62 24  |):.statusnext(b$|
00008920  2c 63 24 29 0d 2a 4e 0e  e7 20 61 24 3c 3e 62 24  |,c$).*N.. a$<>b$|
00008930  20 8c 0d 2a 58 18 20 cf  23 73 74 61 74 66 69 6c  | ..*X. .#statfil|
00008940  65 25 3d 30 3a 62 24 3d  22 22 0d 2a 62 1e 20 c8  |e%=0:b$="".*b. .|
00008950  95 20 61 24 3c 3e 62 24  20 80 20 62 24 3c 3e 22  |. a$<>b$ . b$<>"|
00008960  2a 45 2a 4e 2a 44 2a 22  0d 2a 6c 18 20 20 f2 73  |*E*N*D*".*l.  .s|
00008970  74 61 74 75 73 6e 65 78  74 28 62 24 2c 63 24 29  |tatusnext(b$,c$)|
00008980  0d 2a 76 06 20 ce 0d 2a  80 05 cd 0d 2a 8a 07 3d  |.*v. ..*....*..=|
00008990  63 24 0d 2a 94 26 dd a4  73 74 61 74 75 73 67 65  |c$.*.&..statusge|
000089a0  74 76 28 61 24 29 3a 61  24 3d a4 73 74 61 74 75  |tv(a$):a$=.statu|
000089b0  73 67 65 74 28 61 24 29  0d 2a 9e 1c e7 20 c0 61  |sget(a$).*... .a|
000089c0  24 2c 31 29 3d 22 25 22  20 8c 3d bb 28 c1 61 24  |$,1)="%" .=.(.a$|
000089d0  2c 32 29 29 0d 2a a8 06  3d 30 0d 2a b2 29 dd a4  |,2)).*..=0.*.)..|
000089e0  73 74 61 74 75 73 67 65  74 66 6c 61 67 28 61 24  |statusgetflag(a$|
000089f0  29 3a 61 24 3d a4 73 74  61 74 75 73 67 65 74 28  |):a$=.statusget(|
00008a00  61 24 29 0d 2a bc 20 e7  20 61 24 3d 22 25 31 22  |a$).*. . a$="%1"|
00008a10  84 a4 75 70 70 65 72 28  61 24 29 3d 22 4f 4e 22  |..upper(a$)="ON"|
00008a20  8c 3d b9 0d 2a c6 06 3d  a3 0d ff                 |.=..*..=...|
00008a2b