isl_transitive_closure: extract out construction of path from map_power
[isl.git] / isl_stream.h
blobd83c7058c975a3fe1d0fb6ebe934ad71c8583328
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #ifndef ISL_STREAM_H
11 #define ISL_STREAM_H
13 #include <stdio.h>
15 #if defined(__cplusplus)
16 extern "C" {
17 #endif
19 enum isl_token_type { ISL_TOKEN_UNKNOWN = 256, ISL_TOKEN_VALUE,
20 ISL_TOKEN_IDENT, ISL_TOKEN_GE,
21 ISL_TOKEN_LE, ISL_TOKEN_GT, ISL_TOKEN_LT,
22 ISL_TOKEN_TO, ISL_TOKEN_AND,
23 ISL_TOKEN_OR, ISL_TOKEN_EXISTS };
25 struct isl_token {
26 enum isl_token_type type;
28 unsigned int on_new_line : 1;
29 int line;
30 int col;
32 union {
33 isl_int v;
34 char *s;
35 } u;
38 void isl_token_free(struct isl_token *tok);
40 struct isl_stream {
41 struct isl_ctx *ctx;
42 FILE *file;
43 const char *str;
44 int line;
45 int col;
46 int eof;
48 char *buffer;
49 size_t size;
50 size_t len;
51 int c;
53 struct isl_token *tokens[5];
54 int n_token;
57 struct isl_stream* isl_stream_new_file(struct isl_ctx *ctx, FILE *file);
58 struct isl_stream* isl_stream_new_str(struct isl_ctx *ctx, const char *str);
59 void isl_stream_free(struct isl_stream *s);
61 void isl_stream_error(struct isl_stream *s, struct isl_token *tok, char *msg);
63 struct isl_token *isl_stream_next_token(struct isl_stream *s);
64 struct isl_token *isl_stream_next_token_on_same_line(struct isl_stream *s);
65 void isl_stream_push_token(struct isl_stream *s, struct isl_token *tok);
66 int isl_stream_eat(struct isl_stream *s, int type);
68 #if defined(__cplusplus)
70 #endif
72 #endif