Commit | Line | Data |
---|---|---|
e98a2d6e | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
e98a2d6e | 3 | * |
0235b0db | 4 | * Copyright 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
e98a2d6e PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef _CTF_SCANNER_H |
8 | #define _CTF_SCANNER_H | |
9 | ||
e98a2d6e | 10 | #include <stdio.h> |
91d81473 | 11 | #include "common/macros.h" |
06a626b8 | 12 | #include "ast.h" |
e98a2d6e PP |
13 | |
14 | #ifndef YY_TYPEDEF_YY_SCANNER_T | |
15 | #define YY_TYPEDEF_YY_SCANNER_T | |
16 | typedef void* yyscan_t; | |
17 | #endif | |
18 | ||
19 | struct ctf_scanner_scope; | |
20 | struct ctf_scanner_scope { | |
21 | struct ctf_scanner_scope *parent; | |
5cd6d0e5 | 22 | GHashTable *classes; |
e98a2d6e PP |
23 | }; |
24 | ||
25 | struct ctf_scanner { | |
26 | yyscan_t scanner; | |
27 | struct ctf_ast *ast; | |
28 | struct ctf_scanner_scope root_scope; | |
29 | struct ctf_scanner_scope *cs; | |
30 | struct objstack *objstack; | |
31 | }; | |
32 | ||
d07cfd1a | 33 | BT_HIDDEN |
e98a2d6e | 34 | struct ctf_scanner *ctf_scanner_alloc(void); |
d07cfd1a SM |
35 | |
36 | BT_HIDDEN | |
e98a2d6e | 37 | void ctf_scanner_free(struct ctf_scanner *scanner); |
d07cfd1a SM |
38 | |
39 | BT_HIDDEN | |
e98a2d6e PP |
40 | int ctf_scanner_append_ast(struct ctf_scanner *scanner, FILE *input); |
41 | ||
42 | static inline | |
43 | struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner) | |
44 | { | |
45 | return scanner->ast; | |
46 | } | |
47 | ||
48 | BT_HIDDEN | |
49 | int is_type(struct ctf_scanner *scanner, const char *id); | |
50 | ||
51 | #endif /* _CTF_SCANNER_H */ |