Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared » !JFShared/BasicLib/WimpLib

!JFShared/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 » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared
Filename: !JFShared/BasicLib/WimpLib
Read OK:
File size: 8A38 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >WimpLib
   20REM LEN Justin Fletcher
   30REM Version : 1.74 (10 Sep 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:messptr%+=4: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 THENSYS "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4
 2390curmenu%=menu%:cmenux%=x-64:cmenuy%=y+20
 2400SYS "Wimp_CreateMenu",,menu%,x-64,y+20
 2410ENDPROC
 2420DEFPROCrecreatemenu
 2430SYS "Wimp_CreateMenu",,curmenu%,cmenux%,cmenuy%
 2440ENDPROC
 2450:
 2460REM PROCmenuuntick: Untick a group of options
 2470REM PROCmenutick  : Tick/untick option on menu
 2480REM PROCmenushade : Shade/unshade option on menu
 2490REM FNmenuticked  : Return TRUE if menu item is ticked
 2500REM FNmenushaded  : Return TRUE if menu item is shaded
 2510REM type = 0 for untick
 2520REM type = 1 for tick (also -1)
 2530REM type = 2 for toggle
 2540DEFPROCmenuuntick(menu,start,end)
 2550menu+=start*24+28
 2560REPEAT
 2570 !menu=!menu AND -2:start+=1:menu+=24
 2580UNTIL (end<>-1 AND start>end) OR ((menu!-24) AND &80)=&80
 2590ENDPROC
 2600DEFPROCmenutick(menu,option,toggle):menu+=option*24+28
 2610CASE toggle OF
 2620 WHEN 0:!menu=!menu AND -2
 2630 WHEN -1,1:!menu=!menu OR 1
 2640 WHEN 2:!menu=!menu EOR 1
 2650ENDCASE
 2660ENDPROC
 2670DEFPROCmenushade(menu,option,toggle):menu+=option*24+36
 2680CASE toggle OF
 2690 WHEN 0:!menu=!menu AND NOT(1<<22)
 2700 WHEN -1,1:!menu=!menu OR (1<<22)
 2710 WHEN 2:!menu=!menu EOR (1<<22)
 2720ENDCASE
 2730ENDPROC
 2740DEFFNmenuticked(menu%,item%)
 2750=((menu%!(28+24*item%)) AND 1)=1
 2760DEFFNmenushaded(menu%,item%)
 2770=((menu%!(28+24*item%)) AND 4)=4
 2780:
 2790REM PROCsetmenutext : Set the text for menu option
 2800REM FNgetmenutext   : Read the text for menu option
 2810DEFPROCsetmenutext(menu,option,text$):menu+=option*24+36
 2820IF (!menu AND&100)>0 THEN$(menu!4)=text$ ELSE$(menu+4)=text$
 2830ENDPROC
 2840DEFFNgetmenutext(menu,option):menu+=option*24+36:LOCAL text$
 2850IF (!menu AND&100)>0 THENtext$=$(menu!4) ELSEtext$=$(menu+4)
 2860=text$
 2870:
 2880REM FNdecodemenu : Return menu selection as string
 2890REM also returns for font if menu is fontmenu
 2900DEFFNdecodemenu(menu%):LOCAL cp%,ptr,b$,c$:cp%=menu%:ptr=0
 2910WHILE (b%!ptr>-1 AND cp%<>rmafontarea)
 2920 cp%=cp%!(32+(b%!ptr)*24):ptr+=4
 2930ENDWHILE
 2940IF cp%=rmafontarea AND b%!ptr<>0 THEN
 2950 SYS "Font_DecodeMenu",,rmafontarea,b%+ptr,STRING$(255,CHR$0),255 TO,,,m$
 2960ELSE
 2970 SYS "Wimp_DecodeMenu",,menu%,b%,STRING$(255,CHR$0),255 TO,,,m$
 2980 b$=""
 2990 REPEAT
 3000  c$=LEFT$(m$,INSTR(m$+".",".")-1):m$=MID$(m$,LEN(c$)+2)
 3010  c$=LEFT$(c$,INSTR(c$+" ^"," ^")-1)
 3020  c$=LEFT$(c$,INSTR(c$+" "+CHR$139," "+CHR$139)-1)
 3030  CASE RIGHT$(c$,3) OF
 3040   WHEN "Esc","Del","Ins","End","Hom","Cpy","F10","F11","F12","F13","Prt","Tab","Ret":c$=LEFT$(c$,LEN(c$)-4)
 3050  ENDCASE
 3060  IF MID$(c$,LEN(c$)-2,2)=" F" THENIFRIGHT$(c$)="0" OR VAL(RIGHT$(c$))<>0 THENc$=LEFT$(c$,LEN(c$)-3)
 3070  WHILE RIGHT$(c$)=" ":c$=LEFT$(c$):ENDWHILE
 3080  b$+=c$+"."
 3090 UNTILm$="" OR m$="."
 3100 IF m$="." THENb$+=".."
 3110 m$=LEFT$(b$)
 3120ENDIF
 3130=m$
 3140:
 3150REM FNgetfontmenu       : Return memory location of font menu
 3160REM PROCreleasefontmenu : Release memory used by fontmenu
 3170DEFFNgetfontmenu(font$):LOCAL space,ind
 3180SYS "Hourglass_On"
 3190SYS "Font_ListFonts",,,7<<19,,,,1 TO ,,,space,,ind
 3200PROCrelease(rmafontarea):rmafontarea=FNclaim(space+ind)
 3210IF rmafontarea<0 THENSYS "Hourglass_Off":=-1
 3220IF font$<>"" AND font$<>"System font" THEN
 3230 SYS "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,font$
 3240ELSE
 3250 SYS "Font_ListFonts",,rmafontarea,7<<19,space,rmafontarea+space,ind,-(font$="System font")
 3260ENDIF
 3270SYS "Hourglass_Off"
 3280=rmafontarea
 3290DEFPROCreleasefontmenu:PROCrelease(rmafontarea):ENDPROC
 3300:
 3310REM FNcreateftmenu    : Create a filetype menu
 3320REM PROCreleaseftmenu : Release space used by FT menu
 3330DEFFNcreateftmenu
 3340LOCAL len,name,type,flags,mlen,ilen,n$,v$,mst
 3350SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256 TO ,,len,name,type;flags
 3360mlen=28+24:ilen=9
 3370WHILE (flags AND1)<>1
 3380 IF type=0 THEN
 3390  mlen+=24:n$=RIGHT$(FNstring0(name),3)
 3400  SYS "XWimp_SpriteOp",24,,"Small_"+n$ TO;f
 3410  IF (f AND1)=1THEN
 3420   SYS "XWimp_SpriteOp",24,,"File_"+n$ TO;f
 3430   IF (f AND1)=0THENilen+=11+len ELSEilen+=len+11
 3440  ELSE
 3450   ilen+=12+len
 3460  ENDIF
 3470 ENDIF
 3480 SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name TO ,,len,name,type;flags
 3490ENDWHILE
 3500ftblk=FNclaim(mlen+ilen)
 3510IF ftblk=-1 THEN
 3520 ftblk=FNclaim(28+24+9)
 3530 $ftblk="File types":ftblk!12=&70207
 3540 ftblk!16=16*12:ftblk!20=&28:ftblk!24=0
 3550 ftblk!28=&80:ftblk!32=-1:ftblk!36=&7000121
 3560 ftblk!40=ftblk+28+24:ftblk!44=0:ftblk!48=9
 3570 $(ftblk+28+24)=""
 3580ELSE
 3590 $ftblk="File types":ftblk!12=&70207
 3600 ftblk!16=16*12:ftblk!20=&28:ftblk!24=0
 3610 ilen=mlen+ftblk:mlen=ilen-24:mst=mlen
 3620 SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,0 TO ,,len,name,type;flags
 3630 WHILE (flags AND1)<>1
 3640  IF type=0 THEN
 3650   message_buffer%!len=0:n$=RIGHT$(FNstring0(name),3):v$=FNstring0(message_buffer%)
 3660   mlen!0=0:mlen!4=-1
 3670   SYS "XWimp_SpriteOp",24,,"Small_"+n$ TO;f
 3680   IF (f AND1)=1THEN
 3690    SYS "XWimp_SpriteOp",24,,"File_"+n$ TO;f
 3700    IF (f AND1)=0THENn$="File_"+n$ ELSEn$="File_xxx"
 3710    mlen!8=&7000933
 3720   ELSE
 3730    n$="Small_"+n$:mlen!8=&7000133
 3740   ENDIF
 3750   mlen!12=ilen:$ilen=v$:ilen+=LEN(v$)+1
 3760   mlen!16=ilen:$ilen="s"+n$:ilen+=LEN(n$)+2
 3770   mlen!20=LEN(v$)+1:mlen-=24
 3780  ENDIF
 3790  SYS "XOS_ReadVarVal","File$Type_*",message_buffer%,256,name TO ,,len,name,type;flags
 3800 ENDWHILE
 3810 mlen!0=4:mlen!4=-1:mlen!8=&7000121:mlen!12=ilen
 3820 $ilen="":ilen+=9:mlen!16=-1:mlen!20=9:mlen-=24:!mst=&80
 3830ENDIF
 3840=ftblk
 3850DEFPROCreleaseftmenu:PROCrelease(ftblk):ENDPROC
 3860:
 3870REM ******** Window manipulation routines ***********
 3880:
 3890REM PROCclosewin      : Close a window
 3900REM PROCopenwin       : Open a window at top of stack
 3910REM PROCopenwinat     : Open a window at top-left corner x,y
 3920REM PROCopenwincentre : Open window in centre of screen
 3930REM PROCopenwinto     : Open window at position within TWA
 3940DEFPROCclosewin(win%)
 3950!b%=win%:SYS "Wimp_CloseWindow",,b%
 3960ENDPROC
 3970DEFPROCopenwin(win%)
 3980!b%=win%:SYS "Wimp_GetWindowState",,b%
 3990b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4000ENDPROC
 4010DEFPROCopenwinat(win%,x,y):LOCAL width,height
 4020!b%=win%:SYS "Wimp_GetWindowState",,b%
 4030width=b%!4-b%!12:height=b%!16-b%!8
 4040b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
 4050b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4060ENDPROC
 4070DEFPROCopenwincentre(win%):LOCAL width,height,top,right,x,y
 4080!b%=4:b%!4=5:b%!8=11:b%!12=12:b%!16=-1
 4090SYS "OS_ReadVduVariables",b%,b%+20
 4100right=b%!28+1<<b%!20:top=b%!32+1<<b%!24
 4110!b%=win%:SYS "Wimp_GetWindowState",,b%
 4120width=b%!4-b%!12:height=b%!16-b%!8
 4130x=(right-width)/2+width:y=(top-height)/2+height
 4140b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
 4150b%!28=-1:SYS "Wimp_OpenWindow",,b%
 4160ENDPROC
 4170REM l=left of VWA in TWA, t=top of VWA in TWA
 4180REM r=right of VWA in TWA, b=bottom of VWA in TWA
 4190REM Window does not move, but its size is altered to difference
 4200REM between l&w and t&h. Top left of VWA is positioned to tl.
 4210REM If rb = -1 then no actual size change, just position.
 4220DEFPROCopenwinto(win%,l,t,r,b)
 4230!b%=win%:SYS "Wimp_GetWindowState",,b%
 4240IF l=-1 THENl=b%!20
 4250IF t=-1 THENb=b%!24
 4260IF r=-1 THENr=b%!12-b%!4
 4270IF b=-1 THENt=b%!8-b%!16
 4280b%!12=b%!4+r-l:b%!8=b%!16+b-t:b%!20=l:b%!24=t
 4290SYS"Wimp_OpenWindow",,b%
 4300ENDPROC
 4310:
 4320REM PROCresizewinto : Resizes window and re-opens if needed
 4330REM Will keep to full size if possible
 4340DEFPROCresizewinto(win%,l,t,r,b)
 4350LOCAL full%,open%
 4360!b%=win%:SYS "Wimp_GetWindowState",,b%
 4370REM If full size, open full size, and if open, re-open
 4380open%=(b%!32 AND (1<<16))>0:IF NOT open% THENb%!28=-3
 4390SYS "Wimp_OpenWindow",,b%:SYS "Wimp_GetWindowState",,b%
 4400full%=(b%!32 AND (1<<18))>0
 4410b%!68=l:b%!72=b:b%!76=r:b%!80=t
 4420SYS "Wimp_SetExtent",win%,b%+68
 4430IF full% THENb%!8=b%!16+b-t:b%!12=b%!4+r-l
 4440SYS "Wimp_OpenWindow",,b%
 4450IF open% THENSYS "Wimp_ForceRedraw",win%,l,b,r,t ELSESYS "Wimp_CloseWindow",,b%
 4460ENDPROC
 4470REMfull%=( (((b%!12)-(b%!4))=b%!52) AND (((b%!16)-(b%!8))=b%!56) )
 4480:
 4490REM PROCwinsetextent : Set the maximum extent of window (TWA)
 4500DEFPROCwinsetextent(win%,l,t,r,b)
 4510!b%=win%:SYS "Wimp_GetWindowInfo",,b%+1
 4520IF l=-1 THENl=b%!44
 4530IF b=-1 THENb=b%!48
 4540IF r=-1 THENr=b%!52
 4550IF t=-1 THENt=b%!56
 4560b%!44=l:b%!48=b:b%!52=r:b%!56=t
 4570SYS"XWimp_SetExtent",win%,b%+44
 4580ENDPROC
 4590:
 4600REM PROCforceredraw : Redraw the specified part of the window
 4610DEFPROCforceredraw(win%,l,t,r,b)
 4620SYS "Wimp_ForceRedraw",win%,l,b,r,t
 4630ENDPROC
 4640:
 4650REM PROCwindowtitle : Set window title (only if indirected)
 4660DEF PROCwindowtitle(win%,title$)
 4670LOCAL loc%,a$
 4680b%!0=win%:SYS "Wimp_GetWindowInfo",,b%+1
 4690loc%=!(b%+76):a$=FNmsgtext(title$)
 4700IF FNstring0(loc%)<>a$ THEN
 4710 $loc%=a$:b%!32=win%:SYS "Wimp_GetWindowOutline",,b%+32
 4720 SYS "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
 4730ENDIF
 4740ENDPROC
 4750:
 4760REM ************ Nested Window Manager specific ************
 4770REM PROCembedwin     : embeds a window within another
 4780REM PROCembedwinwith : embeds a window within another with winflgs
 4790REM PROCunembedwin   : unembed a window from another
 4800REM FNparentwin      : Returns the parent window of a child
 4810DEFPROCembedwin(parent%,child%,flags%)
 4820!b%=child%:SYS "Wimp_GetWindowState",,b%
 4830SYS "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% AND NOT 1
 4840ENDPROC
 4850DEFPROCembedwinwith(parent%,child%,flags%,winflags%)
 4860!b%=child%:SYS "Wimp_GetWindowState",,b%:b%!32=winflags%
 4870SYS "Wimp_OpenWindow",,b%,&4B534154,parent%,flags% OR 1
 4880ENDPROC
 4890DEFPROCunembedwin(parent%,child%)
 4900!b%=child%:SYS "Wimp_GetWindowState",,b%
 4910SYS "Wimp_CloseWindow",,b%,&4B534154,parent%
 4920ENDPROC
 4930DEFFNparentwin(child%)
 4940LOCAL parent%
 4950!b%=child%:SYS "Wimp_GetWindowState",,b%,&4B534154 TO ,,,parent%
 4960=parent%
 4970:
 4980REM ******** Icon manipulation routines *************
 4990:
 5000REM FNcreateicon : Create an icon with set parameters
 5010REM window,x,y, width, height, title, validation, colours,
 5020REM ESG, button type, flags
 5030REM col could be font handle if use font is set
 5040REM otherwise col is &BF (B=background, F=foreground) (usu. &17)
 5050REM Quick flags : %AFVHB00 (A=Font, F=Filled, B=Border)
 5060REM Flags :
 5070REM 0 : Text           8 : N/A
 5080REM 1 : Sprite         9 : Right Justified
 5090REM 2 : Bordered      10 : Multiple selection with adjust
 5100REM 3 : H Centre      11 : Small sprite
 5110REM 4 : V Centre      20 : ?
 5120REM 5 : Filled        21 : Inverted
 5130REM 6 : Use fonts     22 : Shaded
 5140REM 7 : N/A           23 : ?
 5150REM Button types :
 5160REM 0 : Ignore clicks
 5170REM 1 : Notify when over
 5180REM 2 : Clicks repeat & notify
 5190REM 3 : Clicks debounce & notify
 5200REM 4 : Click selects, release notifies, or deselect if moved
 5210REM 5 : Click selects, 2 clicks notifies
 5220REM 6 : As 3 but will drag
 5230REM 7 : As 4 but will drag
 5240REM 8 : As 5 but will drag
 5250REM 9 : Menu icon
 5260REM 10: Click=but*256,drag=but*16,2 clicks=but
 5270REM 11: Radio (Validation format : Soptoff,opton)
 5280REM 12/13 : N/A
 5290REM 14: Writeable/Clickable/Draggable
 5300REM 15: Writeable
 5310DEFFNcreateicon(win,x,y,w,h,title$,valid$,col,esg,but,flags)
 5320LOCAL handle:title$=FNmsgtext(title$)
 5330b%!0=win:b%!4=x:b%!8=y-h:b%!12=x+w:b%!16=y
 5340b%!20=(flags AND (%111001111111+(15<<20)))+(col<<24)
 5350b%!20+=(esg<<16)+(but<<12)
 5360IF valid$<>"" OR LEN(title$)>11 OR title$=CHR$0 THEN
 5370 IF title$=CHR$0 THEN
 5380  b%!24=FNindirect(STRING$(255,CHR$0)):b%!32=256
 5390 ELSE
 5400  b%!24=FNindirect(title$):b%!32=LEN(title$)+1
 5410 ENDIF
 5420 b%!28=FNindirect(valid$):b%!20+=1<<8
 5430ELSE
 5440 $(b%+24)=title$
 5450ENDIF
 5460IF ((b%!20) AND &103)=&3 THENERROR &803,"Cannot make a sprite/text icon without validation"
 5470IF (flags AND 3)=0 THENb%!20+=1
 5480IF FNlower(LEFT$(valid$,1))="s" THEN b%!20=b%!20 OR 2
 5490SYS "Wimp_CreateIcon",,b% TO handle
 5500=handle
 5510:
 5520REM PROCdeleteicon : Delete the icon from the window
 5530DEFPROCdeleteicon(win,icon)
 5540!b%=win:b%!4=icon:SYS "Wimp_DeleteIcon",,b%
 5550ENDPROC
 5560:
 5570REM FNCreateIconBarIcon : Create an icon for the icon bar
 5580REM Icon-bar positions (low byte)
 5590REM 1 = right, 2 = left
 5600REM 3 = left relative to (high byte) icon
 5610REM 4 = right relative to (high byte) icon
 5620REM 5 = left, high priority (high byte=priority value)
 5630REM 6 = left, low priority (ditto)
 5640REM 7 = right, low priority (ditto)
 5650REM 8 = right, high priority (ditto)
 5660DEFFNCreateIconBarIcon(Spr$,title$,pos%):LOCAL ic%,w%,m%,e%
 5670title$=FNmsgtext(title$):b%!0=-(ABS(pos%) AND &FF)
 5680b%!4=0:b%!8=-16:b%!12=12+16*LEN(title$):b%!16=88
 5690IFb%!12<12+16*4 THEN b%!12=12+16*4
 5700IF title$<>"" THEN
 5710 b%!20=(1<<28)+(7<<24)+(3<<12)+(%01011)+(1<<8)
 5720 b%!24=FNindirect(title$)
 5730 b%!28=FNindirect("S"+Spr$)
 5740 b%!32=LEN(title$)+1
 5750ELSE
 5760 b%!20=(1<<28)+(7<<24)+(3<<12)+(%11010)
 5770 $(b%+24)=Spr$
 5780ENDIF
 5790SYS "Wimp_SpriteOp",&128,,LEFT$(Spr$,INSTR(Spr$+",",",")) TO,,,w%,m%
 5800SYS "XOS_ReadModeVariable",m%,4 TO ,,e%:w%=(w%+1)<<e%
 5810IF w%>b%!12 THENb%!12=w%
 5820IF (ABS(pos%)AND&FF)=3 OR (ABS(pos%)AND&FF)=4 THENpos%=ABS(pos%)>>8 ELSEpos%=(ABS(pos%) AND &FF00)<<16
 5830SYS "Wimp_CreateIcon",pos%,b% TO ic%
 5840=ic%
 5850:
 5860REM FNgeticonstate : Return -1 if icon is selected,0 otherwise
 5870DEF FNgeticonstate(win%,icon%)
 5880!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 5890=(b%!24>>21 AND 1)>0
 5900:
 5910REM PROCiconshade  : unshade/shade/toggle an icon
 5920REM PROCiconstate  : unselect/select/toggle an icon
 5930REM PROCseticonbit : set/unset/toggle a bit in an icon
 5940DEFPROCiconshade(win%,icon%,type%)
 5950PROCseticonbit(win%,icon%,22,type%)
 5960ENDPROC
 5970DEFPROCiconstate(win%,icon%,type%)
 5980PROCseticonbit(win%,icon%,21,type%)
 5990ENDPROC
 6000REM type = 0 for untick
 6010REM type = 1 for tick (also -1)
 6020REM type = 2 for toggle
 6030DEFPROCseticonbit(win%,icon%,bit%,type%)
 6040LOCAL s%,t%
 6050CASE type% OF
 6060 WHEN 0:s%=0<<bit%:t%=1<<bit%
 6070 WHEN -1,1:s%=1<<bit%:t%=1<<bit%
 6080 WHEN 2:s%=1<<bit%:t%=0<<bit%
 6090ENDCASE
 6100b%!0=win%:b%!4=icon%:b%!8=s%:b%!12=t%
 6110SYS "Wimp_SetIconState",,b%
 6120ENDPROC
 6130:
 6140REM PROCpressicon  : Make the icon pressed and released
 6150REM PROCredrawicon : Force the redraw of the icon
 6160DEFPROCpressicon(win%,icon%)
 6170LOCAL t%:PROCseticonbit(win%,icon%,21,1)
 6180t%=TIME:REPEAT:UNTILTIME>t%+15:PROCseticonbit(win%,icon%,21,0)
 6190ENDPROC
 6200DEFPROCredrawicon(win%,icon%)
 6210win%+=win%=-1:!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6220SYS "Wimp_ForceRedraw",win%,b%!8,b%!12,b%!16,b%!20
 6230ENDPROC
 6240:
 6250REM FNgeticontext   : return icons text string (or sprite)
 6260REM PROCseticontext : set icons text string (or sprite)
 6270DEFFNgeticontext(win%,icon%)
 6280b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6290IF ((b%!24) AND &100)=0 THEN=FNstring0(b%+28)
 6300=FNstring0(b%!28)
 6310DEFPROCseticontext(win%,icon%,text$):LOCAL i%
 6320text$=FNmsgtext(text$):SYS "Wimp_GetCaretPosition",,b%
 6330i%=(!b%=win%) AND (icon%=b%!4)
 6340b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6350IF ((b%!24) AND &100)=0 THEN ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6360IF FNstring0(b%!28)<>text$ THEN
 6370 IF LEN(text$)<b%!36 THEN$(b%!28)=text$ ELSEERROR &803,"Text too long for icon (#"+STR$icon%+")"
 6380 !b%=win%:b%!4=icon%:b%!8=0:b%!12=0:SYS "Wimp_SetIconState",,b%
 6390 IF i% AND (b%!24 AND 1)=1 THENSYS "Wimp_SetCaretPosition",win%,icon%,-1,-1,-1,LEN(text$)
 6400ENDIF
 6410ENDPROC
 6420:
 6430REM FNgeticonvalid   : return icons validation string
 6440REM PROCseticonvalid : set icons validation string
 6450REM Remember not to exceed the original validation string's
 6460REM length.
 6470DEFFNgeticonvalid(win%,icon%)
 6480b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6490IF ((b%!24) AND &100)=0 ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6500=FNstring0(b%!32)
 6510DEFPROCseticonvalid(win%,icon%,text$)
 6520b%!0=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6530IF ((b%!24) AND &100)=0 THEN ERROR &803,"Icon isn't indirected (#"+STR$icon%+")"
 6540$(b%!32)=text$:PROCredrawicon(win%,icon%)
 6550ENDPROC
 6560:
 6570REM PROCdragicon : Start a drag box
 6580REM bound% should be TRUE if you wish the icon to stay within the
 6590REM window
 6600DEFPROCdragicon(win%,icon%,bound%)
 6610!b%=win%:SYS "Wimp_GetWindowState",,b%
 6620sx%=b%!20:sy%=b%!24
 6630x0%=b%!4-sx%:y0%=b%!8-sy%:x1%=b%!12-sx%:y1%=b%!16-sy%
 6640!b%=win%:b%!4=icon%:SYS "Wimp_GetIconState",,b%
 6650b%!8+=x0%:b%!12+=y1%:b%!16+=x0%:b%!20+=y1%
 6660IF bound%=TRUE THEN
 6670 b%!24=x0%+sx%:b%!28=y0%+sy%:b%!32=x1%+sx%:b%!36=y1%+sy%
 6680ELSE
 6690 b%!40=4:b%!44=5:b%!48=11:b%!52=12:b%!56=-1
 6700 SYS "OS_ReadVduVariables",b%+40,b%+40
 6710 b%!24=0:b%!28=0:b%!32=b%!48+1<<b%!40:b%!36=b%!52+1<<b%!44
 6720ENDIF
 6730b%!4=5:REM Drag type
 6740SYS "Wimp_DragBox",,b%
 6750ENDPROC
 6760:
 6770REM PROCdragsave : Initiate a save after DragDone event
 6780DEFPROCdragsave(win%,icon%,type%,size%)
 6790PROCgetptrpos(x,y,win,icon):REM Get drag to location
 6800f$=FNleafname(FNgeticontext(win%,icon%))
 6810!b%=(48+LEN(f$)) AND NOT3
 6820b%!12=0:b%!16=1:b%!20=win:b%!24=icon:b%!28=x:b%!32=y
 6830b%!36=size%:b%!40=type%:$(b%+44)=f$
 6840SYS "Wimp_SendMessage",18,b%,win,icon
 6850ENDPROC
 6860:
 6870REM ******** !Help responsive routines **************
 6880:
 6890REM PROCreadhelp : read help from application and send
 6900REM PROCsendhelp : send help to application
 6910REM \S for "Click SELECT to "
 6920REM \R for "Move the pointer right to "
 6930REM \A for "Click ADJUST to "
 6940REM \T for "This is the "
 6950REM \G for "This option is greyed out because "
 6960REM \W for "This window is "
 6970REM \D for "Drag SELECT to "
 6980REM \d for "Drag ADJUST to "
 6990REM \w for "window"
 7000REM \s for "SELECT"
 7010REM \a for "ADJUST"
 7020REM |M for return
 7030REM FNString$FN to include string
 7040REM > prefix to look up in message file
 7050REM Menu help icons will be searched as HM<menustring>, with
 7060REM spaces replaced with _'s
 7070REM NB if no full stop then one will be added
 7080REM Format for help :
 7090REM  { window,help message for no icon
 7100REM    { icon number, message } repeated
 7110REM  } repeated
 7120REM  { -2, {iconbar message} } by choice
 7130REM  -1,-1 to end
 7140REM NB window submenus must have help strings
 7150REM Format for menu help :
 7160REM  { menu, -1,-1,-1 or menu, -1,0,help for all the items
 7170REM    { opt1,opt2,opt3,help
 7180REM   or -1,string,-1,help } repeated
 7190REM  } repeated
 7200REM  -2,-2,-2,-2
 7210DEFPROCreadhelp(win,icon,to)
 7220LOCAL lwin,val,help$,found,a$,m$,m2$,mh$:found=FALSE:lwin=-1
 7230REPEAT
 7240 READ val,help$
 7250 IF val>(1<<16) OR val<0 THEN
 7260  IF lwin=win THEN
 7270   val=icon:help$="":m2$=m$
 7280  ELSE
 7290   lwin=val:m$=help$
 7300  ENDIF
 7310 ENDIF
 7320 IF val=icon AND lwin=win THEN
 7330  IF icon=-1 OR help$="" THEN
 7340   PROCsendhelp(FNmsgtext(m$)+"|M",to)
 7350  ELSE
 7360   m$=FNmsgtext(m$):IF INSTR(m$,"|M")>0 THENm$=LEFT$(m$,INSTR(m$,"|M")-1)
 7370   PROCsendhelp(FNmsgtext(m$)+"|M"+FNmsgtext(help$),to)
 7380  ENDIF
 7390  found=TRUE
 7400 ENDIF
 7410UNTIL help$="-1" OR found=TRUE
 7420IF NOT found THEN
 7430 !message_buffer%=-1:message_buffer%!4=-1:message_buffer%!8=-1
 7440 SYS "Wimp_GetMenuState",1,message_buffer%,win,icon
 7450 IF !message_buffer%<>-1 THEN
 7460  val=b%:b%=message_buffer%:mh$=FNdecodemenu(curmenu%):b%=val
 7470  m$=mh$:WHILE INSTR(m$," ")>0:MID$(m$,INSTR(m$," "),1)="_":ENDWHILE
 7480  help$=FNmsgtoken("HM"+m$)
 7490  IF help$<>"HM"+m$ THEN
 7500   PROCsendhelp(help$,to)
 7510  ELSE
 7520   REPEAT
 7530    READ m$,val,help$,help$
 7540   UNTIL EVAL(m$)=curmenu% OR m$="-2"
 7550   IF m$<>"-2" THEN
 7560    IF val>-1 THEN
 7570     PROCsendhelp(help$,to):found=TRUE
 7580    ELSE
 7590     REPEAT
 7600      READ lwin,m$,val,help$
 7610      IF VAL(m$)=0 AND m$<>"0" THEN
 7620       IF mh$=m$ THENPROCsendhelp(help$,to):found=TRUE
 7630      ELSE
 7640       IF lwin=message_buffer%!0 AND VAL(m$)=message_buffer%!4 AND val=message_buffer%!8 THEN
 7650        PROCsendhelp(help$,to):found=TRUE
 7660       ENDIF
 7670      ENDIF
 7680     UNTILfound=TRUE OR lwin=-2 OR lwin >&8000
 7690    ENDIF
 7700   ENDIF
 7710  ENDIF
 7720 ENDIF
 7730ENDIF
 7740ENDPROC
 7750DEFPROCsendhelp(help$,to):help$=FNmsgtext(help$)
 7760IF RIGHT$(help$,2)<>"|M" THENhelp$+="|M"
 7770LOCAL b$,c$
 7780help$=FNsubstvars(help$)
 7790WHILE INSTR(help$,"|M")>0
 7800 b$=LEFT$(help$,INSTR(help$,"|M")-1):help$=MID$(help$,LEN(b$)+3)
 7810 IF INSTR("!.?",RIGHT$(b$,1))=0 THENb$+="."
 7820 c$+=b$+"|M"
 7830ENDWHILE
 7840b%!12=b%!8:b%!4=to:b%!16=&503:$(b%+20)=c$+CHR$0
 7850b%!0=20+(LEN(c$)+4) AND -4
 7860SYS "Wimp_SendMessage",17,b%,b%!4
 7870ENDPROC
 7880:
 7890REM ******** MessageTrans interface routines ********
 7900:
 7910REM PROCopenmessages  : open a MessageTrans file for input
 7920REM PROCclosemessages : close a MessageTrans file
 7930DEFPROCopenmessages:LOCAL f,l
 7940IF msgbuffer%<>-1 THENERROR &803,"Message file already open"
 7950SYS "MessageTrans_FileInfo",,Appdir$+".Messages" TO f,,l
 7960IF (f AND1)=1 THENmsgbuffer2%=0 ELSEmsgbuffer2%=FNclaim(l)
 7970IF msgbuffer2%=-1 THENERROR &803,"No room for secondary MessageTrans buffer"
 7980msgbuffer%=FNclaim(16):IF msgbuffer%=-1 THENPROCrelease(msgbuffer2%):ERROR &803,"No room for primary MessageTrans buffer"
 7990SYS "MessageTrans_OpenFile",msgbuffer%,Appdir$+".Messages",msgbuffer2%
 8000ENDPROC
 8010DEFPROCclosemessages
 8020LOCAL ERROR
 8030ON ERROR LOCAL:VDU4:REPORT:PRINT" at ";ERL:G=GET:ENDPROC
 8040IF msgbuffer%>-1 THEN
 8050 SYS "XMessageTrans_CloseFile",msgbuffer%
 8060 PROCrelease(msgbuffer%):PROCrelease(msgbuffer2%)
 8070ENDIF
 8080ENDPROC
 8090:
 8100REM FNmsgtoken        : translate a token into a string
 8110REM FNmsgtext         : translate text to a token if prefix is >
 8120DEFFNmsgtoken(t$):LOCAL s1$,s2$,s3$,a$,len%,f
 8130IF msgbuffer%=-1 THEN=t$
 8140a$=MID$(t$,INSTR(t$+":",":")+1):t$=LEFT$(t$,INSTR(t$+":",":")-1)
 8150s1$=LEFT$(a$,INSTR(a$+":",":")-1)
 8160IF LEFT$(s1$,1)="|" THEN
 8170 s1$=MID$(a$,2):s2$="":s3$=""
 8180ELSE
 8190 a$=MID$(a$,LEN(s1$)+2):s2$=LEFT$(a$,INSTR(a$+":",":")-1)
 8200 IF LEFT$(s2$,1)="|" THENs2$=MID$(a$,2):s3$="" ELSEs3$=MID$(a$,LEN(s2$)+2)
 8210ENDIF
 8220SYS "XMessageTrans_Lookup",msgbuffer%,t$,message_buffer%,256,s1$,s2$,s3$ TO ,,,len%;f
 8230IF (f AND1)=1 THEN=t$ ELSEmessage_buffer%?len%=13
 8240=FNsubstvars($message_buffer%)
 8250DEFFNmsgtext(a$)
 8260IF LEFT$(a$,1)=">" THENa$=FNmsgtoken(MID$(a$,2))
 8270=a$
 8280:
 8290REM ******** String manipulation routines ***********
 8300:
 8310REM FNstring0 : Return 0-terminated string at location
 8320DEFFNstring0(a%):LOCAL a$:IF a%=0 THEN=""
 8330WHILE?a%>31 ANDLEN(a$)<255:a$=a$+CHR$?a%:a%=a%+1:ENDWHILE
 8340=a$
 8350:
 8360REM FNlower       : Return given string in lower case
 8370REM FNupper       : Return given string in upper case
 8380REM FNtidy        : Return given string in tidy format
 8390REM FNstripspaces : Remove spaces from start and end of string
 8400DEFFNlower(a$):LOCAL c$,b$,I
 8410FORI=1TOLEN(a$)
 8420c$=MID$(a$,I,1):IF c$>="A"ANDc$<="Z"THENc$=CHR$(ASC(c$)+32)
 8430b$+=c$:NEXT:=b$
 8440DEFFNupper(a$):LOCAL c$,b$,I
 8450FORI=1TOLEN(a$)
 8460c$=MID$(a$,I,1):IF c$>="a"ANDc$<="z"THENc$=CHR$(ASC(c$)-32)
 8470b$+=c$:NEXT:=b$
 8480DEFFNtidy(a$):LOCAL cap,b$,I,c$
 8490cap=TRUE
 8500FORI=1TOLEN(a$)
 8510 b$=MID$(a$,I,1):IF b$>="a"ANDb$<="z" THENb$=CHR$(ASC(b$)-32)
 8520 IF (b$<"A" ORb$>"Z") AND b$<>"'" THEN
 8530  cap=TRUE
 8540 ELSE
 8550  IF cap=FALSE AND b$<>"'" THENb$=CHR$(ASC(b$)+32) ELSEcap=FALSE
 8560 ENDIF:c$+=b$
 8570NEXT:=c$
 8580DEFFNstripspaces(f$)
 8590WHILE RIGHT$(f$,1)=" " OR RIGHT$(f$,1)=CHR$9:f$=LEFT$(f$):ENDWHILE
 8600WHILE LEFT$(f$,1)=" " OR LEFT$(f$,1)=CHR$9:f$=MID$(f$,2):ENDWHILE
 8610=f$
 8620:
 8630REM FNsubstvars  : Substitute string for FNvar$FN
 8640REM FNsubstvarsp : Substitute string for FNvar$FN with prefix
 8650REM FNgstrans    : Perform GSTrans on string specified
 8660DEFFNsubstvarsp(a$,c$)
 8670LOCAL b$,d$:LOCAL ERROR:ON ERROR LOCAL:=a$
 8680WHILE INSTR(a$,"�")>0
 8690 b$=MID$(a$,INSTR(a$,"�")+1):b$=LEFT$(b$,INSTR(b$,"�")-1)
 8700 d$=c$+b$:IF RIGHT$(d$,1)<>"$" THENd$="STR$("+d$+")"
 8710 a$=LEFT$(a$,INSTR(a$,"�")-1)+EVAL(d$)+MID$(a$,INSTR(a$,"�")+LEN(b$)+2)
 8720ENDWHILE
 8730=a$
 8740DEFFNsubstvars(a$)
 8750LOCAL b$,d$:LOCAL ERROR:ON ERROR LOCAL:=a$
 8760WHILE INSTR(a$,"�")>0
 8770 b$=MID$(a$,INSTR(a$,"�")+1):b$=LEFT$(b$,INSTR(b$,"�")-1)
 8780 d$=b$:IF RIGHT$(d$,1)<>"$" THENd$="STR$("+d$+")"
 8790 a$=LEFT$(a$,INSTR(a$,"�")-1)+EVAL(d$)+MID$(a$,INSTR(a$,"�")+LEN(b$)+2)
 8800ENDWHILE
 8810=a$
 8820DEFFNgstrans(a$):LOCAL p%,len
 8830SYS "OS_GSTrans",a$,message_buffer%,256+(1<<31) TO ,,len
 8840a$="":p%=message_buffer%
 8850WHILE LEN(a$)<len:a$+=CHR$?p%:p%+=1:ENDWHILE
 8860=a$
 8870:
 8880REM FNswinumber : Return the SWI number, given its string
 8890DEFFNswinumber(swi$):LOCAL n
 8900SYS "XOS_SWINumberFromString",,swi$ TO n;flags
 8910IF (flags AND1)>0 THENn=-1
 8920=n
 8930:
 8940REM ******** File information routines **************
 8950:
 8960REM FNfiletype : Return the file type of a file
 8970REM -2=not found, -1=untyped, &1000=dir or image
 8980DEF FNfiletype(f$):LOCAL f%,type%,fl%
 8990SYS "XOS_File",20,f$ TO type%,,,,,,f%;fl%
 9000CASE type% OF
 9010 WHEN 0:type%=-2
 9020 WHEN 1:type%=f%
 9030 WHEN 2,3:type%=&1000
 9040ENDCASE
 9050IF (fl%AND1)=1 THENtype%=-2
 9060=type%
 9070:
 9080REM FNbasetype : Return the file type of a directory or image
 9090REM -2=not found, -1=file, &1000 for dir, type for image
 9100DEF FNbasetype(f$):LOCAL f%,type%,fl%
 9110SYS "XOS_File",5,f$ TO type%,,f%;fl%
 9120CASE type% OF
 9130 WHEN 0:type%=-2
 9140 WHEN 1:type%=-1
 9150 WHEN 2:type%=&1000
 9160 WHEN 3:type%=(f% AND &FFF00)>>8
 9170ENDCASE
 9180IF (fl%AND1)=1 THENtype%=-2
 9190=type%
 9200:
 9210REM FNfilelength : Return the length of a file
 9220REM -1 if not found
 9230DEF FNfilelength(f$):LOCAL len%,ex,f
 9240SYS "XOS_File",5,f$ TO ex,,,,len%;f
 9250IF ex=0 OR (f AND 1)=1 THENlen%=-1
 9260=len%
 9270:
 9280REM FNleafname : Return the leafname of the file
 9290REM FNpathname : Return the directory containing the file
 9300REM FNlongfilename : Return the full pathname of a file
 9310DEF FNleafname(f$):LOCAL r$
 9320IF INSTR(f$,":")>0 THENf$=MID$(f$,INSTR(f$,":")+1)
 9330CASE INSTR(f$,".") OF
 9340 WHEN 0    :r$=f$
 9350 OTHERWISE :r$=FNleafname(RIGHT$(f$,LEN(f$)-INSTR(f$,".")))
 9360ENDCASE
 9370=r$
 9380DEF FNpathname(f$)
 9390IF INSTR(f$,":")>0 AND INSTR(f$,".")=0 THEN=LEFT$(f$,INSTR(f$,":")) ELSEIF INSTR(f$,":")=0 AND INSTR(f$,".")=0 THEN="@"
 9400=LEFT$(f$,LEN(f$)-LEN(FNleafname(f$))-1)
 9410REM Removes identifiers such as Scrap:...
 9420DEFFNlongfilename(f$)
 9430SYS "XOS_FSControl",37,f$,message_buffer%,,,256 TO ,,f$ ;flags
 9440IF (flags AND 1)=1 THENf$=""
 9450=f$
 9460:
 9470REM ******** Module workspace manipulation routine **
 9480:
 9490REM FNclaim   : Claim an area of RMA
 9500REM FNrelease : Release a claimed area of RMA
 9510DEFFNclaim(length%)
 9520LOCAL flags:IF length%<1THENERROR &803,"Cannot claim negative RMA"
 9530SYS "XOS_Module",6,,,length% TO ,,area%;flags
 9540IF (flags AND1)>0 THENarea%=-1
 9550=area%
 9560DEFPROCrelease(RETURN area%)
 9570IF area%>0 THENSYS "OS_Module",7,,area%:area%=-1
 9580ENDPROC
 9590:
 9600REM ******** Task interaction routines **************
 9610:
 9620REM FNtaskname        : return a given tasks name
 9630REM FNwindowtask      : return task handle who owns window
 9640REM FNreadtaskstring  : read a string from given task
 9650REM PROCreadtaskarea  : read a block from given task
 9660REM FNfindtask        : return task handle of named task
 9670DEFFNtaskname(task%):LOCAL name$,f
 9680SYS "XTaskManager_TaskNameFromHandle",task% TO name$;f
 9690IF (f AND1) THENname$="None"
 9700=name$
 9710DEFFNwindowtask(win%):LOCAL task%
 9720message_buffer%!0=20:message_buffer%!12=0
 9730SYS "Wimp_SendMessage",19,message_buffer%,win%,-1 TO ,,task%
 9740=task%
 9750DEFFNreadtaskstring(task%,loc%):LOCAL p$
 9760SYS"Wimp_TransferBlock",task%,loc%,handle,message_buffer%,256
 9770=FNstring0(message_buffer%)
 9780DEFPROCreadtaskarea(task%,loc%,to%,len%)
 9790SYS"Wimp_TransferBlock",task%,loc%,handle,to%,len%
 9800ENDPROC
 9810DEFFNfindtask(a$)
 9820LOCAL th,cnt,t$
 9830SYS "TaskManager_EnumerateTasks",,message_buffer%,16 TO cnt
 9840WHILE cnt<>-1
 9850 th=!message_buffer%:t$=FNstring0(message_buffer%!4)
 9860 SYS "TaskManager_EnumerateTasks",cnt,message_buffer%,16 TO cnt
 9870 IF t$=a$ THENcnt=-1 ELSEIFcnt=-1 THENth=-1
 9880ENDWHILE
 9890=th
 9900:
 9910REM FNbackofwinstack : return win handle of back of win stack
 9920REM FNwinstacknext   : return win handle of next win forward
 9930DEFFNbackofwinstack:LOCAL I
 9940!b%=infobox%:SYS"Wimp_GetWindowState",,b%
 9950FORI=4TO16STEP4
 9960 b%!I=(b%!I)-4096
 9970NEXTI
 9980b%!28=-2:SYS"Wimp_OpenWindow",,b%
 9990SYS"Wimp_GetWindowState",,b%:zc%=b%!28
10000SYS"Wimp_CloseWindow",,b%
10010=zc%
10020DEFFNwinstacknext(win%):!b%=win%:SYS"Wimp_GetWindowState",,b%:=b%!28
10030:
10040REM ******** Caret and pointer control procedures ***
10050:
10060REM PROCsetcaretend : Place the caret at the end of the text
10070REM PROCsetcaretpos : Place the caret at pos within the text
10080REM PROCgetcaretpos : Return the position of the caret
10090REM PROCgetptrpos   : Return the location of the pointer
10100DEFPROCsetcaretend(win,icon)
10110PROCsetcaretpos(win,icon,LEN(FNgeticontext(win,icon)))
10120ENDPROC
10130DEFPROCsetcaretpos(win,icon,chars)
10140SYS "Wimp_SetCaretPosition",win,icon,0,0,-1,chars
10150ENDPROC
10160DEFPROCgetcaretpos(RETURN win,RETURN icon,RETURN chars)
10170SYS "Wimp_GetCaretPosition",,b%:win=!b%:icon=b%!4:chars=b%!20
10180ENDPROC
10190DEFPROCgetptrpos(RETURN x,RETURN y,RETURN win,RETURN icon)
10200SYS "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4:win=b%!12:icon=b%!16
10210ENDPROC
10220:
10230REM ******** Configuration settings control *********
10240:
10250REM FNreadcmos    : Read a byte of configuration info
10260REM PROCwritecmos : Write a byte of configuration info
10270DEFFNreadcmos(byte)
10280SYS "OS_Byte",161,byte TO ,,value
10290=value
10300DEFPROCwritecmos(byte,value)
10310SYS "OS_Byte",162,byte,value
10320ENDPROC
10330:
10340REM ******** Status file control routines ***********
10350:
10360REM PROCmakestatusfile  : Create a status file
10370REM PROCclosestatusfile : Close the status file
10380REM FNreadstatusfile    : Open a status file read
10390DEFPROCmakestatusfile(f$)
10400OSCLI("Create "+f$):OSCLI("SetType "+f$+" FFF")
10410statfile%=OPENOUT(f$):BPUT#statfile%,"Program:"+Appname$
10420ENDPROC
10430DEFPROCclosestatusfile
10440CLOSE#statfile%
10450ENDPROC
10460REM Return FALSE if not correct or not found
10470DEFFNreadstatusfile(f$):LOCAL a$
10480LOCAL ERROR:ON ERROR LOCAL:=FALSE
10490statfile%=OPENIN(f$)
10500IF statfile%=0 THEN=FALSE
10510a$=FNstatusget("Program")
10520IF a$<>Appname$ THENCLOSE#statfile%:=FALSE
10530=TRUE
10540:
10550REM PROCstatusput    : Put the string in status file
10560REM PROCstatusoption : Put the value in status file
10570REM PROCstatusflag   : Put the flag in status file
10580DEFPROCstatusput(e$,d$)
10590BPUT#statfile%,e$+":"+d$
10600ENDPROC
10610DEFPROCstatusoption(e$,v%)
10620BPUT#statfile%,e$+":%"+STR$v%
10630ENDPROC
10640DEFPROCstatusflag(e$,v%)
10650IF v% THENBPUT#statfile%,e$+":On" ELSEBPUT#statfile%,e$+":Off"
10660ENDPROC
10670:
10680REM PROCstatusnext   : Read the next status entry
10690DEFPROCstatusnext(RETURN a$,RETURN b$)
10700IF EOF#statfile% THENa$="*E*N*D*":b$="":ENDPROC
10710REPEAT:a$=GET$#statfile%:UNTILLEFT$(a$,1)<>"#"
10720b$=MID$(a$,INSTR(a$,":")+1)
10730a$=FNupper(LEFT$(a$,INSTR(a$,":")-1))
10740ENDPROC
10750:
10760REM FNstatusget      : Read an entry from status file
10770REM FNstatusgetv     : Read a value from staus file
10780REM FNstatusgetflag  : Read a flag from status file
10790DEFFNstatusget(a$)
10800LOCAL b$,c$:a$=FNupper(a$):PROCstatusnext(b$,c$)
10810IF a$<>b$ THEN
10820 PTR#statfile%=0:b$=""
10830 WHILE a$<>b$ AND b$<>"*E*N*D*"
10840  PROCstatusnext(b$,c$)
10850 ENDWHILE
10860ENDIF
10870=c$
10880DEFFNstatusgetv(a$):a$=FNstatusget(a$)
10890IF LEFT$(a$,1)="%" THEN=VAL(MID$(a$,2))
10900=0
10910DEFFNstatusgetflag(a$):a$=FNstatusget(a$)
10920IF a$="%1"ORFNupper(a$)="ON"THEN=TRUE
10930=FALSE

� >WimpLib
� � Justin Fletcher
"� Version : 1.74 (10 Sep 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:messptr%+=4:�
�:
�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)
	L6� x=-1 �ș "Wimp_GetPointerInfo",,b%:x=b%!0:y=b%!4
	V,curmenu%=menu%:cmenux%=x-64:cmenuy%=y+20
	`)ș "Wimp_CreateMenu",,menu%,x-64,y+20
	j�
	t��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
�
(5��menutick(menu,option,toggle):menu+=option*24+28
2Ȏ toggle �
< � 0:!menu=!menu � -2
F � -1,1:!menu=!menu � 1
P � 2:!menu=!menu � 1
Z�
d�
n6��menushade(menu,option,toggle):menu+=option*24+36
xȎ 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$
"7� (!menu �&100)>0 �text$=$(menu!4) �text$=$(menu+4)
,
=text$
6:
@4� FNdecodemenu : Return menu selection as string
J/� also returns for font if menu is fontmenu
T7ݤdecodemenu(menu%):� cp%,ptr,b$,c$:cp%=menu%:ptr=0
^%ȕ (b%!ptr>-1 � cp%<>rmafontarea)
h$ cp%=cp%!(32+(b%!ptr)*24):ptr+=4
r�
|#� 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$="."
 � m$="." �b$+=".."
& m$=�b$)
0�
:=m$
D:
N?� FNgetfontmenu       : Return memory location of font menu
X;� PROCreleasefontmenu : Release memory used by fontmenu
b$ݤgetfontmenu(font$):� space,ind
lș "Hourglass_On"
v4ș "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

 mlen=28+24:ilen=9

*ȕ (flags �1)<>1

4 � type=0 �

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

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

R  � (f �1)=1�

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

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

p  �

z   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
$T ș "XOS_ReadVarVal","File$Type_*",message_buffer%,256,0 � ,,len,name,type;flags
. ȕ (flags �1)<>1
8  � type=0 �
BO   message_buffer%!len=0:n$=¤string0(name),3):v$=�string0(message_buffer%)
L   mlen!0=0:mlen!4=-1
V.   ș "XWimp_SpriteOp",24,,"Small_"+n$ �;f
`   � (f �1)=1�
j.    ș "XWimp_SpriteOp",24,,"File_"+n$ �;f
t/    � (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):�
:
7� ******** Window manipulation routines ***********
(:
2(� PROCclosewin      : Close a window
<7� PROCopenwin       : Open a window at top of stack
F>� PROCopenwinat     : Open a window at top-left corner x,y
P9� PROCopenwincentre : Open window in centre of screen
Z<� PROCopenwinto     : Open window at position within TWA
d��closewin(win%)
n&!b%=win%:ș "Wimp_CloseWindow",,b%
x�
���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%
��
�6��openwincentre(win%):� width,height,top,right,x,y
�*!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
"3x=(right-width)/2+width:y=(top-height)/2+height
,.b%!4=x:b%!8=y-height:b%!12=x-width:b%!16=y
6%b%!28=-1:ș "Wimp_OpenWindow",,b%
@�
J/� l=left of VWA in TWA, t=top of VWA in TWA
T3� r=right of VWA in TWA, b=bottom of VWA in TWA
^A� Window does not move, but its size is altered to difference
h?� between l&w and t&h. Top left of VWA is positioned to tl.
r;� 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
1open%=(b%!32 � (1<<16))>0:� � open% �b%!28=-3
&9ș "Wimp_OpenWindow",,b%:ș "Wimp_GetWindowState",,b%
0full%=(b%!32 � (1<<18))>0
:#b%!68=l:b%!72=b:b%!76=r:b%!80=t
D"ș "Wimp_SetExtent",win%,b%+68
N*� full% �b%!8=b%!16+b-t:b%!12=b%!4+r-l
Xș "Wimp_OpenWindow",,b%
bJ� open% �ș "Wimp_ForceRedraw",win%,l,b,r,t �ș "Wimp_CloseWindow",,b%
l�
vD�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
�
 :
*=� PROCwindowtitle : Set window title (only if indirected)
4� �windowtitle(win%,title$)
>
� loc%,a$
H+b%!0=win%:ș "Wimp_GetWindowInfo",,b%+1
R%loc%=!(b%+76):a$=�msgtext(title$)
\� �string0(loc%)<>a$ �
f: $loc%=a$:b%!32=win%:ș "Wimp_GetWindowOutline",,b%+32
p5 ș "Wimp_ForceRedraw",-1,b%!36,b%!16,b%!44,b%!48
z�
��
�:
�>� ************ Nested Window Manager specific ************
�7� PROCembedwin     : embeds a window within another
�D� PROCembedwinwith : embeds a window within another with winflgs
�6� 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%)
$+!b%=child%:ș "Wimp_GetWindowState",,b%
./ș "Wimp_CloseWindow",,b%,&4B534154,parent%
8�
Bݤparentwin(child%)
L
� parent%
VB!b%=child%:ș "Wimp_GetWindowState",,b%,&4B534154 � ,,,parent%
`=parent%
j:
t7� ******** 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 : ?
� Button types :
(� 0 : Ignore clicks
2� 1 : Notify when over
< � 2 : Clicks repeat & notify
F"� 3 : Clicks debounce & notify
P?� 4 : Click selects, release notifies, or deselect if moved
Z*� 5 : Click selects, 2 clicks notifies
d� 6 : As 3 but will drag
n� 7 : As 4 but will drag
x� 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
" �
,( b%!28=�indirect(valid$):b%!20+=1<<8
6�
@ $(b%+24)=title$
J�
TU� ((b%!20) � &103)=&3 �� &803,"Cannot make a sprite/text icon without validation"
^� (flags � 3)=0 �b%!20+=1
h.� �lower(�valid$,1))="s" � b%!20=b%!20 � 2
r%ș "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)
8ݤCreateIconBarIcon(Spr$,title$,pos%):� ic%,w%,m%,e%
&1title$=�msgtext(title$):b%!0=-(�(pos%) � &FF)
02b%!4=0:b%!8=-16:b%!12=12+16*�(title$):b%!16=88
:"�b%!12<12+16*4 � b%!12=12+16*4
D� title$<>"" �
N2 b%!20=(1<<28)+(7<<24)+(3<<12)+(%01011)+(1<<8)
X b%!24=�indirect(title$)
b b%!28=�indirect("S"+Spr$)
l b%!32=�(title$)+1
v�
�+ 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
 5� PROCiconstate  : unselect/select/toggle an icon
*8� PROCseticonbit : set/unset/toggle a bit in an icon
4!��iconshade(win%,icon%,type%)
>$�seticonbit(win%,icon%,22,type%)
H�
R!��iconstate(win%,icon%,type%)
\$�seticonbit(win%,icon%,21,type%)
f�
p� type = 0 for untick
z!� 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)
$0t%=�:�:��>t%+15:�seticonbit(win%,icon%,21,0)
.�
8��redrawicon(win%,icon%)
B@win%+=win%=-1:!b%=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
L5ș "Wimp_ForceRedraw",win%,b%!8,b%!12,b%!16,b%!20
V�
`:
j<� FNgeticontext   : return icons text string (or sprite)
t9� 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$)
�

�
:
7� FNgeticonvalid   : return icons validation string
(4� PROCseticonvalid : set icons validation string
2=� Remember not to exceed the original validation string's
<
� length.
Fݤgeticonvalid(win%,icon%)
P3b%!0=win%:b%!4=icon%:ș "Wimp_GetIconState",,b%
ZE� ((b%!24) � &100)=0 � &803,"Icon isn't indirected (#"+�icon%+")"
d=�string0(b%!32)
n$��seticonvalid(win%,icon%,text$)
x3b%!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%
�
"/ b%!40=4:b%!44=5:b%!48=11:b%!52=12:b%!56=-1
,) ș "OS_ReadVduVariables",b%+40,b%+40
6> b%!24=0:b%!28=0:b%!32=b%!48+1<<b%!40:b%!36=b%!52+1<<b%!44
@�
Jb%!4=5:� Drag type
Tș "Wimp_DragBox",,b%
^�
h:
r9� 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 "
� \T for "This is the "
&1� \G for "This option is greyed out because "
0� \W for "This window is "
:� \D for "Drag SELECT to "
D� \d for "Drag ADJUST to "
N� \w for "window"
X� \s for "SELECT"
b� \a for "ADJUST"
l� |M for return
v!� �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
 �  -2,-2,-2,-2
*��readhelp(win,icon,to)
48� lwin,val,help$,found,a$,m$,m2$,mh$:found=�:lwin=-1
>�
H � val,help$
R � val>(1<<16) � val<0 �
\  � lwin=win �
f   val=icon:help$="":m2$=m$
p  �
z   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 �
$@  val=b%:b%=message_buffer%:mh$=�decodemenu(curmenu%):b%=val
.0  m$=mh$:ȕ �m$," ")>0:�m$,�m$," "),1)="_":�
8  help$=�msgtoken("HM"+m$)
B  � help$<>"HM"+m$ �
L   �sendhelp(help$,to)
V  �
`   �
j    � m$,val,help$,help$
t!   � �(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.��sendhelp(help$,to):help$=�msgtext(help$)
P"� �help$,2)<>"|M" �help$+="|M"
Z� b$,c$
dhelp$=�substvars(help$)
nȕ �help$,"|M")>0
x4 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)
"H� msgbuffer2%=-1 �� &803,"No room for secondary MessageTrans buffer"
,qmsgbuffer%=�claim(16):� msgbuffer%=-1 ��release(msgbuffer2%):� &803,"No room for primary MessageTrans buffer"
6Iș "MessageTrans_OpenFile",msgbuffer%,Appdir$+".Messages",msgbuffer2%
@�
J��closemessages
T� �
^� � �:�4:�:�" at ";�:G=�:�
h� msgbuffer%>-1 �
r, ș "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)
 �
 Wș "XMessageTrans_Lookup",msgbuffer%,t$,message_buffer%,256,s1$,s2$,s3$ � ,,,len%;f
 &,� (f �1)=1 �=t$ �message_buffer%?len%=13
 0!=�substvars($message_buffer%)
 :ݤmsgtext(a$)
 D&� �a$,1)=">" �a$=�msgtoken(�a$,2))
 N=a$
 X:
 b7� ******** String manipulation routines ***********
 l:
 v8� 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$
! ݤtidy(a$):� cap,b$,I,c$
!*	cap=�
!4�I=1��(a$)
!>2 b$=�a$,I,1):� b$>="a"�b$<="z" �b$=�(�(b$)-32)
!H# � (b$<"A" �b$>"Z") � b$<>"'" �
!R  cap=�
!\ �
!f.  � cap=� � b$<>"'" �b$=�(�(b$)+32) �cap=�
!p
 �:c$+=b$
!z	�:=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$
"$ݤsubstvars(a$)
".� b$,d$:� �:� � �:=a$
"8ȕ �a$,"�")>0
"B* b$=�a$,�a$,"�")+1):b$=�b$,�b$,"�")-1)
"L+ d$=b$:� �d$,1)<>"$" �d$="STR$("+d$+")"
"V3 a$=�a$,�a$,"�")-1)+�(d$)+�a$,�a$,"�")+�(b$)+2)
"`�
"j=a$
"tݤ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%
#+ș "XOS_File",20,f$ � type%,,,,,,f%;fl%
#(Ȏ type% �
#2 � 0:type%=-2
#< � 1:type%=f%
#F � 2,3:type%=&1000
#P�
#Z� (fl%�1)=1 �type%=-2
#d
=type%
#n:
#x?� 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
$"� ex=0 � (f � 1)=1 �len%=-1
$,	=len%
$6:
$@2� FNleafname : Return the leafname of the file
$J;� FNpathname : Return the directory containing the file
$T9� FNlongfilename : Return the full pathname of a file
$^� �leafname(f$):� r$
$h$� �f$,":")>0 �f$=�f$,�f$,":")+1)
$rȎ �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
%/� FNrelease : Release a claimed area of RMA
%&ݤclaim(length%)
%0:� flags:� length%<1�� &803,"Cannot claim negative RMA"
%:/ș "XOS_Module",6,,,length% � ,,area%;flags
%D� (flags �1)>0 �area%=-1
%N
=area%
%X��release(� area%)
%b/� area%>0 �ș "OS_Module",7,,area%:area%=-1
%l�
%v:
%�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$
& @ș"Wimp_TransferBlock",task%,loc%,handle,message_buffer%,256
&*=�string0(message_buffer%)
&4'��readtaskarea(task%,loc%,to%,len%)
&>5ș"Wimp_TransferBlock",task%,loc%,handle,to%,len%
&H�
&Rݤfindtask(a$)
&\� th,cnt,t$
&f=ș "TaskManager_EnumerateTasks",,message_buffer%,16 � cnt
&pȕ cnt<>-1
&z7 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%
'$Dݤwinstacknext(win%):!b%=win%:ș"Wimp_GetWindowState",,b%:=b%!28
'.:
'87� ******** Caret and pointer control procedures ***
'B:
'L>� PROCsetcaretend : Place the caret at the end of the text
'V>� PROCsetcaretpos : Place the caret at pos within the text
'`8� PROCgetcaretpos : Return the position of the caret
'j:� PROCgetptrpos   : Return the location of the pointer
't��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
(ݤreadcmos(byte)
((#ș "OS_Byte",161,byte � ,,value
(2
=value
(<��writecmos(byte,value)
(Fș "OS_Byte",162,byte,value
(P�
(Z:
(d7� ******** Status file control routines ***********
(n:
(x0� 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%:=�
)"=�
),:
)66� PROCstatusput    : Put the string in status file
)@5� PROCstatusoption : Put the value in status file
)J4� PROCstatusflag   : Put the flag in status file
)T��statusput(e$,d$)
)^�#statfile%,e$+":"+d$
)h�
)r��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
*5� FNstatusgetflag  : Read a flag from status file
*&ݤstatusget(a$)
*0,� b$,c$:a$=�upper(a$):�statusnext(b$,c$)
*:� a$<>b$ �
*D �#statfile%=0:b$=""
*N ȕ a$<>b$ � b$<>"*E*N*D*"
*X  �statusnext(b$,c$)
*b �
*l�
*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  34 20 28 31 30 20 53 65  |on : 1.74 (10 Se|
00000040  70 20 31 39 39 37 29 0d  00 28 1a f4 20 54 68 69  |p 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 3a 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 6d 65 73  73 70 74 72 25 2b 3d 34  |r%=n:messptr%+=4|
000001e0  3a e1 0d 00 aa 05 3a 0d  00 b4 32 f4 20 46 4e 6c  |:.....:...2. FNl|
000001f0  6f 61 64 74 65 6d 70 6c  61 74 65 20 3a 20 6c 6f  |oadtemplate : lo|
00000200  61 64 20 74 68 65 20 73  70 65 63 69 66 69 65 64  |ad the specified|
00000210  20 74 65 6d 70 6c 61 74  65 0d 00 be 32 f4 20 73  | template...2. s|
00000220  70 72 62 6c 6b 25 20 73  68 6f 75 6c 64 20 62 65  |prblk% should be|
00000230  20 31 20 66 6f 72 20 74  68 65 20 73 74 61 6e 64  | 1 for the stand|
00000240  61 72 64 20 73 70 72 69  74 65 73 0d 00 c8 30 dd  |ard sprites...0.|
00000250  a4 6c 6f 61 64 74 65 6d  70 6c 61 74 65 28 6e 24  |.loadtemplate(n$|
00000260  2c 73 70 72 62 6c 6b 25  29 3a ea 20 74 73 69 7a  |,sprblk%):. tsiz|
00000270  65 25 2c 62 6c 6b 25 2c  6f 6b 25 0d 00 d2 30 c8  |e%,blk%,ok%...0.|
00000280  99 20 22 57 69 6d 70 5f  4f 70 65 6e 54 65 6d 70  |. "Wimp_OpenTemp|
00000290  6c 61 74 65 22 2c 2c 41  70 70 64 69 72 24 2b 22  |late",,Appdir$+"|
000002a0  2e 54 65 6d 70 6c 61 74  65 73 22 0d 00 dc 30 c8  |.Templates"...0.|
000002b0  99 20 22 57 69 6d 70 5f  4c 6f 61 64 54 65 6d 70  |. "Wimp_LoadTemp|
000002c0  6c 61 74 65 22 2c 2c 30  2c 2c 2c 2c 6e 24 2c 30  |late",,0,,,,n$,0|
000002d0  20 b8 20 2c 2c 74 73 69  7a 65 25 0d 00 e6 11 de  | . ,,tsize%.....|
000002e0  20 62 6c 6b 25 20 74 73  69 7a 65 25 0d 00 f0 48  | blk% tsize%...H|
000002f0  c8 99 20 22 57 69 6d 70  5f 4c 6f 61 64 54 65 6d  |.. "Wimp_LoadTem|
00000300  70 6c 61 74 65 22 2c 2c  77 73 70 63 25 2c 62 6c  |plate",,wspc%,bl|
00000310  6b 25 2c 62 6c 6b 25 20  2b 20 74 73 69 7a 65 25  |k%,blk% + tsize%|
00000320  2c 2d 31 2c 6e 24 2c 30  20 b8 20 2c 2c 2c 2c 2c  |,-1,n$,0 . ,,,,,|
00000330  2c 6f 6b 25 0d 00 fa 1b  c8 99 20 22 57 69 6d 70  |,ok%...... "Wimp|
00000340  5f 43 6c 6f 73 65 54 65  6d 70 6c 61 74 65 22 0d  |_CloseTemplate".|
00000350  01 04 35 e7 20 6f 6b 25  3d 30 20 8c 85 20 26 38  |..5. ok%=0 .. &8|
00000360  30 33 2c 20 22 54 65 6d  70 6c 61 74 65 20 66 69  |03, "Template fi|
00000370  6c 65 20 22 2b 6e 24 2b  22 20 6e 6f 74 20 66 6f  |le "+n$+" not fo|
00000380  75 6e 64 22 0d 01 0e 39  77 73 70 63 25 21 36 34  |und"...9wspc%!64|
00000390  3d 73 70 72 62 6c 6b 25  3a c8 99 20 22 57 69 6d  |=sprblk%:.. "Wim|
000003a0  70 5f 43 72 65 61 74 65  57 69 6e 64 6f 77 22 2c  |p_CreateWindow",|
000003b0  2c 77 73 70 63 25 20 b8  20 62 6c 6b 25 0d 01 18  |,wspc% . blk%...|
000003c0  09 3d 62 6c 6b 25 0d 01  22 05 3a 0d 01 2c 34 f4  |.=blk%..".:..,4.|
000003d0  20 46 4e 6c 6f 61 64 73  70 72 69 74 65 73 20 3a  | FNloadsprites :|
000003e0  20 4c 6f 61 64 20 73 70  72 69 74 65 20 66 69 6c  | Load sprite fil|
000003f0  65 20 69 6e 74 6f 20 6e  65 77 20 61 72 65 61 0d  |e into new area.|
00000400  01 36 2a dd a4 6c 6f 61  64 73 70 72 69 74 65 73  |.6*..loadsprites|
00000410  28 66 69 6c 65 24 29 3a  ea 20 6c 65 6e 25 2c 6f  |(file$):. len%,o|
00000420  25 2c 73 70 72 62 6c 6b  25 0d 01 40 1a 6f 25 3d  |%,sprblk%..@.o%=|
00000430  8e 28 66 69 6c 65 24 29  3a e7 20 6f 25 3d 30 20  |.(file$):. o%=0 |
00000440  8c 3d 31 0d 01 4a 15 6c  65 6e 25 3d a2 23 6f 25  |.=1..J.len%=.#o%|
00000450  2b 31 36 3a d9 23 6f 25  0d 01 54 2c de 20 73 70  |+16:.#o%..T,. sp|
00000460  72 62 6c 6b 25 20 6c 65  6e 25 3a 21 73 70 72 62  |rblk% len%:!sprb|
00000470  6c 6b 25 3d 6c 65 6e 25  3a 73 70 72 62 6c 6b 25  |lk%=len%:sprblk%|
00000480  21 38 3d 30 0d 01 5e 20  c8 99 22 4f 53 5f 53 70  |!8=0..^ .."OS_Sp|
00000490  72 69 74 65 4f 70 22 2c  26 31 30 39 2c 73 70 72  |riteOp",&109,spr|
000004a0  62 6c 6b 25 0d 01 68 26  c8 99 22 4f 53 5f 53 70  |blk%..h&.."OS_Sp|
000004b0  72 69 74 65 4f 70 22 2c  26 31 30 41 2c 73 70 72  |riteOp",&10A,spr|
000004c0  62 6c 6b 25 2c 66 69 6c  65 24 0d 01 72 0c 3d 73  |blk%,file$..r.=s|
000004d0  70 72 62 6c 6b 25 0d 01  7c 05 3a 0d 01 86 41 f4  |prblk%..|.:...A.|
000004e0  20 46 4e 47 65 74 45 6e  76 20 3a 20 52 65 74 75  | FNGetEnv : Retu|
000004f0  72 6e 20 74 68 65 20 65  6e 76 69 72 6f 6e 6d 65  |rn the environme|
00000500  6e 74 20 73 74 72 69 6e  67 20 73 74 72 69 70 70  |nt string stripp|
00000510  65 64 20 6f 66 20 6c 6f  61 64 65 72 0d 01 90 18  |ed of loader....|
00000520  dd a4 47 65 74 45 6e 76  3a ea 20 63 6f 6d 24 2c  |..GetEnv:. com$,|
00000530  49 2c 70 24 0d 01 9a 19  c8 99 20 22 4f 53 5f 47  |I,p$...... "OS_G|
00000540  65 74 45 6e 76 22 20 b8  20 63 6f 6d 24 0d 01 a4  |etEnv" . com$...|
00000550  1c 70 24 3d 22 22 3a 49  3d a7 63 6f 6d 24 2c 22  |.p$="":I=.com$,"|
00000560  20 2d 71 75 69 74 20 22  29 0d 01 ae 0b e7 20 49  | -quit ")..... I|
00000570  3e 30 20 8c 0d 01 b8 28  20 70 24 3d c1 63 6f 6d  |>0 ....( p$=.com|
00000580  24 2c a7 63 6f 6d 24 2c  22 20 22 2c 49 2b a9 22  |$,.com$," ",I+."|
00000590  20 2d 71 75 69 74 20 22  29 2b 31 29 0d 01 c2 1e  | -quit ")+1)....|
000005a0  20 c8 95 20 c0 70 24 2c  31 29 3d 22 20 22 3a 70  | .. .p$,1)=" ":p|
000005b0  24 3d c1 70 24 2c 32 29  3a ce 0d 01 cc 05 cd 0d  |$=.p$,2):.......|
000005c0  01 d6 07 3d 70 24 0d 01  e0 05 3a 0d 01 ea 40 f4  |...=p$....:...@.|
000005d0  20 46 4e 73 79 73 74 65  6d 76 61 72 20 3a 20 52  | FNsystemvar : R|
000005e0  65 74 75 72 6e 20 74 68  65 20 63 6f 6e 74 65 6e  |eturn the conten|
000005f0  74 73 20 6f 66 20 61 6e  79 20 73 74 72 69 6e 67  |ts of any string|
00000600  20 73 79 73 74 65 6d 20  76 61 72 0d 01 f4 1b dd  | system var.....|
00000610  a4 73 79 73 74 65 6d 76  61 72 28 56 61 72 24 29  |.systemvar(Var$)|
00000620  3a ea 20 6c 65 6e 0d 01  fe 3a c8 99 20 22 58 4f  |:. len...:.. "XO|
00000630  53 5f 52 65 61 64 56 61  72 56 61 6c 22 2c 56 61  |S_ReadVarVal",Va|
00000640  72 24 2c 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |r$,message_buffe|
00000650  72 25 2c 32 35 35 2c 30  2c 33 b8 2c 2c 6c 65 6e  |r%,255,0,3.,,len|
00000660  0d 02 08 1a 6d 65 73 73  61 67 65 5f 62 75 66 66  |....message_buff|
00000670  65 72 25 3f 6c 65 6e 3d  31 33 0d 02 12 15 3d 24  |er%?len=13....=$|
00000680  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 0d  |message_buffer%.|
00000690  02 1c 05 3a 0d 02 26 29  f4 20 50 52 4f 43 65 65  |...:..&). PROCee|
000006a0  72 72 6f 72 20 3a 20 45  78 74 65 72 6e 61 6c 20  |rror : External |
000006b0  65 72 72 6f 72 20 72 6f  75 74 69 6e 65 0d 02 30  |error routine..0|
000006c0  3e f4 20 73 68 6f 75 6c  64 20 62 65 20 63 61 6c  |>. should be cal|
000006d0  6c 65 64 20 77 68 65 6e  20 65 72 72 6f 72 73 20  |led when errors |
000006e0  6f 63 63 75 72 20 64 75  72 69 6e 67 20 69 6e 69  |occur during ini|
000006f0  74 69 61 6c 69 73 61 74  69 6f 6e 0d 02 3a 0c dd  |tialisation..:..|
00000700  f2 65 65 72 72 6f 72 0d  02 44 07 ea 20 85 0d 02  |.eerror..D.. ...|
00000710  4e 47 ee 20 85 20 ea 3a  f2 63 6c 6f 73 65 6d 65  |NG. . .:.closeme|
00000720  73 73 61 67 65 73 3a ef  34 3a 85 20 a2 20 30 2c  |ssages:.4:. . 0,|
00000730  f6 24 2b 22 20 61 74 20  6c 69 6e 65 20 22 2b c3  |.$+" at line "+.|
00000740  9e 2b 22 20 69 6e 20 65  72 72 6f 72 20 68 61 6e  |.+" in error han|
00000750  64 6c 65 72 22 0d 02 58  29 6d 65 73 73 24 3d 22  |dler"..X)mess$="|
00000760  49 6e 74 65 72 6e 61 6c  20 65 72 72 6f 72 20 3a  |Internal error :|
00000770  20 28 22 2b c3 9e 2b 22  29 20 22 2b f6 24 0d 02  | ("+..+") "+.$..|
00000780  62 38 ff 28 22 53 65 74  20 45 72 72 6f 72 24 20  |b8.("Set Error$ |
00000790  22 2b 6d 65 73 73 24 29  3a ff 28 22 53 65 74 20  |"+mess$):.("Set |
000007a0  45 72 72 6f 72 24 54 61  73 6b 20 4e 6f 74 20 6b  |Error$Task Not k|
000007b0  6e 6f 77 6e 22 29 0d 02  6c 4c 6d 65 73 73 61 67  |nown")..lLmessag|
000007c0  65 5f 62 75 66 66 65 72  25 21 30 3d 9f 3a 24 28  |e_buffer%!0=.:$(|
000007d0  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 2b  |message_buffer%+|
000007e0  34 29 3d 6d 65 73 73 24  2b 22 20 77 68 69 6c 73  |4)=mess$+" whils|
000007f0  74 20 69 6e 69 74 69 61  6c 69 73 69 6e 67 22 2b  |t initialising"+|
00000800  bd 30 0d 02 76 27 ee 20  85 20 ea 3a 41 70 70 6e  |.0..v'. . .:Appn|
00000810  61 6d 65 24 3d 22 75 6e  69 6e 69 74 69 61 6c 69  |ame$="uninitiali|
00000820  73 65 64 20 74 61 73 6b  22 0d 02 80 0f 61 24 3d  |sed task"....a$=|
00000830  41 70 70 6e 61 6d 65 24  0d 02 8a 47 ee 20 85 20  |Appname$...G. . |
00000840  ea 3a f2 63 6c 6f 73 65  6d 65 73 73 61 67 65 73  |.:.closemessages|
00000850  3a ef 34 3a 85 20 a2 20  30 2c f6 24 2b 22 20 61  |:.4:. . 0,.$+" a|
00000860  74 20 6c 69 6e 65 20 22  2b c3 9e 2b 22 20 69 6e  |t line "+..+" in|
00000870  20 65 72 72 6f 72 20 68  61 6e 64 6c 65 72 22 0d  | error handler".|
00000880  02 94 34 c8 99 20 22 57  69 6d 70 5f 52 65 70 6f  |..4.. "Wimp_Repo|
00000890  72 74 45 72 72 6f 72 22  2c 6d 65 73 73 61 67 65  |rtError",message|
000008a0  5f 62 75 66 66 65 72 25  2c 39 2c 41 70 70 6e 61  |_buffer%,9,Appna|
000008b0  6d 65 24 0d 02 9e 05 e1  0d 02 a8 05 3a 0d 02 b2  |me$.........:...|
000008c0  3e f4 20 50 52 4f 43 65  72 72 6f 72 20 3a 20 43  |>. PROCerror : C|
000008d0  61 6c 6c 65 64 20 61 74  20 61 6e 79 20 42 41 53  |alled at any BAS|
000008e0  49 43 20 65 72 72 6f 72  20 69 6e 73 69 64 65 20  |IC error inside |
000008f0  74 68 65 20 64 65 73 6b  74 6f 70 0d 02 bc 1b f4  |the desktop.....|
00000900  20 45 52 52 4f 52 20 6e  75 6d 62 65 72 73 20 26  | ERROR numbers &|
00000910  38 30 30 2b 20 3a 0d 02  c6 0c f4 20 30 20 3d 20  |800+ :..... 0 = |
00000920  4f 4b 0d 02 d0 10 f4 20  31 20 3d 20 43 61 6e 63  |OK..... 1 = Canc|
00000930  65 6c 0d 02 da 21 f4 20  32 20 3d 20 4f 4b 20 61  |el...!. 2 = OK a|
00000940  6e 64 20 43 61 6e 63 65  6c 20 28 74 6f 20 71 75  |nd Cancel (to qu|
00000950  69 74 29 0d 02 e4 2e f4  20 53 68 69 66 74 2c 20  |it)..... Shift, |
00000960  43 74 72 6c 2c 20 51 20  61 6e 64 20 63 6c 69 63  |Ctrl, Q and clic|
00000970  6b 20 74 6f 20 65 78 69  74 20 70 72 6f 67 72 61  |k to exit progra|
00000980  6d 0d 02 ee 22 dd f2 65  72 72 6f 72 3a ea 20 65  |m..."..error:. e|
00000990  72 72 63 6f 64 65 2c 6d  65 73 73 24 2c 72 65 70  |rrcode,mess$,rep|
000009a0  6c 79 25 0d 02 f8 07 ea  20 85 0d 03 02 47 ee 20  |ly%..... ....G. |
000009b0  85 20 ea 3a f2 63 6c 6f  73 65 6d 65 73 73 61 67  |. .:.closemessag|
000009c0  65 73 3a ef 34 3a 85 20  a2 20 30 2c f6 24 2b 22  |es:.4:. . 0,.$+"|
000009d0  20 61 74 20 6c 69 6e 65  20 22 2b c3 9e 2b 22 20  | at line "+..+" |
000009e0  69 6e 20 65 72 72 6f 72  20 68 61 6e 64 6c 65 72  |in error handler|
000009f0  22 0d 03 0c 14 c8 99 20  22 4f 53 5f 42 79 74 65  |"...... "OS_Byte|
00000a00  22 2c 31 32 34 0d 03 16  17 e7 20 9f 3e 26 37 46  |",124..... .>&7F|
00000a10  46 20 80 20 9f 3c 26 38  30 33 20 8c 0d 03 20 1c  |F . .<&803 ... .|
00000a20  20 65 72 72 63 6f 64 65  3d 9f 2d 26 37 46 46 3a  | errcode=.-&7FF:|
00000a30  6d 65 73 73 24 3d f6 24  0d 03 2a 2c 20 e7 20 65  |mess$=.$..*, . e|
00000a40  72 72 63 6f 64 65 3d 33  20 8c 6d 65 73 73 24 2b  |rrcode=3 .mess$+|
00000a50  3d 22 20 28 43 61 6e 63  65 6c 20 74 6f 20 51 75  |=" (Cancel to Qu|
00000a60  69 74 29 22 0d 03 34 2d  20 72 65 70 6c 79 25 3d  |it)"..4- reply%=|
00000a70  a4 65 72 72 6f 72 62 6f  78 28 41 70 70 6e 61 6d  |.errorbox(Appnam|
00000a80  65 24 2c 6d 65 73 73 24  2c 65 72 72 63 6f 64 65  |e$,mess$,errcode|
00000a90  29 0d 03 3e 24 20 e7 20  72 65 70 6c 79 25 3d 32  |)..>$ . reply%=2|
00000aa0  20 80 20 65 72 72 63 6f  64 65 3d 33 20 8c 71 75  | . errcode=3 .qu|
00000ab0  69 74 25 3d b9 0d 03 48  05 cc 0d 03 52 3c 20 6d  |it%=...H....R< m|
00000ac0  65 73 73 24 3d 22 49 6e  74 65 72 6e 61 6c 20 65  |ess$="Internal e|
00000ad0  72 72 6f 72 20 3a 20 28  22 2b c3 9e 2b 22 29 20  |rror : ("+..+") |
00000ae0  22 2b f6 24 2b 22 20 43  61 6e 63 65 6c 20 74 6f  |"+.$+" Cancel to|
00000af0  20 51 75 69 74 22 0d 03  5c 29 20 72 65 70 6c 79  | Quit"..\) reply|
00000b00  25 3d a4 65 72 72 6f 72  62 6f 78 28 41 70 70 6e  |%=.errorbox(Appn|
00000b10  61 6d 65 24 2c 6d 65 73  73 24 2c 25 31 31 29 0d  |ame$,mess$,%11).|
00000b20  03 66 12 20 e7 20 72 65  70 6c 79 25 3c 3e 31 20  |.f. . reply%<>1 |
00000b30  8c 0d 03 70 24 20 20 71  75 69 74 25 3d b9 3a ff  |...p$  quit%=.:.|
00000b40  28 22 53 65 74 20 45 72  72 6f 72 24 20 22 2b 6d  |("Set Error$ "+m|
00000b50  65 73 73 24 29 0d 03 7a  23 20 20 ff 28 22 53 65  |ess$)..z#  .("Se|
00000b60  74 20 45 72 72 6f 72 24  54 61 73 6b 20 22 2b 41  |t Error$Task "+A|
00000b70  70 70 6e 61 6d 65 24 29  0d 03 84 06 20 cd 0d 03  |ppname$).... ...|
00000b80  8e 2b 20 e7 20 a6 28 2d  31 29 20 80 20 a6 28 2d  |.+ . .(-1) . .(-|
00000b90  32 29 20 80 20 a6 28 2d  31 37 29 20 8c ff 28 22  |2) . .(-17) ..("|
00000ba0  53 70 6f 6f 6c 22 29 3a  e0 0d 03 98 05 cd 0d 03  |Spool"):........|
00000bb0  a2 05 e1 0d 03 ac 05 3a  0d 03 b6 3b f4 20 46 4e  |.......:...;. FN|
00000bc0  65 72 72 6f 72 62 6f 78  20 3a 20 63 72 65 61 74  |errorbox : creat|
00000bd0  65 20 61 6e 20 65 72 72  6f 72 20 62 6f 78 20 77  |e an error box w|
00000be0  69 74 68 20 75 70 20 74  6f 20 32 20 62 75 74 74  |ith up to 2 butt|
00000bf0  6f 6e 73 0d 03 c0 1d f4  20 42 69 74 20 56 61 6c  |ons..... Bit Val|
00000c00  75 65 20 45 66 66 65 63  74 20 69 66 20 73 65 74  |ue Effect if set|
00000c10  0d 03 ca 3f f4 20 20 30  20 20 20 20 31 20 20 20  |...?.  0    1   |
00000c20  49 6e 63 6c 75 64 65 20  61 6e 20 4f 4b 20 6f 70  |Include an OK op|
00000c30  74 69 6f 6e 20 20 20 20  7d 20 69 66 20 62 6f 74  |tion    } if bot|
00000c40  68 20 75 6e 73 65 74 20  74 68 65 6e 20 61 73 0d  |h unset then as.|
00000c50  03 d4 33 f4 20 20 31 20  20 20 20 32 20 20 20 49  |..3.  1    2   I|
00000c60  6e 63 6c 75 64 65 20 61  20 43 61 6e 63 65 6c 20  |nclude a Cancel |
00000c70  6f 70 74 69 6f 6e 20 7d  20 62 69 74 20 30 20 73  |option } bit 0 s|
00000c80  65 74 0d 03 de 44 f4 20  20 32 20 20 20 20 34 20  |et...D.  2    4 |
00000c90  20 20 52 65 76 65 72 73  65 64 20 62 75 74 74 6f  |  Reversed butto|
00000ca0  6e 73 2c 20 4f 4b 3d 57  68 69 74 65 2c 20 43 61  |ns, OK=White, Ca|
00000cb0  6e 63 65 6c 3d 59 65 6c  6c 6f 77 20 61 6e 64 20  |ncel=Yellow and |
00000cc0  61 63 74 69 6f 6e 0d 03  e8 11 f4 20 20 33 20 20  |action.....  3  |
00000cd0  20 20 38 20 20 20 3f 0d  03 f2 3a f4 20 20 34 20  |  8   ?...:.  4 |
00000ce0  20 20 20 31 36 20 20 54  69 74 6c 65 20 69 73 20  |   16  Title is |
00000cf0  6a 75 73 74 20 74 69 74  6c 65 20 28 6e 6f 74 20  |just title (not |
00000d00  45 72 72 6f 72 20 66 72  6f 6d 20 74 69 74 6c 65  |Error from title|
00000d10  29 0d 03 fc 25 f4 20 20  35 20 20 20 20 33 32 20  |)...%.  5    32 |
00000d20  20 44 61 6e 67 65 72 6f  75 73 2c 20 64 6f 20 6e  | Dangerous, do n|
00000d30  6f 74 20 75 73 65 0d 04  06 1e f4 20 20 36 20 20  |ot use.....  6  |
00000d40  20 20 36 34 20 20 4e 6f  20 65 72 72 6f 72 20 62  |  64  No error b|
00000d50  6f 78 20 3f 0d 04 10 1a  f4 20 20 37 20 20 20 31  |ox ?.....  7   1|
00000d60  32 38 20 20 44 6f 6e 27  74 20 62 65 65 70 0d 04  |28  Don't beep..|
00000d70  1a 3f dd a4 65 72 72 6f  72 62 6f 78 28 74 69 74  |.?..errorbox(tit|
00000d80  6c 65 24 2c 6d 65 73 73  61 67 65 24 2c 62 75 74  |le$,message$,but|
00000d90  74 6f 6e 25 29 3a 74 69  74 6c 65 24 3d a4 6d 73  |ton%):title$=.ms|
00000da0  67 74 65 78 74 28 74 69  74 6c 65 24 29 0d 04 24  |gtext(title$)..$|
00000db0  1f 6d 65 73 73 61 67 65  24 3d a4 6d 73 67 74 65  |.message$=.msgte|
00000dc0  78 74 28 6d 65 73 73 61  67 65 24 29 0d 04 2e 34  |xt(message$)...4|
00000dd0  24 28 6d 65 73 73 61 67  65 5f 62 75 66 66 65 72  |$(message_buffer|
00000de0  25 2b 34 29 3d 6d 65 73  73 61 67 65 24 3a 21 6d  |%+4)=message$:!m|
00000df0  65 73 73 61 67 65 5f 62  75 66 66 65 72 25 3d 30  |essage_buffer%=0|
00000e00  0d 04 38 42 c8 99 20 22  57 69 6d 70 5f 52 65 70  |..8B.. "Wimp_Rep|
00000e10  6f 72 74 45 72 72 6f 72  22 2c 6d 65 73 73 61 67  |ortError",messag|
00000e20  65 5f 62 75 66 66 65 72  25 2c 62 75 74 74 6f 6e  |e_buffer%,button|
00000e30  25 2c 74 69 74 6c 65 24  20 b8 20 2c 72 65 70 6c  |%,title$ . ,repl|
00000e40  79 25 0d 04 42 0b 3d 72  65 70 6c 79 25 0d 04 4c  |y%..B.=reply%..L|
00000e50  05 3a 0d 04 56 37 f4 20  50 52 4f 43 73 68 6f 77  |.:..V7. PROCshow|
00000e60  66 72 65 65 20 3a 20 64  69 73 70 6c 61 79 20 69  |free : display i|
00000e70  6e 20 69 6e 66 6f 62 6f  78 25 20 74 68 65 20 66  |n infobox% the f|
00000e80  72 65 65 20 73 70 61 63  65 0d 04 60 0e dd f2 73  |ree space..`...s|
00000e90  68 6f 77 66 72 65 65 0d  04 6a 07 ea 20 85 0d 04  |howfree..j.. ...|
00000ea0  74 40 ee 20 85 20 ea 3a  e7 20 9f 3d 26 38 30 33  |t@. . .:. .=&803|
00000eb0  20 8c f2 73 65 74 69 63  6f 6e 74 65 78 74 28 69  | ..seticontext(i|
00000ec0  6e 66 6f 62 6f 78 25 2c  34 2c 22 4f 6c 64 20 74  |nfobox%,4,"Old t|
00000ed0  65 6d 70 6c 61 74 65 22  29 3a e1 20 8b e1 0d 04  |emplate"):. ....|
00000ee0  7e 26 f2 73 65 74 69 63  6f 6e 74 65 78 74 28 69  |~&.seticontext(i|
00000ef0  6e 66 6f 62 6f 78 25 2c  35 2c 22 50 72 6f 67 72  |nfobox%,5,"Progr|
00000f00  61 6d 22 29 0d 04 88 42  f2 73 65 74 69 63 6f 6e  |am")...B.seticon|
00000f10  74 65 78 74 28 69 6e 66  6f 62 6f 78 25 2c 31 2c  |text(infobox%,1,|
00000f20  c3 28 b8 50 2d 90 29 2b  22 20 62 79 74 65 73 2c  |.(.P-.)+" bytes,|
00000f30  20 22 2b c3 28 28 b8 50  2d 90 29 81 26 34 30 30  | "+.((.P-.).&400|
00000f40  29 2b 22 4b 22 29 0d 04  92 23 f2 73 65 74 69 63  |)+"K")...#.setic|
00000f50  6f 6e 74 65 78 74 28 69  6e 66 6f 62 6f 78 25 2c  |ontext(infobox%,|
00000f60  36 2c 22 56 61 72 73 22  29 0d 04 9c 40 f2 73 65  |6,"Vars")...@.se|
00000f70  74 69 63 6f 6e 74 65 78  74 28 69 6e 66 6f 62 6f  |ticontext(infobo|
00000f80  78 25 2c 32 2c c3 28 e0  2d 92 29 2b 22 20 62 79  |x%,2,.(.-.)+" by|
00000f90  74 65 73 2c 20 22 2b c3  28 28 e0 2d 92 29 81 26  |tes, "+.((.-.).&|
00000fa0  34 30 30 29 2b 22 4b 22  29 0d 04 a6 23 f2 73 65  |400)+"K")...#.se|
00000fb0  74 69 63 6f 6e 74 65 78  74 28 69 6e 66 6f 62 6f  |ticontext(infobo|
00000fc0  78 25 2c 37 2c 22 46 72  65 65 22 29 0d 04 b0 40  |x%,7,"Free")...@|
00000fd0  f2 73 65 74 69 63 6f 6e  74 65 78 74 28 69 6e 66  |.seticontext(inf|
00000fe0  6f 62 6f 78 25 2c 33 2c  c3 28 93 2d e0 29 2b 22  |obox%,3,.(.-.)+"|
00000ff0  20 62 79 74 65 73 2c 20  22 2b c3 28 28 93 2d e0  | bytes, "+.((.-.|
00001000  29 81 26 34 30 30 29 2b  22 4b 22 29 0d 04 ba 21  |).&400)+"K")...!|
00001010  f2 68 65 61 70 5f 66 72  65 65 28 68 65 61 70 73  |.heap_free(heaps|
00001020  69 7a 65 2c 68 65 61 70  66 72 65 65 29 0d 04 c4  |ize,heapfree)...|
00001030  23 f2 73 65 74 69 63 6f  6e 74 65 78 74 28 69 6e  |#.seticontext(in|
00001040  66 6f 62 6f 78 25 2c 38  2c 22 48 65 61 70 22 29  |fobox%,8,"Heap")|
00001050  0d 04 ce 76 f2 73 65 74  69 63 6f 6e 74 65 78 74  |...v.seticontext|
00001060  28 69 6e 66 6f 62 6f 78  25 2c 34 2c c3 28 68 65  |(infobox%,4,.(he|
00001070  61 70 73 69 7a 65 2d 68  65 61 70 66 72 65 65 29  |apsize-heapfree)|
00001080  2b 22 20 62 79 74 65 73  2c 20 22 2b c3 28 28 68  |+" bytes, "+.((h|
00001090  65 61 70 73 69 7a 65 2d  68 65 61 70 66 72 65 65  |eapsize-heapfree|
000010a0  29 81 26 34 30 30 29 2b  22 4b 20 6f 66 20 22 2b  |).&400)+"K of "+|
000010b0  c3 28 68 65 61 70 73 69  7a 65 20 81 26 34 30 30  |.(heapsize .&400|
000010c0  29 2b 22 4b 22 29 0d 04  d8 05 e1 0d 04 e2 05 3a  |)+"K").........:|
000010d0  0d 04 ec 37 f4 20 2a 2a  2a 2a 2a 2a 2a 2a 20 4d  |...7. ******** M|
000010e0  65 6e 75 20 6d 61 6e 69  70 75 6c 61 74 69 6f 6e  |enu manipulation|
000010f0  20 70 72 6f 63 65 64 75  72 65 73 20 2a 2a 2a 2a  | procedures ****|
00001100  2a 2a 2a 2a 2a 2a 2a 0d  04 f6 05 3a 0d 05 00 39  |*******....:...9|
00001110  f4 20 46 4e 63 72 65 61  74 65 6d 65 6e 75 20 3a  |. FNcreatemenu :|
00001120  20 43 72 65 61 74 65 20  61 20 6d 65 6e 75 20 67  | Create a menu g|
00001130  69 76 65 6e 20 61 20 63  6f 6e 74 72 6f 6c 20 73  |iven a control s|
00001140  74 72 69 6e 67 0d 05 0a  13 f4 20 4d 65 6e 75 20  |tring..... Menu |
00001150  46 6f 72 6d 61 74 20 3a  0d 05 14 1a f4 20 54 69  |Format :..... Ti|
00001160  74 6c 65 7c 49 74 65 6d  7c 49 74 65 6d 7c 49 74  |tle|Item|Item|It|
00001170  65 6d 0d 05 1e 18 f4 20  49 74 65 6d 20 63 6f 6e  |em..... Item con|
00001180  73 69 73 74 73 20 6f 66  20 3a 0d 05 28 1a f4 20  |sists of :..(.. |
00001190  45 6e 74 72 79 20 6f 72  20 45 6e 74 72 79 5d 46  |Entry or Entry]F|
000011a0  6c 61 67 73 0d 05 32 2a  f4 20 46 6c 61 67 73 20  |lags..2*. Flags |
000011b0  63 61 6e 20 62 65 20 3a  20 28 73 65 70 61 72 61  |can be : (separa|
000011c0  74 65 64 20 62 79 20 63  6f 6d 6d 61 73 29 0d 05  |ted by commas)..|
000011d0  3c 13 f4 20 20 54 20 66  6f 72 20 74 69 63 6b 65  |<..  T for ticke|
000011e0  64 0d 05 46 1e f4 20 20  44 20 66 6f 72 20 64 6f  |d..F..  D for do|
000011f0  74 74 65 64 20 75 6e 64  65 72 6e 65 61 74 68 0d  |tted underneath.|
00001200  05 50 15 f4 20 20 57 20  66 6f 72 20 77 72 69 74  |.P..  W for writ|
00001210  61 62 6c 65 0d 05 5a 13  f4 20 20 53 20 66 6f 72  |able..Z..  S for|
00001220  20 73 68 61 64 65 64 0d  05 64 2b f4 20 20 4b 20  | shaded..d+.  K |
00001230  66 6f 72 20 6b 65 79 20  73 68 6f 72 74 63 75 74  |for key shortcut|
00001240  20 28 5e 3d 63 74 72 6c  2c 20 a4 3d 73 68 69 66  | (^=ctrl, .=shif|
00001250  74 29 0d 05 6e 3c f4 20  20 3e 20 66 6f 6c 6c 6f  |t)..n<.  > follo|
00001260  77 65 64 20 62 79 20 76  61 72 69 61 62 6c 65 20  |wed by variable |
00001270  66 6f 72 20 73 75 62 2d  6d 65 6e 75 20 28 49 74  |for sub-menu (It|
00001280  65 6d 5d 3e 73 75 62 6d  65 6e 75 25 7c 29 0d 05  |em]>submenu%|)..|
00001290  78 32 f4 20 20 7d 20 66  6f 6c 6c 6f 77 65 64 20  |x2.  } followed |
000012a0  62 79 20 61 20 73 70 72  69 74 65 20 6e 61 6d 65  |by a sprite name|
000012b0  20 28 49 74 65 6d 5d 7d  73 70 72 69 74 65 7c 29  | (Item]}sprite|)|
000012c0  0d 05 82 43 f4 20 4e 42  3a 54 68 65 20 6c 61 73  |...C. NB:The las|
000012d0  74 20 74 77 6f 20 66 6c  61 67 73 20 63 61 6e 20  |t two flags can |
000012e0  62 65 20 75 73 65 64 20  74 6f 67 65 74 68 65 72  |be used together|
000012f0  20 69 66 20 63 6f 6d 6d  61 20 73 65 70 65 72 61  | if comma sepera|
00001300  74 65 64 0d 05 8c 20 f4  20 20 20 20 65 67 2e 20  |ted... .    eg. |
00001310  49 6e 66 6f 5d 3e 69 6e  66 6f 25 2c 7d 21 48 65  |Info]>info%,}!He|
00001320  6c 70 7c 0d 05 96 41 f4  20 4e 42 3a 49 66 20 74  |lp|...A. NB:If t|
00001330  68 65 20 73 70 72 69 74  65 6e 61 6d 65 20 73 74  |he spritename st|
00001340  61 72 74 73 20 77 69 74  68 20 73 6d 20 74 68 65  |arts with sm the|
00001350  6e 20 74 68 65 20 73 70  72 69 74 65 20 77 69 6c  |n the sprite wil|
00001360  6c 20 62 65 0d 05 a0 3d  f4 20 20 20 20 64 69 73  |l be...=.    dis|
00001370  70 6c 61 79 65 64 20 75  73 69 6e 67 20 69 74 73  |played using its|
00001380  20 73 6d 61 6c 6c 20 66  6f 72 6d 2c 20 6f 74 68  | small form, oth|
00001390  65 72 77 69 73 65 20 69  74 20 77 69 6c 6c 20 62  |erwise it will b|
000013a0  65 0d 05 aa 1d f4 20 20  20 20 73 68 72 75 6e 6b  |e.....    shrunk|
000013b0  20 74 6f 20 68 61 6c 66  20 73 69 7a 65 2e 0d 05  | to half size...|
000013c0  b4 14 dd a4 63 72 65 61  74 65 6d 65 6e 75 28 41  |....createmenu(A|
000013d0  24 29 0d 05 be 35 ea 20  70 6f 69 6e 74 65 72 2c  |$)...5. pointer,|
000013e0  70 32 2c 70 33 2c 6c 2c  6c 6b 2c 4f 24 2c 43 24  |p2,p3,l,lk,O$,C$|
000013f0  2c 6f 69 6e 64 25 2c 6f  69 6e 64 6c 25 2c 6b 73  |,oind%,oindl%,ks|
00001400  25 2c 6b 24 2c 53 24 0d  05 c8 21 6f 69 6e 64 25  |%,k$,S$...!oind%|
00001410  3d 69 6e 64 25 3a 6f 69  6e 64 6c 25 3d 69 6e 64  |=ind%:oindl%=ind|
00001420  6c 25 3a 6b 73 25 3d a3  0d 05 d2 1d 70 6f 69 6e  |l%:ks%=.....poin|
00001430  74 65 72 3d 6d 65 6e 75  25 3a 6c 3d 30 3a 41 24  |ter=menu%:l=0:A$|
00001440  2b 3d 22 7c 22 0d 05 dc  1b f2 6d 65 6e 75 70 75  |+="|".....menupu|
00001450  74 73 28 a4 6d 67 65 74  28 41 24 2c 43 24 29 29  |ts(.mget(A$,C$))|
00001460  0d 05 e6 15 f2 6d 65 6e  75 70 75 74 77 28 26 37  |.....menuputw(&7|
00001470  30 32 30 37 29 0d 05 f0  1b 70 32 3d 6d 65 6e 75  |0207)....p2=menu|
00001480  25 3a f2 6d 65 6e 75 70  75 74 77 28 26 38 30 29  |%:.menuputw(&80)|
00001490  0d 05 fa 12 f2 6d 65 6e  75 70 75 74 77 28 26 32  |.....menuputw(&2|
000014a0  43 29 0d 06 04 26 f2 6d  65 6e 75 70 75 74 77 28  |C)...&.menuputw(|
000014b0  30 29 3a 6f 70 74 69 6f  6e 73 25 3d 30 3a 53 24  |0):options%=0:S$|
000014c0  3d 41 24 3a 6c 6b 3d 30  0d 06 0e 05 f5 0d 06 18  |=A$:lk=0........|
000014d0  15 20 e7 20 6b 73 25 3d  b9 20 8c 6b 73 25 3d b9  |. . ks%=. .ks%=.|
000014e0  2a 32 0d 06 22 06 20 f5  0d 06 2c 29 20 20 4f 24  |*2..". ...,)  O$|
000014f0  3d a4 6d 67 65 74 28 41  24 2c 43 24 29 3a 6f 70  |=.mget(A$,C$):op|
00001500  74 69 6f 6e 73 25 3d 6f  70 74 69 6f 6e 73 25 2b  |tions%=options%+|
00001510  31 0d 06 36 31 20 20 66  6c 61 67 73 3d a4 6d 64  |1..61  flags=.md|
00001520  65 63 6f 64 65 28 43 24  2c 70 33 2c 73 24 2c 6b  |ecode(C$,p3,s$,k|
00001530  24 29 2b 28 28 2d 28 41  24 3d 22 22 29 29 3c 3c  |$)+((-(A$=""))<<|
00001540  37 29 0d 06 40 1a 20 20  e7 20 6b 73 25 3d b9 2a  |7)..@.  . ks%=.*|
00001550  32 20 80 20 6b 24 3c 3e  22 22 20 8c 0d 06 4a 25  |2 . k$<>"" ...J%|
00001560  20 20 20 4f 24 2b 3d c4  6c 2b 6c 6b 2d 28 a9 28  |   O$+=.l+lk-(.(|
00001570  4f 24 29 2b a9 28 6b 24  29 29 2b 31 2c 22 20 22  |O$)+.(k$))+1," "|
00001580  29 0d 06 54 24 20 20 20  e7 20 c0 6b 24 2c 31 29  |)..T$   . .k$,1)|
00001590  3d 22 a4 22 20 8c c1 6b  24 2c 31 2c 31 29 3d bd  |="." ..k$,1,1)=.|
000015a0  28 31 33 39 29 0d 06 5e  0d 20 20 20 4f 24 2b 3d  |(139)..^.   O$+=|
000015b0  6b 24 0d 06 68 07 20 20  cc 0d 06 72 2b 20 20 20  |k$..h.  ...r+   |
000015c0  e7 20 6b 24 3c 3e 22 22  20 8c 6b 73 25 3d b9 3a  |. k$<>"" .ks%=.:|
000015d0  e7 20 6c 6b 3c a9 28 6b  24 29 20 8c 6c 6b 3d a9  |. lk<.(k$) .lk=.|
000015e0  28 6b 24 29 0d 06 7c 07  20 20 cd 0d 06 86 3d 20  |(k$)..|.  ....= |
000015f0  20 66 6c 61 67 73 32 3d  26 37 30 30 30 30 32 31  | flags2=&7000021|
00001600  2b 28 28 2d 28 a9 28 4f  24 29 3e 31 31 29 29 3c  |+((-(.(O$)>11))<|
00001610  3c 38 29 2b 28 31 3c 3c  31 34 29 2a 28 66 6c 61  |<8)+(1<<14)*(fla|
00001620  67 73 20 80 32 35 36 29  0d 06 90 2b 20 20 e7 20  |gs .256)...+  . |
00001630  28 66 6c 61 67 73 20 80  20 34 29 3c 3e 30 20 8c  |(flags . 4)<>0 .|
00001640  66 6c 61 67 73 32 3d 66  6c 61 67 73 32 20 84 20  |flags2=flags2 . |
00001650  32 35 36 0d 06 9a 1c 20  20 f2 6d 65 6e 75 70 75  |256....  .menupu|
00001660  74 77 28 66 6c 61 67 73  20 80 20 32 35 35 29 0d  |tw(flags . 255).|
00001670  06 a4 13 20 20 f2 6d 65  6e 75 70 75 74 77 28 70  |...  .menuputw(p|
00001680  33 29 0d 06 ae 22 20 20  e7 a9 28 4f 24 29 3e 6c  |3)..."  ..(O$)>l|
00001690  20 80 20 6b 73 25 3c 3e  b9 2a 32 20 8c 6c 3d a9  | . ks%<>.*2 .l=.|
000016a0  28 4f 24 29 0d 06 b8 17  20 20 f2 6d 65 6e 75 70  |(O$)....  .menup|
000016b0  75 74 77 28 66 6c 61 67  73 32 29 0d 06 c2 24 20  |utw(flags2)...$ |
000016c0  20 f2 6d 65 6e 75 73 74  72 69 6e 67 28 4f 24 2c  | .menustring(O$,|
000016d0  73 24 2c 28 66 6c 61 67  73 20 80 20 34 29 29 0d  |s$,(flags . 4)).|
000016e0  06 cc 0b 20 fd 41 24 3d  22 22 0d 06 d6 69 20 e7  |... .A$=""...i .|
000016f0  20 6b 73 25 3d b9 2a 32  20 8c 6c 2b 3d 6c 6b 2b  | ks%=.*2 .l+=lk+|
00001700  31 20 8b e7 6b 73 25 3d  b9 20 8c 69 6e 64 25 3d  |1 ..ks%=. .ind%=|
00001710  6f 69 6e 64 25 3a 69 6e  64 6c 25 3d 6f 69 6e 64  |oind%:indl%=oind|
00001720  6c 25 3a 6d 65 6e 75 6c  25 2b 3d 6d 65 6e 75 25  |l%:menul%+=menu%|
00001730  2d 70 32 2d 31 32 3a 6d  65 6e 75 25 3d 70 32 2b  |-p2-12:menu%=p2+|
00001740  31 32 3a 6f 70 74 69 6f  6e 73 25 3d 30 3a 41 24  |12:options%=0:A$|
00001750  3d 53 24 0d 06 e0 0c fd  20 6b 73 25 3c 3e b9 0d  |=S$..... ks%<>..|
00001760  06 ea 0f 21 70 32 3d 6c  2a 31 36 2b 31 36 0d 06  |...!p2=l*16+16..|
00001770  f4 0c 3d 70 6f 69 6e 74  65 72 0d 06 fe 37 dd f2  |..=pointer...7..|
00001780  6d 65 6e 75 73 74 72 69  6e 67 28 54 24 2c 73 24  |menustring(T$,s$|
00001790  2c 66 6c 61 67 29 3a e7  20 c0 54 24 2c 31 29 3d  |,flag):. .T$,1)=|
000017a0  22 a4 22 20 8c 54 24 3d  a0 28 c1 54 24 2c 32 29  |"." .T$=.(.T$,2)|
000017b0  29 0d 07 08 1f e7 a9 28  54 24 29 3c 31 32 20 80  |)......(T$)<12 .|
000017c0  20 73 24 3d 22 22 20 80  20 66 6c 61 67 3d 30 8c  | s$="" . flag=0.|
000017d0  0d 07 12 12 20 f2 6d 65  6e 75 70 75 74 73 28 54  |.... .menuputs(T|
000017e0  24 29 0d 07 1c 05 cc 0d  07 26 1d 20 f2 6d 65 6e  |$).......&. .men|
000017f0  75 70 75 74 77 28 a4 69  6e 64 69 72 65 63 74 28  |uputw(.indirect(|
00001800  54 24 29 29 0d 07 30 0f  20 e7 20 73 24 3c 3e 22  |T$))..0. . s$<>"|
00001810  22 20 8c 0d 07 3a 1e 20  20 6d 65 6e 75 25 21 2d  |" ...:.  menu%!-|
00001820  38 3d 6d 65 6e 75 25 21  2d 38 20 84 20 26 38 30  |8=menu%!-8 . &80|
00001830  33 0d 07 44 34 20 20 e7  c0 a4 6c 6f 77 65 72 28  |3..D4  ...lower(|
00001840  73 24 29 2c 32 29 3d 22  73 6d 22 20 8c 6d 65 6e  |s$),2)="sm" .men|
00001850  75 25 21 2d 38 3d 6d 65  6e 75 25 21 2d 38 20 82  |u%!-8=menu%!-8 .|
00001860  20 26 38 30 30 0d 07 4e  22 20 20 f2 6d 65 6e 75  | &800..N"  .menu|
00001870  70 75 74 77 28 a4 69 6e  64 69 72 65 63 74 28 22  |putw(.indirect("|
00001880  53 22 2b 73 24 29 29 0d  07 58 06 20 cc 0d 07 62  |S"+s$))..X. ...b|
00001890  13 20 20 f2 6d 65 6e 75  70 75 74 77 28 2d 31 29  |.  .menuputw(-1)|
000018a0  0d 07 6c 06 20 cd 0d 07  76 17 20 f2 6d 65 6e 75  |..l. ...v. .menu|
000018b0  70 75 74 77 28 a9 28 54  24 29 2b 31 29 0d 07 80  |putw(.(T$)+1)...|
000018c0  05 cd 0d 07 8a 05 e1 0d  07 94 15 dd a4 6d 67 65  |.............mge|
000018d0  74 28 f8 20 41 24 2c f8  20 43 24 29 0d 07 9e 1b  |t(. A$,. C$)....|
000018e0  ea 20 42 24 3a 42 24 3d  c0 41 24 2c a7 41 24 2c  |. B$:B$=.A$,.A$,|
000018f0  22 7c 22 29 2d 31 29 0d  07 a8 27 41 24 3d c1 41  |"|")-1)...'A$=.A|
00001900  24 2c a9 28 42 24 29 2b  32 29 3a e7 a7 42 24 2c  |$,.(B$)+2):..B$,|
00001910  22 5d 22 29 3c 31 8c 42  24 2b 3d 22 5d 22 0d 07  |"]")<1.B$+="]"..|
00001920  b2 29 43 24 3d c1 42 24  2c a7 42 24 2c 22 5d 22  |.)C$=.B$,.B$,"]"|
00001930  29 2b 31 29 3a 42 24 3d  c0 42 24 2c a7 42 24 2c  |)+1):B$=.B$,.B$,|
00001940  22 5d 22 29 2d 31 29 0d  07 bc 11 3d a4 6d 73 67  |"]")-1)....=.msg|
00001950  74 65 78 74 28 42 24 29  0d 07 c6 3a dd f2 6d 65  |text(B$)...:..me|
00001960  6e 75 70 75 74 73 28 54  24 29 3a e7 a9 28 54 24  |nuputs(T$):..(T$|
00001970  29 3e 31 31 20 8c 85 20  26 38 30 33 2c 22 4d 65  |)>11 .. &803,"Me|
00001980  6e 75 20 65 6e 74 72 79  20 74 6f 6f 20 6c 6f 6e  |nu entry too lon|
00001990  67 22 0d 07 d0 22 24 6d  65 6e 75 25 3d 54 24 3a  |g"..."$menu%=T$:|
000019a0  6d 65 6e 75 25 2b 3d 31  32 3a 6d 65 6e 75 6c 25  |menu%+=12:menul%|
000019b0  2d 3d 31 32 0d 07 da 34  e7 6d 65 6e 75 6c 25 3c  |-=12...4.menul%<|
000019c0  3d 34 20 8c 85 20 26 38  30 33 2c 22 4e 6f 74 20  |=4 .. &803,"Not |
000019d0  65 6e 6f 75 67 68 20 6d  65 6d 6f 72 79 20 66 6f  |enough memory fo|
000019e0  72 20 6d 65 6e 75 73 22  0d 07 e4 05 e1 0d 07 ee  |r menus"........|
000019f0  12 dd f2 6d 65 6e 75 70  75 74 77 28 57 25 29 0d  |...menuputw(W%).|
00001a00  07 f8 20 21 6d 65 6e 75  25 3d 57 25 3a 6d 65 6e  |.. !menu%=W%:men|
00001a10  75 25 2b 3d 34 3a 6d 65  6e 75 6c 25 2d 3d 34 0d  |u%+=4:menul%-=4.|
00001a20  08 02 34 e7 6d 65 6e 75  6c 25 3c 3d 34 20 8c 85  |..4.menul%<=4 ..|
00001a30  20 26 38 30 33 2c 22 4e  6f 74 20 65 6e 6f 75 67  | &803,"Not enoug|
00001a40  68 20 6d 65 6d 6f 72 79  20 66 6f 72 20 6d 65 6e  |h memory for men|
00001a50  75 73 22 0d 08 0c 05 e1  0d 08 16 1f dd a4 6d 64  |us"...........md|
00001a60  65 63 6f 64 65 28 41 24  2c f8 20 70 2c f8 20 73  |ecode(A$,. p,. s|
00001a70  24 2c f8 20 6b 24 29 0d  08 20 28 ea 20 42 24 2c  |$,. k$).. (. B$,|
00001a80  43 24 2c 56 3a 70 3d 2d  31 3a 73 24 3d 22 22 3a  |C$,V:p=-1:s$="":|
00001a90  6b 24 3d 22 22 3a 41 24  3d 41 24 2b 22 2c 22 0d  |k$="":A$=A$+",".|
00001aa0  08 2a 0d c8 95 20 41 24  3c 3e 22 22 0d 08 34 18  |.*... A$<>""..4.|
00001ab0  20 42 24 3d c0 41 24 2c  31 29 3a 41 24 3d c1 41  | B$=.A$,1):A$=.A|
00001ac0  24 2c 32 29 0d 08 3e 0c  20 c8 8e 20 42 24 20 ca  |$,2)..>. .. B$ .|
00001ad0  0d 08 48 13 20 20 c9 20  22 54 22 3a 56 3d 56 20  |..H.  . "T":V=V |
00001ae0  84 20 31 0d 08 52 13 20  20 c9 20 22 44 22 3a 56  |. 1..R.  . "D":V|
00001af0  3d 56 20 84 20 32 0d 08  5c 13 20 20 c9 20 22 57  |=V . 2..\.  . "W|
00001b00  22 3a 56 3d 56 20 84 20  34 0d 08 66 13 20 20 c9  |":V=V . 4..f.  .|
00001b10  20 22 4d 22 3a 56 3d 56  20 84 20 38 0d 08 70 15  | "M":V=V . 8..p.|
00001b20  20 20 c9 20 22 53 22 3a  56 3d 56 20 84 20 32 35  |  . "S":V=V . 25|
00001b30  36 0d 08 7a 31 20 20 c9  20 22 4b 22 3a 6b 24 3d  |6..z1  . "K":k$=|
00001b40  c0 41 24 2c a7 41 24 2c  22 2c 22 29 2d 31 29 3a  |.A$,.A$,",")-1):|
00001b50  41 24 3d c1 41 24 2c a7  41 24 2c 22 2c 22 29 2b  |A$=.A$,.A$,",")+|
00001b60  31 29 0d 08 84 33 20 20  c9 20 22 3e 22 3a 70 3d  |1)...3  . ">":p=|
00001b70  a0 28 c0 41 24 2c a7 41  24 2c 22 2c 22 29 2d 31  |.(.A$,.A$,",")-1|
00001b80  29 29 3a 41 24 3d c1 41  24 2c a7 41 24 2c 22 2c  |)):A$=.A$,.A$,",|
00001b90  22 29 2b 31 29 0d 08 8e  35 20 20 c9 20 22 7d 22  |")+1)...5  . "}"|
00001ba0  3a 73 24 3d c0 41 24 2c  a7 41 24 2c 22 2c 22 29  |:s$=.A$,.A$,",")|
00001bb0  2d 31 29 2b 22 20 22 3a  41 24 3d c1 41 24 2c a7  |-1)+" ":A$=.A$,.|
00001bc0  41 24 2c 22 2c 22 29 2b  31 29 0d 08 98 06 20 cb  |A$,",")+1).... .|
00001bd0  0d 08 a2 05 ce 0d 08 ac  06 3d 56 0d 08 b6 05 3a  |.........=V....:|
00001be0  0d 08 c0 42 f4 20 46 4e  69 6e 64 69 72 65 63 74  |...B. FNindirect|
00001bf0  20 3a 20 50 6c 61 63 65  20 61 20 73 74 72 69 6e  | : Place a strin|
00001c00  67 20 69 6e 20 69 6e 64  69 72 65 63 74 69 6f 6e  |g in indirection|
00001c10  20 62 75 66 66 65 72 20  28 72 65 74 2e 20 6c 6f  | buffer (ret. lo|
00001c20  63 29 0d 08 ca 1d dd a4  69 6e 64 69 72 65 63 74  |c)......indirect|
00001c30  28 61 24 29 3a ea 20 69  3a 69 3d 69 6e 64 25 0d  |(a$):. i:i=ind%.|
00001c40  08 d4 3c e7 a9 28 61 24  29 3e 69 6e 64 6c 25 2d  |..<..(a$)>indl%-|
00001c50  31 20 8c 85 20 26 38 30  33 2c 22 4e 6f 74 20 65  |1 .. &803,"Not e|
00001c60  6e 6f 75 67 68 20 72 6f  6f 6d 20 66 6f 72 20 69  |nough room for i|
00001c70  6e 64 69 72 65 63 74 69  6f 6e 22 0d 08 de 29 24  |ndirection"...)$|
00001c80  69 6e 64 25 3d 61 24 3a  69 6e 64 25 2b 3d a9 28  |ind%=a$:ind%+=.(|
00001c90  61 24 29 2b 31 3a 69 6e  64 6c 25 2d 3d a9 28 61  |a$)+1:indl%-=.(a|
00001ca0  24 29 2b 31 0d 08 e8 06  3d 69 0d 08 f2 05 3a 0d  |$)+1....=i....:.|
00001cb0  08 fc 3c f4 20 50 52 4f  43 69 62 6d 65 6e 75 20  |..<. PROCibmenu |
00001cc0  20 20 20 20 20 20 3a 20  43 72 65 61 74 65 20 61  |      : Create a|
00001cd0  6e 20 69 63 6f 6e 62 61  72 20 6d 65 6e 75 20 66  |n iconbar menu f|
00001ce0  72 6f 6d 20 69 62 6d 65  6e 75 25 0d 09 06 44 f4  |rom ibmenu%...D.|
00001cf0  20 50 52 4f 43 6d 65 6e  75 20 20 20 20 20 20 20  | PROCmenu       |
00001d00  20 20 3a 20 43 72 65 61  74 65 20 74 68 65 20 6d  |  : Create the m|
00001d10  65 6e 75 20 61 74 20 63  6f 2d 6f 72 64 73 20 6f  |enu at co-ords o|
00001d20  72 20 6d 6f 75 73 65 20  69 66 20 78 3d 2d 31 0d  |r mouse if x=-1.|
00001d30  09 10 34 f4 20 50 52 4f  43 72 65 63 72 65 61 74  |..4. PROCrecreat|
00001d40  65 6d 65 6e 75 20 3a 20  52 65 63 72 65 61 74 65  |emenu : Recreate|
00001d50  20 74 68 65 20 6d 65 6e  75 20 6a 75 73 74 20 75  | the menu just u|
00001d60  73 65 64 0d 09 1a 0c dd  f2 69 62 6d 65 6e 75 0d  |sed......ibmenu.|
00001d70  09 24 5b c8 99 20 22 57  69 6d 70 5f 47 65 74 50  |.$[.. "Wimp_GetP|
00001d80  6f 69 6e 74 65 72 49 6e  66 6f 22 2c 2c 62 25 3a  |ointerInfo",,b%:|
00001d90  63 75 72 6d 65 6e 75 25  3d 69 62 6d 65 6e 75 25  |curmenu%=ibmenu%|
00001da0  3a 63 6d 65 6e 75 78 25  3d 62 25 21 30 2d 36 34  |:cmenux%=b%!0-64|
00001db0  3a 63 6d 65 6e 75 79 25  3d 39 36 2b 26 32 43 2a  |:cmenuy%=96+&2C*|
00001dc0  69 62 6f 70 74 69 6f 6e  73 25 0d 09 2e 3b c8 99  |iboptions%...;..|
00001dd0  20 22 57 69 6d 70 5f 43  72 65 61 74 65 4d 65 6e  | "Wimp_CreateMen|
00001de0  75 22 2c 2c 69 62 6d 65  6e 75 25 2c 62 25 21 30  |u",,ibmenu%,b%!0|
00001df0  2d 36 34 2c 39 36 2b 26  32 43 2a 69 62 6f 70 74  |-64,96+&2C*ibopt|
00001e00  69 6f 6e 73 25 0d 09 38  05 e1 0d 09 42 15 dd f2  |ions%..8....B...|
00001e10  6d 65 6e 75 28 6d 65 6e  75 25 2c 78 2c 79 29 0d  |menu(menu%,x,y).|
00001e20  09 4c 36 e7 20 78 3d 2d  31 20 8c c8 99 20 22 57  |.L6. x=-1 ... "W|
00001e30  69 6d 70 5f 47 65 74 50  6f 69 6e 74 65 72 49 6e  |imp_GetPointerIn|
00001e40  66 6f 22 2c 2c 62 25 3a  78 3d 62 25 21 30 3a 79  |fo",,b%:x=b%!0:y|
00001e50  3d 62 25 21 34 0d 09 56  2c 63 75 72 6d 65 6e 75  |=b%!4..V,curmenu|
00001e60  25 3d 6d 65 6e 75 25 3a  63 6d 65 6e 75 78 25 3d  |%=menu%:cmenux%=|
00001e70  78 2d 36 34 3a 63 6d 65  6e 75 79 25 3d 79 2b 32  |x-64:cmenuy%=y+2|
00001e80  30 0d 09 60 29 c8 99 20  22 57 69 6d 70 5f 43 72  |0..`).. "Wimp_Cr|
00001e90  65 61 74 65 4d 65 6e 75  22 2c 2c 6d 65 6e 75 25  |eateMenu",,menu%|
00001ea0  2c 78 2d 36 34 2c 79 2b  32 30 0d 09 6a 05 e1 0d  |,x-64,y+20..j...|
00001eb0  09 74 12 dd f2 72 65 63  72 65 61 74 65 6d 65 6e  |.t...recreatemen|
00001ec0  75 0d 09 7e 32 c8 99 20  22 57 69 6d 70 5f 43 72  |u..~2.. "Wimp_Cr|
00001ed0  65 61 74 65 4d 65 6e 75  22 2c 2c 63 75 72 6d 65  |eateMenu",,curme|
00001ee0  6e 75 25 2c 63 6d 65 6e  75 78 25 2c 63 6d 65 6e  |nu%,cmenux%,cmen|
00001ef0  75 79 25 0d 09 88 05 e1  0d 09 92 05 3a 0d 09 9c  |uy%.........:...|
00001f00  2f f4 20 50 52 4f 43 6d  65 6e 75 75 6e 74 69 63  |/. PROCmenuuntic|
00001f10  6b 3a 20 55 6e 74 69 63  6b 20 61 20 67 72 6f 75  |k: Untick a grou|
00001f20  70 20 6f 66 20 6f 70 74  69 6f 6e 73 0d 09 a6 30  |p of options...0|
00001f30  f4 20 50 52 4f 43 6d 65  6e 75 74 69 63 6b 20 20  |. PROCmenutick  |
00001f40  3a 20 54 69 63 6b 2f 75  6e 74 69 63 6b 20 6f 70  |: Tick/untick op|
00001f50  74 69 6f 6e 20 6f 6e 20  6d 65 6e 75 0d 09 b0 32  |tion on menu...2|
00001f60  f4 20 50 52 4f 43 6d 65  6e 75 73 68 61 64 65 20  |. PROCmenushade |
00001f70  3a 20 53 68 61 64 65 2f  75 6e 73 68 61 64 65 20  |: Shade/unshade |
00001f80  6f 70 74 69 6f 6e 20 6f  6e 20 6d 65 6e 75 0d 09  |option on menu..|
00001f90  ba 38 f4 20 46 4e 6d 65  6e 75 74 69 63 6b 65 64  |.8. FNmenuticked|
00001fa0  20 20 3a 20 52 65 74 75  72 6e 20 54 52 55 45 20  |  : Return TRUE |
00001fb0  69 66 20 6d 65 6e 75 20  69 74 65 6d 20 69 73 20  |if menu item is |
00001fc0  74 69 63 6b 65 64 0d 09  c4 38 f4 20 46 4e 6d 65  |ticked...8. FNme|
00001fd0  6e 75 73 68 61 64 65 64  20 20 3a 20 52 65 74 75  |nushaded  : Retu|
00001fe0  72 6e 20 54 52 55 45 20  69 66 20 6d 65 6e 75 20  |rn TRUE if menu |
00001ff0  69 74 65 6d 20 69 73 20  73 68 61 64 65 64 0d 09  |item is shaded..|
00002000  ce 19 f4 20 74 79 70 65  20 3d 20 30 20 66 6f 72  |... type = 0 for|
00002010  20 75 6e 74 69 63 6b 0d  09 d8 21 f4 20 74 79 70  | untick...!. typ|
00002020  65 20 3d 20 31 20 66 6f  72 20 74 69 63 6b 20 28  |e = 1 for tick (|
00002030  61 6c 73 6f 20 2d 31 29  0d 09 e2 19 f4 20 74 79  |also -1)..... ty|
00002040  70 65 20 3d 20 32 20 66  6f 72 20 74 6f 67 67 6c  |pe = 2 for toggl|
00002050  65 0d 09 ec 20 dd f2 6d  65 6e 75 75 6e 74 69 63  |e... ..menuuntic|
00002060  6b 28 6d 65 6e 75 2c 73  74 61 72 74 2c 65 6e 64  |k(menu,start,end|
00002070  29 0d 09 f6 15 6d 65 6e  75 2b 3d 73 74 61 72 74  |)....menu+=start|
00002080  2a 32 34 2b 32 38 0d 0a  00 05 f5 0d 0a 0a 27 20  |*24+28........' |
00002090  21 6d 65 6e 75 3d 21 6d  65 6e 75 20 80 20 2d 32  |!menu=!menu . -2|
000020a0  3a 73 74 61 72 74 2b 3d  31 3a 6d 65 6e 75 2b 3d  |:start+=1:menu+=|
000020b0  32 34 0d 0a 14 34 fd 20  28 65 6e 64 3c 3e 2d 31  |24...4. (end<>-1|
000020c0  20 80 20 73 74 61 72 74  3e 65 6e 64 29 20 84 20  | . start>end) . |
000020d0  28 28 6d 65 6e 75 21 2d  32 34 29 20 80 20 26 38  |((menu!-24) . &8|
000020e0  30 29 3d 26 38 30 0d 0a  1e 05 e1 0d 0a 28 35 dd  |0)=&80.......(5.|
000020f0  f2 6d 65 6e 75 74 69 63  6b 28 6d 65 6e 75 2c 6f  |.menutick(menu,o|
00002100  70 74 69 6f 6e 2c 74 6f  67 67 6c 65 29 3a 6d 65  |ption,toggle):me|
00002110  6e 75 2b 3d 6f 70 74 69  6f 6e 2a 32 34 2b 32 38  |nu+=option*24+28|
00002120  0d 0a 32 0f c8 8e 20 74  6f 67 67 6c 65 20 ca 0d  |..2... toggle ..|
00002130  0a 3c 19 20 c9 20 30 3a  21 6d 65 6e 75 3d 21 6d  |.<. . 0:!menu=!m|
00002140  65 6e 75 20 80 20 2d 32  0d 0a 46 1b 20 c9 20 2d  |enu . -2..F. . -|
00002150  31 2c 31 3a 21 6d 65 6e  75 3d 21 6d 65 6e 75 20  |1,1:!menu=!menu |
00002160  84 20 31 0d 0a 50 18 20  c9 20 32 3a 21 6d 65 6e  |. 1..P. . 2:!men|
00002170  75 3d 21 6d 65 6e 75 20  82 20 31 0d 0a 5a 05 cb  |u=!menu . 1..Z..|
00002180  0d 0a 64 05 e1 0d 0a 6e  36 dd f2 6d 65 6e 75 73  |..d....n6..menus|
00002190  68 61 64 65 28 6d 65 6e  75 2c 6f 70 74 69 6f 6e  |hade(menu,option|
000021a0  2c 74 6f 67 67 6c 65 29  3a 6d 65 6e 75 2b 3d 6f  |,toggle):menu+=o|
000021b0  70 74 69 6f 6e 2a 32 34  2b 33 36 0d 0a 78 0f c8  |ption*24+36..x..|
000021c0  8e 20 74 6f 67 67 6c 65  20 ca 0d 0a 82 1f 20 c9  |. toggle ..... .|
000021d0  20 30 3a 21 6d 65 6e 75  3d 21 6d 65 6e 75 20 80  | 0:!menu=!menu .|
000021e0  20 ac 28 31 3c 3c 32 32  29 0d 0a 8c 21 20 c9 20  | .(1<<22)...! . |
000021f0  2d 31 2c 31 3a 21 6d 65  6e 75 3d 21 6d 65 6e 75  |-1,1:!menu=!menu|
00002200  20 84 20 28 31 3c 3c 32  32 29 0d 0a 96 1e 20 c9  | . (1<<22).... .|
00002210  20 32 3a 21 6d 65 6e 75  3d 21 6d 65 6e 75 20 82  | 2:!menu=!menu .|
00002220  20 28 31 3c 3c 32 32 29  0d 0a a0 05 cb 0d 0a aa  | (1<<22)........|
00002230  05 e1 0d 0a b4 1d dd a4  6d 65 6e 75 74 69 63 6b  |........menutick|
00002240  65 64 28 6d 65 6e 75 25  2c 69 74 65 6d 25 29 0d  |ed(menu%,item%).|
00002250  0a be 22 3d 28 28 6d 65  6e 75 25 21 28 32 38 2b  |.."=((menu%!(28+|
00002260  32 34 2a 69 74 65 6d 25  29 29 20 80 20 31 29 3d  |24*item%)) . 1)=|
00002270  31 0d 0a c8 1d dd a4 6d  65 6e 75 73 68 61 64 65  |1......menushade|
00002280  64 28 6d 65 6e 75 25 2c  69 74 65 6d 25 29 0d 0a  |d(menu%,item%)..|
00002290  d2 22 3d 28 28 6d 65 6e  75 25 21 28 32 38 2b 32  |."=((menu%!(28+2|
000022a0  34 2a 69 74 65 6d 25 29  29 20 80 20 34 29 3d 34  |4*item%)) . 4)=4|
000022b0  0d 0a dc 05 3a 0d 0a e6  34 f4 20 50 52 4f 43 73  |....:...4. PROCs|
000022c0  65 74 6d 65 6e 75 74 65  78 74 20 3a 20 53 65 74  |etmenutext : Set|
000022d0  20 74 68 65 20 74 65 78  74 20 66 6f 72 20 6d 65  | the text for me|
000022e0  6e 75 20 6f 70 74 69 6f  6e 0d 0a f0 35 f4 20 46  |nu option...5. F|
000022f0  4e 67 65 74 6d 65 6e 75  74 65 78 74 20 20 20 3a  |Ngetmenutext   :|
00002300  20 52 65 61 64 20 74 68  65 20 74 65 78 74 20 66  | Read the text f|
00002310  6f 72 20 6d 65 6e 75 20  6f 70 74 69 6f 6e 0d 0a  |or menu option..|
00002320  fa 37 dd f2 73 65 74 6d  65 6e 75 74 65 78 74 28  |.7..setmenutext(|
00002330  6d 65 6e 75 2c 6f 70 74  69 6f 6e 2c 74 65 78 74  |menu,option,text|
00002340  24 29 3a 6d 65 6e 75 2b  3d 6f 70 74 69 6f 6e 2a  |$):menu+=option*|
00002350  32 34 2b 33 36 0d 0b 04  37 e7 20 28 21 6d 65 6e  |24+36...7. (!men|
00002360  75 20 80 26 31 30 30 29  3e 30 20 8c 24 28 6d 65  |u .&100)>0 .$(me|
00002370  6e 75 21 34 29 3d 74 65  78 74 24 20 8b 24 28 6d  |nu!4)=text$ .$(m|
00002380  65 6e 75 2b 34 29 3d 74  65 78 74 24 0d 0b 0e 05  |enu+4)=text$....|
00002390  e1 0d 0b 18 39 dd a4 67  65 74 6d 65 6e 75 74 65  |....9..getmenute|
000023a0  78 74 28 6d 65 6e 75 2c  6f 70 74 69 6f 6e 29 3a  |xt(menu,option):|
000023b0  6d 65 6e 75 2b 3d 6f 70  74 69 6f 6e 2a 32 34 2b  |menu+=option*24+|
000023c0  33 36 3a ea 20 74 65 78  74 24 0d 0b 22 37 e7 20  |36:. text$.."7. |
000023d0  28 21 6d 65 6e 75 20 80  26 31 30 30 29 3e 30 20  |(!menu .&100)>0 |
000023e0  8c 74 65 78 74 24 3d 24  28 6d 65 6e 75 21 34 29  |.text$=$(menu!4)|
000023f0  20 8b 74 65 78 74 24 3d  24 28 6d 65 6e 75 2b 34  | .text$=$(menu+4|
00002400  29 0d 0b 2c 0a 3d 74 65  78 74 24 0d 0b 36 05 3a  |)..,.=text$..6.:|
00002410  0d 0b 40 34 f4 20 46 4e  64 65 63 6f 64 65 6d 65  |..@4. FNdecodeme|
00002420  6e 75 20 3a 20 52 65 74  75 72 6e 20 6d 65 6e 75  |nu : Return menu|
00002430  20 73 65 6c 65 63 74 69  6f 6e 20 61 73 20 73 74  | selection as st|
00002440  72 69 6e 67 0d 0b 4a 2f  f4 20 61 6c 73 6f 20 72  |ring..J/. also r|
00002450  65 74 75 72 6e 73 20 66  6f 72 20 66 6f 6e 74 20  |eturns for font |
00002460  69 66 20 6d 65 6e 75 20  69 73 20 66 6f 6e 74 6d  |if menu is fontm|
00002470  65 6e 75 0d 0b 54 37 dd  a4 64 65 63 6f 64 65 6d  |enu..T7..decodem|
00002480  65 6e 75 28 6d 65 6e 75  25 29 3a ea 20 63 70 25  |enu(menu%):. cp%|
00002490  2c 70 74 72 2c 62 24 2c  63 24 3a 63 70 25 3d 6d  |,ptr,b$,c$:cp%=m|
000024a0  65 6e 75 25 3a 70 74 72  3d 30 0d 0b 5e 25 c8 95  |enu%:ptr=0..^%..|
000024b0  20 28 62 25 21 70 74 72  3e 2d 31 20 80 20 63 70  | (b%!ptr>-1 . cp|
000024c0  25 3c 3e 72 6d 61 66 6f  6e 74 61 72 65 61 29 0d  |%<>rmafontarea).|
000024d0  0b 68 24 20 63 70 25 3d  63 70 25 21 28 33 32 2b  |.h$ cp%=cp%!(32+|
000024e0  28 62 25 21 70 74 72 29  2a 32 34 29 3a 70 74 72  |(b%!ptr)*24):ptr|
000024f0  2b 3d 34 0d 0b 72 05 ce  0d 0b 7c 23 e7 20 63 70  |+=4..r....|#. cp|
00002500  25 3d 72 6d 61 66 6f 6e  74 61 72 65 61 20 80 20  |%=rmafontarea . |
00002510  62 25 21 70 74 72 3c 3e  30 20 8c 0d 0b 86 41 20  |b%!ptr<>0 ....A |
00002520  c8 99 20 22 46 6f 6e 74  5f 44 65 63 6f 64 65 4d  |.. "Font_DecodeM|
00002530  65 6e 75 22 2c 2c 72 6d  61 66 6f 6e 74 61 72 65  |enu",,rmafontare|
00002540  61 2c 62 25 2b 70 74 72  2c c4 32 35 35 2c bd 30  |a,b%+ptr,.255,.0|
00002550  29 2c 32 35 35 20 b8 2c  2c 2c 6d 24 0d 0b 90 05  |),255 .,,,m$....|
00002560  cc 0d 0b 9a 37 20 c8 99  20 22 57 69 6d 70 5f 44  |....7 .. "Wimp_D|
00002570  65 63 6f 64 65 4d 65 6e  75 22 2c 2c 6d 65 6e 75  |ecodeMenu",,menu|
00002580  25 2c 62 25 2c c4 32 35  35 2c bd 30 29 2c 32 35  |%,b%,.255,.0),25|
00002590  35 20 b8 2c 2c 2c 6d 24  0d 0b a4 0a 20 62 24 3d  |5 .,,,m$.... b$=|
000025a0  22 22 0d 0b ae 06 20 f5  0d 0b b8 2c 20 20 63 24  |"".... ....,  c$|
000025b0  3d c0 6d 24 2c a7 6d 24  2b 22 2e 22 2c 22 2e 22  |=.m$,.m$+".","."|
000025c0  29 2d 31 29 3a 6d 24 3d  c1 6d 24 2c a9 28 63 24  |)-1):m$=.m$,.(c$|
000025d0  29 2b 32 29 0d 0b c2 1e  20 20 63 24 3d c0 63 24  |)+2)....  c$=.c$|
000025e0  2c a7 63 24 2b 22 20 5e  22 2c 22 20 5e 22 29 2d  |,.c$+" ^"," ^")-|
000025f0  31 29 0d 0b cc 26 20 20  63 24 3d c0 63 24 2c a7  |1)...&  c$=.c$,.|
00002600  63 24 2b 22 20 22 2b bd  31 33 39 2c 22 20 22 2b  |c$+" "+.139," "+|
00002610  bd 31 33 39 29 2d 31 29  0d 0b d6 11 20 20 c8 8e  |.139)-1)....  ..|
00002620  20 c2 63 24 2c 33 29 20  ca 0d 0b e0 66 20 20 20  | .c$,3) ....f   |
00002630  c9 20 22 45 73 63 22 2c  22 44 65 6c 22 2c 22 49  |. "Esc","Del","I|
00002640  6e 73 22 2c 22 45 6e 64  22 2c 22 48 6f 6d 22 2c  |ns","End","Hom",|
00002650  22 43 70 79 22 2c 22 46  31 30 22 2c 22 46 31 31  |"Cpy","F10","F11|
00002660  22 2c 22 46 31 32 22 2c  22 46 31 33 22 2c 22 50  |","F12","F13","P|
00002670  72 74 22 2c 22 54 61 62  22 2c 22 52 65 74 22 3a  |rt","Tab","Ret":|
00002680  63 24 3d c0 63 24 2c a9  28 63 24 29 2d 34 29 0d  |c$=.c$,.(c$)-4).|
00002690  0b ea 07 20 20 cb 0d 0b  f4 44 20 20 e7 20 c1 63  |...  ....D  . .c|
000026a0  24 2c a9 28 63 24 29 2d  32 2c 32 29 3d 22 20 46  |$,.(c$)-2,2)=" F|
000026b0  22 20 8c e7 c2 63 24 29  3d 22 30 22 20 84 20 bb  |" ...c$)="0" . .|
000026c0  28 c2 63 24 29 29 3c 3e  30 20 8c 63 24 3d c0 63  |(.c$))<>0 .c$=.c|
000026d0  24 2c a9 28 63 24 29 2d  33 29 0d 0b fe 1b 20 20  |$,.(c$)-3)....  |
000026e0  c8 95 20 c2 63 24 29 3d  22 20 22 3a 63 24 3d c0  |.. .c$)=" ":c$=.|
000026f0  63 24 29 3a ce 0d 0c 08  10 20 20 62 24 2b 3d 63  |c$):.....  b$+=c|
00002700  24 2b 22 2e 22 0d 0c 12  14 20 fd 6d 24 3d 22 22  |$+".".... .m$=""|
00002710  20 84 20 6d 24 3d 22 2e  22 0d 0c 1c 17 20 e7 20  | . m$=".".... . |
00002720  6d 24 3d 22 2e 22 20 8c  62 24 2b 3d 22 2e 2e 22  |m$="." .b$+=".."|
00002730  0d 0c 26 0c 20 6d 24 3d  c0 62 24 29 0d 0c 30 05  |..&. m$=.b$)..0.|
00002740  cd 0d 0c 3a 07 3d 6d 24  0d 0c 44 05 3a 0d 0c 4e  |...:.=m$..D.:..N|
00002750  3f f4 20 46 4e 67 65 74  66 6f 6e 74 6d 65 6e 75  |?. FNgetfontmenu|
00002760  20 20 20 20 20 20 20 3a  20 52 65 74 75 72 6e 20  |       : Return |
00002770  6d 65 6d 6f 72 79 20 6c  6f 63 61 74 69 6f 6e 20  |memory location |
00002780  6f 66 20 66 6f 6e 74 20  6d 65 6e 75 0d 0c 58 3b  |of font menu..X;|
00002790  f4 20 50 52 4f 43 72 65  6c 65 61 73 65 66 6f 6e  |. PROCreleasefon|
000027a0  74 6d 65 6e 75 20 3a 20  52 65 6c 65 61 73 65 20  |tmenu : Release |
000027b0  6d 65 6d 6f 72 79 20 75  73 65 64 20 62 79 20 66  |memory used by f|
000027c0  6f 6e 74 6d 65 6e 75 0d  0c 62 24 dd a4 67 65 74  |ontmenu..b$..get|
000027d0  66 6f 6e 74 6d 65 6e 75  28 66 6f 6e 74 24 29 3a  |fontmenu(font$):|
000027e0  ea 20 73 70 61 63 65 2c  69 6e 64 0d 0c 6c 15 c8  |. space,ind..l..|
000027f0  99 20 22 48 6f 75 72 67  6c 61 73 73 5f 4f 6e 22  |. "Hourglass_On"|
00002800  0d 0c 76 34 c8 99 20 22  46 6f 6e 74 5f 4c 69 73  |..v4.. "Font_Lis|
00002810  74 46 6f 6e 74 73 22 2c  2c 2c 37 3c 3c 31 39 2c  |tFonts",,,7<<19,|
00002820  2c 2c 2c 31 20 b8 20 2c  2c 2c 73 70 61 63 65 2c  |,,,1 . ,,,space,|
00002830  2c 69 6e 64 0d 0c 80 37  f2 72 65 6c 65 61 73 65  |,ind...7.release|
00002840  28 72 6d 61 66 6f 6e 74  61 72 65 61 29 3a 72 6d  |(rmafontarea):rm|
00002850  61 66 6f 6e 74 61 72 65  61 3d a4 63 6c 61 69 6d  |afontarea=.claim|
00002860  28 73 70 61 63 65 2b 69  6e 64 29 0d 0c 8a 2b e7  |(space+ind)...+.|
00002870  20 72 6d 61 66 6f 6e 74  61 72 65 61 3c 30 20 8c  | rmafontarea<0 .|
00002880  c8 99 20 22 48 6f 75 72  67 6c 61 73 73 5f 4f 66  |.. "Hourglass_Of|
00002890  66 22 3a 3d 2d 31 0d 0c  94 28 e7 20 66 6f 6e 74  |f":=-1...(. font|
000028a0  24 3c 3e 22 22 20 80 20  66 6f 6e 74 24 3c 3e 22  |$<>"" . font$<>"|
000028b0  53 79 73 74 65 6d 20 66  6f 6e 74 22 20 8c 0d 0c  |System font" ...|
000028c0  9e 4d 20 c8 99 20 22 46  6f 6e 74 5f 4c 69 73 74  |.M .. "Font_List|
000028d0  46 6f 6e 74 73 22 2c 2c  72 6d 61 66 6f 6e 74 61  |Fonts",,rmafonta|
000028e0  72 65 61 2c 37 3c 3c 31  39 2c 73 70 61 63 65 2c  |rea,7<<19,space,|
000028f0  72 6d 61 66 6f 6e 74 61  72 65 61 2b 73 70 61 63  |rmafontarea+spac|
00002900  65 2c 69 6e 64 2c 66 6f  6e 74 24 0d 0c a8 05 cc  |e,ind,font$.....|
00002910  0d 0c b2 5e 20 c8 99 20  22 46 6f 6e 74 5f 4c 69  |...^ .. "Font_Li|
00002920  73 74 46 6f 6e 74 73 22  2c 2c 72 6d 61 66 6f 6e  |stFonts",,rmafon|
00002930  74 61 72 65 61 2c 37 3c  3c 31 39 2c 73 70 61 63  |tarea,7<<19,spac|
00002940  65 2c 72 6d 61 66 6f 6e  74 61 72 65 61 2b 73 70  |e,rmafontarea+sp|
00002950  61 63 65 2c 69 6e 64 2c  2d 28 66 6f 6e 74 24 3d  |ace,ind,-(font$=|
00002960  22 53 79 73 74 65 6d 20  66 6f 6e 74 22 29 0d 0c  |"System font")..|
00002970  bc 05 cd 0d 0c c6 16 c8  99 20 22 48 6f 75 72 67  |......... "Hourg|
00002980  6c 61 73 73 5f 4f 66 66  22 0d 0c d0 10 3d 72 6d  |lass_Off"....=rm|
00002990  61 66 6f 6e 74 61 72 65  61 0d 0c da 2d dd f2 72  |afontarea...-..r|
000029a0  65 6c 65 61 73 65 66 6f  6e 74 6d 65 6e 75 3a f2  |eleasefontmenu:.|
000029b0  72 65 6c 65 61 73 65 28  72 6d 61 66 6f 6e 74 61  |release(rmafonta|
000029c0  72 65 61 29 3a e1 0d 0c  e4 05 3a 0d 0c ee 30 f4  |rea):.....:...0.|
000029d0  20 46 4e 63 72 65 61 74  65 66 74 6d 65 6e 75 20  | FNcreateftmenu |
000029e0  20 20 20 3a 20 43 72 65  61 74 65 20 61 20 66 69  |   : Create a fi|
000029f0  6c 65 74 79 70 65 20 6d  65 6e 75 0d 0c f8 37 f4  |letype menu...7.|
00002a00  20 50 52 4f 43 72 65 6c  65 61 73 65 66 74 6d 65  | PROCreleaseftme|
00002a10  6e 75 20 3a 20 52 65 6c  65 61 73 65 20 73 70 61  |nu : Release spa|
00002a20  63 65 20 75 73 65 64 20  62 79 20 46 54 20 6d 65  |ce used by FT me|
00002a30  6e 75 0d 0d 02 12 dd a4  63 72 65 61 74 65 66 74  |nu......createft|
00002a40  6d 65 6e 75 0d 0d 0c 2d  ea 20 6c 65 6e 2c 6e 61  |menu...-. len,na|
00002a50  6d 65 2c 74 79 70 65 2c  66 6c 61 67 73 2c 6d 6c  |me,type,flags,ml|
00002a60  65 6e 2c 69 6c 65 6e 2c  6e 24 2c 76 24 2c 6d 73  |en,ilen,n$,v$,ms|
00002a70  74 0d 0d 16 51 c8 99 20  22 58 4f 53 5f 52 65 61  |t...Q.. "XOS_Rea|
00002a80  64 56 61 72 56 61 6c 22  2c 22 46 69 6c 65 24 54  |dVarVal","File$T|
00002a90  79 70 65 5f 2a 22 2c 6d  65 73 73 61 67 65 5f 62  |ype_*",message_b|
00002aa0  75 66 66 65 72 25 2c 32  35 36 20 b8 20 2c 2c 6c  |uffer%,256 . ,,l|
00002ab0  65 6e 2c 6e 61 6d 65 2c  74 79 70 65 3b 66 6c 61  |en,name,type;fla|
00002ac0  67 73 0d 0d 20 15 6d 6c  65 6e 3d 32 38 2b 32 34  |gs.. .mlen=28+24|
00002ad0  3a 69 6c 65 6e 3d 39 0d  0d 2a 14 c8 95 20 28 66  |:ilen=9..*... (f|
00002ae0  6c 61 67 73 20 80 31 29  3c 3e 31 0d 0d 34 0f 20  |lags .1)<>1..4. |
00002af0  e7 20 74 79 70 65 3d 30  20 8c 0d 0d 3e 24 20 20  |. type=0 ...>$  |
00002b00  6d 6c 65 6e 2b 3d 32 34  3a 6e 24 3d c2 a4 73 74  |mlen+=24:n$=..st|
00002b10  72 69 6e 67 30 28 6e 61  6d 65 29 2c 33 29 0d 0d  |ring0(name),3)..|
00002b20  48 2d 20 20 c8 99 20 22  58 57 69 6d 70 5f 53 70  |H-  .. "XWimp_Sp|
00002b30  72 69 74 65 4f 70 22 2c  32 34 2c 2c 22 53 6d 61  |riteOp",24,,"Sma|
00002b40  6c 6c 5f 22 2b 6e 24 20  b8 3b 66 0d 0d 52 11 20  |ll_"+n$ .;f..R. |
00002b50  20 e7 20 28 66 20 80 31  29 3d 31 8c 0d 0d 5c 2d  | . (f .1)=1...\-|
00002b60  20 20 20 c8 99 20 22 58  57 69 6d 70 5f 53 70 72  |   .. "XWimp_Spr|
00002b70  69 74 65 4f 70 22 2c 32  34 2c 2c 22 46 69 6c 65  |iteOp",24,,"File|
00002b80  5f 22 2b 6e 24 20 b8 3b  66 0d 0d 66 2c 20 20 20  |_"+n$ .;f..f,   |
00002b90  e7 20 28 66 20 80 31 29  3d 30 8c 69 6c 65 6e 2b  |. (f .1)=0.ilen+|
00002ba0  3d 31 31 2b 6c 65 6e 20  8b 69 6c 65 6e 2b 3d 6c  |=11+len .ilen+=l|
00002bb0  65 6e 2b 31 31 0d 0d 70  07 20 20 cc 0d 0d 7a 13  |en+11..p.  ...z.|
00002bc0  20 20 20 69 6c 65 6e 2b  3d 31 32 2b 6c 65 6e 0d  |   ilen+=12+len.|
00002bd0  0d 84 07 20 20 cd 0d 0d  8e 06 20 cd 0d 0d 98 57  |...  ..... ....W|
00002be0  20 c8 99 20 22 58 4f 53  5f 52 65 61 64 56 61 72  | .. "XOS_ReadVar|
00002bf0  56 61 6c 22 2c 22 46 69  6c 65 24 54 79 70 65 5f  |Val","File$Type_|
00002c00  2a 22 2c 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |*",message_buffe|
00002c10  72 25 2c 32 35 36 2c 6e  61 6d 65 20 b8 20 2c 2c  |r%,256,name . ,,|
00002c20  6c 65 6e 2c 6e 61 6d 65  2c 74 79 70 65 3b 66 6c  |len,name,type;fl|
00002c30  61 67 73 0d 0d a2 05 ce  0d 0d ac 1b 66 74 62 6c  |ags.........ftbl|
00002c40  6b 3d a4 63 6c 61 69 6d  28 6d 6c 65 6e 2b 69 6c  |k=.claim(mlen+il|
00002c50  65 6e 29 0d 0d b6 10 e7  20 66 74 62 6c 6b 3d 2d  |en)..... ftblk=-|
00002c60  31 20 8c 0d 0d c0 1a 20  66 74 62 6c 6b 3d a4 63  |1 ..... ftblk=.c|
00002c70  6c 61 69 6d 28 32 38 2b  32 34 2b 39 29 0d 0d ca  |laim(28+24+9)...|
00002c80  28 20 24 66 74 62 6c 6b  3d 22 46 69 6c 65 20 74  |( $ftblk="File t|
00002c90  79 70 65 73 22 3a 66 74  62 6c 6b 21 31 32 3d 26  |ypes":ftblk!12=&|
00002ca0  37 30 32 30 37 0d 0d d4  2b 20 66 74 62 6c 6b 21  |70207...+ ftblk!|
00002cb0  31 36 3d 31 36 2a 31 32  3a 66 74 62 6c 6b 21 32  |16=16*12:ftblk!2|
00002cc0  30 3d 26 32 38 3a 66 74  62 6c 6b 21 32 34 3d 30  |0=&28:ftblk!24=0|
00002cd0  0d 0d de 2f 20 66 74 62  6c 6b 21 32 38 3d 26 38  |.../ ftblk!28=&8|
00002ce0  30 3a 66 74 62 6c 6b 21  33 32 3d 2d 31 3a 66 74  |0:ftblk!32=-1:ft|
00002cf0  62 6c 6b 21 33 36 3d 26  37 30 30 30 31 32 31 0d  |blk!36=&7000121.|
00002d00  0d e8 2f 20 66 74 62 6c  6b 21 34 30 3d 66 74 62  |../ ftblk!40=ftb|
00002d10  6c 6b 2b 32 38 2b 32 34  3a 66 74 62 6c 6b 21 34  |lk+28+24:ftblk!4|
00002d20  34 3d 30 3a 66 74 62 6c  6b 21 34 38 3d 39 0d 0d  |4=0:ftblk!48=9..|
00002d30  f2 16 20 24 28 66 74 62  6c 6b 2b 32 38 2b 32 34  |.. $(ftblk+28+24|
00002d40  29 3d 22 22 0d 0d fc 05  cc 0d 0e 06 28 20 24 66  |)=""........( $f|
00002d50  74 62 6c 6b 3d 22 46 69  6c 65 20 74 79 70 65 73  |tblk="File types|
00002d60  22 3a 66 74 62 6c 6b 21  31 32 3d 26 37 30 32 30  |":ftblk!12=&7020|
00002d70  37 0d 0e 10 2b 20 66 74  62 6c 6b 21 31 36 3d 31  |7...+ ftblk!16=1|
00002d80  36 2a 31 32 3a 66 74 62  6c 6b 21 32 30 3d 26 32  |6*12:ftblk!20=&2|
00002d90  38 3a 66 74 62 6c 6b 21  32 34 3d 30 0d 0e 1a 2a  |8:ftblk!24=0...*|
00002da0  20 69 6c 65 6e 3d 6d 6c  65 6e 2b 66 74 62 6c 6b  | ilen=mlen+ftblk|
00002db0  3a 6d 6c 65 6e 3d 69 6c  65 6e 2d 32 34 3a 6d 73  |:mlen=ilen-24:ms|
00002dc0  74 3d 6d 6c 65 6e 0d 0e  24 54 20 c8 99 20 22 58  |t=mlen..$T .. "X|
00002dd0  4f 53 5f 52 65 61 64 56  61 72 56 61 6c 22 2c 22  |OS_ReadVarVal","|
00002de0  46 69 6c 65 24 54 79 70  65 5f 2a 22 2c 6d 65 73  |File$Type_*",mes|
00002df0  73 61 67 65 5f 62 75 66  66 65 72 25 2c 32 35 36  |sage_buffer%,256|
00002e00  2c 30 20 b8 20 2c 2c 6c  65 6e 2c 6e 61 6d 65 2c  |,0 . ,,len,name,|
00002e10  74 79 70 65 3b 66 6c 61  67 73 0d 0e 2e 15 20 c8  |type;flags.... .|
00002e20  95 20 28 66 6c 61 67 73  20 80 31 29 3c 3e 31 0d  |. (flags .1)<>1.|
00002e30  0e 38 10 20 20 e7 20 74  79 70 65 3d 30 20 8c 0d  |.8.  . type=0 ..|
00002e40  0e 42 4f 20 20 20 6d 65  73 73 61 67 65 5f 62 75  |.BO   message_bu|
00002e50  66 66 65 72 25 21 6c 65  6e 3d 30 3a 6e 24 3d c2  |ffer%!len=0:n$=.|
00002e60  a4 73 74 72 69 6e 67 30  28 6e 61 6d 65 29 2c 33  |.string0(name),3|
00002e70  29 3a 76 24 3d a4 73 74  72 69 6e 67 30 28 6d 65  |):v$=.string0(me|
00002e80  73 73 61 67 65 5f 62 75  66 66 65 72 25 29 0d 0e  |ssage_buffer%)..|
00002e90  4c 19 20 20 20 6d 6c 65  6e 21 30 3d 30 3a 6d 6c  |L.   mlen!0=0:ml|
00002ea0  65 6e 21 34 3d 2d 31 0d  0e 56 2e 20 20 20 c8 99  |en!4=-1..V.   ..|
00002eb0  20 22 58 57 69 6d 70 5f  53 70 72 69 74 65 4f 70  | "XWimp_SpriteOp|
00002ec0  22 2c 32 34 2c 2c 22 53  6d 61 6c 6c 5f 22 2b 6e  |",24,,"Small_"+n|
00002ed0  24 20 b8 3b 66 0d 0e 60  12 20 20 20 e7 20 28 66  |$ .;f..`.   . (f|
00002ee0  20 80 31 29 3d 31 8c 0d  0e 6a 2e 20 20 20 20 c8  | .1)=1...j.    .|
00002ef0  99 20 22 58 57 69 6d 70  5f 53 70 72 69 74 65 4f  |. "XWimp_SpriteO|
00002f00  70 22 2c 32 34 2c 2c 22  46 69 6c 65 5f 22 2b 6e  |p",24,,"File_"+n|
00002f10  24 20 b8 3b 66 0d 0e 74  2f 20 20 20 20 e7 20 28  |$ .;f..t/    . (|
00002f20  66 20 80 31 29 3d 30 8c  6e 24 3d 22 46 69 6c 65  |f .1)=0.n$="File|
00002f30  5f 22 2b 6e 24 20 8b 6e  24 3d 22 46 69 6c 65 5f  |_"+n$ .n$="File_|
00002f40  78 78 78 22 0d 0e 7e 17  20 20 20 20 6d 6c 65 6e  |xxx"..~.    mlen|
00002f50  21 38 3d 26 37 30 30 30  39 33 33 0d 0e 88 08 20  |!8=&7000933.... |
00002f60  20 20 cc 0d 0e 92 26 20  20 20 20 6e 24 3d 22 53  |  ....&    n$="S|
00002f70  6d 61 6c 6c 5f 22 2b 6e  24 3a 6d 6c 65 6e 21 38  |mall_"+n$:mlen!8|
00002f80  3d 26 37 30 30 30 31 33  33 0d 0e 9c 08 20 20 20  |=&7000133....   |
00002f90  cd 0d 0e a6 2a 20 20 20  6d 6c 65 6e 21 31 32 3d  |....*   mlen!12=|
00002fa0  69 6c 65 6e 3a 24 69 6c  65 6e 3d 76 24 3a 69 6c  |ilen:$ilen=v$:il|
00002fb0  65 6e 2b 3d a9 28 76 24  29 2b 31 0d 0e b0 2e 20  |en+=.(v$)+1.... |
00002fc0  20 20 6d 6c 65 6e 21 31  36 3d 69 6c 65 6e 3a 24  |  mlen!16=ilen:$|
00002fd0  69 6c 65 6e 3d 22 73 22  2b 6e 24 3a 69 6c 65 6e  |ilen="s"+n$:ilen|
00002fe0  2b 3d a9 28 6e 24 29 2b  32 0d 0e ba 1f 20 20 20  |+=.(n$)+2....   |
00002ff0  6d 6c 65 6e 21 32 30 3d  a9 28 76 24 29 2b 31 3a  |mlen!20=.(v$)+1:|
00003000  6d 6c 65 6e 2d 3d 32 34  0d 0e c4 07 20 20 cd 0d  |mlen-=24....  ..|
00003010  0e ce 58 20 20 c8 99 20  22 58 4f 53 5f 52 65 61  |..X  .. "XOS_Rea|
00003020  64 56 61 72 56 61 6c 22  2c 22 46 69 6c 65 24 54  |dVarVal","File$T|
00003030  79 70 65 5f 2a 22 2c 6d  65 73 73 61 67 65 5f 62  |ype_*",message_b|
00003040  75 66 66 65 72 25 2c 32  35 36 2c 6e 61 6d 65 20  |uffer%,256,name |
00003050  b8 20 2c 2c 6c 65 6e 2c  6e 61 6d 65 2c 74 79 70  |. ,,len,name,typ|
00003060  65 3b 66 6c 61 67 73 0d  0e d8 06 20 ce 0d 0e e2  |e;flags.... ....|
00003070  34 20 6d 6c 65 6e 21 30  3d 34 3a 6d 6c 65 6e 21  |4 mlen!0=4:mlen!|
00003080  34 3d 2d 31 3a 6d 6c 65  6e 21 38 3d 26 37 30 30  |4=-1:mlen!8=&700|
00003090  30 31 32 31 3a 6d 6c 65  6e 21 31 32 3d 69 6c 65  |0121:mlen!12=ile|
000030a0  6e 0d 0e ec 3c 20 24 69  6c 65 6e 3d 22 22 3a 69  |n...< $ilen="":i|
000030b0  6c 65 6e 2b 3d 39 3a 6d  6c 65 6e 21 31 36 3d 2d  |len+=9:mlen!16=-|
000030c0  31 3a 6d 6c 65 6e 21 32  30 3d 39 3a 6d 6c 65 6e  |1:mlen!20=9:mlen|
000030d0  2d 3d 32 34 3a 21 6d 73  74 3d 26 38 30 0d 0e f6  |-=24:!mst=&80...|
000030e0  05 cd 0d 0f 00 0a 3d 66  74 62 6c 6b 0d 0f 0a 25  |......=ftblk...%|
000030f0  dd f2 72 65 6c 65 61 73  65 66 74 6d 65 6e 75 3a  |..releaseftmenu:|
00003100  f2 72 65 6c 65 61 73 65  28 66 74 62 6c 6b 29 3a  |.release(ftblk):|
00003110  e1 0d 0f 14 05 3a 0d 0f  1e 37 f4 20 2a 2a 2a 2a  |.....:...7. ****|
00003120  2a 2a 2a 2a 20 57 69 6e  64 6f 77 20 6d 61 6e 69  |**** Window mani|
00003130  70 75 6c 61 74 69 6f 6e  20 72 6f 75 74 69 6e 65  |pulation routine|
00003140  73 20 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 0d 0f 28  |s ***********..(|
00003150  05 3a 0d 0f 32 28 f4 20  50 52 4f 43 63 6c 6f 73  |.:..2(. PROCclos|
00003160  65 77 69 6e 20 20 20 20  20 20 3a 20 43 6c 6f 73  |ewin      : Clos|
00003170  65 20 61 20 77 69 6e 64  6f 77 0d 0f 3c 37 f4 20  |e a window..<7. |
00003180  50 52 4f 43 6f 70 65 6e  77 69 6e 20 20 20 20 20  |PROCopenwin     |
00003190  20 20 3a 20 4f 70 65 6e  20 61 20 77 69 6e 64 6f  |  : Open a windo|
000031a0  77 20 61 74 20 74 6f 70  20 6f 66 20 73 74 61 63  |w at top of stac|
000031b0  6b 0d 0f 46 3e f4 20 50  52 4f 43 6f 70 65 6e 77  |k..F>. PROCopenw|
000031c0  69 6e 61 74 20 20 20 20  20 3a 20 4f 70 65 6e 20  |inat     : Open |
000031d0  61 20 77 69 6e 64 6f 77  20 61 74 20 74 6f 70 2d  |a window at top-|
000031e0  6c 65 66 74 20 63 6f 72  6e 65 72 20 78 2c 79 0d  |left corner x,y.|
000031f0  0f 50 39 f4 20 50 52 4f  43 6f 70 65 6e 77 69 6e  |.P9. PROCopenwin|
00003200  63 65 6e 74 72 65 20 3a  20 4f 70 65 6e 20 77 69  |centre : Open wi|
00003210  6e 64 6f 77 20 69 6e 20  63 65 6e 74 72 65 20 6f  |ndow in centre o|
00003220  66 20 73 63 72 65 65 6e  0d 0f 5a 3c f4 20 50 52  |f screen..Z<. PR|
00003230  4f 43 6f 70 65 6e 77 69  6e 74 6f 20 20 20 20 20  |OCopenwinto     |
00003240  3a 20 4f 70 65 6e 20 77  69 6e 64 6f 77 20 61 74  |: Open window at|
00003250  20 70 6f 73 69 74 69 6f  6e 20 77 69 74 68 69 6e  | position within|
00003260  20 54 57 41 0d 0f 64 14  dd f2 63 6c 6f 73 65 77  | TWA..d...closew|
00003270  69 6e 28 77 69 6e 25 29  0d 0f 6e 26 21 62 25 3d  |in(win%)..n&!b%=|
00003280  77 69 6e 25 3a c8 99 20  22 57 69 6d 70 5f 43 6c  |win%:.. "Wimp_Cl|
00003290  6f 73 65 57 69 6e 64 6f  77 22 2c 2c 62 25 0d 0f  |oseWindow",,b%..|
000032a0  78 05 e1 0d 0f 82 13 dd  f2 6f 70 65 6e 77 69 6e  |x........openwin|
000032b0  28 77 69 6e 25 29 0d 0f  8c 29 21 62 25 3d 77 69  |(win%)...)!b%=wi|
000032c0  6e 25 3a c8 99 20 22 57  69 6d 70 5f 47 65 74 57  |n%:.. "Wimp_GetW|
000032d0  69 6e 64 6f 77 53 74 61  74 65 22 2c 2c 62 25 0d  |indowState",,b%.|
000032e0  0f 96 25 62 25 21 32 38  3d 2d 31 3a c8 99 20 22  |..%b%!28=-1:.. "|
000032f0  57 69 6d 70 5f 4f 70 65  6e 57 69 6e 64 6f 77 22  |Wimp_OpenWindow"|
00003300  2c 2c 62 25 0d 0f a0 05  e1 0d 0f aa 28 dd f2 6f  |,,b%........(..o|
00003310  70 65 6e 77 69 6e 61 74  28 77 69 6e 25 2c 78 2c  |penwinat(win%,x,|
00003320  79 29 3a ea 20 77 69 64  74 68 2c 68 65 69 67 68  |y):. width,heigh|
00003330  74 0d 0f b4 29 21 62 25  3d 77 69 6e 25 3a c8 99  |t...)!b%=win%:..|
00003340  20 22 57 69 6d 70 5f 47  65 74 57 69 6e 64 6f 77  | "Wimp_GetWindow|
00003350  53 74 61 74 65 22 2c 2c  62 25 0d 0f be 26 77 69  |State",,b%...&wi|
00003360  64 74 68 3d 62 25 21 34  2d 62 25 21 31 32 3a 68  |dth=b%!4-b%!12:h|
00003370  65 69 67 68 74 3d 62 25  21 31 36 2d 62 25 21 38  |eight=b%!16-b%!8|
00003380  0d 0f c8 2e 62 25 21 34  3d 78 3a 62 25 21 38 3d  |....b%!4=x:b%!8=|
00003390  79 2d 68 65 69 67 68 74  3a 62 25 21 31 32 3d 78  |y-height:b%!12=x|
000033a0  2d 77 69 64 74 68 3a 62  25 21 31 36 3d 79 0d 0f  |-width:b%!16=y..|
000033b0  d2 25 62 25 21 32 38 3d  2d 31 3a c8 99 20 22 57  |.%b%!28=-1:.. "W|
000033c0  69 6d 70 5f 4f 70 65 6e  57 69 6e 64 6f 77 22 2c  |imp_OpenWindow",|
000033d0  2c 62 25 0d 0f dc 05 e1  0d 0f e6 36 dd f2 6f 70  |,b%........6..op|
000033e0  65 6e 77 69 6e 63 65 6e  74 72 65 28 77 69 6e 25  |enwincentre(win%|
000033f0  29 3a ea 20 77 69 64 74  68 2c 68 65 69 67 68 74  |):. width,height|
00003400  2c 74 6f 70 2c 72 69 67  68 74 2c 78 2c 79 0d 0f  |,top,right,x,y..|
00003410  f0 2a 21 62 25 3d 34 3a  62 25 21 34 3d 35 3a 62  |.*!b%=4:b%!4=5:b|
00003420  25 21 38 3d 31 31 3a 62  25 21 31 32 3d 31 32 3a  |%!8=11:b%!12=12:|
00003430  62 25 21 31 36 3d 2d 31  0d 0f fa 25 c8 99 20 22  |b%!16=-1...%.. "|
00003440  4f 53 5f 52 65 61 64 56  64 75 56 61 72 69 61 62  |OS_ReadVduVariab|
00003450  6c 65 73 22 2c 62 25 2c  62 25 2b 32 30 0d 10 04  |les",b%,b%+20...|
00003460  2b 72 69 67 68 74 3d 62  25 21 32 38 2b 31 3c 3c  |+right=b%!28+1<<|
00003470  62 25 21 32 30 3a 74 6f  70 3d 62 25 21 33 32 2b  |b%!20:top=b%!32+|
00003480  31 3c 3c 62 25 21 32 34  0d 10 0e 29 21 62 25 3d  |1<<b%!24...)!b%=|
00003490  77 69 6e 25 3a c8 99 20  22 57 69 6d 70 5f 47 65  |win%:.. "Wimp_Ge|
000034a0  74 57 69 6e 64 6f 77 53  74 61 74 65 22 2c 2c 62  |tWindowState",,b|
000034b0  25 0d 10 18 26 77 69 64  74 68 3d 62 25 21 34 2d  |%...&width=b%!4-|
000034c0  62 25 21 31 32 3a 68 65  69 67 68 74 3d 62 25 21  |b%!12:height=b%!|
000034d0  31 36 2d 62 25 21 38 0d  10 22 33 78 3d 28 72 69  |16-b%!8.."3x=(ri|
000034e0  67 68 74 2d 77 69 64 74  68 29 2f 32 2b 77 69 64  |ght-width)/2+wid|
000034f0  74 68 3a 79 3d 28 74 6f  70 2d 68 65 69 67 68 74  |th:y=(top-height|
00003500  29 2f 32 2b 68 65 69 67  68 74 0d 10 2c 2e 62 25  |)/2+height..,.b%|
00003510  21 34 3d 78 3a 62 25 21  38 3d 79 2d 68 65 69 67  |!4=x:b%!8=y-heig|
00003520  68 74 3a 62 25 21 31 32  3d 78 2d 77 69 64 74 68  |ht:b%!12=x-width|
00003530  3a 62 25 21 31 36 3d 79  0d 10 36 25 62 25 21 32  |:b%!16=y..6%b%!2|
00003540  38 3d 2d 31 3a c8 99 20  22 57 69 6d 70 5f 4f 70  |8=-1:.. "Wimp_Op|
00003550  65 6e 57 69 6e 64 6f 77  22 2c 2c 62 25 0d 10 40  |enWindow",,b%..@|
00003560  05 e1 0d 10 4a 2f f4 20  6c 3d 6c 65 66 74 20 6f  |....J/. l=left o|
00003570  66 20 56 57 41 20 69 6e  20 54 57 41 2c 20 74 3d  |f VWA in TWA, t=|
00003580  74 6f 70 20 6f 66 20 56  57 41 20 69 6e 20 54 57  |top of VWA in TW|
00003590  41 0d 10 54 33 f4 20 72  3d 72 69 67 68 74 20 6f  |A..T3. r=right o|
000035a0  66 20 56 57 41 20 69 6e  20 54 57 41 2c 20 62 3d  |f VWA in TWA, b=|
000035b0  62 6f 74 74 6f 6d 20 6f  66 20 56 57 41 20 69 6e  |bottom of VWA in|
000035c0  20 54 57 41 0d 10 5e 41  f4 20 57 69 6e 64 6f 77  | TWA..^A. Window|
000035d0  20 64 6f 65 73 20 6e 6f  74 20 6d 6f 76 65 2c 20  | does not move, |
000035e0  62 75 74 20 69 74 73 20  73 69 7a 65 20 69 73 20  |but its size is |
000035f0  61 6c 74 65 72 65 64 20  74 6f 20 64 69 66 66 65  |altered to diffe|
00003600  72 65 6e 63 65 0d 10 68  3f f4 20 62 65 74 77 65  |rence..h?. betwe|
00003610  65 6e 20 6c 26 77 20 61  6e 64 20 74 26 68 2e 20  |en l&w and t&h. |
00003620  54 6f 70 20 6c 65 66 74  20 6f 66 20 56 57 41 20  |Top left of VWA |
00003630  69 73 20 70 6f 73 69 74  69 6f 6e 65 64 20 74 6f  |is positioned to|
00003640  20 74 6c 2e 0d 10 72 3b  f4 20 49 66 20 72 62 20  | tl...r;. If rb |
00003650  3d 20 2d 31 20 74 68 65  6e 20 6e 6f 20 61 63 74  |= -1 then no act|
00003660  75 61 6c 20 73 69 7a 65  20 63 68 61 6e 67 65 2c  |ual size change,|
00003670  20 6a 75 73 74 20 70 6f  73 69 74 69 6f 6e 2e 0d  | just position..|
00003680  10 7c 1d dd f2 6f 70 65  6e 77 69 6e 74 6f 28 77  |.|...openwinto(w|
00003690  69 6e 25 2c 6c 2c 74 2c  72 2c 62 29 0d 10 86 29  |in%,l,t,r,b)...)|
000036a0  21 62 25 3d 77 69 6e 25  3a c8 99 20 22 57 69 6d  |!b%=win%:.. "Wim|
000036b0  70 5f 47 65 74 57 69 6e  64 6f 77 53 74 61 74 65  |p_GetWindowState|
000036c0  22 2c 2c 62 25 0d 10 90  13 e7 20 6c 3d 2d 31 20  |",,b%..... l=-1 |
000036d0  8c 6c 3d 62 25 21 32 30  0d 10 9a 13 e7 20 74 3d  |.l=b%!20..... t=|
000036e0  2d 31 20 8c 62 3d 62 25  21 32 34 0d 10 a4 18 e7  |-1 .b=b%!24.....|
000036f0  20 72 3d 2d 31 20 8c 72  3d 62 25 21 31 32 2d 62  | r=-1 .r=b%!12-b|
00003700  25 21 34 0d 10 ae 18 e7  20 62 3d 2d 31 20 8c 74  |%!4..... b=-1 .t|
00003710  3d 62 25 21 38 2d 62 25  21 31 36 0d 10 b8 31 62  |=b%!8-b%!16...1b|
00003720  25 21 31 32 3d 62 25 21  34 2b 72 2d 6c 3a 62 25  |%!12=b%!4+r-l:b%|
00003730  21 38 3d 62 25 21 31 36  2b 62 2d 74 3a 62 25 21  |!8=b%!16+b-t:b%!|
00003740  32 30 3d 6c 3a 62 25 21  32 34 3d 74 0d 10 c2 1b  |20=l:b%!24=t....|
00003750  c8 99 22 57 69 6d 70 5f  4f 70 65 6e 57 69 6e 64  |.."Wimp_OpenWind|
00003760  6f 77 22 2c 2c 62 25 0d  10 cc 05 e1 0d 10 d6 05  |ow",,b%.........|
00003770  3a 0d 10 e0 3d f4 20 50  52 4f 43 72 65 73 69 7a  |:...=. PROCresiz|
00003780  65 77 69 6e 74 6f 20 3a  20 52 65 73 69 7a 65 73  |ewinto : Resizes|
00003790  20 77 69 6e 64 6f 77 20  61 6e 64 20 72 65 2d 6f  | window and re-o|
000037a0  70 65 6e 73 20 69 66 20  6e 65 65 64 65 64 0d 10  |pens if needed..|
000037b0  ea 28 f4 20 57 69 6c 6c  20 6b 65 65 70 20 74 6f  |.(. Will keep to|
000037c0  20 66 75 6c 6c 20 73 69  7a 65 20 69 66 20 70 6f  | full size if po|
000037d0  73 73 69 62 6c 65 0d 10  f4 1f dd f2 72 65 73 69  |ssible......resi|
000037e0  7a 65 77 69 6e 74 6f 28  77 69 6e 25 2c 6c 2c 74  |zewinto(win%,l,t|
000037f0  2c 72 2c 62 29 0d 10 fe  11 ea 20 66 75 6c 6c 25  |,r,b)..... full%|
00003800  2c 6f 70 65 6e 25 0d 11  08 29 21 62 25 3d 77 69  |,open%...)!b%=wi|
00003810  6e 25 3a c8 99 20 22 57  69 6d 70 5f 47 65 74 57  |n%:.. "Wimp_GetW|
00003820  69 6e 64 6f 77 53 74 61  74 65 22 2c 2c 62 25 0d  |indowState",,b%.|
00003830  11 12 38 f4 20 49 66 20  66 75 6c 6c 20 73 69 7a  |..8. If full siz|
00003840  65 2c 20 6f 70 65 6e 20  66 75 6c 6c 20 73 69 7a  |e, open full siz|
00003850  65 2c 20 61 6e 64 20 69  66 20 6f 70 65 6e 2c 20  |e, and if open, |
00003860  72 65 2d 6f 70 65 6e 0d  11 1c 31 6f 70 65 6e 25  |re-open...1open%|
00003870  3d 28 62 25 21 33 32 20  80 20 28 31 3c 3c 31 36  |=(b%!32 . (1<<16|
00003880  29 29 3e 30 3a e7 20 ac  20 6f 70 65 6e 25 20 8c  |))>0:. . open% .|
00003890  62 25 21 32 38 3d 2d 33  0d 11 26 39 c8 99 20 22  |b%!28=-3..&9.. "|
000038a0  57 69 6d 70 5f 4f 70 65  6e 57 69 6e 64 6f 77 22  |Wimp_OpenWindow"|
000038b0  2c 2c 62 25 3a c8 99 20  22 57 69 6d 70 5f 47 65  |,,b%:.. "Wimp_Ge|
000038c0  74 57 69 6e 64 6f 77 53  74 61 74 65 22 2c 2c 62  |tWindowState",,b|
000038d0  25 0d 11 30 1d 66 75 6c  6c 25 3d 28 62 25 21 33  |%..0.full%=(b%!3|
000038e0  32 20 80 20 28 31 3c 3c  31 38 29 29 3e 30 0d 11  |2 . (1<<18))>0..|
000038f0  3a 23 62 25 21 36 38 3d  6c 3a 62 25 21 37 32 3d  |:#b%!68=l:b%!72=|
00003900  62 3a 62 25 21 37 36 3d  72 3a 62 25 21 38 30 3d  |b:b%!76=r:b%!80=|
00003910  74 0d 11 44 22 c8 99 20  22 57 69 6d 70 5f 53 65  |t..D".. "Wimp_Se|
00003920  74 45 78 74 65 6e 74 22  2c 77 69 6e 25 2c 62 25  |tExtent",win%,b%|
00003930  2b 36 38 0d 11 4e 2a e7  20 66 75 6c 6c 25 20 8c  |+68..N*. full% .|
00003940  62 25 21 38 3d 62 25 21  31 36 2b 62 2d 74 3a 62  |b%!8=b%!16+b-t:b|
00003950  25 21 31 32 3d 62 25 21  34 2b 72 2d 6c 0d 11 58  |%!12=b%!4+r-l..X|
00003960  1c c8 99 20 22 57 69 6d  70 5f 4f 70 65 6e 57 69  |... "Wimp_OpenWi|
00003970  6e 64 6f 77 22 2c 2c 62  25 0d 11 62 4a e7 20 6f  |ndow",,b%..bJ. o|
00003980  70 65 6e 25 20 8c c8 99  20 22 57 69 6d 70 5f 46  |pen% ... "Wimp_F|
00003990  6f 72 63 65 52 65 64 72  61 77 22 2c 77 69 6e 25  |orceRedraw",win%|
000039a0  2c 6c 2c 62 2c 72 2c 74  20 8b c8 99 20 22 57 69  |,l,b,r,t ... "Wi|
000039b0  6d 70 5f 43 6c 6f 73 65  57 69 6e 64 6f 77 22 2c  |mp_CloseWindow",|
000039c0  2c 62 25 0d 11 6c 05 e1  0d 11 76 44 f4 66 75 6c  |,b%..l....vD.ful|
000039d0  6c 25 3d 28 20 28 28 28  62 25 21 31 32 29 2d 28  |l%=( (((b%!12)-(|
000039e0  62 25 21 34 29 29 3d 62  25 21 35 32 29 20 41 4e  |b%!4))=b%!52) AN|
000039f0  44 20 28 28 28 62 25 21  31 36 29 2d 28 62 25 21  |D (((b%!16)-(b%!|
00003a00  38 29 29 3d 62 25 21 35  36 29 20 29 0d 11 80 05  |8))=b%!56) )....|
00003a10  3a 0d 11 8a 3f f4 20 50  52 4f 43 77 69 6e 73 65  |:...?. PROCwinse|
00003a20  74 65 78 74 65 6e 74 20  3a 20 53 65 74 20 74 68  |textent : Set th|
00003a30  65 20 6d 61 78 69 6d 75  6d 20 65 78 74 65 6e 74  |e maximum extent|
00003a40  20 6f 66 20 77 69 6e 64  6f 77 20 28 54 57 41 29  | of window (TWA)|
00003a50  0d 11 94 20 dd f2 77 69  6e 73 65 74 65 78 74 65  |... ..winsetexte|
00003a60  6e 74 28 77 69 6e 25 2c  6c 2c 74 2c 72 2c 62 29  |nt(win%,l,t,r,b)|
00003a70  0d 11 9e 2a 21 62 25 3d  77 69 6e 25 3a c8 99 20  |...*!b%=win%:.. |
00003a80  22 57 69 6d 70 5f 47 65  74 57 69 6e 64 6f 77 49  |"Wimp_GetWindowI|
00003a90  6e 66 6f 22 2c 2c 62 25  2b 31 0d 11 a8 13 e7 20  |nfo",,b%+1..... |
00003aa0  6c 3d 2d 31 20 8c 6c 3d  62 25 21 34 34 0d 11 b2  |l=-1 .l=b%!44...|
00003ab0  13 e7 20 62 3d 2d 31 20  8c 62 3d 62 25 21 34 38  |.. b=-1 .b=b%!48|
00003ac0  0d 11 bc 13 e7 20 72 3d  2d 31 20 8c 72 3d 62 25  |..... r=-1 .r=b%|
00003ad0  21 35 32 0d 11 c6 13 e7  20 74 3d 2d 31 20 8c 74  |!52..... t=-1 .t|
00003ae0  3d 62 25 21 35 36 0d 11  d0 23 62 25 21 34 34 3d  |=b%!56...#b%!44=|
00003af0  6c 3a 62 25 21 34 38 3d  62 3a 62 25 21 35 32 3d  |l:b%!48=b:b%!52=|
00003b00  72 3a 62 25 21 35 36 3d  74 0d 11 da 22 c8 99 22  |r:b%!56=t...".."|
00003b10  58 57 69 6d 70 5f 53 65  74 45 78 74 65 6e 74 22  |XWimp_SetExtent"|
00003b20  2c 77 69 6e 25 2c 62 25  2b 34 34 0d 11 e4 05 e1  |,win%,b%+44.....|
00003b30  0d 11 ee 05 3a 0d 11 f8  3f f4 20 50 52 4f 43 66  |....:...?. PROCf|
00003b40  6f 72 63 65 72 65 64 72  61 77 20 3a 20 52 65 64  |orceredraw : Red|
00003b50  72 61 77 20 74 68 65 20  73 70 65 63 69 66 69 65  |raw the specifie|
00003b60  64 20 70 61 72 74 20 6f  66 20 74 68 65 20 77 69  |d part of the wi|
00003b70  6e 64 6f 77 0d 12 02 1f  dd f2 66 6f 72 63 65 72  |ndow......forcer|
00003b80  65 64 72 61 77 28 77 69  6e 25 2c 6c 2c 74 2c 72  |edraw(win%,l,t,r|
00003b90  2c 62 29 0d 12 0c 26 c8  99 20 22 57 69 6d 70 5f  |,b)...&.. "Wimp_|
00003ba0  46 6f 72 63 65 52 65 64  72 61 77 22 2c 77 69 6e  |ForceRedraw",win|
00003bb0  25 2c 6c 2c 62 2c 72 2c  74 0d 12 16 05 e1 0d 12  |%,l,b,r,t.......|
00003bc0  20 05 3a 0d 12 2a 3d f4  20 50 52 4f 43 77 69 6e  | .:..*=. PROCwin|
00003bd0  64 6f 77 74 69 74 6c 65  20 3a 20 53 65 74 20 77  |dowtitle : Set w|
00003be0  69 6e 64 6f 77 20 74 69  74 6c 65 20 28 6f 6e 6c  |indow title (onl|
00003bf0  79 20 69 66 20 69 6e 64  69 72 65 63 74 65 64 29  |y if indirected)|
00003c00  0d 12 34 1f dd 20 f2 77  69 6e 64 6f 77 74 69 74  |..4.. .windowtit|
00003c10  6c 65 28 77 69 6e 25 2c  74 69 74 6c 65 24 29 0d  |le(win%,title$).|
00003c20  12 3e 0d ea 20 6c 6f 63  25 2c 61 24 0d 12 48 2b  |.>.. loc%,a$..H+|
00003c30  62 25 21 30 3d 77 69 6e  25 3a c8 99 20 22 57 69  |b%!0=win%:.. "Wi|
00003c40  6d 70 5f 47 65 74 57 69  6e 64 6f 77 49 6e 66 6f  |mp_GetWindowInfo|
00003c50  22 2c 2c 62 25 2b 31 0d  12 52 25 6c 6f 63 25 3d  |",,b%+1..R%loc%=|
00003c60  21 28 62 25 2b 37 36 29  3a 61 24 3d a4 6d 73 67  |!(b%+76):a$=.msg|
00003c70  74 65 78 74 28 74 69 74  6c 65 24 29 0d 12 5c 1a  |text(title$)..\.|
00003c80  e7 20 a4 73 74 72 69 6e  67 30 28 6c 6f 63 25 29  |. .string0(loc%)|
00003c90  3c 3e 61 24 20 8c 0d 12  66 3a 20 24 6c 6f 63 25  |<>a$ ...f: $loc%|
00003ca0  3d 61 24 3a 62 25 21 33  32 3d 77 69 6e 25 3a c8  |=a$:b%!32=win%:.|
00003cb0  99 20 22 57 69 6d 70 5f  47 65 74 57 69 6e 64 6f  |. "Wimp_GetWindo|
00003cc0  77 4f 75 74 6c 69 6e 65  22 2c 2c 62 25 2b 33 32  |wOutline",,b%+32|
00003cd0  0d 12 70 35 20 c8 99 20  22 57 69 6d 70 5f 46 6f  |..p5 .. "Wimp_Fo|
00003ce0  72 63 65 52 65 64 72 61  77 22 2c 2d 31 2c 62 25  |rceRedraw",-1,b%|
00003cf0  21 33 36 2c 62 25 21 31  36 2c 62 25 21 34 34 2c  |!36,b%!16,b%!44,|
00003d00  62 25 21 34 38 0d 12 7a  05 cd 0d 12 84 05 e1 0d  |b%!48..z........|
00003d10  12 8e 05 3a 0d 12 98 3e  f4 20 2a 2a 2a 2a 2a 2a  |...:...>. ******|
00003d20  2a 2a 2a 2a 2a 2a 20 4e  65 73 74 65 64 20 57 69  |****** Nested Wi|
00003d30  6e 64 6f 77 20 4d 61 6e  61 67 65 72 20 73 70 65  |ndow Manager spe|
00003d40  63 69 66 69 63 20 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |cific **********|
00003d50  2a 2a 0d 12 a2 37 f4 20  50 52 4f 43 65 6d 62 65  |**...7. PROCembe|
00003d60  64 77 69 6e 20 20 20 20  20 3a 20 65 6d 62 65 64  |dwin     : embed|
00003d70  73 20 61 20 77 69 6e 64  6f 77 20 77 69 74 68 69  |s a window withi|
00003d80  6e 20 61 6e 6f 74 68 65  72 0d 12 ac 44 f4 20 50  |n another...D. P|
00003d90  52 4f 43 65 6d 62 65 64  77 69 6e 77 69 74 68 20  |ROCembedwinwith |
00003da0  3a 20 65 6d 62 65 64 73  20 61 20 77 69 6e 64 6f  |: embeds a windo|
00003db0  77 20 77 69 74 68 69 6e  20 61 6e 6f 74 68 65 72  |w within another|
00003dc0  20 77 69 74 68 20 77 69  6e 66 6c 67 73 0d 12 b6  | with winflgs...|
00003dd0  36 f4 20 50 52 4f 43 75  6e 65 6d 62 65 64 77 69  |6. PROCunembedwi|
00003de0  6e 20 20 20 3a 20 75 6e  65 6d 62 65 64 20 61 20  |n   : unembed a |
00003df0  77 69 6e 64 6f 77 20 66  72 6f 6d 20 61 6e 6f 74  |window from anot|
00003e00  68 65 72 0d 12 c0 3d f4  20 46 4e 70 61 72 65 6e  |her...=. FNparen|
00003e10  74 77 69 6e 20 20 20 20  20 20 3a 20 52 65 74 75  |twin      : Retu|
00003e20  72 6e 73 20 74 68 65 20  70 61 72 65 6e 74 20 77  |rns the parent w|
00003e30  69 6e 64 6f 77 20 6f 66  20 61 20 63 68 69 6c 64  |indow of a child|
00003e40  0d 12 ca 25 dd f2 65 6d  62 65 64 77 69 6e 28 70  |...%..embedwin(p|
00003e50  61 72 65 6e 74 25 2c 63  68 69 6c 64 25 2c 66 6c  |arent%,child%,fl|
00003e60  61 67 73 25 29 0d 12 d4  2b 21 62 25 3d 63 68 69  |ags%)...+!b%=chi|
00003e70  6c 64 25 3a c8 99 20 22  57 69 6d 70 5f 47 65 74  |ld%:.. "Wimp_Get|
00003e80  57 69 6e 64 6f 77 53 74  61 74 65 22 2c 2c 62 25  |WindowState",,b%|
00003e90  0d 12 de 3b c8 99 20 22  57 69 6d 70 5f 4f 70 65  |...;.. "Wimp_Ope|
00003ea0  6e 57 69 6e 64 6f 77 22  2c 2c 62 25 2c 26 34 42  |nWindow",,b%,&4B|
00003eb0  35 33 34 31 35 34 2c 70  61 72 65 6e 74 25 2c 66  |534154,parent%,f|
00003ec0  6c 61 67 73 25 20 80 20  ac 20 31 0d 12 e8 05 e1  |lags% . . 1.....|
00003ed0  0d 12 f2 33 dd f2 65 6d  62 65 64 77 69 6e 77 69  |...3..embedwinwi|
00003ee0  74 68 28 70 61 72 65 6e  74 25 2c 63 68 69 6c 64  |th(parent%,child|
00003ef0  25 2c 66 6c 61 67 73 25  2c 77 69 6e 66 6c 61 67  |%,flags%,winflag|
00003f00  73 25 29 0d 12 fc 3b 21  62 25 3d 63 68 69 6c 64  |s%)...;!b%=child|
00003f10  25 3a c8 99 20 22 57 69  6d 70 5f 47 65 74 57 69  |%:.. "Wimp_GetWi|
00003f20  6e 64 6f 77 53 74 61 74  65 22 2c 2c 62 25 3a 62  |ndowState",,b%:b|
00003f30  25 21 33 32 3d 77 69 6e  66 6c 61 67 73 25 0d 13  |%!32=winflags%..|
00003f40  06 39 c8 99 20 22 57 69  6d 70 5f 4f 70 65 6e 57  |.9.. "Wimp_OpenW|
00003f50  69 6e 64 6f 77 22 2c 2c  62 25 2c 26 34 42 35 33  |indow",,b%,&4B53|
00003f60  34 31 35 34 2c 70 61 72  65 6e 74 25 2c 66 6c 61  |4154,parent%,fla|
00003f70  67 73 25 20 84 20 31 0d  13 10 05 e1 0d 13 1a 20  |gs% . 1........ |
00003f80  dd f2 75 6e 65 6d 62 65  64 77 69 6e 28 70 61 72  |..unembedwin(par|
00003f90  65 6e 74 25 2c 63 68 69  6c 64 25 29 0d 13 24 2b  |ent%,child%)..$+|
00003fa0  21 62 25 3d 63 68 69 6c  64 25 3a c8 99 20 22 57  |!b%=child%:.. "W|
00003fb0  69 6d 70 5f 47 65 74 57  69 6e 64 6f 77 53 74 61  |imp_GetWindowSta|
00003fc0  74 65 22 2c 2c 62 25 0d  13 2e 2f c8 99 20 22 57  |te",,b%.../.. "W|
00003fd0  69 6d 70 5f 43 6c 6f 73  65 57 69 6e 64 6f 77 22  |imp_CloseWindow"|
00003fe0  2c 2c 62 25 2c 26 34 42  35 33 34 31 35 34 2c 70  |,,b%,&4B534154,p|
00003ff0  61 72 65 6e 74 25 0d 13  38 05 e1 0d 13 42 17 dd  |arent%..8....B..|
00004000  a4 70 61 72 65 6e 74 77  69 6e 28 63 68 69 6c 64  |.parentwin(child|
00004010  25 29 0d 13 4c 0d ea 20  70 61 72 65 6e 74 25 0d  |%)..L.. parent%.|
00004020  13 56 42 21 62 25 3d 63  68 69 6c 64 25 3a c8 99  |.VB!b%=child%:..|
00004030  20 22 57 69 6d 70 5f 47  65 74 57 69 6e 64 6f 77  | "Wimp_GetWindow|
00004040  53 74 61 74 65 22 2c 2c  62 25 2c 26 34 42 35 33  |State",,b%,&4B53|
00004050  34 31 35 34 20 b8 20 2c  2c 2c 70 61 72 65 6e 74  |4154 . ,,,parent|
00004060  25 0d 13 60 0c 3d 70 61  72 65 6e 74 25 0d 13 6a  |%..`.=parent%..j|
00004070  05 3a 0d 13 74 37 f4 20  2a 2a 2a 2a 2a 2a 2a 2a  |.:..t7. ********|
00004080  20 49 63 6f 6e 20 6d 61  6e 69 70 75 6c 61 74 69  | Icon manipulati|
00004090  6f 6e 20 72 6f 75 74 69  6e 65 73 20 2a 2a 2a 2a  |on routines ****|
000040a0  2a 2a 2a 2a 2a 2a 2a 2a  2a 0d 13 7e 05 3a 0d 13  |*********..~.:..|
000040b0  88 37 f4 20 46 4e 63 72  65 61 74 65 69 63 6f 6e  |.7. FNcreateicon|
000040c0  20 3a 20 43 72 65 61 74  65 20 61 6e 20 69 63 6f  | : Create an ico|
000040d0  6e 20 77 69 74 68 20 73  65 74 20 70 61 72 61 6d  |n with set param|
000040e0  65 74 65 72 73 0d 13 92  3c f4 20 77 69 6e 64 6f  |eters...<. windo|
000040f0  77 2c 78 2c 79 2c 20 77  69 64 74 68 2c 20 68 65  |w,x,y, width, he|
00004100  69 67 68 74 2c 20 74 69  74 6c 65 2c 20 76 61 6c  |ight, title, val|
00004110  69 64 61 74 69 6f 6e 2c  20 63 6f 6c 6f 75 72 73  |idation, colours|
00004120  2c 0d 13 9c 1d f4 20 45  53 47 2c 20 62 75 74 74  |,..... ESG, butt|
00004130  6f 6e 20 74 79 70 65 2c  20 66 6c 61 67 73 0d 13  |on type, flags..|
00004140  a6 31 f4 20 63 6f 6c 20  63 6f 75 6c 64 20 62 65  |.1. col could be|
00004150  20 66 6f 6e 74 20 68 61  6e 64 6c 65 20 69 66 20  | font handle if |
00004160  75 73 65 20 66 6f 6e 74  20 69 73 20 73 65 74 0d  |use font is set.|
00004170  13 b0 42 f4 20 6f 74 68  65 72 77 69 73 65 20 63  |..B. otherwise c|
00004180  6f 6c 20 69 73 20 26 42  46 20 28 42 3d 62 61 63  |ol is &BF (B=bac|
00004190  6b 67 72 6f 75 6e 64 2c  20 46 3d 66 6f 72 65 67  |kground, F=foreg|
000041a0  72 6f 75 6e 64 29 20 28  75 73 75 2e 20 26 31 37  |round) (usu. &17|
000041b0  29 0d 13 ba 39 f4 20 51  75 69 63 6b 20 66 6c 61  |)...9. Quick fla|
000041c0  67 73 20 3a 20 25 41 46  56 48 42 30 30 20 28 41  |gs : %AFVHB00 (A|
000041d0  3d 46 6f 6e 74 2c 20 46  3d 46 69 6c 6c 65 64 2c  |=Font, F=Filled,|
000041e0  20 42 3d 42 6f 72 64 65  72 29 0d 13 c4 0d f4 20  | B=Border)..... |
000041f0  46 6c 61 67 73 20 3a 0d  13 ce 20 f4 20 30 20 3a  |Flags :... . 0 :|
00004200  20 54 65 78 74 20 20 20  20 20 20 20 20 20 20 20  | Text           |
00004210  38 20 3a 20 4e 2f 41 0d  13 d8 2c f4 20 31 20 3a  |8 : N/A...,. 1 :|
00004220  20 53 70 72 69 74 65 20  20 20 20 20 20 20 20 20  | Sprite         |
00004230  39 20 3a 20 52 69 67 68  74 20 4a 75 73 74 69 66  |9 : Right Justif|
00004240  69 65 64 0d 13 e2 3b f4  20 32 20 3a 20 42 6f 72  |ied...;. 2 : Bor|
00004250  64 65 72 65 64 20 20 20  20 20 20 31 30 20 3a 20  |dered      10 : |
00004260  4d 75 6c 74 69 70 6c 65  20 73 65 6c 65 63 74 69  |Multiple selecti|
00004270  6f 6e 20 77 69 74 68 20  61 64 6a 75 73 74 0d 13  |on with adjust..|
00004280  ec 29 f4 20 33 20 3a 20  48 20 43 65 6e 74 72 65  |.). 3 : H Centre|
00004290  20 20 20 20 20 20 31 31  20 3a 20 53 6d 61 6c 6c  |      11 : Small|
000042a0  20 73 70 72 69 74 65 0d  13 f6 1e f4 20 34 20 3a  | sprite..... 4 :|
000042b0  20 56 20 43 65 6e 74 72  65 20 20 20 20 20 20 32  | V Centre      2|
000042c0  30 20 3a 20 3f 0d 14 00  25 f4 20 35 20 3a 20 46  |0 : ?...%. 5 : F|
000042d0  69 6c 6c 65 64 20 20 20  20 20 20 20 20 32 31 20  |illed        21 |
000042e0  3a 20 49 6e 76 65 72 74  65 64 0d 14 0a 23 f4 20  |: Inverted...#. |
000042f0  36 20 3a 20 55 73 65 20  66 6f 6e 74 73 20 20 20  |6 : Use fonts   |
00004300  20 20 32 32 20 3a 20 53  68 61 64 65 64 0d 14 14  |  22 : Shaded...|
00004310  1e f4 20 37 20 3a 20 4e  2f 41 20 20 20 20 20 20  |.. 7 : N/A      |
00004320  20 20 20 20 20 32 33 20  3a 20 3f 0d 14 1e 14 f4  |     23 : ?.....|
00004330  20 42 75 74 74 6f 6e 20  74 79 70 65 73 20 3a 0d  | Button types :.|
00004340  14 28 17 f4 20 30 20 3a  20 49 67 6e 6f 72 65 20  |.(.. 0 : Ignore |
00004350  63 6c 69 63 6b 73 0d 14  32 1a f4 20 31 20 3a 20  |clicks..2.. 1 : |
00004360  4e 6f 74 69 66 79 20 77  68 65 6e 20 6f 76 65 72  |Notify when over|
00004370  0d 14 3c 20 f4 20 32 20  3a 20 43 6c 69 63 6b 73  |..< . 2 : Clicks|
00004380  20 72 65 70 65 61 74 20  26 20 6e 6f 74 69 66 79  | repeat & notify|
00004390  0d 14 46 22 f4 20 33 20  3a 20 43 6c 69 63 6b 73  |..F". 3 : Clicks|
000043a0  20 64 65 62 6f 75 6e 63  65 20 26 20 6e 6f 74 69  | debounce & noti|
000043b0  66 79 0d 14 50 3f f4 20  34 20 3a 20 43 6c 69 63  |fy..P?. 4 : Clic|
000043c0  6b 20 73 65 6c 65 63 74  73 2c 20 72 65 6c 65 61  |k selects, relea|
000043d0  73 65 20 6e 6f 74 69 66  69 65 73 2c 20 6f 72 20  |se notifies, or |
000043e0  64 65 73 65 6c 65 63 74  20 69 66 20 6d 6f 76 65  |deselect if move|
000043f0  64 0d 14 5a 2a f4 20 35  20 3a 20 43 6c 69 63 6b  |d..Z*. 5 : Click|
00004400  20 73 65 6c 65 63 74 73  2c 20 32 20 63 6c 69 63  | selects, 2 clic|
00004410  6b 73 20 6e 6f 74 69 66  69 65 73 0d 14 64 1c f4  |ks notifies..d..|
00004420  20 36 20 3a 20 41 73 20  33 20 62 75 74 20 77 69  | 6 : As 3 but wi|
00004430  6c 6c 20 64 72 61 67 0d  14 6e 1c f4 20 37 20 3a  |ll drag..n.. 7 :|
00004440  20 41 73 20 34 20 62 75  74 20 77 69 6c 6c 20 64  | As 4 but will d|
00004450  72 61 67 0d 14 78 1c f4  20 38 20 3a 20 41 73 20  |rag..x.. 8 : As |
00004460  35 20 62 75 74 20 77 69  6c 6c 20 64 72 61 67 0d  |5 but will drag.|
00004470  14 82 13 f4 20 39 20 3a  20 4d 65 6e 75 20 69 63  |.... 9 : Menu ic|
00004480  6f 6e 0d 14 8c 30 f4 20  31 30 3a 20 43 6c 69 63  |on...0. 10: Clic|
00004490  6b 3d 62 75 74 2a 32 35  36 2c 64 72 61 67 3d 62  |k=but*256,drag=b|
000044a0  75 74 2a 31 36 2c 32 20  63 6c 69 63 6b 73 3d 62  |ut*16,2 clicks=b|
000044b0  75 74 0d 14 96 33 f4 20  31 31 3a 20 52 61 64 69  |ut...3. 11: Radi|
000044c0  6f 20 28 56 61 6c 69 64  61 74 69 6f 6e 20 66 6f  |o (Validation fo|
000044d0  72 6d 61 74 20 3a 20 53  6f 70 74 6f 66 66 2c 6f  |rmat : Soptoff,o|
000044e0  70 74 6f 6e 29 0d 14 a0  11 f4 20 31 32 2f 31 33  |pton)..... 12/13|
000044f0  20 3a 20 4e 2f 41 0d 14  aa 27 f4 20 31 34 3a 20  | : N/A...'. 14: |
00004500  57 72 69 74 65 61 62 6c  65 2f 43 6c 69 63 6b 61  |Writeable/Clicka|
00004510  62 6c 65 2f 44 72 61 67  67 61 62 6c 65 0d 14 b4  |ble/Draggable...|
00004520  13 f4 20 31 35 3a 20 57  72 69 74 65 61 62 6c 65  |.. 15: Writeable|
00004530  0d 14 be 3d dd a4 63 72  65 61 74 65 69 63 6f 6e  |...=..createicon|
00004540  28 77 69 6e 2c 78 2c 79  2c 77 2c 68 2c 74 69 74  |(win,x,y,w,h,tit|
00004550  6c 65 24 2c 76 61 6c 69  64 24 2c 63 6f 6c 2c 65  |le$,valid$,col,e|
00004560  73 67 2c 62 75 74 2c 66  6c 61 67 73 29 0d 14 c8  |sg,but,flags)...|
00004570  24 ea 20 68 61 6e 64 6c  65 3a 74 69 74 6c 65 24  |$. handle:title$|
00004580  3d a4 6d 73 67 74 65 78  74 28 74 69 74 6c 65 24  |=.msgtext(title$|
00004590  29 0d 14 d2 2e 62 25 21  30 3d 77 69 6e 3a 62 25  |)....b%!0=win:b%|
000045a0  21 34 3d 78 3a 62 25 21  38 3d 79 2d 68 3a 62 25  |!4=x:b%!8=y-h:b%|
000045b0  21 31 32 3d 78 2b 77 3a  62 25 21 31 36 3d 79 0d  |!12=x+w:b%!16=y.|
000045c0  14 dc 36 62 25 21 32 30  3d 28 66 6c 61 67 73 20  |..6b%!20=(flags |
000045d0  80 20 28 25 31 31 31 30  30 31 31 31 31 31 31 31  |. (%111001111111|
000045e0  2b 28 31 35 3c 3c 32 30  29 29 29 2b 28 63 6f 6c  |+(15<<20)))+(col|
000045f0  3c 3c 32 34 29 0d 14 e6  1e 62 25 21 32 30 2b 3d  |<<24)....b%!20+=|
00004600  28 65 73 67 3c 3c 31 36  29 2b 28 62 75 74 3c 3c  |(esg<<16)+(but<<|
00004610  31 32 29 0d 14 f0 2d e7  20 76 61 6c 69 64 24 3c  |12)...-. valid$<|
00004620  3e 22 22 20 84 20 a9 28  74 69 74 6c 65 24 29 3e  |>"" . .(title$)>|
00004630  31 31 20 84 20 74 69 74  6c 65 24 3d bd 30 20 8c  |11 . title$=.0 .|
00004640  0d 14 fa 12 20 e7 20 74  69 74 6c 65 24 3d bd 30  |.... . title$=.0|
00004650  20 8c 0d 15 04 29 20 20  62 25 21 32 34 3d a4 69  | ....)  b%!24=.i|
00004660  6e 64 69 72 65 63 74 28  c4 32 35 35 2c bd 30 29  |ndirect(.255,.0)|
00004670  29 3a 62 25 21 33 32 3d  32 35 36 0d 15 0e 06 20  |):b%!32=256.... |
00004680  cc 0d 15 18 2f 20 20 62  25 21 32 34 3d a4 69 6e  |..../  b%!24=.in|
00004690  64 69 72 65 63 74 28 74  69 74 6c 65 24 29 3a 62  |direct(title$):b|
000046a0  25 21 33 32 3d a9 28 74  69 74 6c 65 24 29 2b 31  |%!32=.(title$)+1|
000046b0  0d 15 22 06 20 cd 0d 15  2c 28 20 62 25 21 32 38  |..". ...,( b%!28|
000046c0  3d a4 69 6e 64 69 72 65  63 74 28 76 61 6c 69 64  |=.indirect(valid|
000046d0  24 29 3a 62 25 21 32 30  2b 3d 31 3c 3c 38 0d 15  |$):b%!20+=1<<8..|
000046e0  36 05 cc 0d 15 40 14 20  24 28 62 25 2b 32 34 29  |6....@. $(b%+24)|
000046f0  3d 74 69 74 6c 65 24 0d  15 4a 05 cd 0d 15 54 55  |=title$..J....TU|
00004700  e7 20 28 28 62 25 21 32  30 29 20 80 20 26 31 30  |. ((b%!20) . &10|
00004710  33 29 3d 26 33 20 8c 85  20 26 38 30 33 2c 22 43  |3)=&3 .. &803,"C|
00004720  61 6e 6e 6f 74 20 6d 61  6b 65 20 61 20 73 70 72  |annot make a spr|
00004730  69 74 65 2f 74 65 78 74  20 69 63 6f 6e 20 77 69  |ite/text icon wi|
00004740  74 68 6f 75 74 20 76 61  6c 69 64 61 74 69 6f 6e  |thout validation|
00004750  22 0d 15 5e 1d e7 20 28  66 6c 61 67 73 20 80 20  |"..^.. (flags . |
00004760  33 29 3d 30 20 8c 62 25  21 32 30 2b 3d 31 0d 15  |3)=0 .b%!20+=1..|
00004770  68 2e e7 20 a4 6c 6f 77  65 72 28 c0 76 61 6c 69  |h.. .lower(.vali|
00004780  64 24 2c 31 29 29 3d 22  73 22 20 8c 20 62 25 21  |d$,1))="s" . b%!|
00004790  32 30 3d 62 25 21 32 30  20 84 20 32 0d 15 72 25  |20=b%!20 . 2..r%|
000047a0  c8 99 20 22 57 69 6d 70  5f 43 72 65 61 74 65 49  |.. "Wimp_CreateI|
000047b0  63 6f 6e 22 2c 2c 62 25  20 b8 20 68 61 6e 64 6c  |con",,b% . handl|
000047c0  65 0d 15 7c 0b 3d 68 61  6e 64 6c 65 0d 15 86 05  |e..|.=handle....|
000047d0  3a 0d 15 90 36 f4 20 50  52 4f 43 64 65 6c 65 74  |:...6. PROCdelet|
000047e0  65 69 63 6f 6e 20 3a 20  44 65 6c 65 74 65 20 74  |eicon : Delete t|
000047f0  68 65 20 69 63 6f 6e 20  66 72 6f 6d 20 74 68 65  |he icon from the|
00004800  20 77 69 6e 64 6f 77 0d  15 9a 1a dd f2 64 65 6c  | window......del|
00004810  65 74 65 69 63 6f 6e 28  77 69 6e 2c 69 63 6f 6e  |eteicon(win,icon|
00004820  29 0d 15 a4 2e 21 62 25  3d 77 69 6e 3a 62 25 21  |)....!b%=win:b%!|
00004830  34 3d 69 63 6f 6e 3a c8  99 20 22 57 69 6d 70 5f  |4=icon:.. "Wimp_|
00004840  44 65 6c 65 74 65 49 63  6f 6e 22 2c 2c 62 25 0d  |DeleteIcon",,b%.|
00004850  15 ae 05 e1 0d 15 b8 05  3a 0d 15 c2 3b f4 20 46  |........:...;. F|
00004860  4e 43 72 65 61 74 65 49  63 6f 6e 42 61 72 49 63  |NCreateIconBarIc|
00004870  6f 6e 20 3a 20 43 72 65  61 74 65 20 61 6e 20 69  |on : Create an i|
00004880  63 6f 6e 20 66 6f 72 20  74 68 65 20 69 63 6f 6e  |con for the icon|
00004890  20 62 61 72 0d 15 cc 23  f4 20 49 63 6f 6e 2d 62  | bar...#. Icon-b|
000048a0  61 72 20 70 6f 73 69 74  69 6f 6e 73 20 28 6c 6f  |ar positions (lo|
000048b0  77 20 62 79 74 65 29 0d  15 d6 19 f4 20 31 20 3d  |w byte)..... 1 =|
000048c0  20 72 69 67 68 74 2c 20  32 20 3d 20 6c 65 66 74  | right, 2 = left|
000048d0  0d 15 e0 2b f4 20 33 20  3d 20 6c 65 66 74 20 72  |...+. 3 = left r|
000048e0  65 6c 61 74 69 76 65 20  74 6f 20 28 68 69 67 68  |elative to (high|
000048f0  20 62 79 74 65 29 20 69  63 6f 6e 0d 15 ea 2c f4  | byte) icon...,.|
00004900  20 34 20 3d 20 72 69 67  68 74 20 72 65 6c 61 74  | 4 = right relat|
00004910  69 76 65 20 74 6f 20 28  68 69 67 68 20 62 79 74  |ive to (high byt|
00004920  65 29 20 69 63 6f 6e 0d  15 f4 38 f4 20 35 20 3d  |e) icon...8. 5 =|
00004930  20 6c 65 66 74 2c 20 68  69 67 68 20 70 72 69 6f  | left, high prio|
00004940  72 69 74 79 20 28 68 69  67 68 20 62 79 74 65 3d  |rity (high byte=|
00004950  70 72 69 6f 72 69 74 79  20 76 61 6c 75 65 29 0d  |priority value).|
00004960  15 fe 24 f4 20 36 20 3d  20 6c 65 66 74 2c 20 6c  |..$. 6 = left, l|
00004970  6f 77 20 70 72 69 6f 72  69 74 79 20 28 64 69 74  |ow priority (dit|
00004980  74 6f 29 0d 16 08 25 f4  20 37 20 3d 20 72 69 67  |to)...%. 7 = rig|
00004990  68 74 2c 20 6c 6f 77 20  70 72 69 6f 72 69 74 79  |ht, low priority|
000049a0  20 28 64 69 74 74 6f 29  0d 16 12 26 f4 20 38 20  | (ditto)...&. 8 |
000049b0  3d 20 72 69 67 68 74 2c  20 68 69 67 68 20 70 72  |= right, high pr|
000049c0  69 6f 72 69 74 79 20 28  64 69 74 74 6f 29 0d 16  |iority (ditto)..|
000049d0  1c 38 dd a4 43 72 65 61  74 65 49 63 6f 6e 42 61  |.8..CreateIconBa|
000049e0  72 49 63 6f 6e 28 53 70  72 24 2c 74 69 74 6c 65  |rIcon(Spr$,title|
000049f0  24 2c 70 6f 73 25 29 3a  ea 20 69 63 25 2c 77 25  |$,pos%):. ic%,w%|
00004a00  2c 6d 25 2c 65 25 0d 16  26 31 74 69 74 6c 65 24  |,m%,e%..&1title$|
00004a10  3d a4 6d 73 67 74 65 78  74 28 74 69 74 6c 65 24  |=.msgtext(title$|
00004a20  29 3a 62 25 21 30 3d 2d  28 94 28 70 6f 73 25 29  |):b%!0=-(.(pos%)|
00004a30  20 80 20 26 46 46 29 0d  16 30 32 62 25 21 34 3d  | . &FF)..02b%!4=|
00004a40  30 3a 62 25 21 38 3d 2d  31 36 3a 62 25 21 31 32  |0:b%!8=-16:b%!12|
00004a50  3d 31 32 2b 31 36 2a a9  28 74 69 74 6c 65 24 29  |=12+16*.(title$)|
00004a60  3a 62 25 21 31 36 3d 38  38 0d 16 3a 22 e7 62 25  |:b%!16=88..:".b%|
00004a70  21 31 32 3c 31 32 2b 31  36 2a 34 20 8c 20 62 25  |!12<12+16*4 . b%|
00004a80  21 31 32 3d 31 32 2b 31  36 2a 34 0d 16 44 12 e7  |!12=12+16*4..D..|
00004a90  20 74 69 74 6c 65 24 3c  3e 22 22 20 8c 0d 16 4e  | title$<>"" ...N|
00004aa0  32 20 62 25 21 32 30 3d  28 31 3c 3c 32 38 29 2b  |2 b%!20=(1<<28)+|
00004ab0  28 37 3c 3c 32 34 29 2b  28 33 3c 3c 31 32 29 2b  |(7<<24)+(3<<12)+|
00004ac0  28 25 30 31 30 31 31 29  2b 28 31 3c 3c 38 29 0d  |(%01011)+(1<<8).|
00004ad0  16 58 1c 20 62 25 21 32  34 3d a4 69 6e 64 69 72  |.X. b%!24=.indir|
00004ae0  65 63 74 28 74 69 74 6c  65 24 29 0d 16 62 1e 20  |ect(title$)..b. |
00004af0  62 25 21 32 38 3d a4 69  6e 64 69 72 65 63 74 28  |b%!28=.indirect(|
00004b00  22 53 22 2b 53 70 72 24  29 0d 16 6c 16 20 62 25  |"S"+Spr$)..l. b%|
00004b10  21 33 32 3d a9 28 74 69  74 6c 65 24 29 2b 31 0d  |!32=.(title$)+1.|
00004b20  16 76 05 cc 0d 16 80 2b  20 62 25 21 32 30 3d 28  |.v.....+ b%!20=(|
00004b30  31 3c 3c 32 38 29 2b 28  37 3c 3c 32 34 29 2b 28  |1<<28)+(7<<24)+(|
00004b40  33 3c 3c 31 32 29 2b 28  25 31 31 30 31 30 29 0d  |3<<12)+(%11010).|
00004b50  16 8a 12 20 24 28 62 25  2b 32 34 29 3d 53 70 72  |... $(b%+24)=Spr|
00004b60  24 0d 16 94 05 cd 0d 16  9e 3c c8 99 20 22 57 69  |$........<.. "Wi|
00004b70  6d 70 5f 53 70 72 69 74  65 4f 70 22 2c 26 31 32  |mp_SpriteOp",&12|
00004b80  38 2c 2c c0 53 70 72 24  2c a7 53 70 72 24 2b 22  |8,,.Spr$,.Spr$+"|
00004b90  2c 22 2c 22 2c 22 29 29  20 b8 2c 2c 2c 77 25 2c  |,",",")) .,,,w%,|
00004ba0  6d 25 0d 16 a8 37 c8 99  20 22 58 4f 53 5f 52 65  |m%...7.. "XOS_Re|
00004bb0  61 64 4d 6f 64 65 56 61  72 69 61 62 6c 65 22 2c  |adModeVariable",|
00004bc0  6d 25 2c 34 20 b8 20 2c  2c 65 25 3a 77 25 3d 28  |m%,4 . ,,e%:w%=(|
00004bd0  77 25 2b 31 29 3c 3c 65  25 0d 16 b2 18 e7 20 77  |w%+1)<<e%..... w|
00004be0  25 3e 62 25 21 31 32 20  8c 62 25 21 31 32 3d 77  |%>b%!12 .b%!12=w|
00004bf0  25 0d 16 bc 54 e7 20 28  94 28 70 6f 73 25 29 80  |%...T. (.(pos%).|
00004c00  26 46 46 29 3d 33 20 84  20 28 94 28 70 6f 73 25  |&FF)=3 . (.(pos%|
00004c10  29 80 26 46 46 29 3d 34  20 8c 70 6f 73 25 3d 94  |).&FF)=4 .pos%=.|
00004c20  28 70 6f 73 25 29 3e 3e  38 20 8b 70 6f 73 25 3d  |(pos%)>>8 .pos%=|
00004c30  28 94 28 70 6f 73 25 29  20 80 20 26 46 46 30 30  |(.(pos%) . &FF00|
00004c40  29 3c 3c 31 36 0d 16 c6  26 c8 99 20 22 57 69 6d  |)<<16...&.. "Wim|
00004c50  70 5f 43 72 65 61 74 65  49 63 6f 6e 22 2c 70 6f  |p_CreateIcon",po|
00004c60  73 25 2c 62 25 20 b8 20  69 63 25 0d 16 d0 08 3d  |s%,b% . ic%....=|
00004c70  69 63 25 0d 16 da 05 3a  0d 16 e4 40 f4 20 46 4e  |ic%....:...@. FN|
00004c80  67 65 74 69 63 6f 6e 73  74 61 74 65 20 3a 20 52  |geticonstate : R|
00004c90  65 74 75 72 6e 20 2d 31  20 69 66 20 69 63 6f 6e  |eturn -1 if icon|
00004ca0  20 69 73 20 73 65 6c 65  63 74 65 64 2c 30 20 6f  | is selected,0 o|
00004cb0  74 68 65 72 77 69 73 65  0d 16 ee 1f dd 20 a4 67  |therwise..... .g|
00004cc0  65 74 69 63 6f 6e 73 74  61 74 65 28 77 69 6e 25  |eticonstate(win%|
00004cd0  2c 69 63 6f 6e 25 29 0d  16 f8 32 21 62 25 3d 77  |,icon%)...2!b%=w|
00004ce0  69 6e 25 3a 62 25 21 34  3d 69 63 6f 6e 25 3a c8  |in%:b%!4=icon%:.|
00004cf0  99 20 22 57 69 6d 70 5f  47 65 74 49 63 6f 6e 53  |. "Wimp_GetIconS|
00004d00  74 61 74 65 22 2c 2c 62  25 0d 17 02 16 3d 28 62  |tate",,b%....=(b|
00004d10  25 21 32 34 3e 3e 32 31  20 80 20 31 29 3e 30 0d  |%!24>>21 . 1)>0.|
00004d20  17 0c 05 3a 0d 17 16 33  f4 20 50 52 4f 43 69 63  |...:...3. PROCic|
00004d30  6f 6e 73 68 61 64 65 20  20 3a 20 75 6e 73 68 61  |onshade  : unsha|
00004d40  64 65 2f 73 68 61 64 65  2f 74 6f 67 67 6c 65 20  |de/shade/toggle |
00004d50  61 6e 20 69 63 6f 6e 0d  17 20 35 f4 20 50 52 4f  |an icon.. 5. PRO|
00004d60  43 69 63 6f 6e 73 74 61  74 65 20 20 3a 20 75 6e  |Ciconstate  : un|
00004d70  73 65 6c 65 63 74 2f 73  65 6c 65 63 74 2f 74 6f  |select/select/to|
00004d80  67 67 6c 65 20 61 6e 20  69 63 6f 6e 0d 17 2a 38  |ggle an icon..*8|
00004d90  f4 20 50 52 4f 43 73 65  74 69 63 6f 6e 62 69 74  |. PROCseticonbit|
00004da0  20 3a 20 73 65 74 2f 75  6e 73 65 74 2f 74 6f 67  | : set/unset/tog|
00004db0  67 6c 65 20 61 20 62 69  74 20 69 6e 20 61 6e 20  |gle a bit in an |
00004dc0  69 63 6f 6e 0d 17 34 21  dd f2 69 63 6f 6e 73 68  |icon..4!..iconsh|
00004dd0  61 64 65 28 77 69 6e 25  2c 69 63 6f 6e 25 2c 74  |ade(win%,icon%,t|
00004de0  79 70 65 25 29 0d 17 3e  24 f2 73 65 74 69 63 6f  |ype%)..>$.setico|
00004df0  6e 62 69 74 28 77 69 6e  25 2c 69 63 6f 6e 25 2c  |nbit(win%,icon%,|
00004e00  32 32 2c 74 79 70 65 25  29 0d 17 48 05 e1 0d 17  |22,type%)..H....|
00004e10  52 21 dd f2 69 63 6f 6e  73 74 61 74 65 28 77 69  |R!..iconstate(wi|
00004e20  6e 25 2c 69 63 6f 6e 25  2c 74 79 70 65 25 29 0d  |n%,icon%,type%).|
00004e30  17 5c 24 f2 73 65 74 69  63 6f 6e 62 69 74 28 77  |.\$.seticonbit(w|
00004e40  69 6e 25 2c 69 63 6f 6e  25 2c 32 31 2c 74 79 70  |in%,icon%,21,typ|
00004e50  65 25 29 0d 17 66 05 e1  0d 17 70 19 f4 20 74 79  |e%)..f....p.. ty|
00004e60  70 65 20 3d 20 30 20 66  6f 72 20 75 6e 74 69 63  |pe = 0 for untic|
00004e70  6b 0d 17 7a 21 f4 20 74  79 70 65 20 3d 20 31 20  |k..z!. type = 1 |
00004e80  66 6f 72 20 74 69 63 6b  20 28 61 6c 73 6f 20 2d  |for tick (also -|
00004e90  31 29 0d 17 84 19 f4 20  74 79 70 65 20 3d 20 32  |1)..... type = 2|
00004ea0  20 66 6f 72 20 74 6f 67  67 6c 65 0d 17 8e 27 dd  | for toggle...'.|
00004eb0  f2 73 65 74 69 63 6f 6e  62 69 74 28 77 69 6e 25  |.seticonbit(win%|
00004ec0  2c 69 63 6f 6e 25 2c 62  69 74 25 2c 74 79 70 65  |,icon%,bit%,type|
00004ed0  25 29 0d 17 98 0b ea 20  73 25 2c 74 25 0d 17 a2  |%)..... s%,t%...|
00004ee0  0e c8 8e 20 74 79 70 65  25 20 ca 0d 17 ac 1e 20  |... type% ..... |
00004ef0  c9 20 30 3a 73 25 3d 30  3c 3c 62 69 74 25 3a 74  |. 0:s%=0<<bit%:t|
00004f00  25 3d 31 3c 3c 62 69 74  25 0d 17 b6 21 20 c9 20  |%=1<<bit%...! . |
00004f10  2d 31 2c 31 3a 73 25 3d  31 3c 3c 62 69 74 25 3a  |-1,1:s%=1<<bit%:|
00004f20  74 25 3d 31 3c 3c 62 69  74 25 0d 17 c0 1e 20 c9  |t%=1<<bit%.... .|
00004f30  20 32 3a 73 25 3d 31 3c  3c 62 69 74 25 3a 74 25  | 2:s%=1<<bit%:t%|
00004f40  3d 30 3c 3c 62 69 74 25  0d 17 ca 05 cb 0d 17 d4  |=0<<bit%........|
00004f50  29 62 25 21 30 3d 77 69  6e 25 3a 62 25 21 34 3d  |)b%!0=win%:b%!4=|
00004f60  69 63 6f 6e 25 3a 62 25  21 38 3d 73 25 3a 62 25  |icon%:b%!8=s%:b%|
00004f70  21 31 32 3d 74 25 0d 17  de 1e c8 99 20 22 57 69  |!12=t%...... "Wi|
00004f80  6d 70 5f 53 65 74 49 63  6f 6e 53 74 61 74 65 22  |mp_SetIconState"|
00004f90  2c 2c 62 25 0d 17 e8 05  e1 0d 17 f2 05 3a 0d 17  |,,b%.........:..|
00004fa0  fc 39 f4 20 50 52 4f 43  70 72 65 73 73 69 63 6f  |.9. PROCpressico|
00004fb0  6e 20 20 3a 20 4d 61 6b  65 20 74 68 65 20 69 63  |n  : Make the ic|
00004fc0  6f 6e 20 70 72 65 73 73  65 64 20 61 6e 64 20 72  |on pressed and r|
00004fd0  65 6c 65 61 73 65 64 0d  18 06 33 f4 20 50 52 4f  |eleased...3. PRO|
00004fe0  43 72 65 64 72 61 77 69  63 6f 6e 20 3a 20 46 6f  |Credrawicon : Fo|
00004ff0  72 63 65 20 74 68 65 20  72 65 64 72 61 77 20 6f  |rce the redraw o|
00005000  66 20 74 68 65 20 69 63  6f 6e 0d 18 10 1b dd f2  |f the icon......|
00005010  70 72 65 73 73 69 63 6f  6e 28 77 69 6e 25 2c 69  |pressicon(win%,i|
00005020  63 6f 6e 25 29 0d 18 1a  25 ea 20 74 25 3a f2 73  |con%)...%. t%:.s|
00005030  65 74 69 63 6f 6e 62 69  74 28 77 69 6e 25 2c 69  |eticonbit(win%,i|
00005040  63 6f 6e 25 2c 32 31 2c  31 29 0d 18 24 30 74 25  |con%,21,1)..$0t%|
00005050  3d 91 3a f5 3a fd 91 3e  74 25 2b 31 35 3a f2 73  |=.:.:..>t%+15:.s|
00005060  65 74 69 63 6f 6e 62 69  74 28 77 69 6e 25 2c 69  |eticonbit(win%,i|
00005070  63 6f 6e 25 2c 32 31 2c  30 29 0d 18 2e 05 e1 0d  |con%,21,0)......|
00005080  18 38 1c dd f2 72 65 64  72 61 77 69 63 6f 6e 28  |.8...redrawicon(|
00005090  77 69 6e 25 2c 69 63 6f  6e 25 29 0d 18 42 40 77  |win%,icon%)..B@w|
000050a0  69 6e 25 2b 3d 77 69 6e  25 3d 2d 31 3a 21 62 25  |in%+=win%=-1:!b%|
000050b0  3d 77 69 6e 25 3a 62 25  21 34 3d 69 63 6f 6e 25  |=win%:b%!4=icon%|
000050c0  3a c8 99 20 22 57 69 6d  70 5f 47 65 74 49 63 6f  |:.. "Wimp_GetIco|
000050d0  6e 53 74 61 74 65 22 2c  2c 62 25 0d 18 4c 35 c8  |nState",,b%..L5.|
000050e0  99 20 22 57 69 6d 70 5f  46 6f 72 63 65 52 65 64  |. "Wimp_ForceRed|
000050f0  72 61 77 22 2c 77 69 6e  25 2c 62 25 21 38 2c 62  |raw",win%,b%!8,b|
00005100  25 21 31 32 2c 62 25 21  31 36 2c 62 25 21 32 30  |%!12,b%!16,b%!20|
00005110  0d 18 56 05 e1 0d 18 60  05 3a 0d 18 6a 3c f4 20  |..V....`.:..j<. |
00005120  46 4e 67 65 74 69 63 6f  6e 74 65 78 74 20 20 20  |FNgeticontext   |
00005130  3a 20 72 65 74 75 72 6e  20 69 63 6f 6e 73 20 74  |: return icons t|
00005140  65 78 74 20 73 74 72 69  6e 67 20 28 6f 72 20 73  |ext string (or s|
00005150  70 72 69 74 65 29 0d 18  74 39 f4 20 50 52 4f 43  |prite)..t9. PROC|
00005160  73 65 74 69 63 6f 6e 74  65 78 74 20 3a 20 73 65  |seticontext : se|
00005170  74 20 69 63 6f 6e 73 20  74 65 78 74 20 73 74 72  |t icons text str|
00005180  69 6e 67 20 28 6f 72 20  73 70 72 69 74 65 29 0d  |ing (or sprite).|
00005190  18 7e 1d dd a4 67 65 74  69 63 6f 6e 74 65 78 74  |.~...geticontext|
000051a0  28 77 69 6e 25 2c 69 63  6f 6e 25 29 0d 18 88 33  |(win%,icon%)...3|
000051b0  62 25 21 30 3d 77 69 6e  25 3a 62 25 21 34 3d 69  |b%!0=win%:b%!4=i|
000051c0  63 6f 6e 25 3a c8 99 20  22 57 69 6d 70 5f 47 65  |con%:.. "Wimp_Ge|
000051d0  74 49 63 6f 6e 53 74 61  74 65 22 2c 2c 62 25 0d  |tIconState",,b%.|
000051e0  18 92 2a e7 20 28 28 62  25 21 32 34 29 20 80 20  |..*. ((b%!24) . |
000051f0  26 31 30 30 29 3d 30 20  8c 3d a4 73 74 72 69 6e  |&100)=0 .=.strin|
00005200  67 30 28 62 25 2b 32 38  29 0d 18 9c 14 3d a4 73  |g0(b%+28)....=.s|
00005210  74 72 69 6e 67 30 28 62  25 21 32 38 29 0d 18 a6  |tring0(b%!28)...|
00005220  28 dd f2 73 65 74 69 63  6f 6e 74 65 78 74 28 77  |(..seticontext(w|
00005230  69 6e 25 2c 69 63 6f 6e  25 2c 74 65 78 74 24 29  |in%,icon%,text$)|
00005240  3a ea 20 69 25 0d 18 b0  38 74 65 78 74 24 3d a4  |:. i%...8text$=.|
00005250  6d 73 67 74 65 78 74 28  74 65 78 74 24 29 3a c8  |msgtext(text$):.|
00005260  99 20 22 57 69 6d 70 5f  47 65 74 43 61 72 65 74  |. "Wimp_GetCaret|
00005270  50 6f 73 69 74 69 6f 6e  22 2c 2c 62 25 0d 18 ba  |Position",,b%...|
00005280  20 69 25 3d 28 21 62 25  3d 77 69 6e 25 29 20 80  | i%=(!b%=win%) .|
00005290  20 28 69 63 6f 6e 25 3d  62 25 21 34 29 0d 18 c4  | (icon%=b%!4)...|
000052a0  33 62 25 21 30 3d 77 69  6e 25 3a 62 25 21 34 3d  |3b%!0=win%:b%!4=|
000052b0  69 63 6f 6e 25 3a c8 99  20 22 57 69 6d 70 5f 47  |icon%:.. "Wimp_G|
000052c0  65 74 49 63 6f 6e 53 74  61 74 65 22 2c 2c 62 25  |etIconState",,b%|
000052d0  0d 18 ce 47 e7 20 28 28  62 25 21 32 34 29 20 80  |...G. ((b%!24) .|
000052e0  20 26 31 30 30 29 3d 30  20 8c 20 85 20 26 38 30  | &100)=0 . . &80|
000052f0  33 2c 22 49 63 6f 6e 20  69 73 6e 27 74 20 69 6e  |3,"Icon isn't in|
00005300  64 69 72 65 63 74 65 64  20 28 23 22 2b c3 69 63  |directed (#"+.ic|
00005310  6f 6e 25 2b 22 29 22 0d  18 d8 1e e7 20 a4 73 74  |on%+")"..... .st|
00005320  72 69 6e 67 30 28 62 25  21 32 38 29 3c 3e 74 65  |ring0(b%!28)<>te|
00005330  78 74 24 20 8c 0d 18 e2  54 20 e7 20 a9 28 74 65  |xt$ ....T . .(te|
00005340  78 74 24 29 3c 62 25 21  33 36 20 8c 24 28 62 25  |xt$)<b%!36 .$(b%|
00005350  21 32 38 29 3d 74 65 78  74 24 20 8b 85 20 26 38  |!28)=text$ .. &8|
00005360  30 33 2c 22 54 65 78 74  20 74 6f 6f 20 6c 6f 6e  |03,"Text too lon|
00005370  67 20 66 6f 72 20 69 63  6f 6e 20 28 23 22 2b c3  |g for icon (#"+.|
00005380  69 63 6f 6e 25 2b 22 29  22 0d 18 ec 42 20 21 62  |icon%+")"...B !b|
00005390  25 3d 77 69 6e 25 3a 62  25 21 34 3d 69 63 6f 6e  |%=win%:b%!4=icon|
000053a0  25 3a 62 25 21 38 3d 30  3a 62 25 21 31 32 3d 30  |%:b%!8=0:b%!12=0|
000053b0  3a c8 99 20 22 57 69 6d  70 5f 53 65 74 49 63 6f  |:.. "Wimp_SetIco|
000053c0  6e 53 74 61 74 65 22 2c  2c 62 25 0d 18 f6 52 20  |nState",,b%...R |
000053d0  e7 20 69 25 20 80 20 28  62 25 21 32 34 20 80 20  |. i% . (b%!24 . |
000053e0  31 29 3d 31 20 8c c8 99  20 22 57 69 6d 70 5f 53  |1)=1 ... "Wimp_S|
000053f0  65 74 43 61 72 65 74 50  6f 73 69 74 69 6f 6e 22  |etCaretPosition"|
00005400  2c 77 69 6e 25 2c 69 63  6f 6e 25 2c 2d 31 2c 2d  |,win%,icon%,-1,-|
00005410  31 2c 2d 31 2c a9 28 74  65 78 74 24 29 0d 19 00  |1,-1,.(text$)...|
00005420  05 cd 0d 19 0a 05 e1 0d  19 14 05 3a 0d 19 1e 37  |...........:...7|
00005430  f4 20 46 4e 67 65 74 69  63 6f 6e 76 61 6c 69 64  |. FNgeticonvalid|
00005440  20 20 20 3a 20 72 65 74  75 72 6e 20 69 63 6f 6e  |   : return icon|
00005450  73 20 76 61 6c 69 64 61  74 69 6f 6e 20 73 74 72  |s validation str|
00005460  69 6e 67 0d 19 28 34 f4  20 50 52 4f 43 73 65 74  |ing..(4. PROCset|
00005470  69 63 6f 6e 76 61 6c 69  64 20 3a 20 73 65 74 20  |iconvalid : set |
00005480  69 63 6f 6e 73 20 76 61  6c 69 64 61 74 69 6f 6e  |icons validation|
00005490  20 73 74 72 69 6e 67 0d  19 32 3d f4 20 52 65 6d  | string..2=. Rem|
000054a0  65 6d 62 65 72 20 6e 6f  74 20 74 6f 20 65 78 63  |ember not to exc|
000054b0  65 65 64 20 74 68 65 20  6f 72 69 67 69 6e 61 6c  |eed the original|
000054c0  20 76 61 6c 69 64 61 74  69 6f 6e 20 73 74 72 69  | validation stri|
000054d0  6e 67 27 73 0d 19 3c 0d  f4 20 6c 65 6e 67 74 68  |ng's..<.. length|
000054e0  2e 0d 19 46 1e dd a4 67  65 74 69 63 6f 6e 76 61  |...F...geticonva|
000054f0  6c 69 64 28 77 69 6e 25  2c 69 63 6f 6e 25 29 0d  |lid(win%,icon%).|
00005500  19 50 33 62 25 21 30 3d  77 69 6e 25 3a 62 25 21  |.P3b%!0=win%:b%!|
00005510  34 3d 69 63 6f 6e 25 3a  c8 99 20 22 57 69 6d 70  |4=icon%:.. "Wimp|
00005520  5f 47 65 74 49 63 6f 6e  53 74 61 74 65 22 2c 2c  |_GetIconState",,|
00005530  62 25 0d 19 5a 45 e7 20  28 28 62 25 21 32 34 29  |b%..ZE. ((b%!24)|
00005540  20 80 20 26 31 30 30 29  3d 30 20 85 20 26 38 30  | . &100)=0 . &80|
00005550  33 2c 22 49 63 6f 6e 20  69 73 6e 27 74 20 69 6e  |3,"Icon isn't in|
00005560  64 69 72 65 63 74 65 64  20 28 23 22 2b c3 69 63  |directed (#"+.ic|
00005570  6f 6e 25 2b 22 29 22 0d  19 64 14 3d a4 73 74 72  |on%+")"..d.=.str|
00005580  69 6e 67 30 28 62 25 21  33 32 29 0d 19 6e 24 dd  |ing0(b%!32)..n$.|
00005590  f2 73 65 74 69 63 6f 6e  76 61 6c 69 64 28 77 69  |.seticonvalid(wi|
000055a0  6e 25 2c 69 63 6f 6e 25  2c 74 65 78 74 24 29 0d  |n%,icon%,text$).|
000055b0  19 78 33 62 25 21 30 3d  77 69 6e 25 3a 62 25 21  |.x3b%!0=win%:b%!|
000055c0  34 3d 69 63 6f 6e 25 3a  c8 99 20 22 57 69 6d 70  |4=icon%:.. "Wimp|
000055d0  5f 47 65 74 49 63 6f 6e  53 74 61 74 65 22 2c 2c  |_GetIconState",,|
000055e0  62 25 0d 19 82 47 e7 20  28 28 62 25 21 32 34 29  |b%...G. ((b%!24)|
000055f0  20 80 20 26 31 30 30 29  3d 30 20 8c 20 85 20 26  | . &100)=0 . . &|
00005600  38 30 33 2c 22 49 63 6f  6e 20 69 73 6e 27 74 20  |803,"Icon isn't |
00005610  69 6e 64 69 72 65 63 74  65 64 20 28 23 22 2b c3  |indirected (#"+.|
00005620  69 63 6f 6e 25 2b 22 29  22 0d 19 8c 2a 24 28 62  |icon%+")"...*$(b|
00005630  25 21 33 32 29 3d 74 65  78 74 24 3a f2 72 65 64  |%!32)=text$:.red|
00005640  72 61 77 69 63 6f 6e 28  77 69 6e 25 2c 69 63 6f  |rawicon(win%,ico|
00005650  6e 25 29 0d 19 96 05 e1  0d 19 a0 05 3a 0d 19 aa  |n%).........:...|
00005660  25 f4 20 50 52 4f 43 64  72 61 67 69 63 6f 6e 20  |%. PROCdragicon |
00005670  3a 20 53 74 61 72 74 20  61 20 64 72 61 67 20 62  |: Start a drag b|
00005680  6f 78 0d 19 b4 43 f4 20  62 6f 75 6e 64 25 20 73  |ox...C. bound% s|
00005690  68 6f 75 6c 64 20 62 65  20 54 52 55 45 20 69 66  |hould be TRUE if|
000056a0  20 79 6f 75 20 77 69 73  68 20 74 68 65 20 69 63  | you wish the ic|
000056b0  6f 6e 20 74 6f 20 73 74  61 79 20 77 69 74 68 69  |on to stay withi|
000056c0  6e 20 74 68 65 0d 19 be  0c f4 20 77 69 6e 64 6f  |n the..... windo|
000056d0  77 0d 19 c8 21 dd f2 64  72 61 67 69 63 6f 6e 28  |w...!..dragicon(|
000056e0  77 69 6e 25 2c 69 63 6f  6e 25 2c 62 6f 75 6e 64  |win%,icon%,bound|
000056f0  25 29 0d 19 d2 29 21 62  25 3d 77 69 6e 25 3a c8  |%)...)!b%=win%:.|
00005700  99 20 22 57 69 6d 70 5f  47 65 74 57 69 6e 64 6f  |. "Wimp_GetWindo|
00005710  77 53 74 61 74 65 22 2c  2c 62 25 0d 19 dc 17 73  |wState",,b%....s|
00005720  78 25 3d 62 25 21 32 30  3a 73 79 25 3d 62 25 21  |x%=b%!20:sy%=b%!|
00005730  32 34 0d 19 e6 39 78 30  25 3d 62 25 21 34 2d 73  |24...9x0%=b%!4-s|
00005740  78 25 3a 79 30 25 3d 62  25 21 38 2d 73 79 25 3a  |x%:y0%=b%!8-sy%:|
00005750  78 31 25 3d 62 25 21 31  32 2d 73 78 25 3a 79 31  |x1%=b%!12-sx%:y1|
00005760  25 3d 62 25 21 31 36 2d  73 79 25 0d 19 f0 32 21  |%=b%!16-sy%...2!|
00005770  62 25 3d 77 69 6e 25 3a  62 25 21 34 3d 69 63 6f  |b%=win%:b%!4=ico|
00005780  6e 25 3a c8 99 20 22 57  69 6d 70 5f 47 65 74 49  |n%:.. "Wimp_GetI|
00005790  63 6f 6e 53 74 61 74 65  22 2c 2c 62 25 0d 19 fa  |conState",,b%...|
000057a0  2e 62 25 21 38 2b 3d 78  30 25 3a 62 25 21 31 32  |.b%!8+=x0%:b%!12|
000057b0  2b 3d 79 31 25 3a 62 25  21 31 36 2b 3d 78 30 25  |+=y1%:b%!16+=x0%|
000057c0  3a 62 25 21 32 30 2b 3d  79 31 25 0d 1a 04 10 e7  |:b%!20+=y1%.....|
000057d0  20 62 6f 75 6e 64 25 3d  b9 20 8c 0d 1a 0e 3c 20  | bound%=. ....< |
000057e0  62 25 21 32 34 3d 78 30  25 2b 73 78 25 3a 62 25  |b%!24=x0%+sx%:b%|
000057f0  21 32 38 3d 79 30 25 2b  73 79 25 3a 62 25 21 33  |!28=y0%+sy%:b%!3|
00005800  32 3d 78 31 25 2b 73 78  25 3a 62 25 21 33 36 3d  |2=x1%+sx%:b%!36=|
00005810  79 31 25 2b 73 79 25 0d  1a 18 05 cc 0d 1a 22 2f  |y1%+sy%......."/|
00005820  20 62 25 21 34 30 3d 34  3a 62 25 21 34 34 3d 35  | b%!40=4:b%!44=5|
00005830  3a 62 25 21 34 38 3d 31  31 3a 62 25 21 35 32 3d  |:b%!48=11:b%!52=|
00005840  31 32 3a 62 25 21 35 36  3d 2d 31 0d 1a 2c 29 20  |12:b%!56=-1..,) |
00005850  c8 99 20 22 4f 53 5f 52  65 61 64 56 64 75 56 61  |.. "OS_ReadVduVa|
00005860  72 69 61 62 6c 65 73 22  2c 62 25 2b 34 30 2c 62  |riables",b%+40,b|
00005870  25 2b 34 30 0d 1a 36 3e  20 62 25 21 32 34 3d 30  |%+40..6> b%!24=0|
00005880  3a 62 25 21 32 38 3d 30  3a 62 25 21 33 32 3d 62  |:b%!28=0:b%!32=b|
00005890  25 21 34 38 2b 31 3c 3c  62 25 21 34 30 3a 62 25  |%!48+1<<b%!40:b%|
000058a0  21 33 36 3d 62 25 21 35  32 2b 31 3c 3c 62 25 21  |!36=b%!52+1<<b%!|
000058b0  34 34 0d 1a 40 05 cd 0d  1a 4a 16 62 25 21 34 3d  |44..@....J.b%!4=|
000058c0  35 3a f4 20 44 72 61 67  20 74 79 70 65 0d 1a 54  |5:. Drag type..T|
000058d0  19 c8 99 20 22 57 69 6d  70 5f 44 72 61 67 42 6f  |... "Wimp_DragBo|
000058e0  78 22 2c 2c 62 25 0d 1a  5e 05 e1 0d 1a 68 05 3a  |x",,b%..^....h.:|
000058f0  0d 1a 72 39 f4 20 50 52  4f 43 64 72 61 67 73 61  |..r9. PROCdragsa|
00005900  76 65 20 3a 20 49 6e 69  74 69 61 74 65 20 61 20  |ve : Initiate a |
00005910  73 61 76 65 20 61 66 74  65 72 20 44 72 61 67 44  |save after DragD|
00005920  6f 6e 65 20 65 76 65 6e  74 0d 1a 7c 26 dd f2 64  |one event..|&..d|
00005930  72 61 67 73 61 76 65 28  77 69 6e 25 2c 69 63 6f  |ragsave(win%,ico|
00005940  6e 25 2c 74 79 70 65 25  2c 73 69 7a 65 25 29 0d  |n%,type%,size%).|
00005950  1a 86 33 f2 67 65 74 70  74 72 70 6f 73 28 78 2c  |..3.getptrpos(x,|
00005960  79 2c 77 69 6e 2c 69 63  6f 6e 29 3a f4 20 47 65  |y,win,icon):. Ge|
00005970  74 20 64 72 61 67 20 74  6f 20 6c 6f 63 61 74 69  |t drag to locati|
00005980  6f 6e 0d 1a 90 2a 66 24  3d a4 6c 65 61 66 6e 61  |on...*f$=.leafna|
00005990  6d 65 28 a4 67 65 74 69  63 6f 6e 74 65 78 74 28  |me(.geticontext(|
000059a0  77 69 6e 25 2c 69 63 6f  6e 25 29 29 0d 1a 9a 17  |win%,icon%))....|
000059b0  21 62 25 3d 28 34 38 2b  a9 28 66 24 29 29 20 80  |!b%=(48+.(f$)) .|
000059c0  20 ac 33 0d 1a a4 38 62  25 21 31 32 3d 30 3a 62  | .3...8b%!12=0:b|
000059d0  25 21 31 36 3d 31 3a 62  25 21 32 30 3d 77 69 6e  |%!16=1:b%!20=win|
000059e0  3a 62 25 21 32 34 3d 69  63 6f 6e 3a 62 25 21 32  |:b%!24=icon:b%!2|
000059f0  38 3d 78 3a 62 25 21 33  32 3d 79 0d 1a ae 27 62  |8=x:b%!32=y...'b|
00005a00  25 21 33 36 3d 73 69 7a  65 25 3a 62 25 21 34 30  |%!36=size%:b%!40|
00005a10  3d 74 79 70 65 25 3a 24  28 62 25 2b 34 34 29 3d  |=type%:$(b%+44)=|
00005a20  66 24 0d 1a b8 28 c8 99  20 22 57 69 6d 70 5f 53  |f$...(.. "Wimp_S|
00005a30  65 6e 64 4d 65 73 73 61  67 65 22 2c 31 38 2c 62  |endMessage",18,b|
00005a40  25 2c 77 69 6e 2c 69 63  6f 6e 0d 1a c2 05 e1 0d  |%,win,icon......|
00005a50  1a cc 05 3a 0d 1a d6 37  f4 20 2a 2a 2a 2a 2a 2a  |...:...7. ******|
00005a60  2a 2a 20 21 48 65 6c 70  20 72 65 73 70 6f 6e 73  |** !Help respons|
00005a70  69 76 65 20 72 6f 75 74  69 6e 65 73 20 2a 2a 2a  |ive routines ***|
00005a80  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 0d 1a e0 05 3a  |***********....:|
00005a90  0d 1a ea 38 f4 20 50 52  4f 43 72 65 61 64 68 65  |...8. PROCreadhe|
00005aa0  6c 70 20 3a 20 72 65 61  64 20 68 65 6c 70 20 66  |lp : read help f|
00005ab0  72 6f 6d 20 61 70 70 6c  69 63 61 74 69 6f 6e 20  |rom application |
00005ac0  61 6e 64 20 73 65 6e 64  0d 1a f4 2d f4 20 50 52  |and send...-. PR|
00005ad0  4f 43 73 65 6e 64 68 65  6c 70 20 3a 20 73 65 6e  |OCsendhelp : sen|
00005ae0  64 20 68 65 6c 70 20 74  6f 20 61 70 70 6c 69 63  |d help to applic|
00005af0  61 74 69 6f 6e 0d 1a fe  1f f4 20 5c 53 20 66 6f  |ation..... \S fo|
00005b00  72 20 22 43 6c 69 63 6b  20 53 45 4c 45 43 54 20  |r "Click SELECT |
00005b10  74 6f 20 22 0d 1b 08 29  f4 20 5c 52 20 66 6f 72  |to "...). \R for|
00005b20  20 22 4d 6f 76 65 20 74  68 65 20 70 6f 69 6e 74  | "Move the point|
00005b30  65 72 20 72 69 67 68 74  20 74 6f 20 22 0d 1b 12  |er right to "...|
00005b40  1f f4 20 5c 41 20 66 6f  72 20 22 43 6c 69 63 6b  |.. \A for "Click|
00005b50  20 41 44 4a 55 53 54 20  74 6f 20 22 0d 1b 1c 1b  | ADJUST to "....|
00005b60  f4 20 5c 54 20 66 6f 72  20 22 54 68 69 73 20 69  |. \T for "This i|
00005b70  73 20 74 68 65 20 22 0d  1b 26 31 f4 20 5c 47 20  |s the "..&1. \G |
00005b80  66 6f 72 20 22 54 68 69  73 20 6f 70 74 69 6f 6e  |for "This option|
00005b90  20 69 73 20 67 72 65 79  65 64 20 6f 75 74 20 62  | is greyed out b|
00005ba0  65 63 61 75 73 65 20 22  0d 1b 30 1e f4 20 5c 57  |ecause "..0.. \W|
00005bb0  20 66 6f 72 20 22 54 68  69 73 20 77 69 6e 64 6f  | for "This windo|
00005bc0  77 20 69 73 20 22 0d 1b  3a 1e f4 20 5c 44 20 66  |w is "..:.. \D f|
00005bd0  6f 72 20 22 44 72 61 67  20 53 45 4c 45 43 54 20  |or "Drag SELECT |
00005be0  74 6f 20 22 0d 1b 44 1e  f4 20 5c 64 20 66 6f 72  |to "..D.. \d for|
00005bf0  20 22 44 72 61 67 20 41  44 4a 55 53 54 20 74 6f  | "Drag ADJUST to|
00005c00  20 22 0d 1b 4e 15 f4 20  5c 77 20 66 6f 72 20 22  | "..N.. \w for "|
00005c10  77 69 6e 64 6f 77 22 0d  1b 58 15 f4 20 5c 73 20  |window"..X.. \s |
00005c20  66 6f 72 20 22 53 45 4c  45 43 54 22 0d 1b 62 15  |for "SELECT"..b.|
00005c30  f4 20 5c 61 20 66 6f 72  20 22 41 44 4a 55 53 54  |. \a for "ADJUST|
00005c40  22 0d 1b 6c 13 f4 20 7c  4d 20 66 6f 72 20 72 65  |"..l.. |M for re|
00005c50  74 75 72 6e 0d 1b 76 21  f4 20 a4 53 74 72 69 6e  |turn..v!. .Strin|
00005c60  67 24 a4 20 74 6f 20 69  6e 63 6c 75 64 65 20 73  |g$. to include s|
00005c70  74 72 69 6e 67 0d 1b 80  29 f4 20 3e 20 70 72 65  |tring...). > pre|
00005c80  66 69 78 20 74 6f 20 6c  6f 6f 6b 20 75 70 20 69  |fix to look up i|
00005c90  6e 20 6d 65 73 73 61 67  65 20 66 69 6c 65 0d 1b  |n message file..|
00005ca0  8a 3e f4 20 4d 65 6e 75  20 68 65 6c 70 20 69 63  |.>. Menu help ic|
00005cb0  6f 6e 73 20 77 69 6c 6c  20 62 65 20 73 65 61 72  |ons will be sear|
00005cc0  63 68 65 64 20 61 73 20  48 4d 3c 6d 65 6e 75 73  |ched as HM<menus|
00005cd0  74 72 69 6e 67 3e 2c 20  77 69 74 68 0d 1b 94 1e  |tring>, with....|
00005ce0  f4 20 73 70 61 63 65 73  20 72 65 70 6c 61 63 65  |. spaces replace|
00005cf0  64 20 77 69 74 68 20 5f  27 73 0d 1b 9e 2f f4 20  |d with _'s.../. |
00005d00  4e 42 20 69 66 20 6e 6f  20 66 75 6c 6c 20 73 74  |NB if no full st|
00005d10  6f 70 20 74 68 65 6e 20  6f 6e 65 20 77 69 6c 6c  |op then one will|
00005d20  20 62 65 20 61 64 64 65  64 0d 1b a8 17 f4 20 46  | be added..... F|
00005d30  6f 72 6d 61 74 20 66 6f  72 20 68 65 6c 70 20 3a  |ormat for help :|
00005d40  0d 1b b2 28 f4 20 20 7b  20 77 69 6e 64 6f 77 2c  |...(.  { window,|
00005d50  68 65 6c 70 20 6d 65 73  73 61 67 65 20 66 6f 72  |help message for|
00005d60  20 6e 6f 20 69 63 6f 6e  0d 1b bc 2a f4 20 20 20  | no icon...*.   |
00005d70  20 7b 20 69 63 6f 6e 20  6e 75 6d 62 65 72 2c 20  | { icon number, |
00005d80  6d 65 73 73 61 67 65 20  7d 20 72 65 70 65 61 74  |message } repeat|
00005d90  65 64 0d 1b c6 11 f4 20  20 7d 20 72 65 70 65 61  |ed.....  } repea|
00005da0  74 65 64 0d 1b d0 2a f4  20 20 7b 20 2d 32 2c 20  |ted...*.  { -2, |
00005db0  7b 69 63 6f 6e 62 61 72  20 6d 65 73 73 61 67 65  |{iconbar message|
00005dc0  7d 20 7d 20 62 79 20 63  68 6f 69 63 65 0d 1b da  |} } by choice...|
00005dd0  13 f4 20 20 2d 31 2c 2d  31 20 74 6f 20 65 6e 64  |..  -1,-1 to end|
00005de0  0d 1b e4 2f f4 20 4e 42  20 77 69 6e 64 6f 77 20  |.../. NB window |
00005df0  73 75 62 6d 65 6e 75 73  20 6d 75 73 74 20 68 61  |submenus must ha|
00005e00  76 65 20 68 65 6c 70 20  73 74 72 69 6e 67 73 0d  |ve help strings.|
00005e10  1b ee 1c f4 20 46 6f 72  6d 61 74 20 66 6f 72 20  |.... Format for |
00005e20  6d 65 6e 75 20 68 65 6c  70 20 3a 0d 1b f8 3c f4  |menu help :...<.|
00005e30  20 20 7b 20 6d 65 6e 75  2c 20 2d 31 2c 2d 31 2c  |  { menu, -1,-1,|
00005e40  2d 31 20 6f 72 20 6d 65  6e 75 2c 20 2d 31 2c 30  |-1 or menu, -1,0|
00005e50  2c 68 65 6c 70 20 66 6f  72 20 61 6c 6c 20 74 68  |,help for all th|
00005e60  65 20 69 74 65 6d 73 0d  1c 02 1e f4 20 20 20 20  |e items.....    |
00005e70  7b 20 6f 70 74 31 2c 6f  70 74 32 2c 6f 70 74 33  |{ opt1,opt2,opt3|
00005e80  2c 68 65 6c 70 0d 1c 0c  27 f4 20 20 20 6f 72 20  |,help...'.   or |
00005e90  2d 31 2c 73 74 72 69 6e  67 2c 2d 31 2c 68 65 6c  |-1,string,-1,hel|
00005ea0  70 20 7d 20 72 65 70 65  61 74 65 64 0d 1c 16 11  |p } repeated....|
00005eb0  f4 20 20 7d 20 72 65 70  65 61 74 65 64 0d 1c 20  |.  } repeated.. |
00005ec0  12 f4 20 20 2d 32 2c 2d  32 2c 2d 32 2c 2d 32 0d  |..  -2,-2,-2,-2.|
00005ed0  1c 2a 1b dd f2 72 65 61  64 68 65 6c 70 28 77 69  |.*...readhelp(wi|
00005ee0  6e 2c 69 63 6f 6e 2c 74  6f 29 0d 1c 34 38 ea 20  |n,icon,to)..48. |
00005ef0  6c 77 69 6e 2c 76 61 6c  2c 68 65 6c 70 24 2c 66  |lwin,val,help$,f|
00005f00  6f 75 6e 64 2c 61 24 2c  6d 24 2c 6d 32 24 2c 6d  |ound,a$,m$,m2$,m|
00005f10  68 24 3a 66 6f 75 6e 64  3d a3 3a 6c 77 69 6e 3d  |h$:found=.:lwin=|
00005f20  2d 31 0d 1c 3e 05 f5 0d  1c 48 10 20 f3 20 76 61  |-1..>....H. . va|
00005f30  6c 2c 68 65 6c 70 24 0d  1c 52 1c 20 e7 20 76 61  |l,help$..R. . va|
00005f40  6c 3e 28 31 3c 3c 31 36  29 20 84 20 76 61 6c 3c  |l>(1<<16) . val<|
00005f50  30 20 8c 0d 1c 5c 12 20  20 e7 20 6c 77 69 6e 3d  |0 ...\.  . lwin=|
00005f60  77 69 6e 20 8c 0d 1c 66  1f 20 20 20 76 61 6c 3d  |win ...f.   val=|
00005f70  69 63 6f 6e 3a 68 65 6c  70 24 3d 22 22 3a 6d 32  |icon:help$="":m2|
00005f80  24 3d 6d 24 0d 1c 70 07  20 20 cc 0d 1c 7a 18 20  |$=m$..p.  ...z. |
00005f90  20 20 6c 77 69 6e 3d 76  61 6c 3a 6d 24 3d 68 65  |  lwin=val:m$=he|
00005fa0  6c 70 24 0d 1c 84 07 20  20 cd 0d 1c 8e 06 20 cd  |lp$....  ..... .|
00005fb0  0d 1c 98 1c 20 e7 20 76  61 6c 3d 69 63 6f 6e 20  |.... . val=icon |
00005fc0  80 20 6c 77 69 6e 3d 77  69 6e 20 8c 0d 1c a2 1c  |. lwin=win .....|
00005fd0  20 20 e7 20 69 63 6f 6e  3d 2d 31 20 84 20 68 65  |  . icon=-1 . he|
00005fe0  6c 70 24 3d 22 22 20 8c  0d 1c ac 26 20 20 20 f2  |lp$="" ....&   .|
00005ff0  73 65 6e 64 68 65 6c 70  28 a4 6d 73 67 74 65 78  |sendhelp(.msgtex|
00006000  74 28 6d 24 29 2b 22 7c  4d 22 2c 74 6f 29 0d 1c  |t(m$)+"|M",to)..|
00006010  b6 07 20 20 cc 0d 1c c0  39 20 20 20 6d 24 3d a4  |..  ....9   m$=.|
00006020  6d 73 67 74 65 78 74 28  6d 24 29 3a e7 20 a7 6d  |msgtext(m$):. .m|
00006030  24 2c 22 7c 4d 22 29 3e  30 20 8c 6d 24 3d c0 6d  |$,"|M")>0 .m$=.m|
00006040  24 2c a7 6d 24 2c 22 7c  4d 22 29 2d 31 29 0d 1c  |$,.m$,"|M")-1)..|
00006050  ca 36 20 20 20 f2 73 65  6e 64 68 65 6c 70 28 a4  |.6   .sendhelp(.|
00006060  6d 73 67 74 65 78 74 28  6d 24 29 2b 22 7c 4d 22  |msgtext(m$)+"|M"|
00006070  2b a4 6d 73 67 74 65 78  74 28 68 65 6c 70 24 29  |+.msgtext(help$)|
00006080  2c 74 6f 29 0d 1c d4 07  20 20 cd 0d 1c de 0d 20  |,to)....  ..... |
00006090  20 66 6f 75 6e 64 3d b9  0d 1c e8 06 20 cd 0d 1c  | found=..... ...|
000060a0  f2 1a fd 20 68 65 6c 70  24 3d 22 2d 31 22 20 84  |... help$="-1" .|
000060b0  20 66 6f 75 6e 64 3d b9  0d 1c fc 0f e7 20 ac 20  | found=...... . |
000060c0  66 6f 75 6e 64 20 8c 0d  1d 06 42 20 21 6d 65 73  |found ....B !mes|
000060d0  73 61 67 65 5f 62 75 66  66 65 72 25 3d 2d 31 3a  |sage_buffer%=-1:|
000060e0  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 21  |message_buffer%!|
000060f0  34 3d 2d 31 3a 6d 65 73  73 61 67 65 5f 62 75 66  |4=-1:message_buf|
00006100  66 65 72 25 21 38 3d 2d  31 0d 1d 10 36 20 c8 99  |fer%!8=-1...6 ..|
00006110  20 22 57 69 6d 70 5f 47  65 74 4d 65 6e 75 53 74  | "Wimp_GetMenuSt|
00006120  61 74 65 22 2c 31 2c 6d  65 73 73 61 67 65 5f 62  |ate",1,message_b|
00006130  75 66 66 65 72 25 2c 77  69 6e 2c 69 63 6f 6e 0d  |uffer%,win,icon.|
00006140  1d 1a 1d 20 e7 20 21 6d  65 73 73 61 67 65 5f 62  |... . !message_b|
00006150  75 66 66 65 72 25 3c 3e  2d 31 20 8c 0d 1d 24 40  |uffer%<>-1 ...$@|
00006160  20 20 76 61 6c 3d 62 25  3a 62 25 3d 6d 65 73 73  |  val=b%:b%=mess|
00006170  61 67 65 5f 62 75 66 66  65 72 25 3a 6d 68 24 3d  |age_buffer%:mh$=|
00006180  a4 64 65 63 6f 64 65 6d  65 6e 75 28 63 75 72 6d  |.decodemenu(curm|
00006190  65 6e 75 25 29 3a 62 25  3d 76 61 6c 0d 1d 2e 30  |enu%):b%=val...0|
000061a0  20 20 6d 24 3d 6d 68 24  3a c8 95 20 a7 6d 24 2c  |  m$=mh$:.. .m$,|
000061b0  22 20 22 29 3e 30 3a c1  6d 24 2c a7 6d 24 2c 22  |" ")>0:.m$,.m$,"|
000061c0  20 22 29 2c 31 29 3d 22  5f 22 3a ce 0d 1d 38 1e  | "),1)="_":...8.|
000061d0  20 20 68 65 6c 70 24 3d  a4 6d 73 67 74 6f 6b 65  |  help$=.msgtoke|
000061e0  6e 28 22 48 4d 22 2b 6d  24 29 0d 1d 42 18 20 20  |n("HM"+m$)..B.  |
000061f0  e7 20 68 65 6c 70 24 3c  3e 22 48 4d 22 2b 6d 24  |. help$<>"HM"+m$|
00006200  20 8c 0d 1d 4c 1a 20 20  20 f2 73 65 6e 64 68 65  | ...L.   .sendhe|
00006210  6c 70 28 68 65 6c 70 24  2c 74 6f 29 0d 1d 56 07  |lp(help$,to)..V.|
00006220  20 20 cc 0d 1d 60 08 20  20 20 f5 0d 1d 6a 1c 20  |  ...`.   ...j. |
00006230  20 20 20 f3 20 6d 24 2c  76 61 6c 2c 68 65 6c 70  |   . m$,val,help|
00006240  24 2c 68 65 6c 70 24 0d  1d 74 21 20 20 20 fd 20  |$,help$..t!   . |
00006250  a0 28 6d 24 29 3d 63 75  72 6d 65 6e 75 25 20 84  |.(m$)=curmenu% .|
00006260  20 6d 24 3d 22 2d 32 22  0d 1d 7e 13 20 20 20 e7  | m$="-2"..~.   .|
00006270  20 6d 24 3c 3e 22 2d 32  22 20 8c 0d 1d 88 12 20  | m$<>"-2" ..... |
00006280  20 20 20 e7 20 76 61 6c  3e 2d 31 20 8c 0d 1d 92  |   . val>-1 ....|
00006290  24 20 20 20 20 20 f2 73  65 6e 64 68 65 6c 70 28  |$     .sendhelp(|
000062a0  68 65 6c 70 24 2c 74 6f  29 3a 66 6f 75 6e 64 3d  |help$,to):found=|
000062b0  b9 0d 1d 9c 09 20 20 20  20 cc 0d 1d a6 0a 20 20  |.....    .....  |
000062c0  20 20 20 f5 0d 1d b0 1d  20 20 20 20 20 20 f3 20  |   .....      . |
000062d0  6c 77 69 6e 2c 6d 24 2c  76 61 6c 2c 68 65 6c 70  |lwin,m$,val,help|
000062e0  24 0d 1d ba 1f 20 20 20  20 20 20 e7 20 bb 28 6d  |$....      . .(m|
000062f0  24 29 3d 30 20 80 20 6d  24 3c 3e 22 30 22 20 8c  |$)=0 . m$<>"0" .|
00006300  0d 1d c4 30 20 20 20 20  20 20 20 e7 20 6d 68 24  |...0       . mh$|
00006310  3d 6d 24 20 8c f2 73 65  6e 64 68 65 6c 70 28 68  |=m$ ..sendhelp(h|
00006320  65 6c 70 24 2c 74 6f 29  3a 66 6f 75 6e 64 3d b9  |elp$,to):found=.|
00006330  0d 1d ce 0b 20 20 20 20  20 20 cc 0d 1d d8 57 20  |....      ....W |
00006340  20 20 20 20 20 20 e7 20  6c 77 69 6e 3d 6d 65 73  |      . lwin=mes|
00006350  73 61 67 65 5f 62 75 66  66 65 72 25 21 30 20 80  |sage_buffer%!0 .|
00006360  20 bb 28 6d 24 29 3d 6d  65 73 73 61 67 65 5f 62  | .(m$)=message_b|
00006370  75 66 66 65 72 25 21 34  20 80 20 76 61 6c 3d 6d  |uffer%!4 . val=m|
00006380  65 73 73 61 67 65 5f 62  75 66 66 65 72 25 21 38  |essage_buffer%!8|
00006390  20 8c 0d 1d e2 27 20 20  20 20 20 20 20 20 f2 73  | ....'        .s|
000063a0  65 6e 64 68 65 6c 70 28  68 65 6c 70 24 2c 74 6f  |endhelp(help$,to|
000063b0  29 3a 66 6f 75 6e 64 3d  b9 0d 1d ec 0c 20 20 20  |):found=.....   |
000063c0  20 20 20 20 cd 0d 1d f6  0b 20 20 20 20 20 20 cd  |    .....      .|
000063d0  0d 1e 00 29 20 20 20 20  20 fd 66 6f 75 6e 64 3d  |...)     .found=|
000063e0  b9 20 84 20 6c 77 69 6e  3d 2d 32 20 84 20 6c 77  |. . lwin=-2 . lw|
000063f0  69 6e 20 3e 26 38 30 30  30 0d 1e 0a 09 20 20 20  |in >&8000....   |
00006400  20 cd 0d 1e 14 08 20 20  20 cd 0d 1e 1e 07 20 20  | .....   .....  |
00006410  cd 0d 1e 28 06 20 cd 0d  1e 32 05 cd 0d 1e 3c 05  |...(. ...2....<.|
00006420  e1 0d 1e 46 2e dd f2 73  65 6e 64 68 65 6c 70 28  |...F...sendhelp(|
00006430  68 65 6c 70 24 2c 74 6f  29 3a 68 65 6c 70 24 3d  |help$,to):help$=|
00006440  a4 6d 73 67 74 65 78 74  28 68 65 6c 70 24 29 0d  |.msgtext(help$).|
00006450  1e 50 22 e7 20 c2 68 65  6c 70 24 2c 32 29 3c 3e  |.P". .help$,2)<>|
00006460  22 7c 4d 22 20 8c 68 65  6c 70 24 2b 3d 22 7c 4d  |"|M" .help$+="|M|
00006470  22 0d 1e 5a 0b ea 20 62  24 2c 63 24 0d 1e 64 1b  |"..Z.. b$,c$..d.|
00006480  68 65 6c 70 24 3d a4 73  75 62 73 74 76 61 72 73  |help$=.substvars|
00006490  28 68 65 6c 70 24 29 0d  1e 6e 15 c8 95 20 a7 68  |(help$)..n... .h|
000064a0  65 6c 70 24 2c 22 7c 4d  22 29 3e 30 0d 1e 78 34  |elp$,"|M")>0..x4|
000064b0  20 62 24 3d c0 68 65 6c  70 24 2c a7 68 65 6c 70  | b$=.help$,.help|
000064c0  24 2c 22 7c 4d 22 29 2d  31 29 3a 68 65 6c 70 24  |$,"|M")-1):help$|
000064d0  3d c1 68 65 6c 70 24 2c  a9 28 62 24 29 2b 33 29  |=.help$,.(b$)+3)|
000064e0  0d 1e 82 20 20 e7 20 a7  22 21 2e 3f 22 2c c2 62  |...  . ."!.?",.b|
000064f0  24 2c 31 29 29 3d 30 20  8c 62 24 2b 3d 22 2e 22  |$,1))=0 .b$+="."|
00006500  0d 1e 8c 10 20 63 24 2b  3d 62 24 2b 22 7c 4d 22  |.... c$+=b$+"|M"|
00006510  0d 1e 96 05 ce 0d 1e a0  30 62 25 21 31 32 3d 62  |........0b%!12=b|
00006520  25 21 38 3a 62 25 21 34  3d 74 6f 3a 62 25 21 31  |%!8:b%!4=to:b%!1|
00006530  36 3d 26 35 30 33 3a 24  28 62 25 2b 32 30 29 3d  |6=&503:$(b%+20)=|
00006540  63 24 2b bd 30 0d 1e aa  1a 62 25 21 30 3d 32 30  |c$+.0....b%!0=20|
00006550  2b 28 a9 28 63 24 29 2b  34 29 20 80 20 2d 34 0d  |+(.(c$)+4) . -4.|
00006560  1e b4 24 c8 99 20 22 57  69 6d 70 5f 53 65 6e 64  |..$.. "Wimp_Send|
00006570  4d 65 73 73 61 67 65 22  2c 31 37 2c 62 25 2c 62  |Message",17,b%,b|
00006580  25 21 34 0d 1e be 05 e1  0d 1e c8 05 3a 0d 1e d2  |%!4.........:...|
00006590  37 f4 20 2a 2a 2a 2a 2a  2a 2a 2a 20 4d 65 73 73  |7. ******** Mess|
000065a0  61 67 65 54 72 61 6e 73  20 69 6e 74 65 72 66 61  |ageTrans interfa|
000065b0  63 65 20 72 6f 75 74 69  6e 65 73 20 2a 2a 2a 2a  |ce routines ****|
000065c0  2a 2a 2a 2a 0d 1e dc 05  3a 0d 1e e6 3c f4 20 50  |****....:...<. P|
000065d0  52 4f 43 6f 70 65 6e 6d  65 73 73 61 67 65 73 20  |ROCopenmessages |
000065e0  20 3a 20 6f 70 65 6e 20  61 20 4d 65 73 73 61 67  | : open a Messag|
000065f0  65 54 72 61 6e 73 20 66  69 6c 65 20 66 6f 72 20  |eTrans file for |
00006600  69 6e 70 75 74 0d 1e f0  33 f4 20 50 52 4f 43 63  |input...3. PROCc|
00006610  6c 6f 73 65 6d 65 73 73  61 67 65 73 20 3a 20 63  |losemessages : c|
00006620  6c 6f 73 65 20 61 20 4d  65 73 73 61 67 65 54 72  |lose a MessageTr|
00006630  61 6e 73 20 66 69 6c 65  0d 1e fa 18 dd f2 6f 70  |ans file......op|
00006640  65 6e 6d 65 73 73 61 67  65 73 3a ea 20 66 2c 6c  |enmessages:. f,l|
00006650  0d 1f 04 38 e7 20 6d 73  67 62 75 66 66 65 72 25  |...8. msgbuffer%|
00006660  3c 3e 2d 31 20 8c 85 20  26 38 30 33 2c 22 4d 65  |<>-1 .. &803,"Me|
00006670  73 73 61 67 65 20 66 69  6c 65 20 61 6c 72 65 61  |ssage file alrea|
00006680  64 79 20 6f 70 65 6e 22  0d 1f 0e 3a c8 99 20 22  |dy open"...:.. "|
00006690  4d 65 73 73 61 67 65 54  72 61 6e 73 5f 46 69 6c  |MessageTrans_Fil|
000066a0  65 49 6e 66 6f 22 2c 2c  41 70 70 64 69 72 24 2b  |eInfo",,Appdir$+|
000066b0  22 2e 4d 65 73 73 61 67  65 73 22 20 b8 20 66 2c  |".Messages" . f,|
000066c0  2c 6c 0d 1f 18 34 e7 20  28 66 20 80 31 29 3d 31  |,l...4. (f .1)=1|
000066d0  20 8c 6d 73 67 62 75 66  66 65 72 32 25 3d 30 20  | .msgbuffer2%=0 |
000066e0  8b 6d 73 67 62 75 66 66  65 72 32 25 3d a4 63 6c  |.msgbuffer2%=.cl|
000066f0  61 69 6d 28 6c 29 0d 1f  22 48 e7 20 6d 73 67 62  |aim(l).."H. msgb|
00006700  75 66 66 65 72 32 25 3d  2d 31 20 8c 85 20 26 38  |uffer2%=-1 .. &8|
00006710  30 33 2c 22 4e 6f 20 72  6f 6f 6d 20 66 6f 72 20  |03,"No room for |
00006720  73 65 63 6f 6e 64 61 72  79 20 4d 65 73 73 61 67  |secondary Messag|
00006730  65 54 72 61 6e 73 20 62  75 66 66 65 72 22 0d 1f  |eTrans buffer"..|
00006740  2c 71 6d 73 67 62 75 66  66 65 72 25 3d a4 63 6c  |,qmsgbuffer%=.cl|
00006750  61 69 6d 28 31 36 29 3a  e7 20 6d 73 67 62 75 66  |aim(16):. msgbuf|
00006760  66 65 72 25 3d 2d 31 20  8c f2 72 65 6c 65 61 73  |fer%=-1 ..releas|
00006770  65 28 6d 73 67 62 75 66  66 65 72 32 25 29 3a 85  |e(msgbuffer2%):.|
00006780  20 26 38 30 33 2c 22 4e  6f 20 72 6f 6f 6d 20 66  | &803,"No room f|
00006790  6f 72 20 70 72 69 6d 61  72 79 20 4d 65 73 73 61  |or primary Messa|
000067a0  67 65 54 72 61 6e 73 20  62 75 66 66 65 72 22 0d  |geTrans buffer".|
000067b0  1f 36 49 c8 99 20 22 4d  65 73 73 61 67 65 54 72  |.6I.. "MessageTr|
000067c0  61 6e 73 5f 4f 70 65 6e  46 69 6c 65 22 2c 6d 73  |ans_OpenFile",ms|
000067d0  67 62 75 66 66 65 72 25  2c 41 70 70 64 69 72 24  |gbuffer%,Appdir$|
000067e0  2b 22 2e 4d 65 73 73 61  67 65 73 22 2c 6d 73 67  |+".Messages",msg|
000067f0  62 75 66 66 65 72 32 25  0d 1f 40 05 e1 0d 1f 4a  |buffer2%..@....J|
00006800  13 dd f2 63 6c 6f 73 65  6d 65 73 73 61 67 65 73  |...closemessages|
00006810  0d 1f 54 07 ea 20 85 0d  1f 5e 1e ee 20 85 20 ea  |..T.. ...^.. . .|
00006820  3a ef 34 3a f6 3a f1 22  20 61 74 20 22 3b 9e 3a  |:.4:.:." at ";.:|
00006830  47 3d a5 3a e1 0d 1f 68  15 e7 20 6d 73 67 62 75  |G=.:...h.. msgbu|
00006840  66 66 65 72 25 3e 2d 31  20 8c 0d 1f 72 2c 20 c8  |ffer%>-1 ...r, .|
00006850  99 20 22 58 4d 65 73 73  61 67 65 54 72 61 6e 73  |. "XMessageTrans|
00006860  5f 43 6c 6f 73 65 46 69  6c 65 22 2c 6d 73 67 62  |_CloseFile",msgb|
00006870  75 66 66 65 72 25 0d 1f  7c 2f 20 f2 72 65 6c 65  |uffer%..|/ .rele|
00006880  61 73 65 28 6d 73 67 62  75 66 66 65 72 25 29 3a  |ase(msgbuffer%):|
00006890  f2 72 65 6c 65 61 73 65  28 6d 73 67 62 75 66 66  |.release(msgbuff|
000068a0  65 72 32 25 29 0d 1f 86  05 cd 0d 1f 90 05 e1 0d  |er2%)...........|
000068b0  1f 9a 05 3a 0d 1f a4 39  f4 20 46 4e 6d 73 67 74  |...:...9. FNmsgt|
000068c0  6f 6b 65 6e 20 20 20 20  20 20 20 20 3a 20 74 72  |oken        : tr|
000068d0  61 6e 73 6c 61 74 65 20  61 20 74 6f 6b 65 6e 20  |anslate a token |
000068e0  69 6e 74 6f 20 61 20 73  74 72 69 6e 67 0d 1f ae  |into a string...|
000068f0  42 f4 20 46 4e 6d 73 67  74 65 78 74 20 20 20 20  |B. FNmsgtext    |
00006900  20 20 20 20 20 3a 20 74  72 61 6e 73 6c 61 74 65  |     : translate|
00006910  20 74 65 78 74 20 74 6f  20 61 20 74 6f 6b 65 6e  | text to a token|
00006920  20 69 66 20 70 72 65 66  69 78 20 69 73 20 3e 0d  | if prefix is >.|
00006930  1f b8 2a dd a4 6d 73 67  74 6f 6b 65 6e 28 74 24  |..*..msgtoken(t$|
00006940  29 3a ea 20 73 31 24 2c  73 32 24 2c 73 33 24 2c  |):. s1$,s2$,s3$,|
00006950  61 24 2c 6c 65 6e 25 2c  66 0d 1f c2 18 e7 20 6d  |a$,len%,f..... m|
00006960  73 67 62 75 66 66 65 72  25 3d 2d 31 20 8c 3d 74  |sgbuffer%=-1 .=t|
00006970  24 0d 1f cc 31 61 24 3d  c1 74 24 2c a7 74 24 2b  |$...1a$=.t$,.t$+|
00006980  22 3a 22 2c 22 3a 22 29  2b 31 29 3a 74 24 3d c0  |":",":")+1):t$=.|
00006990  74 24 2c a7 74 24 2b 22  3a 22 2c 22 3a 22 29 2d  |t$,.t$+":",":")-|
000069a0  31 29 0d 1f d6 1b 73 31  24 3d c0 61 24 2c a7 61  |1)....s1$=.a$,.a|
000069b0  24 2b 22 3a 22 2c 22 3a  22 29 2d 31 29 0d 1f e0  |$+":",":")-1)...|
000069c0  13 e7 20 c0 73 31 24 2c  31 29 3d 22 7c 22 20 8c  |.. .s1$,1)="|" .|
000069d0  0d 1f ea 1d 20 73 31 24  3d c1 61 24 2c 32 29 3a  |.... s1$=.a$,2):|
000069e0  73 32 24 3d 22 22 3a 73  33 24 3d 22 22 0d 1f f4  |s2$="":s3$=""...|
000069f0  05 cc 0d 1f fe 2d 20 61  24 3d c1 61 24 2c a9 28  |.....- a$=.a$,.(|
00006a00  73 31 24 29 2b 32 29 3a  73 32 24 3d c0 61 24 2c  |s1$)+2):s2$=.a$,|
00006a10  a7 61 24 2b 22 3a 22 2c  22 3a 22 29 2d 31 29 0d  |.a$+":",":")-1).|
00006a20  20 08 38 20 e7 20 c0 73  32 24 2c 31 29 3d 22 7c  | .8 . .s2$,1)="||
00006a30  22 20 8c 73 32 24 3d c1  61 24 2c 32 29 3a 73 33  |" .s2$=.a$,2):s3|
00006a40  24 3d 22 22 20 8b 73 33  24 3d c1 61 24 2c a9 28  |$="" .s3$=.a$,.(|
00006a50  73 32 24 29 2b 32 29 0d  20 12 05 cd 0d 20 1c 57  |s2$)+2). .... .W|
00006a60  c8 99 20 22 58 4d 65 73  73 61 67 65 54 72 61 6e  |.. "XMessageTran|
00006a70  73 5f 4c 6f 6f 6b 75 70  22 2c 6d 73 67 62 75 66  |s_Lookup",msgbuf|
00006a80  66 65 72 25 2c 74 24 2c  6d 65 73 73 61 67 65 5f  |fer%,t$,message_|
00006a90  62 75 66 66 65 72 25 2c  32 35 36 2c 73 31 24 2c  |buffer%,256,s1$,|
00006aa0  73 32 24 2c 73 33 24 20  b8 20 2c 2c 2c 6c 65 6e  |s2$,s3$ . ,,,len|
00006ab0  25 3b 66 0d 20 26 2c e7  20 28 66 20 80 31 29 3d  |%;f. &,. (f .1)=|
00006ac0  31 20 8c 3d 74 24 20 8b  6d 65 73 73 61 67 65 5f  |1 .=t$ .message_|
00006ad0  62 75 66 66 65 72 25 3f  6c 65 6e 25 3d 31 33 0d  |buffer%?len%=13.|
00006ae0  20 30 21 3d a4 73 75 62  73 74 76 61 72 73 28 24  | 0!=.substvars($|
00006af0  6d 65 73 73 61 67 65 5f  62 75 66 66 65 72 25 29  |message_buffer%)|
00006b00  0d 20 3a 11 dd a4 6d 73  67 74 65 78 74 28 61 24  |. :...msgtext(a$|
00006b10  29 0d 20 44 26 e7 20 c0  61 24 2c 31 29 3d 22 3e  |). D&. .a$,1)=">|
00006b20  22 20 8c 61 24 3d a4 6d  73 67 74 6f 6b 65 6e 28  |" .a$=.msgtoken(|
00006b30  c1 61 24 2c 32 29 29 0d  20 4e 07 3d 61 24 0d 20  |.a$,2)). N.=a$. |
00006b40  58 05 3a 0d 20 62 37 f4  20 2a 2a 2a 2a 2a 2a 2a  |X.:. b7. *******|
00006b50  2a 20 53 74 72 69 6e 67  20 6d 61 6e 69 70 75 6c  |* String manipul|
00006b60  61 74 69 6f 6e 20 72 6f  75 74 69 6e 65 73 20 2a  |ation routines *|
00006b70  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 0d 20 6c 05 3a 0d  |**********. l.:.|
00006b80  20 76 38 f4 20 46 4e 73  74 72 69 6e 67 30 20 3a  | v8. FNstring0 :|
00006b90  20 52 65 74 75 72 6e 20  30 2d 74 65 72 6d 69 6e  | Return 0-termin|
00006ba0  61 74 65 64 20 73 74 72  69 6e 67 20 61 74 20 6c  |ated string at l|
00006bb0  6f 63 61 74 69 6f 6e 0d  20 80 22 dd a4 73 74 72  |ocation. ."..str|
00006bc0  69 6e 67 30 28 61 25 29  3a ea 20 61 24 3a e7 20  |ing0(a%):. a$:. |
00006bd0  61 25 3d 30 20 8c 3d 22  22 0d 20 8a 2c c8 95 3f  |a%=0 .="". .,..?|
00006be0  61 25 3e 33 31 20 80 a9  28 61 24 29 3c 32 35 35  |a%>31 ..(a$)<255|
00006bf0  3a 61 24 3d 61 24 2b bd  3f 61 25 3a 61 25 3d 61  |:a$=a$+.?a%:a%=a|
00006c00  25 2b 31 3a ce 0d 20 94  07 3d 61 24 0d 20 9e 05  |%+1:.. ..=a$. ..|
00006c10  3a 0d 20 a8 37 f4 20 46  4e 6c 6f 77 65 72 20 20  |:. .7. FNlower  |
00006c20  20 20 20 20 20 3a 20 52  65 74 75 72 6e 20 67 69  |     : Return gi|
00006c30  76 65 6e 20 73 74 72 69  6e 67 20 69 6e 20 6c 6f  |ven string in lo|
00006c40  77 65 72 20 63 61 73 65  0d 20 b2 37 f4 20 46 4e  |wer case. .7. FN|
00006c50  75 70 70 65 72 20 20 20  20 20 20 20 3a 20 52 65  |upper       : Re|
00006c60  74 75 72 6e 20 67 69 76  65 6e 20 73 74 72 69 6e  |turn given strin|
00006c70  67 20 69 6e 20 75 70 70  65 72 20 63 61 73 65 0d  |g in upper case.|
00006c80  20 bc 38 f4 20 46 4e 74  69 64 79 20 20 20 20 20  | .8. FNtidy     |
00006c90  20 20 20 3a 20 52 65 74  75 72 6e 20 67 69 76 65  |   : Return give|
00006ca0  6e 20 73 74 72 69 6e 67  20 69 6e 20 74 69 64 79  |n string in tidy|
00006cb0  20 66 6f 72 6d 61 74 0d  20 c6 40 f4 20 46 4e 73  | format. .@. FNs|
00006cc0  74 72 69 70 73 70 61 63  65 73 20 3a 20 52 65 6d  |tripspaces : Rem|
00006cd0  6f 76 65 20 73 70 61 63  65 73 20 66 72 6f 6d 20  |ove spaces from |
00006ce0  73 74 61 72 74 20 61 6e  64 20 65 6e 64 20 6f 66  |start and end of|
00006cf0  20 73 74 72 69 6e 67 0d  20 d0 19 dd a4 6c 6f 77  | string. ....low|
00006d00  65 72 28 61 24 29 3a ea  20 63 24 2c 62 24 2c 49  |er(a$):. c$,b$,I|
00006d10  0d 20 da 0e e3 49 3d 31  b8 a9 28 61 24 29 0d 20  |. ...I=1..(a$). |
00006d20  e4 30 63 24 3d c1 61 24  2c 49 2c 31 29 3a e7 20  |.0c$=.a$,I,1):. |
00006d30  63 24 3e 3d 22 41 22 80  63 24 3c 3d 22 5a 22 8c  |c$>="A".c$<="Z".|
00006d40  63 24 3d bd 28 97 28 63  24 29 2b 33 32 29 0d 20  |c$=.(.(c$)+32). |
00006d50  ee 10 62 24 2b 3d 63 24  3a ed 3a 3d 62 24 0d 20  |..b$+=c$:.:=b$. |
00006d60  f8 19 dd a4 75 70 70 65  72 28 61 24 29 3a ea 20  |....upper(a$):. |
00006d70  63 24 2c 62 24 2c 49 0d  21 02 0e e3 49 3d 31 b8  |c$,b$,I.!...I=1.|
00006d80  a9 28 61 24 29 0d 21 0c  30 63 24 3d c1 61 24 2c  |.(a$).!.0c$=.a$,|
00006d90  49 2c 31 29 3a e7 20 63  24 3e 3d 22 61 22 80 63  |I,1):. c$>="a".c|
00006da0  24 3c 3d 22 7a 22 8c 63  24 3d bd 28 97 28 63 24  |$<="z".c$=.(.(c$|
00006db0  29 2d 33 32 29 0d 21 16  10 62 24 2b 3d 63 24 3a  |)-32).!..b$+=c$:|
00006dc0  ed 3a 3d 62 24 0d 21 20  1c dd a4 74 69 64 79 28  |.:=b$.! ...tidy(|
00006dd0  61 24 29 3a ea 20 63 61  70 2c 62 24 2c 49 2c 63  |a$):. cap,b$,I,c|
00006de0  24 0d 21 2a 09 63 61 70  3d b9 0d 21 34 0e e3 49  |$.!*.cap=..!4..I|
00006df0  3d 31 b8 a9 28 61 24 29  0d 21 3e 32 20 62 24 3d  |=1..(a$).!>2 b$=|
00006e00  c1 61 24 2c 49 2c 31 29  3a e7 20 62 24 3e 3d 22  |.a$,I,1):. b$>="|
00006e10  61 22 80 62 24 3c 3d 22  7a 22 20 8c 62 24 3d bd  |a".b$<="z" .b$=.|
00006e20  28 97 28 62 24 29 2d 33  32 29 0d 21 48 23 20 e7  |(.(b$)-32).!H# .|
00006e30  20 28 62 24 3c 22 41 22  20 84 62 24 3e 22 5a 22  | (b$<"A" .b$>"Z"|
00006e40  29 20 80 20 62 24 3c 3e  22 27 22 20 8c 0d 21 52  |) . b$<>"'" ..!R|
00006e50  0b 20 20 63 61 70 3d b9  0d 21 5c 06 20 cc 0d 21  |.  cap=..!\. ..!|
00006e60  66 2e 20 20 e7 20 63 61  70 3d a3 20 80 20 62 24  |f.  . cap=. . b$|
00006e70  3c 3e 22 27 22 20 8c 62  24 3d bd 28 97 28 62 24  |<>"'" .b$=.(.(b$|
00006e80  29 2b 33 32 29 20 8b 63  61 70 3d a3 0d 21 70 0d  |)+32) .cap=..!p.|
00006e90  20 cd 3a 63 24 2b 3d 62  24 0d 21 7a 09 ed 3a 3d  | .:c$+=b$.!z..:=|
00006ea0  63 24 0d 21 84 15 dd a4  73 74 72 69 70 73 70 61  |c$.!....stripspa|
00006eb0  63 65 73 28 66 24 29 0d  21 8e 27 c8 95 20 c2 66  |ces(f$).!.'.. .f|
00006ec0  24 2c 31 29 3d 22 20 22  20 84 20 c2 66 24 2c 31  |$,1)=" " . .f$,1|
00006ed0  29 3d bd 39 3a 66 24 3d  c0 66 24 29 3a ce 0d 21  |)=.9:f$=.f$):..!|
00006ee0  98 29 c8 95 20 c0 66 24  2c 31 29 3d 22 20 22 20  |.).. .f$,1)=" " |
00006ef0  84 20 c0 66 24 2c 31 29  3d bd 39 3a 66 24 3d c1  |. .f$,1)=.9:f$=.|
00006f00  66 24 2c 32 29 3a ce 0d  21 a2 07 3d 66 24 0d 21  |f$,2):..!..=f$.!|
00006f10  ac 05 3a 0d 21 b6 31 f4  20 46 4e 73 75 62 73 74  |..:.!.1. FNsubst|
00006f20  76 61 72 73 20 20 3a 20  53 75 62 73 74 69 74 75  |vars  : Substitu|
00006f30  74 65 20 73 74 72 69 6e  67 20 66 6f 72 20 a4 76  |te string for .v|
00006f40  61 72 24 a4 0d 21 c0 3d  f4 20 46 4e 73 75 62 73  |ar$..!.=. FNsubs|
00006f50  74 76 61 72 73 70 20 3a  20 53 75 62 73 74 69 74  |tvarsp : Substit|
00006f60  75 74 65 20 73 74 72 69  6e 67 20 66 6f 72 20 a4  |ute string for .|
00006f70  76 61 72 24 a4 20 77 69  74 68 20 70 72 65 66 69  |var$. with prefi|
00006f80  78 0d 21 ca 38 f4 20 46  4e 67 73 74 72 61 6e 73  |x.!.8. FNgstrans|
00006f90  20 20 20 20 3a 20 50 65  72 66 6f 72 6d 20 47 53  |    : Perform GS|
00006fa0  54 72 61 6e 73 20 6f 6e  20 73 74 72 69 6e 67 20  |Trans on string |
00006fb0  73 70 65 63 69 66 69 65  64 0d 21 d4 17 dd a4 73  |specified.!....s|
00006fc0  75 62 73 74 76 61 72 73  70 28 61 24 2c 63 24 29  |ubstvarsp(a$,c$)|
00006fd0  0d 21 de 19 ea 20 62 24  2c 64 24 3a ea 20 85 3a  |.!... b$,d$:. .:|
00006fe0  ee 20 85 20 ea 3a 3d 61  24 0d 21 e8 11 c8 95 20  |. . .:=a$.!.... |
00006ff0  a7 61 24 2c 22 a4 22 29  3e 30 0d 21 f2 2a 20 62  |.a$,".")>0.!.* b|
00007000  24 3d c1 61 24 2c a7 61  24 2c 22 a4 22 29 2b 31  |$=.a$,.a$,".")+1|
00007010  29 3a 62 24 3d c0 62 24  2c a7 62 24 2c 22 a4 22  |):b$=.b$,.b$,"."|
00007020  29 2d 31 29 0d 21 fc 2e  20 64 24 3d 63 24 2b 62  |)-1).!.. d$=c$+b|
00007030  24 3a e7 20 c2 64 24 2c  31 29 3c 3e 22 24 22 20  |$:. .d$,1)<>"$" |
00007040  8c 64 24 3d 22 53 54 52  24 28 22 2b 64 24 2b 22  |.d$="STR$("+d$+"|
00007050  29 22 0d 22 06 33 20 61  24 3d c0 61 24 2c a7 61  |)".".3 a$=.a$,.a|
00007060  24 2c 22 a4 22 29 2d 31  29 2b a0 28 64 24 29 2b  |$,".")-1)+.(d$)+|
00007070  c1 61 24 2c a7 61 24 2c  22 a4 22 29 2b a9 28 62  |.a$,.a$,".")+.(b|
00007080  24 29 2b 32 29 0d 22 10  05 ce 0d 22 1a 07 3d 61  |$)+2)."...."..=a|
00007090  24 0d 22 24 13 dd a4 73  75 62 73 74 76 61 72 73  |$."$...substvars|
000070a0  28 61 24 29 0d 22 2e 19  ea 20 62 24 2c 64 24 3a  |(a$)."... b$,d$:|
000070b0  ea 20 85 3a ee 20 85 20  ea 3a 3d 61 24 0d 22 38  |. .:. . .:=a$."8|
000070c0  11 c8 95 20 a7 61 24 2c  22 a4 22 29 3e 30 0d 22  |... .a$,".")>0."|
000070d0  42 2a 20 62 24 3d c1 61  24 2c a7 61 24 2c 22 a4  |B* b$=.a$,.a$,".|
000070e0  22 29 2b 31 29 3a 62 24  3d c0 62 24 2c a7 62 24  |")+1):b$=.b$,.b$|
000070f0  2c 22 a4 22 29 2d 31 29  0d 22 4c 2b 20 64 24 3d  |,".")-1)."L+ d$=|
00007100  62 24 3a e7 20 c2 64 24  2c 31 29 3c 3e 22 24 22  |b$:. .d$,1)<>"$"|
00007110  20 8c 64 24 3d 22 53 54  52 24 28 22 2b 64 24 2b  | .d$="STR$("+d$+|
00007120  22 29 22 0d 22 56 33 20  61 24 3d c0 61 24 2c a7  |")"."V3 a$=.a$,.|
00007130  61 24 2c 22 a4 22 29 2d  31 29 2b a0 28 64 24 29  |a$,".")-1)+.(d$)|
00007140  2b c1 61 24 2c a7 61 24  2c 22 a4 22 29 2b a9 28  |+.a$,.a$,".")+.(|
00007150  62 24 29 2b 32 29 0d 22  60 05 ce 0d 22 6a 07 3d  |b$)+2)."`..."j.=|
00007160  61 24 0d 22 74 1a dd a4  67 73 74 72 61 6e 73 28  |a$."t...gstrans(|
00007170  61 24 29 3a ea 20 70 25  2c 6c 65 6e 0d 22 7e 3a  |a$):. p%,len."~:|
00007180  c8 99 20 22 4f 53 5f 47  53 54 72 61 6e 73 22 2c  |.. "OS_GSTrans",|
00007190  61 24 2c 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |a$,message_buffe|
000071a0  72 25 2c 32 35 36 2b 28  31 3c 3c 33 31 29 20 b8  |r%,256+(1<<31) .|
000071b0  20 2c 2c 6c 65 6e 0d 22  88 1c 61 24 3d 22 22 3a  | ,,len."..a$="":|
000071c0  70 25 3d 6d 65 73 73 61  67 65 5f 62 75 66 66 65  |p%=message_buffe|
000071d0  72 25 0d 22 92 21 c8 95  20 a9 28 61 24 29 3c 6c  |r%.".!.. .(a$)<l|
000071e0  65 6e 3a 61 24 2b 3d bd  3f 70 25 3a 70 25 2b 3d  |en:a$+=.?p%:p%+=|
000071f0  31 3a ce 0d 22 9c 07 3d  61 24 0d 22 a6 05 3a 0d  |1:.."..=a$."..:.|
00007200  22 b0 3b f4 20 46 4e 73  77 69 6e 75 6d 62 65 72  |".;. FNswinumber|
00007210  20 3a 20 52 65 74 75 72  6e 20 74 68 65 20 53 57  | : Return the SW|
00007220  49 20 6e 75 6d 62 65 72  2c 20 67 69 76 65 6e 20  |I number, given |
00007230  69 74 73 20 73 74 72 69  6e 67 0d 22 ba 19 dd a4  |its string."....|
00007240  73 77 69 6e 75 6d 62 65  72 28 73 77 69 24 29 3a  |swinumber(swi$):|
00007250  ea 20 6e 0d 22 c4 30 c8  99 20 22 58 4f 53 5f 53  |. n.".0.. "XOS_S|
00007260  57 49 4e 75 6d 62 65 72  46 72 6f 6d 53 74 72 69  |WINumberFromStri|
00007270  6e 67 22 2c 2c 73 77 69  24 20 b8 20 6e 3b 66 6c  |ng",,swi$ . n;fl|
00007280  61 67 73 0d 22 ce 18 e7  20 28 66 6c 61 67 73 20  |ags."... (flags |
00007290  80 31 29 3e 30 20 8c 6e  3d 2d 31 0d 22 d8 06 3d  |.1)>0 .n=-1."..=|
000072a0  6e 0d 22 e2 05 3a 0d 22  ec 37 f4 20 2a 2a 2a 2a  |n."..:.".7. ****|
000072b0  2a 2a 2a 2a 20 46 69 6c  65 20 69 6e 66 6f 72 6d  |**** File inform|
000072c0  61 74 69 6f 6e 20 72 6f  75 74 69 6e 65 73 20 2a  |ation routines *|
000072d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 0d 22 f6  |*************.".|
000072e0  05 3a 0d 23 00 31 f4 20  46 4e 66 69 6c 65 74 79  |.:.#.1. FNfilety|
000072f0  70 65 20 3a 20 52 65 74  75 72 6e 20 74 68 65 20  |pe : Return the |
00007300  66 69 6c 65 20 74 79 70  65 20 6f 66 20 61 20 66  |file type of a f|
00007310  69 6c 65 0d 23 0a 32 f4  20 2d 32 3d 6e 6f 74 20  |ile.#.2. -2=not |
00007320  66 6f 75 6e 64 2c 20 2d  31 3d 75 6e 74 79 70 65  |found, -1=untype|
00007330  64 2c 20 26 31 30 30 30  3d 64 69 72 20 6f 72 20  |d, &1000=dir or |
00007340  69 6d 61 67 65 0d 23 14  22 dd 20 a4 66 69 6c 65  |image.#.". .file|
00007350  74 79 70 65 28 66 24 29  3a ea 20 66 25 2c 74 79  |type(f$):. f%,ty|
00007360  70 65 25 2c 66 6c 25 0d  23 1e 2b c8 99 20 22 58  |pe%,fl%.#.+.. "X|
00007370  4f 53 5f 46 69 6c 65 22  2c 32 30 2c 66 24 20 b8  |OS_File",20,f$ .|
00007380  20 74 79 70 65 25 2c 2c  2c 2c 2c 2c 66 25 3b 66  | type%,,,,,,f%;f|
00007390  6c 25 0d 23 28 0e c8 8e  20 74 79 70 65 25 20 ca  |l%.#(... type% .|
000073a0  0d 23 32 11 20 c9 20 30  3a 74 79 70 65 25 3d 2d  |.#2. . 0:type%=-|
000073b0  32 0d 23 3c 11 20 c9 20  31 3a 74 79 70 65 25 3d  |2.#<. . 1:type%=|
000073c0  66 25 0d 23 46 16 20 c9  20 32 2c 33 3a 74 79 70  |f%.#F. . 2,3:typ|
000073d0  65 25 3d 26 31 30 30 30  0d 23 50 05 cb 0d 23 5a  |e%=&1000.#P...#Z|
000073e0  19 e7 20 28 66 6c 25 80  31 29 3d 31 20 8c 74 79  |.. (fl%.1)=1 .ty|
000073f0  70 65 25 3d 2d 32 0d 23  64 0a 3d 74 79 70 65 25  |pe%=-2.#d.=type%|
00007400  0d 23 6e 05 3a 0d 23 78  3f f4 20 46 4e 62 61 73  |.#n.:.#x?. FNbas|
00007410  65 74 79 70 65 20 3a 20  52 65 74 75 72 6e 20 74  |etype : Return t|
00007420  68 65 20 66 69 6c 65 20  74 79 70 65 20 6f 66 20  |he file type of |
00007430  61 20 64 69 72 65 63 74  6f 72 79 20 6f 72 20 69  |a directory or i|
00007440  6d 61 67 65 0d 23 82 3a  f4 20 2d 32 3d 6e 6f 74  |mage.#.:. -2=not|
00007450  20 66 6f 75 6e 64 2c 20  2d 31 3d 66 69 6c 65 2c  | found, -1=file,|
00007460  20 26 31 30 30 30 20 66  6f 72 20 64 69 72 2c 20  | &1000 for dir, |
00007470  74 79 70 65 20 66 6f 72  20 69 6d 61 67 65 0d 23  |type for image.#|
00007480  8c 22 dd 20 a4 62 61 73  65 74 79 70 65 28 66 24  |.". .basetype(f$|
00007490  29 3a ea 20 66 25 2c 74  79 70 65 25 2c 66 6c 25  |):. f%,type%,fl%|
000074a0  0d 23 96 26 c8 99 20 22  58 4f 53 5f 46 69 6c 65  |.#.&.. "XOS_File|
000074b0  22 2c 35 2c 66 24 20 b8  20 74 79 70 65 25 2c 2c  |",5,f$ . type%,,|
000074c0  66 25 3b 66 6c 25 0d 23  a0 0e c8 8e 20 74 79 70  |f%;fl%.#.... typ|
000074d0  65 25 20 ca 0d 23 aa 11  20 c9 20 30 3a 74 79 70  |e% ..#.. . 0:typ|
000074e0  65 25 3d 2d 32 0d 23 b4  11 20 c9 20 31 3a 74 79  |e%=-2.#.. . 1:ty|
000074f0  70 65 25 3d 2d 31 0d 23  be 14 20 c9 20 32 3a 74  |pe%=-1.#.. . 2:t|
00007500  79 70 65 25 3d 26 31 30  30 30 0d 23 c8 1f 20 c9  |ype%=&1000.#.. .|
00007510  20 33 3a 74 79 70 65 25  3d 28 66 25 20 80 20 26  | 3:type%=(f% . &|
00007520  46 46 46 30 30 29 3e 3e  38 0d 23 d2 05 cb 0d 23  |FFF00)>>8.#....#|
00007530  dc 19 e7 20 28 66 6c 25  80 31 29 3d 31 20 8c 74  |... (fl%.1)=1 .t|
00007540  79 70 65 25 3d 2d 32 0d  23 e6 0a 3d 74 79 70 65  |ype%=-2.#..=type|
00007550  25 0d 23 f0 05 3a 0d 23  fa 30 f4 20 46 4e 66 69  |%.#..:.#.0. FNfi|
00007560  6c 65 6c 65 6e 67 74 68  20 3a 20 52 65 74 75 72  |lelength : Retur|
00007570  6e 20 74 68 65 20 6c 65  6e 67 74 68 20 6f 66 20  |n the length of |
00007580  61 20 66 69 6c 65 0d 24  04 15 f4 20 2d 31 20 69  |a file.$... -1 i|
00007590  66 20 6e 6f 74 20 66 6f  75 6e 64 0d 24 0e 21 dd  |f not found.$.!.|
000075a0  20 a4 66 69 6c 65 6c 65  6e 67 74 68 28 66 24 29  | .filelength(f$)|
000075b0  3a ea 20 6c 65 6e 25 2c  65 78 2c 66 0d 24 18 25  |:. len%,ex,f.$.%|
000075c0  c8 99 20 22 58 4f 53 5f  46 69 6c 65 22 2c 35 2c  |.. "XOS_File",5,|
000075d0  66 24 20 b8 20 65 78 2c  2c 2c 2c 6c 65 6e 25 3b  |f$ . ex,,,,len%;|
000075e0  66 0d 24 22 1f e7 20 65  78 3d 30 20 84 20 28 66  |f.$".. ex=0 . (f|
000075f0  20 80 20 31 29 3d 31 20  8c 6c 65 6e 25 3d 2d 31  | . 1)=1 .len%=-1|
00007600  0d 24 2c 09 3d 6c 65 6e  25 0d 24 36 05 3a 0d 24  |.$,.=len%.$6.:.$|
00007610  40 32 f4 20 46 4e 6c 65  61 66 6e 61 6d 65 20 3a  |@2. FNleafname :|
00007620  20 52 65 74 75 72 6e 20  74 68 65 20 6c 65 61 66  | Return the leaf|
00007630  6e 61 6d 65 20 6f 66 20  74 68 65 20 66 69 6c 65  |name of the file|
00007640  0d 24 4a 3b f4 20 46 4e  70 61 74 68 6e 61 6d 65  |.$J;. FNpathname|
00007650  20 3a 20 52 65 74 75 72  6e 20 74 68 65 20 64 69  | : Return the di|
00007660  72 65 63 74 6f 72 79 20  63 6f 6e 74 61 69 6e 69  |rectory containi|
00007670  6e 67 20 74 68 65 20 66  69 6c 65 0d 24 54 39 f4  |ng the file.$T9.|
00007680  20 46 4e 6c 6f 6e 67 66  69 6c 65 6e 61 6d 65 20  | FNlongfilename |
00007690  3a 20 52 65 74 75 72 6e  20 74 68 65 20 66 75 6c  |: Return the ful|
000076a0  6c 20 70 61 74 68 6e 61  6d 65 20 6f 66 20 61 20  |l pathname of a |
000076b0  66 69 6c 65 0d 24 5e 18  dd 20 a4 6c 65 61 66 6e  |file.$^.. .leafn|
000076c0  61 6d 65 28 66 24 29 3a  ea 20 72 24 0d 24 68 24  |ame(f$):. r$.$h$|
000076d0  e7 20 a7 66 24 2c 22 3a  22 29 3e 30 20 8c 66 24  |. .f$,":")>0 .f$|
000076e0  3d c1 66 24 2c a7 66 24  2c 22 3a 22 29 2b 31 29  |=.f$,.f$,":")+1)|
000076f0  0d 24 72 11 c8 8e 20 a7  66 24 2c 22 2e 22 29 20  |.$r... .f$,".") |
00007700  ca 0d 24 7c 12 20 c9 20  30 20 20 20 20 3a 72 24  |..$|. . 0    :r$|
00007710  3d 66 24 0d 24 86 29 20  7f 20 3a 72 24 3d a4 6c  |=f$.$.) . :r$=.l|
00007720  65 61 66 6e 61 6d 65 28  c2 66 24 2c a9 28 66 24  |eafname(.f$,.(f$|
00007730  29 2d a7 66 24 2c 22 2e  22 29 29 29 0d 24 90 05  |)-.f$,"."))).$..|
00007740  cb 0d 24 9a 07 3d 72 24  0d 24 a4 13 dd 20 a4 70  |..$..=r$.$... .p|
00007750  61 74 68 6e 61 6d 65 28  66 24 29 0d 24 ae 4e e7  |athname(f$).$.N.|
00007760  20 a7 66 24 2c 22 3a 22  29 3e 30 20 80 20 a7 66  | .f$,":")>0 . .f|
00007770  24 2c 22 2e 22 29 3d 30  20 8c 3d c0 66 24 2c a7  |$,".")=0 .=.f$,.|
00007780  66 24 2c 22 3a 22 29 29  20 8b e7 20 a7 66 24 2c  |f$,":")) .. .f$,|
00007790  22 3a 22 29 3d 30 20 80  20 a7 66 24 2c 22 2e 22  |":")=0 . .f$,"."|
000077a0  29 3d 30 20 8c 3d 22 40  22 0d 24 b8 22 3d c0 66  |)=0 .="@".$."=.f|
000077b0  24 2c a9 28 66 24 29 2d  a9 28 a4 6c 65 61 66 6e  |$,.(f$)-.(.leafn|
000077c0  61 6d 65 28 66 24 29 29  2d 31 29 0d 24 c2 2b f4  |ame(f$))-1).$.+.|
000077d0  20 52 65 6d 6f 76 65 73  20 69 64 65 6e 74 69 66  | Removes identif|
000077e0  69 65 72 73 20 73 75 63  68 20 61 73 20 53 63 72  |iers such as Scr|
000077f0  61 70 3a 2e 2e 2e 0d 24  cc 16 dd a4 6c 6f 6e 67  |ap:....$....long|
00007800  66 69 6c 65 6e 61 6d 65  28 66 24 29 0d 24 d6 40  |filename(f$).$.@|
00007810  c8 99 20 22 58 4f 53 5f  46 53 43 6f 6e 74 72 6f  |.. "XOS_FSContro|
00007820  6c 22 2c 33 37 2c 66 24  2c 6d 65 73 73 61 67 65  |l",37,f$,message|
00007830  5f 62 75 66 66 65 72 25  2c 2c 2c 32 35 36 20 b8  |_buffer%,,,256 .|
00007840  20 2c 2c 66 24 20 3b 66  6c 61 67 73 0d 24 e0 1a  | ,,f$ ;flags.$..|
00007850  e7 20 28 66 6c 61 67 73  20 80 20 31 29 3d 31 20  |. (flags . 1)=1 |
00007860  8c 66 24 3d 22 22 0d 24  ea 07 3d 66 24 0d 24 f4  |.f$="".$..=f$.$.|
00007870  05 3a 0d 24 fe 37 f4 20  2a 2a 2a 2a 2a 2a 2a 2a  |.:.$.7. ********|
00007880  20 4d 6f 64 75 6c 65 20  77 6f 72 6b 73 70 61 63  | Module workspac|
00007890  65 20 6d 61 6e 69 70 75  6c 61 74 69 6f 6e 20 72  |e manipulation r|
000078a0  6f 75 74 69 6e 65 20 2a  2a 0d 25 08 05 3a 0d 25  |outine **.%..:.%|
000078b0  12 26 f4 20 46 4e 63 6c  61 69 6d 20 20 20 3a 20  |.&. FNclaim   : |
000078c0  43 6c 61 69 6d 20 61 6e  20 61 72 65 61 20 6f 66  |Claim an area of|
000078d0  20 52 4d 41 0d 25 1c 2f  f4 20 46 4e 72 65 6c 65  | RMA.%./. FNrele|
000078e0  61 73 65 20 3a 20 52 65  6c 65 61 73 65 20 61 20  |ase : Release a |
000078f0  63 6c 61 69 6d 65 64 20  61 72 65 61 20 6f 66 20  |claimed area of |
00007900  52 4d 41 0d 25 26 14 dd  a4 63 6c 61 69 6d 28 6c  |RMA.%&...claim(l|
00007910  65 6e 67 74 68 25 29 0d  25 30 3a ea 20 66 6c 61  |ength%).%0:. fla|
00007920  67 73 3a e7 20 6c 65 6e  67 74 68 25 3c 31 8c 85  |gs:. length%<1..|
00007930  20 26 38 30 33 2c 22 43  61 6e 6e 6f 74 20 63 6c  | &803,"Cannot cl|
00007940  61 69 6d 20 6e 65 67 61  74 69 76 65 20 52 4d 41  |aim negative RMA|
00007950  22 0d 25 3a 2f c8 99 20  22 58 4f 53 5f 4d 6f 64  |".%:/.. "XOS_Mod|
00007960  75 6c 65 22 2c 36 2c 2c  2c 6c 65 6e 67 74 68 25  |ule",6,,,length%|
00007970  20 b8 20 2c 2c 61 72 65  61 25 3b 66 6c 61 67 73  | . ,,area%;flags|
00007980  0d 25 44 1c e7 20 28 66  6c 61 67 73 20 80 31 29  |.%D.. (flags .1)|
00007990  3e 30 20 8c 61 72 65 61  25 3d 2d 31 0d 25 4e 0a  |>0 .area%=-1.%N.|
000079a0  3d 61 72 65 61 25 0d 25  58 16 dd f2 72 65 6c 65  |=area%.%X...rele|
000079b0  61 73 65 28 f8 20 61 72  65 61 25 29 0d 25 62 2f  |ase(. area%).%b/|
000079c0  e7 20 61 72 65 61 25 3e  30 20 8c c8 99 20 22 4f  |. area%>0 ... "O|
000079d0  53 5f 4d 6f 64 75 6c 65  22 2c 37 2c 2c 61 72 65  |S_Module",7,,are|
000079e0  61 25 3a 61 72 65 61 25  3d 2d 31 0d 25 6c 05 e1  |a%:area%=-1.%l..|
000079f0  0d 25 76 05 3a 0d 25 80  37 f4 20 2a 2a 2a 2a 2a  |.%v.:.%.7. *****|
00007a00  2a 2a 2a 20 54 61 73 6b  20 69 6e 74 65 72 61 63  |*** Task interac|
00007a10  74 69 6f 6e 20 72 6f 75  74 69 6e 65 73 20 2a 2a  |tion routines **|
00007a20  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 0d 25 8a 05  |************.%..|
00007a30  3a 0d 25 94 33 f4 20 46  4e 74 61 73 6b 6e 61 6d  |:.%.3. FNtasknam|
00007a40  65 20 20 20 20 20 20 20  20 3a 20 72 65 74 75 72  |e        : retur|
00007a50  6e 20 61 20 67 69 76 65  6e 20 74 61 73 6b 73 20  |n a given tasks |
00007a60  6e 61 6d 65 0d 25 9e 3c  f4 20 46 4e 77 69 6e 64  |name.%.<. FNwind|
00007a70  6f 77 74 61 73 6b 20 20  20 20 20 20 3a 20 72 65  |owtask      : re|
00007a80  74 75 72 6e 20 74 61 73  6b 20 68 61 6e 64 6c 65  |turn task handle|
00007a90  20 77 68 6f 20 6f 77 6e  73 20 77 69 6e 64 6f 77  | who owns window|
00007aa0  0d 25 a8 37 f4 20 46 4e  72 65 61 64 74 61 73 6b  |.%.7. FNreadtask|
00007ab0  73 74 72 69 6e 67 20 20  3a 20 72 65 61 64 20 61  |string  : read a|
00007ac0  20 73 74 72 69 6e 67 20  66 72 6f 6d 20 67 69 76  | string from giv|
00007ad0  65 6e 20 74 61 73 6b 0d  25 b2 36 f4 20 50 52 4f  |en task.%.6. PRO|
00007ae0  43 72 65 61 64 74 61 73  6b 61 72 65 61 20 20 3a  |Creadtaskarea  :|
00007af0  20 72 65 61 64 20 61 20  62 6c 6f 63 6b 20 66 72  | read a block fr|
00007b00  6f 6d 20 67 69 76 65 6e  20 74 61 73 6b 0d 25 bc  |om given task.%.|
00007b10  3a f4 20 46 4e 66 69 6e  64 74 61 73 6b 20 20 20  |:. FNfindtask   |
00007b20  20 20 20 20 20 3a 20 72  65 74 75 72 6e 20 74 61  |     : return ta|
00007b30  73 6b 20 68 61 6e 64 6c  65 20 6f 66 20 6e 61 6d  |sk handle of nam|
00007b40  65 64 20 74 61 73 6b 0d  25 c6 1f dd a4 74 61 73  |ed task.%....tas|
00007b50  6b 6e 61 6d 65 28 74 61  73 6b 25 29 3a ea 20 6e  |kname(task%):. n|
00007b60  61 6d 65 24 2c 66 0d 25  d0 38 c8 99 20 22 58 54  |ame$,f.%.8.. "XT|
00007b70  61 73 6b 4d 61 6e 61 67  65 72 5f 54 61 73 6b 4e  |askManager_TaskN|
00007b80  61 6d 65 46 72 6f 6d 48  61 6e 64 6c 65 22 2c 74  |ameFromHandle",t|
00007b90  61 73 6b 25 20 b8 20 6e  61 6d 65 24 3b 66 0d 25  |ask% . name$;f.%|
00007ba0  da 1a e7 20 28 66 20 80  31 29 20 8c 6e 61 6d 65  |... (f .1) .name|
00007bb0  24 3d 22 4e 6f 6e 65 22  0d 25 e4 0a 3d 6e 61 6d  |$="None".%..=nam|
00007bc0  65 24 0d 25 ee 1e dd a4  77 69 6e 64 6f 77 74 61  |e$.%....windowta|
00007bd0  73 6b 28 77 69 6e 25 29  3a ea 20 74 61 73 6b 25  |sk(win%):. task%|
00007be0  0d 25 f8 2d 6d 65 73 73  61 67 65 5f 62 75 66 66  |.%.-message_buff|
00007bf0  65 72 25 21 30 3d 32 30  3a 6d 65 73 73 61 67 65  |er%!0=20:message|
00007c00  5f 62 75 66 66 65 72 25  21 31 32 3d 30 0d 26 02  |_buffer%!12=0.&.|
00007c10  3e c8 99 20 22 57 69 6d  70 5f 53 65 6e 64 4d 65  |>.. "Wimp_SendMe|
00007c20  73 73 61 67 65 22 2c 31  39 2c 6d 65 73 73 61 67  |ssage",19,messag|
00007c30  65 5f 62 75 66 66 65 72  25 2c 77 69 6e 25 2c 2d  |e_buffer%,win%,-|
00007c40  31 20 b8 20 2c 2c 74 61  73 6b 25 0d 26 0c 0a 3d  |1 . ,,task%.&..=|
00007c50  74 61 73 6b 25 0d 26 16  25 dd a4 72 65 61 64 74  |task%.&.%..readt|
00007c60  61 73 6b 73 74 72 69 6e  67 28 74 61 73 6b 25 2c  |askstring(task%,|
00007c70  6c 6f 63 25 29 3a ea 20  70 24 0d 26 20 40 c8 99  |loc%):. p$.& @..|
00007c80  22 57 69 6d 70 5f 54 72  61 6e 73 66 65 72 42 6c  |"Wimp_TransferBl|
00007c90  6f 63 6b 22 2c 74 61 73  6b 25 2c 6c 6f 63 25 2c  |ock",task%,loc%,|
00007ca0  68 61 6e 64 6c 65 2c 6d  65 73 73 61 67 65 5f 62  |handle,message_b|
00007cb0  75 66 66 65 72 25 2c 32  35 36 0d 26 2a 1e 3d a4  |uffer%,256.&*.=.|
00007cc0  73 74 72 69 6e 67 30 28  6d 65 73 73 61 67 65 5f  |string0(message_|
00007cd0  62 75 66 66 65 72 25 29  0d 26 34 27 dd f2 72 65  |buffer%).&4'..re|
00007ce0  61 64 74 61 73 6b 61 72  65 61 28 74 61 73 6b 25  |adtaskarea(task%|
00007cf0  2c 6c 6f 63 25 2c 74 6f  25 2c 6c 65 6e 25 29 0d  |,loc%,to%,len%).|
00007d00  26 3e 35 c8 99 22 57 69  6d 70 5f 54 72 61 6e 73  |&>5.."Wimp_Trans|
00007d10  66 65 72 42 6c 6f 63 6b  22 2c 74 61 73 6b 25 2c  |ferBlock",task%,|
00007d20  6c 6f 63 25 2c 68 61 6e  64 6c 65 2c 74 6f 25 2c  |loc%,handle,to%,|
00007d30  6c 65 6e 25 0d 26 48 05  e1 0d 26 52 12 dd a4 66  |len%.&H...&R...f|
00007d40  69 6e 64 74 61 73 6b 28  61 24 29 0d 26 5c 0f ea  |indtask(a$).&\..|
00007d50  20 74 68 2c 63 6e 74 2c  74 24 0d 26 66 3d c8 99  | th,cnt,t$.&f=..|
00007d60  20 22 54 61 73 6b 4d 61  6e 61 67 65 72 5f 45 6e  | "TaskManager_En|
00007d70  75 6d 65 72 61 74 65 54  61 73 6b 73 22 2c 2c 6d  |umerateTasks",,m|
00007d80  65 73 73 61 67 65 5f 62  75 66 66 65 72 25 2c 31  |essage_buffer%,1|
00007d90  36 20 b8 20 63 6e 74 0d  26 70 0e c8 95 20 63 6e  |6 . cnt.&p... cn|
00007da0  74 3c 3e 2d 31 0d 26 7a  37 20 74 68 3d 21 6d 65  |t<>-1.&z7 th=!me|
00007db0  73 73 61 67 65 5f 62 75  66 66 65 72 25 3a 74 24  |ssage_buffer%:t$|
00007dc0  3d a4 73 74 72 69 6e 67  30 28 6d 65 73 73 61 67  |=.string0(messag|
00007dd0  65 5f 62 75 66 66 65 72  25 21 34 29 0d 26 84 41  |e_buffer%!4).&.A|
00007de0  20 c8 99 20 22 54 61 73  6b 4d 61 6e 61 67 65 72  | .. "TaskManager|
00007df0  5f 45 6e 75 6d 65 72 61  74 65 54 61 73 6b 73 22  |_EnumerateTasks"|
00007e00  2c 63 6e 74 2c 6d 65 73  73 61 67 65 5f 62 75 66  |,cnt,message_buf|
00007e10  66 65 72 25 2c 31 36 20  b8 20 63 6e 74 0d 26 8e  |fer%,16 . cnt.&.|
00007e20  24 20 e7 20 74 24 3d 61  24 20 8c 63 6e 74 3d 2d  |$ . t$=a$ .cnt=-|
00007e30  31 20 8b e7 63 6e 74 3d  2d 31 20 8c 74 68 3d 2d  |1 ..cnt=-1 .th=-|
00007e40  31 0d 26 98 05 ce 0d 26  a2 07 3d 74 68 0d 26 ac  |1.&....&..=th.&.|
00007e50  05 3a 0d 26 b6 3f f4 20  46 4e 62 61 63 6b 6f 66  |.:.&.?. FNbackof|
00007e60  77 69 6e 73 74 61 63 6b  20 3a 20 72 65 74 75 72  |winstack : retur|
00007e70  6e 20 77 69 6e 20 68 61  6e 64 6c 65 20 6f 66 20  |n win handle of |
00007e80  62 61 63 6b 20 6f 66 20  77 69 6e 20 73 74 61 63  |back of win stac|
00007e90  6b 0d 26 c0 3e f4 20 46  4e 77 69 6e 73 74 61 63  |k.&.>. FNwinstac|
00007ea0  6b 6e 65 78 74 20 20 20  3a 20 72 65 74 75 72 6e  |knext   : return|
00007eb0  20 77 69 6e 20 68 61 6e  64 6c 65 20 6f 66 20 6e  | win handle of n|
00007ec0  65 78 74 20 77 69 6e 20  66 6f 72 77 61 72 64 0d  |ext win forward.|
00007ed0  26 ca 18 dd a4 62 61 63  6b 6f 66 77 69 6e 73 74  |&....backofwinst|
00007ee0  61 63 6b 3a ea 20 49 0d  26 d4 2c 21 62 25 3d 69  |ack:. I.&.,!b%=i|
00007ef0  6e 66 6f 62 6f 78 25 3a  c8 99 22 57 69 6d 70 5f  |nfobox%:.."Wimp_|
00007f00  47 65 74 57 69 6e 64 6f  77 53 74 61 74 65 22 2c  |GetWindowState",|
00007f10  2c 62 25 0d 26 de 0d e3  49 3d 34 b8 31 36 88 34  |,b%.&...I=4.16.4|
00007f20  0d 26 e8 15 20 62 25 21  49 3d 28 62 25 21 49 29  |.&.. b%!I=(b%!I)|
00007f30  2d 34 30 39 36 0d 26 f2  06 ed 49 0d 26 fc 24 62  |-4096.&...I.&.$b|
00007f40  25 21 32 38 3d 2d 32 3a  c8 99 22 57 69 6d 70 5f  |%!28=-2:.."Wimp_|
00007f50  4f 70 65 6e 57 69 6e 64  6f 77 22 2c 2c 62 25 0d  |OpenWindow",,b%.|
00007f60  27 06 29 c8 99 22 57 69  6d 70 5f 47 65 74 57 69  |'.).."Wimp_GetWi|
00007f70  6e 64 6f 77 53 74 61 74  65 22 2c 2c 62 25 3a 7a  |ndowState",,b%:z|
00007f80  63 25 3d 62 25 21 32 38  0d 27 10 1c c8 99 22 57  |c%=b%!28.'...."W|
00007f90  69 6d 70 5f 43 6c 6f 73  65 57 69 6e 64 6f 77 22  |imp_CloseWindow"|
00007fa0  2c 2c 62 25 0d 27 1a 08  3d 7a 63 25 0d 27 24 44  |,,b%.'..=zc%.'$D|
00007fb0  dd a4 77 69 6e 73 74 61  63 6b 6e 65 78 74 28 77  |..winstacknext(w|
00007fc0  69 6e 25 29 3a 21 62 25  3d 77 69 6e 25 3a c8 99  |in%):!b%=win%:..|
00007fd0  22 57 69 6d 70 5f 47 65  74 57 69 6e 64 6f 77 53  |"Wimp_GetWindowS|
00007fe0  74 61 74 65 22 2c 2c 62  25 3a 3d 62 25 21 32 38  |tate",,b%:=b%!28|
00007ff0  0d 27 2e 05 3a 0d 27 38  37 f4 20 2a 2a 2a 2a 2a  |.'..:.'87. *****|
00008000  2a 2a 2a 20 43 61 72 65  74 20 61 6e 64 20 70 6f  |*** Caret and po|
00008010  69 6e 74 65 72 20 63 6f  6e 74 72 6f 6c 20 70 72  |inter control pr|
00008020  6f 63 65 64 75 72 65 73  20 2a 2a 2a 0d 27 42 05  |ocedures ***.'B.|
00008030  3a 0d 27 4c 3e f4 20 50  52 4f 43 73 65 74 63 61  |:.'L>. PROCsetca|
00008040  72 65 74 65 6e 64 20 3a  20 50 6c 61 63 65 20 74  |retend : Place t|
00008050  68 65 20 63 61 72 65 74  20 61 74 20 74 68 65 20  |he caret at the |
00008060  65 6e 64 20 6f 66 20 74  68 65 20 74 65 78 74 0d  |end of the text.|
00008070  27 56 3e f4 20 50 52 4f  43 73 65 74 63 61 72 65  |'V>. PROCsetcare|
00008080  74 70 6f 73 20 3a 20 50  6c 61 63 65 20 74 68 65  |tpos : Place the|
00008090  20 63 61 72 65 74 20 61  74 20 70 6f 73 20 77 69  | caret at pos wi|
000080a0  74 68 69 6e 20 74 68 65  20 74 65 78 74 0d 27 60  |thin the text.'`|
000080b0  38 f4 20 50 52 4f 43 67  65 74 63 61 72 65 74 70  |8. PROCgetcaretp|
000080c0  6f 73 20 3a 20 52 65 74  75 72 6e 20 74 68 65 20  |os : Return the |
000080d0  70 6f 73 69 74 69 6f 6e  20 6f 66 20 74 68 65 20  |position of the |
000080e0  63 61 72 65 74 0d 27 6a  3a f4 20 50 52 4f 43 67  |caret.'j:. PROCg|
000080f0  65 74 70 74 72 70 6f 73  20 20 20 3a 20 52 65 74  |etptrpos   : Ret|
00008100  75 72 6e 20 74 68 65 20  6c 6f 63 61 74 69 6f 6e  |urn the location|
00008110  20 6f 66 20 74 68 65 20  70 6f 69 6e 74 65 72 0d  | of the pointer.|
00008120  27 74 1b dd f2 73 65 74  63 61 72 65 74 65 6e 64  |'t...setcaretend|
00008130  28 77 69 6e 2c 69 63 6f  6e 29 0d 27 7e 34 f2 73  |(win,icon).'~4.s|
00008140  65 74 63 61 72 65 74 70  6f 73 28 77 69 6e 2c 69  |etcaretpos(win,i|
00008150  63 6f 6e 2c a9 28 a4 67  65 74 69 63 6f 6e 74 65  |con,.(.geticonte|
00008160  78 74 28 77 69 6e 2c 69  63 6f 6e 29 29 29 0d 27  |xt(win,icon))).'|
00008170  88 05 e1 0d 27 92 21 dd  f2 73 65 74 63 61 72 65  |....'.!..setcare|
00008180  74 70 6f 73 28 77 69 6e  2c 69 63 6f 6e 2c 63 68  |tpos(win,icon,ch|
00008190  61 72 73 29 0d 27 9c 34  c8 99 20 22 57 69 6d 70  |ars).'.4.. "Wimp|
000081a0  5f 53 65 74 43 61 72 65  74 50 6f 73 69 74 69 6f  |_SetCaretPositio|
000081b0  6e 22 2c 77 69 6e 2c 69  63 6f 6e 2c 30 2c 30 2c  |n",win,icon,0,0,|
000081c0  2d 31 2c 63 68 61 72 73  0d 27 a6 05 e1 0d 27 b0  |-1,chars.'....'.|
000081d0  27 dd f2 67 65 74 63 61  72 65 74 70 6f 73 28 f8  |'..getcaretpos(.|
000081e0  20 77 69 6e 2c f8 20 69  63 6f 6e 2c f8 20 63 68  | win,. icon,. ch|
000081f0  61 72 73 29 0d 27 ba 40  c8 99 20 22 57 69 6d 70  |ars).'.@.. "Wimp|
00008200  5f 47 65 74 43 61 72 65  74 50 6f 73 69 74 69 6f  |_GetCaretPositio|
00008210  6e 22 2c 2c 62 25 3a 77  69 6e 3d 21 62 25 3a 69  |n",,b%:win=!b%:i|
00008220  63 6f 6e 3d 62 25 21 34  3a 63 68 61 72 73 3d 62  |con=b%!4:chars=b|
00008230  25 21 32 30 0d 27 c4 05  e1 0d 27 ce 25 dd f2 67  |%!20.'....'.%..g|
00008240  65 74 70 74 72 70 6f 73  28 f8 20 78 2c f8 20 79  |etptrpos(. x,. y|
00008250  2c f8 20 77 69 6e 2c f8  20 69 63 6f 6e 29 0d 27  |,. win,. icon).'|
00008260  d8 43 c8 99 20 22 57 69  6d 70 5f 47 65 74 50 6f  |.C.. "Wimp_GetPo|
00008270  69 6e 74 65 72 49 6e 66  6f 22 2c 2c 62 25 3a 78  |interInfo",,b%:x|
00008280  3d 62 25 21 30 3a 79 3d  62 25 21 34 3a 77 69 6e  |=b%!0:y=b%!4:win|
00008290  3d 62 25 21 31 32 3a 69  63 6f 6e 3d 62 25 21 31  |=b%!12:icon=b%!1|
000082a0  36 0d 27 e2 05 e1 0d 27  ec 05 3a 0d 27 f6 37 f4  |6.'....'..:.'.7.|
000082b0  20 2a 2a 2a 2a 2a 2a 2a  2a 20 43 6f 6e 66 69 67  | ******** Config|
000082c0  75 72 61 74 69 6f 6e 20  73 65 74 74 69 6e 67 73  |uration settings|
000082d0  20 63 6f 6e 74 72 6f 6c  20 2a 2a 2a 2a 2a 2a 2a  | control *******|
000082e0  2a 2a 0d 28 00 05 3a 0d  28 0a 37 f4 20 46 4e 72  |**.(..:.(.7. FNr|
000082f0  65 61 64 63 6d 6f 73 20  20 20 20 3a 20 52 65 61  |eadcmos    : Rea|
00008300  64 20 61 20 62 79 74 65  20 6f 66 20 63 6f 6e 66  |d a byte of conf|
00008310  69 67 75 72 61 74 69 6f  6e 20 69 6e 66 6f 0d 28  |iguration info.(|
00008320  14 38 f4 20 50 52 4f 43  77 72 69 74 65 63 6d 6f  |.8. PROCwritecmo|
00008330  73 20 3a 20 57 72 69 74  65 20 61 20 62 79 74 65  |s : Write a byte|
00008340  20 6f 66 20 63 6f 6e 66  69 67 75 72 61 74 69 6f  | of configuratio|
00008350  6e 20 69 6e 66 6f 0d 28  1e 14 dd a4 72 65 61 64  |n info.(....read|
00008360  63 6d 6f 73 28 62 79 74  65 29 0d 28 28 23 c8 99  |cmos(byte).((#..|
00008370  20 22 4f 53 5f 42 79 74  65 22 2c 31 36 31 2c 62  | "OS_Byte",161,b|
00008380  79 74 65 20 b8 20 2c 2c  76 61 6c 75 65 0d 28 32  |yte . ,,value.(2|
00008390  0a 3d 76 61 6c 75 65 0d  28 3c 1b dd f2 77 72 69  |.=value.(<...wri|
000083a0  74 65 63 6d 6f 73 28 62  79 74 65 2c 76 61 6c 75  |tecmos(byte,valu|
000083b0  65 29 0d 28 46 1f c8 99  20 22 4f 53 5f 42 79 74  |e).(F... "OS_Byt|
000083c0  65 22 2c 31 36 32 2c 62  79 74 65 2c 76 61 6c 75  |e",162,byte,valu|
000083d0  65 0d 28 50 05 e1 0d 28  5a 05 3a 0d 28 64 37 f4  |e.(P...(Z.:.(d7.|
000083e0  20 2a 2a 2a 2a 2a 2a 2a  2a 20 53 74 61 74 75 73  | ******** Status|
000083f0  20 66 69 6c 65 20 63 6f  6e 74 72 6f 6c 20 72 6f  | file control ro|
00008400  75 74 69 6e 65 73 20 2a  2a 2a 2a 2a 2a 2a 2a 2a  |utines *********|
00008410  2a 2a 0d 28 6e 05 3a 0d  28 78 30 f4 20 50 52 4f  |**.(n.:.(x0. PRO|
00008420  43 6d 61 6b 65 73 74 61  74 75 73 66 69 6c 65 20  |Cmakestatusfile |
00008430  20 3a 20 43 72 65 61 74  65 20 61 20 73 74 61 74  | : Create a stat|
00008440  75 73 20 66 69 6c 65 0d  28 82 31 f4 20 50 52 4f  |us file.(.1. PRO|
00008450  43 63 6c 6f 73 65 73 74  61 74 75 73 66 69 6c 65  |Cclosestatusfile|
00008460  20 3a 20 43 6c 6f 73 65  20 74 68 65 20 73 74 61  | : Close the sta|
00008470  74 75 73 20 66 69 6c 65  0d 28 8c 33 f4 20 46 4e  |tus file.(.3. FN|
00008480  72 65 61 64 73 74 61 74  75 73 66 69 6c 65 20 20  |readstatusfile  |
00008490  20 20 3a 20 4f 70 65 6e  20 61 20 73 74 61 74 75  |  : Open a statu|
000084a0  73 20 66 69 6c 65 20 72  65 61 64 0d 28 96 18 dd  |s file read.(...|
000084b0  f2 6d 61 6b 65 73 74 61  74 75 73 66 69 6c 65 28  |.makestatusfile(|
000084c0  66 24 29 0d 28 a0 2b ff  28 22 43 72 65 61 74 65  |f$).(.+.("Create|
000084d0  20 22 2b 66 24 29 3a ff  28 22 53 65 74 54 79 70  | "+f$):.("SetTyp|
000084e0  65 20 22 2b 66 24 2b 22  20 46 46 46 22 29 0d 28  |e "+f$+" FFF").(|
000084f0  aa 33 73 74 61 74 66 69  6c 65 25 3d ae 28 66 24  |.3statfile%=.(f$|
00008500  29 3a d5 23 73 74 61 74  66 69 6c 65 25 2c 22 50  |):.#statfile%,"P|
00008510  72 6f 67 72 61 6d 3a 22  2b 41 70 70 6e 61 6d 65  |rogram:"+Appname|
00008520  24 0d 28 b4 05 e1 0d 28  be 15 dd f2 63 6c 6f 73  |$.(....(....clos|
00008530  65 73 74 61 74 75 73 66  69 6c 65 0d 28 c8 0f d9  |estatusfile.(...|
00008540  23 73 74 61 74 66 69 6c  65 25 0d 28 d2 05 e1 0d  |#statfile%.(....|
00008550  28 dc 2e f4 20 52 65 74  75 72 6e 20 46 41 4c 53  |(... Return FALS|
00008560  45 20 69 66 20 6e 6f 74  20 63 6f 72 72 65 63 74  |E if not correct|
00008570  20 6f 72 20 6e 6f 74 20  66 6f 75 6e 64 0d 28 e6  | or not found.(.|
00008580  1d dd a4 72 65 61 64 73  74 61 74 75 73 66 69 6c  |...readstatusfil|
00008590  65 28 66 24 29 3a ea 20  61 24 0d 28 f0 10 ea 20  |e(f$):. a$.(... |
000085a0  85 3a ee 20 85 20 ea 3a  3d a3 0d 28 fa 13 73 74  |.:. . .:=..(..st|
000085b0  61 74 66 69 6c 65 25 3d  8e 28 66 24 29 0d 29 04  |atfile%=.(f$).).|
000085c0  15 e7 20 73 74 61 74 66  69 6c 65 25 3d 30 20 8c  |.. statfile%=0 .|
000085d0  3d a3 0d 29 0e 1c 61 24  3d a4 73 74 61 74 75 73  |=..)..a$=.status|
000085e0  67 65 74 28 22 50 72 6f  67 72 61 6d 22 29 0d 29  |get("Program").)|
000085f0  18 22 e7 20 61 24 3c 3e  41 70 70 6e 61 6d 65 24  |.". a$<>Appname$|
00008600  20 8c d9 23 73 74 61 74  66 69 6c 65 25 3a 3d a3  | ..#statfile%:=.|
00008610  0d 29 22 06 3d b9 0d 29  2c 05 3a 0d 29 36 36 f4  |.)".=..),.:.)66.|
00008620  20 50 52 4f 43 73 74 61  74 75 73 70 75 74 20 20  | PROCstatusput  |
00008630  20 20 3a 20 50 75 74 20  74 68 65 20 73 74 72 69  |  : Put the stri|
00008640  6e 67 20 69 6e 20 73 74  61 74 75 73 20 66 69 6c  |ng in status fil|
00008650  65 0d 29 40 35 f4 20 50  52 4f 43 73 74 61 74 75  |e.)@5. PROCstatu|
00008660  73 6f 70 74 69 6f 6e 20  3a 20 50 75 74 20 74 68  |soption : Put th|
00008670  65 20 76 61 6c 75 65 20  69 6e 20 73 74 61 74 75  |e value in statu|
00008680  73 20 66 69 6c 65 0d 29  4a 34 f4 20 50 52 4f 43  |s file.)J4. PROC|
00008690  73 74 61 74 75 73 66 6c  61 67 20 20 20 3a 20 50  |statusflag   : P|
000086a0  75 74 20 74 68 65 20 66  6c 61 67 20 69 6e 20 73  |ut the flag in s|
000086b0  74 61 74 75 73 20 66 69  6c 65 0d 29 54 16 dd f2  |tatus file.)T...|
000086c0  73 74 61 74 75 73 70 75  74 28 65 24 2c 64 24 29  |statusput(e$,d$)|
000086d0  0d 29 5e 19 d5 23 73 74  61 74 66 69 6c 65 25 2c  |.)^..#statfile%,|
000086e0  65 24 2b 22 3a 22 2b 64  24 0d 29 68 05 e1 0d 29  |e$+":"+d$.)h...)|
000086f0  72 19 dd f2 73 74 61 74  75 73 6f 70 74 69 6f 6e  |r...statusoption|
00008700  28 65 24 2c 76 25 29 0d  29 7c 1b d5 23 73 74 61  |(e$,v%).)|..#sta|
00008710  74 66 69 6c 65 25 2c 65  24 2b 22 3a 25 22 2b c3  |tfile%,e$+":%"+.|
00008720  76 25 0d 29 86 05 e1 0d  29 90 17 dd f2 73 74 61  |v%.)....)....sta|
00008730  74 75 73 66 6c 61 67 28  65 24 2c 76 25 29 0d 29  |tusflag(e$,v%).)|
00008740  9a 35 e7 20 76 25 20 8c  d5 23 73 74 61 74 66 69  |.5. v% ..#statfi|
00008750  6c 65 25 2c 65 24 2b 22  3a 4f 6e 22 20 8b d5 23  |le%,e$+":On" ..#|
00008760  73 74 61 74 66 69 6c 65  25 2c 65 24 2b 22 3a 4f  |statfile%,e$+":O|
00008770  66 66 22 0d 29 a4 05 e1  0d 29 ae 05 3a 0d 29 b8  |ff".)....)..:.).|
00008780  33 f4 20 50 52 4f 43 73  74 61 74 75 73 6e 65 78  |3. PROCstatusnex|
00008790  74 20 20 20 3a 20 52 65  61 64 20 74 68 65 20 6e  |t   : Read the n|
000087a0  65 78 74 20 73 74 61 74  75 73 20 65 6e 74 72 79  |ext status entry|
000087b0  0d 29 c2 1b dd f2 73 74  61 74 75 73 6e 65 78 74  |.)....statusnext|
000087c0  28 f8 20 61 24 2c f8 20  62 24 29 0d 29 cc 27 e7  |(. a$,. b$).).'.|
000087d0  20 c5 23 73 74 61 74 66  69 6c 65 25 20 8c 61 24  | .#statfile% .a$|
000087e0  3d 22 2a 45 2a 4e 2a 44  2a 22 3a 62 24 3d 22 22  |="*E*N*D*":b$=""|
000087f0  3a e1 0d 29 d6 21 f5 3a  61 24 3d be 23 73 74 61  |:..).!.:a$=.#sta|
00008800  74 66 69 6c 65 25 3a fd  c0 61 24 2c 31 29 3c 3e  |tfile%:..a$,1)<>|
00008810  22 23 22 0d 29 e0 16 62  24 3d c1 61 24 2c a7 61  |"#".)..b$=.a$,.a|
00008820  24 2c 22 3a 22 29 2b 31  29 0d 29 ea 1e 61 24 3d  |$,":")+1).)..a$=|
00008830  a4 75 70 70 65 72 28 c0  61 24 2c a7 61 24 2c 22  |.upper(.a$,.a$,"|
00008840  3a 22 29 2d 31 29 29 0d  29 f4 05 e1 0d 29 fe 05  |:")-1)).)....)..|
00008850  3a 0d 2a 08 37 f4 20 46  4e 73 74 61 74 75 73 67  |:.*.7. FNstatusg|
00008860  65 74 20 20 20 20 20 20  3a 20 52 65 61 64 20 61  |et      : Read a|
00008870  6e 20 65 6e 74 72 79 20  66 72 6f 6d 20 73 74 61  |n entry from sta|
00008880  74 75 73 20 66 69 6c 65  0d 2a 12 35 f4 20 46 4e  |tus file.*.5. FN|
00008890  73 74 61 74 75 73 67 65  74 76 20 20 20 20 20 3a  |statusgetv     :|
000088a0  20 52 65 61 64 20 61 20  76 61 6c 75 65 20 66 72  | Read a value fr|
000088b0  6f 6d 20 73 74 61 75 73  20 66 69 6c 65 0d 2a 1c  |om staus file.*.|
000088c0  35 f4 20 46 4e 73 74 61  74 75 73 67 65 74 66 6c  |5. FNstatusgetfl|
000088d0  61 67 20 20 3a 20 52 65  61 64 20 61 20 66 6c 61  |ag  : Read a fla|
000088e0  67 20 66 72 6f 6d 20 73  74 61 74 75 73 20 66 69  |g from status fi|
000088f0  6c 65 0d 2a 26 13 dd a4  73 74 61 74 75 73 67 65  |le.*&...statusge|
00008900  74 28 61 24 29 0d 2a 30  2c ea 20 62 24 2c 63 24  |t(a$).*0,. b$,c$|
00008910  3a 61 24 3d a4 75 70 70  65 72 28 61 24 29 3a f2  |:a$=.upper(a$):.|
00008920  73 74 61 74 75 73 6e 65  78 74 28 62 24 2c 63 24  |statusnext(b$,c$|
00008930  29 0d 2a 3a 0e e7 20 61  24 3c 3e 62 24 20 8c 0d  |).*:.. a$<>b$ ..|
00008940  2a 44 18 20 cf 23 73 74  61 74 66 69 6c 65 25 3d  |*D. .#statfile%=|
00008950  30 3a 62 24 3d 22 22 0d  2a 4e 1e 20 c8 95 20 61  |0:b$="".*N. .. a|
00008960  24 3c 3e 62 24 20 80 20  62 24 3c 3e 22 2a 45 2a  |$<>b$ . b$<>"*E*|
00008970  4e 2a 44 2a 22 0d 2a 58  18 20 20 f2 73 74 61 74  |N*D*".*X.  .stat|
00008980  75 73 6e 65 78 74 28 62  24 2c 63 24 29 0d 2a 62  |usnext(b$,c$).*b|
00008990  06 20 ce 0d 2a 6c 05 cd  0d 2a 76 07 3d 63 24 0d  |. ..*l...*v.=c$.|
000089a0  2a 80 26 dd a4 73 74 61  74 75 73 67 65 74 76 28  |*.&..statusgetv(|
000089b0  61 24 29 3a 61 24 3d a4  73 74 61 74 75 73 67 65  |a$):a$=.statusge|
000089c0  74 28 61 24 29 0d 2a 8a  1c e7 20 c0 61 24 2c 31  |t(a$).*... .a$,1|
000089d0  29 3d 22 25 22 20 8c 3d  bb 28 c1 61 24 2c 32 29  |)="%" .=.(.a$,2)|
000089e0  29 0d 2a 94 06 3d 30 0d  2a 9e 29 dd a4 73 74 61  |).*..=0.*.)..sta|
000089f0  74 75 73 67 65 74 66 6c  61 67 28 61 24 29 3a 61  |tusgetflag(a$):a|
00008a00  24 3d a4 73 74 61 74 75  73 67 65 74 28 61 24 29  |$=.statusget(a$)|
00008a10  0d 2a a8 20 e7 20 61 24  3d 22 25 31 22 84 a4 75  |.*. . a$="%1"..u|
00008a20  70 70 65 72 28 61 24 29  3d 22 4f 4e 22 8c 3d b9  |pper(a$)="ON".=.|
00008a30  0d 2a b2 06 3d a3 0d ff                           |.*..=...|
00008a38