mirror of https://gitlab.com/scemama/irpf90.git
Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Anthony Scemama | beac615343 | |
Anthony Scemama | 01899b41b2 | |
Anthony Scemama | 451c93a52c | |
Anthony Scemama | 76946321d6 | |
Anthony Scemama | ba1a2837aa | |
Anthony Scemama | 4ab1b175fc | |
Anthony Scemama | 0007f72f67 | |
Otto Kohulak | a885761ea2 | |
Otto Kohulak | 152c69c754 | |
Anthony Scemama | 34ca9a7852 | |
Otto Kohulak | d1e475dc22 | |
Anthony Scemama | 088c6fdc04 | |
Ot(t)o Kohulák | c938931e5e | |
Anthony Scemama | ab88cc01a6 | |
Anthony Scemama | 33ca5e1018 |
|
@ -3,7 +3,7 @@ RST2MAN=rst2man -d -t
|
|||
default: man1/irpman.1.gz man1/irpf90.1.gz
|
||||
|
||||
options.rst: ../src/command_line.py
|
||||
python ../src/command_line.py > options.rst
|
||||
python3 ../src/command_line.py > options.rst
|
||||
|
||||
man1/irpf90.1.gz: irpf90.rst options.rst
|
||||
rm -f $@ ; $(RST2MAN) --title="IRP Fortran 90" irpf90.rst man1/irpf90.1 ; gzip man1/irpf90.1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||
# the Implicit Reference to Parameters (IRP) method.
|
||||
# Copyright (C) 2009 Anthony SCEMAMA
|
||||
|
|
|
@ -222,7 +222,7 @@ def do_print_subroutines_rst(sub):
|
|||
filename = sub.line.filename
|
||||
name = sub.name
|
||||
file = open("%s%s.rst"%(mandir,sub.name), "w")
|
||||
print(".. c:function:: %s:\n"%(sub.name.lower()), file=file)
|
||||
print(".. c:macro:: %s:\n"%(sub.name.lower()), file=file)
|
||||
print("", file=file)
|
||||
print(" File : :file:`"+filename+"`", file=file)
|
||||
print("", file=file)
|
||||
|
|
|
@ -26,10 +26,21 @@
|
|||
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
LENMAX = 70
|
||||
tabn = 2
|
||||
|
||||
#copy of locals without "import copy"
|
||||
locals_ = {x: y for x, y in locals().items()}
|
||||
for key, value in locals_.items():
|
||||
try:
|
||||
val = os.environ["IRPF90_INDENT_"+key.upper()]
|
||||
locals()[key] = type(locals_[key])(val)
|
||||
except:
|
||||
pass
|
||||
|
||||
tab = " "*tabn
|
||||
|
||||
class Grep(object):
|
||||
|
@ -106,6 +117,14 @@ class Grep(object):
|
|||
def declaration(self,string):
|
||||
return re.match(self.re_declaration,string) is not None
|
||||
|
||||
re_preprocessor = re.compile(r"^\s*#.*$")
|
||||
def preprocessor(self,string):
|
||||
return re.match(self.re_preprocessor,string) is not None
|
||||
|
||||
re_omppragma = re.compile(r"^\s*!\$omp\s.*$")
|
||||
def omppragma(self,string):
|
||||
return re.match(self.re_omppragma,string) is not None
|
||||
|
||||
grep = Grep()
|
||||
|
||||
class indent(object):
|
||||
|
@ -119,10 +138,12 @@ class indent(object):
|
|||
return l.strip().ljust(n) + ' :: '+ r.strip()
|
||||
|
||||
def format_continuation(self,string,n):
|
||||
buffer = string.split('&')
|
||||
buffer = string.split('&', 1)
|
||||
if len(buffer) == 1:
|
||||
l = buffer[0]
|
||||
return l
|
||||
elif buffer[0].strip() == "":
|
||||
return self.format_continuation(buffer[1], n)
|
||||
else:
|
||||
l, r = buffer
|
||||
return l.strip().ljust(69-len(n)) + '&'+ r.strip()
|
||||
|
@ -165,6 +186,19 @@ class indent(object):
|
|||
for i in range(len(self.text)):
|
||||
prevline = line
|
||||
line = self.text[i].strip()
|
||||
|
||||
if line == "":
|
||||
print("")
|
||||
continue
|
||||
|
||||
if grep.preprocessor(line):
|
||||
print(line.lstrip())
|
||||
continue
|
||||
|
||||
if grep.omppragma(line):
|
||||
print(line.lstrip())
|
||||
continue
|
||||
|
||||
if grep.continuation(line):
|
||||
line = self.format_continuation(line,k)
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ def dress(f,in_root=False):
|
|||
result = os.path.join(cwd,f)
|
||||
else:
|
||||
result = os.path.join(cwd,irpdir,f)
|
||||
return os.path.normpath(result)
|
||||
result = os.path.normpath(result)
|
||||
return result
|
||||
|
||||
|
||||
def create_build_touches(list_of_other_o):
|
||||
|
@ -405,8 +406,12 @@ def run():
|
|||
output.append(create_build_remaining(i))
|
||||
|
||||
|
||||
text = '\n\n'.join(output)
|
||||
text = text.replace(cwd+"/IRPF90_temp","$T")
|
||||
text = text.replace(cwd,"$X")
|
||||
with open(FILENAME,'w') as f:
|
||||
f.write('\n\n'.join(output))
|
||||
f.write("X="+cwd+"\nT="+cwd+"/IRPF90_temp\n")
|
||||
f.write(text)
|
||||
f.write('\n')
|
||||
|
||||
create_irpf90_make([ x.filename for x in l_targets ] + [ os.path.join(irpdir,'irpf90.a') ] )
|
||||
|
|
|
@ -323,7 +323,7 @@ def execute_templates(text):
|
|||
file.close()
|
||||
# Execute shell
|
||||
import os
|
||||
pipe = os.popen("python < %s"%(scriptname),'r')
|
||||
pipe = os.popen("python3 < %s"%(scriptname),'r')
|
||||
lines = pipe.readlines()
|
||||
pipe.close()
|
||||
result += get_text(lines,scriptname)
|
||||
|
|
|
@ -46,12 +46,13 @@ re_decl = re.compile( "".join( [ r"^\ *",
|
|||
r"|intrinsic *(::)?",
|
||||
r"|external *(::)?",
|
||||
r"|equivalence *(::)?",
|
||||
r"|type",
|
||||
r"|type *\(",
|
||||
r"|type +",
|
||||
r"|end ?type",
|
||||
r")[^=(]"
|
||||
] ) )
|
||||
|
||||
re_test = re.compile(r"\( *(.*)(\.[a-zA-Z]*\.|[<>]=?|[=/]=)([^=]*)\)")
|
||||
|
||||
re_string = re.compile(r"'.*?'")
|
||||
re_string = re.compile(r"'.*?'|\".*?\"")
|
||||
|
||||
|
|
Loading…
Reference in New Issue