Re: [fpc-pascal] How are Assigned, Free, Nil and Destroy related?

2011-10-23 Thread Frank Peelo
On 22/10/11 10:01, Mark Morgan Lloyd wrote: Felipe Monteiro de Carvalho wrote: Free is how you release the memory allocated for a object. Free calls Destroy. Never call Destroy manually. When you implement the destructor you always implement Destroy, never change Free. A number of years ago,

Re: [fpc-pascal] More Win CE

2010-11-20 Thread Frank Peelo
On 20/11/10 13:48, Fantomas wrote: ... Sorry, but what do think is awesome? That you can only write .NET applications for Windows Phone 7? That's what I call terrible (which is basically the contrary of "awesome"). Of course, I meant that it's terrible and horrible, for I like WM and FreePasca

Re: [fpc-pascal] Mozilla XPCOM

2010-06-10 Thread Frank Peelo
On 09/06/10 15:50, Marcos Douglas wrote: On Tue, Jun 8, 2010 at 3:44 PM, Luiz Americo Pereira Camara wrote: Marcos Douglas escreveu: Exactly. Therefore I always used 'const' only at 'strings' params. I thought it had changed, but not. ;-) It can be useful for record parame

Re: [fpc-pascal] FPC bug or brain bug ?

2010-05-29 Thread Frank Peelo
On 27/05/10 23:13, Jonas Maebe wrote: On 27 May 2010, at 23:31, Yann Bat wrote: The compiler always adds a VMT if an object has a constructor or destructor. The reason is that the VMT also contains the instance size, which is used by the constructor helper to allocate the required amount

Re: [fpc-pascal] about dynamic array

2010-05-07 Thread Frank Peelo
On 07/05/2010 10:29, spir ☣ wrote: On Fri, 7 May 2010 06:10:30 +0200 cobines wrote: 2010/5/6 spir ☣ : (By the way, started playing with TFPList already, and could not find how to get data back! I mean the symtric of add(). Even tried indexing (who knows, with the syntactic magic of modern

Re: [fpc-pascal] pointer to anything

2010-04-23 Thread Frank Peelo
On 23/04/2010 14:08, spir ☣ wrote: On Fri, 23 Apr 2010 08:17:21 -0400 Doug Chamberlin wrote: On 4/23/2010 3:33 AM, spir ☣ wrote: Say I want to implement a kind of linked list which node data may be anything. Thus I cannot store data on place (in nodes), indeed; so it should be referenced.

Re: [fpc-pascal] Pointers

2010-02-12 Thread Frank Peelo
Jonas Maebe wrote: On 11 Feb 2010, at 18:17, Rainer Stratmann wrote: In the past with the turbopascal compiler and other always sizeof byte was added. That is not true. This program prints "2" when compiled under Turbo Pascal: {$t-} type pw = ^word; var w: pw; begin w:=nil; inc(w)

Re: [fpc-pascal] Pointers

2010-02-11 Thread Frank Peelo
So you're allowed add an integer to an untyped pointer?! Wow! Usually if you add 1 to a pointer of type t, then sizeof(t) gets added to the value of the pointer. So if p points at an array of byte, p+1 would point at the next element of the array, 1 byte after p. But if p points at an array o

Re: [fpc-pascal] Cancelling Scientific notation

2010-01-25 Thread Frank Peelo
On 25/01/2010 18:37, James Gibbens wrote: Hallo FPC gurus, I am VERY new to free pascal and I have a couple of problems. Can somebody please help? 1. If a, b are real numbers and I want to round a/b foo to 3 decimal places, the answer is displayed in Scientific notation. How do I turn that off

Re: [fpc-pascal] Hardware information: Linux and Windows

2010-01-19 Thread Frank Peelo
On 19/01/2010 13:09, Osvaldo Filho wrote: How do I get information about the hardware in Linux and Windows? - Identification of the processor: model, manufacturer, serial number Reading /proc/cpuinfo will give you the model and manufacturer. Don't know how to get the serial number. Was that no

Re: [fpc-pascal] Const Array Length (was Dynamic Array Length)

2010-01-03 Thread Frank Peelo
Rainer Stratmann wrote: Am Saturday 02 January 2010 16:34:57 schrieb JoshyFun: a: array[1..] or string = ('aaa', 'bbb', 'ccc'); That would be perfect. Then you can automatically calculate the amount: amax = sizeof( a ) div sizeof( a[ 1 ] ); If this syntax was in Pascal, would you use High(a

Re: [fpc-pascal] char in [range]

2009-12-08 Thread Frank Peelo
On 07/12/2009 19:41, ik wrote: http://ik.homelinux.org/ On Mon, Dec 7, 2009 at 4:43 PM, Jonas Maebe <mailto:jonas.ma...@elis.ugent.be>> wrote: On 07 Dec 2009, at 15:19, Frank Peelo wrote: On 07/12/2009 13:40, ik wrote: Now it works properly. However it s

Re: [fpc-pascal] char in [range]

2009-12-07 Thread Frank Peelo
On 07/12/2009 13:40, ik wrote: You are right, my bad. I wrote it if (not Key in ['a'..'z']) then Rather then if not (Key in ['a'..'z') then In lazarus under OnKeyPress. Now it works properly. However it seems like the not is for the "in" rather then the key if it inside the pertness. "pert

Re: [fpc-pascal] readonly variables

2009-11-29 Thread Frank Peelo
Anthony Walter wrote: Okay, I am going to call bullshit on you. This is the second time (in a few weeks) where you've replied to something I've written with wrong information. This first time concerning the topic "const records passed incorrectly" you said, "It is nowhere written in the Delphi

Re: [fpc-pascal] private integer is an illegal counter variable

2009-11-27 Thread Frank Peelo
Jonas Maebe wrote: On 27 Nov 2009, at 15:49, Juha Manninen wrote: If I define a private integer: TDemo = class(TCustomApplication) private i: integer; ... and in a protected method I use it: for i := 0 to List.Count - 1 do ... then I get an error: Error: Illegal counter variabl

Re: [fpc-pascal] Is there a way to declare a static varible in a function body?

2009-11-18 Thread Frank Peelo
On 18/11/2009 08:10, yu ping wrote: Is there a way to declare a static varible in a function body? the varible should remain the value assigned from last call. Typed constant, const /name/ : /type/ = /initial value/; Takes the initial value when the program starts, but you can assign new value

Re: [fpc-pascal] Access to RS232 ports with fpc

2009-11-02 Thread Frank Peelo
Jürgen Hestermann schrieb: function SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): LongInt; begin Result := fpRead(Handle, Buffer, Count); end; i don't understand the declaration for "buffer" in the function below, because no type is declared for "buffer". Untyped para

Re: [fpc-pascal] Creating text files with TFileStream

2009-10-23 Thread Frank Peelo
On 23/10/2009 11:21, Graeme Geldenhuys wrote: 2009/10/23 Graeme Geldenhuys : Did you try writing with WriteBuffer(Atext[1], length(AText)? That works exactly like I intended. Thanks Gerard. I spoke to soon! :-( I can view the resulting output.txt file with Midnight Commander (Linux consol

Re: [fpc-pascal] Division by Zero: EDivByZero and EZeroDivide

2009-10-19 Thread Frank Peelo
Gustavo Enrique Jimenez wrote: 2009/10/18 Tom Verhoeff : A simple example is the situation where one needs to calculate the replacement resistor value R for parallel resistors having values R1, R2, ..., Rk. The formula is R = 1/(1/R1 + 1/R2 + ... + 1/Rk). The formula gives a divide-by-zero if o

Re: [fpc-pascal] BNF grammar for fpc

2009-10-16 Thread Frank Peelo
On 16/10/2009 10:53, Florian Klaempfl wrote: Marco van de Voort schrieb: In our previous episode, J�rgen Hestermann said: There is not even a proper open one for Delphi. At least there wasn't till a while back. That may be because it is no longer possible to write a BNF grammar for these c

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Frank Peelo
On 07/10/2009 16:39, Jürgen Hestermann wrote: IIRC, there is a difference. With the second declaration the compiler can add a run-time check that the correct memebrs are accessed based on the value of X. Unfortunately, I cannot find the compiler switch. FPC has no support for this. And I d

Re: [fpc-pascal] Case in Record

2009-10-06 Thread Frank Peelo
On 06/10/2009 15:00, Felipe Monteiro de Carvalho wrote: On Tue, Oct 6, 2009 at 10:13 AM, 章宏九 wrote: Type MyRec = Record X : Longint; Case byte of 2 : (Y : Longint; case byte of 3 : (Z : Longint); ); end; I think

Re: [fpc-pascal] The names of the various FPC documentation

2009-09-07 Thread Frank Peelo
On 07/09/2009 11:00, Jonas Maebe wrote: On 07 Sep 2009, at 11:44, Michael Van Canneyt wrote: On Mon, 7 Sep 2009, Jonas Maebe wrote: ... Spaces and quotes are vetoed as a general rule :) That's fine as a general rule, but at least on Mac OS X specifically it's no problem. I think more

Re: [fpc-pascal] IE 200307043

2009-05-28 Thread Frank Peelo
Prince Riley wrote: Hello Frank, If my past post was unclear as to whether I think the constant 'nil' is an address, then let me be clear. I quoted the Borland Object Pascal's statement nil 'does not reference anything' I was not equating it to a zero address value. While a pointer with a '

Re: [fpc-pascal] IE 200307043

2009-05-27 Thread Frank Peelo
JoshyFun wrote: Hello Frank, Wednesday, May 27, 2009, 2:49:26 PM, you wrote: FP> But I'm more puzzled by what it would /mean/. In spite of your bracketed FP> comment here, you seem to be thinking that nil is an address: i.e. FP> adding/subtracting/multiplying a literal would mean something. I'm

Re: [fpc-pascal] IE 200307043

2009-05-27 Thread Frank Peelo
Prince Riley wrote: Frank, I think the crux of the matter here is how to make the distinction between a pointer with 'no value' and one that is initialized or set to the 'lowest possible value in the range'. The quote I mentioned comes directly from Borland's Object Pascal Langage Manual

Re: [fpc-pascal] IE 200307043

2009-05-25 Thread Frank Peelo
Prince Riley wrote: Hello, I had a chance to go to a reference and check on what the reserved word 'nil' , a special constant, seems to mean. According to the Object Pascal manual (Borland) ... "The reserved word nil is a special constant that can be assigned to any pointer. When nil is ass

Re: [fpc-pascal] Generating code form xmi files

2009-04-03 Thread Frank Peelo
Graeme Geldenhuys wrote: On Fri, Apr 3, 2009 at 10:51 AM, Michael Van Canneyt wrote: ... It is on my todo list, item no. 132.458 :-) ... Do you *only* have 132 todo items - lucky you ! :-) In /his/ locale, he writes '.' In /your/ locale, i'd guess his '.' would be a ',' In /my/ loca

Re: [fpc-pascal] Windows find out if an application already is running

2009-03-18 Thread Frank Peelo
Fantomas wrote: Hello, Rainer! Sunday, March 15, 2009, 10:22:04 PM, you wrote: I tried system.hprevinst, but this shows always 0. If there are more copys of the program then hinstance is always the same value. hPrevInst does not work under Win32. It is only for Win16, AFAIK. Use a named m

Re: [fpc-pascal] Origin of FPC features

2009-02-10 Thread Frank Peelo
Florian Klaempfl wrote: leledumbo schrieb: I'm writing a paper about FPC and I need references where each language feature comes from. So far, these are my what I know (some are guessing though): Feature Original DialectAdditional Information Separate compilationUCSD Pascal

Re: [fpc-pascal] specifying the relative path to a file that is located in the same folder as the application bundle?

2009-02-06 Thread Frank Peelo
Ken G. Brown wrote: Basically from point of sale system running on Macintosh, I needed to pick up a file with a known name located in the same folder as the application bundle, and process it for printing in a custom format. This way it does not need the file path hard coded in case it is differe

Re: [fpc-pascal] Writing a compiler

2009-01-05 Thread Frank Peelo
Frank Peelo wrote: ... There's also "Compiler Construction" by Prof. Wirth, Addison-Wesley, 1996, ISBN 0-201-40353-6. It describes a subset of Oberon, rather than Pascal, but it does have the advantage that he seems to have released it (or rather, a revised 3rd edition) as a

Re: [fpc-pascal] Writing a compiler

2009-01-05 Thread Frank Peelo
Gerard N/A wrote: Hi, On Mon, Jan 5, 2009 at 6:50 AM, leledumbo wrote: I just finished taking compiler techniques class this semester and I'd like to write my own based on the one used in the class. The class uses Java with JLex and JavaCUP, but I don't really like Java and I want to rewrite

Re: [fpc-pascal] Make FPC closer to hardware

2008-11-18 Thread Frank Peelo
leledumbo wrote: Well, it's just an example. I'm saying that because the need of file system support is quite frustrating that I need to write my own write routines. yes, but for example you /don't/ need to write your own write routines. (You *can't* write writeln in Pascal!) You can implement

Re: [fpc-pascal] Make FPC closer to hardware

2008-11-17 Thread Frank Peelo
leledumbo wrote: Micha Nelissen wrote: example? Let Write(Ln) work without file system support? Perhaps just by supplying a routine to write one character, and let other write routines use it. I think it already has what you want there. Doesn't call a function for each char, though.

Re: [fpc-pascal] Question: range checking for string indexing

2008-10-30 Thread Frank Peelo
Tom Verhoeff wrote: On Wed, Oct 29, 2008 at 09:58:10PM +0100, Vinzent Höfler wrote: Tom Verhoeff wrote: I am surprised that for ShortString, the range is not also 1 <= i <= Length(s). IIRC Turbo Pascal only allowed you to access s[0] when range checking was off, and similarly for s[i] with

Re: [fpc-pascal] stdout refuses to be redirected

2008-10-09 Thread Frank Peelo
Arjan van Dijk wrote: You can stop using crt, then you don't need to change your write instuctions. And how about my calls to READKEY and KEYPRESSED? Would unit WINCRT bring a solution? Or should I reconsider the use of these two statements anyhow? One possibility is to assign the output fil

Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Frank Peelo
Marco van de Voort wrote: In our previous episode, Frank Peelo said: An additional issue with delimiters in this case is the fact, that "C" in "CSV" may not always be a comma (or that spreadsheet applications may expect different characters depending on locale - e.g. semi

Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Frank Peelo
Tomas Hajny wrote: On Mon, October 6, 2008 05:33, Antal wrote: It is a plain text file, each row is separated with CRLF (#13#10), each cell separated with tab (#9) errm, surely that should be a comma, not a tab! The Tab as separator is just a good way to avoid using the double quote :P

Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-05 Thread Frank Peelo
Antal wrote: You might use the CSV, which can be easily open with Office and to generate by your application. I am using this way to handle data to/from excel It is a plain text file, each row is separated with CRLF (#13#10), each cell separated with tab (#9) errm, surely that should be a com

Re: [fpc-pascal] FPC IDE on Windows: Configuring colours

2008-09-25 Thread Frank Peelo
Marco van de Voort wrote: In our previous episode, Frank Peelo said: My questions are: How do I change the IDE colours? Is there some configuration I need to change to enable the dialogue? Hi Marco, hope you're keeping well! Afaik the trouble is that the colorselection widget wa

[fpc-pascal] FPC IDE on Windows: Configuring colours

2008-09-25 Thread Frank Peelo
Hi If this is the wrong list for asking about the IDE, I would be glad if you could point me at the right list. I use FreePascal for occasional programming. However, lately I find the colours in the IDE difficult to read - especially integer constants which appear dark blue-grey on a dark bl