FV3 Bundle
c2f Namespace Reference

Classes

class  ParsingError
 

Functions

def multiline (line, maxlength)
 
def iso_c_binding (declaration, returned)
 
def C_F_binding (c_line)
 
def parse_file (c_file)
 

Variables

 parser = ArgumentParser()
 
 type
 
 str
 
 nargs
 
 help
 
 parsed = parser.parse_args()
 
 files = parsed.files
 
 output = parsed.output
 
 module = parsed.module
 
list used_types = []
 
string TAB = " "
 
dictionary TYPES_DICT
 
dictionary TYPES2_DICT
 
 REGEX_RETURNED_TYPE = re.compile( "^ *([_0-9a-zA-Z ]+ *\**&?)" )
 
 REGEX_FUNCTION_NAME = re.compile( "([0-9a-zA-Z_]+) *\(" )
 
 REGEX_ARGUMENTS = re.compile( "\(([&0-9a-zA-Z_\s\,\*\[\]]*)\).*;$" )
 
 REGEX_ARGS = re.compile( " *([&0-9a-zA-Z_\s\*\[\]]+),?" )
 
 REGEX_VAR_TYPE = re.compile( " *([_0-9a-zA-Z]+)[ |\*]" )
 
 REGEX_TYPE = re.compile( "^ *((const )?\w+)[ \*]?" )
 
 REGEX_VAR_NAME = re.compile( "[ |\*&]([_0-9a-zA-Z]+)(?:\[\])?$" )
 

Function Documentation

◆ C_F_binding()

def c2f.C_F_binding (   c_line)

Definition at line 118 of file c2f.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iso_c_binding()

def c2f.iso_c_binding (   declaration,
  returned 
)
Returns the Fortran type corresponding to a C type in the 
    ISO_C_BINDING module and the KIND type 

Definition at line 76 of file c2f.py.

◆ multiline()

def c2f.multiline (   line,
  maxlength 
)
Split a long line in a multiline, following Fortran syntax.

Definition at line 67 of file c2f.py.

Here is the caller graph for this function:

◆ parse_file()

def c2f.parse_file (   c_file)

Definition at line 214 of file c2f.py.

Here is the call graph for this function:

Variable Documentation

◆ files

c2f.files = parsed.files

Definition at line 19 of file c2f.py.

◆ help

c2f.help

Definition at line 15 of file c2f.py.

◆ module

c2f.module = parsed.module

Definition at line 21 of file c2f.py.

◆ nargs

c2f.nargs

Definition at line 15 of file c2f.py.

◆ output

c2f.output = parsed.output

Definition at line 20 of file c2f.py.

◆ parsed

c2f.parsed = parser.parse_args()

Definition at line 18 of file c2f.py.

◆ parser

c2f.parser = ArgumentParser()

Definition at line 14 of file c2f.py.

◆ REGEX_ARGS

c2f.REGEX_ARGS = re.compile( " *([&0-9a-zA-Z_\s\*\[\]]+),?" )

Definition at line 62 of file c2f.py.

◆ REGEX_ARGUMENTS

c2f.REGEX_ARGUMENTS = re.compile( "\(([&0-9a-zA-Z_\s\,\*\[\]]*)\).*;$" )

Definition at line 61 of file c2f.py.

◆ REGEX_FUNCTION_NAME

c2f.REGEX_FUNCTION_NAME = re.compile( "([0-9a-zA-Z_]+) *\(" )

Definition at line 60 of file c2f.py.

◆ REGEX_RETURNED_TYPE

c2f.REGEX_RETURNED_TYPE = re.compile( "^ *([_0-9a-zA-Z ]+ *\**&?)" )

Definition at line 59 of file c2f.py.

◆ REGEX_TYPE

c2f.REGEX_TYPE = re.compile( "^ *((const )?\w+)[ \*]?" )

Definition at line 64 of file c2f.py.

◆ REGEX_VAR_NAME

c2f.REGEX_VAR_NAME = re.compile( "[ |\*&]([_0-9a-zA-Z]+)(?:\[\])?$" )

Definition at line 65 of file c2f.py.

◆ REGEX_VAR_TYPE

c2f.REGEX_VAR_TYPE = re.compile( " *([_0-9a-zA-Z]+)[ |\*]" )

Definition at line 63 of file c2f.py.

◆ str

c2f.str

Definition at line 15 of file c2f.py.

◆ TAB

string c2f.TAB = " "

Definition at line 25 of file c2f.py.

◆ type

c2f.type

Definition at line 15 of file c2f.py.

◆ TYPES2_DICT

dictionary c2f.TYPES2_DICT
Initial value:
1 = {
2  "long double": ("real(c_long_double)","c_long_double"),
3  "unsigned long":("integer(c_long)","c_long"),
4  "unsigned short":("integer(c_short)","c_short"),
5  "unsigned int":("integer(c_int)","c_int"),
6  }

Definition at line 43 of file c2f.py.

◆ TYPES_DICT

dictionary c2f.TYPES_DICT
Initial value:
1 = {
2  "int":("integer(c_int)","c_int"),
3  "long":("integer(c_long)","c_long"),
4  "short":("integer(c_short)","c_short"),
5  "_Bool":("logical(c_bool)","c_bool"),
6  "boolean":("logical(c_bool)","c_bool"),
7  "double": ("real(c_double)","c_double"),
8  "float":("real(c_float)","c_float"),
9  "size_t": ("integer(c_size_t)","c_size_t"),
10  }

Definition at line 31 of file c2f.py.

◆ used_types

list c2f.used_types = []

Definition at line 22 of file c2f.py.