diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-04-23 15:48:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-25 10:04:53 +0200 |
commit | 6b448d3634f26224e480c0f30c617eacd7b4e3ab (patch) | |
tree | e829dd9ce5207e29be890c309e3b5ceaa3e4eea9 | |
parent | da64d198ec3b31318c92ad4bcaab18cc2bf5cfdc (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>
27 files changed, 20 insertions, 41 deletions
diff --git a/basic/source/classes/sb.src b/basic/source/classes/sb.src index d39e7b9bc228..5e6560a1906e 100644 --- a/basic/source/classes/sb.src +++ b/basic/source/classes/sb.src @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC + #include <tools/errcode.hxx> #include "sb.hrc" #include <basic/sberrors.hxx> diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h index 0287c8d49a87..8240cf63c60f 100644 --- a/include/i18nlangtag/lang.h +++ b/include/i18nlangtag/lang.h @@ -85,7 +85,7 @@ * comments are used. Do NOT use // C++ style comments. */ /* disable typedef for usage in svtools/source/misc/langtab.src */ -#ifndef RSC_RESOURCE_USAGE +#ifndef __RSC typedef unsigned short LanguageType; #endif diff --git a/include/rtl/textenc.h b/include/rtl/textenc.h index 72c9b2cc5306..4866a19de76f 100644 --- a/include/rtl/textenc.h +++ b/include/rtl/textenc.h @@ -20,11 +20,11 @@ #ifndef INCLUDED_RTL_TEXTENC_H #define INCLUDED_RTL_TEXTENC_H -#ifdef _SOLAR_RSC_INVOKED +#ifdef __RSC /* Enable resources to use these values, rsc can't handle casts */ #define RTL_TEXTENC_CAST( val ) (val) -#else /* !_SOLAR_RSC_INVOKED */ +#else /* !__RSC */ #include <sal/types.h> @@ -40,7 +40,7 @@ typedef sal_uInt16 rtl_TextEncoding; #define RTL_TEXTENC_CAST( val ) ((rtl_TextEncoding) val) -#endif /* _SOLAR_RSC_INVOKED */ +#endif /* __RSC */ #define RTL_TEXTENCODING_DONTKNOW (RTL_TEXTENC_CAST( 0 )) #define RTL_TEXTENCODING_MS_1252 (RTL_TEXTENC_CAST( 1 )) 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; diff --git a/sc/source/ui/src/scerrors.src b/sc/source/ui/src/scerrors.src index a6662c06d1f7..f9ad6237b843 100644 --- a/sc/source/ui/src/scerrors.src +++ b/sc/source/ui/src/scerrors.src @@ -16,7 +16,6 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC #include "scerrors.hxx" #include "sc.hrc" diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src index c4a3b874a6c3..86aea171dc9c 100644 --- a/sd/source/core/glob.src +++ b/sd/source/core/glob.src @@ -18,8 +18,6 @@ */ /* StarView resource file */ -#define __RSC - #include "glob.hrc" #include "sderror.hxx" diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index 24f012757503..a85b510eef75 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -18,7 +18,6 @@ */ #include <sfx2/sfx.hrc> #include "doc.hrc" -#define __RSC String STR_TEMPLATE_FILTER { diff --git a/solenv/gbuild/AllLangResTarget.mk b/solenv/gbuild/AllLangResTarget.mk index 379b854ca4cd..d31b10b23b3a 100644 --- a/solenv/gbuild/AllLangResTarget.mk +++ b/solenv/gbuild/AllLangResTarget.mk @@ -86,6 +86,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(INCLUDE) \ -I$(dir $(3)) \ $(DEFS) \ + -D__RSC \ -fp=$(1) \ $(if $(MERGEDFILE),$(MERGEDFILE),$<)" > $${RESPONSEFILE} && \ $(gb_ResTarget_RSCCOMMAND) -presponse @$${RESPONSEFILE} && \ diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk index b918f9605283..acc6ea2ba408 100644 --- a/solenv/gbuild/platform/com_GCC_class.mk +++ b/solenv/gbuild/platform/com_GCC_class.mk @@ -74,6 +74,7 @@ $(call gb_Helper_abbreviate_dirs,\ -MM -MP -MT $(call gb_SrsPartTarget_get_target,$(1)) \ $(INCLUDE) \ $(DEFS) \ + -D__RSC \ -c -x c++-header $(2) \ -o $(call gb_SrsPartTarget_get_dep_target,$(1))) endef diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk index 1f3caec82141..3a04f54a741f 100644 --- a/solenv/gbuild/platform/com_MSC_class.mk +++ b/solenv/gbuild/platform/com_MSC_class.mk @@ -461,6 +461,7 @@ $(call gb_Helper_abbreviate_dirs,\ $(call gb_Executable_get_target,makedepend) \ $(INCLUDE) \ $(DEFS) \ + -D__RSC \ $(2) \ -o .src \ -p $(dir $(call gb_SrsPartTarget_get_target,$(1))) \ diff --git a/svtools/source/dialogs/so3res.src b/svtools/source/dialogs/so3res.src index 3ffd4cb482f7..f76a19ebb823 100644 --- a/svtools/source/dialogs/so3res.src +++ b/svtools/source/dialogs/so3res.src @@ -18,8 +18,8 @@ */ #include "svtools/sores.hxx" -#define __RSC #include <svtools/soerr.hxx> + #define S_MAX 0x7fff StringArray RID_SO_ERROR_HANDLER diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src index 0c5f2ad0d77d..6e0fd3bcbf3b 100644 --- a/svtools/source/misc/ehdl.src +++ b/svtools/source/misc/ehdl.src @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC #include <svtools/svtools.hrc> #include <svtools/sfxecode.hxx> diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index b3056b31bd8f..5496a6739fcf 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -18,8 +18,6 @@ */ #include <svtools/svtools.hrc> - -#define RSC_RESOURCE_USAGE 1 #include <i18nlangtag/lang.h> #define PairedList ItemList diff --git a/svx/source/dialog/txenctab.src b/svx/source/dialog/txenctab.src index 56add1e071d8..63e3fa92ca72 100644 --- a/svx/source/dialog/txenctab.src +++ b/svx/source/dialog/txenctab.src @@ -18,9 +18,8 @@ */ #include <svx/dialogs.hrc> - -#define _SOLAR_RSC_INVOKED #include <rtl/textenc.h> + #define PairedList ItemList // Encodings for which no conversion exist yet are commented out. diff --git a/svx/source/items/svxerr.src b/svx/source/items/svxerr.src index c3adc42f5d14..614694f6e028 100644 --- a/svx/source/items/svxerr.src +++ b/svx/source/items/svxerr.src @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC #include "svx/svxerr.hxx" #include <svx/dialogs.hrc> #include <editeng/editerr.hxx> diff --git a/svx/source/src/errtxt.src b/svx/source/src/errtxt.src index bf606cd81437..ff1e91fbbdd2 100644 --- a/svx/source/src/errtxt.src +++ b/svx/source/src/errtxt.src @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC #include <svtools/svtools.hrc> #include <svtools/sfxecode.hxx> diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src index a76bed60d6c6..bca00c9503dc 100644 --- a/sw/source/ui/app/error.src +++ b/sw/source/ui/app/error.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "globals.hrc" #include "app.hrc" #include "swerror.h" diff --git a/uui/source/alreadyopen.src b/uui/source/alreadyopen.src index 876db49a0f6d..6bcca248d9ef 100644 --- a/uui/source/alreadyopen.src +++ b/uui/source/alreadyopen.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_ALREADYOPEN_TITLE diff --git a/uui/source/filechanged.src b/uui/source/filechanged.src index 4d7e92ca5133..ebc37bf72dd6 100644 --- a/uui/source/filechanged.src +++ b/uui/source/filechanged.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_FILECHANGED_TITLE diff --git a/uui/source/ids.src b/uui/source/ids.src index f775a4c8f013..82f5191b19c1 100644 --- a/uui/source/ids.src +++ b/uui/source/ids.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String RID_KEEP_PASSWORD diff --git a/uui/source/lockfailed.src b/uui/source/lockfailed.src index 2384e43e0ed7..91b5bff7f559 100644 --- a/uui/source/lockfailed.src +++ b/uui/source/lockfailed.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_LOCKFAILED_TITLE diff --git a/uui/source/nameclashdlg.src b/uui/source/nameclashdlg.src index b608123c1d53..615b83adc996 100644 --- a/uui/source/nameclashdlg.src +++ b/uui/source/nameclashdlg.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_RENAME_OR_REPLACE diff --git a/uui/source/openlocked.src b/uui/source/openlocked.src index 8aee0a643bf9..2e30dbf646b5 100644 --- a/uui/source/openlocked.src +++ b/uui/source/openlocked.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_OPENLOCKED_TITLE diff --git a/uui/source/passworddlg.src b/uui/source/passworddlg.src index 28379a36de06..93d3d5ee18b0 100644 --- a/uui/source/passworddlg.src +++ b/uui/source/passworddlg.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_ENTER_PASSWORD_TO_OPEN diff --git a/uui/source/passworderrs.src b/uui/source/passworderrs.src index 65b7eacabcc2..ae92de07e717 100644 --- a/uui/source/passworderrs.src +++ b/uui/source/passworderrs.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_ERROR_PASSWORD_TO_OPEN_WRONG diff --git a/uui/source/trylater.src b/uui/source/trylater.src index 4459c1530c74..0b02b391bb6e 100644 --- a/uui/source/trylater.src +++ b/uui/source/trylater.src @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define __RSC - #include "ids.hrc" String STR_TRYLATER_TITLE |