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 (2 months, 1 week ago) by snw
Branches: MAIN, CoherentLogicDevelopment
CVS tags: v0-62-3, v0-62-2, v0-62-1, v0-62-0, start, HEAD
FreeM

%GD	; A.Trocha; Global Directory 01/29/1999 00:44/GMT+1
	; $Source: /home/cvsroot/freem/contrib/%GD.m,v $
	; $Revision: 1.1.1.1 $ $Date: 2025/01/19 02:04:04 $
	;
	; this version is very, very beta
	;
	; todo: LOCKING!!
	;
	N gnorm,gsys,xdir,anz
	;
	;--- path to non-% globals
	S gnorm=$V(3)
	;
	;--- path to %-globals
	S gsys=$V(6)
	;
	;
	W !,?20,"GLOBAL DIRECTORY   "_$ZD
	W !,?23,"OF FreeM       "_$ZT
	W !!
	;
	S anz=0
	;
	;--- get and output %-globals
	K %
	S xdir="!<"_$$dircmd()_" "_$$convpath(gsys)_"^* 2>/dev/null"
	S $ZT="error^"_$ZN
	X xdir D show(0)
	;
	;--- get and output non-% globals
	K %
	S xdir="!<"_$$dircmd()_" "_$$convpath(gnorm)_"^* 2>/dev/null"
	X xdir D show(1)
	;
end	W !,$J(anz,8)," - Globals",!!
	K %
	Q
	;
show(m)	;--- show globals
	;    m=0 show %global  ;   m=1 show non% globals
	;    do not output ^$<xxxxxx>
	N i
	F i=1:1:% D
	. I $G(m)=0&('$F($G(%(i)),"%")) Q
	. I $G(m)=1&($F($G(%(i)),"%")) Q
	. I $F($G(%(i)),"$") Q
	. W $$lb("^"_$P($G(%(i)),"^",2)) S anz=anz+1
	Q
	;
convpath(dir) ;--- convert path
	N sl
	S sl=$$slash()
	I dir="" Q ""
	I dir="."_sl Q ""
	I $E(dir,$L(dir))'=sl Q dir_sl
	Q dir
	;
lb(str)	;---
	Q $E(str,1,9)_$J("",10-$L(str))
	;
slash() ;--- get the OS specific directory delimiter (slash)
	Q "/"
	;
dircmd() ;--
	;--- get the OS specific directory command
	;--- hmm!? how do I know which OS?
	Q "ls"
	;
error	;--- error - trap
	W !,$ZE,!!
	K % Q

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