home *** CD-ROM | disk | FTP | other *** search
- /*
- \ $VER: ShowMenu.Rexx 0.985 (AMG 920317)
- \
- / Prints an overview of all the DLG menus. Refer to the DLG Manual
- \ for the abbreviations of the flags.
- \
- / To do:
- \ better error checking
- / more elegant conversion of struct MenuEntry
- /
- / (C) 1992 by Arnout Grootveld, 2:281/100@FidoNet
- \
- \ Freely distributable. Feel free to do the 'To do' things :-)
- */
-
- parse value sourceline(2) with . '$VER: ' name
- say name
- say
-
- if ~show('L','rexxsupport.library') then
- if ~addlib('rexxsupport.library',0,-30,0) then do
- say "I really need rexxsupport.library!"
- exit 20
- end
-
- MENUDIR='DLGConfig:Menu/'
-
- CmdType. ='???'
- CmdType.1='Exe'
- CmdType.2='Bat'
- CmdType.3='Sub'
- CmdType.4='DLG'
-
- /* Some bit indirection and layout for the flags */
- Bit.1 = 6;Spc.1 =' '
- Bit.2 =13;Spc.2 =' '
- Bit.3 = 1;Spc.3 =' '
- Bit.4 = 0;Spc.4 =' '
- Bit.5 = 8;Spc.5 =' '
- Bit.6 = 9;Spc.6 =' '
- Bit.7 =18;Spc.7 =' '
- Bit.8 =14;Spc.8 =' '
- Bit.9 = 2;Spc.9 =' '
- Bit.10=12;Spc.10=' '
- Bit.11=19;Spc.11=' '
- Bit.12=21;Spc.12=''
-
- menus=showdir(MENUDIR,'f',':');
-
- do until menus=''
- parse var menus menu ':' menus
- if upper(right(menu,5))~='.MENU' then iterate /* allow for other files */
- call open('in',MENUDIR||menu,'R')
- say menu" - "PadRight(C2AStr(readch('in',61)),61)
- say copies(' ',41)"Lev R C D CL E PK KP PT P r T V LF"
- do while ~eof('in')
- entry=readch('in',114)
- if length(entry)~=114 then leave
- command=GetItem(1)
- program=PadRight(C2AStr(GetItem(71)),71)
- description=PadRight(C2AStr(GetItem(33)),33)
- retflag=c2d(GetItem(1))
- type=c2d(GetItem(1))
- call GetItem(1) /* skip padbyte */
- tptflags=GetItem(4)
- user_level=PadLeft(c2d(GetItem(1)),3)
- if type=3
- then flagstr='- - - - - - - - - - - - -' /* submenu */
- else do /* otherwise */
- if retflag=0
- then flagstr='n '
- else flagstr='y '
- do flag=1 to 12
- if bittst(tptflags,Bit.flag)
- then flagstr=flagstr||'y'
- else flagstr=flagstr||'n'
- flagstr=flagstr||Spc.flag
- end
- end
- say ' ['command'] 'description' 'user_level' 'flagstr
- say ' 'CmdType.type' 'program
- say
- end
- call close('in')
- say
- end
-
- exit
-
- C2AStr: procedure /* Convert null-terminated C string to ARexx string */
- str=arg(1)||d2c(0)
- return left(str,pos(d2c(0),str)-1)
-
- PadRight: procedure /* Pad arg(1) on right so length=arg(2) */
- return left(arg(1)||copies(' ',arg(2)),arg(2))
-
- PadLeft: procedure /* Pad arg(1) on left so length=arg(2) */
- return right(copies(' ',arg(2))||arg(1),arg(2))
-
- GetItem: procedure expose entry /* very ugly way to use kind of C structs */
- tmp=left(entry,arg(1))
- entry=delstr(entry,1,arg(1))
- return tmp
-