Am Tuesday 07 August 2012 11:34:10 schrieb Martin: > > With all caller adresses OR all numbers (see down) I have the whole > > amount of snippets that I want to have. > > How?
With the compiler keyword 'calleradresstable'; function s( str : pchar ) : pchar; calleradresstable; Then the compiler makes a table of all calleradresses and also the amount of s() in the program. With the rtl function getcalleradresstable() then I get a pointer and the amount of the array. > I can see 2 ways you get that address > > procedure p (snip:string); > begin > calleraddr := get_caller_addr(); //needs to be implemented > ...... > end It exists already: http://www.freepascal.org/docs-html/rtl/system/get_caller_addr.html > OR > procedure p (snip:string, caller_addr:pointer); > .... > and when calling > p('hello world', get_my_addr()); // needs to be implemented > > *** BUT > then you run your app. You collect maybe (for example) 42 addresses with > snippets > > How do you know that is all of them? There may be places that call p() > but that where not executed. Then you do not have that address, so you > do not know it is missing That is the point. > > > The caller adress is a unique identifier. > > A handle. > > **IF** each snippet is unique (that is if each text exists only once) > Then the text itself can be used as a unique ID Then I also need all adresses from the snippets before all s() are called. Method 'caller adress' is easier and clearly. > > yes it is longer, and compares slower, but a hash table can solve that I prefer faster execution wherever it is possible with little effort. > >> so if you had > >> p(next_compile_time_number, 'text'); > > > > I do not write something about 'next_compile_time_number'. > > My words were 'incremented counter at compiletime'. > > That means the counter increases immediately after every occurence in the > > sourcecode. > > That is what I meant: Take 'next_compile_time_number' as a macro or > preprocesser driective ??? > Now in that case, if you know the highest number (but you do not know > it), you would be able to check completness Yes, but the number doesn't exist. I think we talk again about 2 different things here. > > You want the compiler (at compile time) to build a table (array) of all > places that call p, so you can check if they called? > That is something you never said (or I missed it) I say it the whole time. Beginning with the first post of this thread. Sven wanted to know why I need this, so we are discussing the snippet things now. > >> Lets take a step back: > >> > >> Why do you not just store all snippets in a stringlist, if p saw them? > > > > I do it. > > But I need the information which snippet was not called yet. > > That is all I want. > > See above. I have yet to know, how that works with the caller address http://www.freepascal.org/docs-html/rtl/system/get_caller_addr.html _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal