summaryrefslogtreecommitdiff
path: root/rsc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-04-23 15:48:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-25 10:04:53 +0200
commit6b448d3634f26224e480c0f30c617eacd7b4e3ab (patch)
treee829dd9ce5207e29be890c309e3b5ceaa3e4eea9 /rsc
parentda64d198ec3b31318c92ad4bcaab18cc2bf5cfdc (diff)
make __RSC a builtin define for the RSC compiler
instead of randomly defining it in only some of .src files Change-Id: Ifec3920740723d248400f451d717b5288c421b8d Reviewed-on: https://gerrit.libreoffice.org/36832 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'rsc')
-rw-r--r--rsc/inc/rscdef.hxx7
-rw-r--r--rsc/source/parser/rsclex.cxx7
2 files changed, 10 insertions, 4 deletions
diff --git a/rsc/inc/rscdef.hxx b/rsc/inc/rscdef.hxx
index 1aeeead37e1c..9ca0c8483fab 100644
--- a/rsc/inc/rscdef.hxx
+++ b/rsc/inc/rscdef.hxx
@@ -255,13 +255,14 @@ friend class RscId;
virtual COMPARE Compare( const NameNode * ) const override;
virtual COMPARE Compare( const void * ) const override;
-protected:
-
+public:
RscDefine( RscFileTab::Index lFileKey, const OString& rDefName,
sal_Int32 lDefId );
+ virtual ~RscDefine() override;
+
+protected:
RscDefine( RscFileTab::Index lFileKey, const OString& rDefName,
RscExpression * pExpression );
- virtual ~RscDefine() override;
void IncRef() { nRefCount++; }
void DecRef();
diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx
index 37ea1d3b3973..f240903c9b05 100644
--- a/rsc/source/parser/rsclex.cxx
+++ b/rsc/source/parser/rsclex.cxx
@@ -65,6 +65,7 @@ static bool bTargetDefined;
StringContainer* pStringContainer = nullptr;
+static RscDefine RSC_GLOBAL_DEFINE(RscFileTab::Index(0), OString("__RSC"), 1);
sal_uInt32 GetNumber()
{
@@ -275,7 +276,11 @@ int MakeToken( YYSTYPE * pTokenVal )
// Symbol
RscDefine * pDef;
- pDef = pTC->aFileTab.FindDef( aBuf.getStr() );
+ // this #define symbol is used to indicate to various code that it is being processed with the RSC compiler
+ if (strcmp(aBuf.getStr(), "__RSC") == 0)
+ pDef = &RSC_GLOBAL_DEFINE;
+ else
+ pDef = pTC->aFileTab.FindDef( aBuf.getStr() );
if( pDef )
{
pTokenVal->defineele = pDef;