home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
filemanager
/
director_1
/
!Director
/
Menus
/
System
/
ExpPath
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1995-06-16
|
3KB
|
174 lines
>Director:Menus.System.ExpPath
This expands a path into a serious of menu entries
By SJM (simon@uniqway.demon.co.uk)
Call with the Path variable to be expanded as the argument
eg "Dynamic:/Director:Menus.System.ExpPath C"
1.00 15/5/95 SJM Started
1.01 23/5/95 SJM Fixed bug with Foo: path entries
1.02 26/5/95 NCW Made it recurse in Foo:Bar entries also
Collapses paths as far as possible
$+" at "+
set this to false if you don't want nested paths to be expanded also
allow_recurse=
debug=
(XOS_Module=
swi_number("XOS_Module")
%Menu=
swi_number("Director_Menu")
+EndMenu=
swi_number("Director_EndMenu")
)Option=
swi_number("Director_Option")
+Command=
swi_number("Director_Command")
%Dash=
swi_number("Director_Dash")
0XOS_ReadVarVal=
swi_number("XOS_ReadVarVal")
buffer_size%=1024
buffer% buffer_size%
"OS_GetEnv"
skippast
A$,1)=" " A$=
A$,5))="-QUIT"
skippast :
skippast
path$=A$
title$=path$
reduce(path$, dir$,
make_menu
"Set Director$Menu ExpandedPath"
path$+=dir$
"." =
path$)
path$ =
path$)
"Set Director$Menu Path:"+path$
make_menu
Menu,""""+title$+""" ExpandedPath -temp"
comma%=
path$,",",1)
comma%
comma% = 1
element$=""
<& element$=
path$,comma%-1)
> path$=
path$,comma%+1)
?
element$=path$
path$=""
B
element$+=dir$
E$
element$=""
element$="@"
G, recurse%=
reduce(element$, edir$,
element$+=edir$
I&
allow_recurse=0
recurse%=
K2
"." =
element$)
element$ =
element$)
recurse%
Mv
Option,""""+element$+""" -sub ""Dynamic:/Director:Menus.System.ExpPath "+element$+""" -sprite small_path"
N
O,
Option,"-path "+element$+" -up"
P
path$=""
EndMenu
reduce(
path$,
dir$, all_the_way%)
done%,p%,q%,var$,a$,more%
dir$=""
more%=
\4
debug
Option,"["+path$+dir$+"] -grey"
done%=
p%=
path$,":")
`* var$=
read(
path$,p%-1)+"$Path")
var$<>""
q%=
var$,",")
d#
q%=0
all_the_way%
a$=
path$,p%+1)
f,
a$)<>"."
a$<>""
a$+="."
dir$=a$+dir$
path$=var$
i(
dir$)="."
dir$=
dir$)
j(
q%=0
done%=
more%=
more%=
p
done%
=more%
swi_number(name$)
"OS_SWINumberFromString",,name$
0(a%)
y s$=""
?a%<>0
s$+=
a%+=1
skiptospace
A$,1)<>" "
A$<>0 A$=
A$,2):
skipspace
A$,1)=" " A$=
A$,2):
skippast
skiptospace:
skipspace:
uc(a$)
Z%,z$,b$
a$,Z%,1)
z$>="a"
z$<="z" z$=
z$-32)
b$+=z$:
leaf(path$)
leaf$=""
path$
"." =
path$,I,1)
path$,I+1)
=path$
read(a$)
read%,flags%
?buffer%=13
XOS_ReadVarVal,a$,buffer%,buffer_size%,0,3
,,read%;flags%
flags%
read%=0
buffer%?read%=13
=$buffer%