-
Notifications
You must be signed in to change notification settings - Fork 156
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
base: master
Are you sure you want to change the base?
Conversation
3a41b1e
to
6a137ac
Compare
// 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()))" |
There was a problem hiding this comment.
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:
kaitai_struct_compiler/shared/src/main/scala/io/kaitai/struct/translators/CSharpTranslator.scala
Lines 109 to 110 in 361ca50
override def strReverse(s: expr): String = | |
s"${CSharpCompiler.kstreamName}.StringReverse(${translate(s)})" |
…c: +JsonIgnore and this is the rest of the comment.
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
Instances if
@pluskal are you still working on this? I think this can be a huge improvement but it seems to be stale for 3+ years... |
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. |
Relates to:
This PR adds support for
Kaitai.Struct.Runtime.Async
. Due to my lack of Scala skills, I have used the original implementation ofcsharp
and addedcsharpasync
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.