Re: [fpc-pascal] performance when resizing a dynamic array

2016-12-07 Thread David Emerson
Graeme Geldenhuys wrote: Martin Schreiber wrote: That happens with every reallocmem() with FPC memory manager so using a getmem() block instead of a dynamic array has no advantage in this Maybe a good old linked list implementation is the best performer then. Back to the Pascal of the 80's and

Re: [fpc-pascal] inherited interfaces not seen by queryinterface / supports

2016-10-27 Thread David Emerson
On 10/27/2016 06:01 AM, Tony Whyman wrote: That is you can build an object hierarchy to parallel an interface hierarchy. I don't use the "Supports" primitive. - so maybe there is a bug in this feature but otherwise, what is the problem with interface inheritance? Yes, the problem is with "Sup

Re: [fpc-pascal] inherited interfaces not seen by queryinterface / supports

2016-10-27 Thread David Emerson
On 10/27/2016 05:18 AM, Graeme Geldenhuys wrote: On 2016-10-27 12:42, Marcos Douglas B. Santos wrote: It is a "bug by design". The worst kind! Actually, I think this is should be corrected in both modes (COM and CORBA). Indeed, and even if it is fixed in FPC, it shouldn’t break any existi

[fpc-pascal] inherited interfaces not seen by queryinterface / supports

2016-10-26 Thread David Emerson
Hi all, I am a bit perplexed / disappointed to see that the Supports / QueryInterface functions for interfaces are not behaving the way I would expect them to behave, when using an interface that inherits from another interface. note, _obj_type_ might be TObject, TInterfacedObject, or TCompo

Re: [fpc-pascal] 3.1.1 documentation in html on the website?

2016-10-17 Thread David Emerson
Michael Van Canneyt wrote: David Emerson wrote: Can the 3.1.1 documentation be viewed as html on the website? where? No. The 3.0.0 version is easy to find... but I'd like to see the one under development It is not under development. I only document released material. I guess I s

[fpc-pascal] 3.1.1 documentation in html on the website?

2016-10-17 Thread David Emerson
Can the 3.1.1 documentation be viewed as html on the website? where? The 3.0.0 version is easy to find... but I'd like to see the one under development Thanks! David. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepasc

Re: [fpc-pascal] corba interfaces - is/as not working properly

2016-09-29 Thread David Emerson
On 09/29/2016 06:06 AM, Sven Barth wrote: Am 29.09.2016 11:34 schrieb "Martin Schreiber" mailto:mse00...@gmail.com>>: On Thursday 29 September 2016 10:49:03 Graeme Geldenhuys wrote: > On 2016-09-29 06:42, Martin Schreiber wrote: > > abcintf:= iabc(abc); > > " > > which has the best performance

Re: [fpc-pascal] corba interfaces - is/as not working properly

2016-09-29 Thread David Emerson
On 09/28/2016 10:42 PM, Martin Schreiber wrote: Corba-style interfaces can use any string as ID so for local interfaces it is possible to use shorter ID-strings for better performance. Is this described anywhere in the documentation? > MSEide constructs such ID's by RightClick-'Insert UID'. Ex

Re: [fpc-pascal] corba interfaces - is/as not working properly

2016-09-28 Thread David Emerson
On 09/28/2016 03:31 PM, Graeme Geldenhuys wrote: On 2016-09-28 22:59, David Emerson wrote: Alternately, if I give a GUID does an interface not automatically become COM + managed? No definitely not! The GUID just helps the compiler or RTL identify an Interface. Oh fabulous! Thanks much. I

Re: [fpc-pascal] corba interfaces - is/as not working properly

2016-09-28 Thread David Emerson
On 09/28/2016 01:24 AM, Graeme Geldenhuys wrote: On 2016-09-28 08:38, David Emerson wrote: I'm testing out CORBA interfaces before changing all my code to use them (I would prefer not to have managed types for interfaces). I've been using CORBA style interfaces for years, and it

Re: [fpc-pascal] corba interfaces - is/as not working properly

2016-09-28 Thread David Emerson
On 09/28/2016 12:40 PM, Lars wrote: Curious, where do corba interfaces come in handy ? When can you use them that object oriented code won't offer the same features? For multiple inheritence, since fpc does not support multiple inheritence without interfaces. Interfaces are an addition to obj

[fpc-pascal] corba interfaces - is/as not working properly

2016-09-28 Thread David Emerson
Hi all, I'm testing out CORBA interfaces before changing all my code to use them (I would prefer not to have managed types for interfaces). However I am running into a glitch. Testing "if (my_object is i_some_interface)" is always returning true, even when the object does not implement the i

Re: [fpc-pascal] changes to include file do not trigger recompilation of unit

2016-09-09 Thread David Emerson
On 09/09/2016 01:03 AM, Graeme Geldenhuys wrote: On 2016-09-08 22:57, David Emerson wrote: I'm wondering if anyone else has run into it, and if there might be a workaround. Yes, it has been happening here for years. No workaround that I know of, except to do a Build All after you make ch

[fpc-pascal] changes to include file do not trigger recompilation of unit

2016-09-08 Thread David Emerson
Hi all, a couple days ago I filed this: http://mantis.freepascal.org/view.php?id=30569 In a particular situation (common in my project), making changes to an include file does not trigger recompilation of the unit(s) where it is included. I'm wondering if anyone else has run into it, and if

Re: [fpc-pascal] Does MACRO work in this case?

2016-09-08 Thread David Emerson
On 09/08/2016 10:08 AM, silvioprog wrote: Hello, Looking an alternative to solve the problem I've talked at this topic , I've tried to solve it declaring a macro named "TIStringComparer.Ordinal": Macros can only replace

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-28 Thread David Emerson
Philosophical arguments aside, I filed a bug against the documentation, since one thing is clear-- that I and others were previously misled into believing something that is not true. http://mantis.freepascal.org/view.php?id=30321 In the report, I included several references where the documenta

Re: [fpc-pascal] which "managed" result types require extra work?

2016-06-27 Thread David Emerson
On 06/26/2016 10:51 PM, Jonas Maebe wrote: > PS: there is an intrinsic that can help you in this process: the > "default" intrinsic. Default(TSomeType) returns an instance of a > particular type completely initialised to "empty" (0 for ordinal and > floating point types, empty for strings, nil for

Re: [fpc-pascal] which "managed" result types require extra work?

2016-06-26 Thread David Emerson
Addendum - what about a return value which is a class that implements an interface? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] which "managed" result types require extra work?

2016-06-26 Thread David Emerson
Okay, making a new thread here, to ask one question: Which types do we need to initialize to null/nil/zero/'' when they are a function result? - dynamic arrays - ansistring - unicodestring - string, with {$H+} (but not string[length]) - records containing any of them - anything else??? I u

Re: [fpc-pascal] reference-counted function results not initialized to nil

2016-06-24 Thread David Emerson
On 06/24/2016 08:19 PM, Michalis Kamburelis wrote: After upgrading fpc 2.6.4 -> 3.0.0, I'm seeing a bug where (as noted in subject) reference-counted function results are not being initialized to nil. They were never guaranteed to be initialized to nil. Reference-counted types (unlike other ty

[fpc-pascal] reference-counted function results not initialized to nil

2016-06-24 Thread David Emerson
Hi all, After upgrading fpc 2.6.4 -> 3.0.0, I'm seeing a bug where (as noted in subject) reference-counted function results are not being initialized to nil. Is this a known bug? I am seeing it in ansistrings and also dynamic arrays. Here is an example program to see it with ansistrings:

Re: [fpc-pascal] default parameter single = NaN

2016-06-20 Thread David Emerson
On 06/20/2016 02:53 PM, Martin wrote: On 20/06/2016 22:45, David Emerson wrote: I found a workaround, which is to use Infinity as the default value, instead of NaN. It's acceptable for my use, though a little awkward. there is another workaround. Do not repeat the default val

Re: [fpc-pascal] default parameter single = NaN

2016-06-20 Thread David Emerson
On 06/20/2016 02:43 PM, Jonas Maebe wrote: On 20/06/16 22:59, David Emerson wrote: Error: function header doesn't match the previous declaration for a (non-method) function that does exactly match its previous declaration: function make_scale_matrix (zx:single; zy:single=NaN):t_2d_a

Re: [fpc-pascal] default parameter single = NaN

2016-06-20 Thread David Emerson
I found a workaround, which is to use Infinity as the default value, instead of NaN. It's acceptable for my use, though a little awkward. ~David ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/l

[fpc-pascal] default parameter single = NaN

2016-06-20 Thread David Emerson
Hey all, After installing fpc 3.0.0, I'm getting an... Error: function header doesn't match the previous declaration for a (non-method) function that does exactly match its previous declaration: function make_scale_matrix (zx:single; zy:single=NaN):t_2d_affine; I use "NaN" extensively to in

Re: [fpc-pascal] interface inheritance implementation

2015-10-12 Thread David Emerson
On 10/12/2015 03:13 AM, Graeme Geldenhuys wrote: t_multiplier_and_adder = class (tbase, i_adder, i_multiplier) Thanks for this recommendation-- the problem is that I have a list whose elements are each i_multiplier_and_adder, and I want to be able to take an element of that list and have the

[fpc-pascal] interface inheritance implementation

2015-10-11 Thread David Emerson
Not sure what subject line to use to summarize what I'm trying to do here, but that is kind of related :) So I would like to use an interface that inherits from another interface, and ... well rather than describe what I'm trying to do, I think code speaks best. type // here is the first in

[fpc-pascal] detect implementation / interface sections

2015-09-24 Thread David Emerson
I tried sending this message two days ago, but it seems not to have gone through. Trying again. I like using include files, to break up big units into multiple files, and also as macro-based templates. One thing I do frequently is to put both the interface and the implementation into one inc

Re: [fpc-pascal] question with interfaces, hooks

2015-07-16 Thread David Emerson
Thanks, Graeme and Sven! On 07/14/2015 11:05 PM, Sven Barth wrote: Not related to your problem, but important nevertheless: you don't need to free interface variables. They are reference counted and freed automatically at least if you don't mix a class reference (in your case to t_foo_base) and

[fpc-pascal] question with interfaces, hooks

2015-07-14 Thread David Emerson
Hi list! I'm just starting in with interfaces, and am happy to see there is something similar to multiple inheritence available. But it seems to be limited in a way I will show below, so I am wondering if there is something I am missing. Example code says it best... program test_interfaces;

[fpc-pascal] record helpers & how they effect records

2015-06-08 Thread David Emerson
using a simple record, e.g. some_record_type = record a, b : longint; end; If I declare a record helper, does this change the record in any way? i.e. does the record take any more space when passed as a function parameter? Does it become somehow like an object, and need to be allocated? O

[fpc-pascal] valgrind: "invalid read"

2015-06-03 Thread David Emerson
Hi all, I have just started using valgrind, and I was surprised that I got a lot of errors, particularly in places that look like clean code. So I whittled things down and created a test program. Here is the error I am seeing (I've removed the procid, ==11180==): Invalid read of size 16 a

Re: [fpc-pascal] aggpas examples

2013-08-20 Thread David Emerson
I have also tried compiling examples against the aggpas sources as downloaded from the aggpas website, outside lazarus, and again, errors and more errors. Start by naming one error. Thanks very much for your encouragement Matthias! I managed to resolve everything by moving the $include agg_mo

[fpc-pascal] aggpas examples

2013-08-20 Thread David Emerson
I am trying to compile some of the aggpas examples included with lazarus, but I am getting errors upon errors. I have also tried compiling examples against the aggpas sources as downloaded from the aggpas website, outside lazarus, and again, errors and more errors. Is there a recommended way

Re: [fpc-pascal] math round vs banker's round

2013-08-13 Thread David Emerson
Thanks for the suggestions, guys! José Mejuto wrote: > SimpleRoundTo I think. But I want an integer result, and this returns a floating point. Sven Barth wrote: Take a look at SetRoundMode in unit Math: http://www.freepascal.org/docs-html/rtl/math/setroundmode.html After calling SetRoundMode

[fpc-pascal] math round vs banker's round

2013-08-13 Thread David Emerson
Hi all, I have just discovered that the system.round function has this very odd behavior of rounding towards an even number when the fractional part is .5 -- in the system.round documentation this is described as "banker's rounding" I do not like this behavior. How can I use a more mathemat

[fpc-pascal] bootstrapping from svn

2012-11-25 Thread David Emerson
Well, I decided to make another attempt at running from the svn fixes_2_6 branch The first problem I encountered was that I could not compile from fpc 2.4.4. It sure would be nice if a compatible ppc386 executable was included in the repository, so I wouldn't have to go download it from somewh

Re: [fpc-pascal] debian control files for fpc

2011-12-18 Thread David Emerson
I solved this problem by downloading the sources from debian, which apparently have a different directory structure layout. ~D. On Sun 18 Dec 2011, David Emerson wrote: > > > Where can I find debian control files for fpc? > > > > In the fpcbuild svn repository: > >

Re: [fpc-pascal] News from MSEide+MSEgui

2011-12-18 Thread David Emerson
Congratulations, Martin! Keep up the good work. (is that your own custom-built git gui?) On Mon 12 Dec 2011, Martin Schreiber wrote: > Hi, > > MSEide+MSEgui 2.8rc1 for FPC 2.6 has been released: > > http://sourceforge.net/projects/mseide-msegui/files/mseide-msegui/2.8rc1/ > > There is also a n

Re: [fpc-pascal] alias a function + overload 'in'

2011-12-18 Thread David Emerson
On Sun 18 Dec 2011, Jürgen Hestermann wrote: > David Emerson schrieb: > > 2. is it possible to overload the 'in' operator, so that it may work > > (using supplied code) on things that are not a pascal set? > > I do not know whether it is possible but I hate s

Re: [fpc-pascal] alias a function + overload 'in'

2011-12-18 Thread David Emerson
Thank you, Tomas, those are all excellent suggestions! I am glad I asked. On Sun 18 Dec 2011, Tomas Hajny wrote: > On 17 Dec 11, at 21:07, David Emerson wrote: > > > two little questions > > > > 1. Is it possible to make an alias to a function ... so rather than just

Re: [fpc-pascal] debian control files for fpc

2011-12-18 Thread David Emerson
> > Where can I find debian control files for fpc? > > In the fpcbuild svn repository: > http://svn.freepascal.org/svn/fpcbuild/trunk/install/debian/ > > Vincent Thanks much!! I wish it worked :( I copied all the debian control files from the 2.4.4 release: http://svn.freepascal.org/svn/fpcbui

[fpc-pascal] debian control files for fpc

2011-12-18 Thread David Emerson
I'd like to roll my own fpc-2.4.4 .deb for in-house development The lazarus sources seem to include a debian directory with all the control files, which is wonderful! Where can I find debian control files for fpc? Thanks, David ___ fpc-pascal maillis

[fpc-pascal] alias a function + overload 'in'

2011-12-17 Thread David Emerson
two little questions 1. Is it possible to make an alias to a function ... so rather than just re-calling with the same parameters, it's actually the same thing? like the way we can do, e.g., type natural = cardinal, or const GG = 6, but with a function? 2. is it possible to overload the 'in' op

Re: [fpc-pascal] freetype unit + unicode

2011-10-06 Thread David Emerson
On Thu 6 Oct 2011, michael.vancann...@wisa.be wrote: > On Wed, 5 Oct 2011, David Emerson wrote: > > On Tue 4 Oct 2011, michael.vancann...@wisa.be wrote: > >> If you need some UTF8 extensions to the freetype unit, feel free to make > >> some suggestions, and we'

Re: [fpc-pascal] Reading and writing char

2011-10-05 Thread David Emerson
On Wed 5 Oct 2011, Thomas Young wrote: > Hi, > > I'm trying to read and write ascii characters using FPC. I had no problems > doing this years ago with Think Pascal & Code Warrior. > > For some reason I'm not able to read and write ascii characters above ascii > 127 with FPC. Can someone explain

Re: [fpc-pascal] freetype unit + unicode

2011-10-05 Thread David Emerson
On Tue 4 Oct 2011, michael.vancann...@wisa.be wrote: > If you need some UTF8 extensions to the freetype unit, feel free to make > some suggestions, and we'll see what we can do. > > When the unit was made, unicode support was a thing of the distant future. > (a future which of course crept up on u

Re: [fpc-pascal] freetype unit + unicode

2011-10-04 Thread David Emerson
On Tue 4 Oct 2011, michael.vancann...@wisa.be wrote: > > Is there some secret, hidden documentation for fpc's freetype unit? (and so > > many other units?) :P > > No. > > But you are in luck: this is open source, and the Lazarus IDE lets you jump > and look around in the FPC code very easily :-)

Re: [fpc-pascal] freetype unit + unicode

2011-10-04 Thread David Emerson
> > What freetype API function are you calling? Not sure if it applies to > > freetype, but with Xft (as implemented and used in fpGUI), there are > > various versions of the same API. You need to call the correct one based > > on the encoding type of you text. > > freetype.GetStringGray > > I've

Re: [fpc-pascal] freetype unit + unicode

2011-10-04 Thread David Emerson
On Mon 3 Oct 2011, Graeme Geldenhuys wrote: > On 03/10/2011 21:51, David Emerson wrote: > > I am using the freetype unit (with linux) and would like to display some > > interesting unicode characters. However when I pass a string containing say > > U+2265 to GetStringGray, i

[fpc-pascal] freetype unit + unicode

2011-10-03 Thread David Emerson
I am using the freetype unit (with linux) and would like to display some interesting unicode characters. However when I pass a string containing say U+2265 to GetStringGray, it doesn't display the unicode character at all; it shows 3 other characters in its place. What to do? btw I'm still usin

Re: [fpc-pascal] AnsiString

2011-01-25 Thread David Emerson
Luis Fernando Del Aguila Mejía wrote: > The documentation > (http://www.freepascal.org/docs-html/prog/progsu146.html#x189-1990008.2.7) > says: > -8 Longint current string with size. > -4 Longint with reference count. > But, when I want access to that structure, I have to do it backwards.

Re: [fpc-pascal] constant records as default parameters

2010-12-31 Thread David Emerson
> AFAIK default parameters can only be simple types, not complex types > like records. Well... it certainly appears to be so... > Although, I did get the following program using a default > class parameter to compile and run. Kinda defeats the purpose (low overhead). I'll stick with two simpl

Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
Mark Morgan Lloyd wrote: > Can I have a reality check on this please: in this context is the > overloaded := effectively an implicit cast as well as an explicit operator? looks like. Below is some sample code which illustrates the fact. > Is the availability of overloaded + and := operators nece

[fpc-pascal] constant records as default parameters

2010-12-30 Thread David Emerson
I'd like to use a constant record as a default parameter. Is there some way to do this? Here's my use case: type lt_ints = record left, top : longint; end; const lt_zero : lt_ints = (left:0; top:0); procedure do_something (const offset_lt : lt_ints = lt_zero); The procedure declar

Re: [fpc-pascal] commutative operators

2010-12-30 Thread David Emerson
On Wed 29 Dec 2010, Jetcheng Chu wrote: > I think you need to make sure that `a' and `b' are in the same algebraic > system before making the commutativity of the operator meaningful. You know, that makes a lot of sense. I should have thought about it that way before asking. Thanks. ~David. ___

Re: [fpc-pascal] commutative operators

2010-12-29 Thread David Emerson
On Wed 29 Dec 2010, Honza wrote: > 2010/12/29 David Emerson : > > suppose I define an operator: > > > > operator + (a: one_type; b: another_type) : one_type; > > > > Is there any way to specify that it should be "commutative", so I don't

[fpc-pascal] commutative operators

2010-12-29 Thread David Emerson
suppose I define an operator: operator + (a: one_type; b: another_type) : one_type; Is there any way to specify that it should be "commutative", so I don't have to additionally define the reverse: operator + (a: another_type; b: one_type) : one_type; Thanks ~David. ___

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread David Emerson
> @David: Maybe you can restructure your class hierarchy to something like > this (you'll need to be a bit creative here ^^): heh, no, my solution is to abandon generics :-) I used a find/replace script to make alternate classes with real values. Thanks for all your input, though. Thanks to you

Re: [fpc-pascal] generics class hierarchy

2010-12-19 Thread David Emerson
On Sat 18 Dec 2010, Honza wrote: > 2010/12/19 David Emerson : > > type > >  generic gt_box<_t_point,_num> = class (_t_point)   // FAILS :-( > > f_width, f_height : _num; > > end; > > I think it should fail according to the docs, see: > > http://

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread David Emerson
Sven Barth wrote: > I've now looked at your example code in more detail (I was working the > last time I wrote you). Where did you define "_t_point"? I only found a > "t_point" in your second mail. _t_point is part of the template list. I guess it's a limitation. Conceptually it doesn't seem th

Re: [fpc-pascal] generics class hierarchy

2010-12-18 Thread David Emerson
> Would you please state your FPC version the next time? (If you have > stated I, but I haven't seen it: I'm sorry) Some problems might be fixed > in the development version while they aren't in the latest release. I tried with both 2.4.2 and 2.5.1 (fetched via svn and compiled. Took me quite s

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
err... my mistake. the error message was referring to a different problem, which I was blind to in my hurry. Sorry for all the messages. I'll shut up now. :) On Thu 16 Dec 2010, David Emerson wrote: > Well, I'm guessing generics aren't really ready to be fully used... I'

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
Well, I'm guessing generics aren't really ready to be fully used... I'm getting an error "There is no method in an ancestor class to be overridden" where the ancestor class was a specialized generic. Doesn't seem very promising for actual use. So I'm abandoning generics for now. Hopefully they'

Re: [fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
I'll give a little more detail... Right now I have these non-generic types: t_point = class f_left, f_top : longint; // so named for descendents // several fields and methods to manage it as I need end; t_box = class (t_point) f_width, f_height : longint; // more fields and methods to

[fpc-pascal] generics class hierarchy

2010-12-16 Thread David Emerson
Hi all, How can I use inheritance with generics? e.g. type generic gt_point<_num> = class ... end; generic gt_box<_tpoint,_num> = class (_tpoint) ... end; The above gives me an error; I've tried some other variations but haven't yet found anything that works Thanks, David

Re: [fpc-pascal] crash in tobject.free

2010-12-09 Thread David Emerson
Thanks Matthias, FreeAndNil solved my problem! I was assuming that calling Free would also nil out the variable holding the reference to the object, but obviously it does not. Cheers, David On Thu 9 Dec 2010, Matthias Klumpp wrote: > Hi! > On Thu, 9 Dec 2010 11:42:20 -0800, David E

[fpc-pascal] crash in tobject.free

2010-12-09 Thread David Emerson
Hi all, I'm encountering a consistent crash, and I'm not sure how to address the problem. using: - laz 0.9.28.2-8 beta, svn 22277, from debian testing -- a rather outdated one, because at this point upgrading lazarus requires updating debian - fpc 2.4.0-2 [2010/02/20] for i386 - fpgui commit e0

Re: [fpc-pascal] methods of an object to create others objects

2010-12-02 Thread David Emerson
> Wouldn't it be nice if we had a try..except..finally statement > supported in FPC. All-in-one. We do: it is called "try try" try try // ... except // ... finally // ... Okay, so maybe that's slightly nonstandard, but I'd rather use this awkwardness than add an even more awkward extra in

Re: [fpc-pascal] linking name issue

2010-06-05 Thread David Emerson
Try deleting testunit.o and/or testunit.a, testunit.ppu ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Crosscompile FPC from Win32 to Linux

2010-06-04 Thread David Emerson
Andreas Berger wrote: > I have a stable cgi program running in windows (no libraries - simple > writeln). However, our web host is in linux. Is there a simple way for > me to cross-compile the app? I haven't ever cross-compiled anything, but here's a start... Looking here: http://wiki.lazarus.f

Re: [fpc-pascal] PChar & AnsiString

2010-06-01 Thread David Emerson
> > >> This is not correct. Many strings are simply referenced several > > >> times. > > > > > > May I ask in which typical cases? In an earlier version of our database (before we had things properly typed) many things were stored as strings. Thus a common ansistring may have had a reference

Re: [fpc-pascal] {SOLVED} casting back a pointer to original type

2010-05-30 Thread David Emerson
> OK, I lurred myself by taking words too literally. I thought "virtual" meant > unimplemented, to be implemented in sub-classes. unimplemented = abstract virtual method type something = class procedure do_something; virtual; abstract; end; _

Re: [fpc-pascal] casting back a pointer to original type

2010-05-29 Thread David Emerson
On Sat 29 May 2010, spir ☣ wrote: > I cannot do that. C0 (and all classes) instances need a text method. I also > cannot have 2 methods (one static, one virtual) with different names. So make a virtual method called text. Don't use a static method at all. In my example I was trying to demonstrat

Re: [fpc-pascal] casting back a pointer to original type

2010-05-29 Thread David Emerson
> element := C(list[index]); // casting back > text := element.text; > I cannot do that, even if elements all are *indirect* instances of C, because > this calls C.text instead of the element's own proper text method. If you use virtual methods then C.text should call the descendant's me

Re: [fpc-pascal] flexible record design

2010-05-28 Thread David Emerson
Spir wrote: > I need the simplest and most efficient version, because the type I'm now > designing will be the elementary building block of a rather big system. If you design your class hierarchy well, it ought to be possible to switch the base later on. Personally, I reinvented the wheel by cre

Re: [fpc-pascal] question about class

2010-05-14 Thread David Emerson
I'm no expert so these answers may be a bit off, but I figure any help is nice during US business hours... > Are there somewhere more or less pedagogic examples of class code? I've never found any. I've learned largely by studying (and occasionally fixing) fpgui code. > *self* > Do i need to

Re: [fpc-pascal] identifier scope problem

2010-05-03 Thread David Emerson
On Mon 3 May 2010, leledumbo wrote: > In the code above, equals will refer to tobject.equals instead of equals > defined in the unit. How can I refer to that one instead? I'm unable to reproduce your error. Real code that I could actually compile and run would make this a lot easier. That said,

Re: [fpc-pascal] IDE and programming woes

2010-05-01 Thread David Emerson
First, a descriptive subject header is much appreciated. As for your IDE troubles, I don't know how many people actually use that old FreeVision-based IDE... many of us use either Lazarus or some other more modern editor. Is there some reason you can't or don't want to try Lazarus? > Tirdly, o

Re: [fpc-pascal] dynamic array contents and system.move

2010-05-01 Thread David Emerson
Jürgen Hestermann wrote: > Although I would have expected that special procedures exist to insert > and remove array elements so that there is no need to do such things > manually ... These must be written on a case-by-case basis, for each type of array element. Perhaps I'll tackle this someday

Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-28 Thread David Emerson
Vincent Snijders wrote: > Bihar Anwar schreef: > > I've tried to use Move() instead of Copy(). Any objection with the following > > code? > > Yes, at first glance without much thinking, I don't think it is safe. Did you > think through the consequences of copying reference counted types (ansistrin

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-28 Thread David Emerson
Jürgen Hestermann wrote: > Where are "the usage, internals and purpose of dyn. arrays" documented? I dunno. But I find them incredibly useful. they have some quirks, and over the years I've been using dynarrays, I've documented these on my own computer -- I even have a dynamic array test program

Re: [fpc-pascal] State of FPC docs.rant

2010-04-26 Thread David Emerson
On Mon 26 Apr 2010, Graeme Geldenhuys wrote: > Florian Klaempfl het geskryf: > > > > No git mirror ;)? I think the docs are one of the fpc related > > repositories where using a dvcs might be useful. > > Apparently I am banned for life mentioning the "product that may not be > named" in FPC or L

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-25 Thread David Emerson
Florian Klaempfl wrote: > If you mess with move and have no clue about internals, then you get > burned. Period. Proper dyn. array code uses copy(...) instead of move. I wish there was a type-checked equivalent to what move does. copy creates a new array, and I don't want to do that: I already h

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
you are not getting memory leaks by doing a move > > before making sure that the destination buffer has the memory > > allocated. You see, in Delphi and FPC, move d/n actually move the > > memory... It just copies it. > > > > You were warned :-) > > > > On Sat,

Re: [fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
cobines wrote: > David Emerson wrote: > > move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); > > I think it should be: > > SetLength(self.f_data, length(src.f_data)); > move (src.f_data[0], self.f_data[0], length(self.f_data) * sizeof(byte)); We

[fpc-pascal] dynamic array contents and system.move

2010-04-24 Thread David Emerson
I have a class that has a field, f_data : array of byte; // a dynamic array Within a method of this class (which takes as a parameter "src", another instance of the class) I have the following code: move (src.f_data, self.f_data, length(self.f_data) * sizeof(byte)); It appears that this move

Re: [fpc-pascal] constructor as procvar

2010-03-20 Thread David Emerson
> Tobject.classtype returns TClass (class of TObject) which I first > assumed would work great. However I cannot seem to do a type > conversion from TClass to t_mammal_class (class of t_mammal)! So I am > stuck here. well, I got this working, not sure why I had so much trouble with a simple typ

Re: [fpc-pascal] constructor as procvar

2010-03-20 Thread David Emerson
ri 19 Mar 2010, David Emerson wrote: > Florian Klaempfl wrote: > > Constructor procvars are indeed not supported but the way to achieve > > what you want is to use class type variables > > > > t_mammal_class = class of t_mammal; > > > >

Re: [fpc-pascal] constructor as procvar

2010-03-19 Thread David Emerson
Florian Klaempfl wrote: > Constructor procvars are indeed not supported but the way to achieve > what you want is to use class type variables > > t_mammal_class = class of t_mammal; > >   function find_or_create_animal (color : byte; >     pass_mammal_type : t_mammal_class) : t_mammal; > >  

[fpc-pascal] constructor as procvar

2010-03-19 Thread David Emerson
I'd like to pass a constructor as a procvar. Don't know if this is possible. Here is some silly illustrative code that doesn't work: {$mode objfpc} uses classes, sysutils; type t_mammal = class public constructor create (color : byte); virtual; end; t_pig = class (t_mammal)

Re: [fpc-pascal] fpGUI Toolkit v0.7-rc1 for FPC 2.4

2010-03-16 Thread David Emerson
On Tue 16 Mar 2010, Schindler Karl-Michael wrote: > Hi > > has there been already been work on a carbon backend of fpGUI? > > Michael The best place to ask about this is on the fpgui newsgroups, which are hosted by opensoft.homeip.net Discussions took place in the fpgui.support group in 2008 (

Re: [fpc-pascal] error on compilation

2010-03-16 Thread David Emerson
On Tue 16 Mar 2010, leledumbo wrote: > > How do you install fpc? Do you instal the rtl as well? Yes, you definitely need the rtl. Nowadays I install everything, as required by lazarus. In the past I used to install the barebones minimum, which if I recall correctly was the compiler and the rtl

Re: [fpc-pascal] some new features to delphi prisem

2010-02-22 Thread David Emerson
On Sat 20 Feb 2010, Jürgen Hestermann wrote: > > > y := case Other of > > bla : 'hello'; > > foo : 'bye'; > > baz : 'adius'; > >end; > > What do you gain with this? > Doesn't look much different to > > case Other of >bla : y := 'hello'; >foo : y := 'bye

Re: [fpc-pascal] Pointers

2010-02-11 Thread David Emerson
On Thu 11 Feb 2010, Rainer Stratmann wrote: > How can I have access to position 4 of a pointer? > > var > p : pbyte; > c : char; > s : ansistring; > x : longint; > > s := 'Hello'; > p := @s; > x := 4; // 4th position > c := [p+x]^ ??? how to get access to the 'o' c := (p+x)^; // why w

Re: [fpc-pascal] Unsolicited messages

2010-02-04 Thread David Emerson
Jonas Maebe wrote: > Of course, this remedy will only work for a short while, since nothing > prevents the spammers to set up similar new domains... I don't know a > real remedy against this sort of stuff, unless some people start > setting up blacklists for these things too and we get a way to > i

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

2010-01-19 Thread David Emerson
in linux... just google list hardware linux. Below are some results. Probably not all of them will be available, but you should be able to work with whatever is available on your machine. lshal lshw lspci lsusb lsscsi systool fdisk -l dmidecode cat /proc/cpuinfo cat /proc/meminfo dmesg | egrep

Re: [fpc-pascal] FPC class syntax was extended to support delphi code

2010-01-13 Thread David Emerson
Doug Chamberlin wrote: > Class methods allow you to call the method without instantiating the > class first. For example, Result := TMyClass.MyClassFunction; Oh, that is so cool! I suppose that probably means that class methods can only reference class variables/methods/properties. Cheers, Davi

Re: [fpc-pascal] FPC class syntax was extended to support delphi code

2010-01-13 Thread David Emerson
Thank you for this message! This stuff sounds really cool. In particular, I have been itching for class constants. A few questions come to mind: a. 'var' sections -- I assume that 'var' is optional when declaring fields that occur first (i.e. directly after "private", "public", etc) b. What do

Re: [fpc-pascal] [OT] which editor - emacs?

2010-01-12 Thread David Emerson
It took me a couple years to take that plunge (of course a couple years ago Lazarus was not as robust as it is today) but I will never go back! Lazarus does have the distinct disadvantage that it's cumbersome to work on multiple projects at once. Especially, e.g., if I want to test some feature

  1   2   >