10
0
mirror of https://gitlab.com/scemama/EZFIO.git synced 2024-12-22 12:23:34 +01:00

Merge pull request #4 from LCPQ/master

Merge LCPQ
This commit is contained in:
Anthony Scemama 2018-05-02 19:42:03 +02:00 committed by GitHub
commit 32c59688b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 86 additions and 124 deletions

View File

@ -4,7 +4,7 @@ EZFIO_ROOT=$( cd $(dirname "${BASH_SOURCE}")/.. ; pwd -P )
function _ezfio_py()
{
python "${EZFIO_ROOT}/Python/ezfio.py" $@
python ${EZFIO_ROOT}/Python/ezfio.py $@
}
@ -84,11 +84,11 @@ function _ezfio_set_file()
{
_require_first_argument $@ || return 1
if [[ ! -d "$1" ]]
if [[ ! -d $1 ]]
then
mkdir -p "$1" || return 1
mkdir -p $1 || return 1
fi
export EZFIO_FILE="$1"
export EZFIO_FILE=$1
_ezfio_info "Set file ${EZFIO_FILE}"
return 0
}
@ -106,12 +106,12 @@ function _ezfio_has()
_require_ezfio_file || return 1
_require_first_argument $@ || return 1
if [[ ! -d "${EZFIO_FILE}/${1,,}" ]]
if [[ ! -d ${EZFIO_FILE}/${1,,} ]]
then
return 1
fi
if [[ -z "$2" ]]
if [[ -z $2 ]]
then
return 0
fi
@ -123,14 +123,14 @@ function _ezfio_get()
{
_require_ezfio_file || return 1
if [[ -z "$1" ]]
if [[ -z $1 ]]
then
ls ${EZFIO_FILE} && return 0 || return 1
fi
if [[ -z "$2" ]]
if [[ -z $2 ]]
then
ls "${EZFIO_FILE}/${1,,}" && return 0 || return 1
ls ${EZFIO_FILE}/${1,,} && return 0 || return 1
fi
_ezfio_py get $@ && return 0 || return 1
@ -142,11 +142,11 @@ function _ezfio_set()
_require_first_argument $@ || return 1
_require_second_argument $@ || return 2
if [[ -z "$3" ]]
if [[ -z $3 ]]
then
_ezfio_py set $@ || return 1
else
echo "$3" | _ezfio_py set "$1" "$2" || return 1
echo $3 | _ezfio_py set $1 $2 || return 1
fi
return 0
}

View File

View File

@ -28,7 +28,8 @@ include make.config
.PHONY: default clean veryclean archive
default: make.config
cd src $(MAKE)
cd src && $(MAKE)
clean:
- bash -c "[[ -f lib/libezfio.a ]] && rm $$PWD/lib/*"

View File

@ -37,7 +37,7 @@ def main():
f_name = f[4:]
try:
exec """d['%s'] = ezfio.%s"""%(f_name,f_name)
except IOError:
except:
if do_verbose:
print "%-40s [%5s]"%(f_name, "Empty")
else:

View File

@ -113,7 +113,7 @@ rule build_libezfio_a
description = Building libezfio.a
rule build_libezfio_irp_a
command = cp lib/libezfio.a lib/libezfio_irp.a ; {RANLIB} lib/libezfio_irp.a
command = cp lib/libezfio.a lib/libezfio_irp.a ; {AR} dv lib/libezfio_irp.a irp_stack.irp.o > /dev/null ; {RANLIB} lib/libezfio_irp.a
description = Building libezfio_irp.a
rule build_python
@ -142,4 +142,5 @@ build Ocaml/ezfio.ml: build_ocaml | lib/libezfio.a
if __name__ == '__main__':
create_build_ninja()

View File

@ -1,55 +1,56 @@
.EXPORT_ALL_VARIABLES:
# EZFIO is an automatic generator of I/O libraries
# Copyright (C) 2009 Anthony SCEMAMA, CNRS
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Anthony Scemama
# LCPQ - IRSAMC - CNRS
# Universite Paul Sabatier
# 118, route de Narbonne
# 31062 Toulouse Cedex 4
# scemama@irsamc.ups-tlse.fr
DEFAULT_TARGET: all
include ../make.config
export
# Dark magic below modify with caution!
# "You are Not Expected to Understand This"
# .
# /^\ .
# /\ "V",
# /__\ I O o
# //..\\ I .
# \].`[/ I
# /l\/j\ (] . O
# /. ~~ ,\/I .
# \\L__j^\/I o
# \/--v} I o .
# | | I _________
# | | I c(` ')o
# | l I \. ,/
# _/j L l\_! _//^---^\\_
include irpf90.make
irpf90.make: $(wildcard *.irp.f) ../config/*
$(IRPF90)
ifeq ($(BUILD_SYSTEM),ninja)
BUILD_FILE=IRPF90_temp/build.ninja
IRPF90FLAGS += -j
else ifeq ($(BUILD_SYSTEM),make)
BUILD_FILE=IRPF90_temp/build.make
BUILD_SYSTEM += -j
else
DUMMY:
$(error 'Wrong BUILD_SYSTEM: $(BUILD_SYSTEM)')
endif
define run_and_touch
$(BUILD_SYSTEM) -C $(dir $(1) ) -f $(notdir $(1) ) $(addprefix $(CURDIR)/, $(2)) && touch $(2)
endef
export PYTHONPATH:=$(CURDIR):$(PYTHONPATH)
include ../version
.PHONY: static all
all: static ../Python/ezfio.py ../Ocaml/ezfio.ml
static: ../lib/libezfio.a ../lib/libezfio_irp.a
../lib/libezfio.a: IRPF90_temp/irpf90.a
rm -f ../lib/libezfio.a
cp IRPF90_temp/irpf90.a ../lib/libezfio.a
$(AR) cru ../lib/libezfio.a $(OBJ1)
$(RANLIB) ../lib/libezfio.a
#No more irp_stack
../lib/libezfio_irp.a: ../lib/libezfio.a
rm -f ../lib/libezfio_irp.a
cp ../lib/libezfio.a ../lib/libezfio_irp.a
$(AR) dv ../lib/libezfio_irp.a irp_stack.irp.o
$(RANLIB) ../lib/libezfio_irp.a
../Python/ezfio.py: ../lib/libezfio.a
python2 create_python.py
@ -57,15 +58,4 @@ static: ../lib/libezfio.a ../lib/libezfio_irp.a
../Ocaml/ezfio.ml: ../lib/libezfio.a
python2 create_ocaml.py
IRPF90_temp/irpf90.a: $(BUILD_FILE)
$(call run_and_touch, $<, $@)
$(BUILD_FILE): $(shell find . -maxdepth 2 -path ./IRPF90_temp -prune -o -name '*.irp.f' -print) ../config/*
$(IRPF90) $(IRPF90FLAGS)
clean:
rm -f -- $(BUILD_FILE) $(shell find IRPF90_temp -type f \( -name "*.o" -o -name "*.mod" -name "*.a" \) -delete;)
rm -f ../lib/libezfio.a ../lib/libezfio_irp.a
veryclean: clean
rm -rf IRPF90_temp/ IRPF90_man/ irpf90_entities dist tags

View File

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

View File

@ -40,9 +40,6 @@ print >>file_py, """
version = property(fset=None,fget=get_version)
"""%(v)
file_c = open("../C/ezfio.h","w")
print >>file_c, c_header
import sys
for group in groups.keys():
@ -80,7 +77,6 @@ for group in groups.keys():
'group': group,
'dims': strdims}
print attributes%d
print >>file_c, attributes_c%d
print >>file_py, attributes_py%d
else:
d = { 'type': type,
@ -100,7 +96,6 @@ for group in groups.keys():
'dims_py': dims_py,
'dims': dims }
print buffered%d
print >>file_c, buffered_c%d
print >>file_py, buffered_py%d
else:
dims_loop = ''
@ -147,9 +142,5 @@ for group in groups.keys():
'declar_loop' : declar_loop}
print attributes_arr%d
print >>file_py, attributes_arr_py%d
print >>file_c, attributes_arr_c%d
print >>file_c, c_footer
file_py.close()
file_c.close()

View File

@ -239,48 +239,38 @@ end
#---------
attributes_c = """
void ezfio_set_%(group)s_%(var)s(%(ctype)s %(var)s)
void ezfio_set_%(group)s_%(var)s(%(type)s %(var)s)
{
ezfio_set_%(group)s_%(var)s_(&%(var)s);
}
void ezfio_get_%(group)s_%(var)s(%(ctype)s *%(var)s)
{
ezfio_get_%(group)s_%(var)s_(%(var)s);
}
int ezfio_has_%(group)s_%(var)s()
{
ezfio_has_%(group)s_%(var)s_();
}
"""
attributes_arr_c = """
void ezfio_set_%(group)s_%(var)s(%(ctype)s %(var)s)
{
ezfio_set_%(group)s_%(var)s_(&%(var)s);
}
void ezfio_get_%(group)s_%(var)s(%(ctype)s *%(var)s)
{
ezfio_get_%(group)s_%(var)s_(%(var)s);
}
int ezfio_has_%(group)s_%(var)s()
{
ezfio_has_%(group)s_%(var)s_();
}
"""
calculated_c = attributes_c
c_header = """#ifndef EZFIO_H\n#define EZFIO_H
#include <string.h>
c_header = """
#ifndef EZFIO_H
#define EZFIO_H
#ifdef __cplusplus
extern "C" {
#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
{
@ -292,7 +282,7 @@ void ezfio_set_file(char* filename)
{
long len;
len = strlen(filename);
ezfio_set_file_(filename,len);
ezfio_set_file_(filename,mlen);
}
sparse ezfio_read_buffer(int isize)
@ -307,15 +297,7 @@ void ezfio_write_buffer(sparse data, int 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*(32) :: V
inquire(file=trim(path)//'/.version',exist=exists)
! if (exists) then
! open(libezfio_iunit,file=trim(path)//'/.version')
! read(libezfio_iunit,*) V
! close(libezfio_iunit)
if (exists) then
open(libezfio_iunit,file=trim(path)//'/.version')
read(libezfio_iunit,*) V
close(libezfio_iunit)
! integer :: char_to_version
! if (char_to_version(V) > char_to_version(libezfio_version)) then
! call ezfio_error(irp_here, 'This file was generated with version '//trim(V)//&
! ' but the current installed version is '//trim(libezfio_version)//'')
! endif
! endif
endif
end function
subroutine ezfio_set_file(filename_in)

View File

@ -35,9 +35,6 @@
call HOSTNM(hostname)
write(PID_str,'(A,''.'',I8.8,X)') trim(hostname), PID
PID_str = trim(PID_str)
print *, PID_str
call sleep(1)
END_PROVIDER
logical function ezfio_exists(path)