Re: [fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

2015-07-30 Thread Joao Morais
On 24/07/15 04:10, Michael Van Canneyt wrote: Attributes and RTTI will come as soon as 3.0 are out of the door. Hello Michael, merging to trunk I presume. Provided that attributes and new rtti are two of the best things since the discover of the fire and the wheel, is there some branch I co

Re: [fpc-pascal] Calling overriden method using TMethod

2015-07-30 Thread Joao Morais
On 30/07/15 15:05, Sven Barth wrote: Am 30.07.2015 19:00 schrieb "Joao Morais" <mailto:l...@joaomorais.com.br>>: > > tbar2 inherits from tbar1 and 'go' is a virtual method. v1.go calls the tbar2 implementation as expected but tm(m1)() does call tbar1.go. As

[fpc-pascal] Calling overriden method using TMethod

2015-07-30 Thread Joao Morais
Hello, in the following sample: ==>>>== ... type tm = procedure of object; var v1: tbar1; m1: tmethod; begin v1 := tbar2.create; try v1.go; m1.code:=@tbar1.go; m1.data:=v1; tm(m1)(); finally freeandnil(v1); end; end. ==<<<== tbar2 inherits from

Re: [fpc-pascal] Error Message recording not yet supported

2015-07-23 Thread Joao Morais
On 14/01/15 19:11, Joao Morais wrote: On 14/01/15 12:40, Pierre Free Pascal wrote: The corresponding code that stores the message list generates an internal error if the number of message is more than 255. So that the two lines if mesgnb>0 then Comment(V_Error,'Message r

Re: [fpc-pascal] Error Message recording not yet supported

2015-01-14 Thread Joao Morais
On 14/01/15 12:40, Pierre Free Pascal wrote: Hi all, from looking at the source code and the commit, it does appear to be some error.. The corresponding code that stores the message list generates an internal error if the number of message is more than 255. So that the two lines i

[fpc-pascal] Error Message recording not yet supported

2015-01-14 Thread Joao Morais
workaround: - Download https://github.com/jcmoraisjr/jcore/archive/master.zip - Compile a test package; or - path/to/fpc/3.0.1/compiler/ppc386 -Ficore -Fucore -Fuopf -Fupath/to/fpc/3.0.1/rtl/units/ opf/jcoreopfconfig Please let me know if I did something bad

Re: [fpc-pascal] Type used to specialize a generic

2014-11-23 Thread Joao Morais
Em 23/11/14 15:49, Sven Barth escreveu: Am 23.11.2014 18:11 schrieb "Joao Morais" <mailto:l...@joaomorais.com.br>>: > > > Hello list, is there a safe way to know the PTypeInfo, or at least the string literal of the type(s) used to specialize a generic? N

[fpc-pascal] Type used to specialize a generic

2014-11-23 Thread Joao Morais
following hack on 2.6.x: VPos := Pos('$', AClassName); if VPos > 0 then VTypeName := Copy(AClassName, VPos + 1, Length(AClassName)); ...which is broken on 2.7. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepa

[fpc-pascal] Dynamic array initialization

2014-03-17 Thread Joao Morais
Hello list! Are dynamic arrays initialized with nil after the setlength call? Doc[1] doesn't say a word about that and my tests say yes, they are initialized with nil. What is the supported behavior? [1] http://www.freepascal.org/docs-html/ref/refsu18.html#x42-480003.3.1 ___

Re: [fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-17 Thread Joao Morais
Em 12/03/14 08:55, Martin Frb escreveu: On 12/03/2014 11:27, Joao Morais wrote: If I compile RTL with "-gl -gw", GDB crashes with the following messages: While executing the command: "TGDBMIDebuggerInstruction: "-break-insert +0", " gdb reported: "&

[fpc-pascal] RTL debuginfo on GDB 7.4+ and OSX Mavericks

2014-03-12 Thread Joao Morais
icks. Is this a known problem? Is there a workaround to see linenumbers and the like on RTL traces on Mavericks? [1] http://www.sourceware.org/ml/gdb/2012-03/msg00055.html Thanks! Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] List published properties of a class

2014-02-28 Thread Joao Morais
Em 09/02/14 18:05, Joao Morais escreveu: 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

Re: [fpc-pascal] Property attributes

2014-02-28 Thread Joao Morais
Em 27/02/14 09:34, Sven Barth escreveu: Am 27.02.2014 11:56, schrieb Joao Morais: Em 27/02/14 05:26, Sven Barth escreveu: Am 27.02.2014 01:38, schrieb Joao Morais: Hello list. What is the current status of property attributes? Some roadmap? http://wiki.freepascal.org/Property_attributes

Re: [fpc-pascal] How to use generics and meta class?

2014-02-28 Thread Joao Morais
Em 28/02/14 03:44, Sven Barth escreveu: === code end === Currently this will print: === output begin === Bar === output end === If the compiler would now naively generate an implementation of TMyGeneric with TMyType then the result would be: === output begin === Foo === output end ===

Re: [fpc-pascal] How to use generics and meta class?

2014-02-28 Thread Joao Morais
Em 27/02/14 19:56, luiz americo pereira camara escreveu: 2014-02-27 18:43 GMT-03:00 Joao Morais <mailto:l...@joaomorais.com.br>>: Correct. The feature I was talking about is something like: generic TMyGeneric And TMyType is a class. In this case the compiler k

Re: [fpc-pascal] How to use generics and meta class?

2014-02-27 Thread Joao Morais
Em 27/02/14 09:39, Sven Barth escreveu: Am 27.02.2014 13:37, schrieb Sven Barth: Am 27.02.2014 12:12, schrieb Joao Morais: Em 25/02/14 05:14, Sven Barth escreveu: A generic is by definition not a fully existant type. Plans to include generics as a real type for class attributes? Something

Re: [fpc-pascal] How to use generics and meta class?

2014-02-27 Thread Joao Morais
Em 25/02/14 05:14, Sven Barth escreveu: A generic is by definition not a fully existant type. Plans to include generics as a real type for class attributes? Something like the Java world: generic TMyGeneric <<-- this is the real type specialize TMyGeneric <<-- only for type safety, discar

Re: [fpc-pascal] Property attributes

2014-02-27 Thread Joao Morais
Em 27/02/14 05:26, Sven Barth escreveu: Am 27.02.2014 01:38, schrieb Joao Morais: Hello list. What is the current status of property attributes? Some roadmap? http://wiki.freepascal.org/Property_attributes There is a branch which already supports class attributes. Property attributes (or

[fpc-pascal] Property attributes

2014-02-26 Thread Joao Morais
Hello list. What is the current status of property attributes? Some roadmap? http://wiki.freepascal.org/Property_attributes ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[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] 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] 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.

[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] 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

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

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] 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
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] 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-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

[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] 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] 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] 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] 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] 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

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] 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] 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] 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

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

[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

[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

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] 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] 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

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] 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] 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] 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] 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] 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] 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] 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-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] 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] another pqconnection patch

2008-05-29 Thread Joao Morais
Joao Morais wrote: There are other problems, at least with timestamp field. Please wait another patch soon. The following patch fixes the storage of floating point, time and timestamp fields on a pgsql database. Patch is against trunk. Joao Morais Index: packages/fcl-db/src/sqldb/postgres

Re: [fpc-pascal] another pqconnection patch

2008-05-29 Thread Joao Morais
Joost van der Sluis wrote: Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao Morais: the following patch fixes the storage of floating point numbers where the decimal point isn't a dot. Two questions: does postgres always request a dot as decimal point? Yes. Or is

[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

[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

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] 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

[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

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

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

[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] 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) ___

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] 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] 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] 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] 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] 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] 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] 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] 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
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

[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 =) ___

[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

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

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
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] 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] 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
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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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

[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] 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

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

  1   2   >