* doc/sdccman.lyx: documented #pragma sdcc_hash
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 2 Jan 2007 17:33:58 +0000 (17:33 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 2 Jan 2007 17:33:58 +0000 (17:33 +0000)
* 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
doc/sdccman.lyx
support/cpp2/sdcpp.c

index 63a8cf9bce285b45bb6a1fa47ee990e511a2de85..e6a231b5540db64f66bbabfc4901caa6d61d17fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-02 Borut Razem <borut.razem AT siol.net>
+
+       * 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 <bernhard AT bernhardheld.de>
 
        * src/SDCCast.c (createDo): backPatchLabels() needs falseLabel in
index bc1c1cb994b01b913c45c1de646f6ffea3302595..20b26c198fd4b3b3f68f0c6bc908d7025b40927c 100644 (file)
@@ -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
index c594eb8aa25b718f06b2da1c9b3e8ccd6e74baeb..76931cf94fcdc9dcdc377bafd6acf240b5b6e071 100644 (file)
@@ -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;