Change L to L1 in format

This commit is contained in:
Anthony Scemama 2016-05-17 20:48:04 +02:00
parent 073767edcc
commit 18199543e4
4 changed files with 23 additions and 35 deletions

View File

@ -27,7 +27,7 @@ format= {
'integer' : ["'(I20)'", "%20d"], 'integer' : ["'(I20)'", "%20d"],
'real' : ["'(E24.15)'","%24.15E"], 'real' : ["'(E24.15)'","%24.15E"],
'double precision': ["'(E24.15)'","%24.15E"], 'double precision': ["'(E24.15)'","%24.15E"],
'logical' : ["'(L)'","%c"], 'logical' : ["'(L1)'","%c"],
'character*(*)' : ["'(A)'","%s"] 'character*(*)' : ["'(A)'","%s"]
} }

View File

@ -94,7 +94,6 @@ for group in groups.keys():
buffer = re.sub(r"at\((.*),(.*)\)",r'\1(\2)',buffer) buffer = re.sub(r"at\((.*),(.*)\)",r'\1(\2)',buffer)
print buffer print buffer
print >>file_py, calculated_py%d print >>file_py, calculated_py%d
print >>file_c, calculated_c%d
elif type == "buffered": elif type == "buffered":
d = { 'group': group, d = { 'group': group,
'var': var, 'var': var,

View File

@ -249,7 +249,7 @@ void ezfio_get_%(group)s_%(var)s(%(ctype)s *%(var)s)
ezfio_get_%(group)s_%(var)s_(%(var)s); ezfio_get_%(group)s_%(var)s_(%(var)s);
} }
bool ezfio_has_%(group)s_%(var)s() int ezfio_has_%(group)s_%(var)s()
{ {
ezfio_has_%(group)s_%(var)s_(); ezfio_has_%(group)s_%(var)s_();
} }
@ -258,15 +258,15 @@ bool ezfio_has_%(group)s_%(var)s()
attributes_arr_c = """ attributes_arr_c = """
void ezfio_set_%(group)s_%(var)s(%(ctype)s %(var)s) void ezfio_set_%(group)s_%(var)s(%(ctype)s %(var)s)
{ {
ezfio_set_%(group)s_%(var)s_(&%(var)s, 1); ezfio_set_%(group)s_%(var)s_(&%(var)s);
} }
void ezfio_get_%(group)s_%(var)s(%(ctype)s *%(var)s) void ezfio_get_%(group)s_%(var)s(%(ctype)s *%(var)s)
{ {
ezfio_get_%(group)s_%(var)s_(%(var)s, 1); ezfio_get_%(group)s_%(var)s_(%(var)s);
} }
bool ezfio_has_%(group)s_%(var)s() int ezfio_has_%(group)s_%(var)s()
{ {
ezfio_has_%(group)s_%(var)s_(); ezfio_has_%(group)s_%(var)s_();
} }
@ -274,32 +274,13 @@ bool ezfio_has_%(group)s_%(var)s()
calculated_c = attributes_c calculated_c = attributes_c
c_header = """ c_header = """#ifndef EZFIO_H\n#define EZFIO_H
#ifndef EZFIO_H
#define EZFIO_H #include <string.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
"""
c_footer = """
#ifdef __cplusplus
}
#endif
#endif
"""
file_h = [c_header]
file_h +=[ """
void ezfio_set_file_(char* filename, long filename_size);
void ezfio_read_buffer_(int* indices,double* values, int* isize);
void ezfio_write_buffer_(int* indices,double* values, int* isize);
"""]
file_c = [ """
typedef struct typedef struct
{ {
@ -311,7 +292,7 @@ void ezfio_set_file(char* filename)
{ {
long len; long len;
len = strlen(filename); len = strlen(filename);
ezfio_set_file_(filename,mlen); ezfio_set_file_(filename,len);
} }
sparse ezfio_read_buffer(int isize) sparse ezfio_read_buffer(int isize)
@ -326,7 +307,15 @@ void ezfio_write_buffer(sparse data, int isize)
ezfio_write_buffer_(data.indices,data.values,&isize); ezfio_write_buffer_(data.indices,data.values,&isize);
} }
""" ] """
c_footer = """
#ifdef __cplusplus
}
#endif
#endif
"""

View File

@ -128,16 +128,16 @@ logical function exists(path)
character*(*) :: path character*(*) :: path
character*(32) :: V character*(32) :: V
inquire(file=trim(path)//'/.version',exist=exists) inquire(file=trim(path)//'/.version',exist=exists)
if (exists) then ! if (exists) then
open(libezfio_iunit,file=trim(path)//'/.version') ! open(libezfio_iunit,file=trim(path)//'/.version')
read(libezfio_iunit,*) V ! read(libezfio_iunit,*) V
close(libezfio_iunit) ! close(libezfio_iunit)
! integer :: char_to_version ! integer :: char_to_version
! if (char_to_version(V) > char_to_version(libezfio_version)) then ! if (char_to_version(V) > char_to_version(libezfio_version)) then
! call ezfio_error(irp_here, 'This file was generated with version '//trim(V)//& ! call ezfio_error(irp_here, 'This file was generated with version '//trim(V)//&
! ' but the current installed version is '//trim(libezfio_version)//'') ! ' but the current installed version is '//trim(libezfio_version)//'')
! endif ! endif
endif ! endif
end function end function
subroutine ezfio_set_file(filename_in) subroutine ezfio_set_file(filename_in)