On 07/08/2012 08:22, Rainer Stratmann wrote:
Am Tuesday 07 August 2012 00:02:02 schrieb Martin:
I still do not understand what is so special about the caller address?
Furthermore, you said yourself, you do not need it. You can also live
withe a "number that the compiler generates at compilation time".
With all caller adresses OR all numbers (see down) I have the whole amount of
snippets that I want to have.
How?

I can see 2 ways you get that address

procedure p (snip:string);
begin
  calleraddr := get_caller_addr(); //needs to be implemented
  ......
end

     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

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

yes it is longer, and compares slower, but a hash table can solve that

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

then all p gets is 109, 'text'
if that 109 does help, why not the address of the 1st char?


---
I know there is still something about your idea that I havent got....
which makes this a bit hard.
I want to have all caller adresses of s() before s() is called.
what do you mean before s is called?

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)

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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to