10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-21 11:53:32 +01:00

Added vim files, parallel exit OK

Version:1.2.6
This commit is contained in:
Anthony Scemama 2011-11-09 16:21:26 +01:00
parent 6763923a94
commit b7ab85315e
10 changed files with 103 additions and 8 deletions

View File

@ -8,7 +8,7 @@ END_PROVIDER
BEGIN_PROVIDER [ integer, v ]
v = u2+w+2
END_PROVIDER
!END_PROVIDER
BEGIN_PROVIDER [ integer, u1 ]
integer :: fu

View File

@ -37,6 +37,7 @@ $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=..
@ -44,14 +45,18 @@ $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

View File

@ -26,6 +26,7 @@
import vim
import os,sys
wd = os.path.abspath(os.path.dirname(__file__))
sys.setcheckinterval(1000)
@ -34,6 +35,8 @@ sys.path.insert(0,(wd+"/../src/"))
def main():
from command_line import command_line
vim.install()
if command_line.do_help:
command_line.usage()

View File

@ -78,6 +78,7 @@ class Continue(Line):
return "%20s:%5d : %s"%("Continue",self.i,self.text)
class Begin_provider(Line):
str = "Provider"
def __init__(self,i,text,filename):
Line.__init__(self,i,text,filename)
def __repr__(self):
@ -264,18 +265,21 @@ class End_select(Line):
return "%20s:%5d : %s"%("End_select",self.i,self.text)
class Program(Line):
str = "Program"
def __init__(self,i,text,filename):
Line.__init__(self,i,text,filename)
def __repr__(self):
return "%20s:%5d : %s"%("Program",self.i,self.text)
class Subroutine(Line):
str = "Subroutine"
def __init__(self,i,text,filename):
Line.__init__(self,i,text,filename)
def __repr__(self):
return "%20s:%5d : %s"%("Subroutine",self.i,self.text)
class Function(Line):
str = "Function"
def __init__(self,i,text,filename):
Line.__init__(self,i,text,filename)
def __repr__(self):

51
src/locks.py Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/python
# 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
from command_line import command_line
from irpf90_t import *
from util import *
from variables import variables
FILENAME=irpdir+'irp_locks.irp.F90'
def create():
out = []
l = variables.keys()
l.sort
for v in l:
var = variables[v]
out += var.locker
out = map(lambda x: "%s\n"%(x),out)
if not same_file(FILENAME,out):
file = open(FILENAME,'w')
file.writelines(out)
file.close()
if __name__ == '__main__':
create()

View File

@ -782,8 +782,8 @@ def check_begin_end(text):
if type(line) == x:
return
if type(line) in [ Subroutine, Function, Program, Begin_provider ]:
error.fail(text[begin],type(line)+" is not closed")
error.fail(text[begin],type(line) + " is not closed")
error.fail(text[begin],type(line).str+" is not closed")
error.fail(text[begin],type(line).str + " is not closed")
level = 0

View File

@ -166,7 +166,6 @@ def parallel_loop(f,source):
result = []
for filename, text in src[thread_id]:
result.append( (filename, f(filename,text)) )
result.sort()
if fork == 0:
@ -174,11 +173,16 @@ def parallel_loop(f,source):
w.close()
os._exit(0)
OK = True
for i in xrange(1,NTHREADS):
if os.waitpid(pidlist[i],0)[1] != 0:
OK = False
if not OK:
sys.exit(1)
for i in xrange(1,NTHREADS):
result += pickle.load(r[i])
r[i].close()
if os.waitpid(pidlist[i],0)[1] != 0:
raise OSError
return result

View File

@ -1 +1 @@
version = "1.2.5"
version = "1.2.6"

23
src/vim.py Normal file
View File

@ -0,0 +1,23 @@
#/usr/bin/python
import os
def install():
VIM = os.environ["HOME"]+"/.vim"
try:
if os.access(VIM+"/syntax/irpf90.vim",os.F_OK):
return
if not os.access(VIM,os.F_OK):
os.mkdir(VIM)
file = open(VIM+"/filetype.vim","a")
file.write("au BufRead,BufNewFile *.irp.f setfiletype irpf90")
file.close()
if not os.access(VIM+"/syntax",os.F_OK):
os.mkdir(VIM+"/syntax")
wd = os.path.abspath(os.path.dirname(__file__))+"/../vim"
os.symlink(wd+"/irpf90.vim",VIM+"/syntax/irpf90.vim")
except:
pass
if __name__ == "__main__":
install()

View File

@ -2,7 +2,7 @@
" Language: IRPF90
" Version: 0.1
" URL:
" Last Change: 2010 Jun. 9
" Last Change: 2011 Nov. 9
" Maintainer:
" Usage: Do :help irpf90-syntax from Vim
" Credits:
@ -365,5 +365,10 @@ if !exists("did_irpf90_syn_inits")
delcommand HiLink
endif
fun! ReadMan()
let s:man_word = expand('<cword>')
:exe ":!irpman " . s:man_word
endfun
map K :call ReadMan()<CR>
" vim: ts=8 tw=132