Menu

#538 SysFileTree() 3.9.3

Next Release
open
nobody
Regutil (6)
5
2020-07-11
2020-03-14
frank
No
   A.7 = '?DHRS'                 ;  A.6 = '?DHR-'
   A.5 = '?DH-S'                 ;  A.4 = '?DH--'
   A.3 = '?D-RS'                 ;  A.2 = '?D-R-'
   A.1 = '?D--S'                 ;  A.0 = '?D---'

   do N = 0 to 7
      A.. = translate( A.N, '*++++', '?DHRS' )
      X = SysFileTree( 'C:\*', 'D', 'DOS', A.. )
      if X <> 0   then  exit ERROR( 'SysFileTree failure' X )
      say A.N 'directories' D.0
   end N
   return 0

This code is supposed to count the directory attribute combos (?+--- up to ?++++, for ? read asterisk) on a Windows C:\ drive. Output ooRexx example:

c:\etc\bin>adhrs
?D--- directories 47845
?D--S directories 178
?D-R- directories 233
?D-RS directories 15
?DH-- directories 81
?DH-S directories 507
?DHR- directories 8
?DHRS directories 16

Regina 3.9.3 example:

c:\etc\bin>regina adhrs
?D--- directories 47845
?D--S directories 48023
?D-R- directories 48078
?D-RS directories 48271
?DH-- directories 47926
?DH-S directories 48611
?DHR- directories 48167
?DHRS directories 48883

Caveat, the first run can be very slow, after that it is faster, i.e., the Windows file system cache is populated. Regina's SysFileTree() tends to be more ronust + faster than ooRexx 4.2.0, but here the winner was ooRexx.

JFTR, three doskey aliases:
~~~
c:\etc\bin>alias
alias=doskey /m $
regina=@"C:\etc\bin\REXX\Regina\regina.exe" $

interpret=echo interpret arg(1)|@"C:\etc\bin\REXX\Regina\rexx.exe" -a $*
~~~:

Discussion

  • frank

    frank - 2020-03-14

    Sorry, I suck with markdown in any flavour, the aliases should end with a $?, and for ? read asterisk.

     
  • Paul Kislanko

    Paul Kislanko - 2020-03-14

    Your REXX example depends upon language level 6, and Regina is language level 5. You can run language level 5 code in level 6, but not necessarily language level 6 in an level 5 interpreter.

    In particular, your code assumes
    A.. = ...
    sets more than one variable. But in classical REXX it just sets one, namely A..

     
  • frank

    frank - 2020-03-17

    A.. is classic Rexx, same idea as A.0, dot and zero are constants.

     
  • Paul Kislanko

    Paul Kislanko - 2020-07-11

    ,A.. is classic Rexxm but A.. = ... only sets one variable. You can't use A... = to set all variables that begin with A.. the way you can set all variables that begin with A.

    A.. = 'A..'
    say a..1
    A..1
    

    I used to wish that A.x. = '' would initialize all possible A.x without disturbing the setting for A.y, but there's probably no practical way to make that syntax consistent, much less implement it. A.. = .. is only going to set 1 variable, and I think you wanted it to mean all possible A.., and it doesn't do that.

     

Log in to post a comment.