Re: [fpc-pascal] Problem compiling

2012-08-06 Thread Marco van de Voort
In our previous episode, Jonas Maebe said: Free Pascal Compiler version 2.7.1 [2012/05/22] for i386 Anyone have an idea what could be wrong? Building development versions of FPC always has been and always will be guaranteed to work only if you start with the latest *release*

Re: [fpc-pascal] Problem compiling

2012-08-06 Thread Nico Erfurth
On 05.08.12 23:46, dhkblas...@zeelandnet.nl wrote: I get: text.inc(199,34) Error: Illegal type conversion: Text to TextRec after updating the compiler sources from SVN. Free Pascal Compiler version 2.7.1 [2012/05/22] for i386 Anyone have an idea what could be wrong? You have to use

[fpc-pascal] printing each Friday the 13 using Pascal

2012-08-06 Thread ik
Hi list, A friend of mine started a hobby project: Printing every Friday the 13, in a range of 5 yearshttp://blogs.perl.org/users/sawyer_x/2012/07/yet-another-friday-the-13th.html . I lack of the time for doing it at the moment, and I wish to add to his github

[fpc-pascal] Re: printing each Friday the 13 using Pascal

2012-08-06 Thread leledumbo
Converting one of the answers there... uses SysUtils; const StartingYear = 2012; var Year,Month: Byte; Date: TDateTime; begin for Year in [0 .. 5] do begin for Month in [1 .. 12] do begin Date := EncodeDate(Year,Month,13); if DayOfWeek(Date) = 5 then begin

[fpc-pascal] Re: printing each Friday the 13 using Pascal

2012-08-06 Thread leledumbo
Sorry, missing one thing: Date := EncodeDate(StartingYear + Year,Month,13); -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/printing-each-Friday-the-13-using-Pascal-tp5710496p5710498.html Sent from the Free Pascal - General mailing list archive at Nabble.com.

Re: [fpc-pascal] printing each Friday the 13 using Pascal

2012-08-06 Thread Gerhard Scholz
a quick and dirty solution - Original Message - From: ik To: FPC-Pascal users discussions Sent: Monday, August 06, 2012 1:19 PM Subject: [fpc-pascal] printing each Friday the 13 using Pascal Hi list, A friend of mine started a hobby project: Printing every Friday the 13, in a range

Re: [fpc-pascal] Re: printing each Friday the 13 using Pascal

2012-08-06 Thread Howard Page-Clark
On 06/8/12 1:32, leledumbo wrote: Minor amendment needed to leledumbo's code to give Friday, and a five year range: uses SysUtils; const startYr: word = 2012; var dt: TDateTime; year, month: word; begin for year in [0..4] do for month in [1..12] do begin dt :=

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

2012-08-06 Thread Rainer Stratmann
procedure p1; begin ... end; How to get all caller adresses of p1 in a program before p1 is executed? For example p1 is called from 20 different places in a program. Then I need the 20 caller adresses. ___ fpc-pascal maillist -

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

2012-08-06 Thread Howard Page-Clark
On 06/8/12 3:26, Rainer Stratmann wrote: procedure p1; begin ... end; How to get all caller adresses of p1 in a program before p1 is executed? For example p1 is called from 20 different places in a program. Then I need the 20 caller adresses. if by address you mean line number, then use

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

2012-08-06 Thread Martin
On 06/08/2012 15:26, Rainer Stratmann wrote: procedure p1; begin ... end; How to get all caller adresses of p1 in a program before p1 is executed? For example p1 is called from 20 different places in a program. Then I need the 20 caller adresses. At run time, or design time? at design

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

2012-08-06 Thread Rainer Stratmann
Am Monday 06 August 2012 18:43:04 schrieb Martin: How to get all caller adresses of p1 in a program before p1 is executed? For example p1 is called from 20 different places in a program. Then I need the 20 caller adresses. At run time, or design time? At runtime. I ment the (memory)

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

2012-08-06 Thread Sven Barth
On 06.08.2012 19:28, Rainer Stratmann wrote: Am Monday 06 August 2012 18:43:04 schrieb Martin: How to get all caller adresses of p1 in a program before p1 is executed? For example p1 is called from 20 different places in a program. Then I need the 20 caller adresses. At run time, or design

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

2012-08-06 Thread Rainer Stratmann
Am Monday 06 August 2012 19:34:23 schrieb Sven Barth: You know that scanning the binary code for calls is platform dependant? Yes. [calling opcode] [calleradress] calling opcode can differ and the byteorder of the adress can differ. So you'd need to write that code for every CPU you want to

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

2012-08-06 Thread Sven Barth
On 06.08.2012 19:56, Rainer Stratmann wrote: Am Monday 06 August 2012 19:34:23 schrieb Sven Barth: You know that scanning the binary code for calls is platform dependant? Yes. [calling opcode] [calleradress] calling opcode can differ and the byteorder of the adress can differ. The problem

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

2012-08-06 Thread Sven Barth
On 06.08.2012 21:48, Rainer Stratmann wrote: Out of curiosity: why don't you use resourcestrings? It seems that is has not the flexibility and simplicity (in its entirety) that I want. I would not call your method simple It may is in the beginning more difficult to implement, but if it runs

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

2012-08-06 Thread Martin
On 06/08/2012 20:18, Rainer Stratmann wrote: I do not understand this ... What is the content of the stack? Which file 'f'? Is it read from or write to file 'f'? f is just the STDOUT or logfile where the list of addresses is written to. You would likely use an array instead... But let me

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

2012-08-06 Thread Marco van de Voort
In our previous episode, Sven Barth said: The function returns the right language. Somehow this sounds like the GNU GetText function _() works. With the exception that the text which has to be translated is simply searched by looking through the source code for _(some text)... Note that

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

2012-08-06 Thread Aleksa Todorovic
On Mon, Aug 6, 2012 at 9:48 PM, Rainer Stratmann rainerstratm...@t-online.de wrote: Am Monday 06 August 2012 21:26:24 schrieb Jonas Maebe: It doesn't work like that. Regular calls use relative offsets on most (if not all) architectures we support. And in some cases we generate

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

2012-08-06 Thread Rainer Stratmann
Am Monday 06 August 2012 22:17:11 schrieb Martin: But let me say: I am with everyone else. Using stack/caller info is the wrong(est) way. I fully agree. And if you need to ask What is the content of the stack? Then you should not use it. All this functions are very low level. Usinc this kind

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

2012-08-06 Thread Martin
On 06/08/2012 21:39, Rainer Stratmann wrote Can you explain it more? I want not search through the sourcecode, because it makes it less easy. How does an address like $040012a help you find the source? All I need is all caller adresses of p1 in the program. Or an incremented counter at

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

2012-08-06 Thread Rainer Stratmann
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)^

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

2012-08-06 Thread Martin
On 06/08/2012 21:57, Martin wrote: I am still trying to understand what exactly you try to archive. Ok, I read one of the other posts: Do you need to ensure to handle each snippet only once? Are *ALL* snippets constants? either const t1 = 'abc'; or foo('text') and NEVER result of - a

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

2012-08-06 Thread Rainer Stratmann
Am Monday 06 August 2012 22:57:42 schrieb Martin: On 06/08/2012 21:39, Rainer Stratmann wrote Can you explain it more? I want not search through the sourcecode, because it makes it less easy. How does an address like $040012a help you find the source? If I have a list with all caller

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

2012-08-06 Thread Rainer Stratmann
Am Monday 06 August 2012 23:36:10 schrieb Martin: On 06/08/2012 21:57, Martin wrote: I am still trying to understand what exactly you try to archive. Ok, I read one of the other posts: Do you need to ensure to handle each snippet only once? Are *ALL* snippets constants? yes, but they are

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

2012-08-06 Thread Sven Barth
On 06.08.2012 22:22, Marco van de Voort wrote: In our previous episode, Sven Barth said: The function returns the right language. Somehow this sounds like the GNU GetText function _() works. With the exception that the text which has to be translated is simply searched by looking through the

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

2012-08-06 Thread Martin
On 06/08/2012 22:46, Rainer Stratmann wrote: If the are: use the address of the first char in the snippet ? But then I do not have a list of all caller adresses of s() which I try to get. I still do not understand what is so special about the caller address? Furthermore, you said yourself,

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

2012-08-06 Thread Mark Morgan Lloyd
Rainer Stratmann wrote: All I need is all caller adresses of p1 in the program. You might be able to do that sort of thing by running the program with a profiler and analyzing all captured stacks. But it would be a vast amount of effort, and unless you could guarantee 100% coverage (i.e.

[fpc-pascal] virtual class var?

2012-08-06 Thread Andrew Haines
Hi, is it possible to have a virtual class variable? I want to have a pointer available per class that can be a different value. Something like this: TA = class class var Foo: TObject; virtual; end; TB = class(TA) class var Foo: TSpecialObject; override; end; I have in

Re: [fpc-pascal] virtual class var?

2012-08-06 Thread Andrew Haines
My current idea for a solution is here: http://pastebin.com/P3JsDQ03 Can anyone think of something with less code? I guess I could save a little if I skip the property and directly use GetVMT and SetVMT. Regards, Andrew ___ fpc-pascal maillist -

Re: [fpc-pascal] virtual class var?

2012-08-06 Thread Paul Ishenin
07.08.12, 8:18, Andrew Haines wrote: Hi, is it possible to have a virtual class variable? I want to have a pointer available per class that can be a different value. Something like this: TA = class class var Foo: TObject; virtual; end; TB = class(TA) class var Foo:

Re: [fpc-pascal] virtual class var?

2012-08-06 Thread Andrew Haines
On 08/06/12 23:02, Paul Ishenin wrote: Class variable is stored the same way as a regular variable and has the only difference is that it can be accessible with the class name prefix. The thing you need requires different implementation - something like storing a virtual class variable in

Re: [fpc-pascal] virtual class var?

2012-08-06 Thread Paul Ishenin
07.08.12, 11:24, Andrew Haines wrote: What is the current implementation? I would guess that class vars are stored in the vmt already... No, class var and regular variable has no difference except the scope. It is a static variable which is shared between all instances and descendants - so

Re: [fpc-pascal] virtual class var?

2012-08-06 Thread Andrew Haines
Ahhh ok I understand now. , Thank you. -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. Paul Ishenin paul.ishe...@gmail.com wrote: 07.08.12, 11:24, Andrew Haines wrote: What is the current implementation? I would guess that class vars are stored in the vmt already...