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

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