[fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing

Lukasz Sokol el.es.cr at gmail.com
Mon Aug 13 12:07:59 CEST 2012

On 13/08/2012 10:09, Rainer Stratmann wrote:
> Am Monday 13 August 2012 10:35:55 schrieb Lukasz Sokol:
>> On 12/08/2012 14:41, Rainer Stratmann wrote:
>>> It depends on the approach.
>>> If you have a better solution would you take another approach?
>> What is wrong with known and explored ways e.g. gettext ?
> It will be ok for those who are satisfied with the functionality.
> I dont know gettext in detail, but I assume there is more work than only to 
> put a function ls('textsnippet') around.

Me neither - but IIRC using gettext (dxgettext) was something /incredibly/ easy :
the translating function is called '_()' :) (yes, function _([const] input: string): string; )

 (allegedly, in newer (dx)gettext, not even that- it's enough to have (dx)gettext unit included, 
  but don't quote me on this one).

Then the dxgettext handling program creates the strings to be translated list out of that 
(saves to text .po file), together with programmatic context they are used in, 
as a help for the translator - and then compiles to .mo (pls sbdy correct me if I'm wrong) 
which are loaded at program start/on demand/as resourcestrings, (and IIRC may already support 
UTF-8/Unicode/multiple bytes per character strings too - do you)?

The gettext program is out there for (almost) all platforms, AND there are plethora of translation-handling
programs compatible with it, out there too, but you could well enough handle it by editing
the po files in any decent text editor.

>> 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.
So you don't want to translate it all at the same time, is that what it is?
Only the strictly necessary portions/snippets as you call them?

>> Well why not the T(Hashed)StringList descendant with custom counter
>> field(s) ?
> If I put a ls('snippet') around all texts I now get every caller adress 
> (handle) and the text information 'snippet' itself. So before they are called 
> I can make a list with all handles and all translations.
> When calling ls() I look in my handle list of caller adresses and find it in 
> array nr x where all translations were already made.

Please forgive my attitude - but it looks like a very-low level and hence very
inflexible and very un-Pascal solution to this problem. I think, this is what 
people were trying to suggest to you.


More information about the fpc-pascal mailing list