1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-31 16:45:59 +01:00

working and compiling for nucleus

This commit is contained in:
q-posev 2021-03-17 14:33:32 +01:00
parent c3321b04fd
commit fcfe91d498
4 changed files with 77 additions and 15 deletions

View File

@ -1,14 +1,42 @@
#!/bin/bash
echo "create populated directories"
mkdir -p templates_front/populated
mkdir -p templates_text/populated
mkdir -p templates_hdf5/populated
echo "remove existing templates"
rm templates_front/*.c
rm templates_text/*.c
rm templates_hdf5/*.c
rm templates_front/*.h
rm templates_text/*.h
rm templates_hdf5/*.h
echo "clean populated directories"
rm templates_front/populated/*
rm templates_text/populated/*
rm templates_hdf5/populated/*
echo "tangle org files to generate templates"
cd templates_front
emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "templator_front.org")'
cd ..
cd templates_text
emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "templator_text.org")'
cd ..
cd templates_hdf5
emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "templator_hdf5.org")'
cd ..
echo "run generator script to populate templates"
python generator.py
sleep 2
echo "compile populated files in the lib source files "
cd templates_front
source build.sh
cp trexio* ../

View File

@ -245,7 +245,7 @@ for fname in files_funcs_dsets:
if not dim.isdigit():
templine1 = line.replace('$group_dset_dim$', dim)
templine2 = templine1
if '_read' in templine2:
if '_read' in templine2 and 'hdf5' in fname:
templine1 = rc_line
templine2 += templine1
@ -292,8 +292,8 @@ for fname in files_funcs_nums:
if '_text' in fname:
templ_path = templ_path_text
#for dim in dim_variables.keys():
for dim in numbers.keys():
for dim in dim_variables.keys():
#for dim in numbers.keys():
grname = dim.split('_')[0]
with open(join(templ_path,fname), 'r') as f_in :
with open(join(templ_path,fname_new), 'a') as f_out :

View File

@ -1,13 +1,15 @@
#!/bin/sh
#!/bin/bash
cat prefix_front.c > trexio.c
cat prefix_front.h > trexio.h
cat prefix_s_front.h > trexio_s.h
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cat populated/pop_*.c >> trexio.c
cat populated/pop_*.h >> trexio.h
cat $DIR/prefix_front.c > trexio.c
cat $DIR/prefix_front.h > trexio.h
cat $DIR/prefix_s_front.h > trexio_s.h
cat suffix_s_front.h >> trexio_s.h
cat suffix_front.h >> trexio.h
cat $DIR/populated/pop_*.c >> trexio.c
cat $DIR/populated/pop_*.h >> trexio.h
cat $DIR/suffix_s_front.h >> trexio_s.h
cat $DIR/suffix_front.h >> trexio.h

View File

@ -438,8 +438,25 @@ trexio_exit_code trexio_read_$group$_$group_dset$(trexio_t* file, $group_dset_dt
trexio_exit_code rc;
uint64_t $group_dset_dim$ = -1;
// error handling for rc is added by the generator
rc = trexio_hdf5_read_$group_dset_dim$(file, &$group_dset_dim$);
switch (file->back_end) {
case TREXIO_TEXT:
rc = trexio_text_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
case TREXIO_HDF5:
rc = trexio_hdf5_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
/*
case TREXIO_JSON:
rc = trexio_json_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
*/
}
if (rc != TREXIO_SUCCESS) return rc;
if ($group_dset_dim$ <= 0L) return TREXIO_INVALID_NUM;
uint32_t rank = $group_dset_rank$;
@ -473,8 +490,23 @@ trexio_exit_code trexio_write_$group$_$group_dset$(trexio_t* file, const $group_
trexio_exit_code rc;
uint64_t $group_dset_dim$ = -1;
// error handling for rc is added by the generator
rc = trexio_hdf5_read_$group_dset_dim$(file, &$group_dset_dim$);
switch (file->back_end) {
case TREXIO_TEXT:
rc = trexio_text_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
case TREXIO_HDF5:
rc = trexio_hdf5_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
/*
case TREXIO_JSON:
rc = trexio_json_read_$group_dset_dim$(file, &$group_dset_dim$);
break;
*/
}
if (rc != TREXIO_SUCCESS) return rc;
if ($group_dset_dim$ <= 0L) return TREXIO_INVALID_NUM;
uint32_t rank = $group_dset_rank$;