Re: [fpc-pascal] How to make class constructor body calls descendant's overriden method/property?

2012-11-17 Thread Joao Morais
27;m not mistaken, the class var "name" is shared between all decendants, so perhaps your approach won't work very well. Please correct me if I'm wrong. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: How to make class constructor body calls descendant's overriden method/property?

2012-11-18 Thread Joao Morais
RegisterClass; end; // The application type TUser = class(TBaseModel); TContact = class(TBaseModel); implementation initialization FWRegisterClass([TUser, TContact]); Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: differences between .pp and .pas files

2013-02-25 Thread Joao Morais
; much easier. find -type f -executable Btw .bat is also executable. And nothing prevents you from naming your nix executables with the .exe extension. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/

Re: [fpc-pascal] Virtual Constants

2013-03-03 Thread Joao Morais
: integer; virtual; abstract; public class function getvalue: integer; end; TB = class(TA) protected class function value: integer; override; end; TC = class(TA) protected class function value: integer; override; end; Jo

[fpc-pascal] Intercept call to a property, method or attribute

2013-03-03 Thread Joao Morais
GetClient: somecheck(Self, @FClient); Result := FClient; Is there some compiler magic I am missing? Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Intercept call to a property, method or attribute

2013-03-03 Thread Joao Morais
On Sun, Mar 3, 2013 at 2:16 PM, Sven Barth wrote: > On 03.03.2013 18:03, Joao Morais wrote: >> >> Is there some compiler magic I am missing? > > Nope, you don't miss anything. The only thing which *could* help you is when > the new RTTI unit is

[fpc-pascal] Bootstrap binaries

2013-03-03 Thread Joao Morais
Hello list. How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap like lists are built? I missed at least i386-linux and i386-win32 binaries. Just to know how I will update my drafts. Joao Morais ___ fpc-pascal maillist - fpc-pascal

Re: [fpc-pascal] Bootstrap binaries

2013-03-04 Thread Joao Morais
On Mon, Mar 4, 2013 at 6:19 AM, Marco van de Voort wrote: > In our previous episode, Joao Morais said: >> How ftp://ftp.freepascal.org/pub/fpc/dist/2.6.2/bootstrap >> like lists are built? I missed at least i386-linux and i386-win32 >> binaries. > > They are simply th

[fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
roblem with fpc 2.6.2 and 2.7.1 (from two days ago), i386-win32. Joao Morais == program project1; {$mode objfpc}{$H+} uses heaptrc, sysutils, Classes; type iintf = interface ['{9E08FFD2-5AC4-4AE7-B2C6-703D62A10F16}'] function RefCount: Integer;

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
ng to a safe typecast, don't know exactly why, works flawlessly. Anyway the following code reproduce the exact problem I have here. The 'sucess!' message isn't called. Using 2.6.2 and 2.7.1 (2013/03/03) Joao Morais = program project1; {$mode objfpc}{$H+} uses heap

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-08 Thread Joao Morais
his unlikely coincidente which causes a sigsegv should be the programmer's responsibility. No thanks, I much more prefer the Delphi compatibility =) Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-10 Thread Joao Morais
On Sat, Mar 9, 2013 at 8:33 AM, Jonas Maebe wrote: > > On 09 Mar 2013, at 02:37, Joao Morais wrote: >> >> On Fri, Mar 8, 2013 at 4:09 PM, Flávio Etrusco >> wrote: >>> >>> [...] >>> >> >> You are suggesting that this unlikely c

Re: [fpc-pascal] Exe file names (was:differences between .pp and .pas files)

2013-03-10 Thread Joao Morais
On Sun, Mar 10, 2013 at 2:49 AM, 印場 乃亜 wrote: > > On 2013/02/26, at 8:51, Joao Morais wrote: > >> On Mon, Feb 25, 2013 at 8:03 PM, Graeme Geldenhuys >> wrote: >>> >>> I quite like this idea. I have always hated *nix systems that don't use >>&g

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-10 Thread Joao Morais
Sorry about breaking the thread. On Sun, Mar 10, 2013 at 3:47 PM, Joao Morais wrote: > Anyway I'd like to see some fixes in the rtl, not because of > compatibility but because of performance improvement: not declaring > refcounted parameters such as ansi strings and com interfaces

Re: [fpc-pascal] Win64 release of FPC 2.6.2 missing

2013-05-01 Thread Joao Morais
On Wed, May 1, 2013 at 6:26 AM, Graeme Geldenhuys wrote: > In the end I just downloaded the FPC source, and built my own 64-bit > compiler. Why do you need a 64 bit compiler? (just curious) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org htt

[fpc-pascal] Cannot load libpq.dylib on Mac OS X

2013-08-03 Thread Joao Morais
wxr-xr-x 1 root wheel 15 16 Nov 2012 /usr/lib/libpq.dylib -> libpq.5.4.dylib -- Hints? Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Re: Cannot load libpq.dylib on Mac OS X

2013-08-04 Thread Joao Morais
On Sat, Aug 3, 2013 at 9:07 PM, Joao Morais wrote: > $ ./pqconsole > An unhandled exception occurred at $000CA921 : > EInOutError : Can not load PostgreSQL client library "libpq.dylib". > Check your installation. > --- > > What I have done so far: > &

[fpc-pascal] Memory leak on TFPGInterfacedObjectList

2014-01-27 Thread Joao Morais
Hello list. Whenever I add interfaced objects to a TFPGInterfacedObjectList, those objects apparently add two references, while release only one when the list is cleaned or destroyed. The following code shows: ==>>>== $ /tmp/project1 just before vl.add(v1)..: 1 just after vl.

Re: [fpc-pascal] Memory leak on TFPGInterfacedObjectList

2014-01-27 Thread Joao Morais
Em 27/01/14 20:39, Marco van de Voort escreveu: In our previous episode, Joao Morais said: Hello list. Whenever I add interfaced objects to a TFPGInterfacedObjectList, those objects apparently add two references, while release only one when the list is cleaned or destroyed. v1 reference will

[fpc-pascal] List published properties of a class

2014-02-09 Thread Joao Morais
Hello list. I need to list all published properties declared in a class, iow, removing properties inherited from the parent. Up to now I am iterating typinfo.GetPropList, starting at: GetTypeData(PTypeInfo(TheClass.ClassParent.ClassInfo))^.PropCount; and it works (fpc 2.6.2). TheClass will n

Re: [fpc-pascal] How to use TCompressionStream?

2008-06-21 Thread Joao Morais
7;The result is: '); Dest.Position := 0; for i := 0 to Dest.Size - 1 do IntToHex(Dest.ReadByte, 2); What about use Compressor intead of Dest? Joao Morais WriteLn(''); finally Compressor.Free; Dest.Free; Source.Free; end; end. _

Re: [fpc-pascal] assigning a local function to a var

2008-07-09 Thread Joao Morais
David Emerson wrote: var // what should this be?? my_func : function (pass_str : ansistring) : boolean; Declare a new type: type tmy_func = function(pass_str: ansistring): boolean; var my_func: tmy_func; Joao Morais ___ fpc

Re: [fpc-pascal] assigning a local function to a var

2008-07-10 Thread Joao Morais
my_fnc := @func_a; my_fnc('hello'); end. == Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] assigning a local function to a var

2008-07-10 Thread Joao Morais
) not local functions (embedded within another function). Aff... indeed. Sorry. Local procedures and functions are really unsupported because of stack and local variable issues afaik. Delphi has this same limitation. Joao Morais ___ fpc-pascal mai

Re: [fpc-pascal] freeing string equal to setting to empty string?

2008-07-23 Thread Joao Morais
ss the memory used by string fields is automagically freed (either that or heaptrc is lying[*] when it says my programs aren't leaking memory) Yup. Ansi strings, refcounted interfaces and dyn arrays are automagically freed when declared as class members and you destroy th

Re: [fpc-pascal] Delphi mode

2008-07-31 Thread Joao Morais
ressed:=pKeypressed Changing to Keypressed := pKeypressed() ? else Keypressed:=false; End; Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Access inherited^2

2008-08-04 Thread Joao Morais
Johann Glaser wrote: How can I access an inherited inherited method which was overloaded? You can't, one of them will need to have a different name. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepasca

Re: [fpc-pascal] Access inherited^2

2008-08-04 Thread Joao Morais
Johann Glaser wrote: Hi! Am Montag, den 04.08.2008, 08:23 -0300 schrieb Joao Morais: Johann Glaser wrote: How can I access an inherited inherited method which was overloaded? You can't, one of them will need to have a different name. Thanks. Why is a method hidden, just because it ha

Re: [fpc-pascal] TObject

2008-09-08 Thread Joao Morais
ber. Btw getters and setters have not the same syntax, you need to create two different methods. -- Joao Morais end; If I do a read like this ( after the line SafeVar.data.d:=111;) Writeln(SafeVar.data.d); the output is 111 The compiler is Free Pascal Compiler version 2.2.2 [2008/08/26] for ar

Re: [fpc-pascal] Extended property can't have default value?

2008-10-06 Thread Joao Morais
between Extended and Integer types? How can I overcome this issue? Using stored instead of default? -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Extended property can't have default value?

2008-10-06 Thread Joao Morais
. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] A cross platform keydown and up

2008-10-28 Thread Joao Morais
'up' part of a keypress. Thanks Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TObject

2008-11-04 Thread Joao Morais
: SafeVar_typ; -- Joao Morais Public constructor create; destructor destroy; override; property data:SafeVar_typ read rSafeVar write wSafeVar; Published end; var SafeVar:TSafeVar; constructor TSafeVar.create; Begin inherited Create; fillchar(hSafeVar,sizeof

[fpc-pascal] Bugfix in the TCustomApplication class

2009-08-21 Thread Joao Morais
Hello. The following patch fixes a bug in the TCustomApplication class. Against fixes_2_2, sorry. Joao Morais @@ -411,7 +411,7 @@ end else // Short Option. begin - HaveArg:=(I0) and (ParamStr(I+1)[i]<>FOptionChar); + H

[fpc-pascal] Problem with string manager

2009-09-09 Thread Joao Morais
Hello list. The following cgi script shows "??" in the browser if cwstring is declared, and works as expected if the declaration is removed. Is there something I can change in order to work with widestrings, cwstring and special chars? fixes_2_4 with linux. Thanks. J

Re: [fpc-pascal] Problem with string manager

2009-09-10 Thread Joao Morais
On Wed, Sep 9, 2009 at 5:08 PM, Jonas Maebe wrote: > > On 09 Sep 2009, at 21:10, Joao Morais wrote: > >> The following cgi script shows "??" in the browser if cwstring is >> declared, and works as expected if the declaration is removed. Is >> there somethi

Re: [fpc-pascal] Currency and ABS(-674.59)

2012-03-10 Thread Joao Morais
hould use. And in fact, it is > what it does use in FPC on platforms that don't support an x87 fpu. What about promote the consistency between all platforms and implement currency as a scaled integer? After all, internally, it isn't a floating point format. Joao Morais

[fpc-pascal] Jump AfterConstruction method

2006-03-04 Thread Joao Morais
POP dword ptr fs:[$] ADD ESP, $0C end; What should I do for a FPC platform independent code? Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc

[fpc-pascal] Compile error with published field

2006-11-15 Thread Joao Morais
bject unit) +-TPressObject (PressSubject unit) Am I missing something? WinXP and the just released Lazarus 0.9.20 (with FPC 2.0.4) Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Compile error with published field

2006-11-15 Thread Joao Morais
Michael Van Canneyt wrote: On Wed, 15 Nov 2006, Joao Morais wrote: Hello, I have a TPersistent decendant class that causes the following compiling error: "Only class which are compiled in $M+ mode can be published" This is the inheritance: TPersistent (Classes unit) +-TPress

[fpc-pascal] SetPropValue doesn't convert string to enum

2006-11-15 Thread Joao Morais
using the wrong procedure or using a mistaken approach? Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Compile error with published field

2006-11-17 Thread Joao Morais
Joao Morais wrote: Michael Van Canneyt wrote: On Wed, 15 Nov 2006, Joao Morais wrote: Hello, I have a TPersistent decendant class that causes the following compiling error: "Only class which are compiled in $M+ mode can be published" This is the inheritance: TPersistent (Cl

Re: [fpc-pascal] Compile error with published field

2006-11-18 Thread Joao Morais
r, a non implemented feature or a bug? (note - Delphi doesn't raise this error) -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpdoc and three packages

2006-11-29 Thread Joao Morais
Matt Emson wrote: If you've never looked at Instant Objects it is worthwhile. Far, far simpler to get in to than tiOPF. Only Win32 though AFAIAA. And Kylix. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

[fpc-pascal] open array and 2.1.1

2007-02-20 Thread Joao Morais
because of the nil argument. Known problem? Something that was changed? Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] open array and 2.1.1

2007-02-21 Thread Joao Morais
Jonas Maebe wrote: compiles under 2.0.4 but fails under 2.1.1 (rev 6583), the compiler think that I have an array of const because of the nil argument. Known problem? Something that was changed? Please file a bug report. Done, #8371. -- Joao Morais

[fpc-pascal] Assigning a virtual class method to a method pointer

2007-02-24 Thread Joao Morais
class.implementsclassmethod]); writeln(cboolvalues[tinheritednoclass.implementsclassmethod]); end. Am I doing something wrong or this is a bug? Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Joao Morais
, at this moment I know that I can: 1. Use a safe, magic and efficient way, but I need to know if it exists; 2. Create a "light" instance using vfooclass.NewInstance method; 3. hack the vmt. Which approach do you use? Thanks. -- Joao Morais ___

[fpc-pascal] How to know if a class implements a method

2007-05-18 Thread Joao Morais
ating an instance? Thanks. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Rows affected in sqldb query

2007-05-25 Thread Joao Morais
Hello, Is there a way to know how many rows was affected in the last dml statement (sqldb classes)? Or, at least, if an update or a delete statement found what they was looking for? Thanks, -- Joao Morais ___ fpc-pascal maillist - fpc-pascal

Re: [fpc-pascal] Usage of TInterfacedObject. Automatic release?

2007-05-26 Thread Joao Morais
reference, you will have memory leakage. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Usage of TInterfacedObject. Automatic release?

2007-05-26 Thread Joao Morais
Cesar Romero wrote: - Create a Finalization method that will set one of the references to "nil" Is this mandatory? I thought the compiler creates this code for global vars as well as it creates for local vars. -- Joao Morais ___

Re: [fpc-pascal] CGI upload app

2007-06-06 Thread Joao Morais
middle of "Regenerate Makefiles?" thread .. Sent a mail in private with 2 articles. Hmmm... what about a link? Thanks. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] PASCAL programming for Novice

2007-06-09 Thread Joao Morais
AHelloClass; end; destructor THelloWrapper.Destroy; begin FHello.Free; inherited; end; function THelloWrapper.GetHello: THelloWorld; begin if not Assigned(FHello) then FHello := FHelloClass.Create; Result := FHello; end; And so on. -- Joao Morais _

Re: [fpc-pascal] a book about freepascal [off-topic]

2007-06-19 Thread Joao Morais
Flávio Etrusco wrote: There are many Portuguese speakers in the list that certainly will be glad to help too ;-) Best regards, Flávio (from Brazil) Yup. I have started a thread in the Lazarus mailing list where only PT-BRs participated. =) -- Joao Morais

Re: [fpc-pascal] Documentation for sqldb

2007-06-20 Thread Joao Morais
! -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Documentation for sqldb

2007-06-20 Thread Joao Morais
flict. I can use a select just before the update but I will create an useless overhead, since the database provides this information. When you say implement it, you don't mean 2.2 I think. If so, would you have a workaround to point out? Thanks. -- Joao Morais _

[fpc-pascal] Assigning a result of a method reference

2007-06-23 Thread Joao Morais
, the compiler complains that: Error: Incompatible types: got "" expected "AnsiString" Current 2.2 fixes branch. If I remove the at operator, this code compiles under $mode delphi. What can I do to make it work under objfpc? Thanks. -- Joao Morais _

Re: [fpc-pascal] Assigning a result of a method reference

2007-06-23 Thread Joao Morais
Michael Van Canneyt wrote: On Sat, 23 Jun 2007, Joao Morais wrote: Hello, Taking the following code: {$mode objfpc}{$h+} class function tfoo.classmetadata: string; var vmetadatamethod: function: string of object; begin vmetadatamethod := @internalmetadatastr; // more code Result

Re: [fpc-pascal] Assigning a result of a method reference

2007-06-24 Thread Joao Morais
Michael Van Canneyt wrote: On Sat, 23 Jun 2007, Joao Morais wrote: Michael Van Canneyt wrote: On Sat, 23 Jun 2007, Joao Morais wrote: Result := vmetadatamethod; end; the last assignment doesn't compile, the compiler complains that: Error: Incompatible types: got "" expec

[fpc-pascal] Problem with interfaces

2007-08-19 Thread Joao Morais
e source of the problem is gpl code. It fails under 2.0.4 and current fixes_2_2 branch. Hints? Thanks. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Problem with interfaces

2007-08-20 Thread Joao Morais
Darius Blaszijk wrote: I've had similar issues some time ago. Have you tried FPC 2.3.1? It has a some interface fixes. Nope. Trunk, rev. 8290 and still broken :-/ Thanks. -- Joao Morais Joao Morais wrote: Hello, I have the following code: {$mode objfpc} interface ... fun

Re: [fpc-pascal] Problem with interfaces

2007-08-21 Thread Joao Morais
Micha Nelissen wrote: Joao Morais wrote: The first call that I make to DefaultObj from *another* unit recreate the object, because, I don't know why, the _holder var points again to nil. Try to use a data watchpoint to watch when the variable is being changed. Hopefully that will point t

Re: [fpc-pascal] special numbers detected by val()

2007-08-26 Thread Joao Morais
lement your own data type (eg as a class) and include some flags as IsNull, IsEmpty, etc. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Problem with interfaces

2007-08-26 Thread Joao Morais
Joao Morais wrote: I simply don't know how to register the issue since I can't create a small sample that reproduce it, but I can send about 1 mb of sources to a volunteer though. Was this one forgotten? Let me know how can I help. -- J

Re: [fpc-pascal] list classes or arrays in FPC

2007-10-01 Thread Joao Morais
is: Result := ((FObjList[ARow] as TObjectList)[ACol] as TYourTargetClass); Hth. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Specifying a Interface type via $Interfaces

2007-10-12 Thread Joao Morais
: garbage collection, an algorithm to detect the island or one weak reference in order to break the chain. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] class declaration questions

2007-10-12 Thread Joao Morais
ill issue a warning if you instantiate a class with abstract methods Only if creating an instance straight from the class, eg: This will warn: begin VMyObj := TMyAbstract.Create; This wont: var VMyClass: TMyAbstractClass; begin VMyClass := TMyAbstract; VMyObj := VMyClass.Create; --

Re: [fpc-pascal] class declaration questions

2007-10-12 Thread Joao Morais
fField:anytype; end; would make fField visible "public"? It would be "published". iirc only if the class or a superclass is declared with $M+ -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.fr

Re: [fpc-pascal] Why this evaluates on "if" wrong ?

2007-10-28 Thread Joao Morais
e a scaled integer type like Currency. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Why this evaluates on "if" wrong ?

2007-10-29 Thread Joao Morais
Daniël Mantione wrote: And, as said before, no datastructure is adequate for storing a mathematical real number. Not even if you have infinite memory. Nope. If infinite memory was tangible, you would be able to store any real number. -- Joao Morais

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
0); // now you have [0] .. [19]; // Length(VArray) = 20 // for I := 0 to Pred(Length(VArray)) is a valid statement They are reference counted, just like ansi strings, ie don't worry about memory leakages. -- Joao Morais ___ fpc-pascal ma

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
statement They are reference counted, just like ansi strings, ie don't worry about memory leakages. ... Of the array itself. The objects it contains is another matter. Ah, yes, forgot to mention this. I usually use dyn arrays to manage objects owned by other lists or objects. -- Joao M

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
]:= 1 Vetor[1]:= 2 Vetor[2]:= 0 Vetor[3]:= 0 I assume the same based on the rtl internals -- except that you cannot assume values from a newly allocated area (except if you are dealing with objects) -- Joao Morais ___ fpc-pascal maillist -

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
Adrian Maier wrote: On 10/31/07, Joao Morais <[EMAIL PROTECTED]> wrote: Adrian Maier wrote: On 10/31/07, Matt Emson <[EMAIL PROTECTED]> wrote: Adrian Maier wrote: Hello, I'm seeking for advice about which is the best way to hold an array of class instances I need to ac

Re: [fpc-pascal] property or public

2008-01-21 Thread Joao Morais
private FList1: TStringList; FList2: TStringList; public property List1: TStringList read FList1; property List2: TStringList read FList2; end; The later, *much* better. You should never use class members outside the private area. -- Joao Morais

Re: [fpc-pascal] property or public

2008-01-21 Thread Joao Morais
Damien Gerard wrote: On Jan 21, 2008, at 2:52 PM, Joao Morais wrote: Damien Gerard wrote: I have (it would seem) a stupid question :) We have TStringList vars. User can do what he want with it. Which one is the stupid or the better way to do it ? TMyClass = class(TObject) public List1

Re: [fpc-pascal] property or public

2008-01-21 Thread Joao Morais
Matt Emson wrote: Joao Morais wrote: Damien Gerard wrote: On Jan 21, 2008, at 2:52 PM, Joao Morais wrote: Damien Gerard wrote: I have (it would seem) a stupid question :) We have TStringList vars. User can do what he want with it. Which one is the stupid or the better way to do it

[fpc-pascal] Populate the Format function

2008-01-22 Thread Joao Morais
Hello, I need to send an unknown amount of elements to the Format function (actually objects within a tlist decendant). I apparently cannot create a dynamic array of const, is there another way that I am missing? Currently I am parsing the Fmt param. Thanks. -- Joao Morais

[fpc-pascal] Copying array raising exception

2008-01-23 Thread Joao Morais
is: ', length(v2)); end. will raise an exception, range check error iirc, trying to copy an array beyond the number of its items. Just to know if this was designed or I should report to mantis. Thanks. -- Joao Morais ps - Michael, now my Format function rocks =) ___

Re: [fpc-pascal] class constants

2008-01-24 Thread Joao Morais
Leonardo M. Ramé wrote: Jonathan, I never needed such type of feature, a propossed solution is to create one unit per class, and declare your constants in the implementation section of each unit. A class function would be a better approach. Example: unit People interface type TPeople

Re: [fpc-pascal] class constants

2008-01-24 Thread Joao Morais
Leonardo M. Ramé wrote: With your response I assume he meant something like "static attributes" when he said "class constants". Yup. A class variable is another matter, which afaik cannot be reached with one class per unit approach. --- Joao Morais <[EMAIL PROTE

Re: [fpc-pascal] class constants

2008-01-24 Thread Joao Morais
Marco van de Voort wrote: Does FPC support class constants, and if it doesn't, are there any plans to add this support? Have a look at http://www.freepascal.org/faq.var#extensionselect The question would be "what would make this possible?" What about class vars? ___

Re: [fpc-pascal] Copying array raising exception

2008-01-26 Thread Joao Morais
Joao Morais wrote: writeln('now testing dynamic array'); setlength(v1, 5); v2 := copy(v1, 2, 10); writeln('length is: ', length(v2)); v2 := copy(v1, 6, 10); // <<-- here writeln('length is: ', length(v2)); end. will raise an exception, ra

Re: [fpc-pascal] lul.pas does not compile with fpc 2.2.0

2008-02-10 Thread Joao Morais
mpile mode. But it breaks too much existing code. We have to think about backwards compatibility. Not a problem IMHO, since one can include objfpc mode within fpc.cfg file. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Free Pascal compiler/linker/debugger as a plug-in/replacement for Delphi compiler/linker/debugger

2008-02-11 Thread Joao Morais
tions. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] AnsiDequotedStr not return empty for ""

2008-03-03 Thread Joao Morais
zaher dirkey wrote: Who is need to return the same source if it empty quoted string? That force me to implement a new function to use it. Or use AnsiExtractQuotedStr. -- Joao Morais On Sun, Mar 2, 2008 at 2:17 PM, Micha Nelissen <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]&g

Re: [fpc-pascal] Re: classes initialization

2008-03-25 Thread Joao Morais
idn't get your point. What about this piece of code: interface function foo: tfoo; implementation var _foo: tfoo; function foo: tfoo; begin if not assigned(_foo) then _foo := tfoo.create; result := _foo; end; Is it safe? -- Joao Morais _

Re: [fpc-pascal] Windows unit and SyncObjs unit clash

2008-03-26 Thread Joao Morais
encapsulates a TRLTCriticalSection. -- Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Windows unit and SyncObjs unit clash

2008-03-26 Thread Joao Morais
elphi & FPC users. They (Delphi users) are all out of luck with the cross-platform abilities of FPC, so we have to use what both compilers support. For Delphi, that would be the 'Windows' unit. What about use uses Windows under ifndef f

Re: [fpc-pascal] Pointers in Pascal!!

2008-04-29 Thread Joao Morais
Jonas Maebe wrote: On 29 Apr 2008, at 15:35, Zaka E-Lab wrote: It's possible to give a default initialization value to a defined type? No, that is not possible. Except if your pointer is declared as a member of a class (which is always assigned to nil by default) ___

[fpc-pascal] Playing with SpVoice (ole object)

2008-05-11 Thread Joao Morais
Hello, the following code: {$mode objfpc}{$H+} uses comobj; var vsound: olevariant; s: string; begin vsound := createoleobject('SAPI.SpVoice'); writeln('playing using literal'); vsound.speak('hello world'); writeln('ok (press enter)'); readln; writeln('now playing using a stri

Re: [fpc-pascal] Playing with SpVoice (ole object)

2008-05-12 Thread Joao Morais
[EMAIL PROTECTED] wrote: Joao Morais wrote: s := 'hello world'; vsound.speak(s); speaks using a literal but says randomic words (sometimes says nothing) using a variable. Is there something that I am missing? You should use a variable of type WideString: VAR S: WideString

Re: [fpc-pascal] Playing with SpVoice (ole object)

2008-05-12 Thread Joao Morais
Marco van de Voort wrote: {$mode objfpc}{$H+} uses comobj; var vsound: olevariant; s: string; begin vsound := createoleobject('SAPI.SpVoice'); writeln('playing using literal'); vsound.speak('hello world'); writeln('ok (press enter)'); readln; writeln('now playing using

Re: [fpc-pascal] casting interfaces and objects

2008-05-18 Thread Joao Morais
make a workaround in the QueryInterface method. Joao Morais Smth. like this: IObserver = Interface procedure Notify( param: TParameter ); end; TObserver = class public procedure Notify( param: TParameter ); virtual; abstract; end; Is it legal to use one or the other when e.g. handing ove

[fpc-pascal] TList.SetCount patch

2008-05-22 Thread Joao Morais
Hello, the following patch fixes a memory leakage for lists with owned objects. (patch against fixes_2_2, sorry, at least it is an one file patch and very small) Joao Morais Index: rtl/objpas/classes/lists.inc === --- rtl

[fpc-pascal] ibconnection patch

2008-05-24 Thread Joao Morais
s the sqlscale. Both patches are against fixes_2_2. Let me know if it's still useful, otherwise I will checkout trunk and create another patch. -- Joao Morais Index: fcl-db/src/sqldb/interbase/ibconnection.pp === --- fcl-db

Re: [fpc-pascal] ibconnection patch

2008-05-25 Thread Joao Morais
Michael Van Canneyt wrote: On Sat, 24 May 2008, Joao Morais wrote: The following patches fixes the lack of sqlscale var when writing decimal and numeric fields to ib/fb databases. I've used the same approach used to read such fields, ie, intpower. I looked at the patch. It looks go

[fpc-pascal] pqconnection patch

2008-05-28 Thread Joao Morais
Hello, The following patch fixes the reading of a bytea field from a PgSQL database. Btw is there someone working on pg's blob storage? Joao Morais Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp === --- package

[fpc-pascal] another pqconnection patch

2008-05-28 Thread Joao Morais
Hello, the following patch fixes the storage of floating point numbers where the decimal point isn't a dot. Joao Morais Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp === --- packages/fcl-db/src/sqldb/pos

  1   2   >