Skip to content

Update flatten_namespace#439

Merged
ltaylor16 merged 15 commits intodevelopfrom
shroud_share
Nov 5, 2025
Merged

Update flatten_namespace#439
ltaylor16 merged 15 commits intodevelopfrom
shroud_share

Conversation

@ltaylor16
Copy link
Copy Markdown
Member

Remove option F_flatten_namespace, only have option flatten_namespace which applies to both C and Fortran. Preserved the NamespaceNode in the tree.

Move SwigMemFlags so it is protected by SHROUD_SHARE_H define. This allows several wrapped libraries to define the same symbols with having a compiler error.

Add a +constfunc attribute. Used when a member function does not change the class. Keeps the capsule as intent(IN) in the generated Fortran.

Factor out class FileInfo to allow multiple C files to be built up at once. Needed for the change in namespace processing.

Used with capsule_memflags. Will not add to the top of the type files
but surrounded by #ifndef SHROUD_SHARE_H so that multiple wrapped
libraries can define the same, identical symbols.  This allows one
wrapped library to use another.  Most symbols are made unique by name
mangling, this is another solution to sharing.
When the object is a argument that is intent(IN),
the capsule needs to be intent(IN) too, otherwise:

gfortran
Dummy argument ‘obj’ with INTENT(IN) in variable definition context
  (actual argument to INTENT = OUT/INOUT) at (1)

oneapi
A dummy argument with the INTENT(IN) attribute shall not be defined
nor become undefined.   [OBJ]
Used to declare a member function as const when C++ const keyword is
not used.  This sets the shadow argument as intent(IN) and allows the
function to be called with an intent(IN) dummy argument.
It was missing. Added a test case to cxxlibrary.yaml.
There a test in scope.yaml but it is not compiled since there
is not run/scope library.

+   integer, parameter :: color_enum = C_INT
    integer(color_enum), parameter :: colorenum_red = 60

Do not wrap for Python since it is not compiling.
Fix at some future date...
A best practice.
Add some comments.
Merge its behavior into option flatten_space.
No need to treat Fortran differently.

This will change splicernames when maybe it shouldn't.

Add a test for deprecated options, similar to deprecate format, and
check for setting F_flatten_namespace.
The declarations in the Namespace will go into the parent's file.
This fixes a problem where an include file which will not exist was
being added to a typemap.  Then it was added to generated code
resulting in a compile error.
The symbol table lookup has moved to declast.py so this argument is no
longer needed.
Helps to identify where Shroud is currently processing.
Similar to ModuleInfo in wrapf.py.  Used to gather up output for a
file.  Currently only a single file can be generated at a time.  But
planned changes to how namespace are processed will require the
ability to have several files being accumulated at once.
Nessary for future flatten_namespace work.
It keeps the each output file independent in its own instance.
The NamespaceNode is now always added to the parent NamespaceNode (or
LibraryNode).  Before it was not added if option.flatten_namespace was
set. Instead all of the namespaces declarations were added directly to
the parent Namespace. This could present issues with duplicate names.
Now the hierarchy is preserved in the Node tree.

This restores the splicer names which lost the namespace component in
some cases in an earlier commit. It also causes some reordering of
declarations in the C and Fortran wrappers.

Instead wrapf.py and wrapc.py are responsible for checking for
flatten_namespace and do the correct thing.  Note that Python and Lua
do not check for flatten_namespace and will create wrappers that
mirror the Node tree.

To be fixed: the 'Wrote filename' in the log is being duplicated since
write_file is being called too often due to now having to check for
flatten_namespace explicitly.
They are now created since the Python wrapper does not process option
flatten_namespace.
@ltaylor16 ltaylor16 merged commit 144d2ef into develop Nov 5, 2025
3 checks passed
@ltaylor16 ltaylor16 deleted the shroud_share branch November 7, 2025 21:35
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