libk  Diff

Differences From Artifact [824a86b217]:

To Artifact [aa4095c969]:


     4      4    * ~ lexi hale <lexi@hale.su>
     5      5    * this header declares IO primitive functions and
     6      6    * structures. it is the same for all platforms.
     7      7    * platform-specific code is found in the *.platform.h
     8      8    * files.
     9      9    */
    10     10   
           11  +#include <k/str.h>
    11     12   #include <k/type.h>
           13  +#include <k/mem.h>
    12     14   
    13     15   typedef enum kiostream_kind {
    14     16   	kiostream_closed,
    15     17   	  // this kiostream cannot be written to
    16     18   	kiostream_file,
    17     19   	  // this kiostream represents a file
    18     20   	kiostream_sock,
................................................................................
    36     38   typedef struct kiochan {
    37     39   	kiostream in;
    38     40   	  // text can be read from this stream
    39     41   	kiostream out;
    40     42   	  // text can be written to this stream
    41     43   } kiochan;
    42     44   
    43         -unsigned long long kiosend(kiochan); // send data to a channel
    44         -unsigned long long kiorecv(kiochan); // receive data from a channel
    45         -
    46     45   typedef enum kiocond {
    47     46   	kiocond_ok,
    48     47   	  // success
    49     48       kiocond_fail,
    50     49   	  // action failed
    51     50   } kiocond;
    52     51   
           52  +kiocond kiosend(kiochan, ksraw, sz*); // send data to a channel
           53  +kiocond kiorecv(kiochan, ksraw*); // receive data from a channel
           54  +kmptr kiorecvall(kiochan, kmcell*, kmkind); // automatically allocate a bufer for a channel
           55  +  // kmkind is only used if kmcell* is NULL
           56  +kiocond kiocon(kiochan, kiochan); // connect one channel to another
           57  +
    53     58   #endif