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

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 l...@joaomorais.com.br 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 expected

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 mesgnb0 then Comment(V_Error,'Message recordind

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

[fpc-pascal] Error Message recording not yet supported

2015-01-14 Thread Joao Morais
://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/TARGET opf/jcoreopfconfig Please let me know if I did something badly wrong. Thanks! Joao Morais

[fpc-pascal] Type used to specialize a generic

2014-11-23 Thread Joao Morais
the 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.freepascal.org

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 l...@joaomorais.com.br 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? No, you can't

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: linespec.c:2445: internal-error: void

[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

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

2014-03-12 Thread Joao Morais
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] 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] 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] 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-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

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 TMyGenericT: TMyType -- this is the real type specialize TMyGenericTSomeDescendantType --

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

[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

[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

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

[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 jcmorai...@gmail.com 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: 1. export

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

2013-08-03 Thread Joao Morais
- 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 gra...@geldenhuys.co.uk 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 -

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-10 Thread Joao Morais
On Sat, Mar 9, 2013 at 8:33 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: On 09 Mar 2013, at 02:37, Joao Morais wrote: On Fri, Mar 8, 2013 at 4:09 PM, Flávio Etrusco flavio.etru...@gmail.com wrote: [...] You are suggesting that this unlikely coincidente which causes a sigsegv should

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, 印場 乃亜 shir...@galapagossoftware.com wrote: On 2013/02/26, at 8:51, Joao Morais jcmorai...@gmail.com wrote: On Mon, Feb 25, 2013 at 8:03 PM, Graeme Geldenhuys gra...@geldenhuys.co.uk wrote: I quite like this idea. I have always hated *nix systems that don't

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 jcmorai...@gmail.com 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

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-08 Thread Joao Morais
. 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

[fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
(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; end; { tintf } tintf = class(TInterfacedObject

Re: [fpc-pascal] Sigsegv with refcounting interface

2013-03-07 Thread Joao Morais
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 heaptrc, sysutils, Classes

Re: [fpc-pascal] Bootstrap binaries

2013-03-04 Thread Joao Morais
On Mon, Mar 4, 2013 at 6:19 AM, Marco van de Voort mar...@stack.nl 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 the compiler binary

Re: [fpc-pascal] Virtual Constants

2013-03-03 Thread Joao Morais
value: 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; Joao Morais

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

2013-03-03 Thread Joao Morais
: 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 pascaldra...@googlemail.com 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 implemented which contains

[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] Re: differences between .pp and .pas files

2013-02-25 Thread Joao Morais
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/mailman

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

2012-11-18 Thread Joao Morais
(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
. 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
. 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 jonas.ma...@elis.ugent.be 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 something I can change in order

[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. Joao Morais

[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:=(IParamCount) and (Length(ParamStr(I+1))0) and (ParamStr(I+1

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

Re: [fpc-pascal] TObject

2008-09-08 Thread Joao Morais
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 arm Of course I could create

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 has

Re: [fpc-pascal] Delphi mode

2008-07-31 Thread Joao Morais
:=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
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 the instance. Joao Morais

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

2008-07-10 Thread Joao Morais
. == 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 maillist

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
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. ___ fpc

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 'str

[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 === --- packages/fcl

[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/postgres

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 good. I

Re: [fpc-pascal] casting interfaces and objects

2008-05-18 Thread Joao Morais
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 over an observer to a method

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

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
. -- 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
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 fpc? -- Joao Morais ___ fpc

Re: [fpc-pascal] Re: classes initialization

2008-03-25 Thread Joao Morais
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 ___ fpc

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] wrote: Peter

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

2008-02-11 Thread Joao Morais
. -- 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
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 http

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, range check error iirc, trying to copy

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 PROTECTED] wrote: A class function

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?

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

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

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
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 maillist - fpc-pascal

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 Morais

Re: [fpc-pascal] Arrays of objects

2007-10-31 Thread Joao Morais
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 - fpc

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 access the elements using

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
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] 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
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; -- Joao Morais

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.freepascal.org/mailman

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

2007-10-01 Thread Joao Morais
] 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] special numbers detected by val()

2007-08-26 Thread Joao Morais
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. -- Joao Morais

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

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 ... function

[fpc-pascal] Problem with interfaces

2007-08-19 Thread Joao Morais
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 procedure variable type

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

2007-06-23 Thread Joao Morais
, the compiler complains that: Error: Incompatible types: got procedure variable type of function:AnsiString of object;Register 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

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

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] PASCAL programming for Novice

2007-06-09 Thread Joao Morais
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 ___ fpc-pascal maillist

Re: [fpc-pascal] CGI upload app

2007-06-06 Thread Joao Morais
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] 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

  1   2   >