From 170a47c784efa8f5a54d93a3b93943380d6b9aff Mon Sep 17 00:00:00 2001 From: borutr Date: Tue, 2 Jan 2007 17:33:58 +0000 Subject: [PATCH] * doc/sdccman.lyx: documented #pragma sdcc_hash * support/cpp2/sdcpp.c: allow_naked_hash (value of #pragma sdcc_hash) initialized to 0 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4552 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 6 +++ doc/sdccman.lyx | 103 +++++++++++++++++++++++++++++++++++-------- support/cpp2/sdcpp.c | 1 + 3 files changed, 91 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63a8cf9b..e6a231b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-02 Borut Razem + + * doc/sdccman.lyx: documented #pragma sdcc_hash + * support/cpp2/sdcpp.c: allow_naked_hash (value of #pragma sdcc_hash) + initialized to 0 + 2007-01-01 Bernhard Held * src/SDCCast.c (createDo): backPatchLabels() needs falseLabel in diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index bc1c1cb9..20b26c19 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -16914,6 +16914,57 @@ The preprocessor SDCPP \layout Itemize +\series bold +pedantic_parse_number +\series default + +\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number} + +\end_inset + + (+ | -) - Pedantic parse numbers so that situations like 0xfe-LO_B(3) are + parsed properly and the macro LO_B(3) gets expanded. + Default is off. + Below is an example on how to use this pragma. + +\emph on + Note: this functionality is not in conformance with standard! + +\layout Verse + + +\family typewriter +#pragma pedantic_parse_number + +\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number} + +\end_inset + + +\newline +\newline +#define LO_B(x) ((x) & 0xff) +\newline +\newline +unsigned char foo(void) +\newline +\InsetSpace ~ +\InsetSpace ~ +\InsetSpace ~ +unsigned char c=0xfe-LO_B(3); +\newline +\newline +\InsetSpace ~ +\InsetSpace ~ +\InsetSpace ~ + +return c; +\newline +} +\newline + +\layout Itemize + + \series bold preproc_asm \series default @@ -16990,51 +17041,65 @@ void foo (void) \series bold -pedantic_parse_number +sdcc_hash \series default -\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number} +\begin_inset LatexCommand \index{\#pragma sdcc\_hash} \end_inset - (+ | -) - Pedantic parse numbers so that situations like 0xfe-LO_B(3) are - parsed properly and the macro LO_B(3) gets expanded. - Default is off. + (+ | -) - Allow "naked" hash in macro definition, for example: +\newline +\family typewriter +#define DIR_LO(x) #(x & 0xff) +\family default +\newline +Default is off. Below is an example on how to use this pragma. - -\emph on - Note: this functionality is not in conformance with standard! - \layout Verse \family typewriter -#pragma pedantic_parse_number + -\begin_inset LatexCommand \index{\#pragma pedantic\_parse\_number} +#pragma preproc_asm + +\newline +#pragma sdcc_hash + +\begin_inset LatexCommand \index{\#pragma sdcc\_hash} \end_inset -\newline -\newline -#define LO_B(x) ((x) & 0xff) \newline \newline -unsigned char foo(void) +#define ROMCALL(x) +\backslash \newline \InsetSpace ~ \InsetSpace ~ \InsetSpace ~ -unsigned char c=0xfe-LO_B(3); +mov R6_B3, #(x & 0xff) +\backslash \newline +\InsetSpace ~ +\InsetSpace ~ +\InsetSpace ~ +mov R7_B3, #((x >> 8) & 0xff) +\backslash \newline \InsetSpace ~ \InsetSpace ~ \InsetSpace ~ - -return c; +lcall __romcall \newline -} +\newline +... +\newline +_asm +\newline +ROMCALL(72) +\newline +_endasm; +\newline +... \newline \layout Standard diff --git a/support/cpp2/sdcpp.c b/support/cpp2/sdcpp.c index c594eb8a..76931cf9 100644 --- a/support/cpp2/sdcpp.c +++ b/support/cpp2/sdcpp.c @@ -248,6 +248,7 @@ sdcpp_init_options (unsigned int argc, const char **argv) { unsigned int ret = sdcpp_common_init_options(argc, argv); + CPP_OPTION (parse_in, allow_naked_hash) = 0; CPP_OPTION (parse_in, preproc_asm) = 1; CPP_OPTION (parse_in, pedantic_parse_number) = 0; CPP_OPTION (parse_in, obj_ext) = NULL; -- 2.30.2