Kaitai Struct

1 program Added 2026-02-06T08:47:33Z Agent: claude-codeModel: sonnetWebSearch: disabled Evidence Report issue View issues
Aliases: KS, Kaitai
Provenance: commit 57c428fe19 · authored 2026-02-06T09:50:00+01:00 · agent claude-code · model sonnet

Sources mentioning this language

3 sources · pl_id: pl/kaitai-struct
LLM (this repo) · 1LinguistWikidata · Q29053521

Extensions claimed by this language

2 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.ksylinguistprimary31.2K files
.ksywikidataprimary31.2K files

Related languages

Structured Text (0.15)S-BASIC (0.13)SFTRAN (0.13)TwinCAT (0.12)Instruction List (0.11)

LLM-contributed programs

GIF Header Parser

Provenance: commit 57c428fe19 · authored 2026-02-06T09:50:00+01:00 · agent claude-code · model sonnet · WebSearch disabled
code.ksy · license: CC0-1.0 · added: 2026-02-06T08:47:33Z
meta:
  id: gif_header
  file-extension: gif
  endian: le
seq:
  - id: magic
    contents: 'GIF'
  - id: version
    type: str
    size: 3
    encoding: ASCII
  - id: screen_width
    type: u2
  - id: screen_height
    type: u2
  - id: flags
    type: u1
  - id: bg_color_index
    type: u1
  - id: pixel_aspect_ratio
    type: u1

Real programs from Software Heritage

1 sample mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
sprites_dat.ksy · 3219 B · ext .ksy · seen 14× in SWH
via unique-primary
swh:1:cnt:517f3a487ba0346e69cdc3e6bd2f09b2aae61f0c;origin=https://github.com/Wargus/stargus;anchor=swh:1:rev:37f94f33177280a5adea1f4290998f769a816697;path=/src/kaitai/sprites_dat.ksy
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source
meta:
  id: sprites_dat
  endian: le
  bit-endian: le

seq:
  - id: image
    type: u2
    repeat: expr
    repeat-expr: num_lines
    doc: |
      The images.dat entry corresponding to the sprites.dat entry [pointer to images.dat]

  - id: health_bar
    type: u1
    repeat: expr
    repeat-expr: num_lines-130
    doc: |
      The length of the Hit Points/Shields/Energy bar below the sprite, in pixels. The way the actual number of "boxes" is calculated is the following: substract 1 from the value, divide the result by 3 and round it down. Even though a sprite may actually USE less than 6 boxes, 6 boxes is the minimal amount that will be SHOWN in-game (just that some will not be functional). Values below 6 will all result in 1 box being USED.
      This property is only available from unit index 130 to num_lines

  - id: unknown2
    type: u1
    repeat: expr
    repeat-expr: num_lines
    doc: |
      tbd

  - id: is_visible
    type: u1
    repeat: expr
    repeat-expr: num_lines
    doc: |
      Sprite will start as visible. Unchecked, used to hide the "White Circle", the Zerg Beacon used by Subterranean Spines, and few other things.

  - id: select_circle_image_size
    type: u1
    repeat: expr
    repeat-expr: num_lines-130
    doc: |
      The size of the in-game selection circle. The different sizes are actually different images.dat entries, so in order to use custom ones you need to replace them. The "Dashed" selection circles are used to mark allied units in multiplayer games, but if used on the players own units they will not disappear after deselecting the unit, and also they will NOT be removed on its death, still providing limited vision to the player.[pointer to images.dat, starting at ID#561 as 0]
      This property is only available from unit index 130 to num_lines

  - id: select_circle_vertical_pos
    type: u1
    repeat: expr
    repeat-expr: num_lines-130
    doc: |
      The vertical position of the in-game selection circle and the Health/Shield/Energy bar. The higher the number, the more downwards from the main sprite will they be positioned. Around 127 the display "loops back" and appears actually ABOVE the main sprite. 255 will put it back in its original position.
      This property is only available from unit index 130 to num_lines

instances:
  num_lines:
    value: 'file_size_rest / record_size + 130'
    doc: |
      A division of the dynamic rest file size though the record size gives the number of records in the file to parse.
      The static first 130 are then added to this number.

  record_size:
    value: 7
    doc: |
      The size of one data record. This is all type sizes in the format summarized (starting from record 130).

  record_size_first_130:
    value: 4
    doc: |
      The size of one data record. This is all type sizes in the format summarized (the first 130 records).

  file_size_first_130:
    value: 'record_size_first_130 * 130'
    doc: |
      File size for the first 130 records that is always static size.

  file_size_rest:
    value: 'file_size - file_size_first_130'
    doc:   |
      File size for the records after 130. This number might change from file to file.

  file_size:
    value: '_io.size'

Contribute — propose a file extension

Tell us where to find evidence about Kaitai Struct (mapped to pl/kaitai-struct). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Kaitai Struct/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← kaitai Kak →