kaitai-io / kaitai_struct

Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
https://kaitai.io
4.04k stars 199 forks source link

A few questions on the language repositories and supported languages mentioned README.md #1010

Open jpluimers opened 1 year ago

jpluimers commented 1 year ago

A few questions on the README.md about the language repositories and supported languages.

First the list of examples, which is in alphabetical order:

In C\

Gif g = Gif.FromFile("path/to/some.gif");
Console.WriteLine("width = " + g.LogicalScreen.ImageWidth);
Console.WriteLine("height = " + g.LogicalScreen.ImageHeight);

In Java

Gif g = Gif.fromFile("path/to/some.gif");
System.out.println("width = " + g.logicalScreen().imageWidth());
System.out.println("height = " + g.logicalScreen().imageHeight());

In JavaScript

See JavaScript notes in the documentation for a more complete quick start guide.

var g = new Gif(new KaitaiStream(someArrayBuffer));
console.log("width = " + g.logicalScreen.imageWidth);
console.log("height = " + g.logicalScreen.imageHeight);

In Lua

local g = Gif:from_file("path/to/some.gif")
print("width = " .. g.logical_screen.image_width)
print("height = " .. g.logical_screen.image_height)

In Nim

let g = Gif.fromFile("path/to/some.gif")
echo "width = " & $g.logicalScreen.imageWidth
echo "height = " & $g.logicalScreen.imageHeight

In PHP

$g = Gif::fromFile('path/to/some.gif');
printf("width = %d\n", $g->logicalScreen()->imageWidth());
printf("height = %d\n", $g->logicalScreen()->imageHeight());

In Python

g = Gif.from_file("path/to/some.gif")
print "width = %d" % (g.logical_screen.image_width)
print "height = %d" % (g.logical_screen.image_height)

In Ruby

g = Gif.from_file("path/to/some.gif")
puts "width = #{g.logical_screen.image_width}"
puts "height = #{g.logical_screen.image_height}"

Then the supported languages list, also in alphabetical order:

  • C#
  • Java
  • JavaScript
  • Lua
  • Nim
  • PHP
  • Python
  • Ruby

Finally the list of language runtime repositories where Nim and Lua are not in alphabetical order:

A few questions:

  1. why are Nim and Lua not in alphabetical order in the runtime libraries list?
  2. why is the runtime libraries list missing these runtime library repositories:
  3. why are these languages missing from the supported languages list:
    • C++/STL
    • Go
    • Perl
    • Swift
  4. why are these languages missing from the examples:
    • C++/STL
    • Go
    • Perl
    • Swift

--jeroen

generalmimon commented 1 year ago

@jpluimers Thanks for the report. In general, I'm aware that this README is wrong in many ways, and the suggested solution is to remove these sections from the README and link to https://kaitai.io/#quick-start instead, which should be correct. See @GreyCat's comment (https://github.com/kaitai-io/kaitai_struct/pull/738#issuecomment-619357771):

Broadly, the idea was actually to remove this piece of quick start documentation here and have it completely in one place: https://kaitai.io/ — with interactive language switch.

It's just that nobody has done it yet :-(

jpluimers commented 1 year ago

@jpluimers Thanks for the report. In general, I'm aware that this README is wrong in many ways, and the suggested solution is to remove these sections from the README and link to https://kaitai.io/#quick-start instead, which should be correct. See @GreyCat's comment (#738 (comment)).

Thanks. Where is the quick-start generated from?

I'll try to set a reminder for a pull request somewhere after this month, as I'm fully occupied until then.

generalmimon commented 1 year ago

@jpluimers:

Where is the quick-start generated from?

Ah, it's defined here: https://github.com/kaitai-io/kaitai-io.github.io/blob/08b97c6669734a93fd194598507392169c7b1a53/index.md?plain=1#L157

But I believe you don't need to change it, unless have you found some error there?

It's just that most content from https://github.com/kaitai-io/kaitai_struct/blob/0671f0f/README.md should be removed and replaced with a link to https://kaitai.io/ or its respective sections.

jpluimers commented 1 year ago

@jpluimers:

Where is the quick-start generated from?

Ah, it's defined here: https://github.com/kaitai-io/kaitai-io.github.io/blob/08b97c6669734a93fd194598507392169c7b1a53/index.md?plain=1#L157

But I believe you don't need to change it, unless have you found some error there?

It's just that most content from https://github.com/kaitai-io/kaitai_struct/blob/0671f0f/README.md should be removed and replaced with a link to https://kaitai.io/ or its respective sections.

I'm kind of surprised by both the https://kaitai.io/ being pure html (with hardcoded styles and embedded pre code fragments going through encoding hoops in order to preserve content) instead of being generated from various bits and parts, and that it is favoured over the markdown README documentation that can have unencoded code fragments: It feels like 1995 calling and wanting their marquee and blink elements back.

Given that the kaitai-project-homepage is all Jekyll based, there can be a better solution to at least have the various example code fragments in separate files, no?