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

portability patch for mac

This commit is contained in:
q-posev 2021-05-06 09:19:05 +02:00
parent 4cbc9c29f0
commit 48d300674a
2 changed files with 9 additions and 9 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("%lu -> %lu %s \n", num, infile_num, printf("%llu -> %llu %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

@ -347,7 +347,7 @@ trexio_text_read_$group$ (trexio_text_t* const file)
return NULL; return NULL;
} }
rc = fscanf(f, "%lu\n", &($group$->dims_$group_dset$[i])); rc = fscanf(f, "%llu\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, "%lu", &($group$->$group_num$)); rc = fscanf(f, "%llu", &($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 %lu\n", i, $group$->dims_$group_dset$[i]); fprintf(f, "dims_$group_dset$ %u %llu\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$ %lu\n", $group$->$group_num$); fprintf(f, "$group_num$ %llu\n", $group$->$group_num$);
// END REPEAT GROUP_NUM // END REPEAT GROUP_NUM
/* Write arrays */ /* Write arrays */
@ -758,7 +758,7 @@ rdm_t* trexio_text_read_rdm(trexio_text_t* const file) {
assert (rc == 1); assert (rc == 1);
assert (strcmp(buffer, "dim_one_e") == 0); assert (strcmp(buffer, "dim_one_e") == 0);
rc = fscanf(f, "%lu", &(rdm->dim_one_e)); rc = fscanf(f, "%llu", &(rdm->dim_one_e));
assert (rc == 1); assert (rc == 1);
/* Allocate arrays */ /* Allocate arrays */
@ -831,7 +831,7 @@ trexio_exit_code trexio_text_flush_rdm(trexio_text_t* const file) {
fseek(f, 0L, SEEK_SET); fseek(f, 0L, SEEK_SET);
/* Write the dimensioning variables */ /* Write the dimensioning variables */
fprintf(f, "num %lu\n", rdm->dim_one_e); fprintf(f, "num %llu\n", rdm->dim_one_e);
/* Write arrays */ /* Write arrays */
fprintf(f, "one_e\n"); fprintf(f, "one_e\n");
@ -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, "%9ld %9ld %9ld %9ld %24le\n", int rc = fscanf(f, "%9lld %9lld %9lld %9lld %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, "%9ld %9ld %9ld %9ld %24le\n", int rc = fprintf(f, "%9lld %9lld %9lld %9lld %24le\n",
index[4*i], index[4*i],
index[4*i+1], index[4*i+1],
index[4*i+2], index[4*i+2],