[fpc-pascal] Get all caller adresses of a procedure/function

Rainer Stratmann RainerStratmann at t-online.de
Mon Aug 6 23:05:22 CEST 2012


Am Monday 06 August 2012 22:37:08 schrieb Aleksa Todorovic:
> program test_str_36;
>
> uses
>   sysutils;
>
> function s(str: pchar): pchar;
> var
>   str2: pchar;
> begin
>   if str[0] = '~' then
>   begin
>     // string is not localized
>     str2 := strnew('numero'); // localized version
>     ppchar(str)^ := str2;
>   end;
>   result := ppchar(str)^;
> end;
>
> var
>   i: integer;
const prestr = '~~~~~~~~';
> begin
>   for i := 1 to 10 do
>   begin
>     writeln( s( prestr + 'number' ),  ' ' ,   i);
>   end;
> end.

That seems somehow interesting.
But you have to put it everywhere in front.
May be a macro can do it so that you have only s() left.
And may be (but not very likely when reading the statement of Jonas) you can 
search the whole program for '~~~~~~~~' to get the caller adresses of s().



More information about the fpc-pascal mailing list