Changeset 25


Ignore:
Timestamp:
Jul 14, 2015, 12:56:28 PM (10 years ago)
Author:
Alex Taylor
Message:

Added Sys2SyncBuffer function. Updated version number to 0.1.2.

Location:
rxutilex/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • rxutilex/trunk/FUNCTIONS

    r22 r25  
    490490
    491491-------------------------------------------------------------------------
     492Sys2SyncBuffer                                                           
     493
     494Used to synchronize buffer read/write transactions (wrapper to
     495DosResetBuffer)  For external files, writes the buffer to disk.
     496For named pipes, blocks until the remote client end of the pipe has read
     497the contents.
     498                                                                         
     499REXX ARGUMENTS:                                                         
     500  1. File handle (as returned by Sys2Open or Sys2CreateNamedPipe).
     501     (REQUIRED)
     502                                                                         
     503REXX RETURN VALUE:  1 on success, 0 on failure
     504
     505-------------------------------------------------------------------------
    492506Sys2Version
    493507
  • rxutilex/trunk/npsrv_w.cmd

    r17 r25  
    1212        if ok == 0 then say SYS2ERR
    1313        else say ok 'bytes written.'
    14 /*
    15         do until _cb == 0
    16             PARSE VALUE Sys2CheckNamedPipe( hp ) WITH _cb _state
    17             if _cb == "" then do
    18                 say SYS2ERR
    19                 leave
    20             end
    21         end
    22 */
     14        ok = Sys2SyncBuffer( hp )
     15        if ok == 0 then say SYS2ERR
    2316        ok = Sys2DisconnectNamedPipe( hp )
    2417        if ok == 0 then say SYS2ERR
  • rxutilex/trunk/rxutilex.c

    r24 r25  
    8484#define SZ_LIBRARY_NAME         "RXUTILEX"  // Name of this library
    8585#define SZ_ERROR_NAME           "SYS2ERR"   // REXX variable used to store error codes
    86 #define SZ_VERSION              "0.1.1"     // Current version of this library
     86#define SZ_VERSION              "0.1.2"     // Current version of this library
    8787
    8888// Maximum string lengths...
     
    130130    "Sys2Seek",
    131131    "Sys2Read",
     132    "Sys2SyncBuffer",
    132133    "Sys2Write",
    133134    "Sys2Version"
     
    171172RexxFunctionHandler Sys2Read;
    172173RexxFunctionHandler Sys2Write;
     174RexxFunctionHandler Sys2SyncBuffer;
    173175
    174176
     
    20912093
    20922094
     2095/* ------------------------------------------------------------------------- *
     2096 * Sys2SyncBuffer                                                            *
     2097 *                                                                           *
     2098 * Wrapper to DosResetBuffer: for external files, write the buffer to disk;  *
     2099 * for pipes, block until the far end of the pipe has read the contents.     *
     2100 *                                                                           *
     2101 * REXX ARGUMENTS:                                                           *
     2102 *   1. File handle (returned by Sys2Open)                        (REQUIRED) *
     2103 *                                                                           *
     2104 * REXX RETURN VALUE:                                                        *
     2105 *   1 on success, or 0 if an error occurred.                                *
     2106 * ------------------------------------------------------------------------- */
     2107ULONG APIENTRY Sys2SyncBuffer( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult )
     2108{
     2109    HFILE  hf;
     2110    APIRET rc;
     2111
     2112    // Reset the error indicator
     2113    WriteErrorCode( 0, NULL );
     2114
     2115    // Make sure we have exactly one valid argument (the file handle)
     2116    if ( argc != 1  || ( !RXVALIDSTRING(argv[0]) ))
     2117        return ( 40 );
     2118    if (( sscanf( argv[0].strptr, "%8X", &hf )) != 1 ) return ( 40 );
     2119
     2120    // Sync the buffer
     2121    rc = DosResetBuffer( hf );
     2122    if ( rc != NO_ERROR ) {
     2123        WriteErrorCode( rc, "DosResetBuffer");
     2124        MAKERXSTRING( *prsResult, "0", 1 );
     2125    }
     2126    else {
     2127        MAKERXSTRING( *prsResult, "1", 1 );
     2128    }
     2129
     2130    return ( 0 );
     2131}
     2132
     2133
     2134
    20932135// -------------------------------------------------------------------------
    20942136// INTERNAL FUNCTIONS
  • rxutilex/trunk/rxutilex.def

    r23 r25  
    11LIBRARY     RXUTILEX INITINSTANCE TERMINSTANCE
    22DATA        MULTIPLE NONSHARED
    3 DESCRIPTION '@#Alex Taylor:0.1.1#@##1## 3 May 2015 22:36:07      REINFORCE::::::@@Extended REXX Utility Functions'
     3DESCRIPTION '@#Alex Taylor:0.1.2#@##1## 12 Jul 2015 20:07:59     REINFORCE::::::@@Extended REXX Utility Functions'
    44
    55EXPORTS     Sys2LoadFuncs
     
    2727Sys2Read
    2828Sys2Write
    29 
     29Sys2SyncBuffer
Note: See TracChangeset for help on using the changeset viewer.