Home » Archimedes archive » Acorn User » AU 1998-09.adf » Features » DesktopPD/Director/!Director/Menus/Files/ExplodeDir
DesktopPD/Director/!Director/Menus/Files/ExplodeDir
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-09.adf » Features |
Filename: | DesktopPD/Director/!Director/Menus/Files/ExplodeDir |
Read OK: | ✔ |
File size: | 0646 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Acorn User » AU 1995-10.adf » !Direct » Director/!Director/Menus/Files/ExplodeDir
- Archimedes archive » Acorn User » AU 1998-09.adf » Features » DesktopPD/Director/!Director/Menus/Files/ExplodeDir
File contents
10REM >Explode 20REM By Dave Lawrence 26Jun95 30 40ON ERROR PRINT REPORT$;" at line ";ERL:END 50DIM buf 512 60 70in$=FNgetargs 80SYS "OS_ReadArgs", "dir/k,title/k,sub/k,add/k,do/k", in$, buf, 512 90dir$=FNstr0(!buf) 100title$=FNstr0(buf!4) 110sub$=FNstr0(buf!8) 120add$=FNstr0(buf!12) 121do$=FNstr0(buf!16) 130IF sub$<>"" sub$="-sub ""Dynamic:/"+sub$+" "+dir$+"""" 140 150menu=FNswi_number("Director_Menu") 160endmenu=FNswi_number("Director_EndMenu") 170option=FNswi_number("Director_Option") 180command=FNswi_number("Director_Command") 190subargs=FNswi_number("OS_SubstituteArgs") 200dash=FNswi_number("Director_Dash") 210 220SYS "OS_FSControl",37,dir$,buf,,,512 230canon$=FNstr0(buf) 240SYS menu,title$+" Explode -temp" 250total=0 260PROCrecurse(canon$,"") 270IF total>0 AND add$<>"" THEN 280 SYS dash 281 SYS option, add$+" -sub ""Dynamic:/"+do$+" "+dir$+"""" 290ENDIF 300*EndMenu 310*Set Director$Menu Explode 320END 330: 340DEF PROCrecurse(from$,pre$) 350LOCAL i 360i=0 370REPEAT 380 SYS "OS_GBPB",12,from$,buf,1,i,128,0 TO ,,,read,i 390 IF read=1 THEN 400 leaf$=FNstr0(buf+24) 410 path$=from$+"."+leaf$ 420 name$=leaf$ 430 IF pre$<>"" name$=pre$+"."+name$ 440 CASE buf!16 OF 450 WHEN 1: 460 spr$ = "small_"+RIGHT$("000"+STR$~buf!20,3) 470 SYS option, name$+" -sprite "+spr$+" "+sub$ 480 total+=1 490 WHEN 2: 500 PROCrecurse(path$, name$) 510 ENDCASE 520 ENDIF 530UNTIL i=-1 540ENDPROC 550 560DEF FNswi_number(swi$) 570SYS "OS_SWINumberFromString",,swi$ TO swi% 580=swi% 590: 600DEF FNgetargs 610SYS "OS_GetEnv" TO A$ 620quit=INSTR(A$,"-quit") 630IF quit=0 quit=INSTR(A$,"-QUIT") 640A$=MID$(A$,quit+6) 650spc=INSTR(A$," ") 660A$=MID$(A$,spc+1) 670=A$ 680: 690DEF FNstr0(A) 700A$="" 710WHILE ?A<>0 720 A$+=CHR$?A 730 A+=1 740ENDWHILE 750=A$
� >Explode � By Dave Lawrence 26Jun95 (� � � �$;" at line ";�:� 2 � buf 512 < Fin$=�getargs PEș "OS_ReadArgs", "dir/k,title/k,sub/k,add/k,do/k", in$, buf, 512 Zdir$=�str0(!buf) dtitle$=�str0(buf!4) nsub$=�str0(buf!8) xadd$=�str0(buf!12) ydo$=�str0(buf!16) �9� sub$<>"" sub$="-sub ""Dynamic:/"+sub$+" "+dir$+"""" � �%menu=�swi_number("Director_Menu") �+endmenu=�swi_number("Director_EndMenu") �)option=�swi_number("Director_Option") �+command=�swi_number("Director_Command") �,subargs=�swi_number("OS_SubstituteArgs") �%dash=�swi_number("Director_Dash") � �'ș "OS_FSControl",37,dir$,buf,,,512 �canon$=�str0(buf) �#ș menu,title$+" Explode -temp" �total=0 �recurse(canon$,"") � total>0 � add$<>"" � ș dash : ș option, add$+" -sub ""Dynamic:/"+do$+" "+dir$+"""" "� ,*EndMenu 6*Set Director$Menu Explode @� J: T� �recurse(from$,pre$) ^� i hi=0 r� |4 ș "OS_GBPB",12,from$,buf,1,i,128,0 � ,,,read,i � � read=1 � � leaf$=�str0(buf+24) � path$=from$+"."+leaf$ � name$=leaf$ �% � pre$<>"" name$=pre$+"."+name$ � Ȏ buf!16 � � � 1: �* spr$ = "small_"+�"000"+�~buf!20,3) �2 ș option, name$+" -sprite "+spr$+" "+sub$ � total+=1 � � 2: � �recurse(path$, name$) � � � � i=-1 � & 0� �swi_number(swi$) :,ș "OS_SWINumberFromString",,swi$ � swi% D =swi% N: X� �getargs bș "OS_GetEnv" � A$ lquit=�A$,"-quit") v� quit=0 quit=�A$,"-QUIT") �A$=�A$,quit+6) �spc=�A$," ") �A$=�A$,spc+1) �=A$ �: �� �str0(A) � A$="" �ȕ ?A<>0 � A$+=�?A � A+=1 �� �=A$ �
00000000 0d 00 0a 0e f4 20 3e 45 78 70 6c 6f 64 65 0d 00 |..... >Explode..| 00000010 14 1e f4 20 42 79 20 44 61 76 65 20 4c 61 77 72 |... By Dave Lawr| 00000020 65 6e 63 65 20 32 36 4a 75 6e 39 35 0d 00 1e 04 |ence 26Jun95....| 00000030 0d 00 28 1c ee 20 85 20 f1 20 f6 24 3b 22 20 61 |..(.. . . .$;" a| 00000040 74 20 6c 69 6e 65 20 22 3b 9e 3a e0 0d 00 32 0d |t line ";.:...2.| 00000050 de 20 62 75 66 20 35 31 32 0d 00 3c 04 0d 00 46 |. buf 512..<...F| 00000060 10 69 6e 24 3d a4 67 65 74 61 72 67 73 0d 00 50 |.in$=.getargs..P| 00000070 45 c8 99 20 22 4f 53 5f 52 65 61 64 41 72 67 73 |E.. "OS_ReadArgs| 00000080 22 2c 20 22 64 69 72 2f 6b 2c 74 69 74 6c 65 2f |", "dir/k,title/| 00000090 6b 2c 73 75 62 2f 6b 2c 61 64 64 2f 6b 2c 64 6f |k,sub/k,add/k,do| 000000a0 2f 6b 22 2c 20 69 6e 24 2c 20 62 75 66 2c 20 35 |/k", in$, buf, 5| 000000b0 31 32 0d 00 5a 14 64 69 72 24 3d a4 73 74 72 30 |12..Z.dir$=.str0| 000000c0 28 21 62 75 66 29 0d 00 64 17 74 69 74 6c 65 24 |(!buf)..d.title$| 000000d0 3d a4 73 74 72 30 28 62 75 66 21 34 29 0d 00 6e |=.str0(buf!4)..n| 000000e0 15 73 75 62 24 3d a4 73 74 72 30 28 62 75 66 21 |.sub$=.str0(buf!| 000000f0 38 29 0d 00 78 16 61 64 64 24 3d a4 73 74 72 30 |8)..x.add$=.str0| 00000100 28 62 75 66 21 31 32 29 0d 00 79 15 64 6f 24 3d |(buf!12)..y.do$=| 00000110 a4 73 74 72 30 28 62 75 66 21 31 36 29 0d 00 82 |.str0(buf!16)...| 00000120 39 e7 20 73 75 62 24 3c 3e 22 22 20 73 75 62 24 |9. sub$<>"" sub$| 00000130 3d 22 2d 73 75 62 20 22 22 44 79 6e 61 6d 69 63 |="-sub ""Dynamic| 00000140 3a 2f 22 2b 73 75 62 24 2b 22 20 22 2b 64 69 72 |:/"+sub$+" "+dir| 00000150 24 2b 22 22 22 22 0d 00 8c 04 0d 00 96 25 6d 65 |$+"""".......%me| 00000160 6e 75 3d a4 73 77 69 5f 6e 75 6d 62 65 72 28 22 |nu=.swi_number("| 00000170 44 69 72 65 63 74 6f 72 5f 4d 65 6e 75 22 29 0d |Director_Menu").| 00000180 00 a0 2b 65 6e 64 6d 65 6e 75 3d a4 73 77 69 5f |..+endmenu=.swi_| 00000190 6e 75 6d 62 65 72 28 22 44 69 72 65 63 74 6f 72 |number("Director| 000001a0 5f 45 6e 64 4d 65 6e 75 22 29 0d 00 aa 29 6f 70 |_EndMenu")...)op| 000001b0 74 69 6f 6e 3d a4 73 77 69 5f 6e 75 6d 62 65 72 |tion=.swi_number| 000001c0 28 22 44 69 72 65 63 74 6f 72 5f 4f 70 74 69 6f |("Director_Optio| 000001d0 6e 22 29 0d 00 b4 2b 63 6f 6d 6d 61 6e 64 3d a4 |n")...+command=.| 000001e0 73 77 69 5f 6e 75 6d 62 65 72 28 22 44 69 72 65 |swi_number("Dire| 000001f0 63 74 6f 72 5f 43 6f 6d 6d 61 6e 64 22 29 0d 00 |ctor_Command")..| 00000200 be 2c 73 75 62 61 72 67 73 3d a4 73 77 69 5f 6e |.,subargs=.swi_n| 00000210 75 6d 62 65 72 28 22 4f 53 5f 53 75 62 73 74 69 |umber("OS_Substi| 00000220 74 75 74 65 41 72 67 73 22 29 0d 00 c8 25 64 61 |tuteArgs")...%da| 00000230 73 68 3d a4 73 77 69 5f 6e 75 6d 62 65 72 28 22 |sh=.swi_number("| 00000240 44 69 72 65 63 74 6f 72 5f 44 61 73 68 22 29 0d |Director_Dash").| 00000250 00 d2 04 0d 00 dc 27 c8 99 20 22 4f 53 5f 46 53 |......'.. "OS_FS| 00000260 43 6f 6e 74 72 6f 6c 22 2c 33 37 2c 64 69 72 24 |Control",37,dir$| 00000270 2c 62 75 66 2c 2c 2c 35 31 32 0d 00 e6 15 63 61 |,buf,,,512....ca| 00000280 6e 6f 6e 24 3d a4 73 74 72 30 28 62 75 66 29 0d |non$=.str0(buf).| 00000290 00 f0 23 c8 99 20 6d 65 6e 75 2c 74 69 74 6c 65 |..#.. menu,title| 000002a0 24 2b 22 20 45 78 70 6c 6f 64 65 20 2d 74 65 6d |$+" Explode -tem| 000002b0 70 22 0d 00 fa 0b 74 6f 74 61 6c 3d 30 0d 01 04 |p"....total=0...| 000002c0 17 f2 72 65 63 75 72 73 65 28 63 61 6e 6f 6e 24 |..recurse(canon$| 000002d0 2c 22 22 29 0d 01 0e 1a e7 20 74 6f 74 61 6c 3e |,"")..... total>| 000002e0 30 20 80 20 61 64 64 24 3c 3e 22 22 20 8c 0d 01 |0 . add$<>"" ...| 000002f0 18 0c 20 c8 99 20 64 61 73 68 0d 01 19 3a 20 c8 |.. .. dash...: .| 00000300 99 20 6f 70 74 69 6f 6e 2c 20 61 64 64 24 2b 22 |. option, add$+"| 00000310 20 2d 73 75 62 20 22 22 44 79 6e 61 6d 69 63 3a | -sub ""Dynamic:| 00000320 2f 22 2b 64 6f 24 2b 22 20 22 2b 64 69 72 24 2b |/"+do$+" "+dir$+| 00000330 22 22 22 22 0d 01 22 05 cd 0d 01 2c 0c 2a 45 6e |"""".."....,.*En| 00000340 64 4d 65 6e 75 0d 01 36 1e 2a 53 65 74 20 44 69 |dMenu..6.*Set Di| 00000350 72 65 63 74 6f 72 24 4d 65 6e 75 20 45 78 70 6c |rector$Menu Expl| 00000360 6f 64 65 0d 01 40 05 e0 0d 01 4a 05 3a 0d 01 54 |ode..@....J.:..T| 00000370 1a dd 20 f2 72 65 63 75 72 73 65 28 66 72 6f 6d |.. .recurse(from| 00000380 24 2c 70 72 65 24 29 0d 01 5e 07 ea 20 69 0d 01 |$,pre$)..^.. i..| 00000390 68 07 69 3d 30 0d 01 72 05 f5 0d 01 7c 34 20 c8 |h.i=0..r....|4 .| 000003a0 99 20 22 4f 53 5f 47 42 50 42 22 2c 31 32 2c 66 |. "OS_GBPB",12,f| 000003b0 72 6f 6d 24 2c 62 75 66 2c 31 2c 69 2c 31 32 38 |rom$,buf,1,i,128| 000003c0 2c 30 20 b8 20 2c 2c 2c 72 65 61 64 2c 69 0d 01 |,0 . ,,,read,i..| 000003d0 86 0f 20 e7 20 72 65 61 64 3d 31 20 8c 0d 01 90 |.. . read=1 ....| 000003e0 19 20 20 6c 65 61 66 24 3d a4 73 74 72 30 28 62 |. leaf$=.str0(b| 000003f0 75 66 2b 32 34 29 0d 01 9a 1b 20 20 70 61 74 68 |uf+24).... path| 00000400 24 3d 66 72 6f 6d 24 2b 22 2e 22 2b 6c 65 61 66 |$=from$+"."+leaf| 00000410 24 0d 01 a4 11 20 20 6e 61 6d 65 24 3d 6c 65 61 |$.... name$=lea| 00000420 66 24 0d 01 ae 25 20 20 e7 20 70 72 65 24 3c 3e |f$...% . pre$<>| 00000430 22 22 20 6e 61 6d 65 24 3d 70 72 65 24 2b 22 2e |"" name$=pre$+".| 00000440 22 2b 6e 61 6d 65 24 0d 01 b8 11 20 20 c8 8e 20 |"+name$.... .. | 00000450 62 75 66 21 31 36 20 ca 0d 01 c2 0b 20 20 20 c9 |buf!16 ..... .| 00000460 20 31 3a 0d 01 cc 2a 20 20 20 20 73 70 72 24 20 | 1:...* spr$ | 00000470 3d 20 22 73 6d 61 6c 6c 5f 22 2b c2 22 30 30 30 |= "small_"+."000| 00000480 22 2b c3 7e 62 75 66 21 32 30 2c 33 29 0d 01 d6 |"+.~buf!20,3)...| 00000490 32 20 20 20 20 c8 99 20 6f 70 74 69 6f 6e 2c 20 |2 .. option, | 000004a0 6e 61 6d 65 24 2b 22 20 2d 73 70 72 69 74 65 20 |name$+" -sprite | 000004b0 22 2b 73 70 72 24 2b 22 20 22 2b 73 75 62 24 0d |"+spr$+" "+sub$.| 000004c0 01 e0 10 20 20 20 20 74 6f 74 61 6c 2b 3d 31 0d |... total+=1.| 000004d0 01 ea 0b 20 20 20 c9 20 32 3a 0d 01 f4 1e 20 20 |... . 2:.... | 000004e0 20 20 f2 72 65 63 75 72 73 65 28 70 61 74 68 24 | .recurse(path$| 000004f0 2c 20 6e 61 6d 65 24 29 0d 01 fe 07 20 20 cb 0d |, name$).... ..| 00000500 02 08 06 20 cd 0d 02 12 0a fd 20 69 3d 2d 31 0d |... ...... i=-1.| 00000510 02 1c 05 e1 0d 02 26 04 0d 02 30 17 dd 20 a4 73 |......&...0.. .s| 00000520 77 69 5f 6e 75 6d 62 65 72 28 73 77 69 24 29 0d |wi_number(swi$).| 00000530 02 3a 2c c8 99 20 22 4f 53 5f 53 57 49 4e 75 6d |.:,.. "OS_SWINum| 00000540 62 65 72 46 72 6f 6d 53 74 72 69 6e 67 22 2c 2c |berFromString",,| 00000550 73 77 69 24 20 b8 20 73 77 69 25 0d 02 44 09 3d |swi$ . swi%..D.=| 00000560 73 77 69 25 0d 02 4e 05 3a 0d 02 58 0e dd 20 a4 |swi%..N.:..X.. .| 00000570 67 65 74 61 72 67 73 0d 02 62 17 c8 99 20 22 4f |getargs..b... "O| 00000580 53 5f 47 65 74 45 6e 76 22 20 b8 20 41 24 0d 02 |S_GetEnv" . A$..| 00000590 6c 15 71 75 69 74 3d a7 41 24 2c 22 2d 71 75 69 |l.quit=.A$,"-qui| 000005a0 74 22 29 0d 02 76 1e e7 20 71 75 69 74 3d 30 20 |t")..v.. quit=0 | 000005b0 71 75 69 74 3d a7 41 24 2c 22 2d 51 55 49 54 22 |quit=.A$,"-QUIT"| 000005c0 29 0d 02 80 12 41 24 3d c1 41 24 2c 71 75 69 74 |)....A$=.A$,quit| 000005d0 2b 36 29 0d 02 8a 10 73 70 63 3d a7 41 24 2c 22 |+6)....spc=.A$,"| 000005e0 20 22 29 0d 02 94 11 41 24 3d c1 41 24 2c 73 70 | ")....A$=.A$,sp| 000005f0 63 2b 31 29 0d 02 9e 07 3d 41 24 0d 02 a8 05 3a |c+1)....=A$....:| 00000600 0d 02 b2 0e dd 20 a4 73 74 72 30 28 41 29 0d 02 |..... .str0(A)..| 00000610 bc 09 41 24 3d 22 22 0d 02 c6 0c c8 95 20 3f 41 |..A$=""...... ?A| 00000620 3c 3e 30 0d 02 d0 0c 20 41 24 2b 3d bd 3f 41 0d |<>0.... A$+=.?A.| 00000630 02 da 09 20 41 2b 3d 31 0d 02 e4 05 ce 0d 02 ee |... A+=1........| 00000640 07 3d 41 24 0d ff |.=A$..| 00000646