--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Tue May 12 10:41:34 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Tue May 12 10:46:48 2009 -0500
@@ -67,7 +67,7 @@
public CarbideBuildConfiguration(IProject project, ISymbianBuildContext context) {
- super(context.getSDK(), context.getPlatformString(), context.getTargetString(), context.getBuildVariationName());
+ super(context.getSDK(), context.getPlatformString(), context.getTargetString());
projectTracker = new TrackedResource(project);
sisBuilderInfoList = new ArrayList<ISISBuilderInfo>(0);
envVarsInfo = new EnvironmentVarsInfo2(project, context);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/barney.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,13 @@
+VARIANT barney
+
+EXTENDS flintstone500
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config/flintstone500/barney
+
+ROM_INCLUDE prepend /epoc32/include/config/flintstone500/barney
+ROM_INCLUDE prepend /epoc32/rom/config/flintstone500/barney
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/default.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,10 @@
+VARIANT default
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE set /epoc32/include
+
+ROM_INCLUDE set /epoc32/include
+ROM_INCLUDE prepend /epoc32/include/internal
+ROM_INCLUDE prepend /epoc32/rom/include
+ROM_INCLUDE prepend /epoc32/rom
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/dino79.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,12 @@
+VARIANT dino79
+
+EXTENDS flintstone500
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config/flintstone500/dino79
+
+ROM_INCLUDE prepend /epoc32/include/config/flintstone500/dino79
+ROM_INCLUDE prepend /epoc32/rom/config/flintstone500/dino79
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/flintstone500.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,14 @@
+VARIANT flintstone500
+
+EXTENDS variants
+
+VIRTUAL
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config/flintstone500
+
+ROM_INCLUDE prepend /epoc32/include/config/flintstone500
+ROM_INCLUDE prepend /epoc32/rom/config/flintstone500
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/fred99nhd.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,13 @@
+VARIANT fred99nhd
+
+EXTENDS flintstone500
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config/flintstone500/fred99nhd
+
+ROM_INCLUDE prepend /epoc32/include/config/flintstone500/fred99nhd
+ROM_INCLUDE prepend /epoc32/rom/config/flintstone500/fred99nhd
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/variants.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,20 @@
+VARIANT variants
+
+EXTENDS default
+
+VIRTUAL
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config
+
+ROM_INCLUDE prepend /epoc32/include/config
+ROM_INCLUDE prepend /epoc32/rom/config
+
+
+ROM_INCLUDE prepend /epoc32/rom/include/language/osext
+ROM_INCLUDE prepend /epoc32/rom/include/core/tools
+ROM_INCLUDE prepend /epoc32/rom/include/core/osext
+ROM_INCLUDE prepend /epoc32/rom/include/core/os
+ROM_INCLUDE prepend /epoc32/rom/include/core/mw
+ROM_INCLUDE prepend /epoc32/rom/include/core/app
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/Data/var/group1/epoc32/tools/variant/wilma88.var Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,13 @@
+VARIANT differentname
+
+EXTENDS flintstone500
+
+VARIANT_HRH /epoc32/include/feature_settings.hrh
+
+BUILD_INCLUDE prepend /epoc32/include/config/flintstone500/wilma88
+
+ROM_INCLUDE prepend /epoc32/include/config/flintstone500/wilma88
+ROM_INCLUDE prepend /epoc32/rom/config/flintstone500/wilma88
+
+
+
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Tue May 12 10:41:34 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Tue May 12 10:46:48 2009 -0500
@@ -28,6 +28,7 @@
suite.addTestSuite(SDKCreationTest.class);
suite.addTestSuite(MacroStoreLoaderTest.class);
suite.addTestSuite(BSFCatalogTest.class);
+ suite.addTestSuite(SBVCatalogTest.class);
suite.addTestSuite(DevicesLoaderTest.class);
suite.addTestSuite(SymbianContextTest.class);
suite.addTestSuite(TestSDKChangeListener.class);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.sdk.core.test;
+
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.*;
+
+import com.nokia.carbide.cpp.internal.sdk.core.model.SBVCatalogFactory;
+import com.nokia.carbide.cpp.sdk.core.ISBVCatalog;
+import com.nokia.carbide.cpp.sdk.core.ISBVPlatform;
+
+
+public class SBVCatalogTest extends TestCase {
+
+ private IPath sdkPath;
+ private IPath sdkIncludePath;
+ private ISBVCatalog catalog;
+
+ private void setupForSDK(IPath relativeSdkPath) throws Exception {
+ if (Platform.isRunning()) {
+ URL url = FileLocator.find(TestPlugin.getDefault().getBundle(), relativeSdkPath, null);
+ URL fileURL = FileLocator.toFileURL(url);
+ sdkPath = new Path(fileURL.getPath());
+ } else {
+ sdkPath = relativeSdkPath;
+ }
+ sdkIncludePath = sdkPath.append("epoc32/include");
+
+ catalog = SBVCatalogFactory.createCatalog(sdkPath, sdkIncludePath);
+ assertNotNull(catalog);
+ }
+
+ public void testSDKScan() throws Exception {
+ setupForSDK(new Path("Data"));
+ assertEquals(0, catalog.getPlatforms().length);
+ assertNull(catalog.findPlatform("ARMV5"));
+ }
+
+ /**
+ * Test that the correct SBV platforms are created
+ * @throws Exception
+ */
+ public void testSBVCatalogCreation() throws Exception {
+ setupForSDK(new Path("Data/var/group1"));
+ ISBVPlatform[] platforms = catalog.getPlatforms();
+ assertEquals(7, platforms.length);
+
+ assertEquals("barney", platforms[0].getName());
+ assertEquals("default", platforms[1].getName());
+ assertEquals("dino79", platforms[2].getName());
+ assertEquals("flintstone500", platforms[3].getName());
+ assertEquals("fred99nhd", platforms[4].getName());
+ assertEquals("variants", platforms[5].getName());
+ assertEquals("differentname", platforms[6].getName()); // filename is wilma88, but test that we us the VARIANT keyword
+ }
+
+ /**
+ * Test SBV support, which establishes a hierarchy of SBV platforms
+ * and also supports additional levels of system include paths.
+ * @throws Exception
+ */
+ public void testSBVDataView() throws Exception {
+ setupForSDK(new Path("Data/var/group1"));
+ ISBVPlatform[] platforms = catalog.getPlatforms();
+ assertEquals(7, platforms.length);
+
+ ISBVPlatform platform;
+ platform = catalog.findPlatform("BARNEY");
+ assertNotNull(platform);
+ assertEquals("barney", platform.getName());
+ assertEquals("FLINTSTONE500", platform.getExtendedVariantName().toUpperCase());
+
+ assertFalse(platform.isVirtual());
+
+ platform = catalog.findPlatform(platform.getExtendedVariantName());
+ assertNotNull(platform);
+ assertTrue(platform.isVirtual());
+ assertEquals("VARIANTS", platform.getExtendedVariantName().toUpperCase());
+
+ assertNotNull(platform.getBuildIncludePaths());
+ assertEquals(3, platform.getBuildIncludePaths().size());
+
+ assertTrue("Didn't get expected VARIANT_HRH value", platform.getBuildVariantHRHFile().toPortableString().contains("/epoc32/include/feature_settings.hrh"));
+
+ // test null platform
+ platform = catalog.findPlatform("wilma88");
+ assertNull(platform);
+
+ // test build include paths
+ platform = catalog.findPlatform("dino79");
+ assertNotNull(platform);
+ assertEquals(4, platform.getBuildIncludePaths().size());
+
+ List<IPath> incPaths = platform.getBuildIncludePaths();
+ for (IPath path : incPaths){
+ System.out.println("Include path for dino79 bianry variant: " + path.toOSString());
+ }
+
+ assertEquals(16, platform.getROMBuildIncludePaths().size());
+
+ }
+
+ /**
+ * @param built
+ * @param string
+ * @return
+ */
+ private boolean findPlatform(ISBVPlatform[] platforms, String string) {
+ for (ISBVPlatform platform : platforms)
+ if (platform.getName().equalsIgnoreCase(string))
+ return true;
+ return false;
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Tue May 12 10:41:34 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Tue May 12 10:46:48 2009 -0500
@@ -41,7 +41,6 @@
private String platform;
private String target;
private String displayString = null;
- private String symbianBuildVariationString;
private static String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$
private static String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$
@@ -63,26 +62,11 @@
public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget) {
sdkId = theSDK.getUniqueId();
- String[] platformString = thePlatform.split("\\.");
- if (platformString != null && platformString.length == 2){
- platform = platformString[0];
- symbianBuildVariationString = platformString[1];
- } else {
- platform = thePlatform;
- symbianBuildVariationString = "";
- }
-
+ platform = thePlatform;
target = theTarget;
getDisplayString();
}
-
- public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget, String theBinaryVariationName) {
- sdkId = theSDK.getUniqueId();
- platform = thePlatform;
- target = theTarget;
- symbianBuildVariationString = theBinaryVariationName;
- getDisplayString();
- }
+
@Override
public int hashCode() {
@@ -157,13 +141,8 @@
} else {
displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT;
}
-
- String platDisplay = platform;
- if (symbianBuildVariationString.length() > 0){
- platDisplay = platform + "." + symbianBuildVariationString;
- }
-
- displayString = displayString + " (" + platDisplay + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
+
+ displayString = displayString + " (" + platform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
}
return displayString;
}
@@ -529,6 +508,13 @@
public String getBuildVariationName() {
- return symbianBuildVariationString;
+ String varName = "";
+
+ String[] tokens = getPlatformString().split("\\.");
+ if (tokens.length == 2){
+ varName = tokens[1];
+ }
+
+ return varName;
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.internal.sdk.core.model;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import com.nokia.carbide.cpp.sdk.core.ISBVCatalog;
+import com.nokia.carbide.cpp.sdk.core.ISBVPlatform;
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+
+/**
+ * This class defines the hierarchy of VAR files detected for a given SDK.
+ *
+ */
+public class SBVCatalog implements ISBVCatalog {
+
+ private List<IMessage> messages;
+ private List<SBVPlatform> platforms;
+
+ public SBVCatalog(IPath sdkPath, IPath sdkIncludePath) {
+ this.messages = new ArrayList<IMessage>(1);
+ this.platforms = new ArrayList<SBVPlatform>(10);
+
+ File epoc32ToolsDir = sdkPath.append("epoc32").append("tools").append("variant").toFile(); //$NON-NLS-1$ //$NON-NLS-2$
+ File[] sbvFiles = epoc32ToolsDir.listFiles(new FilenameFilter() {
+ public boolean accept(File file, String str) {
+ return str.toLowerCase().endsWith(".var"); //$NON-NLS-1$
+ }
+ });
+
+ // cannot read directory; return empty catalog
+ if (sbvFiles == null){
+ return;
+ }
+
+ // gather the individual SBV platforms
+ for (File sbvFile : sbvFiles) {
+ IPath sbvPath = new Path(sbvFile.getAbsolutePath());
+ SBVPlatform platform = SBVPlatform.createPlatform(this, sbvPath, messages, sdkIncludePath);
+ if (platform != null) {
+ platforms.add(platform);
+ }
+ }
+
+ // TODO: Do we need to bother with a hierarchy?
+ // now wire up the platforms
+ //establishPlatformHierarchy();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVCatalog#getMessages()
+ */
+ public IMessage[] getMessages() {
+ return (IMessage[]) messages.toArray(new IMessage[messages.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVCatalog#findPlatform(java.lang.String)
+ */
+ public ISBVPlatform findPlatform(String platformName) {
+ for (ISBVPlatform platform : platforms) {
+ if (platform.getName().equalsIgnoreCase(platformName))
+ return platform;
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVCatalog#getPlatforms()
+ */
+ public ISBVPlatform[] getPlatforms() {
+ return (ISBVPlatform[]) platforms.toArray(new ISBVPlatform[platforms.size()]);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalogFactory.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.internal.sdk.core.model;
+
+import com.nokia.carbide.cpp.sdk.core.ISBVCatalog;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * This factory creates SBV catalogs.
+ *
+ */
+public class SBVCatalogFactory {
+
+ /**
+ * Create a catalog of SBV information for the .var files detected
+ * in the given SDK's directory. The catalog is regenerated from scratch.
+ * @param sdk non-null SDK to scan
+ * @return a catalog, never null
+ */
+ public static ISBVCatalog createCatalog(ISymbianSDK sdk) {
+ SBVCatalog catalog = new SBVCatalog(new Path(sdk.getEPOCROOT()), sdk.getIncludePath());
+ return catalog;
+ }
+
+ /**
+ * Create a catalog of BSV information for the VAR files detected
+ * in the given directory. The catalog is regenerated from scratch.
+ * @param sdkPath path to an SDK root
+ * @param sdkIncludePath path to the SDK's include directory
+ * @return a catalog, never null
+ */
+ public static ISBVCatalog createCatalog(IPath sdkPath, IPath sdkIncludePath) {
+ SBVCatalog catalog = new SBVCatalog(sdkPath, sdkIncludePath);
+ return catalog;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,275 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.internal.sdk.core.model;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.*;
+
+import org.eclipse.core.runtime.*;
+
+import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
+import com.nokia.carbide.cpp.epoc.engine.ISBVViewRunnable;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
+import com.nokia.carbide.cpp.internal.api.sdk.Messages;
+import com.nokia.carbide.cpp.sdk.core.*;
+import com.nokia.cpp.internal.api.utils.core.*;
+
+/**
+ * This specifies a single SBV platform.
+ *
+ */
+public class SBVPlatform implements ISBVPlatform {
+
+ /** The exact basename of the .var */
+ private String name;
+ private IPath path;
+ private ISBVPlatform extendedPlatform;
+ private String extendedPlatName;
+ private List<IPath> systemBuildIncludePaths = new ArrayList<IPath>();
+ private List<IPath> romBuildIncludePaths = new ArrayList<IPath>();
+ private IPath sdkIncludePath;
+ private IPath bldVarintHRH;
+ private ISBVCatalog catalog;
+ private boolean virtual;
+
+ /** Create a Symbian Binary Variation platform from parse results of a .var file
+ * @param sdk
+ * @param sbvPath
+ * @param enableAbiV2Mode used to remap ARMV5, ARMV6, or ARMV6_ABIV1 to an appropriate canonical name
+
+ */
+ SBVPlatform(ISBVCatalog catalog, IPath sdkIncludePath, ISBVView view ) {
+ this.catalog = catalog;
+ this.sdkIncludePath = sdkIncludePath;
+ this.extendedPlatName = view.getExtends().toUpperCase();
+ this.path = view.getModel().getPath();
+ this.virtual = view.getVirtualFlag();
+ this.name = view.getVariantName();
+
+ String temp = view.getBuildVariantHRH();
+ String epocRoot = getEPOCRoot();
+
+ bldVarintHRH = new Path(epocRoot + temp);
+
+ setBuildIncludePaths(view.getBuildIncludes());
+ setROMBuildIncludePaths(view.getROMBuildIncludes());
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "SBV platform: " + name; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof ISBVPlatform && ((ISBVPlatform) obj).getName().equalsIgnoreCase(name);
+ }
+
+
+ /**
+ * Set the customized platform.
+ * @param customized
+ */
+ void setCustomizedPlatform(ISBVPlatform customized) {
+ Check.checkState(customized != this);
+ this.extendedPlatform = customized;
+ if (customized != null) {
+ this.extendedPlatName = customized.getName();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getCatalog()
+ */
+ public ISBVCatalog getCatalog() {
+ return catalog;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getSBVPath()
+ */
+ public IPath getSBVPath() {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedPlatformName()
+ */
+ public String getExtendedVariantName() {
+ return extendedPlatName;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISBVPlatform#getExtendedVariant()()
+ */
+ public ISBVPlatform getExtendedVariant() {
+ return catalog.findPlatform(getExtendedVariantName());
+ }
+
+ /**
+ * Create one SBV platform, partially initialized in isolation from the
+ * content of one SBV file.
+ * @param catalog the owning catalog
+ * @param sbvPath full path to .sbv file
+ * @param messages array of messages to which to add any messages found while parsing
+ * @return new platform, or null on error
+ */
+ public static SBVPlatform createPlatform(
+ final ISBVCatalog catalog,
+ final IPath sbvPath,
+ final List<IMessage> messages,
+ final IPath sdkIncludePath) {
+
+ ISBVViewRunnable runnable = new ISBVViewRunnable() {
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.IViewRunnable#failedLoad(org.eclipse.core.runtime.CoreException)
+ */
+ public Object failedLoad(CoreException exception) {
+ EpocEnginePlugin.log(exception);
+ messages.add(new Message(IMessage.ERROR,
+ new MessageLocation(sbvPath),
+ "SBVCatalog.SBVLoadError", //$NON-NLS-1$
+ MessageFormat.format(
+ Messages.getString("SBVCatalog.SBVLoadError"), //$NON-NLS-1$
+ new Object[] { exception.getLocalizedMessage() })
+ ));
+ return null;
+ }
+ public Object run(ISBVView view) {
+ IMessage[] viewMessages = view.getMessages();
+ for (IMessage message : viewMessages) {
+ messages.add(message);
+ }
+ return new SBVPlatform(catalog, sdkIncludePath, view);
+ }
+ };
+
+ return (SBVPlatform) EpocEnginePlugin.runWithSBVView(sbvPath, runnable);
+ }
+
+ public boolean isVirtual() {
+ return virtual;
+ }
+
+ public IPath getBuildVariantHRHFile() {
+
+ return bldVarintHRH;
+
+ }
+
+ protected void setBuildIncludePaths(Map<String, String> incPaths){
+ synchronized (this)
+ {
+ Set<String> set = incPaths.keySet();
+ for (String currPath : set) {
+ IPath path = new Path(getEPOCRoot() + currPath);
+ systemBuildIncludePaths.add(path);
+ }
+ }
+
+ }
+
+ protected List<IPath> getBuildIncludePathsFromParents(){
+
+ List<IPath> parentBuildIncludes = new ArrayList<IPath>();
+
+ ISBVPlatform platform = getExtendedVariant();
+ ISBVPlatform prevPlat;
+ while (platform != null) {
+ parentBuildIncludes.addAll(platform.getBuildIncludePaths());
+ prevPlat = platform;
+ platform = getExtendedVariant();
+ if (prevPlat.getName().equalsIgnoreCase(platform.getName())){
+ break;
+ }
+ }
+
+ return parentBuildIncludes;
+ }
+
+ protected void setROMBuildIncludePaths(Map<String, String> incPaths){
+ synchronized (this)
+ {
+ Set<String> set = incPaths.keySet();
+ for (String currPath : set){
+ IPath path = new Path(getEPOCRoot() + currPath);
+ romBuildIncludePaths.add(path);
+ }
+ }
+ }
+
+ protected List<IPath> getROMBuildIncludePathsFromParents(){
+
+ List<IPath> parentROMBuildIncludes = new ArrayList<IPath>();
+
+ ISBVPlatform platform = getExtendedVariant();
+ ISBVPlatform prevPlat;
+ while (platform != null) {
+ parentROMBuildIncludes.addAll(platform.getROMBuildIncludePaths());
+ prevPlat = platform;
+ platform = getExtendedVariant();
+ if (prevPlat.getName().equalsIgnoreCase(platform.getName())){
+ break;
+ }
+ }
+
+ return parentROMBuildIncludes;
+ }
+
+ protected String getEPOCRoot(){
+
+ String EPOC32_INCLUDE = "epoc32" + File.separator + "include";
+ if (sdkIncludePath.toOSString().contains(EPOC32_INCLUDE)){
+ return sdkIncludePath.toOSString().substring(0, sdkIncludePath.toOSString().indexOf(EPOC32_INCLUDE));
+ }
+
+ return sdkIncludePath.toOSString();
+ }
+
+ public List<IPath> getBuildIncludePaths(){
+ List<IPath> fullList = new ArrayList<IPath>();
+
+ fullList.addAll(systemBuildIncludePaths);
+ fullList.addAll(getBuildIncludePathsFromParents());
+
+ return fullList;
+ }
+
+ public List<IPath> getROMBuildIncludePaths(){
+ List<IPath> fullList = new ArrayList<IPath>();
+
+ fullList.addAll(romBuildIncludePaths);
+ fullList.addAll(getROMBuildIncludePathsFromParents());
+
+ return fullList;
+ }
+
+
+}
+
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Tue May 12 10:41:34 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Tue May 12 10:46:48 2009 -0500
@@ -81,7 +81,9 @@
private List<IDefine> variantHRHMacros = null;
private List<ISymbianBuildContext> bsfContextList = new ArrayList<ISymbianBuildContext>(0);
-
+
+ private List<ISymbianBuildContext> binaryVariantContextList = new ArrayList<ISymbianBuildContext>(0);
+
private Date createDate;
private URL publisherURL;
private String sdkDescription;
@@ -92,6 +94,7 @@
List<String> supportedTargetTypesList = new ArrayList<String>();
private IBSFCatalog bsfCatalog;
+ private ISBVCatalog sbvCatalog;
private Map<String, List<String>> cachedPlatformMacros = new HashMap<String, List<String>>();
@@ -260,6 +263,7 @@
ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
if (sdkMgr.getBSFScannerEnabled()){
buildTargets.addAll(getBSFPlatformContexts());
+ buildTargets.addAll(getBinaryVariationPlatformContexts()); // Symbian Binary Variation (.var)
}
return buildTargets;
@@ -284,6 +288,27 @@
return bsfContextList;
}
+
+public List<ISymbianBuildContext> getBinaryVariationPlatformContexts(){
+
+ synchronized (binaryVariantContextList) {
+ if (!binaryVariantContextList.isEmpty()){
+ return binaryVariantContextList;
+ }
+
+ ISBVCatalog catalog = getSBVCatalog();
+ for (ISBVPlatform sbvPlatform : catalog.getPlatforms()) {
+ // Currently only variation of ARMV5 is supported... So just hard code the variated platform
+ // Only add the build platform if it's not virtual.
+ if (!sbvPlatform.isVirtual()){
+ binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.DEBUG_TARGET));
+ binaryVariantContextList.add(new SymbianBuildContext(this, SymbianBuildContext.ARMV5_PLATFORM + "." + sbvPlatform.getName(), ISymbianBuildContext.RELEASE_TARGET));
+ }
+ }
+ }
+
+ return binaryVariantContextList;
+ }
public List<ISymbianBuildContext> getFilteredBuildConfigurations() {
@@ -1187,5 +1212,16 @@
return bsfCatalog;
}
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.sdk.core.ISymbianSDK#getBSFCatalog()
+ */
+ public ISBVCatalog getSBVCatalog() {
+ synchronized (this) {
+ if (sbvCatalog == null) {
+ sbvCatalog = SBVCatalogFactory.createCatalog(this);
+ }
+ }
+ return sbvCatalog;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVCatalog.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.sdk.core;
+
+import com.nokia.cpp.internal.api.utils.core.*;
+
+/**
+ * This is a catalog of all the .VAR (Symbian Binary Variation) files detected for a given SDK.
+ *
+ */
+public interface ISBVCatalog {
+ /**
+ * Get any problems detected while parsing the BSF files.
+ * @return array of messages, never null
+ */
+ IMessage[] getMessages();
+
+ /**
+ * Get the array of SBV platforms detected. Each corresponds to
+ * a *.var file. This does not include the built-in platforms.
+ * @return array, never null
+ */
+ ISBVPlatform[] getPlatforms();
+
+
+ /**
+ * Find a platform with the given name.
+ * @param name platform name, case doesn't matter
+ * @return platform or null
+ */
+ ISBVPlatform findPlatform(String platform);
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.sdk.core;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
+
+/**
+ * This interface defines a single Symbian Binary Variation (SBV) platform.
+ * <p>
+ * Once a platform is available
+ * from a catalog, it is contained in a hierarchy of platforms, terminating at
+ * built-in platforms (like ARMV5).
+ */
+public interface ISBVPlatform {
+ /**
+ * Get the catalog this platform is contained in.
+ * @return ISBVCatalog, never null
+ */
+ ISBVCatalog getCatalog();
+
+ /**
+ * Get the platform's name, from the VARIANT keyword value.
+ *
+ * @return name, never null
+ */
+ String getName();
+
+ /**
+ * Get the full file system path to the .var used.
+ * <p>
+ * This may be used
+ * to retrieve the {@link ISBVView} via {@link EpocEnginePlugin#runWithSBVView(IPath, com.nokia.carbide.cpp.epoc.engine.model.IViewConfiguration, com.nokia.carbide.cpp.epoc.engine.ISBVViewRunnable)}
+ * to get more information about the SBV.
+ *
+ * @return path, never null
+ */
+ IPath getSBVPath();
+
+ /**
+ * Get the name of the variant this SBV platform extends
+ * @return
+ */
+ String getExtendedVariantName();
+
+ /**
+ * Get the variant platform this platform extends
+ * @return The ISBVPlatform, or null if it does not extend a platform
+ */
+ public ISBVPlatform getExtendedVariant();
+
+ /**
+ * Is the VIRTUAL keyword present?
+ * @return
+ */
+ public boolean isVirtual();
+
+ /**
+ * Get the
+ * @return The path to the defined HRH file, null if none.
+ */
+ public IPath getBuildVariantHRHFile();
+
+ /**
+ * The list of BUILD_INCLUDE paths from the variant and all it's parents
+ * @return list of paths
+ */
+ List<IPath> getBuildIncludePaths();
+
+ /**
+ * The list of ROM_INCLUDE paths from the variant and all it's parents
+ * @return list of paths
+ */
+ List<IPath> getROMBuildIncludePaths();
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Tue May 12 10:41:34 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Tue May 12 10:46:48 2009 -0500
@@ -113,6 +113,7 @@
/**
* For platforms that are building with Symbian Binary Variation, this suffix will be included in the configuration name
+ * For example, if you are building variant armv5.product1, then this will return "product1" string.
* @return The name of the Symbian Binary Variation, or an empy String if the configuration is not a variation.
*/
public String getBuildVariationName();
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Tue May 12 10:41:34 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Tue May 12 10:46:48 2009 -0500
@@ -67,8 +67,8 @@
BuildPlatformFilterPage.EKA2_Platforms=EKA2 Platforms
BuildPlatformFilterPage.Specify_Platforms_Help2=Specifies platforms to be displayed for OS versions 8.1a and less (8.xa, 7.x, 6.x)
BuildPlatformFilterPage.EKA1_Platforms_Label=EKA1 Platforms
-BuildPlatformFilterPage.BSF_Help=Scans for .bsf files under \\epoc32\\tools for platform extensions. These are platforms such as ARMV6 and ARM9E.
-BuildPlatformFilterPage.BSF_Label=Discover SDK Customization Platforms Dynamically (BSF Scanner)
+BuildPlatformFilterPage.BSF_Help=Scans for .bsf and/or .var files under \\epoc32\\tools for platform variants.
+BuildPlatformFilterPage.BSF_Label=Discover customization (.bsf) and Symbian Binary Variant (.var) platforms dynamically.
SDKPreferencePage.List_of_Available_SDKs_ToolTip=List of available SDKs from devices.xml.
SDKPreferencePage.Platforms_cannot_be_determined=Platforms cannot be determined
SDKPreferencePage.OS_Version_Cannot_Be_Determined=OS version cannot be determined
--- a/project/com.nokia.carbide.cpp.epoc.engine/META-INF/MANIFEST.MF Tue May 12 10:41:34 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/META-INF/MANIFEST.MF Tue May 12 10:46:48 2009 -0500
@@ -20,6 +20,7 @@
com.nokia.carbide.cpp.epoc.engine.model,
com.nokia.carbide.cpp.epoc.engine.model.bldinf,
com.nokia.carbide.cpp.epoc.engine.model.bsf,
+ com.nokia.carbide.cpp.epoc.engine.model.sbv,
com.nokia.carbide.cpp.epoc.engine.model.makefile,
com.nokia.carbide.cpp.epoc.engine.model.makefile.image,
com.nokia.carbide.cpp.epoc.engine.model.mmp,
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/EpocEnginePlugin.java Tue May 12 10:41:34 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/EpocEnginePlugin.java Tue May 12 10:46:48 2009 -0500
@@ -16,6 +16,9 @@
*/
package com.nokia.carbide.cpp.epoc.engine;
+import org.eclipse.core.runtime.*;
+import org.osgi.framework.BundleContext;
+
import com.nokia.carbide.cpp.epoc.engine.model.*;
import com.nokia.carbide.cpp.epoc.engine.model.bldinf.*;
import com.nokia.carbide.cpp.epoc.engine.model.bsf.*;
@@ -23,14 +26,10 @@
import com.nokia.carbide.cpp.epoc.engine.model.makefile.IMakefileOwnedModel;
import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.*;
import com.nokia.carbide.cpp.epoc.engine.model.mmp.*;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.*;
import com.nokia.carbide.internal.cpp.epoc.engine.model.ViewDataCache;
-import com.nokia.cpp.internal.api.utils.core.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
+import com.nokia.cpp.internal.api.utils.core.Logging;
+import com.nokia.cpp.internal.api.utils.core.MultiResourceChangeListenerDispatcher;
/**
* The main plugin class to be used in the desktop.
@@ -54,6 +53,7 @@
private static IModelProvider<IMakefileOwnedModel, IMakefileModel> makefileModelProvider;
private static IModelProvider<IImageMakefileOwnedModel, IImageMakefileModel> imageMakefileModelProvider;
private static IModelProvider<IBSFOwnedModel, IBSFModel> bsfModelProvider;
+ private static IModelProvider<ISBVOwnedModel, ISBVModel> sbvModelProvider;
private static ViewDataCache<IMMPOwnedModel, IMMPModel, IMMPView, IMMPData> mmpViewDataCache;
@@ -145,7 +145,7 @@
}
/**
- * Get the provider that manages access to image (scalable icon) makefiles in the workspace.
+ * Get the provider that manages access to BSF files in an SDK.
* @return provider, never null
*/
public static synchronized IModelProvider<IBSFOwnedModel, IBSFModel> getBSFModelProvider() {
@@ -155,6 +155,16 @@
return bsfModelProvider;
}
+ /**
+ * Get the provider that manages access to the .var files in the SDK (for Symbian Binary Variation support).
+ * @return provider, never null
+ */
+ public static synchronized IModelProvider<ISBVOwnedModel, ISBVModel> getSBVModelProvider() {
+ if (sbvModelProvider == null) {
+ sbvModelProvider = ModelProviderFactory.createModelProvider(new SBVModelFactory());
+ }
+ return sbvModelProvider;
+ }
/**
* Get the dispatcher for resource change events handling multiple paths.
@@ -331,6 +341,46 @@
}
/**
+ * Get a shared instance of the given SBV model, create a view
+ * with the given configuration, and run user code using the model.
+ * <p>
+ * The model and view are automatically released.
+ * <p>
+ * If the model cannot be loaded or an exception is thrown, the runnable's
+ * #failedLoad() is called.
+ * @param modelPath workspace-relative path
+ * @param runnable the code to run when the model is loaded (or fails)
+ * @return result from runnable#run
+ */
+ public static Object runWithSBVView(IPath modelPath,
+ ISBVViewRunnable runnable) {
+ ISBVModel model;
+ if (runnable instanceof ViewRunnableAdapter) {
+ ((ViewRunnableAdapter) runnable).setModelPath(modelPath);
+ }
+ try {
+ model = getSBVModelProvider().getSharedModel(modelPath);
+ } catch (CoreException e) {
+ return runnable.failedLoad(e);
+ } catch (Throwable t) {
+ return runnable.failedLoad(new CoreException(Logging.newStatus(EpocEnginePlugin.getDefault(), t)));
+ }
+ ISBVView view = null;
+ if (model == null) {
+ return runnable.failedLoad(null);
+ }
+ try {
+ view = model.createView(null);
+ return runnable.run(view);
+ } finally {
+ if (view != null)
+ view.dispose();
+ getSBVModelProvider().releaseSharedModel(model);
+ }
+ }
+
+
+ /**
* Get a read-only copy of data for the given MMP view
* with the given configuration, and run user code using the model.
* <p>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/ISBVViewRunnable.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine;
+
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVModel;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
+
+/**
+ * Instantiate this interface and pass to EpocEnginePlugin#runWithSBVView()
+ * to encapsulate some of the bookkeeping of model/view handling.
+ *
+ */
+public interface ISBVViewRunnable extends IViewRunnable<ISBVModel, ISBVView> {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/SBVModelFactory.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine.model;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVOwnedModel;
+import com.nokia.carbide.internal.cpp.epoc.engine.model.sbv.SBVModel;
+
+public class SBVModelFactory implements IModelFactory<ISBVOwnedModel> {
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IModelFactory#createModel(org.eclipse.core.runtime.IPath, org.eclipse.jface.text.IDocument)
+ */
+ public ISBVOwnedModel createModel(IPath path, IDocument document) {
+ return new SBVModel(path, document);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ESBVFlags.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine.model.sbv;
+
+/**
+ * This enumeration defines all the flags which may appear in the SBV (.var)
+ * grammar.
+ *
+ */
+public enum ESBVFlags {
+ COMPILEWITHPARENT,
+ COMPILEALONE,
+ VIRTUALVARIANT,
+ VARIANT
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVModel.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine.model.sbv;
+
+import com.nokia.carbide.cpp.epoc.engine.model.IModel;
+
+/**
+ * This is the user interface to a Symbian Binary Variation (VAR) model.
+ *
+ */
+public interface ISBVModel extends IModel<ISBVView> {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVOwnedModel.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine.model.sbv;
+
+import com.nokia.carbide.cpp.epoc.engine.model.*;
+
+/**
+ * This is the owner interface to the SBV (Symbian Binary Variant) model.
+ */
+public interface ISBVOwnedModel extends ISBVModel, IOwnedModel<ISBVView> {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/cpp/epoc/engine/model/sbv/ISBVView.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.cpp.epoc.engine.model.sbv;
+
+import java.util.Map;
+
+import com.nokia.carbide.cpp.epoc.engine.model.IView;
+
+/**
+ * A view onto .VAR (Symbian Binary Variation) contents. This is a parse over a single .VAR file.
+ * <p>
+ * Note: this view cannot be rewritten.
+ *
+ *
+ */
+public interface ISBVView extends IView<ISBVOwnedModel> {
+
+ public static final String INCLUDE_FLAG_SET = "SET";
+ public static final String INCLUDE_FLAG_PREPEND = "PREPEND";
+ public static final String INCLUDE_FLAG_APPEND = "APPEND";
+
+ /** Set the EXTENDS platform.
+ * @param binary variant platform may not be null, but may be "" */
+ void setExtends(String platform);
+
+ /** Get the EXTENDS platform.
+ * @return binary variant platform this extends; never null, but may be the empty string if .var is invalid. */
+ String getExtends();
+
+ /**
+ * Set whether or not the VIRTUAL flag defined?
+ * @param flag
+ */
+ void setVirtualFlag(boolean flag);
+
+ /**
+ * Get whether or not the virtual flag is defined.
+ * @return true if VIRTUAL is defined in the .var file
+ */
+ boolean getVirtualFlag();
+
+ /**
+ * Sets the BUILD_HRH value
+ * @param pathStr, the value of the path in the .var file
+ */
+ void setBuildHRHFile(String pathStr);
+
+ /**
+ * Get the BUILD_HRH value
+ * @return The string of the BUILD_HRH, null if not defined.
+ */
+ String getBuildVariantHRH();
+
+ /**
+ * Set the name of the VARIANT
+ * @param variantName
+ */
+ void setVariantName(String variantName);
+
+ /**
+ * Get the name of the VARIANT
+ *
+ * @return the variant name
+ */
+ String getVariantName();
+
+
+ /**
+ * add a build include path
+ */
+ void addBuildInclude(String arguments);
+
+ /**
+ * Get the BUILD_INLCUDES
+ * @return A map of the build includes: <Include dir, flag>
+ */
+ Map<String, String> getBuildIncludes();
+
+ /**
+ * add a rom build include path
+ */
+ void addROMInclude(String arguments);
+
+ /**
+ * Get the ROM_INLCUDES
+ * @return A map of the build includes: <Include dir, flag>
+ */
+ Map<String, String> getROMBuildIncludes();
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/ASTSBVFactory.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.*;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv.*;
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+
+
+public abstract class ASTSBVFactory extends ASTFactory {
+
+ public static IASTListNode<IASTSBVStatement> createSBVStatementListNode() {
+ return createListNode(""); //$NON-NLS-1$
+ }
+
+ public static IASTSBVFlagStatement createSBVFlagStatement(String name) {
+ return new ASTSBVFlagStatement(createPreprocessorLiteralTextNode(name));
+ }
+
+ public static IASTSBVFlagStatement createSBVFlagStatement(IASTLiteralTextNode name) {
+ return new ASTSBVFlagStatement(name);
+ }
+
+ public static IASTSBVTranslationUnit createSBVTranslationUnit(
+ IASTListNode<IASTSBVStatement> nodes) {
+ if (nodes == null)
+ nodes = createTopLevelNodeListNode();
+ return new ASTSBVTranslationUnit(nodes);
+ }
+
+ public static IASTSBVTranslationUnit createSBVTranslationUnit() {
+ return createSBVTranslationUnit(null);
+ }
+
+ public static IASTSBVProblemStatement createSBVProblemStatement(IASTPreprocessorTokenStream tokenStream, IMessage message) {
+ return new ASTSBVProblemStatement(tokenStream, message);
+ }
+
+ public static IASTSBVProblemStatement createSBVProblemStatement(String string, IMessage message) {
+ return createSBVProblemStatement(createPreprocessorTokenStream(string), message);
+ }
+
+ public static IASTSBVArgumentStatement createSBVArgumentStatement(
+ String keyword, String arguments) {
+ return createSBVArgumentStatement(createPreprocessorLiteralTextNode(keyword),
+ createPreprocessorLiteralTextNode(arguments));
+ }
+
+ public static IASTSBVArgumentStatement createSBVArgumentStatement(
+ IASTLiteralTextNode keyword,
+ IASTLiteralTextNode arguments) {
+ return new ASTSBVArgumentStatement(keyword, arguments);
+ }
+
+ public static IASTSBVStatement createSBVCommentStatement(String line) {
+ if (line == null)
+ line = ""; //$NON-NLS-1$
+ return new ASTSBVCommentStatement(createPreprocessorTokenStream(line));
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVArgumentStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTLiteralTextNode;
+
+public interface IASTSBVArgumentStatement extends IASTSBVStatement {
+ IASTLiteralTextNode getArgument();
+ void setArgument(IASTLiteralTextNode argument);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVCommentStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTPreprocessorTokenStreamStatement;
+
+public interface IASTSBVCommentStatement extends IASTSBVStatement,
+ IASTPreprocessorTokenStreamStatement {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVFlagStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTKeywordStatement;
+
+/**
+ * Statement representing a standalone flag.
+ *
+ */
+public interface IASTSBVFlagStatement extends IASTKeywordStatement, IASTSBVStatement {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVProblemStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTProblemTopLevelNode;
+
+public interface IASTSBVProblemStatement extends IASTProblemTopLevelNode,
+ IASTSBVStatement {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTStatement;
+
+public interface IASTSBVStatement extends IASTStatement {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/api/cpp/epoc/engine/dom/sbv/IASTSBVTranslationUnit.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTTranslationUnit;
+
+public interface IASTSBVTranslationUnit extends IASTTranslationUnit {
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVArgumentStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.*;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVArgumentStatement;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTKeywordStatement;
+
+
+public class ASTSBVArgumentStatement extends ASTKeywordStatement implements
+ IASTSBVArgumentStatement {
+
+ private IASTLiteralTextNode arguments;
+
+
+ /**
+ * @param keyword
+ * @param arguments
+ */
+ public ASTSBVArgumentStatement(IASTLiteralTextNode keyword, IASTLiteralTextNode argument) {
+ super(keyword);
+ setArgument(argument);
+ dirty = false;
+ }
+
+ /**
+ * @param statement
+ */
+ public ASTSBVArgumentStatement(ASTSBVArgumentStatement statement) {
+ super(statement);
+ setArgument((IASTLiteralTextNode) statement.getArgument().copy());
+ dirty = statement.dirty;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equalValue(IASTNode obj) {
+ if (!(obj instanceof ASTSBVArgumentStatement))
+ return false;
+ if (!super.equalValue(obj))
+ return false;
+
+ ASTSBVArgumentStatement node = (ASTSBVArgumentStatement) obj;
+ return node.arguments.equalValue(arguments);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode() ^ arguments.hashCode() ^ -309982;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.mmp.dom.IASTMMPStatement#getArgumentText()
+ */
+ public IASTLiteralTextNode getArgument() {
+ return arguments;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.mmp.dom.IASTMMPStatement#setArgumentText(com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTLiteralTextNode)
+ */
+ public void setArgument(IASTLiteralTextNode argument) {
+ unparent(this.arguments);
+ if (argument != null)
+ parent(argument);
+ this.arguments = argument;
+ fireChanged();
+ dirty = true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.internal.ASTMMPStatement#copy()
+ */
+ public IASTNode copy() {
+ return new ASTSBVArgumentStatement(this);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTNode#rewrite(com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IRewriteHandler)
+ */
+ public void rewrite(IRewriteHandler handler) {
+ handler.emitNode(getKeyword());
+ handler.emitSpace();
+ handler.emitNode(arguments);
+ handler.emitNewline();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.internal.ASTMMPKeywordStatement#getChildren()
+ */
+ @Override
+ public IASTNode[] getChildren() {
+ return new IASTNode[] { getKeyword(), arguments };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVCommentStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTPreprocessorTokenStream;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVCommentStatement;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTPreprocessorTokenStreamStatement;
+
+
+public class ASTSBVCommentStatement extends ASTPreprocessorTokenStreamStatement
+ implements IASTSBVCommentStatement {
+
+ /**
+ * @param tokenStream
+ */
+ public ASTSBVCommentStatement(IASTPreprocessorTokenStream tokenStream) {
+ super(tokenStream);
+ }
+
+ /**
+ * @param node
+ */
+ public ASTSBVCommentStatement(ASTSBVCommentStatement node) {
+ super(node);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVFlagStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.*;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVFlagStatement;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTKeywordStatement;
+
+
+public class ASTSBVFlagStatement extends ASTKeywordStatement implements
+ IASTSBVFlagStatement {
+
+ /**
+ * @param keyword
+ * @param arguments
+ */
+ public ASTSBVFlagStatement(IASTLiteralTextNode keyword) {
+ super(keyword);
+ }
+
+ /**
+ * @param statement
+ */
+ public ASTSBVFlagStatement(ASTSBVFlagStatement statement) {
+ super(statement);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equalValue(IASTNode obj) {
+ if (!(obj instanceof ASTSBVFlagStatement))
+ return false;
+ return super.equalValue(obj);
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.internal.ASTMMPStatement#copy()
+ */
+ public IASTNode copy() {
+ return new ASTSBVFlagStatement(this);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTNode#rewrite(com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IRewriteHandler)
+ */
+ public void rewrite(IRewriteHandler handler) {
+ handler.emitNode(getKeyword());
+ handler.emitNewline();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVProblemStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTPreprocessorTokenStream;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVProblemStatement;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTProblemTopLevelNode;
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+
+
+public class ASTSBVProblemStatement extends ASTProblemTopLevelNode implements
+ IASTSBVProblemStatement {
+
+ /**
+ * @param tokenStream
+ * @param message
+ */
+ public ASTSBVProblemStatement(IASTPreprocessorTokenStream tokenStream, IMessage message) {
+ super(tokenStream, message);
+ }
+
+ /**
+ * @param statement
+ */
+ public ASTSBVProblemStatement(ASTSBVProblemStatement statement) {
+ super(statement);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTStatement#getKeywordName()
+ */
+ public String getKeywordName() {
+ return null;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVStatement.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVStatement;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTStatement;
+
+
+public abstract class ASTSBVStatement extends ASTStatement implements IASTSBVStatement {
+
+ public ASTSBVStatement() {
+ super();
+ }
+
+ public ASTSBVStatement(ASTSBVStatement other) {
+ super(other);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/dom/sbv/ASTSBVTranslationUnit.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.dom.sbv;
+
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.*;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.IASTSBVTranslationUnit;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTTranslationUnit;
+
+
+public class ASTSBVTranslationUnit extends ASTTranslationUnit implements
+ IASTSBVTranslationUnit {
+
+ public ASTSBVTranslationUnit(
+ IASTListNode<? extends IASTTopLevelNode> nodes) {
+ super(nodes);
+ }
+
+ public ASTSBVTranslationUnit(ASTSBVTranslationUnit unit) {
+ super(unit);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equalValue(IASTNode obj) {
+ if (!(obj instanceof ASTSBVTranslationUnit))
+ return false;
+ return super.equalValue(obj);
+ }
+
+
+}
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ModelProviderBase.java Tue May 12 10:41:34 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/ModelProviderBase.java Tue May 12 10:46:48 2009 -0500
@@ -44,7 +44,7 @@
public abstract class ModelProviderBase implements IModelProvider {
// not static or final so it can change during test
- private boolean DUMP = false;
+ private boolean DUMP = true;
private static int gProviderCounter;
private int providerId;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVModel.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.model.sbv;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+import com.nokia.carbide.cpp.epoc.engine.model.IViewConfiguration;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVOwnedModel;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
+import com.nokia.carbide.internal.cpp.epoc.engine.model.ModelBase;
+
+
+public class SBVModel extends ModelBase<ISBVView> implements ISBVOwnedModel {
+
+ public SBVModel(IPath path, IDocument document) {
+ super(path, document);
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ModelBase#createView(com.nokia.carbide.internal.cpp.epoc.engine.model.ModelBase, com.nokia.carbide.cpp.epoc.engine.model.IViewConfiguration)
+ */
+ @Override
+ protected ISBVView createView(ModelBase model, IViewConfiguration configuration) {
+ return new SBVView(model, configuration);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/model/sbv/SBVView.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.model.sbv;
+
+import java.util.*;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+
+import com.nokia.carbide.cpp.epoc.engine.model.*;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVOwnedModel;
+import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.ASTFactory;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.IASTTopLevelNode;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.*;
+import com.nokia.carbide.internal.cpp.epoc.engine.model.ModelBase;
+import com.nokia.carbide.internal.cpp.epoc.engine.model.ViewBase;
+import com.nokia.carbide.internal.cpp.epoc.engine.parser.IDocumentParser;
+import com.nokia.carbide.internal.cpp.epoc.engine.parser.ParserFactory;
+import com.nokia.cpp.internal.api.utils.core.*;
+
+
+public class SBVView extends ViewBase<ISBVOwnedModel> implements ISBVView {
+
+ /** The name of the variant that this configuration extends */
+ private static final String EXTENDS = "EXTENDS"; //$NON-NLS-1$
+ /** The name of the variant */
+ private static final String VARIANT = "VARIANT"; //$NON-NLS-1$
+ /** Defines the variant as a virtual variant, which means that this variant configuration is not compiled. */
+ private static final String VIRTUAL = "VIRTUAL"; //$NON-NLS-1$
+ /** The global variant hrh file, which is include to the building and image creation. If this parameter is not existing the system tries to include a <variantname>.hrh */
+ private static final String VARIANT_HRH = "VARIANT_HRH"; //$NON-NLS-1$
+ /** set,prepend or append include paths to the global list of build time system includes (Used during abld command). */
+ private static final String BUILD_INCLUDE = "BUILD_INCLUDE"; //$NON-NLS-1$
+ /** set,prepend or append include paths to the global list of rom build time system includes (Used during buildrom.pl command). */
+ private static final String ROM_INCLUDE = "ROM_INCLUDE"; //$NON-NLS-1$
+
+ private IASTSBVTranslationUnit tu;
+ private String variantName;
+ private boolean sawHeaderComment;
+ private boolean sawExtends;
+ private boolean sawBuildHRH;
+ private String extendsVariantStr;
+ private String varintHRHStr;
+ private boolean isVirtual;
+
+ /** Path, flag */
+ private Map<String, String> buildIncludePaths = new HashMap<String, String>();
+
+ /** ROM build includes */
+ private Map<String, String> romBuildIncludePaths = new HashMap<String, String>();;
+
+ /**
+ * @param model
+ * @param parser
+ * @param viewConfiguration
+ */
+ public SBVView(ModelBase model, IViewConfiguration viewConfiguration) {
+ super(model, null, viewConfiguration);
+ tu = null;
+ }
+
+ private void refresh() {
+ extendsVariantStr = ""; //$NON-NLS-1$
+
+ IDocumentParser sbvParser = ParserFactory.createSBVParser();
+ tu = (IASTSBVTranslationUnit) sbvParser.parse(getModel().getPath(), getModel().getDocument());
+
+ sawHeaderComment = false;
+ sawExtends = false;
+ sawBuildHRH = false;
+
+ for (IASTTopLevelNode stmt : tu.getNodes()) {
+ if (stmt instanceof IASTSBVFlagStatement) {
+ String flag = ((IASTSBVFlagStatement) stmt).getKeywordName();
+ handleStatement(flag);
+ } else if (stmt instanceof IASTSBVArgumentStatement) {
+ String option = ((IASTSBVArgumentStatement) stmt).getKeywordName();
+ String value = ((IASTSBVArgumentStatement) stmt).getArgument().getValue();
+ handleStatement(option, value);
+ } else {
+ Check.checkState(false);
+ }
+ }
+ }
+
+ /**
+ * Handle a statement with an option and a value.
+ * @param option
+ * @param value
+ */
+ private void handleStatement(String option, String value) {
+ if (!sawExtends && option.equals(EXTENDS)) {
+ setExtends(value);
+ sawExtends = true;
+ }
+
+ else if (!sawBuildHRH && option.equals(VARIANT_HRH)) {
+ setBuildHRHFile(value);
+ sawBuildHRH = true;
+ }
+
+ else if (option.equals(VARIANT)) {
+ setVariantName(value);
+ }
+
+ else if (option.equals(BUILD_INCLUDE)){
+ addBuildInclude(value);
+ }
+
+ else if (option.equals(ROM_INCLUDE)){
+ addROMInclude(value);
+ }
+
+ }
+
+ /**
+ * Handle a flag statement
+ * @param flag
+ */
+ private void handleStatement(String flag) {
+ if (flag.equals(VIRTUAL)) {
+ setVirtualFlag(true);
+ }
+ }
+
+ @Override
+ public IPath[] getReferencedFiles() {
+ return new IPath[] { model.getPath() };
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ViewBase#internalReparse()
+ */
+ @Override
+ protected Map<IPath, IDocument> internalReparse(Map<IPath, IDocument> overrideDocumentMap) {
+ // empty: nothing new provided yet
+ Map<IPath, IDocument> documentMap = new HashMap<IPath, IDocument>();
+ refresh();
+ return documentMap;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ViewBase#internalRevertChanges()
+ */
+ @Override
+ protected void internalRevertChanges() {
+ refresh();
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ViewBase#internalHasChanges()
+ */
+ @Override
+ protected boolean internalHasChanges() {
+ return false;
+ }
+
+ /**
+ */
+ protected void internalCommit() {
+ // no changes supported
+ }
+
+ @Override
+ public boolean merge() {
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.model.ViewBase#addViewSpecificMessages(java.util.List)
+ */
+ @Override
+ protected void addViewSpecificMessages(List<IMessage> messageList) {
+ IPath fullPath = getModel().getPath();
+ if (!sawHeaderComment) {
+ messageList.add(ASTFactory.createErrorMessage("SBVView.InvalidSBVHeader",
+ new Object[0],
+ new MessageLocation(fullPath)));
+ }
+ if (!sawExtends) {
+ messageList.add(ASTFactory.createErrorMessage("SBVView.NoCustomizesStatement",
+ new Object[0],
+ new MessageLocation(fullPath)));
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#getCustomizes()
+ */
+ public String getExtends() {
+ return extendsVariantStr;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setCustomizes(java.lang.String)
+ */
+ public void setExtends(String platform) {
+ this.extendsVariantStr = platform;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.IView#getData()
+ */
+ public IData getData() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView#setVirtualFlag(boolean)
+ */
+ public void setVirtualFlag(boolean flag) {
+ this.isVirtual = flag;
+ }
+
+ public boolean getVirtualFlag() {
+ return isVirtual;
+ }
+
+ public String getBuildVariantHRH() {
+ return varintHRHStr;
+ }
+
+ public void setBuildHRHFile(String pathStr) {
+ varintHRHStr = pathStr;
+ }
+
+ public void setVariantName(String variantName){
+ this.variantName = variantName;
+ }
+
+ public String getVariantName(){
+ return variantName;
+ }
+
+ public void addBuildInclude(String arguments) {
+ String[] args = arguments.split("\\s+");
+ if (args.length == 2){
+ buildIncludePaths.put(args[1], args[0]);
+ }
+
+ }
+
+ public void addROMInclude(String arguments) {
+ String[] args = arguments.split("\\s+");
+ if (args.length == 2){
+ romBuildIncludePaths.put(args[1], args[0]);
+ }
+
+ }
+
+ public Map<String, String> getBuildIncludes() {
+ return buildIncludePaths;
+ }
+
+ public Map<String, String> getROMBuildIncludes() {
+ return romBuildIncludePaths;
+ }
+
+
+
+}
--- a/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/parser/ParserFactory.java Tue May 12 10:41:34 2009 -0500
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/parser/ParserFactory.java Tue May 12 10:46:48 2009 -0500
@@ -23,6 +23,7 @@
import com.nokia.carbide.internal.cpp.epoc.engine.parser.mmp.MMPParser;
import com.nokia.carbide.internal.cpp.epoc.engine.parser.pkg.IPKGParserConfiguration;
import com.nokia.carbide.internal.cpp.epoc.engine.parser.pkg.PKGParser;
+import com.nokia.carbide.internal.cpp.epoc.engine.parser.sbv.SBVParser;
public abstract class ParserFactory {
@@ -70,6 +71,15 @@
public static IDocumentParser createBSFParser() {
return new BSFParser();
}
+
+ /**
+ * Create a SBV (.var) parser, whose output contains only IASTSBVStatements.
+ * @return
+ */
+ public static IDocumentParser createSBVParser() {
+ return new SBVParser();
+ }
+
/**
* Create a PKG parser, whose output contains only IASTBSFStatements.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/parser/sbv/ISBVParserConfiguration.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.parser.sbv;
+
+
+/**
+ * Extend parser configuration to tell which statements and kinds are recognized, e.g.,
+ * according to the current SDK.
+ * <p>
+ * All the calls are passed a canonical upper-case keyword.
+ *
+ */
+public interface ISBVParserConfiguration {
+ /** Unknown or illegal for this SDK */
+ int UNKNOWN_STATEMENT = 0;
+ /** A statement which appears alone on a line */
+ int FLAG_STATEMENT = 1;
+ /** A statement taking a single argument */
+ int SINGLE_ARGUMENT_STATEMENT = 2;
+ /** A statement with a list of arguments, all alike */
+ int LIST_ARGUMENT_STATEMENT = 3;
+
+ /** Not returned here, but in EMMPStatement */
+ int AIF_STATEMENT = 4;
+ /** Not returned here, but in EMMPStatement */
+ int OPTION_STATEMENT = 5;
+ /** Not returned here, but in EMMPStatement */
+ int START_BLOCK_STATEMENT = 6;
+ /** Not returned here, but in EMMPStatement */
+ int UID_STATEMENT = 7;
+ /** Not returned here, but in EMMPStatement */
+ int BITMAP_SOURCE_STATEMENT = 8;
+
+ /** Is AIF supported? */
+ boolean isAifStatementRecognized();
+ /** Is SOURCE (for START BITMAP) supported? */
+ boolean isBitmapSourceStatementRecognized();
+ /** Is OPTION supported? */
+ boolean isOptionStatementRecognized();
+ /** Is START ... END supported? */
+ boolean isStartBlockStatementRecognized();
+ /** Is UID supported? */
+ boolean isUidStatementRecognized();
+
+ /** Classify this generic statement */
+ int categorizeStatement(String keyword);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/project/com.nokia.carbide.cpp.epoc.engine/src/com/nokia/carbide/internal/cpp/epoc/engine/parser/sbv/SBVParser.java Tue May 12 10:46:48 2009 -0500
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.carbide.internal.cpp.epoc.engine.parser.sbv;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Region;
+
+import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.*;
+import com.nokia.carbide.internal.api.cpp.epoc.engine.dom.sbv.*;
+import com.nokia.carbide.internal.cpp.epoc.engine.dom.ASTUtils;
+import com.nokia.carbide.internal.cpp.epoc.engine.parser.*;
+import com.nokia.cpp.internal.api.utils.core.IMessage;
+import com.nokia.cpp.internal.api.utils.core.MessageLocation;
+
+/**
+ * This is a parser for Symbian Binary Variation (.var).
+ *
+ */
+public class SBVParser implements IDocumentParser {
+ /** Pattern ignoring space, matching a keyword, and allowing for possible options following a space. */
+ /* Avoids consuming trailing space */
+ private static final Pattern KEYWORD_AND_OPTIONS = Pattern.compile(
+ "\\s*((?:\\w|_)+)\\s*(?:\\s+(.*?)(?>\\s+)?)?(\\s*)"); //$NON-NLS-1$
+
+ private IPath path;
+
+ private boolean hadErrors;
+
+ private PositionTrackingReader reader;
+ private int lineNumber;
+ private int lineOffset;
+
+ private IDocument document;
+
+ public SBVParser() {
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.parser.sbv.ISBVParser#parse(org.eclipse.core.runtime.IPath, java.io.Reader)
+ */
+ public IASTSBVTranslationUnit parse(IPath path, IDocument document) {
+ this.document = document;
+ this.reader = new PositionTrackingReader(new StringReader(document.get()));
+ IASTListNode<IASTSBVStatement> stmts = ASTSBVFactory.createSBVStatementListNode();
+ IASTSBVTranslationUnit tu = ASTSBVFactory.createSBVTranslationUnit(stmts);
+ hadErrors = false;
+ try {
+ String line;
+ this.path = path;
+ this.lineOffset = reader.getOffset();
+ this.lineNumber = reader.getLineNumber();
+ while ((line = reader.readLine()) != null) {
+ IASTSBVStatement stmt = parseStatement(line);
+ if (stmt != null) {
+ stmts.add(stmt);
+ }
+ this.lineOffset = reader.getOffset();
+ this.lineNumber = reader.getLineNumber();
+ }
+ } catch (IOException e) {
+ EpocEnginePlugin.log(e);
+ }
+
+ if (!stmts.isEmpty()) {
+ ParserUtils.setSourceRangeForListNode(null, stmts, null);
+ } else {
+ stmts.setSourceRegion(ASTUtils.createDocumentSourceRegion(document, path,
+ new Region(0, 0)));
+ }
+ tu.copySourceInfo(stmts);
+
+ tu.setDirtyTree(false);
+
+ return tu;
+ }
+
+ /* (non-Javadoc)
+ * @see com.nokia.carbide.internal.cpp.epoc.engine.parser.IDocumentParser#hadErrors()
+ */
+ public boolean hadErrors() {
+ return hadErrors;
+ }
+
+ /**
+ * @param line
+ * @return
+ */
+ private IASTSBVStatement parseStatement(String line) {
+ if (line.trim().length() == 0) {
+ return null;
+ }
+
+ IDocumentSourceRegion region = ASTUtils.createDocumentSourceRegion(
+ document,
+ path,
+ new Region(lineOffset, reader.getOffset() - lineOffset));
+
+ IASTSBVStatement stmt = null;
+
+ if (line.startsWith("#")) { //$NON-NLS-1$
+ stmt = ASTSBVFactory.createSBVCommentStatement(line);
+ ((IASTSBVCommentStatement) stmt).getTokenStream().setSourceRegion(region.copy());
+ } else {
+ Matcher matcher = KEYWORD_AND_OPTIONS.matcher(line);
+ if (!matcher.matches()) {
+ return ASTSBVFactory.createSBVProblemStatement(line,
+ ASTFactory.createMessage(IMessage.ERROR,
+ "SBVParser.UnknownStatement", //$NON-NLS-1$
+ new Object[0],
+ getMessageLocation()));
+ }
+
+ String keyword = matcher.group(1).toUpperCase();
+ String arguments = matcher.group(2);
+
+ IASTLiteralTextNode keywordNode = ASTSBVFactory.createPreprocessorLiteralTextNode(keyword);
+ ISourceRegion keywordRegion = ASTUtils.createDocumentSourceRegion(
+ document,
+ path,
+ new Region(lineOffset + matcher.start(1), keyword.length()));
+ keywordNode.setSourceRegion(keywordRegion);
+
+ if (arguments != null) {
+ IASTLiteralTextNode argumentsNode = ASTSBVFactory.createPreprocessorLiteralTextNode(arguments);
+ ISourceRegion argumentsRegion = ASTUtils.createDocumentSourceRegion(
+ document,
+ path,
+ new Region(lineOffset + matcher.start(2), arguments.length()));
+ argumentsNode.setSourceRegion(argumentsRegion);
+
+ stmt = ASTSBVFactory.createSBVArgumentStatement(keywordNode, argumentsNode);
+ } else {
+ stmt = ASTSBVFactory.createSBVFlagStatement(keywordNode);
+ }
+ }
+ stmt.setSourceRegion(region);
+
+ return stmt;
+ }
+
+ /**
+ * @return
+ */
+ private MessageLocation getMessageLocation() {
+ return new MessageLocation(path, lineNumber, 0);
+ }
+
+}