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

C# Async with .NET Core Kaitai.Struct.Runtime.Async #189

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

pluskal
Copy link

@pluskal pluskal commented Jan 3, 2020

Relates to:

This PR adds support for Kaitai.Struct.Runtime.Async. Due to my lack of Scala skills, I have used the original implementation of csharp and added csharpasync compilar and translator.

The structure should be improved and refactored by someone skilled in Scala. The copy of translator is unnecessary duplicate, but the tight coupling between classes requires it in this simple PoC.

@pluskal pluskal changed the title WIP: C# Async with .NET Core Kaitai.Struct.Runtime WIP: C# Async with .NET Core Kaitai.Struct.Runtime.Async Jan 3, 2020
@pluskal pluskal force-pushed the Async branch 5 times, most recently from 3a41b1e to 6a137ac Compare January 7, 2020 19:33
@pluskal pluskal changed the title WIP: C# Async with .NET Core Kaitai.Struct.Runtime.Async C# Async with .NET Core Kaitai.Struct.Runtime.Async Feb 19, 2020
@pluskal pluskal requested a review from GreyCat February 19, 2020 15:17
Comment on lines +107 to +110
// FIXME: This is not fully Unicode aware, but might be better than nothing.
// http://stackoverflow.com/a/228060/2055163
override def strReverse(s: expr): String =
s"new string(Array.Reverse(${translate(s)}.ToCharArray()))"
Copy link
Member

Choose a reason for hiding this comment

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

The current C# implementation is Unicode-aware, so it might be useful to use the same implementation - see kaitai_struct_csharp_runtime/KaitaiStream.cs:686-700. This is how it's called from the compiler currently:

override def strReverse(s: expr): String =
s"${CSharpCompiler.kstreamName}.StringReverse(${translate(s)})"

beho and others added 6 commits March 1, 2021 16:48
Async C#: throw exception when default branch in switch is not hit at runtime
ParseInstances
- Introduce error signaling "if closing" to LanguageCompiler with
default implementation fallick back to standard "if closing"
- use it only in CSharpAsyncCompiler
@MeikelLP
Copy link

@pluskal are you still working on this? I think this can be a huge improvement but it seems to be stale for 3+ years...

@pluskal
Copy link
Author

pluskal commented Oct 16, 2023

I am sorry, but we have finished the project. I needed this a few years ago, so I do not envision improving this further.

Changes I made should be pushed in the PRs above. I have used it on massively parallel applications, and the speed was satisfactory for my needs.

I am not experienced in Scala, so I can only help a little in this repo. It mainly was copy and paste for me.

Feel free to use this code as it is or continue where I finished. I can review C# if you want to make some changes there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants