| 1 |
/* |
| 2 |
* Copyright 2008-2009 Katholieke Universiteit Leuven |
| 3 |
* |
| 4 |
* Use of this software is governed by the MIT license |
| 5 |
* |
| 6 |
* Written by Sven Verdoolaege, K.U.Leuven, Departement |
| 7 |
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium |
| 8 |
*/ |
| 9 |
|
| 10 |
#ifndef ISL_STREAM_H |
| 11 |
#define ISL_STREAM_H |
| 12 |
|
| 13 |
#include <stdio.h> |
| 14 |
#include <isl/hash.h> |
| 15 |
#include <isl/aff_type.h> |
| 16 |
#include <isl/obj.h> |
| 17 |
#include <isl/val_type.h> |
| 18 |
#include <isl/schedule_type.h> |
| 19 |
|
| 20 |
#if defined(__cplusplus) |
| 21 |
extern "C" { |
| 22 |
#endif |
| 23 |
|
| 24 |
enum isl_token_type { ISL_TOKEN_ERROR = -1, |
| 25 |
ISL_TOKEN_UNKNOWN = 256, ISL_TOKEN_VALUE, |
| 26 |
ISL_TOKEN_IDENT, ISL_TOKEN_GE, |
| 27 |
ISL_TOKEN_LE, ISL_TOKEN_GT, ISL_TOKEN_LT, |
| 28 |
ISL_TOKEN_NE, ISL_TOKEN_EQ_EQ, |
| 29 |
ISL_TOKEN_LEX_GE, ISL_TOKEN_LEX_LE, |
| 30 |
ISL_TOKEN_LEX_GT, ISL_TOKEN_LEX_LT, |
| 31 |
ISL_TOKEN_TO, ISL_TOKEN_AND, |
| 32 |
ISL_TOKEN_OR, ISL_TOKEN_EXISTS, ISL_TOKEN_NOT, |
| 33 |
ISL_TOKEN_DEF, ISL_TOKEN_INFTY, ISL_TOKEN_NAN, |
| 34 |
ISL_TOKEN_MIN, ISL_TOKEN_MAX, ISL_TOKEN_RAT, |
| 35 |
ISL_TOKEN_TRUE, ISL_TOKEN_FALSE, |
| 36 |
ISL_TOKEN_CEILD, ISL_TOKEN_FLOORD, ISL_TOKEN_MOD, |
| 37 |
ISL_TOKEN_STRING, |
| 38 |
ISL_TOKEN_MAP, ISL_TOKEN_AFF, |
| 39 |
ISL_TOKEN_CEIL, ISL_TOKEN_FLOOR, |
| 40 |
ISL_TOKEN_IMPLIES, |
| 41 |
ISL_TOKEN_INT_DIV, |
| 42 |
ISL_TOKEN_LAST }; |
| 43 |
|
| 44 |
struct isl_token; |
| 45 |
|
| 46 |
__isl_give isl_val *isl_token_get_val(isl_ctx *ctx, struct isl_token *tok); |
| 47 |
__isl_give char *isl_token_get_str(isl_ctx *ctx, struct isl_token *tok); |
| 48 |
int isl_token_get_type(struct isl_token *tok); |
| 49 |
void isl_token_free(struct isl_token *tok); |
| 50 |
|
| 51 |
struct isl_stream; |
| 52 |
typedef struct isl_stream isl_stream; |
| 53 |
|
| 54 |
__isl_give isl_stream *isl_stream_new_file(isl_ctx *ctx, FILE *file); |
| 55 |
__isl_give isl_stream *isl_stream_new_str(isl_ctx *ctx, const char *str); |
| 56 |
void isl_stream_free(__isl_take isl_stream *s); |
| 57 |
|
| 58 |
isl_ctx *isl_stream_get_ctx(__isl_keep isl_stream *s); |
| 59 |
|
| 60 |
void isl_stream_error(__isl_keep isl_stream *s, struct isl_token *tok, |
| 61 |
char *msg); |
| 62 |
|
| 63 |
struct isl_token *isl_stream_next_token(__isl_keep isl_stream *s); |
| 64 |
struct isl_token *isl_stream_next_token_on_same_line(__isl_keep isl_stream *s); |
| 65 |
int isl_stream_next_token_is(__isl_keep isl_stream *s, int type); |
| 66 |
void isl_stream_push_token(__isl_keep isl_stream *s, struct isl_token *tok); |
| 67 |
void isl_stream_flush_tokens(__isl_keep isl_stream *s); |
| 68 |
int isl_stream_eat_if_available(__isl_keep isl_stream *s, int type); |
| 69 |
char *isl_stream_read_ident_if_available(__isl_keep isl_stream *s); |
| 70 |
int isl_stream_eat(__isl_keep isl_stream *s, int type); |
| 71 |
int isl_stream_is_empty(__isl_keep isl_stream *s); |
| 72 |
int isl_stream_skip_line(__isl_keep isl_stream *s); |
| 73 |
|
| 74 |
enum isl_token_type isl_stream_register_keyword(__isl_keep isl_stream *s, |
| 75 |
const char *name); |
| 76 |
|
| 77 |
struct isl_obj isl_stream_read_obj(__isl_keep isl_stream *s); |
| 78 |
__isl_give isl_val *isl_stream_read_val(__isl_keep isl_stream *s); |
| 79 |
__isl_give isl_multi_aff *isl_stream_read_multi_aff(__isl_keep isl_stream *s); |
| 80 |
__isl_give isl_map *isl_stream_read_map(__isl_keep isl_stream *s); |
| 81 |
__isl_give isl_set *isl_stream_read_set(__isl_keep isl_stream *s); |
| 82 |
__isl_give isl_pw_qpolynomial *isl_stream_read_pw_qpolynomial( |
| 83 |
__isl_keep isl_stream *s); |
| 84 |
__isl_give isl_union_set *isl_stream_read_union_set(__isl_keep isl_stream *s); |
| 85 |
__isl_give isl_union_map *isl_stream_read_union_map(__isl_keep isl_stream *s); |
| 86 |
__isl_give isl_schedule *isl_stream_read_schedule(isl_stream *s); |
| 87 |
|
| 88 |
int isl_stream_yaml_read_start_mapping(__isl_keep isl_stream *s); |
| 89 |
int isl_stream_yaml_read_end_mapping(__isl_keep isl_stream *s); |
| 90 |
int isl_stream_yaml_read_start_sequence(__isl_keep isl_stream *s); |
| 91 |
int isl_stream_yaml_read_end_sequence(__isl_keep isl_stream *s); |
| 92 |
int isl_stream_yaml_next(__isl_keep isl_stream *s); |
| 93 |
|
| 94 |
#if defined(__cplusplus) |
| 95 |
} |
| 96 |
#endif |
| 97 |
|
| 98 |
#endif |