libk  Diff

Differences From Artifact [247977844e]:

To Artifact [824a86b217]:


1
2







3










































4
#ifndef KIio
#define KIio


















































#endif


>
>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef KIio
#define KIio
/* <k/io.h>
 * ~ lexi hale <lexi@hale.su>
 * this header declares IO primitive functions and
 * structures. it is the same for all platforms.
 * platform-specific code is found in the *.platform.h
 * files.
 */

#include <k/type.h>

typedef enum kiostream_kind {
	kiostream_closed,
	  // this kiostream cannot be written to
	kiostream_file,
	  // this kiostream represents a file
	kiostream_sock,
	  // this kiostream is attached to a socket,
	  // UNIX, IP, or otherwise
	kiostream_term,
	  // this socket is being used to communicate
	  // directly with a human being
	kiostream_ansi,
	  // like kiostream_term, but can also understand
	  // ANSI control codes
	kiostream_other
	  // no fuckin idea
} kiostream_kind;

typedef struct kiostream {
	kiostream_kind kind;
	#include "kiostream.platform.h"
} kiostream;

typedef struct kiochan {
	kiostream in;
	  // text can be read from this stream
	kiostream out;
	  // text can be written to this stream
} kiochan;

unsigned long long kiosend(kiochan); // send data to a channel
unsigned long long kiorecv(kiochan); // receive data from a channel

typedef enum kiocond {
	kiocond_ok,
	  // success
    kiocond_fail,
	  // action failed
} kiocond;

#endif