Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port the C++ Generator to Kotlin #345

Merged
merged 146 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
2577596
cpp: move the old xtend based generator
cmnrd May 20, 2021
99dd25b
cpp: add minimal version of cpp generator in kotlin that compiles
cmnrd May 20, 2021
6340d6b
cpp: add copyright header
cmnrd May 20, 2021
bc655b2
cpp: add stub implementation of doGenerate()
cmnrd May 20, 2021
aae7cd0
cpp: port the check for main
cmnrd May 20, 2021
e904b7b
cpp: start by copying the static files
cmnrd May 20, 2021
f7de049
cpp: and (incomplete) port of the generateCmake method
cmnrd May 20, 2021
d887fdc
cpp: improve escaping of $ sign
cmnrd May 20, 2021
e2d667f
cpp: use kotlins builtin TODO function
cmnrd May 20, 2021
710a9b3
cpp: some improvements that intellij told me to do...
cmnrd May 20, 2021
35190ca
cpp: move control flow from string templates to code
cmnrd May 20, 2021
a83e795
cpp: reorganizing code
cmnrd May 21, 2021
164ae30
cpp: fixes
cmnrd May 21, 2021
e339d90
cpp: properly handle severity levels
cmnrd May 21, 2021
5bf3e0b
cpp: add code for generating paths from resources/reactors
cmnrd May 21, 2021
0a6c59d
cpp: introduce the .. operator for handling indentation of multiline …
cmnrd May 21, 2021
94e6a88
cpp: list all generated source files in the cmake script
cmnrd May 21, 2021
9241209
cpp: clean up a little
cmnrd May 21, 2021
97b4138
cpp: remove ported code from old xtend file
cmnrd May 21, 2021
8a59d63
cpp: fix a typo and add a todo
cmnrd May 21, 2021
8000616
cpp: add conversion functions for time units
cmnrd May 21, 2021
402a785
cpp: add incomplete function for generating main.cc
cmnrd May 21, 2021
8c7229c
cpp: port compilation code
cmnrd May 21, 2021
e71693f
cpp: bugfix
cmnrd May 21, 2021
66bfb20
cpp: port useful reaction extensions
cmnrd May 21, 2021
149c90d
cpp: port code for declaring reactions
cmnrd May 21, 2021
5332bf5
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
oowekyala May 23, 2021
b9f04c9
Fix compilation issue
oowekyala May 23, 2021
8c9af1c
cpp: move default runtime version to the companion object
cmnrd May 26, 2021
47a98be
cpp: small improvements as suggested by Clément
cmnrd May 26, 2021
f5652f2
cpp: use replaceIndent instead of prependIndent
cmnrd May 26, 2021
e5fa113
cpp: reformat and small bugfix
cmnrd May 26, 2021
8476f27
cpp: convert CppFileConfig to Kotlin
cmnrd May 26, 2021
2a68afe
cpp: move code to new cpp sub-package
cmnrd May 26, 2021
81dc2fd
cpp: move common extensions to separate file
cmnrd May 26, 2021
8e4df51
cpp: move some extension functions to separate extensions module
cmnrd May 26, 2021
96abc6a
cpp: move path functions to CppFileConfig
cmnrd May 26, 2021
c05691c
cpp: move fileComment() functions to extensions
cmnrd May 26, 2021
59842c9
cpp: first step at generating source files and headers
cmnrd May 26, 2021
0295b13
cpp: bugfix
cmnrd May 26, 2021
202c02e
cpp: generate code for file level preambles
cmnrd May 26, 2021
1524831
cpp: bug fixes
cmnrd May 26, 2021
bfba8f3
Fix problem with Guice @Inject in generator
oowekyala May 27, 2021
c97d131
cpp: port constructor generation
cmnrd May 27, 2021
8f172be
cpp: generate reaction code
cmnrd May 27, 2021
ac61fa8
cpp: add AST extensions for inferring types
cmnrd May 27, 2021
1c6de59
cpp: add more utilities for dealing with types
cmnrd May 27, 2021
ac5594f
cpp: generate code for actions
cmnrd May 27, 2021
aa1cda5
cpp: generate the assemble method
cmnrd May 27, 2021
d5e3214
cpp: bugfixes
cmnrd May 27, 2021
41e01e7
cpp: generate code for timers
cmnrd May 27, 2021
5a2af85
cpp: bugfix
cmnrd May 27, 2021
1d4d68f
cpp: support state variables
cmnrd May 27, 2021
9605f1b
cpp: generate reactor level preambles
cmnrd May 27, 2021
7759857
cpp: bugfix
cmnrd May 27, 2021
8750fcd
cpp: small improvements and a TODO note
cmnrd May 27, 2021
241b3e3
cpp: explicitly include the .. operator using with(prependOperator)
cmnrd May 27, 2021
fc24500
cpp: rename extensions.kt to CppExtensions.kt
cmnrd May 27, 2021
abcad35
cpp: rename cpp generators
cmnrd May 27, 2021
e1530ee
cpp: fix importing of preambles
cmnrd May 27, 2021
f455d39
cpp: move all generator classes to individual files
cmnrd May 27, 2021
fff9b7b
cpp: factor out generation of main file to its own class
cmnrd May 28, 2021
aa77ade
cpp: factor out the cmake generation into its own class
cmnrd May 28, 2021
6b360fb
cpp: use all cores while building
cmnrd May 28, 2021
ee55b93
cpp: imperative function names
cmnrd May 28, 2021
0859a24
cpp: generate ports
cmnrd May 28, 2021
e1316f1
cpp: generate port connections
cmnrd Jun 1, 2021
057b8a1
cpp: generate code for reactor instantiations
cmnrd Jun 1, 2021
bb8106a
cpp: generate code for parameters
cmnrd Jun 1, 2021
a690121
cpp: pass parameters to reactor instances
cmnrd Jun 1, 2021
ca58741
cpp: need to use chrono literals in header files
cmnrd Jun 1, 2021
11e07c8
cpp: fix connections
cmnrd Jun 1, 2021
931ebb4
Merge remote-tracking branch 'origin/kotlin-with-gradle' into kotlin-…
cmnrd Jun 1, 2021
d8b3992
cpp: generate code for deadline handlers
cmnrd Jun 1, 2021
b00589f
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 2, 2021
4765378
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 2, 2021
786cf26
cpp: fix preamble includes
cmnrd Jun 2, 2021
6065fb1
cpp: properly prepare reaction scopes
cmnrd Jun 2, 2021
2637fb6
cpp: generics
cmnrd Jun 2, 2021
8baffb7
cpp: fix min delay of actions
cmnrd Jun 3, 2021
1e1a2da
cpp: support generation of after delays
cmnrd Jun 3, 2021
b7b3840
cpp: fix typo
cmnrd Jun 3, 2021
6a090db
cpp: fix preamble generation
cmnrd Jun 3, 2021
375c63a
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
oowekyala Jun 3, 2021
8a3a055
cpp: generate multiport and bank connections
cmnrd Jun 3, 2021
4628a14
cpp: fix bug in multiport instantiation
cmnrd Jun 3, 2021
9f4e088
cpp: fix bug in reactor instantiation
cmnrd Jun 3, 2021
e617732
cpp: fix bug in bank instance initialization
cmnrd Jun 3, 2021
01b8f9d
cpp: fix another bug in connection generation
cmnrd Jun 3, 2021
b9f43fa
cpp: and fix yet another bug in action generation
cmnrd Jun 3, 2021
cf90a48
cpp: support CLI parsing of main reactor parameters
cmnrd Jun 4, 2021
5c307ec
cpp: support broadcast connections
cmnrd Jun 4, 2021
829d5c1
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
oowekyala Jun 4, 2021
f38d68c
Merge branch 'master' into kotlin-cpp-generator
lhstrh Jun 4, 2021
9db30e9
ASTUtils: after delay generation should use LF´s time type
cmnrd Jun 7, 2021
0d26c13
cpp: port most of the error reporting code to kotlin
cmnrd Jun 7, 2021
e4d66bd
FileConfig: move getEclipseResource from generator base to file config
cmnrd Jun 7, 2021
96a29ab
generator: extend the error reporter interface
cmnrd Jun 7, 2021
6f2f3b4
generator: add error reporter interface and implement it in IErrorRep…
cmnrd Jun 7, 2021
07ca8f8
FileConfig: fix compilation error
cmnrd Jun 7, 2021
9eb8cd5
cpp: move log level extension to the cmake generator
cmnrd Jun 8, 2021
0835b47
cpp: move the prepend operator to a new GeneratorExtensions file
cmnrd Jun 8, 2021
30c36f5
cpp: fix a typo and simplify code
cmnrd Jun 8, 2021
58b4810
cpp: fix formatting
cmnrd Jun 8, 2021
36f9102
cpp: fix a typo
cmnrd Jun 8, 2021
6cbeeff
cpp: fix another typo
cmnrd Jun 8, 2021
245aa58
cpp: move FileConfig extensions to their own file
cmnrd Jun 8, 2021
63d23c0
cpp: fix imports of isGeneric
cmnrd Jun 8, 2021
a3cf864
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 8, 2021
e512a62
ASTUtils: delete redundant function
cmnrd Jun 8, 2021
dbd94d4
ASTUtils: stop eclipse from wrongly complaining about non-exhaustive …
cmnrd Jun 8, 2021
0188e58
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 8, 2021
b9fe6b0
cpp: delete the old cpp generator
cmnrd Jun 9, 2021
75c15b3
cpp: move some code to AstExtensions
cmnrd Jun 9, 2021
1d61bae
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 9, 2021
9fe3b0a
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 10, 2021
88105b7
ErrorReporter: add methods for reporting at specific files and lines
cmnrd Jun 10, 2021
212da92
GeneratorBase: *have* an ErrorReporter instead if implementing it
cmnrd Jun 10, 2021
f21e0c1
generator: pass EclipseErrorReporter to all generators
cmnrd Jun 10, 2021
7c58c81
generator: pass file config as constructor argument
cmnrd Jun 10, 2021
e0cd9b8
ErrorReporter: Update the eclipse reporter to the new interface
cmnrd Jun 10, 2021
75abccb
ErrorReporter: update the interface to keep track if errors occurred
cmnrd Jun 10, 2021
7a49930
FileConfig: move mode detection from GeneratorBase
cmnrd Jun 10, 2021
0bd225d
ErrorReporter: Fix reporting in eclipse
cmnrd Jun 10, 2021
91da2ce
cpp: fixing the cpp generator after recent changes
cmnrd Jun 10, 2021
cce6235
some fixes
cmnrd Jun 10, 2021
50f80d1
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 11, 2021
681a8bc
cpp: fix typo
cmnrd Jun 14, 2021
1b2160c
cpp: report errors instead of throwing exceptions
cmnrd Jun 14, 2021
9a4f5ba
cpp: move code for accessing validated widths to port/instance genera…
cmnrd Jun 14, 2021
e613199
cpp: remove unnecessary extension
cmnrd Jun 14, 2021
502f079
Update org.lflang/src/org/lflang/AstExtensions.kt
lhstrh Jun 14, 2021
c4905ce
Update org.lflang/src/org/lflang/AstExtensions.kt
lhstrh Jun 14, 2021
d2be292
Merge remote-tracking branch 'origin/kotlin-cpp-generator' into kotli…
cmnrd Jun 15, 2021
827caf4
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 15, 2021
6f8f90b
cpp: fix typo in reactor-cpp
cmnrd Jun 15, 2021
0090971
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 17, 2021
80dc16a
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 25, 2021
bfb004f
generator: port changes from LFGenerator.kt back to LFGenerator.java
cmnrd Jun 25, 2021
4a959ca
cpp: make sure that LFGenerator works properly if run from Eclipse
cmnrd Jun 25, 2021
e50ce87
generator: port the error reporter to Java
cmnrd Jun 25, 2021
d927e04
generator: Display a proper error if the generator cannot be found
cmnrd Jun 25, 2021
a1e8546
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 25, 2021
caba3c8
Merge branch 'kotlin-with-gradle' into kotlin-cpp-generator
cmnrd Jun 28, 2021
3c2c49a
idea: push my code style settings
cmnrd Jun 28, 2021
cf24190
Update org.lflang/src/org/lflang/generator/LFGenerator.java
lhstrh Jun 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 173 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package org.lflang.diagram.synthesis.util

import org.lflang.ErrorReporter
import org.eclipse.emf.ecore.EObject
import java.nio.file.Path

/**
* @author{Alexander Schulz-Rosengarten <als@informatik.uni-kiel.de>}
Expand All @@ -26,10 +27,19 @@ class SynthesisErrorReporter implements ErrorReporter {
override reportError(EObject object, String message) {
}

override reportError(Path file, Integer line, String message) {
}

override reportWarning(String message) {
}

override reportWarning(EObject object, String message) {
}

override reportWarning(Path file, Integer line, String message) {
}

override getErrorsOccurred() { return false }

override reset() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ class LinguaFrancaDependencyAnalysisTest {
}
}

var gen = new CGenerator()
var message = ""
try {
new ReactionInstanceGraph(
new ReactorInstance(mainDef.reactorClass.toDefinition, gen))
new ReactorInstance(mainDef.reactorClass.toDefinition, new DefaultErrorReporter()))
} catch(Exception e) {
message = e.message
}
Expand Down
9 changes: 6 additions & 3 deletions org.lflang/src/org/lflang/ASTUtils.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,13 @@ class ASTUtils {

delayParameter.name = "delay"
delayParameter.type = factory.createType
delayParameter.type.id = generator.targetTimeType
delayParameter.type.id = "time"
delayParameter.type.time = true
val defaultTime = factory.createTime
defaultTime.unit = TimeUnit.NONE
defaultTime.interval = 0
val defaultValue = factory.createValue
defaultValue.literal = generator.timeInTargetLanguage(
new TimeValue(0, TimeUnit.NONE))
defaultValue.time = defaultTime
delayParameter.init.add(defaultValue)

// Name the newly created action; set its delay and type.
Expand Down
Loading