home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User 4
/
AUCD4.iso
/
education
/
_cogsys
/
_getres
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1997-10-20
|
5KB
|
235 lines
>!RunImage
GetRes
S.H.Curry III
__ _
(_ _|_ ._ _ ._ _ /_\ ._ ._ _
__) |_ | (_)| |(_|/ \| | | |
_|
Last Modified 19 October, 1997
prog$="!GetRes"
version$="0.1"
debug%=
throwback%=
initialised%=
quit%=
error(
debug%
#file%,"Page = &"+
#file%,"HIMEM = &"+
#file%,"LOMEM = &"+
#file%,"Dim = &"+
~(used%)
#file%,"WimpSlot = "+
)+used%)/1024)
initialised%=
error(
+pollmask%=
_Create_Poll_Mask("0,17,18")
"Wimp_Poll",pollmask%,q%
reason%
respond(reason%)
quit%
_Create_Poll_Mask(valid_list$)
more%,reason_code%,comma%
mask%=%11111111111111111111
more%=
more%
reason_code%=
(valid_list$)
(!mask%=mask%
1<<reason_code%
comma%=
valid_list$,",")
comma%=0
more%=
-&valid_list$=
valid_list$,comma%+1)
=mask%
respond(reason%)
reason%
background
17,18:
umess1
background
speak%=
there(speakmod$)
speak%<>0
set_spkflag(
set_spkflag(
quit%=
error(err%,err$,erl%,finish%)
i%,e%,t$,T$
normpoint
error(
throwback%
("Set Basic$File <CogSys$Path>.!GetRes")
"Edit:Throwback"
!q%=err%
err$+=" ("+
$(q%+4)=err$
"Wimp_ReportError",q%,5,prog$
finish%
q% &1000, workbuf% 256
used%+=&1000
used%+=256
spkflag% 7
used%+=7
$spkflag%="CogSpk$"
flag% 25
used%+=25
no% 3
used%+=3
$no%="NO"+
ok% 3
used%+=3
$ok%="OK"+
used%=0
date$=
$,15)
mon$=
$,8,3)
year$=
$,12,4)
i$res_mod$="<CogSys$Path>.Modules"
speakmod$="LoadSpeak"
lAv%=
initwimp:
v%<300:
99,"Must be version 3.0 WIMP or later"
debug%
initdebug
read_mods
set_spkflag(cond%)
On entry
R0 - pointer to variable name
R1 - pointer to variable value
R2 - len of value or negative to delete the variable
R3 - context pointer or 0 for 1st call
R4 - variable type
On Exit
R0,R1,R2 - preserved
R3 - new context pointer
R4 - variable type created if expression evaluated
cond%
"XOS_SetVarVal",spkflag%,ok%,2,0,0
"XOS_SetVarVal",spkflag%,no%,2,0,0
check_spkflag
On entry
R0 - pointer to variable name
R1 - pointer to buffer to hold variable value
R2 - max len of buffer or bit 31 set to existence/lenght of variable
R3 - context pointer or 0 for 1st call
R4 - 3 if expanded string is to be converted on return
On Exit
R0,R1 - preserved
R2 - number of bytes read
R3 - new context pointer
R4 - variable type
a%,b%,num%,c%,type%,temp$
temp$=""
"XOS_ReadVarVal",spkflag%,flag%,-1,0,0
a%,b%,num%,c%,type%
num%=0
variable does not exist
Z%=
"XOS_ReadVarVal",spkflag%,flag%,25,0,0
a%,b%,num%,c%,type%
type%=0
temp$=
gets(flag%,num%)
Z%=
temp$<>"OK"
bip(voice%,pitch%,dur%)
voice%,-15,pitch%,dur%
gets(t%,l%)
i%,t$
t$=""
l%=0 =t$
i%=1
t$+=
t%?(i%-1)
prequit
ackrec
quit%=
umess1
ref%=q%!8
task%=q%!4
task%<>taskhandle%
mess%=q%!16
mess%
0:quit%=
prequit
&502:
ackrec:q%!12=ref%:
"Wimp_SendMessage",19,q%,task%
initwimp
$q%="TASK"
"Wimp_Initialise",310,!q%,prog$
!q%,taskhandle%
$q%="TASK"
"Wimp_CloseDown",taskhandle%,!q%
initdebug
"Pipe:$.DebugFile"
file%=
#file%,"Traced output from "+prog$
#file%,""
path$="<CogSys$Path>.DeBug"
name$=
34+"Debug Output"+
+com$=
34+"Obey "+path$+".!RunDebug"+
("Wimptask TaskWindow "+com$+" -name "+name$+" -display -quit")
read_mods
temp%
0num_modules%=
read_number_of_files(res_mod$)
module$(num_modules%)
used%+=255*num_modules%
)temp%=
read_files(module$(),res_mod$)
read_number_of_files(DataDir$)
next%=0
files%=0
"OS_GBPB",10,DataDir$,workbuf%,1,next%,32,"*"
,,,read%,next%
(workbuf%!16=1)
read%=1
files%+=1
next%<0
=files%
read_files(array$(),DataDir$)
next%,temp$
next%=0
files%=0
"OS_GBPB",10,DataDir$,workbuf%,1,next%,32,"*"
,,,read%,next%
(workbuf%!16=1)
read%=1
files%+=1
4 array$(files%)=DataDir$+"."+
zts(workbuf%+20)
next%<0
=files%
zts(T%)
?T%<>0
T$+=
T%+=1
there(in$)
found%
found%=0
loop%=1
num_modules%
in$=
_Leaf(module$(loop%))
found%=loop%
=found%
_Leaf(process_string$)
string$,loop%
loop%=
(process_string$)
process_string$,loop%,1)<>"."
-string$=
process_string$,loop%,1)+string$
loop%-=1
=string$