isl_basic_set_get_hash: initialize hash value
[isl.git] / isl_stream.h
blobf445fc66c1d933dc792171e691b039f536ae7753
1 #ifndef ISL_STREAM_H
2 #define ISL_STREAM_H
4 #include <stdio.h>
6 #if defined(__cplusplus)
7 extern "C" {
8 #endif
10 enum isl_token_type { ISL_TOKEN_UNKNOWN = 256, ISL_TOKEN_VALUE,
11 ISL_TOKEN_IDENT, ISL_TOKEN_GE,
12 ISL_TOKEN_LE, ISL_TOKEN_TO, ISL_TOKEN_AND,
13 ISL_TOKEN_EXISTS };
15 struct isl_token {
16 enum isl_token_type type;
18 unsigned int on_new_line : 1;
19 int line;
20 int col;
22 union {
23 isl_int v;
24 char *s;
25 } u;
28 void isl_token_free(struct isl_token *tok);
30 struct isl_stream {
31 struct isl_ctx *ctx;
32 FILE *file;
33 const char *str;
34 int line;
35 int col;
36 int eof;
38 char *buffer;
39 size_t size;
40 size_t len;
41 int c;
43 struct isl_token *tokens[5];
44 int n_token;
47 struct isl_stream* isl_stream_new_file(struct isl_ctx *ctx, FILE *file);
48 struct isl_stream* isl_stream_new_str(struct isl_ctx *ctx, const char *str);
49 void isl_stream_free(struct isl_stream *s);
51 void isl_stream_error(struct isl_stream *s, struct isl_token *tok, char *msg);
53 struct isl_token *isl_stream_next_token(struct isl_stream *s);
54 void isl_stream_push_token(struct isl_stream *s, struct isl_token *tok);
55 int isl_stream_eat(struct isl_stream *s, int type);
57 #if defined(__cplusplus)
59 #endif
61 #endif