Changeset 29


Ignore:
Timestamp:
Jan 26, 2016, 4:13:36 PM (10 years ago)
Author:
Alex Taylor
Message:

Added optional second parameter to Sys2LocateDLL, and updated/clarified function documentation.

Location:
rxutilex/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • rxutilex/trunk/FUNCTIONS

    r25 r29  
    2525Sys2ReplaceModule           - Unlock a DLL (DosReplaceModule wrapper)
    2626Sys2Seek                    - Set file read/write pointer (with >2GB support)
     27Sys2SyncBuffer              - synchronize read/write (DosResetBuffer wrapper)
    2728Sys2Version                 - Get the version of this library
    2829Sys2Write                   - Write bytes to a file or named pipe
     
    278279
    279280If a DLL with the given name is currently loaded, that instance of the
    280 DLL will be returned.  Otherwise, standard DLL loading rules (according
    281 to the current LIBPATH and/or extended LIBPATH configuration) are used to
    282 search for a DLL whose module name matches the one specified.
     281DLL will be returned.  Otherwise, unless 'L' is specified in the second
     282parameter, standard DLL loading rules (which will be governed by the
     283current LIBPATH and/or extended LIBPATH configuration) are used to
     284search for a loadable DLL whose module name matches the one specified.
     285(A loadable DLL is one whose runtime dependencies are also loadable,
     286and whose initialization routine can be executed successfully.)
    283287
    284288REXX ARGUMENTS:
    285289  1. The name of the DLL to search for.  (REQUIRED)
     290  2. Flag to limit search context, must be one of:                       
     291       A : 'All', search for both loaded and loadable DLLs      (DEFAULT)
     292       L : 'Loaded', search only for currently-loaded DLLs
    286293
    287294
     
    490497
    491498-------------------------------------------------------------------------
    492 Sys2SyncBuffer                                                           
     499Sys2SyncBuffer
    493500
    494501Used to synchronize buffer read/write transactions (wrapper to
    495 DosResetBuffer)  For external files, writes the buffer to disk.
     502DosResetBuffer).  For external files, writes the buffer to disk.
    496503For named pipes, blocks until the remote client end of the pipe has read
    497504the contents.
  • rxutilex/trunk/rxutilex.c

    r26 r29  
    13821382 *                                                                           *
    13831383 * REXX ARGUMENTS:                                                           *
    1384  *   1. The name of the DLL to search for.  (REQUIRED)                       *
     1384 *   1. The name of the DLL to search for.                        (REQUIRED) *
     1385 *   2. Flag to limit search context, must be one of:                        *
     1386 *        ALL       : Search for both loaded and loadable DLLs     (DEFAULT) *
     1387 *        LOADEDONLY: Search only for currently-loaded DLLs                  *
     1388 *      Only the first letter (A/L) is significant.                          *
    13851389 *                                                                           *
    13861390 * REXX RETURN VALUE:                                                        *
     
    13911395    HMODULE hmod;
    13921396    CHAR    achModuleName[ CCHMAXPATH ];
    1393     BOOL    bUnload = FALSE;
     1397    BOOL    bLoadedOnly = FALSE,
     1398            bUnload     = FALSE;
    13941399    APIRET  rc;
    13951400
     
    13971402    WriteErrorCode( 0, NULL );
    13981403
    1399     if ( !(argc == 1 && RXVALIDSTRING(argv[0])) ) return ( 40 );
     1404    if ( argc < 1  || ( !RXVALIDSTRING(argv[0]) )) return ( 40 );
     1405
     1406    // Second argument: flag
     1407    if ( argc >= 2 && RXVALIDSTRING(argv[1]) ) {
     1408        strupr( argv[1].strptr );
     1409        if ( strcspn(argv[1].strptr, "AL") > 0 ) return ( 40 );
     1410        switch ( argv[1].strptr[0] ) {
     1411            case 'A': bLoadedOnly = FALSE; break;
     1412            case 'L': bLoadedOnly = TRUE;  break;
     1413            default : return ( 40 );
     1414        }
     1415    }
    14001416
    14011417    // See if the DLL is already loaded
    14021418    rc = DosQueryModuleHandle( argv[0].strptr, &hmod );
    14031419    if ( rc ) {
    1404         // Guess not; try to load it now
     1420        // Guess not...
     1421        if ( bLoadedOnly ) {
     1422            // Just return
     1423            MAKERXSTRING( *prsResult, "", 0 );
     1424            return 0;
     1425        }
     1426        // Try to load it now
    14051427        rc = DosLoadModule( NULL, 0, argv[0].strptr, &hmod );
    14061428        if ( rc ) {
     
    23842406        // REXX API does not free this kind of buffer
    23852407        ulBytes = strlen( pszValue );
    2386         }
     2408    }
    23872409    MAKERXSTRING( shvVar.shvname, szCompoundName, strlen(szCompoundName) );
    23882410    shvVar.shvvalue.strptr    = pszValue;
  • rxutilex/trunk/rxutilex.def

    r26 r29  
    11LIBRARY     RXUTILEX INITINSTANCE TERMINSTANCE
    22DATA        MULTIPLE NONSHARED
    3 DESCRIPTION '@#Alex Taylor:0.1.2#@##1## 15 Jul 2015 00:14:13     REINFORCE::::::@@Extended REXX Utility Functions'
     3DESCRIPTION '@#Alex Taylor:0.1.2#@##1## 27 Jan 2016 00:11:55     REINFORCE::::::@@Extended REXX Utility Functions'
    44
    55EXPORTS     Sys2LoadFuncs
  • rxutilex/trunk/testlib.cmd

    r22 r29  
    3636
    3737say Sys2LocateDLL('ehxdlmri')
     38say Sys2LocateDLL('ehxdlmri', 'a')
     39say Sys2LocateDLL('ehxdlmri', 'l')
     40say Sys2LocateDLL('gcc1', 'l')
     41
    3842
    3943call Sys2DropFuncs
Note: See TracChangeset for help on using the changeset viewer.