1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-07-22 18:57:39 +02:00

put back sanity check that dimensioning variables are positive

This commit is contained in:
q-posev 2021-09-20 17:00:05 +02:00
parent ce0d98b984
commit c22e9d2925
2 changed files with 8 additions and 1 deletions

View File

@ -1181,6 +1181,7 @@ trexio_exit_code
trexio_write_$group_num$_64 (trexio_t* const file, const $group_num_dtype_double$ num)
{
if (file == NULL) return TREXIO_INVALID_ARG_1;
//if (num < 0L) return TREXIO_INVALID_ARG_2; /* this line is uncommented by the generator for dimensioning variables; do NOT remove! */
if (trexio_has_$group_num$(file) == TREXIO_SUCCESS) return TREXIO_ATTR_ALREADY_EXISTS;
switch (file->back_end) {
@ -1244,7 +1245,7 @@ trexio_write_$group_num$_32 (trexio_t* const file, const $group_num_dtype_single
{
if (file == NULL) return TREXIO_INVALID_ARG_1;
//if (num < 0 ) return TREXIO_INVALID_ARG_2;
//if (num < 0) return TREXIO_INVALID_ARG_2; /* this line is uncommented by the generator for dimensioning variables; do NOT remove! */
if (trexio_has_$group_num$(file) == TREXIO_SUCCESS) return TREXIO_ATTR_ALREADY_EXISTS;
switch (file->back_end) {

View File

@ -129,6 +129,12 @@ def recursive_populate_file(fname: str, paths: dict, detailed_source: dict) -> N
f_out.write(templine)
num_written = []
continue
# special case to uncomment check for positive dimensioning variables in templates
elif 'uncommented by the generator for dimensioning' in line:
# only uncomment and write the line if `num` is in the name
if 'num' in item:
templine = line.replace('//', '')
f_out.write(templine)
# general case of recursive replacement of inline triggers
else:
populated_line = recursive_replace_line(line, triggers, detailed_source[item])