File:  [Coherent Logic Development] / freem / contrib / %RD.m
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jan 19 02:04:04 2025 UTC (6 months, 1 week ago) by snw
Branches: MAIN, CoherentLogicDevelopment
CVS tags: v0-63-1-rc1, v0-63-0-rc1, v0-63-0, v0-62-3, v0-62-2, v0-62-1, v0-62-0, start, HEAD
FreeM

    1: %RD	; A.Trocha; Routine Directory 01/29/1999 01:30/GMT+1
    2: 	; $Source: /home/cvsroot/freem/contrib/%RD.m,v $
    3: 	; $Revision: 1.1.1.1 $ $Date: 2025/01/19 02:04:04 $
    4: 	; this version is very, very beta
    5: 	; todo: LOCKING!!
    6: 	;
    7: 	N rnorm,rsys,xdir,anz,ext
    8: 	;
    9: 	;--- path to non-% routines
   10: 	S rnorm=$V(4)
   11: 	;
   12: 	;--- path to %-routines
   13: 	S rsys=$V(8)
   14: 	;
   15: 	;--- get routine extention
   16: 	S ext=$V(98)
   17: 	;
   18: 	W !,?20,"ROUTINE DIRECTORY  "_$ZD
   19: 	W !,?23," OF FreeM      "_$ZT
   20: 	W !!
   21: 	;
   22: 	S anz=0
   23: 	;
   24: 	;--- get and output %-routines
   25: 	K %
   26: 	S xdir="!<"_$$dircmd()_" "_$$convpath(rsys)_"*"_ext_" 2>/dev/null"
   27: 	S $ZT="error^"_$ZN
   28: 	X xdir D show($$convpath(rsys),0)
   29: 	;
   30: 	;--- get and output non-% routines
   31: 	K %
   32: 	S xdir="!<"_$$dircmd()_" "_$$convpath(rnorm)_"*"_ext_" 2>/dev/null"
   33: 	X xdir D show($$convpath(rnorm),1)
   34: 	;
   35: end	W !,$J(anz,8)," - Routines",!!
   36: 	K %
   37: 	Q
   38: 	;
   39: show(path,m) ;--- show routines
   40: 	;    m=0 show %routines  ;   m=1 show non% routines
   41: 	N i,out
   42: 	F i=1:1:% D
   43: 	. I $G(m)=0&('$F($G(%(i)),"%")) Q
   44: 	. I $G(m)=1&($F($G(%(i)),"%")) Q
   45: 	. S out=$G(%(i))
   46: 	. I path'="" S out=$E(out,$L(path)+1,$L(out))
   47: 	. S out=$E(out,1,$L(out)-$L(ext))
   48: 	. W $$lb("^"_out) S anz=anz+1
   49: 	Q
   50: 	;
   51: convpath(dir)
   52: 	;--- convert path
   53: 	N sl
   54: 	S sl=$$slash()
   55: 	I dir="" Q ""
   56: 	I dir="."_sl Q ""
   57: 	I $E(dir,$L(dir))'=sl Q dir_sl
   58: 	Q dir
   59: 	;
   60: lb(str)	;---
   61: 	Q $E(str,1,9)_$J("",10-$L(str))
   62: 	;
   63: slash() ;--- get the OS specific directory delimiter (slash)
   64: 	Q "/"
   65: 	;
   66: dircmd() ;
   67: 	;--- get the OS specific directory command
   68: 	;--- hmm!? how do I know which OS?
   69: 	Q "ls"
   70: 	;
   71: error	;--- error - trap
   72: 	W !,$ZE,!!
   73: 	K % Q

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>