Ignore:
Timestamp:
Sep 21, 2014, 8:45:02 AM (11 years ago)
Author:
Alex Taylor
Message:

More work on named-pipe and I/O functions. Added some test cases for the new functionality. Updated documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rxutilex/trunk/FUNCTIONS

    r16 r17  
    44
    55Sys2CheckNamedPipe          - Check the status of a named pipe
     6Sys2Close                   - Close a file or named pipe
    67Sys2ConnectNamedPipe        - Enable client sessions on a named pipe
    78Sys2CreateNamedPipe         - Create a named pipe
     
    1415Sys2LoadFuncs               - Register all functions
    1516Sys2LocateDLL               - Search for a loaded/loadable DLL
     17Sys2Open                    - Open a file or stream (with >2GB support)
    1618Sys2PutClipboardText        - Copy a text string to the clipboard
    1719Sys2QueryForegroundProcess  - Get the PID of the current foreground process
     
    1921Sys2QueryProcess            - Get information about a process
    2022Sys2QueryProcessList        - Get the list of running processes
    21 Sys2Read                    -
     23Sys2Read                    - Read bytes from a file or named pipe
    2224Sys2ReplaceModule           - Unlock a DLL (DosReplaceModule wrapper)
     25Sys2Seek                    - Set file read/write pointer (with >2GB support)
    2326Sys2Version                 - Get the version of this library
     27Sys2Write                   - Write bytes to a file or named pipe
    2428
    2529
     
    4549
    4650-------------------------------------------------------------------------
     51Sys2Close
     52
     53Close a file or stream (wrapper to DosClose).
     54
     55REXX ARGUMENTS:
     56  1. File handle (returned by Sys2Open).  (REQUIRED)
     57
     58REXX RETURN VALUE:
     59  1 on success, or 0 if an error occurred.
     60
     61
     62-------------------------------------------------------------------------
    4763Sys2ConnectNamedPipe
    4864
     
    6076Sys2CreateNamedPipe
    6177
    62 Creates a named pipe with the specified name and parameters.
     78Creates a named pipe with the specified name and parameters.  Only byte
     79mode is supported; message mode is not.
    6380
    6481Note that the standard REXX functions such as CHARIN/OUT, which operate
    6582directly on file names, are not capable of using the pipe handle returned
    6683from this function. While the client end can use such functions after
    67 using STREAM to issue an OPEN WRITE or OPEN READ command, the host end
     84using STREAM to issue an OPEN WRITE or OPEN READ command, the server end
    6885needs to use the pipe handle from this function, and must therefore use
    6986Sys2Read/Sys2Write in order to read and write data from the pipe.
     87
     88Named pipes can be created in inbound-only, outbound-only, or duplex
     89(inbound/outbound) mode.  An error will result if attempting to write
     90to an inbound-only pipe, or read from an outbound-only pipe.
     91
     92To activate a named pipe so that client processes can connect to it, use
     93Sys2ConnectNamedPipe.  To check the pipe's connection status, as well as
     94the amount of data currently in the pipe, use Sys2CheckNamedPipe.  To
     95unlock a named pipe after a client has closed the connection, use
     96Sys2DisconnectNamedPipe.  Finally, the pipe should be destroyed using
     97Sys2Close when no longer needed.
    7098
    7199REXX ARGUMENTS:
     
    232260
    233261-------------------------------------------------------------------------
    234 
     262Sys2Open
     263
     264Opens a file or other stream; files larger than 2GB are supported (this
     265function is a wrapper to DosOpenL).  Direct-DASD mode is not supported by
     266this function, nor is setting the initial extended attributes.
     267
     268REXX ARGUMENTS:
     269  1. Name of file or stream to open.                           (REQUIRED)
     270  2. Open action flags, must be either "O" (open if exists), "R" (replace
     271     if exists), or nothing (fail if exists), optionally followed by "C"
     272     (create if file does not exist).  If "C" is not specified, the
     273     operation will fail if the file does not exist.  Note that a value
     274     of "" alone will therefore fail automatically.        (DEFAULT: "O")
     275     In summary, the possible combinations are:
     276       O = Open only (if file exists, open it; if not, fail)
     277       OC= Open/create (if file exists, open it; if not, create it)
     278       R = Replace only (if file exists, replace it; if not, fail)
     279       RC= Replace/create (if file exists, replace it; if not, create it)
     280       C = Create only (if file exists, fail; if not, create it)
     281       (empty) = No-op (if file exists, fail; if not, fail)
     282  3. Access mode flags, one or both of:                   (DEFAULT: "RW")
     283       R = Open file with read access.
     284       W = Open file with write access.
     285  4. Sharing mode flags, any combination of:               (DEFAULT: "W")
     286       R = Deny read access to other processes
     287       W = Deny write access to other processes
     288  5. Deny legacy DosOpen access, one of:
     289       0 = Allow DosOpen to access the file                     (DEFAULT)
     290       1 = Deny access using the DosOpen API
     291  6. Privacy/inheritance flag, one of:
     292       0 = The file handle is inherited by child processes.     (DEFAULT)
     293       1 = The file handle is private to the current process.
     294  7. Initial file attributes when creating a file:          (DEFAULT: "")
     295       A = Archive attribute set
     296       D = Directory attribute set
     297       S = System attribute set
     298       H = Hidden attribute set
     299       R = Read-only attribute set
     300  8. Initial file size when creating or replacing a file; ignored if
     301     access mode is read-only.                               (DEFAULT: 0)
     302  9. I/O mode flags, any or all of:                         (DEFAULT: "")
     303      T = Write-through mode (default is normal write)
     304      N = No-cache mode (default is to use filesystem cache)
     305      S = Sequential access
     306      R = Random access
     307         * S and R can combine as follows:
     308             Neither: No locality known (default)
     309             S only:  Mainly sequential access
     310             R only:  Mainly random access
     311             Both:    Random/sequential (i.e. random with some locality)
     312
     313REXX RETURN VALUE:
     314  File handle, or "" in case of error.
     315
     316
     317-------------------------------------------------------------------------
    235318Sys2PutClipboardText
    236319
     
    323406Sys2Read
    324407
    325 Read bytes from a previously-opened stream (wrapper to DosRead).  The
    326 format of file handles supported by this function is currently limited
    327 to those returned by Sys2CreateNamedPipe.
    328 
    329 REXX ARGUMENTS:
    330   1. File handle (as returned by Sys2CreateNamedPipe).  (REQUIRED)
     408Read bytes from a previously-opened stream (wrapper to DosRead).
     409
     410REXX ARGUMENTS:
     411  1. File handle (as returned by Sys2Open or Sys2CreateNamedPipe).
     412     (REQUIRED)
    331413  2. Number of bytes to read.  (REQUIRED)
    332414
     
    350432
    351433-------------------------------------------------------------------------
     434Sys2Seek
     435
     436Move the read/write pointer to the specified location in an open
     437file/stream; files larger than 2GB are supported (this function is a
     438wrapper to DosSetFilePtrL).
     439
     440REXX ARGUMENTS:
     441  1. File handle (returned by Sys2Open).  (REQUIRED)
     442  2. The signed distance in bytes to move.  (REQUIRED)
     443  3. Move method, one of:
     444       B = Beginning of file
     445       C = Current position (DEFAULT)
     446       E = End of file
     447
     448REXX RETURN VALUE:
     449  The new file position, in bytes.
     450
     451
     452-------------------------------------------------------------------------
    352453Sys2Version
    353454
     
    357458REXX RETURN VALUE: Current version in the form "major.minor.refresh"
    358459
     460
     461-------------------------------------------------------------------------
     462Sys2Write
     463
     464Write bytes to a previously-opened stream (wrapper to DosWrite).
     465
     466REXX ARGUMENTS:
     467  1. File handle (as returned by Sys2Open or Sys2CreateNamedPipe).
     468     (REQUIRED)
     469  2. Data to be written.  (REQUIRED)
     470
     471REXX RETURN VALUE:
     472  The number of bytes successfully written.
     473
Note: See TracChangeset for help on using the changeset viewer.