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 ... 13
1
Programming / Re: OW, JNI (GCC built java 1.6) and parameters
« on: May 21, 2020, 07:30:32 pm »
I use open-watcom-c-os2-2.0-beta3.zip wherever it may come from.

Ohh, LoadLib.txt should be adjusted ... change a ".dll" to "*dll" to allow it to use any version of the library you define. Especially useful with Cairo as it come in many versions.

2
Programming / Re: OW, JNI (GCC built java 1.6) and parameters
« on: May 21, 2020, 09:56:54 am »
Nice,

Java was more of a challenge as it need the code fpeHandler that get called as various Floating point exceptions pop up.
Code: [Select]
LoadLib *jVM = new LoadLib( "jvm" ); //find in before/after libpath, path etc.
if( jVM->rc != NO_ERROR ) //jvm.dll not found, try subfolder "client" of above and environment variable JAVA_HOME (if set), try as is if param 2 instead contain \.
       jVM->Load( "client\\jvm", "JAVA_HOME" );

... do other stuff ...
Code: [Select]
/* Define each function dynamically */
    int rc = NO_ERROR; //must be defined as InitFunc use rc
    InitFunc( jVM->hmod, jint, JNI_GetDefaultJavaVMInitArgs, ( void *vm_args ) );
    InitFunc( jVM->hmod, jint, JNI_CreateJavaVM, ( JavaVM **p_vm, JNIEnv **p_env, void *vm_args ) );
InitFunc take care of decorations "_" in front or after.

Code: [Select]
resVer = JNI_GetDefaultJavaVMInitArgs(&vm_args2);...
Code: [Select]
res = JNI_CreateJavaVM( &currentJVM, &jniEnv, &vm_args2);

Also tried with libsane and created my own version of scanimage, that use defaults. There I have problems to reach and set internal structures of variables in the memory created by the gcc compiled library

3
Programming / Re: OW, JNI (GCC built java 1.6) and parameters
« on: May 20, 2020, 09:51:15 pm »
Hello,

I've managed to find out the problem and solve it.

Built BSF4Rexx (2009) with Open Watcom 2.0 IDE and resolved some calling convention difficulties and it output:
Code: [Select]
Rexx interpreter:  REXXSAA 4.00 3 Feb 1999
BSF4Rexx (DLL/so): 282.20090420 org/rexxla/bsf/engines/rexx

The problem there is now related to something when java call back into the library:
Code: [Select]
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at org.rexxla.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:1306)

Please feel free to help me out

The code is useful as you try to write code not only for Java6 (OpenJDK) but also SQLite3 and Cairo as well, as it take care of floating point errors that occur there.

//Jan-Erik

LoadLib.txt modified to allow versions to load, such as cario2.dll, cario.dll, cairo164.dll etc.

4
Multimedia / Re: Updated Uniaud32 build
« on: May 17, 2020, 03:17:38 pm »
I've tried the versions mentioned here up to 3.5 and I can notice improvements...
* PM123 play web radio 44.1 kHz just as nice as before
* Unimix 0.82 doesn't crash and can now allow microphone in, though doesn't give any input
* Mplayer stutter and freeze the movie clips I play

5
Programming / Re: Mac Address in Classic Rexx
« on: October 11, 2019, 08:15:19 pm »
It should now run and only rely on the installed TCP/IP package.

2019 Oct 11, Now use TCPIP HOST command

Code: [Select]
/*
 * Filename: macaddr.cmd
 *   Author: JAN-ERIK
 *  Created: Mon Sep 10 2012
 *  Purpose: Retrieve MAC Address
 *  Changes: 2019-07-25, Added support for Router
 *           2019-09-14, Added support for localhost
 *           2019-09-15, OS2ENVIRONMENT -> ENVIRONMENT
 *           2019-10-11, Now use TCPIP HOST command
 */
stem = 'host.'
IF 0 < ARG() THEN
   count = rxGetMacAddr( ARG(1) )
ELSE
   count = rxGetMacAddr()
DO i = 1 TO count
    /*magic.cmd*/
    /*Wake on Lan in REXX*/
    /*MAC = '11:22:33:44:55:66';*/
    MAC = host.i.macaddr
    SAY host.i.name||':' host.i.ipaddr||':' MAC;
    X = TRANSLATE( 'abcdefghijkl', host.i.macaddr, 'ab:cd:ef:gh:ij:kl' )
    call RxFuncAdd 'SockLoadFuncs', 'rxsock', 'SockLoadFuncs';
    call SockLoadFuncs( '*' );
    SCT = SockSocket( 'AF_INET', 'SOCK_DGRAM', 'IPPROTO_UDP' );
    RC = SockSetSockOpt( SCT, 'SOL_SOCKET', 'SO_BROADCAST', '1' );
    RC = SockIOCtl( SCT, 'FIONBIO', '0' );
    adr.!family = 'AF_INET';
    /*adr.!addr   = '255.255.255.255';*/
    adr.!addr   = host.i.ipaddr
    adr.!port   = 9;
    S = COPIES( D2C(255) ,6 );
    T = COPIES( X ,16);
    G = COPIES( D2C(0) ,6 );
    RC = SockConnect( SCT, "adr.!" );
    STG = S||T||G;
    SAY STG
    RC = SockSend( SCT, STG );
    call SockSoClose SCT;
END
RETURN 0

rxGetMacAddr: PROCEDURE EXPOSE (stem) /*<COMPUTERNAME>*/
    isStem = ( RIGHT( stem, 1 )  = '.' )
    stemval = STRIP( stem, 'T', '.' )
    retval = 0
    i = 0
    /* No parameters given, list all computers */
    IF ARG() = 0 THEN
    DO
       DO WHILE QUEUED() > 0; PARSE PULL; END;
       '@PING 255.255.255.255 56 1 2>&1|RXQUEUE'
       DO WHILE QUEUED() > 0
          PARSE UPPER VALUE REVERSE( LINEIN( 'QUEUE:' ) ) WITH ' :'ipnumber.i' '.
          ipnumber.i = STRIP( REVERSE( ipnumber.i ) )
          IF 7 < LENGTH( ipnumber.i ) THEN
             i = i + 1
          ipnumber.0 = i - 1
       END
       ipnumber.i = VALUE( 'HOSTNAME',, 'ENVIRONMENT' )
       ipnumber.0 = i
       j = 1
       DO i = 1 TO ipnumber.0
          '@HOST' ipnumber.i '2>&1|RXQUEUE'
          DO WHILE QUEUED() > 0
             PARSE UPPER VALUE LINEIN( 'QUEUE:' ) WITH ipnumber.j' = 'hostname.j
          END
          hostname.0 = j
          IF 0 < LENGTH( hostname.j ) THEN
             j = j + 1
       END
       j = j - 1
       ipnumber.j = STRIP( hostname.j )
       hostname.j = VALUE( 'HOSTNAME',, 'ENVIRONMENT' )
    END
    ELSE DO
        /* Search for a specific computer */
        hostname.0 = 1
        hostname.1 = TRANSLATE( ARG(1) )
    END
    j = 0
    DO WHILE QUEUED() > 0; PARSE PULL; END;
    DO i = 1 TO hostname.0
       IF i = hostname.0 THEN
          '@NETSTAT -n 2>&1|RXQUEUE'
       ELSE DO
          '@PING '||TRANSLATE( hostname.i )||' 1 1 2>&1|RXQUEUE'
          DO WHILE QUEUED() > 0; PARSE PULL; END;
          '@ARP '||TRANSLATE( hostname.i )||' 2>&1|RXQUEUE'
       END
       DO WHILE QUEUED() > 0
          PARSE UPPER VALUE SUBWORD( LINEIN( 'QUEUE:' ), 2 + ( i = hostname.0 ) ) WITH machex +17 ipnum .
          IF ( LENGTH( machex ) = 17 & LENGTH( ipnum ) > 7 ) | ( i = hostname.0 & LENGTH( STRIP( machex ) ) = 12 & machex <> 0 ) THEN
          DO
             pass = 0
             IF i = hostname.0 THEN
             DO
                IF DATATYPE( STRIP( machex ), 'X' ) THEN
                DO
                   hostname.i = STRIP( hostname.i )
                   ipnum = ipnumber.i
                   machex = TRANSLATE( 'ab:cd:ef:gh:ij:kl', STRIP( machex ), 'abcdefghijkl' )
                   pass = 1
                END
             END
             ELSE pass = 1
             IF pass THEN
             DO
                j = j + 1
                IF isStem THEN
                   INTERPRET stemval'.j.name = hostname.i;'||stemval'.j.macaddr = TRANSLATE( machex, "0", " " );'||stemval'.j.ipaddr = ipnum;'||stemval'.0 = j; retval = j'
                ELSE
                   retval = retval||hostname.i||' '||TRANSLATE( STRIP( machex ), "0", " " )||' '||ipnum||D2C(13)||D2C(10)
             END
          END
       END
    END
    IF 1 < hostname.0 THEN
    DO
        DO WHILE QUEUED() > 0; PARSE PULL; END;
        '@ARP -a 2>&1|RXQUEUE'
        DO WHILE QUEUED() > 0
           arp = LINEIN( 'QUEUE:' )
           IF 0 < POS( ':', arp ) & 3 < WORDS( arp ) THEN
           DO
              PARSE UPPER VALUE arp WITH iface +13 macad +17 ipadd rest
              DO i = 1 To VALUE( stemval'.0' )
                 /* Add computer to list */
                 IF TRANSLATE( macad, "0", " " ) = VALUE( stemval'.i.macaddr' ) THEN LEAVE i
              END
              IF VALUE( stemval'.0' ) < i THEN
              DO
                 IF isStem THEN
                    INTERPRET stemval'.i.name = STRIP( iface );'||stemval'.i.macaddr = TRANSLATE( macad, "0", " " );'||stemval'.i.ipaddr = STRIP( ipadd );'||stemval'.0 = i;retval = i'
                 ELSE
                    retval = retval||STRIP( iface )||' '||TRANSLATE( macad, "0", " " )||' '||ipadd||D2C(13)||D2C(10)
              END
           END
        END
    END
RETURN retval

6
Networking / Re: openvpn configuration?
« on: October 02, 2019, 08:57:29 pm »
Thank you Paul for the updated build!

Many assume that one just want to connect to "home", when away.
I'm looking at that but qputty refuse to connect to my router with a batch file here so the long and tedious configuration has to be done manually. :(

But how do one use those "free" or paid OpenVPN services out there from "home" to the outside to secure the connection? Here it just say "Connection refused".
Would be interesting to read and follow a description with images how to set it up with ArcaOS (ArcaOS is OS/2 with all available fixes applied, so upgrade to and use it).

Most providers seem to have "tun" set in their config files btw.

7
Programming / Re: NetRexx on OS/2
« on: September 18, 2019, 11:36:43 pm »
Added you modifications to the script.

8
Programming / Re: Mac Address in Classic Rexx
« on: September 18, 2019, 09:20:47 pm »
Samba (nmblookup.exe) apparently doesn't list the machines own mac address other than 00-00-0...

9
Programming / Re: RexxLA The Rexx Language Association
« on: September 18, 2019, 09:13:08 pm »
I would appreciate if we could get the OS/2 WPS code (wprexx.imp, wpsinit.wps and wpinst.cmd) from IBM and pair it with a new OS/2 built version of ooRexx by RexxLA. Those look somewhat separate from OS/2 Object Rexx, something like an add on with classes that should be possible to register with a proper ooRexx replacement?!
Is there something more needed than those to create a Object Rexx replacement?
Perhaps wishful thinking on my part, but surely something I would look forward to.
//Jan-Erik

10
Programming / Re: NetRexx on OS/2
« on: September 17, 2019, 06:29:04 am »
Ahh, yes, 4OS2 of course in combination with the unchanged part of the code.

Suggestions how to alter that section?

It seems to set classpath correctly, but then abandons it's work because it can't find hello.class.

Dir /N /B might work in CMD, but it's not useful with 4os2. Rexx has a lot of other ways to find filenames that don't depend on the exact syntax of CMD.

The script does work on CMD.

11
Programming / Android SDK with classic rexx
« on: September 16, 2019, 11:23:07 pm »
This is a script that create a program object that you can use to list and download Android SDK.
It download the current Android SDK and libraries as I write this.
Prerequisite: java and android-sdk_r24.4.1-windows.zip (as previously found through) unpacked to a folder
  • Just run the script by double clicking on it.
  • It search your computer for the unpacked sdk, copy itself and files it need and create a program object (if possible).
  • Double click on the program object and type "update sdk --filter 3,2,1" and follow the instructions.
    repeat the procedure with the packages you want to download, use "list sdk" to list available packages.
The script add "--no-ui --no-https" as it doesn't work otherwise.
Please also note that I don't know if you can actually develop something with the downloaded files, that is up to you to find out.
It was intended to act as a subsystem for development with NetRexx to create apps for Android, but I didn't persue it further since there are so few examples and information on how to actually code NetRexx apps and deploy them on Android.
Code: [Select]
/*
 * Filename: android.cmd
 *   Author: JanErik
 *  Created: Sun Sep 11 2016
 *  Purpose: Install SDK for Android in OS/2
 *  Changes: Mon Sep 16 2019 Changes to program object and startup configuration.
 *  Require: Zip SDK (such as android-sdk_r24.4.1-windows.zip), downloads updates live.
 */

'@echo off'
'@mode 80,102'
'@cls'

/* Set up prog to be the path of this script, including following symlinks,
   and set up progdir to be the fully-qualified pathname of its directory. */
PARSE SOURCE . . prog
PARSE ARG params

IF LENGTH( STRIP( params ) ) = 0 THEN
   params = '-h'

/* Grab current directory before we change it */
work_dir = DIRECTORY()

/* Change current directory and drive to where the script is, to avoid
 issues with directories containing whitespaces. */
PARSE VALUE REVERSE( prog ) WITH fname'\'this
this = REVERSE( this )
CALL DIRECTORY this

/* Load RexxUtil Library */
IF RxFuncQuery('SysLoadFuncs') THEN
DO
   CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
   CALL SysLoadFuncs
END

env = 'ENVIRONMENT'
/* Check we have a valid Java.exe in the path.*/
IF VALUE( 'JAVA_HOME',, env ) = '' THEN
DO
   CALL SysGetEA this, 'JAVA_HOME', 'java_path'
   IF STREAM( java_path'\JAVA.EXE', 'C', 'QUERY EXISTS' ) = "" THEN
      java_path = ''
   IF LENGTH( java_path ) < 2 THEN DO
      PARSE UPPER VALUE rxFind( 'JAVA.EXE', ' -version', 'VERSION "1.' ) WITH java_path'\BIN'
      IF LENGTH( java_path ) = 0 THEN
      DO
         CALL LINEOUT 'STDERR', 'JAVA engine not found'
         RETURN 1
      END
      CALL SysPutEA this, 'JAVA_HOME', java_path
   END
END
ELSE java_path = VALUE( 'JAVA_HOME',, env )

CALL SysGetEA this, 'ANDROID_PATH', 'android_path'
IF STREAM( android_path'\android.bat', 'C', 'QUERY EXISTS' ) = "" THEN
   android_path = ''
IF LENGTH( android_path ) < 2 THEN DO
   PARSE VALUE rxFind( 'android.bat' ) WITH android_path
   IF LENGTH( android_path ) = 0 THEN
   DO
      CALL LINEOUT 'STDERR', 'Android SDK not found'
      RETURN 2
   END
   CALL SysPutEA this, 'ANDROID_PATH', android_path
END
ext = 'cmd ico png'
DO i = 1 TO 3
   IF STREAM( android_path'\android.'SUBWORD( ext, i, 1 ), 'C', 'QUERY EXISTS' ) = '' THEN
      IF SysCopyObject( this'\android.'SUBWORD( ext, i, 1 ), android_path ) = 1 THEN
         CALL LINEOUT 'STDERR', 'Copied android.'SUBWORD( ext, i, 1 )' to "'android_path'"'
END
IF TRANSLATE( android_path ) <> TRANSLATE( this ) THEN
DO
   this = android_path
   work_dir = android_path
END

objID = 'ANDROID'
android_name = 'Android'
android_wps = 'Android SDK'
IF wpsObjectExist( '<WP_'objID'>' ) = 0 THEN
DO
   setupstring = 'OBJECTID=<WP_'objID'>;NOAUTOCLOSE=YES;EXENAME='this'\android.cmd;PARAMETERS=[Specify parameter (list sdk --filter 1)];ICONFILE='this'\'android_name'.ico;'
   IF SysCreateObject( 'WPProgram', android_wps, '<WP_DEVFLDR>', setupstring, 'U' ) <> 1 THEN
      CALL SysCreateObject 'WPProgram', android_wps, '<WP_DESKTOP>', setupstring, 'U'
   CALL rxAddBigIcon this'\'android_name'.png', '<WP_'objID'>'
END

jar_path = 'lib\sdkmanager.jar;lib\swtmenubar.jar'

/* Set SWT.Jar path based on current architecture (x86 or x86_64)*/
CALL DIRECTORY this
swt_path = ''
DO WHILE LENGTH( swt_path ) = 0
   DO WHILE QUEUED() > 0; PARSE PULL; END
   '@'java_path'\bin\java.exe -jar lib\archquery.jar|rxqueue'
   PARSE PULL swt_path
END

MkTempCopy:
    /* Copy android.bat and its required libs to a temp dir.
       This avoids locking the tool dir in case the user is trying to update it.*/

   tmp_dir = VALUE( 'TEMP',,'ENVIRONMENT' )'\temp-android-tool'
   cpy = swt_path'\* common.jar commons-codec* commons-compress* commons-logging dvlib.jag gson* guava* httpclient* httpcore* httpmime* layoutlib-api.jar org-eclipse-* sdk* swtmenubar.jar'
   DO i = 1 TO WORDS( cpy )
      cpyfile = 'lib\'SUBWORD( cpy, i, 1 )
      IF POS( '*', cpyfile ) > 0 THEN
      DO
         CALL SysFileTree this'\'cpyfile, 'file.', 'SFO'
         DO j = 1 TO file.0
            CALL rxCpyFile this, file.j, tmp_dir
         END
      END
      ELSE CALL rxCpyFile this, this'\'cpyfile, tmp_dir
   END

   /* jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.*/
   tools_dir = android_path
   CALL DIRECTORY tmp_dir

EndTempCopy:

   /* The global ANDROID_SWT always override the SWT.Jar path */
   IF VALUE( 'ANDROID_SWT',,'ENVIRONMENT' ) <> '' THEN
      swt_path = VALUE( 'ANDROID_SWT',,'ENVIRONMENT' )
   ELSE
      swt_path = this'\lib\'swt_path
   IF DIRECTORY( swt_path ) = '' THEN
   DO
      CALL LINEOUT 'STDERR', 'ERROR: SWT folder "'swt_path'" does not exist.'
      CALL LINEOUT 'STDERR', 'Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.'
      RETURN 2
   END

SetPath:
/* Finally exec the java program and end here.
 REMOTE_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000*/
   IF 0 = POS( TRANSLATE( java_path ), TRANSLATE( VALUE( 'PATH',,'ENVIRONMENT' ) ) ) THEN
      CALL VALUE 'PATH', java_path'\bin;'||STRIP( VALUE( 'PATH',,'ENVIRONMENT' ),, ';' ), 'ENVIRONMENT'
   IF 0 = POS( TRANSLATE( tools_path ), TRANSLATE( VALUE( 'PATH',,'ENVIRONMENT' ) ) ) THEN
      CALL VALUE 'PATH', tools_path'\lib;'||STRIP( VALUE( 'PATH',,'ENVIRONMENT' ),, ';' ), 'ENVIRONMENT'
   CALL DIRECTORY tools_dir
   '@java "-Dcom.android.sdkmanager.toolsdir='tools_dir'" "-Dcom.android.sdkmanager.workdir='work_dir'" -classpath "'jar_path';'swt_path'\swt.jar" com.android.sdkmanager.Main 'params' --no-ui --no-https'
   CALL DIRECTORY work_dir
RETURN rc
   
rxCpyFile: PROCEDURE
   PARSE VALUE REVERSE( SUBSTR( ARG(2), LENGTH( ARG(1) ) + 1 ) ) WITH fname'\'fpath
   fpath = REVERSE( fpath )
   rc = rxMkDir( ARG(3)fpath )
   IF rc = 0 & STREAM( ARG(3)fpath'\'REVERSE( fname ), 'C', 'QUERY EXISTS' ) = '' THEN
      rc = SysCopyObject( ARG(2), ARG(3)fpath )
RETURN rc
   
rxChk: PROCEDURE
   DO WHILE QUEUED() > 0; PARSE PULL; END;
   '@'||ARG(1)||ARG(2)||' 2>>&1 | RXQUEUE'
   DO WHILE QUEUED() > 0
      IF POS( TRANSLATE( ARG(3) ), TRANSLATE( LINEIN( 'QUEUE:' ) ) ) > 0 THEN
         IF LENGTH( ARG(4) ) > 0 THEN RETURN ARG(4)
   END
RETURN ''
   
rxFind: PROCEDURE EXPOSE !_msg_!.
   env = 'ENVIRONMENT'
   PARSE VALUE REVERSE( SysSearchPath( 'PATH', ARG(1) ) ) WITH fname'\'fpath
   fpath = REVERSE( fpath )
   fname = REVERSE( fname )
   IF ARG() > 1 & LENGTH( fpath ) > 0 THEN
      fspec = rxChk( fpath'\'fname, ARG(2), ARG(3), fpath )
   ELSE IF STREAM( fpath'\'fname, 'C', 'QUERY EXISTS' ) <> '' THEN
      fspec = fpath
   ELSE fspec = ''
   IF LENGTH( fspec ) > 0 THEN RETURN fspec
   CALL LINEOUT 'STDERR', VALUE( 'PROGRAMS',, env )
   IF POS( '*', ARG(1) ) = 0 THEN fname = '*'ARG(1)
   ELSE fname = ARG(1)
   CALL SysFileTree VALUE( 'PROGRAMS',, env )'\'fname, 'file.', 'SFO'
   DO i = 1 TO file.0
      PARSE VALUE REVERSE( file.i ) WITH .'\'fspec
      IF ARG() > 1 THEN
         fspec = rxChk( file.i, ARG(2), ARG(3), REVERSE( fspec ) )
      ELSE
         fspec = REVERSE( fspec )
      IF LENGTH( fspec ) > 0 THEN RETURN fspec
   END
   drives = SysDriveMap( 'C:', 'USED' )
   DO j = 1 TO WORDS( drives )
      CALL LINEOUT 'STDERR', SUBWORD( drives, j, 1 )
      CALL SysFileTree SUBWORD( drives, j, 1 )||'\'fname, 'file.', 'SFO'
      DO i = 1 TO file.0
         PARSE VALUE REVERSE( file.i ) WITH .'\'fspec
         IF ARG() > 1 THEN
            fspec = rxChk( file.i, ARG(2), ARG(3), REVERSE( fspec ) )
         ELSE
            fspec = REVERSE( fspec )
         IF LENGTH( fspec ) > 0 THEN RETURN fspec
      END
   END
RETURN ''   
   
rxMkDir: PROCEDURE
    rc = ( DIRECTORY( ARG(1) ) = '' )
    IF rc = 1 THEN
        IF \rxMkDir( STRIP( FILESPEC( 'D', ARG(1) )FILESPEC( 'P', ARG(1) ), 'T', '\' ) ) THEN
           rc = SysMkDir( ARG(1) )
Return rc
   
rxAddBigIcon: PROCEDURE EXPOSE !_msg_!. java_path
    crlf = D2C(13)D2C(10)
    bigicons_dir = VALUE( 'BIGICONS',, 'ENVIRONMENT' )
    bigicon = FILESPEC( 'N', ARG(1) )
    objid = ARG(2)
    IF LENGTH( bigicons_dir ) > 0 THEN
    DO
        IF STREAM( ( bigicons_dir'\'bigicon ), 'C','QUERY EXISTS') = '' THEN
           IF SysCopyObject( ARG(1), bigicons_dir ) = 0 THEN
              RETURN 1
        IF STREAM( bigicons_dir'\bigicons.txt', 'C', 'QUERY EXIST' ) <> '' THEN
        DO
            f_size = STREAM( bigicons_dir'\bigicons.txt', 'C', 'QUERY SIZE' )
            IF f_size > 0 THEN
            DO
                input = CHARIN( bigicons_dir'\bigicons.txt', 1, f_size )
                CALL STREAM bigicons_dir'\bigicons.txt', 'C', 'CLOSE'
                PARSE UPPER VALUE input WITH pre'"'(bigicon)'"'post
                IF LENGTH( post ) > 0 THEN RETURN 2
                PARSE UPPER VALUE input WITH pre'"'(objid)'"'post
                IF LENGTH( post ) > 0 THEN RETURN 3
                PARSE VALUE input WITH pre'[OBJECTID]'mid(crlf)(crlf)'['post
                input = pre'[OBJECTID]'STRIP( STRIP( mid, 'T', D2C(10) ), 'T', D2C(13) )||crlf||LEFT( '"'objid'"', 28 )'"'bigicon'"'crlf||crlf'['post
                CALL SysFileDelete bigicons_dir'\bigicons.txt'
                CALL CHAROUT bigicons_dir'\bigicons.txt', input
                CALL STREAM bigicons_dir'\bigicons.txt', 'C', 'CLOSE'
            END
            ELSE RETURN 4
        END
    END
RETURN 0

/* Code borrowed from REXX Tips & Tricks v3.60 */
wpsObjectExist: PROCEDURE /* parameter: '<new_wps_object_id>', return: 1 exist, 0 doesn't exist, 43 error */
  PARSE ARG objID
  rc = 43               /* init return/error code 43 = routine not found */
  SIGNAL ON SYNTAX NAME ObjectExistError

  IF SUBSTR( objID, 2, 1 ) <> ":" THEN
      IF LEFT( objID, 1 ) <> "<" & RIGHT( objID, 1 ) <> ">" THEN
          objID = "<" || objID || ">"

  /* create the object and see if it fail */
  tempRC = SysCreateObject( "WPFolder", "TestObject", "<WP_NOWHERE>", "OBJECTID=" || objID || ";", "FAIL" )

  IF tempRC = 1 THEN
  DO
    CALL SysDestroyObject objID
    rc = 0
  END
  ELSE
    rc = 1

ObjectExistError:

RETURN rc

12
Programming / Re: Mac Address in Classic Rexx
« on: September 16, 2019, 10:55:52 pm »
IBM File and Print Client is reliable and integrate well with the system.

Samba trash the database and can't recover if one has to force a reboot.
A reliable fix for that and it may be possible to switch.

13
Programming / Re: List path to ObjectID's in plain rexx
« on: September 16, 2019, 06:30:40 pm »
This version can also list files as shadows and not only <WP_OBJECTID>.
It list only one of duplicate named shadows.
< and > has to be specified for objects to be able to retrieve the entry from SysIni.

Code: [Select]
/*
 * Filename: WPSObj.cmd
 *   Author: JanErik
 *  Created: Sat Aug  3 2019
 *  Purpose: Script to list Paths and Object names of Object ID's with rexx
 *  Changes:
 */
call rxFuncAdd "SysIni", "REXXUTIL", "SysIni"
IF ARG(1) = 1 THEN
   RETURN RxShadows()

objids = 'Bitmap  Movies TAJMAHAL.MAH REXXLIB.ZIP FireFox'
DO i = 1 TO WORDS( objids )
   CALL TIME 'R'
   hID = RxObjIDPath( SUBWORD( objids, i, 1 ) )
   SAY hID '"'!_PWH_!.hID.appPath'" ->' !_PWH_!.hID.fPath '"'!_PWH_!.hID.fName'"' '<-'||!_PWH_!.hID.isDir||'->' !_PWH_!.hID.oPath '"'!_PWH_!.hID.oName'" (' TIME( 'E' )'s )'
END
RETURN 0

RxObjIDPath: PROCEDURE EXPOSE !_PWH_!.
   PARSE ARG objID, refresh
   IF \DATATYPE( !_PWH_!.0, 'W' ) | refresh = 1 THEN
   DO
      /* Process shortcuts to shadows in parallell */
      '@START "WPShadow" /C /MIN WPSObj 1'
      /* Determine the currently active handles */
      hApp = SysIni( 'SYSTEM', 'PM_Workplace:ActiveHandles', 'HandlesAppName' )
      IF hApp = 'ERROR:' THEN
         hApp = 'PM_Workplace:Handles0'
      block = ''
      CALL SysIni 'SYSTEM', hApp, 'All:', 'blocks.'
      DO i = 1 To blocks.0
         block = block||SysIni( 'SYSTEM', hApp, blocks.i )
      END
      DROP blocks.
      DROP hApp
      !_PWH_!. = ''
      !_count_! = 0
      PARSE VALUE block WITH 5 block
      DO WHILE 0 < LENGTH( block )
         PARSE VALUE block WITH !_name_! 5 block
         SELECT
            WHEN !_name_! = 'DRIV' THEN
               PARSE VALUE block WITH 20 block
            WHEN !_name_! = 'NODE' THEN
            DO
               PARSE VALUE block WITH !_pre_! 3 !_oID_! 5 !_pID_! 7 !_mid_! 25 !_isDir_! 27 !_fnSize_! 29 block
               !_oID_! = C2RX( !_oID_! )
               !_PWH_!.!_oID_!.isDir = C2X2D( !_isDir_! )
               !_PWH_!.!_oID_!.fID = C2RX( !_pID_! )
               !_PWH_!.!_oID_!.fPath = ''
               !_fnSize_! = C2X2D( !_fnSize_! )
               !_PWH_!.!_oID_!.fName = LEFT( block, !_fnSize_! )
               !_count_! = !_count_! + 1
               !_PWH_!.0 = !_count_!
               block = SUBSTR( block, !_fnSize_! + 2 )
            END
            OTHERWISE NOP
         END
      END
      IF SysIni( 'USER', 'PM_Abstract:FldrContent', 'All:', 'blocks.' ) <> 'ERROR:' THEN
      DO i = 1 TO blocks.0
         !_children_! = SysIni( 'USER', 'PM_Abstract:FldrContent', blocks.i )
         block = blocks.i
         IF !_PWH_!.block.isDir <> 1 THEN
            !_PWH_!.block.isDir = 1
         DO WHILE 0 < LENGTH( !_children_! )
            PARSE VALUE !_children_! WITH !_child_! 3 5 !_children_!
            !_child_! = C2RX( !_child_! )
            IF !_PWH_!.!_child_!.fID = '' THEN
               !_PWH_!.!_child_!.fID = block
         END
      END
      DROP blocks.
      DROP block
      DROP !_child_!
      DROP !_children_!
   END
   IF 0 < LENGTH( STRIP( objID ) ) THEN
   DO
      !_findID_! = SysIni( 'USER', 'PM_Workplace:Location', objID )
      IF !_findID_! = 'ERROR:' THEN
         !_findID_! = SysIni( 'SHADOW.INI', 'PM_Shadow:Location', SysMapCase( objID ) )
      IF !_findID_! <> 'ERROR:' THEN
      DO
         PARSE VALUE !_findID_! WITH !_findID_! +2 +2 !_objName_!
         !_findID_! = C2RX( !_findID_! )
         !_PWH_!.!_findID_!.oPath = RxObjPath( !_findID_! )
         RETURN !_findID_!
      END
   END
RETURN 0
   
RxShadows: PROCEDURE
   IF SysIni( 'USER', 'PM_Abstract:Objects', 'All:', 'shadow.' ) <> 'ERROR:' THEN
   DO i = 1 TO shadow.0
      PARSE VALUE SysIni( 'USER', 'PM_Abstract:Objects', shadow.i ) WITH . 'WPShadow' . 'WPAbstract' +15 !_objSize_! +2 !_objName_! 'WPObject'
      IF 0 < LENGTH( !_objName_! ) THEN
         CALL SysIni 'SHADOW.INI', 'PM_Shadow:Location', SysMapCase( LEFT( !_objName_!, C2X2D( !_objSize_! ) - 1 ) ), X2C( XREV( shadow.i ) )
   END
RETURN 0
   
RxObjPath: PROCEDURE EXPOSE !_PWH_!.
   PARSE ARG findID
   !_path_! = ''
   !_PWH_!.findID.appPath = ''
   PARSE VALUE SysIni( 'USER', 'PM_Abstract:Objects', STRIP( findID, 'L', '0' ) ) WITH !_pre_! 'WPAbstract' +15 !_objSize_! +2 !_objName_! 'WPObject'
   PARSE VALUE !_pre_! WITH . 'WPProgramRef' +19 !_findID_! +2
   IF !_findID_! = '' THEN
      PARSE VALUE !_pre_! WITH . 'WPShadow' +15 !_findID_! +2
   IF !_findID_! <> '' THEN
   DO
      !_findID_! = C2RX( !_findID_! )
      IF 0 < LENGTH( !_objSize_! ) THEN
         !_PWH_!.findID.oName = LEFT( !_objName_!, C2X2D( !_objSize_! ) - 1 )
      IF !_PWH_!.!_findID_!.isDir <> 1 THEN
      DO
         !_PWH_!.findID.fName = !_PWH_!.findID.oName
         DO WHILE 0 < !_PWH_!.!_findID_!.fID
            !_path_! = '\'||!_PWH_!.!_findID_!.fName||!_path_!
            !_findID_! = !_PWH_!.!_findID_!.fID
         END
         !_path_! = !_PWH_!.!_findID_!.fName||!_path_!
         !_PWH_!.findID.appPath = !_path_!
      END
      !_findID_! = !_PWH_!.findID.fID
   END
   ELSE IF !_PWH_!.!_findID_!.isDir <> 1 THEN
      !_findID_! = !_PWH_!.findID.fID
   ELSE
      !_findID_! = findID
   !_path_! = ''
   DO WHILE 0 < !_PWH_!.!_findID_!.fID
      !_path_! = '\'||!_PWH_!.!_findID_!.fName||!_path_!
      !_findID_! = !_PWH_!.!_findID_!.fID
   END
   !_path_! = !_PWH_!.!_findID_!.fName||!_path_!
   !_PWH_!.findID.fPath = !_path_!
   !_path_! = !_path_!||'\'||!_PWH_!.findID.fName
   !_findID_! = findID
   DO WHILE 0 < !_PWH_!.!_findID_!.fID
      PARSE VALUE REVERSE( !_path_! ) WITH !_name_!'\'!_path_!
      !_name_! = REVERSE( !_name_! )
      !_path_! = REVERSE( !_path_! )
      IF SysGetEA( !_path_!||'\'||!_name_!, '.LONGNAME', 'EAValue' ) = 0 & EAValue <> '' THEN
      DO
         PARSE VAR EAValue EAType +2 EALength +2 EAValue
         IF EAType = 'FDFF'x THEN
            !_PWH_!.!_findID_!.oName = STRIP( EAValue, 'T', '00'x )
      END
      ELSE
         !_PWH_!.!_findID_!.oName = !_name_!
      !_findID_! = !_PWH_!.!_findID_!.fID
   END
   !_path_! = ''
   !_findID_! = !_PWH_!.findID.fID
   DO WHILE 0 < !_PWH_!.!_findID_!.fID
      !_path_! = '\'||!_PWH_!.!_findID_!.oName||!_path_!
      !_findID_! = !_PWH_!.!_findID_!.fID
   END
   !_path_! = !_PWH_!.!_findID_!.fName||!_path_!
RETURN !_path_!

XREV: PROCEDURE
   !_hex_! = STRIP( ARG( 1 ) )
   !_exp_! = ''
   IF \DATATYPE( !_hex_!, 'X' ) THEN RETURN !_exp_!
   DO i = 1 TO LENGTH( !_hex_! ) BY 4
      !_exp_! = STRIP( TRANSLATE( '1234', RIGHT( '0000'||STRIP( SUBSTR( !_hex_!, i, 4 ) ), 4 ), '3412' ) )||!_exp_!
   END
RETURN !_exp_!
   
C2R2X: PROCEDURE
   chrs = ARG(1)
   retval = ''
   DO i = 1 TO LENGTH( chrs ) BY 2
      retval = retval||'|'||C2RX( SUBSTR( chrs, i, 2 ) )
   END
RETURN retval   
   
C2RX: PROCEDURE
RETURN XREV( C2X( ARG(1) ) )

C2X2D: PROCEDURE
   chrs = ARG(1)
   retval = ''
   DO i = 1 TO LENGTH( chrs ) BY 2
      retval = retval||X2D( C2RX( SUBSTR( chrs, i, 2 ) ) )
   END
RETURN retval

14
Programming / Re: NetRexx on OS/2
« on: September 16, 2019, 05:57:17 pm »
Here ite set the class path to
Code: [Select]
.;D:\PROGRAMS\NETREXX\lib\NetRexxC.jar;D:\PROGRAMS\OPENJDK\lib\tools.jarautomatically as seen with
Code: [Select]
      CALL TRACE 'I'
    if subv>=6.0 then CALL VALUE 'CLASSPATH', '.;'this'\lib\NetRexxC.jar;'j_path'\lib\tools.jar', 'ENVIRONMENT'

What do you get?

Just add CALL TRACE 'I' right before the line and look for then output.

The problem is that the NetRexxC.cmd does not set classpath correctly. I'm not going to patch an increasingly bad REXX program, but rather I'll try to construct a useful one for the present day, that does not necessarily run original Java 1.1-based NetRexx from the 1990's.

//Jan-Erik

15
Programming / Re: Mac Address in Classic Rexx
« on: September 16, 2019, 06:22:49 am »
It use the output of commands such as arp, net view, netstat etc. that's part of IBM File and Print.
It should be possible to adapt it to Samba server as well in the future when Samba can run right away after installation.

Add the line
Code: [Select]
call trace '?i'in the beginning of the code and run it.
Press Enter to continue and look at the output and you should see what it says.

Set the line to
Code: [Select]
call trace 'i'and thus leave out the ? (question mark) in the beginning of the code and run it with
Code: [Select]
macaddr>output.txtThen it output every row it execute without asking for confirmation.
The you can read the file output.txt and see where it fail.


Pages: [1] 2 3 ... 13