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
..
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef KIstr
#define KIstr
#include <k/mem.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct kstr {
sz size;
kmptr ptr;
} kstr;
typedef struct ksraw {
sz size;
const char* ptr;
} ksraw;
typedef struct ksmut {
sz size;
char* ptr;
} ksmut;
#include <k/internal.egroup.h>
typedef enum kscond {
kscond_ok = kscond_id,
kscond_fail,
kscond_unimplemented,
kscond_nonnumeric,
kscond_no_room,
kscond_null,
} kscond;
................................................................................
ksconv_partial = 1 << 7,
ksconv_nopfx = 1 << 8,
ksconv_endh = 1 << 9,
ksconv_endl = 1 << 10,
};
kscond ks_to_int(ksraw str,
enum ksconv mode,
u8* dest, sz size);
kscond ks_of_int(u8* number, sz size,
enum ksconv mode,
char* bufstart, sz bufsize);
kscond kscp(ksraw str, ksmut dest, sz* len);
#ifdef __cplusplus
}
#endif
#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
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#ifndef KIstr
#define KIstr
#include <k/type.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ksraw {
sz size;
const char* ptr;
} ksraw;
typedef struct ksmut {
sz size;
char* ptr;
} ksmut;
sz kssz(const char* str, sz max);
#include <k/mem.h>
typedef struct kstr {
sz size;
kmptr ptr;
} kstr;
#include <k/io.h>
#include <k/internal.egroup.h>
typedef enum kscond {
kscond_ok = kscond_id,
kscond_partial,
kscond_fail,
kscond_unimplemented,
kscond_nonnumeric,
kscond_no_room,
kscond_null,
} kscond;
................................................................................
ksconv_partial = 1 << 7,
ksconv_nopfx = 1 << 8,
ksconv_endh = 1 << 9,
ksconv_endl = 1 << 10,
};
typedef struct ksbuf {
sz run;
kiochan channel;
char* cur;
char buf [];
} ksbuf;
/* functions */
kscond ks_to_int(ksraw str,
enum ksconv mode,
u8* dest, sz size);
kscond ks_of_int(u8* number, sz size,
enum ksconv mode,
char* bufstart, sz bufsize);
kscond kscp(ksraw str, ksmut dest, sz* len);
ksbuf* ksbufmk(void* where, kiochan channel, sz run);
#include <k/core.h>
kcond ksbufput(ksbuf*, ksraw);
kiocond ksbufflush(ksbuf*);
#ifdef __cplusplus
}
#endif
#endif
|