Skip to content

Set more fields in fcfmt.py#433

Merged
ltaylor16 merged 9 commits intodevelopfrom
use-user-fmt
Sep 30, 2025
Merged

Set more fields in fcfmt.py#433
ltaylor16 merged 9 commits intodevelopfrom
use-user-fmt

Conversation

@ltaylor16
Copy link
Copy Markdown
Member

Instead of setting in ast.py, set in fcfmt.py which is called after generate.py. This allows format fields to be properly set for generate functions like template instantiations and other generated functions.

Also set the value on fmt_func instead of fmt_result since the
function is generic and not the result.
It is only set on fmt_func now. fmt_result worked since its parent is
fmt_func.
Have fcfmt.py match wrapf.py
Use reeval_template to avoid the inlocal in eval_template.  It is only
called when needed instead of for each function.  Since
options.F_create_generic is tested before setting, it is no longer set
for functions which are templated on their result (since Fortran
cannot create a generic interface for those functions). This changes
some JSON files.

Update from user_fmt after function_fmt is set since F_name_generic
may be set in the YAML file by the user.
fmt_func is updated form user_fmt afterwards so the user values is
take priority. Working to remove inlocal if possible.
Before computed in ast.py.
user_dict is used to update as the final step.
fill_typedef_typemap is then called.
update_names is a no-op and can be removed later.
Its contents were moved into fcfmt.py.

Changes to JSON files:

python-only - c_type, C_name_typedef, are no longer defined since it
is not going through fcfmt.py

templates - std::vector::size_type does not update the typemap, only
 the instantiations of std::vector.

typedefs-c - Properly apply typedef format fields to set C_name_typedef.
 This propogates to other format fields.
The work is now done in fcfmt.py.
It was being called from ast.py earlier.
Now it is called after templates are instantiated in generate.py.

Added test error-fmt and moved some tests from error-ast.  error-ast
is correctly stopping because of errors and never calls
fill_typedef_typemap from its new location. Test error-fmt has no AST
errors.

Changes to JSON files.
python-only - Fills in fields in typedef TypeID.
  c_type is unchanged when created by declast.py since fill_typedef_typemap
  is no longer called where C_name_typedef is unset.
templates - Fills in fields in uninstantiated std::vector::size_type
@ltaylor16 ltaylor16 merged commit faf4467 into develop Sep 30, 2025
3 checks passed
@ltaylor16 ltaylor16 deleted the use-user-fmt branch October 26, 2025 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant