home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 2
/
AUCD2.iso
/
internet
/
acornet.spk
/
!Acornet
/
Apps
/
!Ping
/
!Runimage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1996-03-13
|
9KB
|
350 lines
Runimage for Ping
"Wimp_Initialise",200,&4B534154,"Ping"
,myhandle%
version$="0.13 (12-Mar-96)"
errorblock% 100
errbox(
indlength%=&400
pings%=0
maxpings%=20
maxpinglength%=128
"OS_File",17,"<Ping$Dir>.Sprites"
,,,,spsize%
spsize%+=4
"pingm%=99:
just silly numbers
mainm%=137
indirected% indlength%
wblk% &300
menublk% 28+24*maxpings%
messb% &200
iconblock% 42
plblk% &100
sp% spsize%
pingslot% (maxpings%+1)*maxpinglength%
!sp%=spsize%
&2E,266,sp%,"<Ping$Dir>.Sprites"
set_message_numbers
load_my_windows
load_messages
rewriteIcon(info%,3,version$)
get_pings
PROCrewriteIcon(pane%,0,$pingslot%)
all_over%=
mask%=1
errbox(
$+" "+
+". "+"OK to continue CANCEL to Quit",3):
errreturn%=2
openOnTop
SYS"Wimp_SetCaretPosition",pane%,0,0,0,-1,LEN FNgeticontext(pane%,0)
all_over%
"Wimp_CloseDown",myhandle%,&4B534154
"Wimp_Poll",mask%,plblk%
reason%
reason%
2 :
"Wimp_OpenWindow",,plblk%
3 : all_over%=
6 :
buttons
8 :
keyPress
9 :
menu_selection
17,18 :
receive
receive
plblk%!16
>%
Quit% : all_over%=
HelpRequest% :
plblk%!32
pane% :win$="PN":
sendhelp
sendhelp
"MessageTrans_Lookup",filedesc%,win$+
plblk%!36,plblk%+20,200
!plblk%=256
plblk%!12=plblk%!8
plblk%!16=HelpReply%
"Wimp_SendMessage",17,plblk%,plblk%!4
"<Ping$Dir>.Pings"
geticontext(pane%,0)
pings%>0
i%=0
pings%-1
\+
#x%,$(pingslot%+maxpinglength%*i%)
memtostring(ptr%)
?ptr%<>0
(?ptr%):ptr%+=1
reminder(mess$)
rewriteIcon(message%,0,mess$)
!wblk%=message%
"Wimp_GetWindowState",,wblk%
centreWindow(wblk%)
wblk%!28=-1
"Wimp_OpenWindow",,wblk%
keyPress
window%=plblk%!0
key%=plblk%!24
key%=13
"Wimp_ProcessKey",key%
menu_selection
option%=plblk%!0
menu%
mainm% :
option%=1
all_over%=
C
option%=0
reminder(
)+" bytes free")
pingm% :
ping_selection
"Wimp_GetPointerInfo",,plblk%
plblk%!8=1
ping_menu
ping_selection
6,129,0
&FF,&FF
,key%
key%=255
pings%>0
cut(option%)
pings%>0
A
rewriteIcon(pane%,0,$(pingslot%+maxpinglength%*option%))
)
"Wimp_GetCaretPosition",,plblk%
h
plblk%!0=pane%
plblk%!4=0
"Wimp_SetCaretPosition",pane%,0,0,0,-1,
geticontext(pane%,0)
buttons
button%=plblk%!8
window%=plblk%!12
icon%=plblk%!16
button%=2
main_menu
menu%=mainm%
"Wimp_CreateMenu",,menublk%,plblk%!0-64,plblk%!4
window%
pane% :
pane_buttons
message% :
closeWindow(message%)
IF button% AND &50 THEN
wblk%!4=pane%:SYS "Wimp_GetWindowState",,wblk%+4: REM drag whole window if not on card
!wblk%=pane%:wblk%!4=1:SYS "Wimp_DragBox",,wblk%
ENDIF
closeWindow(w%)
!wblk%=w%
"Wimp_CloseWindow",,wblk%
openOnTop
!plblk%=pane%
"Wimp_GetWindowState",,plblk%
centreWindow(plblk%)
plblk%!28=-1
"Wimp_OpenWindow",,plblk%
openwin(handle%)
!plblk%=handle%
"Wimp_GetWindowState",,plblk%
plblk%!28=-1
"Wimp_OpenWindow",,plblk%
pane_buttons
icon%
1 :
2 :
3 :
remove
4 :
5 : all_over%=
6 :
ping_menu
cut(what%)
what%<>pings%-1
i%=what%
pings%-1
J $(pingslot%+maxpinglength%*i%)=$(pingslot%+maxpinglength%*(i%+1))
$ $(pingslot%-maxpinglength%)=""
pings%-=1
remove
(at%=
position(
geticontext(pane%,0))
at%<>-1
cut(at%)
pings%<maxpings%
position(
geticontext(pane%,0))=-1
@ $(pingslot%+maxpinglength%*pings%)=
geticontext(pane%,0)
pings%+=1
reminder("Sorry I can only remember "+
maxpings%+" pings.")
position(f$)
return%
return%=-1
pings%>0
i%=0
pings%-1
$(pingslot%+i%*maxpinglength%)=f$
return%=i%
=return%
place$=
geticontext(pane%,0)
"Wimp_StartTask","taskwindow -wimpslot 128k -quit -name PingInfo "+
(34)+"ping -c 10 -q "+place$+
exists(f$)
exists%
"XOS_File",17,(f$)
found%
found%=1
found%=2
exists%=
=exists%
rewriteIcon(wind%,icon%,text$)
!iconblock%=wind%
iconblock%!4=icon%
&400CE,,iconblock%
$iconblock%!28=text$
iconblock%!8=0
iconblock%!12=&400000
&400CD,,iconblock%
geticontext(window%,ic%)
!iconblock%=window%
iconblock%!4=ic%
&400CE,,iconblock%
=$iconblock%!28
centreWindow(b%)
getmodeInfo
width%=(b%!12-b%!4)
height%=(b%!16-b%!8)
x%=(xos%+1-width%)/2
y%=(yos%+1-height%)/2
b%!12=x%+width%:b%!4=x%
b%!16=y%+height%:b%!8=y%
getmodeInfo
"OS_ReadModeVariable",-1,11
,,Xpixels%
"OS_ReadModeVariable",-1,12
,,Ypixels%
"OS_ReadModeVariable",-1,4
,,XEigFactor%
"OS_ReadModeVariable",-1,5
,,YEigFactor%
A"xos%=(Xpixels%+1)<<XEigFactor%
B"yos%=(Ypixels%+1)<<YEigFactor%
get_pings
pings%=0
exists("<Ping$Dir>.Pings")
c%=
"<Ping$Dir>.Pings"
rewriteIcon(pane%,0,
#c%)
pings%<maxpings%
M/ $(pingslot%+maxpinglength%*pings%)=
pings%+=1
RC$(pingslot%+pings%*maxpinglength%)="" :
ensure one empty slot
errbox(msg$,flags%)
Xl!errorblock%=0:$(errorblock%+4)=msg$+
"Wimp_ReportError",errorblock%,flags%, "!Ping"
,errreturn%
main_menu
b%=wblk%
menu_head(b%,"MTITLE")
p%=b%+
"MTITLE"+1+6
menuitem(0,"BM0")
menuitem(&80,"BM1")
c !p%=0
"MessageTrans_MakeMenus",filedesc%,b%,menublk%,256
menublk%!(28+4)=info%
ping_menu
menwid%=9*16:
(title+1)*16
$menublk%="Pings"
menublk%?12=7
menublk%?13=2
menublk%?14=7
menublk%?15=0
menublk%!20=44
menublk%!24=0
at%=menublk%+28
pings%>0
i%=0
pings%-1
inditem(at%,0 ,0 ,&07000111,pingslot%+maxpinglength%*i%)
$(pingslot%+maxpinglength%*i%)>9
menwid%=(
$(pingslot%+maxpinglength%*i%)+1)*16
{/ $pingslot%="Sorry I don't have any pings"
menwid%=32*16
inditem(at%,0 ,0 ,&07000111,pingslot%+maxpinglength%*i%)
at%!(-24)=&80
menu%=pingm%
menublk%!16=menwid%
"Wimp_CreateMenu",,menublk%,plblk%!0+24,plblk%!4+22
menuitem(flags%,token$)
$p%=token$+
token$+1
p%=((p%+3)
!p%=flags%
p%!4=0
p%!8=&7000011
p%+=12
inditem(
where%,mflags%,submpointer%,miconflags%,item%)
where%!0=mflags%
where%!4=submpointer%
where%!8=miconflags%
!(where%+12)=item%
$(item%+
$item%+1)=""
!(where%+16)=item%+
$item%+1
PROCerrbox($item%+" "+$!(where%+16))
!!(where%+20)=1+
$!(where%+16)
where%+=24
menu_head(where%,t$)
$where%=t$
where%+=
t$+1
!where%=&70207
where%?4=44
where%?5=0
load_my_windows
"Wimp_OpenTemplate",,"<Ping$Dir>.Templates"
5indy%=indirected%:ind_end%=indirected%+indlength%
$pane% =
onewindow("Pane")
$info% =
onewindow("Info")
'message% =
onewindow("Message")
"Wimp_CloseTemplate"
onewindow(t$)
"Wimp_LoadTemplate",,wblk%,indy%,ind_end%,-1,t$,0
,,indy%
wblk%!64=sp%
"Wimp_CreateWindow",,wblk%
set_message_numbers
Quit% =0
HelpRequest% =&502
HelpReply% =&503
load_messages
m$="<Ping$Dir>.Messages"
"MessageTrans_FileInfo",,m$
flags%,,size%
"OS_Module",6,,,17+
,,filedesc%
$(filedesc%+16)=m$
"MessageTrans_OpenFile",filedesc%,filedesc%+16,messb%
"MessageTrans_CloseFile",filedesc%