Commit afb03408 by Neil Booth Committed by Neil Booth

cpphash.h (_cpp_read_logical_line_trad, [...]): Update prototypes.

	* cpphash.h (_cpp_read_logical_line_trad,
	_cpp_expansions_different_trad): Update prototypes.
	* cpplex.c (continue_after_nul): New.
	* cppmain.c: Include cpphash.h.
	(scan_translation_unit_trad): New.
	(cpp_preprocess_file): Call it.
	* cpptrad.c (_cpp_read_logical_line_trad): Take new parameter
	overlay.
	(_cpp_expansions_different_trad): Update prototype.

From-SVN: r54446
parent 2754d3c5
2002-06-10 Neil Booth <neil@daikokuya.demon.co.uk>
* cpphash.h (_cpp_read_logical_line_trad,
_cpp_expansions_different_trad): Update prototypes.
* cpplex.c (continue_after_nul): New.
* cppmain.c: Include cpphash.h.
(scan_translation_unit_trad): New.
(cpp_preprocess_file): Call it.
* cpptrad.c (_cpp_read_logical_line_trad): Take new parameter
overlay.
(_cpp_expansions_different_trad): Update prototype.
Mon Jun 10 18:02:24 2002 J"orn Rennecke <joern.rennecke@superh.com>
Fix cfi generation for SH[1-4]:
......
......@@ -510,13 +510,14 @@ extern void _cpp_do_file_change PARAMS ((cpp_reader *, enum lc_reason,
extern void _cpp_pop_buffer PARAMS ((cpp_reader *));
/* In cpptrad.c. */
extern bool _cpp_read_logical_line_trad PARAMS ((cpp_reader *));
extern bool _cpp_read_logical_line_trad PARAMS ((cpp_reader *, int));
extern void _cpp_overlay_buffer PARAMS ((cpp_reader *pfile, const uchar *,
size_t));
extern cpp_hashnode *_cpp_lex_identifier_trad PARAMS ((cpp_reader *));
extern void _cpp_set_trad_context PARAMS ((cpp_reader *));
extern bool _cpp_create_trad_definition PARAMS ((cpp_reader *, cpp_macro *));
extern bool _cpp_expansions_different_trad PARAMS ((cpp_macro *, cpp_macro *));
extern bool _cpp_expansions_different_trad PARAMS ((const cpp_macro *,
const cpp_macro *));
/* Utility routines and macros. */
#define DSC(str) (const uchar *)str, sizeof str - 1
......
......@@ -891,7 +891,7 @@ continue_after_nul (pfile)
buffer->saved_flags = BOL;
if (CPP_OPTION (pfile, traditional))
more = _cpp_read_logical_line_trad (pfile);
more = _cpp_read_logical_line_trad (pfile, true);
else
{
/* Stop parsing arguments with a CPP_EOF. When we finally come
......
......@@ -24,6 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "cpphash.h"
#include "intl.h"
/* Encapsulates state used to convert the stream of tokens coming from
......@@ -42,6 +43,7 @@ static void setup_callbacks PARAMS ((cpp_reader *));
/* General output routines. */
static void scan_translation_unit PARAMS ((cpp_reader *));
static void scan_translation_unit_trad PARAMS ((cpp_reader *));
static void check_multiline_token PARAMS ((const cpp_string *));
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
......@@ -104,6 +106,8 @@ cpp_preprocess_file (pfile)
cpp_scan_nooutput or cpp_get_token next. */
if (options->no_output)
cpp_scan_nooutput (pfile);
else if (options->traditional)
scan_translation_unit_trad (pfile);
else
scan_translation_unit (pfile);
......@@ -217,6 +221,22 @@ check_multiline_token (str)
print.line++;
}
static void
scan_translation_unit_trad (pfile)
cpp_reader *pfile;
{
bool more;
size_t len;
do
{
more = _cpp_read_logical_line_trad (pfile, false);
len = pfile->trad_out_cur - pfile->trad_out_base;
fwrite (pfile->trad_out_base, 1, len, print.outf);
}
while (more);
}
/* If the token read on logical line LINE needs to be output on a
different line to the current one, output the required newlines or
a line marker, and return 1. Otherwise return 0. */
......
......@@ -298,15 +298,18 @@ restore_buff (pfile)
/* Reads a logical line into the output buffer. Returns TRUE if there
is more text left in the buffer. */
bool
_cpp_read_logical_line_trad (pfile)
_cpp_read_logical_line_trad (pfile, overlay)
cpp_reader *pfile;
int overlay;
{
cpp_buffer *buffer;
unsigned int first_line;
unsigned int first_line = 0;
restore_buff (pfile);
first_line = pfile->line = pfile->trad_line;
if (overlay)
{
restore_buff (pfile);
first_line = pfile->line = pfile->trad_line;
}
buffer = pfile->buffer;
if (buffer->cur == buffer->rlimit)
......@@ -330,10 +333,14 @@ _cpp_read_logical_line_trad (pfile)
scan_out_logical_line (pfile, NULL);
buffer->cur = CUR (pfile->context);
pfile->trad_line = pfile->line;
pfile->line = first_line;
_cpp_overlay_buffer (pfile, pfile->trad_out_base,
pfile->trad_out_cur - pfile->trad_out_base);
if (overlay)
{
pfile->trad_line = pfile->line;
pfile->line = first_line;
_cpp_overlay_buffer (pfile, pfile->trad_out_base,
pfile->trad_out_cur - pfile->trad_out_base);
}
return true;
}
......@@ -855,7 +862,7 @@ canonicalize_text (dest, src, len, pquote)
than in the form of their whitespace. */
bool
_cpp_expansions_different_trad (macro1, macro2)
cpp_macro *macro1, *macro2;
const cpp_macro *macro1, *macro2;
{
uchar *p1 = xmalloc (macro1->count + macro2->count);
uchar *p2 = p1 + macro1->count;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment