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

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