summaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-03-13 22:01:08 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-03-13 22:01:08 +0000
commit45b966db65e4ab054d31f01f65b7a98023dbcb54 (patch)
tree665428b0af6694941ce92f0755dc66596d94fa55 /gcc/cpphash.h
parent46089b8642e5054073af90a85cfdd07f0f09353b (diff)
downloadgcc-45b966db65e4ab054d31f01f65b7a98023dbcb54.tar.gz
Makefile.in (LIBCPP_OBJS): Add cpplex.o.
* Makefile.in (LIBCPP_OBJS): Add cpplex.o. (cpplex.o): New target. * po/POTFILES.in: Add cpplex.c. * cpplex.c (_cpp_grow_token_buffer, null_cleanup, cpp_push_buffer, cpp_pop_buffer, cpp_scan_buffer, cpp_expand_to_buffer, cpp_buf_line_and_col, cpp_file_buffer, skip_block_comment, skip_line_comment, skip_comment, copy_comment, _cpp_skip_hspace, _cpp_skip_rest_of_line, _cpp_parse_name, skip_string, parse_string, _cpp_parse_assertion, cpp_get_token, cpp_get_non_space_token, _cpp_get_directive_token, find_position, _cpp_read_and_prescan, _cpp_init_input_buffer): Move here. (maybe_macroexpand, _cpp_lex_token): New functions. * cpplib.c (SKIP_WHITE_SPACE, eval_if_expr, parse_set_mark, parse_goto_mark): Delete. (_cpp_handle_eof): New function. (_cpp_handle_directive): Rename from handle_directive. (_cpp_output_line_command): Rename from output_line_command. (do_if, do_elif): Call _cpp_parse_expr directly. * cppfiles.c (_cpp_read_include_file): Don't call init_input_buffer here. * cpphash.c (quote_string): Move here, rename _cpp_quote_string. * cppexp.c (_cpp_parse_expr): Diddle parsing_if_directive here; pop the token_buffer and skip the rest of the line here. * cppinit.c (cpp_start_read): Call _cpp_init_input_buffer here. * cpphash.h (CPP_RESERVE, CPP_IS_MACRO_BUFFER, ACTIVE_MARK_P): Define here. (CPP_SET_BUF_MARK, CPP_GOTO_BUF_MARK, CPP_SET_MARK, CPP_GOTO_MARK): New macros. (_cpp_quote_string, _cpp_parse_name, _cpp_skip_rest_of_line, _cpp_skip_hspace, _cpp_parse_assertion, _cpp_lex_token, _cpp_read_and_prescan, _cpp_init_input_buffer, _cpp_grow_token_buffer, _cpp_get_directive_token, _cpp_handle_directive, _cpp_handle_eof, _cpp_output_line_command): Prototype them here. * cpplib.h (enum cpp_token): Add CPP_MACRO. (CPP_RESERVE, get_directive_token, cpp_grow_buffer, quote_string, output_line_command): Remove. From-SVN: r32513
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index c842ea6e121..4468d42475a 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -217,6 +217,11 @@ extern unsigned char _cpp_IStable[256];
((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
+/* Make sure PFILE->token_buffer has space for at least N more characters. */
+#define CPP_RESERVE(PFILE, N) \
+ (CPP_WRITTEN (PFILE) + (size_t)(N) > (PFILE)->token_buffer_size \
+ && (_cpp_grow_token_buffer (PFILE, N), 0))
+
/* Append string STR (of length N) to PFILE's output buffer.
Assume there is enough space. */
#define CPP_PUTS_Q(PFILE, STR, N) \
@@ -242,6 +247,29 @@ extern unsigned char _cpp_IStable[256];
#define CPP_PEDANTIC(PFILE) \
(CPP_OPTIONS (PFILE)->pedantic && !CPP_BUFFER (pfile)->system_header_p)
+/* CPP_IS_MACRO_BUFFER is true if the buffer contains macro expansion.
+ (Note that it is false while we're expanding macro *arguments*.) */
+#define CPP_IS_MACRO_BUFFER(PBUF) ((PBUF)->data != NULL)
+
+/* Remember the current position of PFILE so it may be returned to
+ after looking ahead a bit.
+
+ Note that when you set a mark, you _must_ return to that mark. You
+ may not forget about it and continue parsing. You may not pop a
+ buffer with an active mark. You may not call CPP_BUMP_LINE while a
+ mark is active. */
+#define CPP_SET_BUF_MARK(IP) ((IP)->mark = (IP)->cur - (IP)->buf)
+#define CPP_GOTO_BUF_MARK(IP) ((IP)->cur = (IP)->buf + (IP)->mark, \
+ (IP)->mark = -1)
+#define CPP_SET_MARK(PFILE) CPP_SET_BUF_MARK(CPP_BUFFER(PFILE))
+#define CPP_GOTO_MARK(PFILE) CPP_GOTO_BUF_MARK(CPP_BUFFER(PFILE))
+
+/* ACTIVE_MARK_P is true if there's a live mark in the buffer. */
+#define ACTIVE_MARK_P(PFILE) (CPP_BUFFER (PFILE)->mark != -1)
+
+/* Last arg to output_line_command. */
+enum file_change_code {same_file, rename_file, enter_file, leave_file};
+
/* In cpphash.c */
extern HASHNODE *_cpp_make_hashnode PARAMS ((const U_CHAR *, size_t,
enum node_type,
@@ -257,6 +285,7 @@ extern void _cpp_dump_definition PARAMS ((cpp_reader *, const U_CHAR *,
long, DEFINITION *));
extern int _cpp_compare_defs PARAMS ((cpp_reader *, DEFINITION *,
DEFINITION *));
+extern void _cpp_quote_string PARAMS ((cpp_reader *, const char *));
extern void _cpp_macroexpand PARAMS ((cpp_reader *, HASHNODE *));
extern void _cpp_init_macro_hash PARAMS ((cpp_reader *));
extern void _cpp_dump_macro_hash PARAMS ((cpp_reader *));
@@ -272,4 +301,24 @@ extern void _cpp_init_include_hash PARAMS ((cpp_reader *));
/* In cppexp.c */
extern int _cpp_parse_expr PARAMS ((cpp_reader *));
+/* In cpplex.c */
+extern void _cpp_parse_name PARAMS ((cpp_reader *, int));
+extern void _cpp_skip_rest_of_line PARAMS ((cpp_reader *));
+extern void _cpp_skip_hspace PARAMS ((cpp_reader *));
+extern int _cpp_parse_assertion PARAMS ((cpp_reader *));
+extern enum cpp_token _cpp_lex_token PARAMS ((cpp_reader *));
+extern long _cpp_read_and_prescan PARAMS ((cpp_reader *, cpp_buffer *,
+ int, size_t));
+extern void _cpp_init_input_buffer PARAMS ((cpp_reader *));
+extern void _cpp_grow_token_buffer PARAMS ((cpp_reader *, long));
+extern enum cpp_token _cpp_get_directive_token
+ PARAMS ((cpp_reader *));
+
+/* In cpplib.c */
+extern int _cpp_handle_directive PARAMS ((cpp_reader *));
+extern void _cpp_handle_eof PARAMS ((cpp_reader *));
+extern void _cpp_output_line_command PARAMS ((cpp_reader *,
+ enum file_change_code));
+
+
#endif