Show Posts

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.


Messages - Jan-Erik Lärka

Pages: 1 2 [3] 4 5 ... 22
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.

32
Hello,

Here's a script I've just completed to download and install information about REXX.
You have 10 titles to choose from and enjoy.

Beware that the script has not been tested that much and may cause problems, especially when sites such as hobbesarchive.com complain or is down.
I leave testing and extending the script to you, to enhance it further.


 REXX tutorials under ArcaOS out-of-the-box
 ==========================================
 1. REXX for the absolute beginner: Installed
 2. Rexx Reference Summary Handbook: Installed
 3. REXX Tips & Tricks v3.60: Installed
 4. Learning REXX Programming in 56,479 Steps: Installed
 5. OS/2 REXX. From Bark to Byte: Installed
 6. REXX Programmers Reference 2nd Edition: Installed
 7. REXX Tutorial: Installed
 8. A Practical Approach to Programming: Installed
 9. OS/2 2.1 Rexx Handbook (Warning! 321MB): Installed
10. Extending the Workplace Shell with Object Rexx: Installed

 Install <A>ll or 1, 2 ... ( ? for additional Info, 0 to Exit ):


Regards,
//Jan-Erik

33
Programming / [Classic REXX] Network Map
« on: March 16, 2025, 04:16:38 pm »
I'm trying to write a REXX script to list the devices available on my home LAN.

It use commands available in the OS to get the host name, ip-number and mac address.

Here I can see on the names that it has found computers, mobile phones, vacuum cleaner, routers etc. on the same subnet and indicate if they're offline or not.
I'd also like to, if possible, find out what kind of device the script has listed and set icons accordingly, and not just online/offline. How?!

That also mean that I need help to create the artwork for it.  ;)

The script in default mode without parameters determine the ip-address of the computer, ping and check for others 1 to 255.
With environment variable SET WOL=1 it also send a "wake on lan call" to each machine.
With environment variable SET NET=1 it also create a folder Network Map* in the folder Network, with a sub folder for workgroup* or domain* and individual objects (online*/offline*) for each device. If one click on a device it will refresh (run the script and update the object itself).

34
First of all we need a function that can check if an executable can run or if the library/file exist or not.

Since we don't have a list of the files nor their types yet, our function can only be prepared to:
  • Support obvious file types such as .exe, .hlp/.inf, .pdf and .cmd
  • Take one parameter by default, the file to check and return 0 if all is well or another number depending on the problem.
  • Be extendable and allow for more files types and at least one more parameter or stem/array later.

Try to write a function and post it here, that can test if for example wget.exe (without path*) is present or not on the system.
Hints:
  • rc = 1041 not available
  • rc <> 0 missing support libraries
  • other problem and rc = 0 ok

*The function should try determine the path if needed, but not provided, with for example SysSearchPath(...).

35
It is the start to look at that is a good starting point, with a need for more, so let's keep this thread alive.

So what do we need/want?

Should we aim to support a specific version of OS/2 and newer? ¹)
A list of handbooks related to REXX. The list that Dariusz Piatkowski showed should be a good starting point, where can the files be downloaded from?
There should also be a dedicated section about "Object REXX" ²) and "ooRexx" ²).
PDF and/or INF/HLP format?

What would you like to see/need? Dan and Lewis
Is it a broader discussion about what REXX can do and how, a list of functions one can copy/paste into own projects, or...?

____
¹) Various libraries has been introduced and removed in versions of eComStation and ArcaOS. The proper way would be to assume that there is only Classic REXX in Warp 4 installed with the limitations and bugs found there and provide functions that check and test the system and then work from there. It may require rather large functions to be complete, but may be what we should aim for?
Example 1: To get the boot drive of the system currently in use one can call the function SysBootDrive, but it is only available with later versions of RexxUtil, so to write scripts that work with any version of the OS, one has to expand it somewhat (see code).
Example 2: The useful rexx library to unpack files "unzip32.dll" may (not) be available, but unzip.exe of various versions may (not) also be available, and/or unpack200.exe with OpenJDK. A wrapper function to unzip should be written to use whatever is available as we can't assume a baseline.

²) With Object REXX and ooRexx one can create a reusable "text library" to reference (compare to "include" in C/C++) with methods that can explore all possebilities and provide a unified way to unpack archives.

Code: [Select]
/* 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

36
List info related to programming in REXX
TitleType (Help/Tutorial/Reference/Guide/Examples/...)LocationFormat (pdf/inf/html/...)License (free/gpl 3/restricted/commercial/...)Interpreter (CRexx/ORexx/ooRexx/ARexx/BRexx/Regina/Roo)

37
Hi Dan,
you're quite right.

We need to discuss and make plans from 'Hello world' and beyond, bridging the gap from an intro to writing something useful.
How about a combination of scripts to choose what to retrieve and install of help, reference, guides, editors etc.

Introductions that hold the hand all the way is key and what I would say help one over the initial hurdles how to get used to what can be done.

Rexx is great as "glue" to explore and control various tools, techniques and system resources.
Code: [Select]
/* 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.

Or should all come as wpi or rpm packages? A problem is the hosting and location after a few years.

A first version could list the various titles, file format and internet location (url)?
Let the user choose and then do some magic, add short cuts as suggested etc.

Next list text editors and their benefits in writing rexx code

Why not guide the user through the code that do all of that as well.
How to read, interpret and follow the execution, 'dry execution', as learning from existing code should be easier.
Perhaps donate a number of functions that can be reused, instead of asking everyone to reinvent the wheel over and over again

I have a recursive function I call RxMkDir that is quite useful. One specify the path and it create it all levels down if it doesn't exist, and/or jump to it.

Someone else have a function that create shortcuts on the desktop from a stem/array, etc.

38
Ohh, nice output like a container tree view!

   IF dir < dir.0 THEN leader = D2C(195)
                  ELSE leader = D2C(192)
can be shortened to
Code: [Select]
leader = D2C( 192 + 3 * ( dir < dir.0 ) )

39
/**/
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


It is often just a matter of personal taste and preference, so the code to output that can be written in many ways and they'll serve well, thus cause frustration and confusion for beginners that want one and only one solution to cling to.

But here goes, assuming that the code has been saved to "charcode.cmd":
parse arg where and every occurance of where can be omitted in this case, as one can type "charcode > c850.txt" to save it to file c850.txt

How about a loop for:
call lineout ,'     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5'
such as:
do i = 0 to 15 /* loop 16 times, start at 0 and end at 15 */
  call charout , right( i, 2 + 4 * ( i = 0 ) , ' ' ) /* output a number, with 1 space in front and 4 more if loop number is zero*/
End
SAY /* This "say" without anything else just add a new line character */


40
Programming / Re: Classic, Regina, Object and Open Object Rexx
« on: February 25, 2025, 03:31:52 pm »
The benefit of tokenized code is that the rexx engine can run faster as it's prepared and structured in a way that the machine would handle it.

In my mind model to make it understandable I look at it as something like:
Code: [Select]
[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.

On OS/2 it save the tokenized code to the EA (Extended Attribute) of the .cmd file, so if no one has altered the code between runs, can just skip the "compilation" part and just run it.

cRexx check less of the code in advance for obvious mistakes and problems.

41
Yes!

There are so much one can do with REXX.
Newer versions (ooRexx) can often do more with less (code).

Do show us some and let's begin there.

42
Programming / Re: Classic, Regina, Object and Open Object Rexx
« on: February 22, 2025, 05:43:26 pm »
I don't know; doesn't this mean exactly the opposite?
Quote from: RexxUtil.inf
Syntax
┌───────────────────────────────────────────────────────────────────────────┐
│                                                                           │
│ ──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.60
Quote
Another 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.

43
Programming / Re: Classic, Regina, Object and Open Object Rexx
« on: February 15, 2025, 03:06:13 pm »
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).

That same question holds true for everyone else in this thread, as this is some good, solid info which bears repeating, I think.
I don't mind.

44
Programming / Re: GeneologyJ
« on: January 28, 2025, 06:24:27 am »
Great, Thank you!

National Language support included here.

45
Programming / GeneologyJ
« on: January 27, 2025, 09:33:03 pm »
Previous versions of GeneologyJ run on OS/2 with OpenJDK, but the one built on sourceforge 6865 (2020-08-25) has been built for Java 1.7 and newer even though it only contain slight changes that doesn't introduce much that require java 1.7

I have now tried to build it myself and adjusted a combined try ... catch and a try ... catch for a file close procedure. The latter may cause problems and need a proper rewrite, but I'd like to ask for your help to see if this build work ok with our OpenJDK.

Perhaps something to look at from an OS/2 perspective as the project is mature and behave very well and is easy to build.

Pages: 1 2 [3] 4 5 ... 22