mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-09-01 09:13:40 +02:00
-s option updated
This commit is contained in:
parent
93f1a359d8
commit
15a0e1e2c5
42
bin/irpf90
42
bin/irpf90
@ -1,42 +0,0 @@
|
||||
#!/usr/bin/python -O
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
wd = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.insert(0,(wd+"/../src/"))
|
||||
sys.path.insert(0,(wd+"/../share/irpf90/src/"))
|
||||
|
||||
debug = int(os.getenv("IRP_DEBUG",0))
|
||||
if debug == 0:
|
||||
import irpf90
|
||||
irpf90.main()
|
||||
else:
|
||||
import profile
|
||||
print "Profiling irpf90"
|
||||
profile.run('import irpf90 ; irpf90.main()')
|
1
bin/irpf90
Symbolic link
1
bin/irpf90
Symbolic link
@ -0,0 +1 @@
|
||||
/home/scemama/irpf90/src/irpf90.exe
|
@ -1,7 +1,7 @@
|
||||
include version
|
||||
default:
|
||||
rm *.rpm *.tar.gz *.exe.gz 2> /dev/null ;\
|
||||
VERSION=$(VERSION) epm -a noarch -m noarch irpf90 irpf90.list ;\
|
||||
VERSION=$(VERSION) epm -f portable -a noarch -m noarch irpf90 irpf90.list ;\
|
||||
cd noarch ;\
|
||||
cp ~/.rpmmacros .;\
|
||||
echo "%_topdir $$PWD" > ~/.rpmmacros ;\
|
||||
|
@ -1,62 +0,0 @@
|
||||
# epm -f format irpf90 irpf90.list
|
||||
# format:
|
||||
# aix
|
||||
# bsd
|
||||
# depot or swinstall (HP-UX)
|
||||
# dpkg
|
||||
# inst or tardist (IRIX
|
||||
# native (native for the current platform)
|
||||
# osx
|
||||
# pkg (Solaris)
|
||||
# portable (default)
|
||||
# rpm
|
||||
# setld (Tru64)
|
||||
# slackware
|
||||
|
||||
# Product information
|
||||
# -------------------
|
||||
|
||||
%product irpf90
|
||||
%copyright 2009 A. Scemama, CNRS
|
||||
%vendor A. Scemama, CNRS
|
||||
%license ../LICENSE
|
||||
%readme ../README
|
||||
%description IRP-Fortran90 preprocessor
|
||||
%version $VERSION
|
||||
|
||||
%format rpm
|
||||
%requires python
|
||||
%requires make
|
||||
|
||||
%format all
|
||||
|
||||
# Autoconfiguration variables
|
||||
# ---------------------------
|
||||
|
||||
$prefix=/usr
|
||||
$exec_prefix=/usr
|
||||
$bindir=${exec_prefix}/bin
|
||||
$datadir=${exec_prefix}/share/irpf90/src
|
||||
$vimdir=${exec_prefix}/share/irpf90/vim
|
||||
$docdir=${prefix}/share/irpf90/doc
|
||||
$mandir=${prefix}/man
|
||||
$srcdir=..
|
||||
|
||||
# Executables
|
||||
# -----------
|
||||
|
||||
|
||||
%system all
|
||||
%description IRP-Fortran90 preprocessor
|
||||
f 0444 root sys ${mandir}/man1/irpf90.1.gz ${srcdir}/man/man1/irpf90.1.gz
|
||||
f 0444 root sys ${mandir}/man1/irpman.1.gz ${srcdir}/man/man1/irpman.1.gz
|
||||
f 0444 root sys ${vimdir}/irpf90.vim ${srcdir}/vim/irpf90.vim
|
||||
f 0555 root sys ${bindir}/irpf90 ${srcdir}/bin/irpf90
|
||||
f 0555 root sys ${bindir}/irpman ${srcdir}/bin/irpman
|
||||
f 0555 root sys ${datadir}/ ${srcdir}/src/*.py
|
||||
f 0444 root sys ${docdir}/README ${srcdir}/README
|
||||
f 0444 root sys ${docdir}/LICENSE ${srcdir}/LICENSE
|
||||
|
||||
EOF
|
||||
|
||||
|
@ -2,9 +2,9 @@ PYTHON=python
|
||||
PYVERSION=$(shell $(PYTHON) -c "import sys; print(sys.version[:3])")
|
||||
|
||||
irpf90.exe: irpf90.so
|
||||
gcc build/*/irpf90.o -L/usr/lib -lpython$(PYVERSION) -o irpf90.exe
|
||||
gcc build/*/irpf90.o -L/usr/lib64 -lpython$(PYVERSION) -o irpf90.exe
|
||||
|
||||
irpf90.so : $(wildcard %.py) irpf90.c
|
||||
irpf90.so : $(wildcard *.py) irpf90.c
|
||||
./cython_setup.py build_ext --inplace
|
||||
|
||||
irpf90.c: irpf90.py
|
||||
|
@ -81,7 +81,7 @@ class CommandLine(object):
|
||||
for o,a in self.opts:
|
||||
if o in [ "-s", '--'+options['s'][0] ]:
|
||||
k, v = a.split(':')
|
||||
v_re = re.compile(r"(^.*[,| ]+)(%s)(\s*$)"%k.strip())
|
||||
v_re = re.compile(r"(\W)(%s)(\W.*$|$)"%k.strip())
|
||||
self._substituted[k] = [v, v_re]
|
||||
return self._substituted
|
||||
substituted = property(fget=substituted)
|
||||
|
@ -519,11 +519,11 @@ def perform_loop_substitutions():
|
||||
result = []
|
||||
append = result.append
|
||||
for vars,line in text:
|
||||
if type(line) == Do:
|
||||
if type(line) in [ Do, If, Elseif] :
|
||||
for k,v in command_line.substituted.items():
|
||||
reg = v[1]
|
||||
if reg.search(line.text) is not None:
|
||||
line.text = re.sub(reg,r'\1%s\3', line.text)%v[0]
|
||||
while reg.search(line.text) is not None:
|
||||
line.text = re.sub(reg,r'\1%s\3', line.text,count=1)%v[0]
|
||||
append( (vars,line) )
|
||||
main_result.append( (filename, result) )
|
||||
return main_result
|
||||
|
@ -588,7 +588,6 @@ def irp_simple_statements(text):
|
||||
|
||||
def process_function(line):
|
||||
assert type(line) == Function
|
||||
buffer = line.text.split('(')
|
||||
subname = find_subname(line)
|
||||
length = len(subname)
|
||||
i = line.i
|
||||
|
Loading…
Reference in New Issue
Block a user