diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml b/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml
index fa91fe6..b03010d 100644
--- a/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/plugin.xml
@@ -1,466 +1,510 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/RDLUiModule.xtend b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/RDLUiModule.xtend
index 62c09b9..4557173 100644
--- a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/RDLUiModule.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/RDLUiModule.xtend
@@ -3,8 +3,8 @@
*/
package com.minres.rdl.ui
-import com.minres.structural.ui.hyperlink.MyHyperlinkHelper
-import com.minres.structural.ui.hyperlink.MyXtextHyperlink
+import com.minres.rdl.ui.hyperlink.RdlHyperlinkHelper
+import com.minres.rdl.ui.hyperlink.RdlXtextHyperlink
import org.eclipse.xtend.lib.annotations.FinalFieldsConstructor
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider
import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider
@@ -36,11 +36,11 @@ class RDLUiModule extends AbstractRDLUiModule {
}
def Class extends HyperlinkHelper> bindHyperlinkHelper() {
- return MyHyperlinkHelper
+ return RdlHyperlinkHelper
}
def Class extends XtextHyperlink> bindHyperlink() {
- return MyXtextHyperlink
+ return RdlXtextHyperlink
}
}
diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/builder/GenerationHandler.java b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/builder/GenerationHandler.java
new file mode 100644
index 0000000..1d369fe
--- /dev/null
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/builder/GenerationHandler.java
@@ -0,0 +1,134 @@
+package com.minres.rdl.ui.builder;
+
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2;
+import org.eclipse.xtext.generator.IGenerator2;
+import org.eclipse.xtext.resource.IResourceDescriptions;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.resource.IResourceSetProvider;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.minres.rdl.generator.RdlGeneratorContext;
+import com.minres.rdl.preferences.PreferenceConstants;
+
+public class GenerationHandler extends AbstractHandler implements IHandler {
+
+ @Inject
+ private IGenerator2 generator;
+
+ @Inject
+ private Provider fileAccessProvider;
+
+ @Inject
+ IResourceDescriptions resourceDescriptions;
+
+ @Inject
+ IResourceSetProvider resourceSetProvider;
+
+ IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE_NAME);
+
+ @Override
+ public Object execute(ExecutionEvent event) {
+ RdlGeneratorContext context = new RdlGeneratorContext();
+ context.cancelIndicator = CancelIndicator.NullImpl;
+ context.namespace = preferences.get(PreferenceConstants.P_NAMESPACE, "sysc");
+ context.forceOverwrite=preferences.getBoolean(PreferenceConstants.P_OVERWRITE_STUBS, false);
+ String whatToGenerate = preferences.get(PreferenceConstants.P_FILETYPES_TO_GENERATE, "all");
+ if(whatToGenerate=="sc-comp") {
+ context.generateFw=false;
+ } else if(whatToGenerate=="fw") {
+ context.generateSc=false;
+ }
+ context.forceOverwrite=preferences.getBoolean(PreferenceConstants.P_OVERWRITE_STUBS, false);
+ context.fwPathModifier=preferences.get(PreferenceConstants.P_FIRMWARE_PATH, "");
+ context.scPathModifier=preferences.get(PreferenceConstants.P_COMPONENT_PATH, "");
+
+ String outputDir = preferences.get("outlet.DEFAULT_OUTPUT.directory", "src-gen");
+ IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
+ IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+ if (activeEditor instanceof XtextEditor && activeEditor == activePart) {
+ IFile file = (IFile) activeEditor.getEditorInput().getAdapter(IFile.class);
+ if (file != null) {
+ final EclipseResourceFileSystemAccess2 fsa = getFsa(outputDir, file, context.fwPathModifier, context.scPathModifier);
+ ((XtextEditor)activeEditor).getDocument().readOnly(new IUnitOfWork() {
+ @Override
+ public Boolean exec(XtextResource state) throws Exception {
+ generator.doGenerate(state, fsa, context);
+ return Boolean.TRUE;
+ }
+ });
+ }
+ } else {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ for (Object element : structuredSelection) {
+ if (element instanceof IFile) {
+ IFile file = (IFile) element;
+ final EclipseResourceFileSystemAccess2 fsa = getFsa(outputDir, file, context.fwPathModifier, context.scPathModifier);
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource r = resourceSetProvider.get(file.getProject()).getResource(uri, true);
+ try {
+ generator.doGenerate(r, fsa, context);
+ } finally {}
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private EclipseResourceFileSystemAccess2 getFsa(String outputDir, IFile file, String fwPath, String scPath) {
+ IProject project = file.getProject();
+ IFolder srcGenFolder = project.getFolder(outputDir);
+ createIfNotExists(srcGenFolder);
+ if(fwPath.length()>0) createIfNotExists(srcGenFolder.getFolder(fwPath));
+ if(scPath.length()>0) createIfNotExists(srcGenFolder.getFolder(scPath));
+ final EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get();
+ fsa.setOutputPath("src-gen");
+ String scGenFolderPath = (fwPath.length()>0? srcGenFolder.getFolder(scPath) : srcGenFolder).getProjectRelativePath().toString();
+ fsa.setOutputPath("sc-incl-out", scGenFolderPath);
+ fsa.setOutputPath("sc-src-out", scGenFolderPath);
+ String fwGenFolderPath = (fwPath.length()>0? srcGenFolder.getFolder(fwPath) : srcGenFolder).getProjectRelativePath().toString();
+ fsa.setOutputPath("fw-incl-out", fwGenFolderPath);
+ fsa.setOutputPath("fw-src-out", fwGenFolderPath);
+ fsa.setProject(project);
+ fsa.setMonitor(new NullProgressMonitor());
+ return fsa;
+ }
+
+ private void createIfNotExists(IFolder srcGenFolder) {
+ if (!srcGenFolder.exists()) {
+ try {
+ srcGenFolder.create(true, true, new NullProgressMonitor());
+ } catch (CoreException e) { }
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+}
diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyHyperlinkHelper.xtend b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlHyperlinkHelper.xtend
similarity index 93%
rename from com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyHyperlinkHelper.xtend
rename to com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlHyperlinkHelper.xtend
index ff233dd..4e3d3d3 100644
--- a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyHyperlinkHelper.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlHyperlinkHelper.xtend
@@ -1,4 +1,4 @@
-package com.minres.structural.ui.hyperlink
+package com.minres.rdl.ui.hyperlink
import com.google.inject.Inject
import org.eclipse.emf.common.util.URI
@@ -13,7 +13,7 @@ import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor
import org.eclipse.xtext.util.TextRegion
import org.eclipse.jface.text.IRegion
-class MyHyperlinkHelper extends HyperlinkHelper {
+class RdlHyperlinkHelper extends HyperlinkHelper {
@Inject ImportUriResolver resolver;
@@ -37,7 +37,7 @@ class MyHyperlinkHelper extends HyperlinkHelper {
result.setHyperlinkRegion(new Region(textRegion.getOffset(), textRegion.getLength()) as IRegion);
result.setURI(if(uri.isPlatformResource()) uri else resource.getResourceSet().getURIConverter().normalize(uri));
result.setHyperlinkText(labelProvider.getText(top));
- if(result instanceof MyXtextHyperlink) result.selectTarget=false
+ if(result instanceof RdlXtextHyperlink) result.selectTarget=false
acceptor.accept(result);
}
}
diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyXtextHyperlink.xtend b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlXtextHyperlink.xtend
similarity index 81%
rename from com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyXtextHyperlink.xtend
rename to com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlXtextHyperlink.xtend
index 9c83a70..5bb4634 100644
--- a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/structural/ui/hyperlink/MyXtextHyperlink.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/hyperlink/RdlXtextHyperlink.xtend
@@ -1,10 +1,10 @@
-package com.minres.structural.ui.hyperlink
+package com.minres.rdl.ui.hyperlink
import com.google.inject.Inject
import org.eclipse.xtext.ui.editor.IURIEditorOpener
import org.eclipse.xtext.ui.editor.hyperlinking.XtextHyperlink
-class MyXtextHyperlink extends XtextHyperlink {
+class RdlXtextHyperlink extends XtextHyperlink {
var boolean select = true
diff --git a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend
index b7b28bb..7ba7059 100644
--- a/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl.ui/src/com/minres/rdl/ui/preferences/RdlPreferencePage.xtend
@@ -8,6 +8,7 @@ import com.minres.rdl.preferences.PreferenceConstants
import org.eclipse.ui.preferences.ScopedPreferenceStore
import org.eclipse.core.runtime.preferences.InstanceScope
import org.eclipse.jface.preference.ComboFieldEditor
+import org.eclipse.jface.preference.StringFieldEditor
class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@@ -21,6 +22,11 @@ class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchP
override createFieldEditors() {
addField(new BooleanFieldEditor(PreferenceConstants.P_GENERATE_CSV, "Generate CSV:", getFieldEditorParent()));
addField(new ComboFieldEditor(PreferenceConstants.P_ADDRESSUNIT, "Address unit size", #[#["Byte (8bit)","byte"], #["Word (16bit)","word"], #["DWord (32bit)","dword"]], getFieldEditorParent()))
+ addField(new StringFieldEditor(PreferenceConstants.P_NAMESPACE, "Namespace of generated SystemC", 30, getFieldEditorParent()))
+ addField(new BooleanFieldEditor(PreferenceConstants.P_OVERWRITE_STUBS, "Always overwrite component stubs", getFieldEditorParent()));
+ addField(new ComboFieldEditor(PreferenceConstants.P_FILETYPES_TO_GENERATE, "File types to generate", #[#["All","all"], #["FW only","fw"], #["SC components","sc-comp"]], getFieldEditorParent()))
+ addField(new StringFieldEditor(PreferenceConstants.P_COMPONENT_PATH, "relative path for SystemC files", 30, getFieldEditorParent()))
+ addField(new StringFieldEditor(PreferenceConstants.P_FIRMWARE_PATH, "relative path for FW files", 30, getFieldEditorParent()))
}
override init(IWorkbench workbench) {
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/RDLRuntimeModule.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/RDLRuntimeModule.xtend
index ea930a2..e8f36da 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/RDLRuntimeModule.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/RDLRuntimeModule.xtend
@@ -26,4 +26,11 @@ class RDLRuntimeModule extends AbstractRDLRuntimeModule {
//return typeof(ResourceSetGlobalScopeProvider)
return typeof(org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider)
}
+// def Class extends IGeneratorConfiguration> bindIGeneratorConfiguration() {
+// return GeneratorConfiguration;
+// }
+// def IGeneratorConfiguration bindIGeneratorConfiguration() {
+// return new GeneratorConfiguration();
+// }
+
}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/AddrmapGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/AddrmapGenerator.xtend
index 24a279c..0008c10 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/AddrmapGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/AddrmapGenerator.xtend
@@ -4,6 +4,7 @@ import com.minres.rdl.rdl.ComponentDefinition
import com.minres.rdl.rdl.ComponentDefinitionType
import static extension com.minres.rdl.RdlUtil.*
+import java.util.Date
class AddrmapGenerator extends RdlBaseGenerator {
@@ -18,8 +19,18 @@ class AddrmapGenerator extends RdlBaseGenerator {
}
override generateHeader(String namespace) {'''
- #ifndef _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
- #define _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
+ /*
+ * Copyright (c) 2019 -2022 MINRES Technologies GmbH
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Created on: «new Date»
+ * * «componentDefinition.effectiveName».h Author:
+ *
+ */
+
+ #pragma once
+
// need double braces, see https://stackoverflow.com/questions/6893700/how-to-construct-stdarray-object-with-initializer-list#6894191
const std::array, «componentDefinition.instanceCount(ComponentDefinitionType.REGFILE)»> «componentDefinition.effectiveName»_map = {{
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwAddrmapGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwAddrmapGenerator.xtend
index 0287e49..8d8d41d 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwAddrmapGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwAddrmapGenerator.xtend
@@ -21,43 +21,17 @@ class FwAddrmapGenerator extends RdlBaseGenerator {
}
override generateHeader(String namespace) {'''
- ////////////////////////////////////////////////////////////////////////////////
- // Copyright (C) 2020-2022, MINRES Technologies GmbH
- // All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are met:
- //
- // 1. Redistributions of source code must retain the above copyright notice,
- // this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright notice,
- // this list of conditions and the following disclaimer in the documentation
- // and/or other materials provided with the distribution.
- //
- // 3. Neither the name of the copyright holder nor the names of its contributors
- // may be used to endorse or promote products derived from this software
- // without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- // POSSIBILITY OF SUCH DAMAGE.
- //
- // Created on: «new Date»
- // * «componentDefinition.name».h Author:
- //
- ////////////////////////////////////////////////////////////////////////////////
+ /*
+ * Copyright (c) 2019 -2022 MINRES Technologies GmbH
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Created on: «new Date»
+ * * «componentDefinition.effectiveName».h Author:
+ *
+ */
- #ifndef _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
- #define _«componentDefinition.effectiveName.toUpperCase»_MAP_H_
+ #pragma once
«FOR instantiation : componentDefinition.instantiationsOfType(ComponentDefinitionType.REGFILE)»
«IF instantiation.component !== null && !nameMap.contains(instantiation.component.name)»
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwRegfileGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwRegfileGenerator.xtend
index 10bdbff..71ad3f9 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwRegfileGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/FwRegfileGenerator.xtend
@@ -22,43 +22,17 @@ class FwRegfileGenerator extends RdlBaseGenerator{
}
override String generateHeader(String namespace)'''
- ////////////////////////////////////////////////////////////////////////////////
- // Copyright (C) 2020-2022, MINRES Technologies GmbH
- // All rights reserved.
- //
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions are met:
- //
- // 1. Redistributions of source code must retain the above copyright notice,
- // this list of conditions and the following disclaimer.
- //
- // 2. Redistributions in binary form must reproduce the above copyright notice,
- // this list of conditions and the following disclaimer in the documentation
- // and/or other materials provided with the distribution.
- //
- // 3. Neither the name of the copyright holder nor the names of its contributors
- // may be used to endorse or promote products derived from this software
- // without specific prior written permission.
- //
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- // POSSIBILITY OF SUCH DAMAGE.
- //
- // Created on: «new Date»
- // * «componentDefinition.name».h Author:
- //
- ////////////////////////////////////////////////////////////////////////////////
+ /*
+ * Copyright (c) 2019 -2022 MINRES Technologies GmbH
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Created on: «new Date»
+ * * «componentDefinition.effectiveName».h Author:
+ *
+ */
- #ifndef _«componentDefinition.name.toUpperCase»_H_
- #define _«componentDefinition.name.toUpperCase»_H_
+ #pragma once
#include
#include
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend
index f227723..9416821 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend
@@ -23,7 +23,9 @@ import java.io.File
class Main {
- val USAGE_STR = "RDL2code [-h] [-v] [-f] [-n ] [-I ] ";
+ val USAGE_STR = '''
+ RDL2code [-h] [-v] [-f] [-fw] [-sc [-n ]] [-I ]
+ '''
def static main(String[] args) {
if (args.empty) {
@@ -56,7 +58,6 @@ class Main {
@Inject JavaIoFileSystemAccess fileAccess
def run(String[] args) {
-
val opt = new Options(args, 0, Integer.MAX_VALUE);
opt.getSet().addOption("h", Multiplicity.ZERO_OR_ONE);
opt.getSet().addOption("v", Multiplicity.ZERO_OR_ONE);
@@ -64,6 +65,8 @@ class Main {
opt.getSet().addOption("n", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
opt.getSet().addOption("o", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
opt.getSet().addOption("I", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
+ opt.getSet().addOption("fw", Multiplicity.ZERO_OR_ONE);
+ opt.getSet().addOption("sc", Multiplicity.ZERO_OR_ONE);
if (!opt.check(false, false)) { // Print usage hints
System.err.println("Usage is: " + USAGE_STR);
throw new MalformedParametersException(opt.getCheckErrors());
@@ -87,19 +90,18 @@ class Main {
fileAccess.outputPath = opt.getSet().getOption('o').getResultValue(0)
fileAccess.outputConfigurations.get(IFileSystemAccess.DEFAULT_OUTPUT)?.setOverrideExistingResources(true)
}
-// #{'incl-out' -> false, 'src-out' -> false, 'gen-out' -> true}.forEach[p1, p2|
-// if(opt.getSet().isSet(p1.substring(0, 1)))
-// fileAccess.setOutputPath(p1, opt.getSet().getOption(p1.substring(0, 1)).getResultValue(0)+'/')
-// else
-// fileAccess.setOutputPath(p1, 'src-gen/')
-// fileAccess.outputConfigurations.get(p1)?.setOverrideExistingResources(p2)
-// ]
- opt.getSet().getData().forEach [ String string |
- if(verbose) println("Processing " + string);
+ val context = new RdlGeneratorContext => [cancelIndicator = CancelIndicator.NullImpl]
+ context.forceOverwrite= opt.getSet().isSet('f')
+ if(opt.getSet().isSet('n'))
+ context.namespace=opt.getSet().getOption('n').getResultValue(0)
+ context.generateFw=opt.getSet().isSet('fw')
+ context.generateSc=opt.getSet().isSet('sc')
+ opt.getSet().getData().forEach [ String fileName |
+ if(verbose) println("Processing " + fileName);
// Load the resource
val resourceSet = resourceSetProvider.get as XtextResourceSet
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
- val resource = resourceSet.getResource(URI.createFileURI(string), true)
+ val resource = resourceSet.getResource(URI.createFileURI(fileName), true)
// Validate the resource
val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl)
if (!issues.empty) {
@@ -107,22 +109,10 @@ class Main {
issues.forEach[System.err.println(it)]
throw new ParseException("error validating " + resource.URI, issues.size)
}
-
- val context = new RdlGeneratorContext => [cancelIndicator = CancelIndicator.NullImpl]
- context.forceOverwrite= opt.getSet().isSet('f')
- if(opt.getSet().isSet('n'))
- context.namespace=opt.getSet().getOption('n').getResultValue(0)
generator.generate(resource, fileAccess, context)
-
- if(verbose) println('Code generation for ' + string + ' finished')
- try {
- if(verbose) println('includes are in ' + fileAccess.getURI('', 'incl-out'))
- } catch (Exception e) {
+ if(verbose) {
+ println('Code generation for ' + fileName + ' finished')
println('includes are in ' + fileAccess.getURI(''))
- }
- try {
- if(verbose) println('sources are in ' + fileAccess.getURI('', 'src-out'))
- } catch (Exception e) {
println('sources are in ' + fileAccess.getURI(''))
}
]
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend_gen b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend_gen
deleted file mode 100644
index de3a94d..0000000
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/Main.xtend_gen
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * generated by Xtext 2.14.0
- */
-package com.minres.rdl.generator
-
-import com.google.inject.Inject
-import com.google.inject.Provider
-import com.minres.rdl.RDLStandaloneSetup
-import org.eclipse.emf.common.util.URI
-import org.eclipse.emf.ecore.resource.ResourceSet
-import org.eclipse.xtext.generator.GeneratorContext
-import org.eclipse.xtext.generator.GeneratorDelegate
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-import org.eclipse.xtext.util.CancelIndicator
-import org.eclipse.xtext.validation.CheckMode
-import org.eclipse.xtext.validation.IResourceValidator
-
-class Main {
-
- def static main(String[] args) {
- if (args.empty) {
- System::err.println('Aborting: no path to EMF resource provided!')
- return
- }
- val injector = new RDLStandaloneSetup().createInjectorAndDoEMFRegistration
- val main = injector.getInstance(Main)
- main.runGenerator(args.get(0))
- }
-
- @Inject Provider resourceSetProvider
-
- @Inject IResourceValidator validator
-
- @Inject GeneratorDelegate generator
-
- @Inject JavaIoFileSystemAccess fileAccess
-
- def protected runGenerator(String string) {
- // Load the resource
- val set = resourceSetProvider.get
- val resource = set.getResource(URI.createFileURI(string), true)
-
- // Validate the resource
- val issues = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl)
- if (!issues.empty) {
- issues.forEach[System.err.println(it)]
- return
- }
-
- // Configure and start the generator
- fileAccess.outputPath = 'src-gen/'
- val context = new GeneratorContext => [
- cancelIndicator = CancelIndicator.NullImpl
- ]
- generator.generate(resource, fileAccess, context)
- System.out.println('Code generation finished.')
- }
-}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/ModuleGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/ModuleGenerator.xtend
index 7392cfb..bbde586 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/ModuleGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/ModuleGenerator.xtend
@@ -22,12 +22,12 @@ class ModuleGenerator extends RdlBaseGenerator {
override generateHeader(String namespace){
if(componentDefinition.type!=ComponentDefinitionType.REGFILE) return ''
- val addrMaps = componentDefinition.eResource.resourceSet.allContents
- .filter[ it instanceof ComponentDefinition]
- .map[it as ComponentDefinition]
- .filter[it.type == ComponentDefinitionType.ADDRMAP]
- .filter[def | def.instantiations.filter[it.componentRef==componentDefinition].size>0]
- if(addrMaps.size==0) return ''
+// val addrMaps = componentDefinition.eResource.resourceSet.allContents
+// .filter[ it instanceof ComponentDefinition]
+// .map[it as ComponentDefinition]
+// .filter[it.type == ComponentDefinitionType.ADDRMAP]
+// .filter[def | def.instantiations.filter[it.componentRef==componentDefinition].size>0]
+// if(addrMaps.size==0) return ''
'''
/*
* Copyright (c) 2019 -2022 MINRES Technologies GmbH
@@ -35,11 +35,13 @@ class ModuleGenerator extends RdlBaseGenerator {
* SPDX-License-Identifier: Apache-2.0
*/
- #ifndef _«namespace.toUpperCase»_«componentDefinition.effectiveName.toUpperCase»_H_
- #define _«namespace.toUpperCase»_«componentDefinition.effectiveName.toUpperCase»_H_
+ #pragma once
+
#include
- namespace «namespace» {
+ «FOR ns : namespace.split('::')»
+ namespace «ns» {
+ «ENDFOR»
namespace gen {
class «componentDefinition.effectiveName»_regs;
}
@@ -58,7 +60,9 @@ class ModuleGenerator extends RdlBaseGenerator {
std::unique_ptr regs;
};
- } /* namespace «namespace» */
+ «FOR ns : namespace.split('::').reverse»
+ } // namespace «ns»
+ «ENDFOR»
#endif /* _«namespace.toUpperCase»_«componentDefinition.effectiveName.toUpperCase»_H_ */
'''
@@ -66,12 +70,12 @@ class ModuleGenerator extends RdlBaseGenerator {
override generateSource(String namespace) {
if(componentDefinition.type!=ComponentDefinitionType.REGFILE) return ''
- val addrMaps = componentDefinition.eResource.resourceSet.allContents
- .filter[ it instanceof ComponentDefinition]
- .map[it as ComponentDefinition]
- .filter[it.type == ComponentDefinitionType.ADDRMAP]
- .filter[def | def.instantiations.filter[it.componentRef==componentDefinition].size>0]
- if(addrMaps.size==0) return ''
+// val addrMaps = componentDefinition.eResource.resourceSet.allContents
+// .filter[ it instanceof ComponentDefinition]
+// .map[it as ComponentDefinition]
+// .filter[it.type == ComponentDefinitionType.ADDRMAP]
+// .filter[def | def.instantiations.filter[it.componentRef==componentDefinition].size>0]
+// if(addrMaps.size==0) return ''
'''
/*
* Copyright (c) 2019 -2022 MINRES Technologies GmbH
@@ -84,7 +88,9 @@ class ModuleGenerator extends RdlBaseGenerator {
#include
- namespace «namespace» {
+ «FOR ns : namespace.split('::')»
+ namespace «ns» {
+ «ENDFOR»
SC_HAS_PROCESS(«componentDefinition.effectiveName»);// NOLINT
«componentDefinition.effectiveName»::«componentDefinition.effectiveName»(sc_core::sc_module_name nm)
@@ -119,7 +125,9 @@ class ModuleGenerator extends RdlBaseGenerator {
}
}
- } /* namespace «namespace» */
+ «FOR ns : namespace.split('::').reverse»
+ } // namespace «ns»
+ «ENDFOR»
'''
}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RDLGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RDLGenerator.xtend
index 9894b9f..059de92 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RDLGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RDLGenerator.xtend
@@ -12,28 +12,28 @@ import org.eclipse.xtext.generator.IGeneratorContext
import static extension com.minres.rdl.RdlUtil.*
import java.util.Map
-/**
- * Generates code from your model files on save.
- *
- * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
- */
class RDLGenerator extends AbstractGenerator {
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
val force = if(context instanceof RdlGeneratorContext) context.forceOverwrite else false
val namespace = if(context instanceof RdlGeneratorContext) context.namespace else "sysc"
+ val genFW = if(context instanceof RdlGeneratorContext) context.generateFw else true
+ val genSC = if(context instanceof RdlGeneratorContext) context.generateSc else true
resource.resourceSet.allContents.filter[ it instanceof ComponentDefinition].map[it as ComponentDefinition].forEach[
val genMap = it.fileGenerator
if(genMap!==null) genMap.forEach[p1, gen |
- val header = gen.generateHeader(namespace)
- val inclFileName = p1+'/'+it.effectiveName+'.h'
- val inclCfg = fsa.outputConfig('incl-out')
- if((force || !fsa.isFile(inclFileName, inclCfg) || gen.overwrite) && header!==null && header.length>0)
- fsa.generateFile(inclFileName, inclCfg, header)
- val source = gen.generateSource(namespace)
- val srcFileName = p1+'/'+it.effectiveName+'.cpp'
- val srcCfg = fsa.outputConfig('src-out')
- if((force || !fsa.isFile(srcFileName, srcCfg) || gen.overwrite) && source!==null && source.length>0)
- fsa.generateFile(srcFileName, srcCfg, source)
+ if((p1=='fw' && genFW) || (p1!='fw' && genSC)) {
+ val header = gen.generateHeader(namespace)
+ val prefix = if(p1=="fw") 'fw-' else 'sc-'
+ val inclFileName = p1+'/'+it.effectiveName+'.h'
+ val inclCfg = fsa.outputConfig(prefix+'incl-out')
+ if((force || !fsa.isFile(inclFileName, inclCfg) || gen.overwrite) && header!==null && header.length>0)
+ fsa.generateFile(inclFileName, inclCfg, header)
+ val source = gen.generateSource(namespace)
+ val srcFileName = p1+'/'+it.effectiveName+'.cpp'
+ val srcCfg = fsa.outputConfig(prefix+'src-out')
+ if((force || !fsa.isFile(srcFileName, srcCfg) || gen.overwrite) && source!==null && source.length>0)
+ fsa.generateFile(srcFileName, srcCfg, source)
+ }
]
]
}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RdlGeneratorContext.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RdlGeneratorContext.xtend
index 495d8ac..798f26e 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RdlGeneratorContext.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RdlGeneratorContext.xtend
@@ -1,8 +1,26 @@
package com.minres.rdl.generator
-import org.eclipse.xtext.generator.GeneratorContext
+import org.eclipse.xtext.util.CancelIndicator
+import org.eclipse.xtext.generator.IGeneratorContext
+
+class RdlGeneratorContext implements IGeneratorContext {
-class RdlGeneratorContext extends GeneratorContext {
public boolean forceOverwrite = false
- public String namespace ="scc"
+
+ public String namespace ="sysc"
+
+ public CancelIndicator cancelIndicator;
+
+ public boolean generateFw = true;
+
+ public String fwPathModifier = ""
+
+ public boolean generateSc = true;
+
+ public String scPathModifier =""
+
+ override getCancelIndicator() {
+ return cancelIndicator
+ }
+
}
\ No newline at end of file
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RegfileGenerator.xtend b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RegfileGenerator.xtend
index 0904c56..b5c833f 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RegfileGenerator.xtend
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/generator/RegfileGenerator.xtend
@@ -32,8 +32,7 @@ class RegfileGenerator extends RdlBaseGenerator{
*
*/
- #ifndef _«namespace.toUpperCase»_GEN_«componentDefinition.effectiveName.toUpperCase»_H_
- #define _«namespace.toUpperCase»_GEN_«componentDefinition.effectiveName.toUpperCase»_H_
+ #pragma once
#include
#include
@@ -45,7 +44,9 @@ class RegfileGenerator extends RdlBaseGenerator{
«ENDIF»
«ENDFOR»
- namespace «namespace» {
+ «FOR ns : namespace.split('::')»
+ namespace «ns» {
+ «ENDFOR»
namespace gen {
class «componentDefinition.effectiveName»_regs :
@@ -128,7 +129,9 @@ class RegfileGenerator extends RdlBaseGenerator{
void registerResources(scc::tlm_target& target, uint64_t offset=0);
};
} // namespace gen
- } // namespace «namespace»
+ «FOR ns : namespace.split('::').reverse»
+ } // namespace «ns»
+ «ENDFOR»
//////////////////////////////////////////////////////////////////////////////
// member functions
//////////////////////////////////////////////////////////////////////////////
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceConstants.java b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceConstants.java
index 9611520..a26694a 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceConstants.java
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceConstants.java
@@ -7,10 +7,19 @@ public class PreferenceConstants {
public static final String SCOPE_NAME = "com.minres.rdl.rdl";
+ public static final String ADDRESSUNIT_PROP = "com.minres.rdl.addrunit";
+
public static final String P_GENERATE_CSV = "booleanCsvPreference";
public static final String P_ADDRESSUNIT = "choiceAddrunitPreference";
- public static final String ADDRESSUNIT_PROP = "com.minres.rdl.addrunit";
+ public static final String P_NAMESPACE = "setNamespacePreference";
+ public static final String P_OVERWRITE_STUBS = "overwriteStubs";
+
+ public static final String P_FILETYPES_TO_GENERATE = "filetypesToGenerate";
+
+ public static final String P_COMPONENT_PATH = "componentPath";
+
+ public static final String P_FIRMWARE_PATH = "firmwarePath";
}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceInitializer.java b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceInitializer.java
index 8bf8d83..a0c8cbe 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceInitializer.java
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/PreferenceInitializer.java
@@ -1,5 +1,8 @@
package com.minres.rdl.preferences;
+import java.util.Arrays;
+import java.util.HashSet;
+
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
@@ -8,6 +11,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
+ private final HashSet valid_addrunit_types = new HashSet(Arrays.asList(new String[]{"byte", "word", "dword"}));
/*
* (non-Javadoc)
*
@@ -18,19 +22,17 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
IEclipsePreferences store = RdlPreferences.getPreferenceStore();
store.putBoolean(PreferenceConstants.P_GENERATE_CSV, true);
String value = System.getProperty(PreferenceConstants.ADDRESSUNIT_PROP);
- if(value!=null){
- if("byte".equals(value)){
- store.put(PreferenceConstants.P_ADDRESSUNIT, "byte");
- } else if("word".equals(value)){
- store.put(PreferenceConstants.P_ADDRESSUNIT, "word");
- } else if("dword".equals(value)){
- store.put(PreferenceConstants.P_ADDRESSUNIT, "dword");
- } else {
- System.err.println("Unknown configuration value: '"+value+"', using 'byte'");
- store.put(PreferenceConstants.P_ADDRESSUNIT, "byte");
- }
- } else
+ if(valid_addrunit_types.contains(value)){
+ store.put(PreferenceConstants.P_ADDRESSUNIT, value);
+ } else {
+ System.err.println("Unknown configuration value: '"+value+"', using 'byte'");
store.put(PreferenceConstants.P_ADDRESSUNIT, "byte");
+ }
+ store.put(PreferenceConstants.P_NAMESPACE, "sysc");
+ store.putBoolean(PreferenceConstants.P_OVERWRITE_STUBS, false);
+ store.put(PreferenceConstants.P_FILETYPES_TO_GENERATE, "all");
+ store.put(PreferenceConstants.P_COMPONENT_PATH, "");
+ store.put(PreferenceConstants.P_FIRMWARE_PATH, "");
}
}
diff --git a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/RdlPreferences.java b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/RdlPreferences.java
index 1cedea5..61ee2c5 100644
--- a/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/RdlPreferences.java
+++ b/com.minres.rdl.parent/com.minres.rdl/src/com/minres/rdl/preferences/RdlPreferences.java
@@ -5,6 +5,10 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
public class RdlPreferences {
+ public static IEclipsePreferences getPreferenceStore() {
+ return InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE_NAME);
+ }
+
public static boolean getGenerateCsv() {
return getPreferenceStore().getBoolean(PreferenceConstants.P_GENERATE_CSV, true);
}
@@ -13,7 +17,23 @@ public class RdlPreferences {
return getPreferenceStore().get(PreferenceConstants.P_ADDRESSUNIT, System.getProperty(PreferenceConstants.ADDRESSUNIT_PROP));
}
- public static IEclipsePreferences getPreferenceStore() {
- return InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE_NAME);
+ public static String getNamespace() {
+ return getPreferenceStore().get(PreferenceConstants.P_NAMESPACE, "sysc");
+ }
+
+ public static boolean getOverwriteStubs() {
+ return getPreferenceStore().getBoolean(PreferenceConstants.P_OVERWRITE_STUBS, false);
+ }
+
+ public static int getFielTypesToGenerate() {
+ return getPreferenceStore().getInt(PreferenceConstants.P_FILETYPES_TO_GENERATE, 3);
+ }
+
+ public static String getComponentPath() {
+ return getPreferenceStore().get(PreferenceConstants.P_COMPONENT_PATH, "");
+ }
+
+ public static String getFirmwarePath() {
+ return getPreferenceStore().get(PreferenceConstants.P_FIRMWARE_PATH, "");
}
}
\ No newline at end of file