Source Code Cross Referenced for TraceModelBase.java in  » IDE-Netbeans » cnd » org » netbeans » modules » cnd » modelimpl » trace » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » cnd » org.netbeans.modules.cnd.modelimpl.trace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * Portions Copyrighted 2007 Sun Microsystems, Inc.
016:         */
017:        package org.netbeans.modules.cnd.modelimpl.trace;
018:
019:        import java.io.File;
020:        import java.util.*;
021:        import java.util.Collections;
022:        import java.util.List;
023:        import java.util.logging.Level;
024:        import java.util.logging.Logger;
025:        import org.netbeans.modules.cnd.api.model.CsmFile;
026:        import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
027:        import org.netbeans.modules.cnd.api.model.CsmProject;
028:        import org.netbeans.modules.cnd.api.model.CsmUID;
029:        import org.netbeans.modules.cnd.api.project.NativeFileItem;
030:        import org.netbeans.modules.cnd.api.project.NativeProject;
031:        import org.netbeans.modules.cnd.modelimpl.csm.core.FileImpl;
032:        import org.netbeans.modules.cnd.modelimpl.csm.core.ModelImpl;
033:        import org.netbeans.modules.cnd.modelimpl.csm.core.ProjectBase;
034:        import org.netbeans.modules.cnd.modelimpl.repository.RepositoryUtils;
035:        import org.openide.filesystems.FileObject;
036:        import org.openide.filesystems.FileUtil;
037:        import org.openide.loaders.DataObject;
038:        import org.openide.loaders.DataObjectNotFoundException;
039:        import org.openide.util.Exceptions;
040:        import org.openide.util.Utilities;
041:
042:        /**
043:         * A class that is able to
044:         * - create CsmModel
045:         * - create NativeProject and CsmProject
046:         *   according to parameters (file names, -I and -D options)
047:         * @author Vladimir Kvashin
048:         */
049:        public class TraceModelBase {
050:
051:            private boolean useCSysIncludes = Boolean
052:                    .getBoolean("cnd.modelimpl.c.include");
053:            private boolean useCSysDefines = Boolean
054:                    .getBoolean("cnd.modelimpl.c.define");
055:            private boolean useCppSysIncludes = Boolean
056:                    .getBoolean("cnd.modelimpl.cpp.include");
057:            private boolean useCppSysDefines = Boolean
058:                    .getBoolean("cnd.modelimpl.cpp.define");
059:
060:            private ModelImpl model;
061:
062:            // only one of project/projectUID must be used 
063:            private ProjectBase project;
064:            private CsmUID<CsmProject> projectUID;
065:
066:            private List<String> quoteIncludePaths = new ArrayList<String>();
067:            private List<String> systemIncludePaths = new ArrayList<String>();
068:            private List<File> files = new ArrayList<File>();
069:            private List<String> currentIncludePaths = null;
070:
071:            private List<String> macros = new ArrayList<String>();
072:
073:            // if true, then relative include paths oin -I option are considered
074:            // to be based on the file that we currently compile rather then current dir
075:            private boolean pathsRelCurFile = false;
076:
077:            public TraceModelBase() {
078:                Logger openideLogger = Logger.getLogger("org.openide.loaders");
079:                // reduce log level to prevent unnecessary messages in tests
080:                openideLogger.setLevel(Level.SEVERE);
081:                RepositoryUtils.cleanCashes();
082:                model = (ModelImpl) CsmModelAccessor.getModel(); // new ModelImpl(true);
083:                if (model == null) {
084:                    model = new ModelImpl();
085:                }
086:                model.startup();
087:                currentIncludePaths = quoteIncludePaths;
088:            }
089:
090:            protected final void setIncludePaths(List<String> sysIncludes,
091:                    List<String> usrIncludes) {
092:                this .quoteIncludePaths = usrIncludes;
093:                this .systemIncludePaths = sysIncludes;
094:                this .currentIncludePaths = this .quoteIncludePaths;
095:            }
096:
097:            protected final void shutdown() {
098:                model.shutdown();
099:                RepositoryUtils.cleanCashes();
100:            }
101:
102:            public void processArguments(final String... args) {
103:                for (int i = 0; i < args.length; i++) {
104:                    if (args[i].startsWith("--")) { // NOI18N
105:                        // NOI18N
106:                        processFlag(args[i].substring(2));
107:                    } else if (args[i].startsWith("-")) { // NOI18N
108:                        // NOI18N
109:                        for (int charIdx = 1; charIdx < args[i].length(); charIdx++) {
110:                            ProcessFlagResult res = processFlag(args[i]
111:                                    .charAt(charIdx), args[i]
112:                                    .substring(charIdx + 1));
113:                            if (res == ProcessFlagResult.ALL_PROCESSED) {
114:                                break;
115:                            }
116:                        }
117:                    } else {
118:                        addFile(files, new File(args[i]));
119:                    }
120:                }
121:            }
122:
123:            protected enum ProcessFlagResult {
124:                NONE_PROCESSED, CHAR_PROCESSED, ALL_PROCESSED
125:            }
126:
127:            protected ProcessFlagResult processFlag(char flag, String argRest) {
128:                // it's easier to set the most "popular" return value here and NONE_... in default case
129:                ProcessFlagResult result = ProcessFlagResult.CHAR_PROCESSED;
130:                switch (flag) {
131:                // TODO: support not only "-Idir" but "-I dir" as well
132:                // TODO: support -iquote. Now I disabled this since the contract reads:
133:                // -iquote<dir> Add the directory dir to the head of the list of directories to be searched for header files
134:                // ONLY for the case of #include "file"; they are NOT searched for #include <file>
135:                case 'I':
136:                    if (argRest.length() > 0) {
137:                        if (argRest.charAt(0) == '-') {
138:                            // switch following include paths destination list
139:                            currentIncludePaths = (currentIncludePaths == quoteIncludePaths) ? systemIncludePaths
140:                                    : quoteIncludePaths;
141:                            argRest = argRest.substring(1);
142:                        }
143:                        String includePath = argRest;
144:                        currentIncludePaths.add(includePath);
145:                        result = ProcessFlagResult.ALL_PROCESSED;
146:                    }
147:                    break;
148:                case 'D':
149:                    macros.add(argRest);
150:                    result = ProcessFlagResult.ALL_PROCESSED;
151:                    break;
152:                default:
153:                    result = ProcessFlagResult.NONE_PROCESSED;
154:                }
155:                return result;
156:            }
157:
158:            /** 
159:             * Processes a string flag
160:             * @return true if the flag has been recognised and processed,
161:             * otherwise false
162:             */
163:            protected boolean processFlag(String flag) {
164:                if ("relpath".equals(flag)) { // NOI18N
165:                    // NOI18N
166:                    pathsRelCurFile = true;
167:                    return true;
168:                }
169:                return false;
170:            }
171:
172:            private void addFile(List<File> files, File file) {
173:                if (file.isDirectory()) {
174:                    String[] list = file.list();
175:                    for (int i = 0; i < list.length; i++) {
176:                        addFile(files, new File(file, list[i]));
177:                    }
178:                } else {
179:                    files.add(file);
180:                }
181:            }
182:
183:            public ProjectBase getProject() {
184:                synchronized (this ) {
185:                    if (projectUID == null) {
186:                        projectUID = createProject().getUID();
187:                    }
188:                }
189:                return (projectUID == null) ? null : (ProjectBase) projectUID
190:                        .getObject();
191:            }
192:
193:            public static void closeProject(CsmProject project) {
194:                closeProject(project, false);
195:            }
196:
197:            public static void closeProject(CsmProject project,
198:                    boolean cleanRepository) {
199:                Object platformProject = project.getPlatformProject();
200:                ((ModelImpl) CsmModelAccessor.getModel()).closeProject(
201:                        platformProject, cleanRepository);
202:            }
203:
204:            public void resetProject() {
205:                resetProject(false);
206:            }
207:
208:            public void resetProject(boolean cleanRepository) {
209:                ProjectBase aProject = getProject();
210:                if (aProject != null) {
211:                    closeProject(aProject, cleanRepository);
212:                }
213:                projectUID = null;
214:                project = null;
215:                //getProject();
216:            }
217:
218:            private ProjectBase createProject() {
219:                NativeProject nativeProject = NativeProjectProvider
220:                        .createProject("DummyProject",
221:                                files, // NOI18N
222:                                getSystemIncludes(), quoteIncludePaths,
223:                                getSysMacros(), macros, pathsRelCurFile);
224:                ProjectBase result = model.addProject(nativeProject,
225:                        "DummyProject", true); // NOI18N
226:                return result;
227:            }
228:
229:            protected List<String> getSystemIncludes() {
230:                Set<String> all = new HashSet<String>(systemIncludePaths);
231:                if (useCppSysIncludes) {
232:                    // add generated by gcc 3.3.4 on SuSe 9.2
233:                    // #gcc -x c++ -v -E - < /dev/null
234:                    if ((Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0) {
235:                        all
236:                                .add("/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3"); // NOI18N
237:                        all
238:                                .add("/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/i386-pc-solaris2.10"); // NOI18N
239:                        all
240:                                .add("/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../include/c++/3.4.3/backward"); // NOI18N
241:                        all.add("/usr/local/include"); // NOI18N
242:                        all.add("/usr/sfw/include"); // NOI18N
243:                        all
244:                                .add("/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/include"); // NOI18N
245:                        all.add("/usr/include"); // NOI18N
246:                    } else {
247:                        all.add("/usr/include/g++"); // NOI18N
248:                        all.add("/usr/include/g++/i586-suse-linux"); // NOI18N
249:                        all.add("/usr/include/g++/backward"); // NOI18N
250:                        all.add("/usr/local/include"); // NOI18N
251:                        all
252:                                .add("/usr/lib/gcc-lib/i586-suse-linux/3.3.4/include"); // NOI18N
253:                        all.add("/usr/i586-suse-linux/include"); // NOI18N
254:                        all.add("/usr/include"); // NOI18N
255:                    }
256:                } else if (useCSysIncludes) {
257:                    // add generated by gcc 3.3.4 on SuSe 9.2
258:                    // #gcc -x c -v -E - < /dev/null
259:                    all.add("/usr/local/include"); // NOI18N
260:                    all.add("/usr/lib/gcc-lib/i586-suse-linux/3.3.4/include"); // NOI18N
261:                    all.add("/usr/i586-suse-linux/include"); // NOI18N
262:                    all.add("/usr/include"); // NOI18N
263:                }
264:                return new ArrayList<String>(all);
265:            }
266:
267:            protected List<String> getSysMacros() {
268:                Set<String> all = new HashSet<String>();
269:                if (useCppSysDefines) {
270:                    if ((Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0) {
271:                        // Solaris 10, amd x86
272:                        // gcc -x c++ -dM -E /dev/null | awk '{print "all.add(\"" $2 "=" $3 $4 $5 $6 $7 "\");" }'
273:                        all.add("__DBL_MIN_EXP__=(-1021)"); // NOI18N
274:                        all.add("__EXTENSIONS__=1"); // NOI18N
275:                        all.add("__FLT_MIN__=1.17549435e-38F"); // NOI18N
276:                        all.add("__CHAR_BIT__=8"); // NOI18N
277:                        all.add("_XOPEN_SOURCE=500"); // NOI18N
278:                        all.add("__WCHAR_MAX__=2147483647"); // NOI18N
279:                        all.add("__DBL_DENORM_MIN__=4.9406564584124654e-324"); // NOI18N
280:                        all.add("__FLT_EVAL_METHOD__=2"); // NOI18N
281:                        all.add("__DBL_MIN_10_EXP__=(-307)"); // NOI18N
282:                        all.add("__FINITE_MATH_ONLY__=0"); // NOI18N
283:                        all.add("__GNUC_PATCHLEVEL__=3"); // NOI18N
284:                        all.add("__SHRT_MAX__=32767"); // NOI18N
285:                        all.add("__LDBL_MAX__=1.18973149535723176502e+4932L"); // NOI18N
286:                        all.add("__unix=1"); // NOI18N
287:                        all.add("__LDBL_MAX_EXP__=16384"); // NOI18N
288:                        all.add("__SCHAR_MAX__=127"); // NOI18N
289:                        all.add("__USER_LABEL_PREFIX__="); // NOI18N
290:                        all.add("__STDC_HOSTED__=1"); // NOI18N
291:                        all.add("_LARGEFILE64_SOURCE=1"); // NOI18N
292:                        all.add("__LDBL_HAS_INFINITY__=1"); // NOI18N
293:                        all.add("__DBL_DIG__=15"); // NOI18N
294:                        all.add("__FLT_EPSILON__=1.19209290e-7F"); // NOI18N
295:                        all.add("__GXX_WEAK__=1"); // NOI18N
296:                        all.add("__LDBL_MIN__=3.36210314311209350626e-4932L"); // NOI18N
297:                        all.add("__unix__=1"); // NOI18N
298:                        all.add("__DECIMAL_DIG__=21"); // NOI18N
299:                        all.add("_LARGEFILE_SOURCE=1"); // NOI18N
300:                        all.add("__LDBL_HAS_QUIET_NAN__=1"); // NOI18N
301:                        all.add("__GNUC__=3"); // NOI18N
302:                        all.add("__DBL_MAX__=1.7976931348623157e+308"); // NOI18N
303:                        all.add("__DBL_HAS_INFINITY__=1"); // NOI18N
304:                        all.add("__SVR4=1"); // NOI18N
305:                        all.add("__cplusplus=1"); // NOI18N
306:                        all.add("__DEPRECATED=1"); // NOI18N
307:                        all.add("__DBL_MAX_EXP__=1024"); // NOI18N
308:                        all.add("__GNUG__=3"); // NOI18N
309:                        all.add("__LONG_LONG_MAX__=9223372036854775807LL"); // NOI18N
310:                        all.add("__GXX_ABI_VERSION=1002"); // NOI18N
311:                        all.add("__FLT_MIN_EXP__=(-125)"); // NOI18N
312:                        all.add("__DBL_MIN__=2.2250738585072014e-308"); // NOI18N
313:                        all.add("__FLT_MIN_10_EXP__=(-37)"); // NOI18N
314:                        all.add("__DBL_HAS_QUIET_NAN__=1"); // NOI18N
315:                        all.add("__tune_i386__=1"); // NOI18N
316:                        all.add("__sun=1"); // NOI18N
317:                        all.add("__REGISTER_PREFIX__="); // NOI18N
318:                        all.add("__NO_INLINE__=1"); // NOI18N
319:                        all.add("__i386=1"); // NOI18N
320:                        all.add("__FLT_MANT_DIG__=24"); // NOI18N
321:                        all
322:                                .add("__VERSION__=\"3.4.3(csl-sol210-3_4-branch+sol_rpath)\""); // NOI18N
323:                        all.add("i386=1"); // NOI18N
324:                        all.add("sun=1"); // NOI18N
325:                        all.add("unix=1"); // NOI18N
326:                        all.add("__i386__=1"); // NOI18N
327:                        all.add("__SIZE_TYPE__=unsignedint"); // NOI18N
328:                        all.add("__ELF__=1"); // NOI18N
329:                        all.add("__FLT_RADIX__=2"); // NOI18N
330:                        all.add("__LDBL_EPSILON__=1.08420217248550443401e-19L"); // NOI18N
331:                        all.add("__FLT_HAS_QUIET_NAN__=1"); // NOI18N
332:                        all.add("__FLT_MAX_10_EXP__=38"); // NOI18N
333:                        all.add("__LONG_MAX__=2147483647L"); // NOI18N
334:                        all.add("__FLT_HAS_INFINITY__=1"); // NOI18N
335:                        all.add("__PRAGMA_REDEFINE_EXTNAME=1"); // NOI18N
336:                        all.add("__EXCEPTIONS=1"); // NOI18N
337:                        all.add("__LDBL_MANT_DIG__=64"); // NOI18N
338:                        all.add("__WCHAR_TYPE__=longint"); // NOI18N
339:                        all.add("__FLT_DIG__=6"); // NOI18N
340:                        all.add("__INT_MAX__=2147483647"); // NOI18N
341:                        all.add("__FLT_MAX_EXP__=128"); // NOI18N
342:                        all.add("__DBL_MANT_DIG__=53"); // NOI18N
343:                        all.add("__WINT_TYPE__=longint"); // NOI18N
344:                        all.add("__LDBL_MIN_EXP__=(-16381)"); // NOI18N
345:                        all.add("__LDBL_MAX_10_EXP__=4932"); // NOI18N
346:                        all.add("__DBL_EPSILON__=2.2204460492503131e-16"); // NOI18N
347:                        all.add("__sun__=1"); // NOI18N
348:                        all.add("__svr4__=1"); // NOI18N
349:                        all.add("__FLT_DENORM_MIN__=1.40129846e-45F"); // NOI18N
350:                        all.add("__FLT_MAX__=3.40282347e+38F"); // NOI18N
351:                        all.add("__GNUC_MINOR__=4"); // NOI18N
352:                        all.add("__DBL_MAX_10_EXP__=308"); // NOI18N
353:                        all
354:                                .add("__LDBL_DENORM_MIN__=3.64519953188247460253e-4951L"); // NOI18N
355:                        all.add("__PTRDIFF_TYPE__=int"); // NOI18N
356:                        all.add("__LDBL_MIN_10_EXP__=(-4931)"); // NOI18N
357:                        all.add("__LDBL_DIG__=18"); // NOI18N
358:                    } else {
359:                        // add generated by gcc 3.3.4 on SuSe 9.2
360:                        // #gcc -x c++ -dM -E - < /dev/null
361:                        all.add("__CHAR_BIT__=8"); // NOI18N
362:                        all.add("__cplusplus=1"); // NOI18N
363:                        all.add("__DBL_DENORM_MIN__=4.9406564584124654e-324"); // NOI18N
364:                        all.add("__DBL_DIG__=15"); // NOI18N
365:                        all.add("__DBL_EPSILON__=2.2204460492503131e-16"); // NOI18N
366:                        all.add("__DBL_MANT_DIG__=53"); // NOI18N
367:                        all.add("__DBL_MAX_10_EXP__=308"); // NOI18N
368:                        all.add("__DBL_MAX__=1.7976931348623157e+308"); // NOI18N
369:                        all.add("__DBL_MAX_EXP__=1024"); // NOI18N
370:                        all.add("__DBL_MIN_10_EXP__=(-307)"); // NOI18N
371:                        all.add("__DBL_MIN__=2.2250738585072014e-308"); // NOI18N
372:                        all.add("__DBL_MIN_EXP__=(-1021)"); // NOI18N
373:                        all.add("__DECIMAL_DIG__=21"); // NOI18N
374:                        all.add("__DEPRECATED=1"); // NOI18N
375:                        all.add("__ELF__=1"); // NOI18N
376:                        all.add("__EXCEPTIONS=1"); // NOI18N
377:                        all.add("__FINITE_MATH_ONLY__=0"); // NOI18N
378:                        all.add("__FLT_DENORM_MIN__=1.40129846e-45F"); // NOI18N
379:                        all.add("__FLT_DIG__=6"); // NOI18N
380:                        all.add("__FLT_EPSILON__=1.19209290e-7F"); // NOI18N
381:                        all.add("__FLT_EVAL_METHOD__=2"); // NOI18N
382:                        all.add("__FLT_MANT_DIG__=24"); // NOI18N
383:                        all.add("__FLT_MAX_10_EXP__=38"); // NOI18N
384:                        all.add("__FLT_MAX__=3.40282347e+38F"); // NOI18N
385:                        all.add("__FLT_MAX_EXP__=128"); // NOI18N
386:                        all.add("__FLT_MIN_10_EXP__=(-37)"); // NOI18N
387:                        all.add("__FLT_MIN__=1.17549435e-38F"); // NOI18N
388:                        all.add("__FLT_MIN_EXP__=(-125)"); // NOI18N
389:                        all.add("__FLT_RADIX__=2"); // NOI18N
390:                        all.add("__GNUC__=3"); // NOI18N
391:                        all.add("__GNUC_MINOR__=3"); // NOI18N
392:                        all.add("__GNUC_PATCHLEVEL__=4"); // NOI18N
393:                        all.add("__GNUG__=3"); // NOI18N
394:                        all.add("__gnu_linux__=1"); // NOI18N
395:                        all.add("_GNU_SOURCE=1"); // NOI18N
396:                        all.add("__GXX_ABI_VERSION=102"); // NOI18N
397:                        all.add("__GXX_WEAK__=1"); // NOI18N
398:                        all.add("__i386=1"); // NOI18N
399:                        all.add("__i386__=1"); // NOI18N
400:                        all.add("i386=1"); // NOI18N
401:                        all.add("__INT_MAX__=2147483647"); // NOI18N
402:                        all
403:                                .add("__LDBL_DENORM_MIN__=3.64519953188247460253e-4951L"); // NOI18N
404:                        all.add("__LDBL_DIG__=18"); // NOI18N
405:                        all.add("__LDBL_EPSILON__=1.08420217248550443401e-19L"); // NOI18N
406:                        all.add("__LDBL_MANT_DIG__=64"); // NOI18N
407:                        all.add("__LDBL_MAX_10_EXP__=4932"); // NOI18N
408:                        all.add("__LDBL_MAX__=1.18973149535723176502e+4932L"); // NOI18N
409:                        all.add("__LDBL_MAX_EXP__=16384"); // NOI18N
410:                        all.add("__LDBL_MIN_10_EXP__=(-4931)"); // NOI18N
411:                        all.add("__LDBL_MIN__=3.36210314311209350626e-4932L"); // NOI18N
412:                        all.add("__LDBL_MIN_EXP__=(-16381)"); // NOI18N
413:                        all.add("__linux=1"); // NOI18N
414:                        all.add("__linux__=1"); // NOI18N
415:                        all.add("linux=1"); // NOI18N
416:                        all.add("__LONG_LONG_MAX__=9223372036854775807LL"); // NOI18N
417:                        all.add("__LONG_MAX__=2147483647L"); // NOI18N
418:                        all.add("__NO_INLINE__=1"); // NOI18N
419:                        all.add("__PTRDIFF_TYPE__=int"); // NOI18N
420:                        all.add("__REGISTER_PREFIX__"); // NOI18N
421:                        all.add("__SCHAR_MAX__=127"); // NOI18N
422:                        all.add("__SHRT_MAX__=32767"); // NOI18N
423:                        all.add("__SIZE_TYPE__=unsigned int"); // NOI18N
424:                        all.add("__STDC_HOSTED__=1"); // NOI18N
425:                        all.add("__tune_i586__=1"); // NOI18N
426:                        all.add("__tune_pentium__=1"); // NOI18N
427:                        all.add("__unix=1"); // NOI18N
428:                        all.add("__unix__=1"); // NOI18N
429:                        all.add("unix=1"); // NOI18N
430:                        all.add("__USER_LABEL_PREFIX__"); // NOI18N
431:                        all.add("__VERSION__=\"3.3.4 (pre 3.3.5 20040809)\""); // NOI18N
432:                        all.add("__WCHAR_MAX__=2147483647"); // NOI18N
433:                        all.add("__WCHAR_TYPE__=long int"); // NOI18N
434:                        all.add("__WINT_TYPE__=unsigned int"); // NOI18N
435:                    }
436:                } else if (useCSysDefines) {
437:                    // add generated by gcc 3.3.4 on SuSe 9.2
438:                    // #gcc -x c -dM -E - < /dev/null
439:                    all.add("__DBL_MIN_EXP__=(-1021)"); // NOI18N
440:                    all.add("__FLT_MIN__=1.17549435e-38F"); // NOI18N
441:                    all.add("__CHAR_BIT__=8"); // NOI18N
442:                    all.add("__WCHAR_MAX__=2147483647"); // NOI18N
443:                    all.add("__DBL_DENORM_MIN__=4.9406564584124654e-324"); // NOI18N
444:                    all.add("__FLT_EVAL_METHOD__=2"); // NOI18N
445:                    all.add("__unix__=1"); // NOI18N
446:                    all.add("unix=1"); // NOI18N
447:                    all.add("__i386__=1"); // NOI18N
448:                    all.add("__SIZE_TYPE__=unsigned=int"); // NOI18N
449:                    all.add("__ELF__=1"); // NOI18N
450:                    all.add("__DBL_MIN_10_EXP__=(-307)"); // NOI18N
451:                    all.add("__FINITE_MATH_ONLY__=0"); // NOI18N
452:                    all.add("__GNUC_PATCHLEVEL__=4"); // NOI18N
453:                    all.add("__FLT_RADIX__=2"); // NOI18N
454:                    all.add("__LDBL_EPSILON__=1.08420217248550443401e-19L"); // NOI18N
455:                    all.add("__SHRT_MAX__=32767"); // NOI18N
456:                    all.add("__LDBL_MAX__=1.18973149535723176502e+4932L"); // NOI18N
457:                    all.add("__linux=1"); // NOI18N
458:                    all.add("__unix=1"); // NOI18N
459:                    all.add("__LDBL_MAX_EXP__=16384"); // NOI18N
460:                    all.add("__LONG_MAX__=2147483647L"); // NOI18N
461:                    all.add("__linux__=1"); // NOI18N
462:                    all.add("__SCHAR_MAX__=127"); // NOI18N
463:                    all.add("__DBL_DIG__=15"); // NOI18N
464:                    all.add("__USER_LABEL_PREFIX__"); // NOI18N
465:                    all.add("linux=1"); // NOI18N
466:                    all.add("__tune_pentium__=1"); // NOI18N
467:                    all.add("__STDC_HOSTED__=1"); // NOI18N
468:                    all.add("__LDBL_MANT_DIG__=64"); // NOI18N
469:                    all.add("__FLT_EPSILON__=1.19209290e-7F"); // NOI18N
470:                    all.add("__LDBL_MIN__=3.36210314311209350626e-4932L"); // NOI18N
471:                    all.add("__WCHAR_TYPE__=long int"); // NOI18N
472:                    all.add("__FLT_DIG__=6"); // NOI18N
473:                    all.add("__FLT_MAX_10_EXP__=38"); // NOI18N
474:                    all.add("__INT_MAX__=2147483647"); // NOI18N
475:                    all.add("__gnu_linux__=1"); // NOI18N
476:                    all.add("__FLT_MAX_EXP__=128"); // NOI18N
477:                    all.add("__DECIMAL_DIG__=21"); // NOI18N
478:                    all.add("__DBL_MANT_DIG__=53"); // NOI18N
479:                    all.add("__WINT_TYPE__=unsigned int"); // NOI18N
480:                    all.add("__GNUC__=3"); // NOI18N
481:                    all.add("__LDBL_MIN_EXP__=(-16381)"); // NOI18N
482:                    all.add("__tune_i586__=1"); // NOI18N
483:                    all.add("__LDBL_MAX_10_EXP__=4932"); // NOI18N
484:                    all.add("__DBL_EPSILON__=2.2204460492503131e-16"); // NOI18N
485:                    all.add("__DBL_MAX__=1.7976931348623157e+308"); // NOI18N
486:                    all.add("__DBL_MAX_EXP__=1024"); // NOI18N
487:                    all.add("__FLT_DENORM_MIN__=1.40129846e-45F"); // NOI18N
488:                    all.add("__LONG_LONG_MAX__=9223372036854775807LL"); // NOI18N
489:                    all.add("__FLT_MAX__=3.40282347e+38F"); // NOI18N
490:                    all.add("__GXX_ABI_VERSION=102"); // NOI18N
491:                    all.add("__FLT_MIN_10_EXP__=(-37)"); // NOI18N
492:                    all.add("__FLT_MIN_EXP__=(-125)"); // NOI18N
493:                    all.add("i386=1"); // NOI18N
494:                    all.add("__GNUC_MINOR__=3"); // NOI18N
495:                    all.add("__DBL_MAX_10_EXP__=308"); // NOI18N
496:                    all
497:                            .add("__LDBL_DENORM_MIN__=3.64519953188247460253e-4951L"); // NOI18N
498:                    all.add("__DBL_MIN__=2.2250738585072014e-308"); // NOI18N
499:                    all.add("__PTRDIFF_TYPE__=int"); // NOI18N
500:                    all.add("__LDBL_MIN_10_EXP__=(-4931)"); // NOI18N
501:                    all.add("__REGISTER_PREFIX__"); // NOI18N
502:                    all.add("__LDBL_DIG__=18"); // NOI18N
503:                    all.add("__NO_INLINE__=1"); // NOI18N
504:                    all.add("__i386=1"); // NOI18N
505:                    all.add("__FLT_MANT_DIG__=24"); // NOI18N
506:                    all.add("__VERSION__=\"3.3.4 (pre 3.3.5 20040809)\""); // NOI18N
507:                }
508:                return new ArrayList<String>(all);
509:            }
510:
511:            public ModelImpl getModel() {
512:                return model;
513:            }
514:
515:            public List<String> getMacros() {
516:                return Collections.unmodifiableList(macros);
517:            }
518:
519:            public boolean isPathsRelCurFile() {
520:                return pathsRelCurFile;
521:            }
522:
523:            public List<File> getFiles() {
524:                return Collections.unmodifiableList(files);
525:            }
526:
527:            public List<String> getQuoteIncludePaths() {
528:                return Collections.unmodifiableList(quoteIncludePaths);
529:            }
530:
531:            public void setUseCSysDefines(boolean set) {
532:                this .useCSysDefines = set;
533:            }
534:
535:            public void setUseCSysIncludes(boolean set) {
536:                this .useCSysIncludes = set;
537:            }
538:
539:            public void setUseCppSysDefines(boolean set) {
540:                this .useCppSysDefines = set;
541:            }
542:
543:            public void setUseCppSysIncludes(boolean set) {
544:                this .useCppSysIncludes = set;
545:            }
546:
547:            public void setUseSysPredefined(boolean set) {
548:                setUseCSysDefines(set);
549:                setUseCSysIncludes(set);
550:                setUseCppSysDefines(set);
551:                setUseCppSysIncludes(set);
552:            }
553:
554:            protected final void initDataObjects() {
555:                ProjectBase prj = getProject();
556:                if (prj != null) {
557:                    Collection<CsmFile> allFiles = prj.getAllFiles();
558:                    for (CsmFile csmFile : allFiles) {
559:                        if (csmFile instanceof  FileImpl) {
560:                            try {
561:                                FileImpl impl = (FileImpl) csmFile;
562:                                NativeFileItem item = impl.getNativeFileItem();
563:                                FileObject fo = item == null ? null : FileUtil
564:                                        .toFileObject(item.getFile());
565:                                DataObject dobj = fo == null ? null
566:                                        : DataObject.find(fo);
567:                                NativeProjectProvider.registerItemInDataObject(
568:                                        dobj, item);
569:                            } catch (DataObjectNotFoundException ex) {
570:                                Exceptions.printStackTrace(ex);
571:                            }
572:                        }
573:                    }
574:                }
575:            }
576:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.