diff options
Diffstat (limited to 'plugins/org.eclipse.etrice.core.etphys/src/org')
7 files changed, 619 insertions, 619 deletions
diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhys.xtext b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhys.xtext index 3f021005e..0f3ce5362 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhys.xtext +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhys.xtext @@ -1,92 +1,92 @@ -/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-grammar org.eclipse.etrice.core.etphys.ETPhys with org.eclipse.xtext.common.Terminals
-
-generate eTPhys "http://www.eclipse.org/etrice/core/etphys/ETPhys"
-
-import "http://www.eclipse.org/emf/2002/Ecore" as ecore
-
-PhysicalModel:
- 'PhysicalModel' name=FQN '{'
- (imports+=Import)*
- (
- systems+=PhysicalSystem |
- nodeClasses+=NodeClass |
- runtimeClasses+=RuntimeClass
- )*
- '}'
-;
-
-PhysicalSystem:
- 'PhysicalSystem' name=ID (docu=Documentation)? '{'
- nodeRefs+=NodeRef*
- '}'
-;
-
-NodeRef:
- 'NodeRef' name=ID ':' type=[NodeClass|FQN] (docu=Documentation)?
-;
-
-NodeClass:
- 'NodeClass'name=ID (docu=Documentation)? '{'
- 'runtime' '=' runtime=[RuntimeClass|FQN]
- 'priomin' '=' priomin=PRIO
- 'priomax' '=' priomax=PRIO
- threads+=PhysicalThread*
- '}'
-;
-
-PhysicalThread:
- (default?='DefaultThread' | 'Thread') name=ID '{'
- 'execmode' '=' execmode=ExecMode
- ('interval' '=' time=TIME)?
- 'prio' '=' prio=PRIO
- 'stacksize' '=' stacksize=INT
- 'msgblocksize' '=' msgblocksize=INT
- 'msgpoolsize' '=' msgpoolsize=INT
- '}'
-;
-
-enum ExecMode:
- POLLED='polled' |
- BLOCKED='blocked' |
- MIXED='mixed'
-;
-
-RuntimeClass:
- 'RuntimeClass' name=ID (docu=Documentation)? '{'
- 'model' '=' threadModel=ThreadModel
- '}'
-;
-
-enum ThreadModel:
- SINGLE_THREADED='singleThreaded' |
- MULTI_THREADED='multiThreaded'
-;
-
-Documentation: '['
- text+=STRING+
- ']';
-
-PRIO returns ecore::EInt hidden(): ('+'|'-')? INT;
-
-Import :
- 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;
-
-ImportedFQN:
- FQN ('.*')?;
-
-FQN:
- ID ('.' ID)*;
-
-TIME returns ecore::EInt: (INT 's') | (INT 'ms') | (INT 'us') | (INT 'ns');
+/******************************************************************************* + * Copyright (c) 2012 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +grammar org.eclipse.etrice.core.etphys.ETPhys with org.eclipse.xtext.common.Terminals + +generate eTPhys "http://www.eclipse.org/etrice/core/etphys/ETPhys" + +import "http://www.eclipse.org/emf/2002/Ecore" as ecore + +PhysicalModel: + 'PhysicalModel' name=FQN '{' + (imports+=Import)* + ( + systems+=PhysicalSystem | + nodeClasses+=NodeClass | + runtimeClasses+=RuntimeClass + )* + '}' +; + +PhysicalSystem: + 'PhysicalSystem' name=ID (docu=Documentation)? '{' + nodeRefs+=NodeRef* + '}' +; + +NodeRef: + 'NodeRef' name=ID ':' type=[NodeClass|FQN] (docu=Documentation)? +; + +NodeClass: + 'NodeClass'name=ID (docu=Documentation)? '{' + 'runtime' '=' runtime=[RuntimeClass|FQN] + 'priomin' '=' priomin=PRIO + 'priomax' '=' priomax=PRIO + threads+=PhysicalThread* + '}' +; + +PhysicalThread: + (default?='DefaultThread' | 'Thread') name=ID '{' + 'execmode' '=' execmode=ExecMode + ('interval' '=' time=TIME)? + 'prio' '=' prio=PRIO + 'stacksize' '=' stacksize=INT + 'msgblocksize' '=' msgblocksize=INT + 'msgpoolsize' '=' msgpoolsize=INT + '}' +; + +enum ExecMode: + POLLED='polled' | + BLOCKED='blocked' | + MIXED='mixed' +; + +RuntimeClass: + 'RuntimeClass' name=ID (docu=Documentation)? '{' + 'model' '=' threadModel=ThreadModel + '}' +; + +enum ThreadModel: + SINGLE_THREADED='singleThreaded' | + MULTI_THREADED='multiThreaded' +; + +Documentation: '[' + text+=STRING+ + ']'; + +PRIO returns ecore::EInt hidden(): ('+'|'-')? INT; + +Import : + 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING; + +ImportedFQN: + FQN ('.*')?; + +FQN: + ID ('.' ID)*; + +TIME returns ecore::EInt: (INT 's') | (INT 'ms') | (INT 'us') | (INT 'ns'); diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhysPostprocessor.ext b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhysPostprocessor.ext index 85a5fa1c6..949f818b8 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhysPostprocessor.ext +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/ETPhysPostprocessor.ext @@ -1,17 +1,17 @@ -/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug
- *
- *******************************************************************************/
-
-import xtext;
-
-process(GeneratedMetamodel this) :
- JAVA org.eclipse.etrice.core.etphys.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel)
+/******************************************************************************* + * Copyright (c) 2012 Juergen Haug + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug + * + *******************************************************************************/ + +import xtext; + +process(GeneratedMetamodel this) : + JAVA org.eclipse.etrice.core.etphys.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel) ;
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/GenerateETPhys.mwe2 b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/GenerateETPhys.mwe2 index f8109cfac..472e829cb 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/GenerateETPhys.mwe2 +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/GenerateETPhys.mwe2 @@ -1,149 +1,149 @@ -/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-module org.eclipse.etrice.core.etphys.GenerateETPhys
-
-import org.eclipse.emf.mwe.utils.*
-import org.eclipse.xtext.generator.*
-import org.eclipse.xtext.ui.generator.*
-
-var grammarURI = "classpath:/org/eclipse/etrice/core/etphys/ETPhys.xtext"
-var file.extensions = "etphys"
-var projectName = "org.eclipse.etrice.core.etphys"
-var runtimeProject = "../${projectName}"
-
-Workflow {
- bean = StandaloneSetup {
- scanClassPath = true
- platformUri = "${runtimeProject}/.."
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}/src-gen"
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}.ui/src-gen"
- }
-
- component = Generator {
- pathRtProject = runtimeProject
- pathUiProject = "${runtimeProject}.ui"
- pathTestProject = "../../tests/${projectName}.tests"
- projectNameRt = projectName
- projectNameUi = "${projectName}.ui"
- language = {
- uri = grammarURI
- fileExtensions = file.extensions
-
- // Java API to access grammar elements (required by several other fragments)
- fragment = grammarAccess.GrammarAccessFragment {}
-
- // generates Java API for the generated EPackages
- fragment = ecore.EcoreGeneratorFragment {
- // referencedGenModels = "
- // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
- // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
- // "
- }
-
- // Serializer 2.0
- fragment = serializer.SerializerFragment {
- generateStub = false
- }
-
- // the serialization component (1.0)
- // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
-
- // a custom ResourceFactory for use with EMF
- fragment = resourceFactory.ResourceFactoryFragment {
- fileExtensions = file.extensions
- }
-
- // The antlr parser generator fragment.
- fragment = parser.antlr.XtextAntlrGeneratorFragment {
- // options = {
- // backtrack = true
- // }
- }
-
- // java-based API for validation
- fragment = validation.JavaValidatorFragment {
- composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
- composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
- }
-
- // scoping and exporting API
- // fragment = scoping.ImportURIScopingFragment {}
- // fragment = exporting.SimpleNamesFragment {}
-
- // scoping and exporting API
- fragment = scoping.ImportURIScopingFragment {}
- //fragment = scoping.ImportNamespacesScopingFragment {}
- fragment = exporting.QualifiedNamesFragment {}
- //fragment = builder.BuilderIntegrationFragment {}
-
- // generator API
- fragment = generator.GeneratorFragment {
- generateMwe = false
- generateJavaMain = false
- }
-
- // formatter API
- fragment = formatting.FormatterFragment {}
-
- // labeling API
- fragment = labeling.LabelProviderFragment {}
-
- // outline API
- fragment = outline.OutlineTreeProviderFragment {}
- fragment = outline.QuickOutlineFragment {}
-
- // quickfix API
- fragment = quickfix.QuickfixProviderFragment {}
-
- // content assist API
- fragment = contentAssist.JavaBasedContentAssistFragment {}
-
- // generates a more lightweight Antlr parser and lexer tailored for content assist
- fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
-
- // generates junit test support classes into Generator#pathTestProject
- fragment = junit.Junit4Fragment {}
-
- // project wizard (optional)
- // fragment = projectWizard.SimpleProjectWizardFragment {
- // generatorProjectName = "${projectName}"
- // modelFileExtension = file.extensions
- // }
-
- // rename refactoring
- fragment = refactoring.RefactorElementNameFragment {}
-
- // provides the necessary bindings for java types integration
- //fragment = types.TypesGeneratorFragment {}
-
- // generates the required bindings only if the grammar inherits from Xbase
- fragment = xbase.XbaseGeneratorFragment {}
-
- // provides a preference page for template proposals
- fragment = templates.CodetemplatesGeneratorFragment {}
-
- // provides a compare view
- fragment = compare.CompareFragment {
- fileExtensions = file.extensions
- }
-
- }
- }
-}
-
+/******************************************************************************* + * Copyright (c) 2012 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +module org.eclipse.etrice.core.etphys.GenerateETPhys + +import org.eclipse.emf.mwe.utils.* +import org.eclipse.xtext.generator.* +import org.eclipse.xtext.ui.generator.* + +var grammarURI = "classpath:/org/eclipse/etrice/core/etphys/ETPhys.xtext" +var file.extensions = "etphys" +var projectName = "org.eclipse.etrice.core.etphys" +var runtimeProject = "../${projectName}" + +Workflow { + bean = StandaloneSetup { + scanClassPath = true + platformUri = "${runtimeProject}/.." + } + + component = DirectoryCleaner { + directory = "${runtimeProject}/src-gen" + } + + component = DirectoryCleaner { + directory = "${runtimeProject}.ui/src-gen" + } + + component = Generator { + pathRtProject = runtimeProject + pathUiProject = "${runtimeProject}.ui" + pathTestProject = "../../tests/${projectName}.tests" + projectNameRt = projectName + projectNameUi = "${projectName}.ui" + language = { + uri = grammarURI + fileExtensions = file.extensions + + // Java API to access grammar elements (required by several other fragments) + fragment = grammarAccess.GrammarAccessFragment {} + + // generates Java API for the generated EPackages + fragment = ecore.EcoreGeneratorFragment { + // referencedGenModels = " + // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel, + // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel + // " + } + + // Serializer 2.0 + fragment = serializer.SerializerFragment { + generateStub = false + } + + // the serialization component (1.0) + // fragment = parseTreeConstructor.ParseTreeConstructorFragment {} + + // a custom ResourceFactory for use with EMF + fragment = resourceFactory.ResourceFactoryFragment { + fileExtensions = file.extensions + } + + // The antlr parser generator fragment. + fragment = parser.antlr.XtextAntlrGeneratorFragment { + // options = { + // backtrack = true + // } + } + + // java-based API for validation + fragment = validation.JavaValidatorFragment { + composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" + composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" + } + + // scoping and exporting API + // fragment = scoping.ImportURIScopingFragment {} + // fragment = exporting.SimpleNamesFragment {} + + // scoping and exporting API + fragment = scoping.ImportURIScopingFragment {} + //fragment = scoping.ImportNamespacesScopingFragment {} + fragment = exporting.QualifiedNamesFragment {} + //fragment = builder.BuilderIntegrationFragment {} + + // generator API + fragment = generator.GeneratorFragment { + generateMwe = false + generateJavaMain = false + } + + // formatter API + fragment = formatting.FormatterFragment {} + + // labeling API + fragment = labeling.LabelProviderFragment {} + + // outline API + fragment = outline.OutlineTreeProviderFragment {} + fragment = outline.QuickOutlineFragment {} + + // quickfix API + fragment = quickfix.QuickfixProviderFragment {} + + // content assist API + fragment = contentAssist.JavaBasedContentAssistFragment {} + + // generates a more lightweight Antlr parser and lexer tailored for content assist + fragment = parser.antlr.XtextAntlrUiGeneratorFragment {} + + // generates junit test support classes into Generator#pathTestProject + fragment = junit.Junit4Fragment {} + + // project wizard (optional) + // fragment = projectWizard.SimpleProjectWizardFragment { + // generatorProjectName = "${projectName}" + // modelFileExtension = file.extensions + // } + + // rename refactoring + fragment = refactoring.RefactorElementNameFragment {} + + // provides the necessary bindings for java types integration + //fragment = types.TypesGeneratorFragment {} + + // generates the required bindings only if the grammar inherits from Xbase + fragment = xbase.XbaseGeneratorFragment {} + + // provides a preference page for template proposals + fragment = templates.CodetemplatesGeneratorFragment {} + + // provides a compare view + fragment = compare.CompareFragment { + fileExtensions = file.extensions + } + + } + } +} + diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/ETPhysConverter.java b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/ETPhysConverter.java index 69c6accef..33148692c 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/ETPhysConverter.java +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/ETPhysConverter.java @@ -1,31 +1,31 @@ -/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etphys.converters;
-
-import org.eclipse.xtext.common.services.DefaultTerminalConverters;
-import org.eclipse.xtext.conversion.IValueConverter;
-import org.eclipse.xtext.conversion.ValueConverter;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class ETPhysConverter extends DefaultTerminalConverters {
-
- private TimeConverter timeConverter = new TimeConverter();
-
- @ValueConverter(rule="TIME")
- public IValueConverter<Integer> getTimeConverter() {
- return timeConverter;
- }
-}
+/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.core.etphys.converters; + +import org.eclipse.xtext.common.services.DefaultTerminalConverters; +import org.eclipse.xtext.conversion.IValueConverter; +import org.eclipse.xtext.conversion.ValueConverter; + +/** + * @author Henrik Rentz-Reichert + * + */ +public class ETPhysConverter extends DefaultTerminalConverters { + + private TimeConverter timeConverter = new TimeConverter(); + + @ValueConverter(rule="TIME") + public IValueConverter<Integer> getTimeConverter() { + return timeConverter; + } +} diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/TimeConverter.java b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/TimeConverter.java index f52f6678e..af6045af4 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/TimeConverter.java +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/converters/TimeConverter.java @@ -1,66 +1,66 @@ -/*******************************************************************************
- * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etphys.converters;
-
-import org.eclipse.xtext.conversion.ValueConverterException;
-import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter;
-import org.eclipse.xtext.nodemodel.INode;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class TimeConverter extends AbstractLexerBasedConverter<Integer> {
-
- /* (non-Javadoc)
- * @see org.eclipse.xtext.conversion.IValueConverter#toValue(java.lang.String, org.eclipse.xtext.nodemodel.INode)
- */
- @Override
- public Integer toValue(String string, INode node) throws ValueConverterException {
- if (string==null || string.isEmpty())
- throw new ValueConverterException("Couldn't convert empty string to time.", node, null);
- else {
- // determine power and extract number
- int power;
- int pos;
- String value;
- if ((pos=string.indexOf("ns"))>0) {
- value = string.substring(0,pos);
- power = 1;
- }
- else if ((pos=string.indexOf("us"))>0) {
- value = string.substring(0,pos);
- power = 1000;
- }
- else if ((pos=string.indexOf("ms"))>0) {
- value = string.substring(0,pos);
- power = 1000000;
- }
- else if ((pos=string.indexOf("s"))>0) {
- value = string.substring(0,pos);
- power = 1000000000;
- }
- else
- throw new ValueConverterException("No unit specified with time (s, ms, us or ns).", node, null);
-
- try {
- int val = Integer.parseInt(value.trim());
- return Integer.valueOf(val)*power;
- }
- catch (NumberFormatException e) {
- throw new ValueConverterException("Could not parse time value.", node, e);
- }
- }
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2013 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Henrik Rentz-Reichert (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.core.etphys.converters; + +import org.eclipse.xtext.conversion.ValueConverterException; +import org.eclipse.xtext.conversion.impl.AbstractLexerBasedConverter; +import org.eclipse.xtext.nodemodel.INode; + +/** + * @author Henrik Rentz-Reichert + * + */ +public class TimeConverter extends AbstractLexerBasedConverter<Integer> { + + /* (non-Javadoc) + * @see org.eclipse.xtext.conversion.IValueConverter#toValue(java.lang.String, org.eclipse.xtext.nodemodel.INode) + */ + @Override + public Integer toValue(String string, INode node) throws ValueConverterException { + if (string==null || string.isEmpty()) + throw new ValueConverterException("Couldn't convert empty string to time.", node, null); + else { + // determine power and extract number + int power; + int pos; + String value; + if ((pos=string.indexOf("ns"))>0) { + value = string.substring(0,pos); + power = 1; + } + else if ((pos=string.indexOf("us"))>0) { + value = string.substring(0,pos); + power = 1000; + } + else if ((pos=string.indexOf("ms"))>0) { + value = string.substring(0,pos); + power = 1000000; + } + else if ((pos=string.indexOf("s"))>0) { + value = string.substring(0,pos); + power = 1000000000; + } + else + throw new ValueConverterException("No unit specified with time (s, ms, us or ns).", node, null); + + try { + int val = Integer.parseInt(value.trim()); + return Integer.valueOf(val)*power; + } + catch (NumberFormatException e) { + throw new ValueConverterException("Could not parse time value.", node, e); + } + } + } + +} diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.xtend b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.xtend index e63b9720f..3f9f06992 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.xtend +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/DocuPostprocessor.xtend @@ -1,244 +1,244 @@ -/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etphys.postprocessing
-
-import org.eclipse.xtext.GeneratedMetamodel
-
-import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
-
-class DocuPostprocessor {
-
- def process(GeneratedMetamodel metamodel) {
- val pckg = metamodel.EPackage
-
- //------------------------------------------------------------------
- var cls = pckg.getClass("PhysicalModel")
- cls.setDocumentation(
- '''
- The root object for the physical model. It gives access to the systems, node classes
- and runtimes defined.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The model name is a dot separated fully qualified name and is
- used to provide a name space.
- ''')
-
- cls.getReference("imports").setDocumentation(
- '''
- A list of all imported models.
- ''')
-
- cls.getReference("systems").setDocumentation(
- '''
- A list of all defined physical systems.
- ''')
-
- cls.getReference("nodeClasses").setDocumentation(
- '''
- A list of all defined node classes.
- ''')
-
- cls.getReference("runtimeClasses").setDocumentation(
- '''
- A list of all defined runtime classes.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("PhysicalSystem")
- cls.setDocumentation(
- '''
- This model object represents a complete physical system.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The name of the physical system by which it is referred to in the model.
- ''')
-
- cls.getReference("nodeRefs").setDocumentation(
- '''
- A list of referenced nodes.
- ''')
-
- cls.getReference("docu").setDocumentation(
- '''
- This is an optional documentation.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("NodeRef")
- cls.setDocumentation(
- '''
- This stands for a node instance in a specific role.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The name of the reference by which it is referred to in the model.
- ''')
-
- cls.getReference("type").setDocumentation(
- '''
- The node class of this reference.
- ''')
-
- cls.getReference("docu").setDocumentation(
- '''
- This is an optional documentation.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("NodeClass")
- cls.setDocumentation(
- '''
- This defines a node class.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The name of the node class by which it is referred to in the model.
- ''')
-
- cls.getReference("docu").setDocumentation(
- '''
- This is an optional documentation.
- ''')
-
- cls.getReference("runtime").setDocumentation(
- '''
- This is the associated runtime class.
- ''')
-
- cls.getAttribute("priomin").setDocumentation(
- '''
- This is the minimal thread priority for this node type.
- ''')
-
- cls.getAttribute("priomax").setDocumentation(
- '''
- This is the maximum thread priority for this node type.
- ''')
-
- cls.getReference("threads").setDocumentation(
- '''
- This is a list of all threads defined for this node.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("PhysicalThread")
- cls.setDocumentation(
- '''
- This defines a physical thread running in a node.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The name of the thread by which it is referred to in the model.
- ''')
-
- cls.getAttribute("default").setDocumentation(
- '''
- If this is {@code true} then this is the default thread.
- ''')
-
- cls.getAttribute("execmode").setDocumentation(
- '''
- This is the execution mode of the thread.
- ''')
-
- cls.getAttribute("prio").setDocumentation(
- '''
- This is the priority of the thread.
- ''')
-
- cls.getAttribute("stacksize").setDocumentation(
- '''
- This is the stacksize of the thread.
- ''')
-
- cls.getAttribute("msgblocksize").setDocumentation(
- '''
- This is the msgblocksize of the thread.
- ''')
-
- cls.getAttribute("msgpoolsize").setDocumentation(
- '''
- This is the msgpoolsize of the thread.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("RuntimeClass")
- cls.setDocumentation(
- '''
- This defines a runtime class.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The name of the runtime class by which it is referred to in the model.
- ''')
-
- cls.getReference("docu").setDocumentation(
- '''
- This is an optional documentation.
- ''')
-
- cls.getAttribute("threadModel").setDocumentation(
- '''
- This distinguishes single and multi threaded.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("Documentation")
- cls.setDocumentation('''
- A piece of documentation that can be optionally attached at
- certain places in the model.
- ''')
-
- cls.getAttribute("text").setDocumentation(
- '''
- This is the documentation's contents.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("Import")
- cls.setDocumentation('''
- The import declares an imported model (given as a URI) and
- an optional imported namespace.
- ''')
-
- cls.getAttribute("importedNamespace").setDocumentation(
- '''
- The imported name space has to be a dot separated qualified name followed by .*.
- Example: my.namespace.*
- ''')
-
- cls.getAttribute("importURI").setDocumentation(
- '''
- The import URI can be a relative or absolute file system path.
- It may contain environment variables in ${} which will be expanded.
- <p>
- Examples:
- <ul>
- <li>import model "AnotherModel.room"</li>
- <li>import my.namespace.* from "AnotherModel.room"</li>
- <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
- <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
- </ul>
- </p>
- ''')
- }
-
+/******************************************************************************* + * Copyright (c) 2012 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.core.etphys.postprocessing + +import org.eclipse.xtext.GeneratedMetamodel + +import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.* + +class DocuPostprocessor { + + def process(GeneratedMetamodel metamodel) { + val pckg = metamodel.EPackage + + //------------------------------------------------------------------ + var cls = pckg.getClass("PhysicalModel") + cls.setDocumentation( + ''' + The root object for the physical model. It gives access to the systems, node classes + and runtimes defined. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The model name is a dot separated fully qualified name and is + used to provide a name space. + ''') + + cls.getReference("imports").setDocumentation( + ''' + A list of all imported models. + ''') + + cls.getReference("systems").setDocumentation( + ''' + A list of all defined physical systems. + ''') + + cls.getReference("nodeClasses").setDocumentation( + ''' + A list of all defined node classes. + ''') + + cls.getReference("runtimeClasses").setDocumentation( + ''' + A list of all defined runtime classes. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("PhysicalSystem") + cls.setDocumentation( + ''' + This model object represents a complete physical system. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The name of the physical system by which it is referred to in the model. + ''') + + cls.getReference("nodeRefs").setDocumentation( + ''' + A list of referenced nodes. + ''') + + cls.getReference("docu").setDocumentation( + ''' + This is an optional documentation. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("NodeRef") + cls.setDocumentation( + ''' + This stands for a node instance in a specific role. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The name of the reference by which it is referred to in the model. + ''') + + cls.getReference("type").setDocumentation( + ''' + The node class of this reference. + ''') + + cls.getReference("docu").setDocumentation( + ''' + This is an optional documentation. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("NodeClass") + cls.setDocumentation( + ''' + This defines a node class. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The name of the node class by which it is referred to in the model. + ''') + + cls.getReference("docu").setDocumentation( + ''' + This is an optional documentation. + ''') + + cls.getReference("runtime").setDocumentation( + ''' + This is the associated runtime class. + ''') + + cls.getAttribute("priomin").setDocumentation( + ''' + This is the minimal thread priority for this node type. + ''') + + cls.getAttribute("priomax").setDocumentation( + ''' + This is the maximum thread priority for this node type. + ''') + + cls.getReference("threads").setDocumentation( + ''' + This is a list of all threads defined for this node. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("PhysicalThread") + cls.setDocumentation( + ''' + This defines a physical thread running in a node. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The name of the thread by which it is referred to in the model. + ''') + + cls.getAttribute("default").setDocumentation( + ''' + If this is {@code true} then this is the default thread. + ''') + + cls.getAttribute("execmode").setDocumentation( + ''' + This is the execution mode of the thread. + ''') + + cls.getAttribute("prio").setDocumentation( + ''' + This is the priority of the thread. + ''') + + cls.getAttribute("stacksize").setDocumentation( + ''' + This is the stacksize of the thread. + ''') + + cls.getAttribute("msgblocksize").setDocumentation( + ''' + This is the msgblocksize of the thread. + ''') + + cls.getAttribute("msgpoolsize").setDocumentation( + ''' + This is the msgpoolsize of the thread. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("RuntimeClass") + cls.setDocumentation( + ''' + This defines a runtime class. + ''') + + cls.getAttribute("name").setDocumentation( + ''' + The name of the runtime class by which it is referred to in the model. + ''') + + cls.getReference("docu").setDocumentation( + ''' + This is an optional documentation. + ''') + + cls.getAttribute("threadModel").setDocumentation( + ''' + This distinguishes single and multi threaded. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("Documentation") + cls.setDocumentation(''' + A piece of documentation that can be optionally attached at + certain places in the model. + ''') + + cls.getAttribute("text").setDocumentation( + ''' + This is the documentation's contents. + ''') + + //------------------------------------------------------------------ + cls = pckg.getClass("Import") + cls.setDocumentation(''' + The import declares an imported model (given as a URI) and + an optional imported namespace. + ''') + + cls.getAttribute("importedNamespace").setDocumentation( + ''' + The imported name space has to be a dot separated qualified name followed by .*. + Example: my.namespace.* + ''') + + cls.getAttribute("importURI").setDocumentation( + ''' + The import URI can be a relative or absolute file system path. + It may contain environment variables in ${} which will be expanded. + <p> + Examples: + <ul> + <li>import model "AnotherModel.room"</li> + <li>import my.namespace.* from "AnotherModel.room"</li> + <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li> + <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li> + </ul> + </p> + ''') + } + }
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/PostprocessorController.java b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/PostprocessorController.java index b6bf950de..d327b2b4b 100644 --- a/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/PostprocessorController.java +++ b/plugins/org.eclipse.etrice.core.etphys/src/org/eclipse/etrice/core/etphys/postprocessing/PostprocessorController.java @@ -1,22 +1,22 @@ -/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etphys.postprocessing;
-
-import org.eclipse.xtext.GeneratedMetamodel;
-
-public class PostprocessorController {
-
- public static void process(GeneratedMetamodel metamodel){
- new DocuPostprocessor().process(metamodel);
- }
-}
+/******************************************************************************* + * Copyright (c) 2012 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * CONTRIBUTORS: + * Juergen Haug + * + *******************************************************************************/ + +package org.eclipse.etrice.core.etphys.postprocessing; + +import org.eclipse.xtext.GeneratedMetamodel; + +public class PostprocessorController { + + public static void process(GeneratedMetamodel metamodel){ + new DocuPostprocessor().process(metamodel); + } +} |