Menu

address SYSTEM

frank
2020-04-06
2020-04-30
  • frank

    frank - 2020-04-06

    I kind of like address SYSTEM, it's an intuitively clear idea for folks used to a C function system(). However, ooRexx does not have it, they offer anaddress CMD (on NT and OS/2) matching Regina address SYSTEM, and a Windows only RexxUtil RxWinExec() remotely related to Regina address CMD, actually a simplified address SYSTEM 'start', so far I never used it.

    In an attempt to avoid RegUtil SysFileDelete(), because static Regina can't do that, I tried call SYSTEM 'del'whatever using a wannabe-portable...

    /* ----------------------------- (wrap address SYSTEM 2020-03-17) */
    /* Regina uses an intuitive address SYSTEM for internal commands, */
    /* redirections, and pipes.  Regina uses address CMD for external */
    /* commands, roughly that is an address SYSTEM 'start ... /WAIT'. */
    /* An ooRexx address CMD corresponds to Regina address SYSTEM, on */
    /* Windows ooRexx RexxUtil has RxWinExec() for external commands. */
    
    SYSTEM:  procedure expose rc
       parse version S V .           ;  call on FAILURE   name ERROR
       if ( V == 5.00 ) | ( 6 <= V & V < 7 )  then  do
          if V = 5 then  address SYSTEM arg( 1 )          /* Regina   */
                   else  address CMD    arg( 1 )          /* (o)oRexx */
          return .RS < 0                                  /* 1: fail  */
       end                           /* Kedit KEXX 5.xy not supported */
       exit ERROR( 'Please edit procedure SYSTEM() for' S V )
    

    Works as it should on Windows, presumably also for DOS or OS(2, with ooRexx or Regina. But it would be a seriously bad idea in any shell without a del command, e.g, a bash expecting rm, a clear showstopper for my portability dreams.

    OTOH there are only two vital RexxUtil functions for my purposes:SysFileDelete (1st place with a huge margin), SysFileTree (limited to three arguments), and while SysMkDir() + SysRmDir() would be also nice they are less important, md + rd happen to work also for bash etc.

    So now I wonder if static Regina could support a minimal subset of RegUtil as built-in functions.

     
  • Paul Kislanko

    Paul Kislanko - 2020-04-30

    Not sure what you mean by "static" regina, but once you've registered the RegUtil functions they are "built-in." They are just not part of the language because they are platform-dependent.

     

Log in to post a comment.