Releases¶
Notes to help migrate between releases.
Unreleased¶
Rename some fields in Statements to allow C and Fortran entries to exist in the same group by consistently using a
c_
,i_
orf_
prefix. This allows a single group to contains all the fields used for more complex conversions making it easier to follow the flow.This will change the name of fields in fstatements in an input YAML file. These are used to changed the default behavior of a wrapper.
- decl: void vector_iota_out_with_num(std::vector<int> &arg+intent(out))
fstatements:
c:
c_return_type: long
c_return:
- return SHT_arg_cdesc->size;
Old Name | New Name |
---|---|
arg_call | c_arg_call |
pre_call | c_pre_call |
call | c_call |
post_call | c_post_call |
final | c_final |
ret | c_return |
temps | c_temps |
local | c_local |
f_arg_decl | i_arg_decl |
f_result_decl | i_result_decl |
f_result_var | i_result_var |
f_module | i_module |
f_import | i_import |
Old Name | New Name |
---|---|
need_wrapper | f_need_wrapper |
arg_name | f_arg_name |
arg_decl | f_arg_decl |
arg_c_call | f_arg_call |
declare | f_declare |
pre_call | f_pre_call |
call | f_call |
post_call | f_post_call |
result | f_result |
temps | f_temps |
local | f_local |
- Added format field f_c_suffix. Used in format fields **C_name_template* and F_C_name_template* to allow Fortran wrapper to call a C function with additional mangling such as **C_cfi_suffix and C_bufferify_suffix. Previously this was appended directly to format field *function_suffix. If **C_name_template* or F_C_name_template* are explicitly set in the YAML file then *f_c_suffix should be included in the value.
- Renamed format fields hnamefunc. These fields were added from the statement fields c_helper and f_helper, each a blank delimited list of names. A format field was added for each name with a 0-based suffix corresponding to the position in the list. Now, the format fields have the prefix of chelper_ or fhelper_ followed by the helpers name. For example, fhelper_copy_array. This makes it easier to match the corresponding helper and will help when using statement mixin groups since the order of names will no longer matter.
v0.13.0¶
Changes¶
Some generated wrapper names have been changed to be more consistent. Added format field F_name_api. It is controlled by option F_API_case which may be set to lower, upper, underscore or preserve. Uses of format field underscore_name should be changed to F_name_api. It’s often used in name options such as F_name_impl_template and F_name_generic_template.
Likewise, C API names are controlled by option C_name_api. The default is preserve. The previous behavior can be restored by setting option C_API_case to underscore.
F_API_case defaults to underscore since Fortran is case insensitive. F_C_case defaults to preserve to make the C API closer to the C++ API.
Changed the name of C and Python function splicer to use function_name instead of underscore_name to correspond to C++ library names.
The C_memory_dtor_function is now written to the utility file, C_impl_utility. This function contains code to delete memory from shadow classes. Previously it was written to file C_impl_filename. In addition, some helper functions are also written into this file. This may require changes to Makefiles to ensure this file is compiled.
A single capsule derived type is created in the Fortran wrapper instead of one per class. This is considered an implementation detail and a user of the wrapper will not access them directly. However, it may show up in splicer code. It is used to pass values from the Fortran wrapper to the C wrapper. The old type names may of been referenced in explicit splicer code. In that case the name will need to be changed. The format field F_capsule_data_type_class is replaced by F_capsule_data_type. The C wrapper continues to create a capsule struct for each class as a form of type safety in the C API.
Class instance arguments which are passed by value will now pass the shadow type by reference. This allows the addr and idtor fields to be changed if necessary by the C wrapper.
Replaced the additional_interfaces splicer with additional_declarations. This new splicer is outside of an interface block and can be used to add add a generic interface that could not be added to additional_interfaces. Existing additional_interfaces splicers can be converted to additional_declarations by wrapping the splicer with
INTERFACE
/END INTERFACE
.
New Features¶
- Added support for C++ class inheritance. See Class Inheritance
- Added the ability to treat a struct as a class. See Object-oriented C
- Added the ability to declare members of a struct on
individual
decl
lines in the YAML file similar to how class members are defined. Before the struct was defined in a singledecl:
. - Allow structs to be templated.
- Added the ability to declare variables using the
enum
keyword. C++ creates a type for each enumeration. - Generate generic interface which allows a scalar or array to be passed for an argument.
- Process assumed-rank dimension attribute, dimension(..). Create a generic interface using scalar and each rank.
- Added some support for Futher Interoperability with C. Used when option F_CFI is True (C/Fortran Interoperability).
- Support deref(pointer) for
char *
andstd::string
functions. Requires at least gfortran 6.1.0 - Added option F_trim_char_in. Controls where
CHARACTER
arguments are NULL terminated. If True then terminated in Fortran else in C. - Added attribute +blanknull to convert a blank Fortran string into
a NULL pointer instead of a 1-d buffer with
'/0'
. Used withconst char *
arguments. This can be defaulted to True with the F_blanknull option. - Added
file_code
dictionary to input YAML file. It contains directives to add header file andUSE
statements into generated files. These are collated with headers andUSE
statements added by typemaps, statements and helpers to avoid duplication. - Allow typemaps with base as integer and real to be added to the
input YAML file. This allows kind parameters to be defined via splicers
then used by a typemap. i.e.
integer(INDEXTYPE)
- Added option C_shadow_result. If true, the C wrapper will return a pointer
to the capsule holding the function result. The capsule is also passed
as an argument. If false the function is
void
. - The getter for a class member function will return a Fortran pointer if the dimension attribute is added to the declaration. Likewise, the setter will expect an array of the same rank as dimension. Getter and setters will also be generated for struct fields which are pointers to native types. Option F_struct_getter_setter can be used to control their creation.
- Added ability to add splicer to
typedef
declarations. For example, to use the C preprocessor to set the type of the typedef. See typedefs.yaml for an example. - Added support for out arguments which return a reference to a
std::vector
or pointer to an array ofstd::string
. - Create C and Fortran wrappers for typedef statements.
Before
typedef
was treated as an alias.typedef int TypeID
would substituteinteger(C_INT)
for every use ofTypeID
in the Fortran wrapper. Now a parameter is created:integer, parameter :: type_id = C_INT
. Used as:integer(type_id) :: arg
.
Fixed¶
- Order of header files in cxx_header is preserved in the generated code.
- Create a generic interface even if only one decl is in the fortran_generic list.
- generic_function now creates a C wrapper for each Fortran wrapper. This causes each Fortran interface to bind to a different C function which fixes a compile error with xlf.
- Add generic interfaces for class methods. Generic functions where only being added
to the type-bound procedures.
class_generic(obj)
now works instead of onlyobj%generic()
. - Add continuations on Fortran
IMPORT
statements. - Support an array of pointers -
void **addr+rank(1)
. - Fix Fortran wrapper for
intent(INOUT)
forvoid **
. - Promote wrap options (ex wrap_fortran) up to container when True (library, class, namespace). This allows wrap_fortran to be False at the global level and set True on a function and get a wrapper. Before a False at the global level would never attempt to do any wrapping.
- Better support for
std::vector
with pointer template arguments. For examples,<const double *>
. - Parse
class
,struct
andenum
as part of declaration. This allowstypedef struct tag name
to be parsed properly. - Create type table earlier in parse. This allows recursive structs such as
struct point { struct point *next; }
to be parsed. - Fixed issues in converting function names from CamelCase
- Remove redundant underscore
Create_Cstruct_as_class
wasc_create__cstruct_as_class
nowc_create_cstruct_as_class
- Add missing underscore
AFunction
wasafunction
nowa_function
.
- Remove redundant underscore