zcbor
Advanced tools
+34
-11
@@ -39,5 +39,5 @@ /* | ||
| #include <sys/printk.h> | ||
| #define zcbor_trace() (printk("bytes left: %zu, byte: 0x%x, elem_count: 0x%" PRIxFAST32 ", %s:%d\n",\ | ||
| (size_t)state->payload_end - (size_t)state->payload, *state->payload, \ | ||
| state->elem_count, __FILE__, __LINE__)) | ||
| #define zcbor_trace() (printk("bytes left: %zu, byte: 0x%x, elem_count: 0x%" PRIxFAST32 ", err: %d, %s:%d\n",\ | ||
| (size_t)state->payload_end - (size_t)state->payload, *state->payload, state->elem_count, \ | ||
| state->constant_state ? state->constant_state->error : 0, __FILE__, __LINE__)) | ||
@@ -78,2 +78,10 @@ #define zcbor_print_assert(expr, ...) \ | ||
| #if SIZE_MAX <= UINT64_MAX | ||
| /** The ZCBOR_SUPPORTS_SIZE_T will be defined if processing of size_t type variables directly | ||
| * with zcbor_size_ functions is supported. | ||
| **/ | ||
| #define ZCBOR_SUPPORTS_SIZE_T | ||
| #else | ||
| #warning "zcbor: Unsupported size_t encoding size" | ||
| #endif | ||
@@ -269,12 +277,11 @@ struct zcbor_state_constant; | ||
| /** Initialize a state with backups. | ||
| * One of the states in the array is used as a struct zcbor_state_constant object. | ||
| * As long as n_states is more than 1, one of the states in the array is used | ||
| * as a struct zcbor_state_constant object. | ||
| * If there is no struct zcbor_state_constant (n_states == 1), error codes are | ||
| * not available. | ||
| * This means that you get a state with (n_states - 2) backups. | ||
| * The constant state is mandatory so n_states must be at least 2. | ||
| * payload, payload_len, and elem_count are used to initialize the first state. | ||
| * in the array, which is the state that can be passed to cbor functions. | ||
| * | ||
| * @retval false if n_states < 2 | ||
| * @retval true otherwise | ||
| */ | ||
| bool zcbor_new_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| const uint8_t *payload, size_t payload_len, uint_fast32_t elem_count); | ||
@@ -286,3 +293,4 @@ | ||
| { | ||
| return !(state->constant_state->stop_on_error && state->constant_state->error); | ||
| struct zcbor_state_constant *cs = state->constant_state; | ||
| return !(cs && cs->stop_on_error && cs->error); | ||
| } | ||
@@ -294,2 +302,5 @@ #endif | ||
| { | ||
| if (!state->constant_state) { | ||
| return ZCBOR_SUCCESS; | ||
| } | ||
| int err = state->constant_state->error; | ||
@@ -301,2 +312,12 @@ | ||
| /** Look at current error state without altering it */ | ||
| static inline int zcbor_peek_error(const zcbor_state_t *state) | ||
| { | ||
| if (!state->constant_state) { | ||
| return ZCBOR_SUCCESS; | ||
| } else { | ||
| return state->constant_state->error; | ||
| } | ||
| } | ||
| /** Write the provided error to the error state. */ | ||
@@ -309,3 +330,5 @@ static inline void zcbor_error(zcbor_state_t *state, int err) | ||
| { | ||
| state->constant_state->error = err; | ||
| if (state->constant_state) { | ||
| state->constant_state->error = err; | ||
| } | ||
| } | ||
@@ -312,0 +335,0 @@ } |
@@ -37,2 +37,3 @@ /* | ||
| bool zcbor_uint64_decode(zcbor_state_t *state, uint64_t *result); | ||
| bool zcbor_size_decode(zcbor_state_t *state, size_t *result); | ||
@@ -53,2 +54,3 @@ /** The following applies to all _expect() functions that don't have docs. | ||
| bool zcbor_uint64_expect(zcbor_state_t *state, uint64_t result); | ||
| bool zcbor_size_expect(zcbor_state_t *state, size_t result); | ||
@@ -309,3 +311,3 @@ /** Consume and expect a pint with a certain value, within a union. | ||
| /** See @ref zcbor_new_state() */ | ||
| bool zcbor_new_decode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_decode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| const uint8_t *payload, size_t payload_len, uint_fast32_t elem_count); | ||
@@ -318,6 +320,2 @@ | ||
| * | ||
| * The return value from @ref zcbor_new_encode_state can be safely ignored | ||
| * because the only error condition is n_states < 2, and this macro adds 2 to | ||
| * num_backups to get n_states, so it can never be < 2. | ||
| * | ||
| * @param[in] name The name of the new state variable. | ||
@@ -332,5 +330,5 @@ * @param[in] num_backups The number of backup slots to keep in the state. | ||
| do { \ | ||
| (void)zcbor_new_decode_state(name, ARRAY_SIZE(name), payload, payload_size, elem_count); \ | ||
| zcbor_new_decode_state(name, ARRAY_SIZE(name), payload, payload_size, elem_count); \ | ||
| } while(0) | ||
| #endif /* ZCBOR_DECODE_H__ */ |
+14
-12
@@ -33,4 +33,5 @@ /* | ||
| bool zcbor_int64_put(zcbor_state_t *state, int64_t input); | ||
| bool zcbor_uint32_put(zcbor_state_t *state, uint32_t result); | ||
| bool zcbor_uint32_put(zcbor_state_t *state, uint32_t input); | ||
| bool zcbor_uint64_put(zcbor_state_t *state, uint64_t input); | ||
| bool zcbor_size_put(zcbor_state_t *state, size_t input); | ||
@@ -43,4 +44,5 @@ /** Encode a pint/nint from a pointer. | ||
| bool zcbor_int64_encode(zcbor_state_t *state, const int64_t *input); | ||
| bool zcbor_uint32_encode(zcbor_state_t *state, const uint32_t *result); | ||
| bool zcbor_uint32_encode(zcbor_state_t *state, const uint32_t *input); | ||
| bool zcbor_uint64_encode(zcbor_state_t *state, const uint64_t *input); | ||
| bool zcbor_size_encode(zcbor_state_t *state, const size_t *input); | ||
@@ -58,9 +60,13 @@ /** Encode a bstr. */ | ||
| */ | ||
| static inline bool zcbor_bstr_encode_ptr(zcbor_state_t *state, uint8_t *ptr, size_t len) | ||
| static inline bool zcbor_bstr_encode_ptr(zcbor_state_t *state, const uint8_t *ptr, size_t len) | ||
| { | ||
| return zcbor_bstr_encode(state, &(struct zcbor_string){.value = ptr, .len = len}); | ||
| const struct zcbor_string zs = { .value = ptr, .len = len }; | ||
| return zcbor_bstr_encode(state, &zs); | ||
| } | ||
| static inline bool zcbor_tstr_encode_ptr(zcbor_state_t *state, uint8_t *ptr, size_t len) | ||
| static inline bool zcbor_tstr_encode_ptr(zcbor_state_t *state, const uint8_t *ptr, size_t len) | ||
| { | ||
| return zcbor_tstr_encode(state, &(struct zcbor_string){.value = ptr, .len = len}); | ||
| const struct zcbor_string zs = { .value = ptr, .len = len }; | ||
| return zcbor_tstr_encode(state, &zs); | ||
| } | ||
@@ -254,3 +260,3 @@ | ||
| /** See @ref zcbor_new_state() */ | ||
| bool zcbor_new_encode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_encode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| uint8_t *payload, size_t payload_len, uint_fast32_t elem_count); | ||
@@ -263,6 +269,2 @@ | ||
| * | ||
| * The return value from @ref zcbor_new_encode_state can be safely ignored | ||
| * because the only error condition is n_states < 2, and this macro adds 2 to | ||
| * num_backups to get n_states, so it can never be < 2. | ||
| * | ||
| * @param[in] name The name of the new state variable. | ||
@@ -277,5 +279,5 @@ * @param[in] num_backups The number of backup slots to keep in the state. | ||
| do { \ | ||
| (void)zcbor_new_encode_state(name, ARRAY_SIZE(name), payload, payload_size, elem_count); \ | ||
| zcbor_new_encode_state(name, ARRAY_SIZE(name), payload, payload_size, elem_count); \ | ||
| } while(0) | ||
| #endif /* ZCBOR_ENCODE_H__ */ |
+26
-18
| Metadata-Version: 2.1 | ||
| Name: zcbor | ||
| Version: 0.4.0 | ||
| Version: 0.5.0 | ||
| Summary: zcbor | ||
@@ -8,3 +8,2 @@ Home-page: https://github.com/NordicSemiconductor/zcbor | ||
| License: Apache Software License | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 4 - Beta | ||
@@ -14,3 +13,3 @@ Classifier: License :: OSI Approved :: Apache Software License | ||
| Classifier: Topic :: Software Development :: Build Tools | ||
| Requires-Python: >=3.6 | ||
| Requires-Python: >=3.7 | ||
| Description-Content-Type: text/markdown | ||
@@ -35,3 +34,3 @@ License-File: LICENSE | ||
| The CBOR library found at [headers](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/include) and [source](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/src) is used by the generated code, but can also be used directly. | ||
| The CBOR library found at [headers](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/include) and [source](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/src) is used by the generated code, but can also be used directly. | ||
| If so, you must instantiate a `zcbor_state_t` object, which is most easily done using the `zcbor_new_*_state()` functions or the `ZCBOR_STATE_*()` macros. | ||
@@ -55,3 +54,3 @@ | ||
| */ | ||
| cbor_state_t states[n]; | ||
| zcbor_state_t states[n]; | ||
@@ -90,3 +89,3 @@ /** Initialize the states. After calling this, states[0] is ready to be used | ||
| By invoking `zcbor` (when installed via Pip or setup.py), or the Python script [zcbor.py](https://github.com/NordicSemiconductor/zcbor/blob/0.4.0/zcbor/zcbor.py) directly, you can generate C code that validates/encodes/decodes CBOR data conforming to a CDDL schema. | ||
| By invoking `zcbor` (when installed via Pip or setup.py), or the Python script [zcbor.py](https://github.com/NordicSemiconductor/zcbor/blob/0.5.0/zcbor/zcbor.py) directly, you can generate C code that validates/encodes/decodes CBOR data conforming to a CDDL schema. | ||
| zcbor can also validate and convert CBOR data to and from JSON/YAML, either from the command line, or imported as a module. | ||
@@ -170,3 +169,3 @@ Finally, the package contains a light-weight CBOR encoding/decoding library in C. | ||
| There are tests for the code generation in [tests/](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/). | ||
| There are tests for the code generation in [tests/](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/). | ||
| The tests require [Zephyr](https://github.com/zephyrproject-rtos/zephyr) (if your shell is set up to build Zephyr samples, the tests should also build). | ||
@@ -233,3 +232,3 @@ | ||
| See [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/decode/test3_simple/) for CDDL example code. | ||
| See [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/decode/test3_simple/) for CDDL example code. | ||
@@ -284,3 +283,3 @@ Introduction to CBOR | ||
| This example is is taken from [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/decode/test3_simple/). | ||
| This example is is taken from [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/decode/test3_simple/). | ||
@@ -391,3 +390,3 @@ If your CDDL file contains the following code: | ||
| There are also test.sh scripts to quickly run all tests. | ||
| [`tests/test.sh`](https://github.com/NordicSemiconductor/zcbor/blob/0.4.0/tests/test.sh) runs all tests, including python tests in [`tests/scripts`](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/scripts). | ||
| [`tests/test.sh`](https://github.com/NordicSemiconductor/zcbor/blob/0.5.0/tests/test.sh) runs all tests, including python tests in [`tests/scripts`](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/scripts). | ||
@@ -397,3 +396,3 @@ These tests are dependent upon the `pycodestyle` package from `pip`. | ||
| To set up the environment to run the ztest tests, follow [Zephyr's Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html), or see the workflow in the [`.github`](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/.github) directory. | ||
| To set up the environment to run the ztest tests, follow [Zephyr's Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html), or see the workflow in the [`.github`](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/.github) directory. | ||
@@ -421,3 +420,3 @@ Command line documentation | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -434,3 +433,8 @@ --version show program's version number and exit | ||
| value of this option is 3. Set it to a large number | ||
| when not relevant. | ||
| when not relevant. When generating code, the | ||
| default_max_qty can usually be set to a text symbol, | ||
| to allow it to be configurable when building the code. | ||
| This is not always possible, as sometimes the value is | ||
| needed for internal computations. If so, the script | ||
| will raise an exception. | ||
| --no-prelude Exclude the standard CDDL prelude from the build. The | ||
@@ -453,3 +457,3 @@ prelude can be viewed at zcbor/cddl/prelude.cddl in | ||
| [--git-sha-header] [-b {32,64}] | ||
| [--include-prefix INCLUDE_PREFIX] | ||
| [--include-prefix INCLUDE_PREFIX] [-s] | ||
@@ -471,3 +475,3 @@ Parse a CDDL file and produce C code that validates and xcodes CBOR. | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -529,2 +533,8 @@ --output-c OUTPUT_C, --oc OUTPUT_C | ||
| prefix to the filename. | ||
| -s, --short-names Attempt to make most generated struct member names | ||
| shorter. This might make some names identical which | ||
| will cause a compile error. If so, tweak the CDDL | ||
| labels or layout, or disable this option. This might | ||
| also make enum names different from the corresponding | ||
| union members. | ||
@@ -560,3 +570,3 @@ ``` | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -590,3 +600,1 @@ -i INPUT, --input INPUT | ||
| ``` | ||
+17
-6
@@ -36,3 +36,3 @@ zcbor | ||
| */ | ||
| cbor_state_t states[n]; | ||
| zcbor_state_t states[n]; | ||
@@ -396,3 +396,3 @@ /** Initialize the states. After calling this, states[0] is ready to be used | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -409,3 +409,8 @@ --version show program's version number and exit | ||
| value of this option is 3. Set it to a large number | ||
| when not relevant. | ||
| when not relevant. When generating code, the | ||
| default_max_qty can usually be set to a text symbol, | ||
| to allow it to be configurable when building the code. | ||
| This is not always possible, as sometimes the value is | ||
| needed for internal computations. If so, the script | ||
| will raise an exception. | ||
| --no-prelude Exclude the standard CDDL prelude from the build. The | ||
@@ -428,3 +433,3 @@ prelude can be viewed at zcbor/cddl/prelude.cddl in | ||
| [--git-sha-header] [-b {32,64}] | ||
| [--include-prefix INCLUDE_PREFIX] | ||
| [--include-prefix INCLUDE_PREFIX] [-s] | ||
@@ -446,3 +451,3 @@ Parse a CDDL file and produce C code that validates and xcodes CBOR. | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -504,2 +509,8 @@ --output-c OUTPUT_C, --oc OUTPUT_C | ||
| prefix to the filename. | ||
| -s, --short-names Attempt to make most generated struct member names | ||
| shorter. This might make some names identical which | ||
| will cause a compile error. If so, tweak the CDDL | ||
| labels or layout, or disable this option. This might | ||
| also make enum names different from the corresponding | ||
| union members. | ||
@@ -535,3 +546,3 @@ ``` | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -538,0 +549,0 @@ -i INPUT, --input INPUT |
@@ -1,3 +0,3 @@ | ||
| cbor2>=5.4.0 | ||
| pyyaml~=5.4.1 | ||
| regex>=2020.11.13 | ||
| cbor2>=5.4.2.post1 | ||
| pyyaml>=6.0.0 | ||
| regex>=2022.3.15 |
+1
-1
@@ -78,3 +78,3 @@ #!/usr/bin/env python3 | ||
| ], | ||
| python_requires='>=3.6', | ||
| python_requires='>=3.7', | ||
| packages=setuptools.find_packages(), | ||
@@ -81,0 +81,0 @@ install_requires=get_dependencies(), |
@@ -126,3 +126,3 @@ /* | ||
| bool zcbor_new_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| const uint8_t *payload, size_t payload_len, uint_fast32_t elem_count) | ||
@@ -138,3 +138,3 @@ { | ||
| if(n_states < 2) { | ||
| return false; | ||
| return; | ||
| } | ||
@@ -154,3 +154,2 @@ | ||
| } | ||
| return true; | ||
| } | ||
@@ -157,0 +156,0 @@ |
+19
-3
@@ -270,2 +270,10 @@ /* | ||
| #ifdef ZCBOR_SUPPORTS_SIZE_T | ||
| bool zcbor_size_decode(zcbor_state_t *state, size_t *result) | ||
| { | ||
| return value_extract(state, result, sizeof(size_t)); | ||
| } | ||
| #endif | ||
| bool zcbor_uint32_expect(zcbor_state_t *state, uint32_t result) | ||
@@ -292,2 +300,10 @@ { | ||
| #ifdef ZCBOR_SUPPORTS_SIZE_T | ||
| bool zcbor_size_expect(zcbor_state_t *state, size_t result) | ||
| { | ||
| return zcbor_uint64_expect(state, result); | ||
| } | ||
| #endif | ||
| static bool str_start_decode(zcbor_state_t *state, | ||
@@ -321,4 +337,4 @@ struct zcbor_string *result, zcbor_major_type_t exp_major_type) | ||
| { | ||
| struct zcbor_string dummy; | ||
| if (result == NULL) { | ||
| struct zcbor_string dummy; | ||
| result = &dummy; | ||
@@ -913,6 +929,6 @@ } | ||
| bool zcbor_new_decode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_decode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| const uint8_t *payload, size_t payload_len, uint_fast32_t elem_count) | ||
| { | ||
| return zcbor_new_state(state_array, n_states, payload, payload_len, elem_count); | ||
| zcbor_new_state(state_array, n_states, payload, payload_len, elem_count); | ||
| } |
+28
-7
@@ -236,2 +236,15 @@ /* | ||
| #ifdef ZCBOR_SUPPORTS_SIZE_T | ||
| bool zcbor_size_put(zcbor_state_t *state, size_t input) | ||
| { | ||
| return zcbor_uint64_put(state, input); | ||
| } | ||
| bool zcbor_size_encode(zcbor_state_t *state, const size_t *input) | ||
| { | ||
| return zcbor_size_put(state, *input); | ||
| } | ||
| #endif | ||
| static bool str_start_encode(zcbor_state_t *state, | ||
@@ -410,2 +423,11 @@ const struct zcbor_string *input, zcbor_major_type_t major_type) | ||
| /** If max_num is smaller than the actual number of encoded elements, | ||
| * the value_encode() below will corrupt the data if the encoded | ||
| * header is larger than the previously encoded header. */ | ||
| if (header_len > max_header_len) { | ||
| zcbor_print("max_num too small.\r\n"); | ||
| ZCBOR_ERR(ZCBOR_ERR_HIGH_ELEM_COUNT); | ||
| } | ||
| /* Reencode header of list now that we know the number of elements. */ | ||
@@ -419,5 +441,4 @@ if (!(value_encode(state, major_type, &list_count, sizeof(list_count)))) { | ||
| size_t body_size = (size_t)payload - (size_t)start; | ||
| memmove(state->payload_mut, | ||
| state->payload + max_header_len - header_len, | ||
| body_size); | ||
| memmove(state->payload_mut, start, body_size); | ||
| /* Reset payload pointer to end of list */ | ||
@@ -496,3 +517,3 @@ state->payload += body_size; | ||
| { | ||
| if (!value_encode(state, ZCBOR_MAJOR_TYPE_PRIM, input, | ||
| if (!value_encode_len(state, ZCBOR_MAJOR_TYPE_PRIM, input, | ||
| sizeof(*input))) { | ||
@@ -514,3 +535,3 @@ ZCBOR_FAIL(); | ||
| { | ||
| if (!value_encode(state, ZCBOR_MAJOR_TYPE_PRIM, input, | ||
| if (!value_encode_len(state, ZCBOR_MAJOR_TYPE_PRIM, input, | ||
| sizeof(*input))) { | ||
@@ -583,6 +604,6 @@ ZCBOR_FAIL(); | ||
| bool zcbor_new_encode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| void zcbor_new_encode_state(zcbor_state_t *state_array, uint_fast32_t n_states, | ||
| uint8_t *payload, size_t payload_len, uint_fast32_t elem_count) | ||
| { | ||
| return zcbor_new_state(state_array, n_states, payload, payload_len, elem_count); | ||
| zcbor_new_state(state_array, n_states, payload, payload_len, elem_count); | ||
| } |
+26
-18
| Metadata-Version: 2.1 | ||
| Name: zcbor | ||
| Version: 0.4.0 | ||
| Version: 0.5.0 | ||
| Summary: zcbor | ||
@@ -8,3 +8,2 @@ Home-page: https://github.com/NordicSemiconductor/zcbor | ||
| License: Apache Software License | ||
| Platform: UNKNOWN | ||
| Classifier: Development Status :: 4 - Beta | ||
@@ -14,3 +13,3 @@ Classifier: License :: OSI Approved :: Apache Software License | ||
| Classifier: Topic :: Software Development :: Build Tools | ||
| Requires-Python: >=3.6 | ||
| Requires-Python: >=3.7 | ||
| Description-Content-Type: text/markdown | ||
@@ -35,3 +34,3 @@ License-File: LICENSE | ||
| The CBOR library found at [headers](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/include) and [source](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/src) is used by the generated code, but can also be used directly. | ||
| The CBOR library found at [headers](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/include) and [source](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/src) is used by the generated code, but can also be used directly. | ||
| If so, you must instantiate a `zcbor_state_t` object, which is most easily done using the `zcbor_new_*_state()` functions or the `ZCBOR_STATE_*()` macros. | ||
@@ -55,3 +54,3 @@ | ||
| */ | ||
| cbor_state_t states[n]; | ||
| zcbor_state_t states[n]; | ||
@@ -90,3 +89,3 @@ /** Initialize the states. After calling this, states[0] is ready to be used | ||
| By invoking `zcbor` (when installed via Pip or setup.py), or the Python script [zcbor.py](https://github.com/NordicSemiconductor/zcbor/blob/0.4.0/zcbor/zcbor.py) directly, you can generate C code that validates/encodes/decodes CBOR data conforming to a CDDL schema. | ||
| By invoking `zcbor` (when installed via Pip or setup.py), or the Python script [zcbor.py](https://github.com/NordicSemiconductor/zcbor/blob/0.5.0/zcbor/zcbor.py) directly, you can generate C code that validates/encodes/decodes CBOR data conforming to a CDDL schema. | ||
| zcbor can also validate and convert CBOR data to and from JSON/YAML, either from the command line, or imported as a module. | ||
@@ -170,3 +169,3 @@ Finally, the package contains a light-weight CBOR encoding/decoding library in C. | ||
| There are tests for the code generation in [tests/](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/). | ||
| There are tests for the code generation in [tests/](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/). | ||
| The tests require [Zephyr](https://github.com/zephyrproject-rtos/zephyr) (if your shell is set up to build Zephyr samples, the tests should also build). | ||
@@ -233,3 +232,3 @@ | ||
| See [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/decode/test3_simple/) for CDDL example code. | ||
| See [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/decode/test3_simple/) for CDDL example code. | ||
@@ -284,3 +283,3 @@ Introduction to CBOR | ||
| This example is is taken from [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/decode/test3_simple/). | ||
| This example is is taken from [test3_simple](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/decode/test3_simple/). | ||
@@ -391,3 +390,3 @@ If your CDDL file contains the following code: | ||
| There are also test.sh scripts to quickly run all tests. | ||
| [`tests/test.sh`](https://github.com/NordicSemiconductor/zcbor/blob/0.4.0/tests/test.sh) runs all tests, including python tests in [`tests/scripts`](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/tests/scripts). | ||
| [`tests/test.sh`](https://github.com/NordicSemiconductor/zcbor/blob/0.5.0/tests/test.sh) runs all tests, including python tests in [`tests/scripts`](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/tests/scripts). | ||
@@ -397,3 +396,3 @@ These tests are dependent upon the `pycodestyle` package from `pip`. | ||
| To set up the environment to run the ztest tests, follow [Zephyr's Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html), or see the workflow in the [`.github`](https://github.com/NordicSemiconductor/zcbor/tree/0.4.0/.github) directory. | ||
| To set up the environment to run the ztest tests, follow [Zephyr's Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html), or see the workflow in the [`.github`](https://github.com/NordicSemiconductor/zcbor/tree/0.5.0/.github) directory. | ||
@@ -421,3 +420,3 @@ Command line documentation | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -434,3 +433,8 @@ --version show program's version number and exit | ||
| value of this option is 3. Set it to a large number | ||
| when not relevant. | ||
| when not relevant. When generating code, the | ||
| default_max_qty can usually be set to a text symbol, | ||
| to allow it to be configurable when building the code. | ||
| This is not always possible, as sometimes the value is | ||
| needed for internal computations. If so, the script | ||
| will raise an exception. | ||
| --no-prelude Exclude the standard CDDL prelude from the build. The | ||
@@ -453,3 +457,3 @@ prelude can be viewed at zcbor/cddl/prelude.cddl in | ||
| [--git-sha-header] [-b {32,64}] | ||
| [--include-prefix INCLUDE_PREFIX] | ||
| [--include-prefix INCLUDE_PREFIX] [-s] | ||
@@ -471,3 +475,3 @@ Parse a CDDL file and produce C code that validates and xcodes CBOR. | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -529,2 +533,8 @@ --output-c OUTPUT_C, --oc OUTPUT_C | ||
| prefix to the filename. | ||
| -s, --short-names Attempt to make most generated struct member names | ||
| shorter. This might make some names identical which | ||
| will cause a compile error. If so, tweak the CDDL | ||
| labels or layout, or disable this option. This might | ||
| also make enum names different from the corresponding | ||
| union members. | ||
@@ -560,3 +570,3 @@ ``` | ||
| optional arguments: | ||
| options: | ||
| -h, --help show this help message and exit | ||
@@ -590,3 +600,1 @@ -i INPUT, --input INPUT | ||
| ``` | ||
@@ -1,3 +0,3 @@ | ||
| cbor2>=5.4.0 | ||
| pyyaml~=5.4.1 | ||
| regex>=2020.11.13 | ||
| cbor2>=5.4.2.post1 | ||
| pyyaml>=6.0.0 | ||
| regex>=2022.3.15 |
+1
-1
@@ -1,1 +0,1 @@ | ||
| 0.4.0 | ||
| 0.5.0 |
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
315539
2.37%2757
2.83%