| # Copyright 2019 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| [$default byte_order: "LittleEndian"] |
| [(cpp) namespace: "emboss::test"] |
| |
| struct Constants: |
| let sprocket = 1 |
| let geegaw = 2 |
| |
| enum Kind: |
| WIDGET = 0 |
| SPROCKET = Constants.sprocket |
| GEEGAW = Constants.geegaw |
| COMPUTED = Constants.geegaw+Constants.sprocket |
| LARGE_VALUE = 2000 |
| DUPLICATE_LARGE_VALUE = LARGE_VALUE |
| MAX32BIT = 4294967295 |
| MAX64BIT = 0x1_0000_0000_0000_0000-1 |
| |
| |
| enum Signed: |
| MIN64BIT = -0x8000_0000_0000_0000 |
| MAX64BIT = 0x8000_0000_0000_0000-1 |
| |
| |
| enum OnlyShortValues: |
| ZERO = 0 |
| ONE = 1 |
| |
| |
| enum OnlyShortSignedValues: |
| ZERO = 0 |
| NEGATIVE_ONE = -1 |
| |
| |
| enum ExplicitlySigned: |
| [is_signed: true] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySized64: |
| [maximum_bits: 64] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySized32: |
| [maximum_bits: 32] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySized16: |
| [maximum_bits: 16] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySized8: |
| [maximum_bits: 8] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySized12: |
| [maximum_bits: 12] |
| ZERO = 0 |
| |
| |
| enum ExplicitlySizedAndSigned: |
| [maximum_bits: 32] |
| [is_signed: true] |
| ZERO = 0 |
| |
| |
| struct ManifestEntry: |
| 0 [+1] Kind kind |
| 1 [+4] UInt count |
| 5 [+4] Kind wide_kind |
| 9 [+5] bits: |
| 4 [+32] Kind wide_kind_in_bits |
| |
| |
| struct StructContainingEnum: |
| enum Status: |
| OK = 0x00 |
| FAILURE = 0x01 |
| 0 [+1] UInt bar |