-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regen master kaitai-io/kaitai_struct@adf33aa
- Loading branch information
1 parent
883896c
commit ca253f1
Showing
22 changed files
with
583 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from construct import * | ||
from construct.lib import * | ||
import enum | ||
|
||
class valid_fail_in_enum__animal(enum.IntEnum): | ||
dog = 4 | ||
chicken = 12 | ||
|
||
valid_fail_in_enum = Struct( | ||
'foo' / Enum(Int32ul, valid_fail_in_enum__animal), | ||
) | ||
|
||
_schema = valid_fail_in_enum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild | ||
|
||
#include "valid_fail_in_enum.h" | ||
#include "kaitai/exceptions.h" | ||
const std::set<std::underlying_type<valid_fail_in_enum_t::animal_t>::type> valid_fail_in_enum_t::_values_animal_t{4, 12}; | ||
|
||
valid_fail_in_enum_t::valid_fail_in_enum_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, valid_fail_in_enum_t* p__root) : kaitai::kstruct(p__io) { | ||
m__parent = p__parent; | ||
m__root = p__root ? p__root : this; | ||
_read(); | ||
} | ||
|
||
void valid_fail_in_enum_t::_read() { | ||
m_foo = static_cast<valid_fail_in_enum_t::animal_t>(m__io->read_u4le()); | ||
if (valid_fail_in_enum_t::_values_animal_t.find(m_foo) == valid_fail_in_enum_t::_values_animal_t.end()) { | ||
throw kaitai::validation_not_in_enum_error<valid_fail_in_enum_t::animal_t>(m_foo, m__io, std::string("/seq/0")); | ||
} | ||
} | ||
|
||
valid_fail_in_enum_t::~valid_fail_in_enum_t() { | ||
_clean_up(); | ||
} | ||
|
||
void valid_fail_in_enum_t::_clean_up() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#pragma once | ||
|
||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild | ||
|
||
class valid_fail_in_enum_t; | ||
|
||
#include "kaitai/kaitaistruct.h" | ||
#include <stdint.h> | ||
#include <memory> | ||
#include <set> | ||
#include <type_traits> | ||
|
||
#if KAITAI_STRUCT_VERSION < 11000L | ||
#error "Incompatible Kaitai Struct C++/STL API: version 0.11 or later is required" | ||
#endif | ||
|
||
class valid_fail_in_enum_t : public kaitai::kstruct { | ||
|
||
public: | ||
|
||
enum animal_t { | ||
ANIMAL_DOG = 4, | ||
ANIMAL_CHICKEN = 12 | ||
}; | ||
static const std::set<std::underlying_type<animal_t>::type> _values_animal_t; | ||
|
||
valid_fail_in_enum_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent = nullptr, valid_fail_in_enum_t* p__root = nullptr); | ||
|
||
private: | ||
void _read(); | ||
void _clean_up(); | ||
|
||
public: | ||
~valid_fail_in_enum_t(); | ||
|
||
private: | ||
animal_t m_foo; | ||
valid_fail_in_enum_t* m__root; | ||
kaitai::kstruct* m__parent; | ||
|
||
public: | ||
animal_t foo() const { return m_foo; } | ||
valid_fail_in_enum_t* _root() const { return m__root; } | ||
kaitai::kstruct* _parent() const { return m__parent; } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild | ||
|
||
using System; | ||
|
||
namespace Kaitai | ||
{ | ||
public partial class ValidFailInEnum : KaitaiStruct | ||
{ | ||
public static ValidFailInEnum FromFile(string fileName) | ||
{ | ||
return new ValidFailInEnum(new KaitaiStream(fileName)); | ||
} | ||
|
||
|
||
public enum Animal | ||
{ | ||
Dog = 4, | ||
Chicken = 12, | ||
} | ||
public ValidFailInEnum(KaitaiStream p__io, KaitaiStruct p__parent = null, ValidFailInEnum p__root = null) : base(p__io) | ||
{ | ||
m_parent = p__parent; | ||
m_root = p__root ?? this; | ||
_read(); | ||
} | ||
private void _read() | ||
{ | ||
_foo = ((Animal) m_io.ReadU4le()); | ||
if (!Enum.IsDefined(typeof(Animal), _foo)) | ||
{ | ||
throw new ValidationNotInEnumError(_foo, m_io, "/seq/0"); | ||
} | ||
} | ||
private Animal _foo; | ||
private ValidFailInEnum m_root; | ||
private KaitaiStruct m_parent; | ||
public Animal Foo { get { return _foo; } } | ||
public ValidFailInEnum M_Root { get { return m_root; } } | ||
public KaitaiStruct M_Parent { get { return m_parent; } } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
digraph { | ||
rankdir=LR; | ||
node [shape=plaintext]; | ||
subgraph cluster__valid_fail_in_enum { | ||
label="ValidFailInEnum"; | ||
graph[style=dotted]; | ||
|
||
valid_fail_in_enum__seq [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"> | ||
<TR><TD BGCOLOR="#E0FFE0">pos</TD><TD BGCOLOR="#E0FFE0">size</TD><TD BGCOLOR="#E0FFE0">type</TD><TD BGCOLOR="#E0FFE0">id</TD></TR> | ||
<TR><TD PORT="foo_pos">0</TD><TD PORT="foo_size">4</TD><TD>u4le→Animal</TD><TD PORT="foo_type">foo</TD></TR> | ||
<TR><TD COLSPAN="4" PORT="foo__valid">must be defined in the enum</TD></TR> | ||
</TABLE>>]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> | ||
|
||
<title>ValidFailInEnum format specification</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>ValidFailInEnum format specification</h1> | ||
|
||
|
||
<a name='type-valid_fail_in_enum'></a> | ||
<h1>Type: ValidFailInEnum</h1> | ||
|
||
<table class="table"> | ||
<tr><th>Offset</th><th>Size</th><th>ID</th><th>Type</th><th>Note</th></tr> | ||
<tr> | ||
<td>0</td> | ||
<td>...</td> | ||
<td>foo</td> | ||
<td>u4le→Animal</td> | ||
<td></td> | ||
</tr> | ||
</table> | ||
<a name='enum-valid_fail_in_enum-animal'></a> | ||
<h2>Enum: animal</h2> | ||
|
||
<table class="table"> | ||
<tr> | ||
<th>ID</th><th>Name</th><th>Note</th> | ||
</tr> | ||
<tr> | ||
<td>4</td><td>dog</td><td></td></tr> | ||
</tr> | ||
<tr> | ||
<td>12</td><td>chicken</td><td></td></tr> | ||
</tr> | ||
</table> | ||
|
||
</div> | ||
<!-- Optional JavaScript --> | ||
<!-- jQuery first, then Popper.js, then Bootstrap JS --> | ||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script> | ||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script> | ||
</body> | ||
</html> | ||
|
58 changes: 58 additions & 0 deletions
58
compiled/java/src/io/kaitai/struct/testformats/ValidFailInEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild | ||
|
||
package io.kaitai.struct.testformats; | ||
|
||
import io.kaitai.struct.ByteBufferKaitaiStream; | ||
import io.kaitai.struct.KaitaiStruct; | ||
import io.kaitai.struct.KaitaiStream; | ||
import java.io.IOException; | ||
import java.util.Map; | ||
import java.util.HashMap; | ||
|
||
public class ValidFailInEnum extends KaitaiStruct { | ||
public static ValidFailInEnum fromFile(String fileName) throws IOException { | ||
return new ValidFailInEnum(new ByteBufferKaitaiStream(fileName)); | ||
} | ||
|
||
public enum Animal { | ||
DOG(4), | ||
CHICKEN(12); | ||
|
||
private final long id; | ||
Animal(long id) { this.id = id; } | ||
public long id() { return id; } | ||
private static final Map<Long, Animal> byId = new HashMap<Long, Animal>(2); | ||
static { | ||
for (Animal e : Animal.values()) | ||
byId.put(e.id(), e); | ||
} | ||
public static Animal byId(long id) { return byId.get(id); } | ||
} | ||
|
||
public ValidFailInEnum(KaitaiStream _io) { | ||
this(_io, null, null); | ||
} | ||
|
||
public ValidFailInEnum(KaitaiStream _io, KaitaiStruct _parent) { | ||
this(_io, _parent, null); | ||
} | ||
|
||
public ValidFailInEnum(KaitaiStream _io, KaitaiStruct _parent, ValidFailInEnum _root) { | ||
super(_io); | ||
this._parent = _parent; | ||
this._root = _root == null ? this : _root; | ||
_read(); | ||
} | ||
private void _read() { | ||
this.foo = Animal.byId(this._io.readU4le()); | ||
if (this.foo == null) { | ||
throw new KaitaiStream.ValidationNotInEnumError(this.foo, this._io, "/seq/0"); | ||
} | ||
} | ||
private Animal foo; | ||
private ValidFailInEnum _root; | ||
private KaitaiStruct _parent; | ||
public Animal foo() { return foo; } | ||
public ValidFailInEnum _root() { return _root; } | ||
public KaitaiStruct _parent() { return _parent; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild | ||
|
||
(function (root, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(['exports', 'kaitai-struct/KaitaiStream'], factory); | ||
} else if (typeof exports === 'object' && exports !== null && typeof exports.nodeType !== 'number') { | ||
factory(exports, require('kaitai-struct/KaitaiStream')); | ||
} else { | ||
factory(root.ValidFailInEnum || (root.ValidFailInEnum = {}), root.KaitaiStream); | ||
} | ||
})(typeof self !== 'undefined' ? self : this, function (ValidFailInEnum_, KaitaiStream) { | ||
var ValidFailInEnum = (function() { | ||
ValidFailInEnum.Animal = Object.freeze({ | ||
DOG: 4, | ||
CHICKEN: 12, | ||
|
||
4: "DOG", | ||
12: "CHICKEN", | ||
}); | ||
|
||
function ValidFailInEnum(_io, _parent, _root) { | ||
this._io = _io; | ||
this._parent = _parent; | ||
this._root = _root || this; | ||
|
||
this._read(); | ||
} | ||
ValidFailInEnum.prototype._read = function() { | ||
this.foo = this._io.readU4le(); | ||
if (!Object.prototype.hasOwnProperty.call(ValidFailInEnum.Animal, this.foo)) { | ||
throw new KaitaiStream.ValidationNotInEnumError(this.foo, this._io, "/seq/0"); | ||
} | ||
} | ||
|
||
return ValidFailInEnum; | ||
})(); | ||
ValidFailInEnum_.ValidFailInEnum = ValidFailInEnum; | ||
}); |
Oops, something went wrong.