- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Is there a function available that will let me test for the name of the Fortran routine that has called my subroutine?
Thanks and God bless!
Jack
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
No, there isn't. About the best you can do is call TRACEBACKQQ which will generate a traceback - if the program was built with traceback enabled that will contain the names of routines up the call stack. By default this is written to the console (or a popup window), but can be redirected to a file. Probably more complication than you're looking for.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks so much, Steve, for your as-usual prompt and expert response.
You're very discerning about the complication. On to additional ENTRY points!
Thanks again, and of course ...
God bless!
Jack
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Please don't use ENTRY! Maybe pass a code as an additional argument to indicate the caller.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Sorry to challenge your digestion or blood pressure by mentioning ENTRY, Steve! But this is an old dog who knows only old tricks trying to keep an old (45-years-old!) program running that just needs a couple of new options. A lot easier to just point the calling routine into the specific code it needs than to teach the other callers how to identify themselves. ;-)
Thanks again so much for all you do with and for the Forum. You make it so pleasant and understandable for us engineers who have to write code every now and then.
God bless!
Jack
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
40 years ago, there were several incompatible versions of ENTRY (none standard).
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Warning Will Robinson hack approaching...
module mod_FindCaller character(256) :: LastFile integer :: LastLine contains function FindCaller(f,l,x) real :: FindCaller, x ! same type, use generic function character*(*) :: f integer :: l LastFile = f LastLine = l FindCaller = x end function FindCaller end module mod_FindCaller subroutine FOO(A, B) use mod_FindCaller real :: A,B real :: C real :: X X = A + B goto 100 ENTRY FEE(C) X = C 100 continue print *,X print *,LastFile,LastLine end subroutine FOO program Test use mod_FindCaller implicit none ! The #defines must not be in the module ! They may be in an FPP #include file ! But not in a Fortran INCLUDE file #define FOO(a,b) foo(FindCaller(__FILE__, __LINE__, a), b) #define FEE(a) fee(FindCaller(__FILE__, __LINE__, a)) CALL FOO(1.0,2.0) CALL FEE(5.0) end program Test
Jim Dempsey

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora