1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_codemaker.hxx"
30*cdf0e10cSrcweir #include "sal/config.h"
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include "codemaker/commoncpp.hxx"
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include "codemaker/options.hxx"
35*cdf0e10cSrcweir #include "codemaker/typemanager.hxx"
36*cdf0e10cSrcweir #include "codemaker/unotype.hxx"
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include "osl/diagnose.h"
39*cdf0e10cSrcweir #include "registry/reader.hxx"
40*cdf0e10cSrcweir #include "registry/types.h"
41*cdf0e10cSrcweir #include "rtl/strbuf.hxx"
42*cdf0e10cSrcweir #include "rtl/string.hxx"
43*cdf0e10cSrcweir #include "rtl/ustring.hxx"
44*cdf0e10cSrcweir #include "sal/types.h"
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #include <vector>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir namespace codemaker { namespace cpp {
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir rtl::OString typeToPrefix(TypeManager const & manager, rtl::OString const & type)
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir     RTTypeClass typeclass = manager.getTypeClass(type);
53*cdf0e10cSrcweir     if (typeclass == RT_TYPE_INVALID ||
54*cdf0e10cSrcweir         typeclass == RT_TYPE_PUBLISHED)
55*cdf0e10cSrcweir         return rtl::OString("_");
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     static char const * const typeclassPrefix[RT_TYPE_UNION + 1] = {
58*cdf0e10cSrcweir         "invalid",    /* RT_TYPE_INVALID, is here only as placeholder */
59*cdf0e10cSrcweir         "interface",  /* RT_TYPE_INTERFACE */
60*cdf0e10cSrcweir         "module",     /* RT_TYPE_MODULE */
61*cdf0e10cSrcweir         "struct",     /* RT_TYPE_STRUCT */
62*cdf0e10cSrcweir         "enum",       /* RT_TYPE_ENUM */
63*cdf0e10cSrcweir         "exception",  /* RT_TYPE_EXCEPTION */
64*cdf0e10cSrcweir         "typedef",    /* RT_TYPE_TYPEDEF */
65*cdf0e10cSrcweir         "service",    /* RT_TYPE_SERVICE */
66*cdf0e10cSrcweir         "singleton",  /* RT_TYPE_SINGLETON */
67*cdf0e10cSrcweir         "object",     /* RT_TYPE_OBJECT */
68*cdf0e10cSrcweir         "constants",  /* RT_TYPE_CONSTANTS */
69*cdf0e10cSrcweir         "union"       /* RT_TYPE_UNION */
70*cdf0e10cSrcweir     };
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir     return rtl::OString(typeclassPrefix[typeclass]);
73*cdf0e10cSrcweir }
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir rtl::OString scopedCppName(rtl::OString const & type, bool bNoNameSpace,
76*cdf0e10cSrcweir                            bool shortname)
77*cdf0e10cSrcweir {
78*cdf0e10cSrcweir     char c('/');
79*cdf0e10cSrcweir     sal_Int32 nPos = type.lastIndexOf( c );
80*cdf0e10cSrcweir 	if (nPos == -1) {
81*cdf0e10cSrcweir         nPos = type.lastIndexOf( '.' );
82*cdf0e10cSrcweir         if (nPos == -1)
83*cdf0e10cSrcweir             return type;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir         c = '.';
86*cdf0e10cSrcweir     }
87*cdf0e10cSrcweir 	if (bNoNameSpace)
88*cdf0e10cSrcweir 		return type.copy(nPos+1);
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	rtl::OStringBuffer tmpBuf(type.getLength()*2);
91*cdf0e10cSrcweir     nPos = 0;
92*cdf0e10cSrcweir     do
93*cdf0e10cSrcweir 	{
94*cdf0e10cSrcweir 		tmpBuf.append("::");
95*cdf0e10cSrcweir 		tmpBuf.append(type.getToken(0, c, nPos));
96*cdf0e10cSrcweir 	} while( nPos != -1 );
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     if (shortname) {
99*cdf0e10cSrcweir         rtl::OString s(tmpBuf.makeStringAndClear());
100*cdf0e10cSrcweir         if (s.indexOf("::com::sun::star") == 0)
101*cdf0e10cSrcweir             return s.replaceAt(0, 16, "css");
102*cdf0e10cSrcweir 		else
103*cdf0e10cSrcweir 			return s;
104*cdf0e10cSrcweir     }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 	return tmpBuf.makeStringAndClear();
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir rtl::OString translateUnoToCppType(
111*cdf0e10cSrcweir     codemaker::UnoType::Sort sort, RTTypeClass typeClass,
112*cdf0e10cSrcweir     rtl::OString const & nucleus, bool shortname)
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir     rtl::OStringBuffer buf;
115*cdf0e10cSrcweir     if (sort == codemaker::UnoType::SORT_COMPLEX) {
116*cdf0e10cSrcweir         if (typeClass == RT_TYPE_INTERFACE
117*cdf0e10cSrcweir             && nucleus == rtl::OString("com/sun/star/uno/XInterface"))
118*cdf0e10cSrcweir         {
119*cdf0e10cSrcweir             buf.append(RTL_CONSTASCII_STRINGPARAM("::com::sun::star::uno::XInterface"));
120*cdf0e10cSrcweir         } else {
121*cdf0e10cSrcweir             //TODO: check that nucleus is a valid (UTF-8) identifier
122*cdf0e10cSrcweir             buf.append(nucleus);
123*cdf0e10cSrcweir         }
124*cdf0e10cSrcweir     } else {
125*cdf0e10cSrcweir         static char const * const cppTypes[codemaker::UnoType::SORT_ANY + 1] = {
126*cdf0e10cSrcweir             "void", "::sal_Bool", "::sal_Int8", "::sal_Int16", "::sal_uInt16",
127*cdf0e10cSrcweir             "::sal_Int32", "::sal_uInt32", "::sal_Int64", "::sal_uInt64",
128*cdf0e10cSrcweir             "float", "double", "::sal_Unicode", "::rtl::OUString",
129*cdf0e10cSrcweir             "::com::sun::star::uno::Type", "::com::sun::star::uno::Any" };
130*cdf0e10cSrcweir         buf.append(cppTypes[sort]);
131*cdf0e10cSrcweir     }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir     if (shortname) {
134*cdf0e10cSrcweir         rtl::OString s(buf.makeStringAndClear());
135*cdf0e10cSrcweir         if (s.indexOf("::com::sun::star") == 0)
136*cdf0e10cSrcweir             return s.replaceAt(0, 16, "css");
137*cdf0e10cSrcweir 		else
138*cdf0e10cSrcweir 			return s;
139*cdf0e10cSrcweir     }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir     return buf.makeStringAndClear();
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir rtl::OString translateUnoToCppIdentifier(
145*cdf0e10cSrcweir     rtl::OString const & unoIdentifier, rtl::OString const & prefix,
146*cdf0e10cSrcweir     IdentifierTranslationMode transmode, rtl::OString const * forbidden)
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir     if (// Keywords:
149*cdf0e10cSrcweir         unoIdentifier == "asm"
150*cdf0e10cSrcweir         || unoIdentifier == "auto"
151*cdf0e10cSrcweir         || unoIdentifier == "bool"
152*cdf0e10cSrcweir         || unoIdentifier == "break"
153*cdf0e10cSrcweir         || unoIdentifier == "case"
154*cdf0e10cSrcweir         || unoIdentifier == "catch"
155*cdf0e10cSrcweir         || unoIdentifier == "char"
156*cdf0e10cSrcweir         || unoIdentifier == "class"
157*cdf0e10cSrcweir         || unoIdentifier == "const"
158*cdf0e10cSrcweir         /* unoIdentifier == "const_cast" */
159*cdf0e10cSrcweir         || unoIdentifier == "continue"
160*cdf0e10cSrcweir         || unoIdentifier == "default"
161*cdf0e10cSrcweir         || unoIdentifier == "delete"
162*cdf0e10cSrcweir         || unoIdentifier == "do"
163*cdf0e10cSrcweir         || unoIdentifier == "double"
164*cdf0e10cSrcweir         /* unoIdentifier == "dynamic_cast" */
165*cdf0e10cSrcweir         || unoIdentifier == "else"
166*cdf0e10cSrcweir         || unoIdentifier == "enum"
167*cdf0e10cSrcweir         || unoIdentifier == "explicit"
168*cdf0e10cSrcweir         || unoIdentifier == "export"
169*cdf0e10cSrcweir         || unoIdentifier == "extern"
170*cdf0e10cSrcweir         || unoIdentifier == "false"
171*cdf0e10cSrcweir         || unoIdentifier == "float"
172*cdf0e10cSrcweir         || unoIdentifier == "for"
173*cdf0e10cSrcweir         || unoIdentifier == "friend"
174*cdf0e10cSrcweir         || unoIdentifier == "goto"
175*cdf0e10cSrcweir         || unoIdentifier == "if"
176*cdf0e10cSrcweir         || unoIdentifier == "inline"
177*cdf0e10cSrcweir         || unoIdentifier == "int"
178*cdf0e10cSrcweir         || unoIdentifier == "long"
179*cdf0e10cSrcweir         || unoIdentifier == "mutable"
180*cdf0e10cSrcweir         || unoIdentifier == "namespace"
181*cdf0e10cSrcweir         || unoIdentifier == "new"
182*cdf0e10cSrcweir         || unoIdentifier == "operator"
183*cdf0e10cSrcweir         || unoIdentifier == "private"
184*cdf0e10cSrcweir         || unoIdentifier == "protected"
185*cdf0e10cSrcweir         || unoIdentifier == "public"
186*cdf0e10cSrcweir         || unoIdentifier == "register"
187*cdf0e10cSrcweir         /* unoIdentifier == "reinterpret_cast" */
188*cdf0e10cSrcweir         || unoIdentifier == "return"
189*cdf0e10cSrcweir         || unoIdentifier == "short"
190*cdf0e10cSrcweir         || unoIdentifier == "signed"
191*cdf0e10cSrcweir         || unoIdentifier == "sizeof"
192*cdf0e10cSrcweir         || unoIdentifier == "static"
193*cdf0e10cSrcweir         /* unoIdentifier == "static_cast" */
194*cdf0e10cSrcweir         || unoIdentifier == "struct"
195*cdf0e10cSrcweir         || unoIdentifier == "switch"
196*cdf0e10cSrcweir         || unoIdentifier == "template"
197*cdf0e10cSrcweir         || unoIdentifier == "this"
198*cdf0e10cSrcweir         || unoIdentifier == "throw"
199*cdf0e10cSrcweir         || unoIdentifier == "true"
200*cdf0e10cSrcweir         || unoIdentifier == "try"
201*cdf0e10cSrcweir         || unoIdentifier == "typedef"
202*cdf0e10cSrcweir         || unoIdentifier == "typeid"
203*cdf0e10cSrcweir         || unoIdentifier == "typename"
204*cdf0e10cSrcweir         || unoIdentifier == "union"
205*cdf0e10cSrcweir         || unoIdentifier == "unsigned"
206*cdf0e10cSrcweir         || unoIdentifier == "using"
207*cdf0e10cSrcweir         || unoIdentifier == "virtual"
208*cdf0e10cSrcweir         || unoIdentifier == "void"
209*cdf0e10cSrcweir         || unoIdentifier == "volatile"
210*cdf0e10cSrcweir         /* unoIdentifier == "wchar_t" */
211*cdf0e10cSrcweir         || unoIdentifier == "while"
212*cdf0e10cSrcweir         // Alternative representations:
213*cdf0e10cSrcweir         || unoIdentifier == "and"
214*cdf0e10cSrcweir         /* unoIdentifier == "and_eq" */
215*cdf0e10cSrcweir         || unoIdentifier == "bitand"
216*cdf0e10cSrcweir         || unoIdentifier == "bitor"
217*cdf0e10cSrcweir         || unoIdentifier == "compl"
218*cdf0e10cSrcweir         || unoIdentifier == "not"
219*cdf0e10cSrcweir         /* unoIdentifier == "not_eq" */
220*cdf0e10cSrcweir         || unoIdentifier == "or"
221*cdf0e10cSrcweir         /* unoIdentifier == "or_eq" */
222*cdf0e10cSrcweir         || unoIdentifier == "xor"
223*cdf0e10cSrcweir         /* unoIdentifier == "xor_eq" */
224*cdf0e10cSrcweir         // Standard macros:
225*cdf0e10cSrcweir         || (transmode != ITM_KEYWORDSONLY
226*cdf0e10cSrcweir             && (unoIdentifier == "BUFSIZ"
227*cdf0e10cSrcweir                 || unoIdentifier == "CLOCKS_PER_SEC"
228*cdf0e10cSrcweir                 || unoIdentifier == "EDOM"
229*cdf0e10cSrcweir                 || unoIdentifier == "EOF"
230*cdf0e10cSrcweir                 || unoIdentifier == "ERANGE"
231*cdf0e10cSrcweir                 || unoIdentifier == "EXIT_FAILURE"
232*cdf0e10cSrcweir                 || unoIdentifier == "EXIT_SUCCESS"
233*cdf0e10cSrcweir                 || unoIdentifier == "FILENAME_MAX"
234*cdf0e10cSrcweir                 || unoIdentifier == "FOPEN_MAX"
235*cdf0e10cSrcweir                 || unoIdentifier == "HUGE_VAL"
236*cdf0e10cSrcweir                 || unoIdentifier == "LC_ALL"
237*cdf0e10cSrcweir                 || unoIdentifier == "LC_COLLATE"
238*cdf0e10cSrcweir                 || unoIdentifier == "LC_CTYPE"
239*cdf0e10cSrcweir                 || unoIdentifier == "LC_MONETARY"
240*cdf0e10cSrcweir                 || unoIdentifier == "LC_NUMERIC"
241*cdf0e10cSrcweir                 || unoIdentifier == "LC_TIME"
242*cdf0e10cSrcweir                 || unoIdentifier == "L_tmpnam"
243*cdf0e10cSrcweir                 || unoIdentifier == "MB_CUR_MAX"
244*cdf0e10cSrcweir                 || unoIdentifier == "NULL"
245*cdf0e10cSrcweir                 || unoIdentifier == "RAND_MAX"
246*cdf0e10cSrcweir                 || unoIdentifier == "SEEK_CUR"
247*cdf0e10cSrcweir                 || unoIdentifier == "SEEK_END"
248*cdf0e10cSrcweir                 || unoIdentifier == "SEEK_SET"
249*cdf0e10cSrcweir                 || unoIdentifier == "SIGABRT"
250*cdf0e10cSrcweir                 || unoIdentifier == "SIGFPE"
251*cdf0e10cSrcweir                 || unoIdentifier == "SIGILL"
252*cdf0e10cSrcweir                 || unoIdentifier == "SIGINT"
253*cdf0e10cSrcweir                 || unoIdentifier == "SIGSEGV"
254*cdf0e10cSrcweir                 || unoIdentifier == "SIGTERM"
255*cdf0e10cSrcweir                 || unoIdentifier == "SIG_DFL"
256*cdf0e10cSrcweir                 || unoIdentifier == "SIG_ERR"
257*cdf0e10cSrcweir                 || unoIdentifier == "SIG_IGN"
258*cdf0e10cSrcweir                 || unoIdentifier == "TMP_MAX"
259*cdf0e10cSrcweir                 || unoIdentifier == "WCHAR_MAX"
260*cdf0e10cSrcweir                 || unoIdentifier == "WCHAR_MIN"
261*cdf0e10cSrcweir                 || unoIdentifier == "WEOF"
262*cdf0e10cSrcweir                 /* unoIdentifier == "_IOFBF" */
263*cdf0e10cSrcweir                 /* unoIdentifier == "_IOLBF" */
264*cdf0e10cSrcweir                 /* unoIdentifier == "_IONBF" */
265*cdf0e10cSrcweir                 || unoIdentifier == "assert"
266*cdf0e10cSrcweir                 || unoIdentifier == "errno"
267*cdf0e10cSrcweir                 || unoIdentifier == "offsetof"
268*cdf0e10cSrcweir                 || unoIdentifier == "setjmp"
269*cdf0e10cSrcweir                 || unoIdentifier == "stderr"
270*cdf0e10cSrcweir                 || unoIdentifier == "stdin"
271*cdf0e10cSrcweir                 || unoIdentifier == "stdout"
272*cdf0e10cSrcweir                 /* unoIdentifier == "va_arg" */
273*cdf0e10cSrcweir                 /* unoIdentifier == "va_end" */
274*cdf0e10cSrcweir                 /* unoIdentifier == "va_start" */
275*cdf0e10cSrcweir                 // Standard values:
276*cdf0e10cSrcweir                 || unoIdentifier == "CHAR_BIT"
277*cdf0e10cSrcweir                 || unoIdentifier == "CHAR_MAX"
278*cdf0e10cSrcweir                 || unoIdentifier == "CHAR_MIN"
279*cdf0e10cSrcweir                 || unoIdentifier == "DBL_DIG"
280*cdf0e10cSrcweir                 || unoIdentifier == "DBL_EPSILON"
281*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MANT_DIG"
282*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MAX"
283*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MAX_10_EXP"
284*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MAX_EXP"
285*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MIN"
286*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MIN_10_EXP"
287*cdf0e10cSrcweir                 || unoIdentifier == "DBL_MIN_EXP"
288*cdf0e10cSrcweir                 || unoIdentifier == "FLT_DIG"
289*cdf0e10cSrcweir                 || unoIdentifier == "FLT_EPSILON"
290*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MANT_DIG"
291*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MAX"
292*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MAX_10_EXP"
293*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MAX_EXP"
294*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MIN"
295*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MIN_10_EXP"
296*cdf0e10cSrcweir                 || unoIdentifier == "FLT_MIN_EXP"
297*cdf0e10cSrcweir                 || unoIdentifier == "FLT_RADIX"
298*cdf0e10cSrcweir                 || unoIdentifier == "FLT_ROUNDS"
299*cdf0e10cSrcweir                 || unoIdentifier == "INT_MAX"
300*cdf0e10cSrcweir                 || unoIdentifier == "INT_MIN"
301*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_DIG"
302*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_EPSILON"
303*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MANT_DIG"
304*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MAX"
305*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MAX_10_EXP"
306*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MAX_EXP"
307*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MIN"
308*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MIN_10_EXP"
309*cdf0e10cSrcweir                 || unoIdentifier == "LDBL_MIN_EXP"
310*cdf0e10cSrcweir                 || unoIdentifier == "LONG_MAX"
311*cdf0e10cSrcweir                 || unoIdentifier == "LONG_MIN"
312*cdf0e10cSrcweir                 || unoIdentifier == "MB_LEN_MAX"
313*cdf0e10cSrcweir                 || unoIdentifier == "SCHAR_MAX"
314*cdf0e10cSrcweir                 || unoIdentifier == "SCHAR_MIN"
315*cdf0e10cSrcweir                 || unoIdentifier == "SHRT_MAX"
316*cdf0e10cSrcweir                 || unoIdentifier == "SHRT_MIN"
317*cdf0e10cSrcweir                 || unoIdentifier == "UCHAR_MAX"
318*cdf0e10cSrcweir                 || unoIdentifier == "UINT_MAX"
319*cdf0e10cSrcweir                 || unoIdentifier == "ULONG_MAX"
320*cdf0e10cSrcweir                 || unoIdentifier == "USHRT_MAX"))
321*cdf0e10cSrcweir             || (transmode == ITM_GLOBAL
322*cdf0e10cSrcweir                 && (// Standard types:
323*cdf0e10cSrcweir                     /* unoIdentifier == "clock_t" */
324*cdf0e10cSrcweir                     /* unoIdentifier == "div_t" */
325*cdf0e10cSrcweir                     unoIdentifier == "FILE"
326*cdf0e10cSrcweir                     /* unoIdentifier == "fpos_t" */
327*cdf0e10cSrcweir                     /* unoIdentifier == "jmp_buf" */
328*cdf0e10cSrcweir                     || unoIdentifier == "lconv"
329*cdf0e10cSrcweir                     /* unoIdentifier == "ldiv_t" */
330*cdf0e10cSrcweir                     /* unoIdentifier == "mbstate_t" */
331*cdf0e10cSrcweir                     /* unoIdentifier == "ptrdiff_t" */
332*cdf0e10cSrcweir                     /* unoIdentifier == "sig_atomic_t" */
333*cdf0e10cSrcweir                     /* unoIdentifier == "size_t" */
334*cdf0e10cSrcweir                     /* unoIdentifier == "time_t" */
335*cdf0e10cSrcweir                     || unoIdentifier == "tm"
336*cdf0e10cSrcweir                     /* unoIdentifier == "va_list" */
337*cdf0e10cSrcweir                     /* unoIdentifier == "wctrans_t" */
338*cdf0e10cSrcweir                     /* unoIdentifier == "wctype_t" */
339*cdf0e10cSrcweir                     /* unoIdentifier == "wint_t" */
340*cdf0e10cSrcweir                     // Standard namespaces:
341*cdf0e10cSrcweir                     || unoIdentifier == "std"))
342*cdf0e10cSrcweir             // Others:
343*cdf0e10cSrcweir             || unoIdentifier == "NDEBUG"
344*cdf0e10cSrcweir             || (forbidden != 0 && unoIdentifier == *forbidden) )
345*cdf0e10cSrcweir     {
346*cdf0e10cSrcweir         rtl::OStringBuffer buf(prefix);
347*cdf0e10cSrcweir         buf.append('_');
348*cdf0e10cSrcweir         buf.append(unoIdentifier);
349*cdf0e10cSrcweir         return buf.makeStringAndClear();
350*cdf0e10cSrcweir     } else {
351*cdf0e10cSrcweir         return unoIdentifier;
352*cdf0e10cSrcweir     }
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir } }
356