Hi all,
I'm currently working on implementing the `split` procedure, which was
added in Fortran 2023. Given its similar functionality to the `scan`
intrinsic, I've been learning the implementation of `scan` to better
understand its mechanics. During my investigation of the source code,
I've come across a couple of questions that I'm hoping you could help me
out:
* Function Resolution
I noticed that `scan` resolves to `gfc_get_string("__scan_%d",
string->ts.kind)`. However, based on my examination of `libgfortran` and
`trans-intrinsic.cc`, it appears this ultimately forwards to the
`string_scan` function. Could you please explain the significance of
this resolution step? Is it critical to the current implementation, or
is it perhaps a remnant of historical design?
* Argument Passing
According to the Fortran specification, the `scan` intrinsic accepts
arguments for `string`, `set`, `back`, and `kind`. Yet, the intrinsic
implemented in `libgfortran` seems to take `charlen` and the actual
pointers for both `string` and `set`. I've tried searching, but I
haven't been able to pinpoint where this transformation from the
specified arguments to the `libgfortran` expected arguments occurs. Any
guidance on this would be greatly appreciated.
Thanks,
Yuao
- Questions on `scan` Intrinsic Implementation (For Fortran 202... c8ef
-