[fpc-pascal] Re: Get all caller adresses of a given
function/procedure before executing
RainerStratmann at t-online.de
Tue Aug 14 09:11:57 CEST 2012
Am Tuesday 14 August 2012 03:28:26 schrieb waldo kitty:
> On 8/13/2012 05:09, Rainer Stratmann wrote:
> > Am Monday 13 August 2012 10:35:55 schrieb Lukasz Sokol:
> >> You were saying, that you want to know, which string has not been
> >> used / which string has been used and how many times ?
> > I want to knof if the string was called the first time.
> > But since I also get the pchar information of the textsnippets from the
> > programmemory I can translate (make a list or whatever in the future) all
> > snippets before they were called.
> i've been following this whole thread with interest... one thing that i'm
> still not clear about, though, is why is this important? is it to see what
> areas of the program are actually used or something else?
Yes. It has to do with that.
> in my mind, a
> multi-language tool will have all strings translated into the supported
The translation is a different thing to that.
> if there are some that are ambiguous or used in a different
> way, then they would get broken down further for proper language
I do not understand this...
> while i have numerous tools and utils out in the wild being
> used on a daily bases, none of them are multi-language but i do look
> forward to the day when i can produce such with minimal effort in coding...
> i have to leave it to others to do the actual translations, though...
I put only ls('snippet1'), ls('snippet2'), ls('snippet3')... around the text
everywhere I want a translation.
This is also better if you are searching for text in the program. You find
then exactly the position you want.
The program then is - now before all ls() are executed - making a list of all
caller adresses (handles) and of all snipets.
Caller adresses Table:
Snippet Table (original language)
4 very long text snippet
Snippet Table (language 2)
4 sehr langer text schnipsel
The ls procedure can get its (unique) caller adress and quickly search in the
caller adress table and then knows the array nr of the translation.
You can make other tables (or fields in an array) for each translation for
example. The translation is done somewhere else (for example online
There is a file with all snippets and translations (handles _not_ included,
because they may change with each execution of the program).
In this file you can store all information you want (date of creation, date of
change, and so on).
If you have a very long snippet then for example you can give the snippet
another identifyer by marking the identifyer with two '~' at the beginning of
the text snippet, for example: ls ('~ID313~very long text snippet' ). With
the shorter text snippets the snippet itself is the identifyer. If you work
with aliases as identifyer then an additional field is required as shown
Again: all you have to do in the program is putting a ls() everywhere around
you want a translation.
No need for tons od additional identyfiers and additional lines like:
p_snippet1 : pchar;
p_snippet2 : pchar;
p_snippet3 : pchar;
id_snippet1 = 'ids_snippet1';
id_snippet2 = 'ids_snippet2';
id_snippet3 = 'ids_snippet3';
p_snippet1 := trlt( id_snippet1 );
p_snippet2 := trlt( id_snippet2 );
p_snippet3 := trlt( id_snippet3 );
writeln( p_snippet1 );
writeln( p_snippet2 );
writeln( p_snippet3 );
writeln( ls( 'snippet1' ) );
writeln( ls( 'snippet2' ) );
writeln( ls( 'snippet3' ) );
More information about the fpc-pascal