libscomp/input.h

36 lines
650 B
C
Raw Normal View History

2021-07-10 15:10:00 -04:00
#pragma once
#include <stddef.h>
#define LIBSCOMM_MAXARG 32
#define LIBSCOMM_MAXBUF 1024
struct libscomm_line {
size_t name;
char *buf[LIBSCOMM_MAXARG];
size_t len;
};
struct libscomm_inbuf {
const char *s;
size_t l;
};
struct libscomm_input {
int state;
char intbuf[LIBSCOMM_MAXBUF];
size_t len;
};
enum libscomm_input_r {
LIBSCOMM_MORE,
LIBSCOMM_OVERFLOW,
LIBSCOMM_ARG_OVERFLOW,
LIBSCOMM_COMPLETE
};
void libscomm_reset(struct libscomm_input *);
enum libscomm_input_r libscomm_read(struct libscomm_input *,
struct libscomm_inbuf *,
struct libscomm_line *);