31
Programming / Re: [Classic REXX] Network Map
« on: March 23, 2025, 08:46:43 am »
I've added a line to the script to open the folder as it refresh the devices.
OS2World.com Forum is back !!!
Remember to visit OS2World at:
http://www.os2world.com
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
/* Purpose: Get information about the drive where the OS has been installed to */
/* Somewhat extended (and renamed) version of the one found in Rexx Tips & Tricks v3.60 */
/* Note the use of OS2ENVIRONMENT instead of just ENVIRONMENT as one can't assume a certain baseline version without forcing that one on others */
RxBootDrive: PROCEDURE EXPOSE (exposeList)
/* install a local error handler */
SIGNAL ON SYNTAX NAME BootDrive
boot_drive = ''
boot_drive = SysBootDrive()
BootDrive:
/* boot_drive is still empty if SysBootDrive() failed */
/* SysBootDrive() is only available in the newer versions of REXXUTIL! */
IF boot_drive = '' THEN
DO
/* Do further tests to ensure that the result of this method is correct! */
PARSE UPPER VALUE VALUE( "PATH",, prog.__env ) WITH "\OS2\SYSTEM" -2 boot_drive +2
boot_drive = STRIP( boot_drive )
os_dir = STRIP( LEFT( VALUE( 'OSDIR',, 'OS2ENVIRONMENT' ), 2 ) )
sys_cmd = STRIP( LEFT( VALUE( 'COMSPEC',, 'OS2ENVIRONMENT' ), 2 ) )
IF LENGTH( os_dir ) = 2 & LENGTH( sys_cmd ) = 2 THEN
IF os_dir = sys_cmd THEN RETURN os_dir
IF LENGTH( os_dir ) = 2 THEN
IF boot_drive = os_dir THEN RETURN boot_drive
IF LENGTH( sys_cmd ) = 2 THEN
IF boot_drive = sys_cmd THEN RETURN boot_drive
END
RETURN boot_drive
Title | Type (Help/Tutorial/Reference/Guide/Examples/...) | Location | Format (pdf/inf/html/...) | License (free/gpl 3/restricted/commercial/...) | Interpreter (CRexx/ORexx/ooRexx/ARexx/BRexx/Regina/Roo) |
/* Retrieve help/tutorial/guide/intro to REXX */
'@yum -y install wget' /* ensure wget is available so we can retrieve/tools/packages/... from the web */
The above code would use the external tool and run yum. @ ensure that the command yum -y install wget doesn't appear on screen, while the output from the command do.IF dir < dir.0 THEN leader = D2C(195)can be shortened to
ELSE leader = D2C(192)
leader = D2C( 192 + 3 * ( dir < dir.0 ) )
/**/
parse arg where
call lineout where,' 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5'
do i=1 to 15
call charout where,' '||right(i*16,3,' ')
do j=0 to 15
call charout where,' '||d2c(i*16+j)
end
call lineout where,' '||right(16*i+15,3,' ')
end
call lineout where,' 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5'
call lineout where
exit
[b]"Not tokenized"[/b]
The text has to be read and interpreted over and over again as it run loops and process instructions.
Comparisons performed letter by letter to determine what instruction for instruction lead to
[b]"Tokenization"[/b]
The text code read into memory is prepared before the engine run it
Each time a variable get mentioned it is replaced by a placeholder that point to memory, specific to the computer and architecture.
All references that point to that placeholder/memory can then be directly read/written/used instead of looking/searching/comparing through text.
[b]"Tokenized"[/b]
The non text tokenized code in memory can execute the instructions the way the computer work.
I don't know; doesn't this mean exactly the opposite?Quote from: RexxUtil.infSyntax
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ──SysSaveRexxMacroSpace( file )─────────────────────────────────── │
│ │
└───────────────────────────────────────────────────────────────────────────┘
Description
Saves all functions in the REXX macrospace to a file. These functions can be loaded again later using the SysLoadRexxMacroSpace function.
It's not directly editable or in plain text, it's what one would think of as "compiled" or as better described, tokenized into machine readable code (see more accurate info below).
It's also a hassle to create functions that way, the code for it has to be written into one script that gets tokenized and save the code on the side.
The benefit of Object Rexx and ooRexx is that one can write rexx code in a plain text file and call one or more functions/methods as it behave as part of the main script.
from
Rexx Tips & Tricks, Version 3.60QuoteAnother method to create a token image of your REXX program is to load the REXX program into the macro space and save the macro space into a file. This will produce a token image of your REXX program that you can reload into the macrospace and execute it from there. This method also avoids the 64 K limit of the EAs. (see REXXCC - a REXX "compiler")
In this case you need an additional loader to load the token image into the macro space again before you can execute it.
Jan-Erik, you wouldn't mind if I borrowed some of your opening description for a wiki page on the ArcaOS site, would you? An interesting question cropped up in the bug tracker today, and I had to over-simplify my answer. I realized that we really didn't have anything REXX-related in the wiki (though we do have pages for DOS and Win-OS/2 and the like).I don't mind.
That same question holds true for everyone else in this thread, as this is some good, solid info which bears repeating, I think.