1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

discard portability patch

This commit is contained in:
q-posev 2021-05-06 09:35:48 +02:00
parent c35362f933
commit d3b35ae453
3 changed files with 12 additions and 12 deletions

View File

@ -235,7 +235,7 @@ trexio_hdf5_write_$group_num$ (trexio_t* const file, const uint64_t num)
if (infile_num != num) { if (infile_num != num) {
if (infile_num != 0) { if (infile_num != 0) {
printf("%llu -> %llu %s \n", num, infile_num, printf("%lu -> %lu %s \n", num, infile_num,
"This variable already exists. Overwriting it is not supported"); "This variable already exists. Overwriting it is not supported");
return TREXIO_FAILURE; return TREXIO_FAILURE;

View File

@ -226,7 +226,7 @@ trexio_text_unlock (trexio_t* const file)
} }
#+end_src #+end_src
** Deinitialize function (templated part) ** Deinitialize function (templated part)
#+begin_src c :tangle basic_text_group.c #+begin_src c :tangle basic_text_group.c
@ -283,7 +283,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
strncpy (file_name, file->parent.file_name, TREXIO_MAX_FILENAME_LENGTH); strncpy (file_name, file->parent.file_name, TREXIO_MAX_FILENAME_LENGTH);
strncat (file_name, $group$_file_name, strncat (file_name, $group$_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen($group$_file_name)); TREXIO_MAX_FILENAME_LENGTH-strlen($group$_file_name));
if (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != '\0') { if (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != '\0') {
FREE(file_name); FREE(file_name);
@ -347,7 +347,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
return NULL; return NULL;
} }
rc = fscanf(f, "%llu\n", &($group$->dims_$group_dset$[i])); rc = fscanf(f, "%lu\n", &($group$->dims_$group_dset$[i]));
assert(!(rc != 1)); assert(!(rc != 1));
if (rc != 1) { if (rc != 1) {
FREE(buffer); FREE(buffer);
@ -373,7 +373,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
return NULL; return NULL;
} }
rc = fscanf(f, "%llu", &($group$->$group_num$)); rc = fscanf(f, "%lu", &($group$->$group_num$));
assert(!(rc != 1)); assert(!(rc != 1));
if (rc != 1) { if (rc != 1) {
FREE(buffer); FREE(buffer);
@ -479,14 +479,14 @@ trexio_text_flush_$group$ (trexio_text_t* const file)
if ($group$->rank_$group_dset$ != 0) size_$group_dset$ = 1; if ($group$->rank_$group_dset$ != 0) size_$group_dset$ = 1;
for (unsigned int i=0; i<$group$->rank_$group_dset$; ++i){ for (unsigned int i=0; i<$group$->rank_$group_dset$; ++i){
fprintf(f, "dims_$group_dset$ %u %llu\n", i, $group$->dims_$group_dset$[i]); fprintf(f, "dims_$group_dset$ %u %lu\n", i, $group$->dims_$group_dset$[i]);
size_$group_dset$ *= $group$->dims_$group_dset$[i]; size_$group_dset$ *= $group$->dims_$group_dset$[i];
} }
// END REPEAT GROUP_DSET // END REPEAT GROUP_DSET
// START REPEAT GROUP_NUM // START REPEAT GROUP_NUM
fprintf(f, "$group_num$ %llu\n", $group$->$group_num$); fprintf(f, "$group_num$ %lu\n", $group$->$group_num$);
// END REPEAT GROUP_NUM // END REPEAT GROUP_NUM
/* Write arrays */ /* Write arrays */
@ -734,7 +734,7 @@ rdm_t* trexio_text_read_rdm(trexio_text_t* const file) {
strncpy (file_name, file->parent.file_name, TREXIO_MAX_FILENAME_LENGTH); strncpy (file_name, file->parent.file_name, TREXIO_MAX_FILENAME_LENGTH);
strncat (file_name, rdm_file_name, strncat (file_name, rdm_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(rdm_file_name)); TREXIO_MAX_FILENAME_LENGTH-strlen(rdm_file_name));
if (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != '\0') { if (file_name[TREXIO_MAX_FILENAME_LENGTH-1] != '\0') {
FREE(file_name); FREE(file_name);
@ -993,7 +993,7 @@ trexio_text_buffered_read_rdm_two_e(trexio_t* const file,
fseek(f, (long) offset * line_length, SEEK_SET); fseek(f, (long) offset * line_length, SEEK_SET);
for (uint64_t i=0 ; i<size ; ++i) { for (uint64_t i=0 ; i<size ; ++i) {
int rc = fscanf(f, "%9lld %9lld %9lld %9lld %24le\n", int rc = fscanf(f, "%9ld %9ld %9ld %9ld %24le\n",
&index[4*i], &index[4*i],
&index[4*i+1], &index[4*i+1],
&index[4*i+2], &index[4*i+2],
@ -1032,7 +1032,7 @@ trexio_text_buffered_write_rdm_two_e(trexio_t* const file,
fseek(f, (long) offset * line_length, SEEK_SET); fseek(f, (long) offset * line_length, SEEK_SET);
for (uint64_t i=0 ; i<size ; ++i) { for (uint64_t i=0 ; i<size ; ++i) {
int rc = fprintf(f, "%9lld %9lld %9lld %9lld %24le\n", int rc = fprintf(f, "%9ld %9ld %9ld %9ld %24le\n",
index[4*i], index[4*i],
index[4*i+1], index[4*i+1],
index[4*i+2], index[4*i+2],

View File

@ -151,8 +151,8 @@ for fname in files_funcs_groups:
std_dtype_out = '24.16e' std_dtype_out = '24.16e'
std_dtype_in = 'lf' std_dtype_in = 'lf'
elif params['dtype'] == 'int64_t': elif params['dtype'] == 'int64_t':
std_dtype_out = 'lld' std_dtype_out = 'ld'
std_dtype_in = 'lld' std_dtype_in = 'ld'
templine1 = templine2.replace('$group_dset_std_dtype_out$', std_dtype_out) templine1 = templine2.replace('$group_dset_std_dtype_out$', std_dtype_out)
templine2 = templine1.replace('$group_dset_std_dtype_in$', std_dtype_in) templine2 = templine1.replace('$group_dset_std_dtype_in$', std_dtype_in)