Lines Matching refs:stream
67 #define dirty_stream(stream) \
69 if (!stream->dirty) { \
70 stream->dirty = 1; \
71 if (!stream->ifndef) \
72 stream->protect = NULL; \
76 #define end_group(stream) \
78 if (stream->ifndef == stream->top_if) { \
79 stream->ifndef = NULL; \
80 if (!stream->dirty) \
81 stream->protect = NULL; \
82 else if (stream->protect) \
83 stream->dirty = 0; \
87 #define nesting_error(stream) \
89 stream->dirty = 1; \
90 stream->ifndef = NULL; \
91 stream->protect = NULL; \
98 token->pos.stream = pos->stream;
170 replace_with_string(token, stream_name(token->pos.stream));
256 static void preprocessor_line(struct stream *stream, struct token **line);
260 struct stream *stream = input_streams + prev->pos.stream;
268 preprocessor_line(stream, p);
297 next->pos.stream = pos->stream;
811 int stream, next;
813 for (stream = *hash_stream(path); stream >= 0 ; stream = next) {
814 struct stream *s = input_streams + stream;
874 static void set_stream_include_path(struct stream *stream)
876 const char *path = stream->path;
878 const char *p = strrchr(stream->name, '/');
881 int len = p - stream->name + 1;
884 memcpy(m, stream->name, len);
894 stream->path = path;
945 static int handle_include_path(struct stream *stream, struct token **list, struct token *token, int how)
978 path = stream->next_path;
986 set_stream_include_path(stream);
997 static int handle_include(struct stream *stream, struct token **list, struct token *token)
999 return handle_include_path(stream, list, token, 0);
1002 static int handle_include_next(struct stream *stream, struct token **list, struct token *token)
1004 return handle_include_path(stream, list, token, 1);
1007 static int handle_argv_include(struct stream *stream, struct token **list, struct token *token)
1009 return handle_include_path(stream, list, token, 2);
1470 static int do_handle_define(struct stream *stream, struct token **line, struct token *token, int attr)
1500 static int handle_define(struct stream *stream, struct token **line, struct token *token)
1502 return do_handle_define(stream, line, token, SYM_ATTR_NORMAL);
1505 static int handle_weak_define(struct stream *stream, struct token **line, struct token *token)
1507 return do_handle_define(stream, line, token, SYM_ATTR_WEAK);
1510 static int handle_strong_define(struct stream *stream, struct token **line, struct token *token)
1512 return do_handle_define(stream, line, token, SYM_ATTR_STRONG);
1515 static int do_handle_undef(struct stream *stream, struct token **line, struct token *token, int attr)
1546 static int handle_undef(struct stream *stream, struct token **line, struct token *token)
1548 return do_handle_undef(stream, line, token, SYM_ATTR_NORMAL);
1551 static int handle_strong_undef(struct stream *stream, struct token **line, struct token *token)
1553 return do_handle_undef(stream, line, token, SYM_ATTR_STRONG);
1556 static int preprocessor_if(struct stream *stream, struct token *token, int cond)
1560 token->next = stream->top_if;
1561 stream->top_if = token;
1567 static int handle_ifdef(struct stream *stream, struct token **line, struct token *token)
1574 dirty_stream(stream);
1579 return preprocessor_if(stream, token, arg);
1582 static int handle_ifndef(struct stream *stream, struct token **line, struct token *token)
1587 if (!stream->dirty && !stream->ifndef) {
1588 if (!stream->protect) {
1589 stream->ifndef = token;
1590 stream->protect = next->ident;
1591 } else if (stream->protect == next->ident) {
1592 stream->ifndef = token;
1593 stream->dirty = 1;
1598 dirty_stream(stream);
1604 return preprocessor_if(stream, token, arg);
1669 static int handle_if(struct stream *stream, struct token **line, struct token *token)
1675 dirty_stream(stream);
1676 return preprocessor_if(stream, token, value);
1679 static int handle_elif(struct stream * stream, struct token **line, struct token *token)
1681 struct token *top_if = stream->top_if;
1682 end_group(stream);
1685 nesting_error(stream);
1686 sparse_error(token->pos, "unmatched #elif within stream");
1691 nesting_error(stream);
1698 dirty_stream(stream);
1712 static int handle_else(struct stream *stream, struct token **line, struct token *token)
1714 struct token *top_if = stream->top_if;
1715 end_group(stream);
1718 nesting_error(stream);
1719 sparse_error(token->pos, "unmatched #else within stream");
1724 nesting_error(stream);
1737 static int handle_endif(struct stream *stream, struct token **line, struct token *token)
1739 struct token *top_if = stream->top_if;
1740 end_group(stream);
1742 nesting_error(stream);
1743 sparse_error(token->pos, "unmatched #endif in stream");
1748 stream->top_if = top_if->next;
1753 static int handle_warning(struct stream *stream, struct token **line, struct token *token)
1759 static int handle_error(struct stream *stream, struct token **line, struct token *token)
1765 static int handle_nostdinc(struct stream *stream, struct token **line, struct token *token)
1842 static int handle_add_include(struct stream *stream, struct token **line, struct token *token)
1856 static int handle_add_isystem(struct stream *stream, struct token **line, struct token *token)
1870 static int handle_add_system(struct stream *stream, struct token **line, struct token *token)
1901 static int handle_add_dirafter(struct stream *stream, struct token **line, struct token *token)
1915 static int handle_split_include(struct stream *stream, struct token **line, struct token *token)
1936 * stream. Just as an example.
1946 static int handle_pragma(struct stream *stream, struct token **line, struct token *token)
1951 stream->once = 1;
1966 static int handle_line(struct stream *stream, struct token **line, struct token *token)
1971 static int handle_ident(struct stream *stream, struct token **line, struct token *token)
1976 static int handle_nondirective(struct stream *stream, struct token **line, struct token *token)
2096 int stream = init_stream(NULL, "preprocessor", -1, includepath);
2099 int (*handler)(struct stream *, struct token **, struct token *);
2150 sym = create_symbol(stream, normal[i].name, SYM_PREPROCESSOR, NS_PREPROCESSOR);
2156 sym = create_symbol(stream, special[i].name, SYM_PREPROCESSOR, NS_PREPROCESSOR);
2162 sym = create_symbol(stream, dynamic[i].name, SYM_NODE, NS_MACRO);
2171 static void handle_preprocessor_line(struct stream *stream, struct token **line, struct token *start)
2173 int (*handler)(struct stream *, struct token **, struct token *);
2197 dirty_stream(stream);
2206 if (!handler(stream, line, token)) /* all set */
2213 static void preprocessor_line(struct stream *stream, struct token **line)
2226 handle_preprocessor_line(stream, line, start);
2234 struct stream *stream = input_streams + next->pos.stream;
2238 preprocessor_line(stream, list);
2246 if (stream->top_if) {
2247 nesting_error(stream);
2248 sparse_error(stream->top_if->pos, "unterminated preprocessor conditional");
2249 stream->top_if = NULL;
2252 if (!stream->dirty)
2253 stream->constant = CONSTANT_FILE_YES;
2263 dirty_stream(stream);