Skip to content
New issue

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

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

Already on GitHub? # to your account

Added AlarmClock example #780

Merged
merged 24 commits into from
Feb 16, 2022
Merged

Added AlarmClock example #780

merged 24 commits into from
Feb 16, 2022

Conversation

tanneberger
Copy link
Member

What was done ?

Added a short description and reference to the projects repository. This will be helpful to many which want to learn lingua franca or want to see how other people solved some issues or structured their project.

@lhstrh
Copy link
Member

lhstrh commented Dec 3, 2021

Why not add the actual example?

@tanneberger
Copy link
Member Author

Did you take a look at the repository. Opinions ? Feedback ?

I just figured I would be less of a hustle in the future when I change / add things that I don't need to update the example here. The other point is that I use Crow as my networking library and I include it as a git sub-module therefore it won't build in this repository because of the missing dependency.

But sure I can add the source files no problem.

@tanneberger tanneberger requested a review from cmnrd December 20, 2021 09:19
@tanneberger tanneberger self-assigned this Dec 20, 2021
@tanneberger tanneberger added the cpp Related to C++ target label Dec 20, 2021
Copy link
Collaborator

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since, apparently, this is not your actual clock but a simplified version, I agree that it is probably better to avoid the submodule and add all your sources directly.

Could you also add a README with brief usage instructions? What do I need to do to try this out? Also some high level comments on what this does and how it works would be nice.

I think I spotted a syntax error here

Also I cannot compile the example. i get this strange error:

ava.util.NoSuchElementException
        at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1000)
        at org.lflang.generator.ReactorInstance.establishPortConnections(ReactorInstance.java:1197)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:1056)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:919)
        at org.lflang.generator.ReactorInstance.<init>(ReactorInstance.java:80)
        at org.lflang.ModelInfo.update(ModelInfo.java:116)
        at org.lflang.validation.LFValidator.checkModel(LFValidator.java:785)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:129)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:337)
        at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:72)
        at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151)
        at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:257)
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:244)
        at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:41)
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:201)
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:147)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:125)
        at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:91)
        at org.lflang.lfc.Main.getValidatedResource(Main.java:325)
        at org.lflang.lfc.Main.runGenerator(Main.java:268)
        at org.lflang.lfc.Main.main(Main.java:206)
lfc: fatal error: An unexpected error occurred:
java.lang.NullPointerException
        at org.lflang.FileConfig.toIPath(FileConfig.java:707)
        at org.lflang.FileConfig.toPath(FileConfig.java:690)
        at org.lflang.lfc.Main.getValidatedResource(Main.java:333)
        at org.lflang.lfc.Main.runGenerator(Main.java:268)
        at org.lflang.lfc.Main.main(Main.java:206)

This indicates some problem in the compiler, but I suspect that it is triggered by the syntax error.

@tanneberger
Copy link
Member Author

@cmnrd ok so only the sources. But then it won't compile because cmake wont find the crow library (the http lib that I use).

Signed-off-by: revol-xut <revol-xut@protonmail.com>
@cmnrd
Copy link
Collaborator

cmnrd commented Jan 20, 2022

That is not a problem. With our current CI configuration, we only run the LF code generation in all examples, but we don't invoke the target compiler (since multiple examples have external dependencies).

Copy link
Collaborator

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this does not compile for me because the include of shared_header.hpp cannot be resolved. See my comments for a proposed fix.

example/Cpp/src/AlarmClock/AlarmClock.cmake Outdated Show resolved Hide resolved
example/Cpp/src/AlarmClock/AlarmClock.cmake Show resolved Hide resolved
example/Cpp/src/AlarmClock/Clock.lf Outdated Show resolved Hide resolved
@tanneberger tanneberger requested a review from cmnrd January 26, 2022 10:23
example/Cpp/src/AlarmClock/README.md Outdated Show resolved Hide resolved
test/Cpp/lib64/libreactor-cpp.so Outdated Show resolved Hide resolved
example/Cpp/src/AlarmClock/.gitmodules Outdated Show resolved Hide resolved
cmnrd added a commit that referenced this pull request Feb 16, 2022
@cmnrd cmnrd merged commit a7bb7fe into lf-lang:master Feb 16, 2022
@lhstrh lhstrh changed the title AlarmClock example Added AlarmClock example Mar 17, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cpp Related to C++ target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants