Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
On 04.04.2017 16:54, Ryan Joseph wrote: > >> On Apr 4, 2017, at 9:46 PM, Sven Barth via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> SetLength() allocates a single block of memory, cause array access is >> ordinary pointer arithmetic

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
On 04.04.2017 15:40, Ryan Joseph wrote: > >> On Apr 4, 2017, at 7:17 PM, Sven Barth via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> If you want continuous memory areas you need to use static arrays or develop >> your own dynamic da

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
On 04.04.2017 15:40, Ryan Joseph wrote: > >> On Apr 4, 2017, at 7:17 PM, Sven Barth via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> If you want continuous memory areas you need to use static arrays or develop >> your own dynamic da

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2017 13:55 schrieb "Ryan Joseph" : > > > > On Apr 4, 2017, at 4:58 PM, Howard Page-Clark via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > You can always use FillChar and its kin on specific 'nested' arrays like this > > > > type > > TIntArray =

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2017 12:52 schrieb "Mark Morgan Lloyd" < markmll.fpc-pas...@telemetry.co.uk>: > > On 02/04/17 10:00, Jonas Maebe wrote: > >> Allocating new memory via setlength also clears the memory (+ the >> overhead of allocating the memory). > > > Jonas, is it still the case that if SetLength()

Re: [fpc-pascal] Setting record values

2017-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2017 05:25 schrieb "Ryan Joseph" : > > Thanks for the tips, I appreciate it. > > This is all pretty trivial but it’s kind of annoying that using an inline class function is more efficient than a constructor despite having identical functionality. It's tempting

Re: [fpc-pascal] Array clearing

2017-04-04 Thread Sven Barth via fpc-pascal
Am 04.04.2017 06:55 schrieb "Ryan Joseph" <r...@thealchemistguild.com>: > > > > On Apr 2, 2017, at 11:02 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > can be easily seen by looking at the implementation of

Re: [fpc-pascal] Array clearing

2017-04-02 Thread Sven Barth via fpc-pascal
On 02.04.2017 11:22, Ryan Joseph wrote: > >> On Apr 1, 2017, at 9:25 PM, Jürgen Hestermann >> wrote: >> >> If you just need to reuse the same array and only need to zero its elements >> then of course fillchar would be the fastest approach (it saves the memory >>

Re: [fpc-pascal] Setting record values

2017-04-02 Thread Sven Barth via fpc-pascal
On 01.04.2017 09:59, Ryan Joseph wrote: > >> On Apr 1, 2017, at 2:46 PM, Sven Barth via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> I haven't looked at it in detail, but it could be that both have similar >> efficiency. You could also

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 13:31 schrieb "Jürgen Hestermann" : > > I am wondering what the purpose of filling all > array elements with zero's could be. > If I want to discard all elements I would simply delete > the whole array (setlength(MyArray,0) ). > > But when should it be

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 10:35 schrieb "Ryan Joseph" : > > > > On Apr 1, 2017, at 2:50 PM, Ryan Joseph wrote: > > > > Yeah, I was concerned with just compiler types or weakly retained classes where I’m just keeping the reference. > > Another question.

Re: [fpc-pascal] Setting record values

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 05:59 schrieb "Ryan Joseph" : > > I’ve been using a design pattern in my code which I think is probably pretty stupid so I’d like to make sure. Assume I have a type like TPoint below and I want to set the value I’ll doing something like point :=

Re: [fpc-pascal] Array clearing

2017-04-01 Thread Sven Barth via fpc-pascal
Am 01.04.2017 05:42 schrieb "Ryan Joseph" : > > As far as the compiler is concerned what’s the difference between clearing an array using a for-loop vs. FillChar? It seems like iterating the array would be slower but what does FillChar do exactly and is it faster? The

Re: [fpc-pascal] Questions About Constructors

2017-03-31 Thread Sven Barth via fpc-pascal
Am 31.03.2017 19:27 schrieb "African Wild Dog" : > > 2017-03-30 4:25 GMT-03:00 Michael Van Canneyt : >> >> >> >> On Thu, 30 Mar 2017, African Wild Dog wrote: >> >>> Hello, >>> >>> 1 - What happens if my constructor raise an exception? Is my

Re: [fpc-pascal] Delphi RTTI vs Free Pascal RTTI

2017-03-25 Thread Sven Barth via fpc-pascal
Am 24.03.2017 19:55 schrieb "Michael Van Canneyt" : > > > > On Fri, 24 Mar 2017, African Wild Dog wrote: > >> Hello, >> >> I need to write a code compatilble with both free pascal and delphi using >> the old style RTTI. >> What are the diferences between delphi's and free

Re: [fpc-pascal] TypeInfo question

2017-03-24 Thread Sven Barth via fpc-pascal
Am 24.03.2017 03:51 schrieb "Ryan Joseph" : > Is there anyway I could push the type checking to runtime? I wanted to using writeln also to perform some printing for debugging but I get stuck at compile time again trying to mix, integers, strings, records, classes etc…

Re: [fpc-pascal] Delphi for Linux is out

2017-03-23 Thread Sven Barth via fpc-pascal
On 23.03.2017 18:35, Florian Klämpfl wrote: > Am 23.03.2017 um 16:47 schrieb Mattias Gaertner: >> On Thu, 23 Mar 2017 16:08:20 +0100 (CET) >> Michael Van Canneyt wrote: >> >>> [...] When did FPC start to run on Linux? 1999? >>> >>> I got the first "hello world"

Re: [fpc-pascal] Delphi for Linux is out

2017-03-23 Thread Sven Barth via fpc-pascal
Am 23.03.2017 13:05 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Hi, > > Just thought I would mention, yesterday Delphi 10.2 was released which > includes Linux support (I assume a cross-compiler). It is only available > in the Enterprise edition product line though, and only

Re: [fpc-pascal] TypeInfo question

2017-03-23 Thread Sven Barth via fpc-pascal
Am 23.03.2017 16:29 schrieb "Ryan Joseph" : > > I have some generics which operate on multiple types and instead of making subclasses for certain types and overriding methods I wonder if using the RTTI like: > > PTypeInfo(TypeInfo(T))^.kind = tkClass > > would be a good

Re: [fpc-pascal] Interface Inheritance Bug

2017-03-19 Thread Sven Barth via fpc-pascal
Am 19.03.2017 17:55 schrieb "African Wild Dog" <paintedlyc...@gmail.com>: > > 2017-03-19 5:25 GMT-03:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: >> >> I think this will happen with non-generic interfaces as well. So please test wi

Re: [fpc-pascal] Forward Generic Type Declaration Bug

2017-03-19 Thread Sven Barth via fpc-pascal
Am 19.03.2017 11:30 schrieb "Bart" <bartjun...@gmail.com>: > > On 3/19/17, Sven Barth via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote: > > >> But it should not give an internal error. > > > > With that I agree. Would you please check wi

Re: [fpc-pascal] rtl-generics vs fgl

2017-03-19 Thread Sven Barth via fpc-pascal
Am 19.03.2017 10:10 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Hi, > > Sorry if this is a silly question, I didn't really follow Generics > discussions in the past. If the "rtl-generics" package a replacement for > the fgl unit? The fgl unit is more lightweight while

Re: [fpc-pascal] Interface Inheritance Bug

2017-03-19 Thread Sven Barth via fpc-pascal
Am 19.03.2017 05:07 schrieb "African Wild Dog" : > > Hello, > > Test env: debian jessie amd64 - fpc 3.0.2 > > It seems free pascal have a bug when handling interface inheritance using generics. > > When i try to compile the unit bellow, i get this error: > >

Re: [fpc-pascal] Forward Generic Type Declaration Bug

2017-03-19 Thread Sven Barth via fpc-pascal
Am 19.03.2017 00:02 schrieb "Bart" <bartjun...@gmail.com>: > > On 3/18/17, Sven Barth via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote: > > > Forward declarations for generic types are not supported. > > But it should not give an internal error.

Re: [fpc-pascal] Forward Generic Type Declaration Bug

2017-03-19 Thread Sven Barth via fpc-pascal
Am 18.03.2017 23:27 schrieb "African Wild Dog" <paintedlyc...@gmail.com>: > > 2017-03-18 18:40 GMT-03:00 Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org>: >> >> Forward declarations for generic types are not supported. > > Are

Re: [fpc-pascal] Generics Bug

2017-03-18 Thread Sven Barth via fpc-pascal
Am 18.03.2017 22:41 schrieb "Sven Barth" <pascaldra...@googlemail.com>: > > Am 18.03.2017 19:55 schrieb "African Wild Dog" <paintedlyc...@gmail.com>: > > > > Hello, > > > > > > Please confirm this bug. > &g

Re: [fpc-pascal] Generics Bug

2017-03-18 Thread Sven Barth via fpc-pascal
Am 18.03.2017 19:55 schrieb "African Wild Dog" : > > Hello, > > > Please confirm this bug. > > The unit code bellow won't compile (fpc 3.0.2 - debian jessie amd64): > > "generics_bug.pas(17,48) Fatal: Syntax error, "," expected but "<" found" > > === CODE === > > unit

Re: [fpc-pascal] Forward Generic Type Declaration Bug

2017-03-18 Thread Sven Barth via fpc-pascal
Am 18.03.2017 19:20 schrieb "African Wild Dog" : > > Hello, > > Please confirm if this is a bug. > > When I try to compile the unit below I get the error: > > "generics_bug.pas(14,43) Fatal: Internal error 2012101001" > > It seems the compiler has bug when handling forward

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 22:39, fredvs wrote: > OK, Sven you win (and http://stackoverflow.com should follow fpc forum). > But you will not convince me that c does better than fpc, maybe equal but > surely not better. Despite me definitely favoring Object Pascal as well, I can't you have spreading

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 16:30, fredvs wrote: >>> Many thanks Sven for your help. >>> Do you agree if I add your name into the list of the "great contributors" >>> of >>> uos (https://github.com/fredvs/uos) ? >> I don't think that's necessary. I'm merely doing my "job"... > > OK, I understand. (But I ask it

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 07.03.2017 13:49 schrieb "fredvs" : > > > To access a file stored as a resource you need to use TResourceStream. > > Ho my Dog, I did not know this one. > More than perfect, many thanks Sven. > > PS: About array of float into TFileStream, after Googling a while, it s not >

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 06.03.2017 23:57 schrieb "fredvs" : > > Re-hello. > > Ok, I do not find yet the guilty in my code, I will re-try a other day. > By the way, your code is working perfectly Sven. > > Now, last part of the question: how to convert that file stored into > ressource but without to

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
Am 06.03.2017 22:45 schrieb "fredvs" : > > > I don't know what you're doing wrong, but the following works: > > Huh, it is exactly what I (think to) do. > And re-reading hundred times my code does not see any difference. > > OK, I will re-read thousand times the code, maybe I

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
On 06.03.2017 19:31, fredvs wrote: >> Or, quite comically maybe: use a text file > > Or maybe, like in my second post, convert float32 ---> integer32 > > for x := 0 to length(floatbuffer) -1 do > begin >floatbuffer[x] := round(floatbuffer[x] * 2147483647); >if floatbuffer[x] >

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-06 Thread Sven Barth via fpc-pascal
Am 06.03.2017 13:42 schrieb "fredvs" : > > > I don't know. By all logic, it should not work either. > > Yes, it is I think too. > > Some more explanation: > > I use a "global" buffer of float to store data. > Those data can be int16, int32 or float32. > > For example, > > If

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-05 Thread Sven Barth via fpc-pascal
Am 05.03.2017 18:33 schrieb "fredvs" : > > Hello. > > I have saved the buffer into file with a TFileStream. > > With lot of success for array of cint16 and cint32. > > But for array of cfloat --> much less success. Define "much less success". How are you writing the array and

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-04 Thread Sven Barth via fpc-pascal
Am 04.03.2017 16:06 schrieb "fredvs" : > > Hello. > > Is it possible to add a array of float into ressource ? > > For example, there is myarray : array of cfloat. > > Is it possible to store that array myarray ressource and, when I want to use > it from ressource, I get also a

Re: [fpc-pascal] Array of const and generics

2017-03-02 Thread Sven Barth
Am 02.03.2017 14:17 schrieb "Ryan Joseph" <r...@thealchemistguild.com>: > > > > On Mar 2, 2017, at 5:45 PM, Sven Barth <pascaldra...@googlemail.com> wrote: > > > > "array of const" itself should work without problems though mixing the typ

Re: [fpc-pascal] Array of const and generics

2017-03-02 Thread Sven Barth
Am 02.03.2017 10:42 schrieb "Ryan Joseph" : > > Is it possible to use array of const inside of generics? > > > Quick example I just typed up. If you specialize the generic the compiler always complains about the type in array of const not being the specialized type.

Re: [fpc-pascal] Run Time Type Info - are the type names of all classes defined in a unit stored in the RTTI?

2017-03-01 Thread Sven Barth
Am 02.03.2017 06:30 schrieb "Dennis Poon" <den...@avidsoft.com.hk>: > > > > Sven Barth wrote: > >> >> Am 01.03.2017 11:53 schrieb "Dennis" <de...@avidsoft.com.hk >: >> > >> > Programmatically, I want to make a

Re: [fpc-pascal] Run Time Type Info - are the type names of all classes defined in a unit stored in the RTTI?

2017-03-01 Thread Sven Barth
Am 01.03.2017 11:53 schrieb "Dennis" : > > Programmatically, I want to make a list of all Classes defined in the unit. > Is this info stored in the RTTI or anywhere else? This info is not yet available, but will be in the future. Regards, Sven

Re: [fpc-pascal] class operator in record

2017-03-01 Thread Sven Barth
Am 01.03.2017 10:06 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2017-03-01 02:39, nore...@z505.com wrote: > > How come: > > > >class operator Initialize(var aFoo: TFoo); > >class operator Finalize(var aFoo: TFoo); > > > > in a record are called class operator.. > >

Re: [fpc-pascal] class operator in record

2017-03-01 Thread Sven Barth
Am 01.03.2017 03:39 schrieb : > > How come: > > class operator Initialize(var aFoo: TFoo); > class operator Finalize(var aFoo: TFoo); > > in a record are called class operator.. > > why not "record operator"? > > Are these advanced neo-records considered classes? It's simply

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Sven Barth
Am 22.02.2017 13:12 schrieb "Jürgen Hestermann" : > Also, I am not sure whether "Close" is equivalent to "CloseFile" and "Assign" is equivalent to "AssignFile". > I remenber that I had some issues using the old (TP7) notations but I am don't remember the details. They

Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?

2017-02-12 Thread Sven Barth
On 12.02.2017 19:25, fredvs wrote: > For example, fpc can load dynamically libraries but it is not usable if that > libraries depend on other libraries. > > It would be great (IMO) if fpc provide, unlike other compilers, some more > modern ways to use things (units, libraries, etc...) with the

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Sven Barth
Am 07.02.2017 19:59 schrieb "Maciej Izak" : > > > 2017-02-07 19:49 GMT+01:00 Mattias Gaertner : >> >> In FPC static class methods can be virtual as well. > > > So we have bug... Indeed... Regards, Sven ___

Re: [fpc-pascal] class property accessor static

2017-02-07 Thread Sven Barth
Am 07.02.2017 14:31 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > I never understood Object Pascal's class methods/properties either? > Unlike Java, not everything needs to be in a class. We are allowed to > have procedures or functions, and global ones at that. So in Object >

Re: [fpc-pascal] Parameterless constructors are not allowed in records or record/type helpers

2017-02-05 Thread Sven Barth
Am 06.02.2017 02:37 schrieb "Ryan Joseph" : > > I tried class functions in records already but I got the error "Class methods must be static in records”. Not sure what that means but I assumed they don’t work either. You need to add the "static" modifier to the method.

Re: [fpc-pascal] Parameterless constructors are not allowed in records or record/type helpers

2017-02-05 Thread Sven Barth
Am 05.02.2017 15:04 schrieb "Ryan Joseph" : > > I never knew Pascal had default parameters, a feature I always use and enjoy in PHP. Once again I learn something new about the language I use. :) I suggest you to read through the language reference guide then ;) >

Re: [fpc-pascal] IsValidIdent() and identifiers escaped with

2017-02-05 Thread Sven Barth
Am 05.02.2017 15:53 schrieb "Jürgen Hestermann" : > > > > Am 2017-02-05 um 15:24 schrieb Howard Page-Clark: >> >> var >> : boolean; > > > Is that a valid identifier? > Here > http://wiki.lazarus.freepascal.org/Identifiers > it says: > > Rules for identifiers: > > Must

Re: [fpc-pascal] Parameterless constructors are not allowed in records or record/type helpers

2017-02-05 Thread Sven Barth
Am 05.02.2017 09:39 schrieb "Ryan Joseph" <r...@thealchemistguild.com>: > > > > On Feb 5, 2017, at 3:27 PM, Sven Barth <pascaldra...@googlemail.com> wrote: > > > > constructor with a default parameter. > > How? never heard of this. Thanks. See

Re: [fpc-pascal] Parameterless constructors are not allowed in records or record/type helpers

2017-02-05 Thread Sven Barth
Am 05.02.2017 09:13 schrieb "Ryan Joseph" : > > Why is this restriction in place and what are the alternatives if any? Some times I want to just provide a method that sets default values for a record without any parameters but FPC doesn’t let me for some reason. Delphi

Re: [fpc-pascal] Operator overloading with Text labels or words

2017-01-30 Thread Sven Barth
Am 30.01.2017 09:12 schrieb "Michael Van Canneyt" : > > > > Hi, > > You can use words. But only words that the compiler defines. See the documentation. That's not what he meant. Even if one overloads operator "Less" then one still has to use it as "<". Regards, Sven

Re: [fpc-pascal] TProcess vs RunProcess()

2017-01-30 Thread Sven Barth
Am 30.01.2017 11:07 schrieb "Lars" : > > On Mon, January 30, 2017 1:06 am, Marco van de Voort wrote: > >> Reason I want to avoid TProcess is simply because cgi programs being > >> around 30-100K are easier to upload for people with limited internet > >> connection speeds. As soon

Re: [fpc-pascal] Operator overloading with Text labels or words

2017-01-30 Thread Sven Barth
Am 30.01.2017 08:47 schrieb "Lars" : > > It's not possible to define an operator like: > > Operator AbcXyz(r : real; z1 : complex) z : complex; > begin > end; > > Is it? > > Has to be a symbol? Only existing operators can be overloaded. For everything else, use a function.

Re: [fpc-pascal] Pipe vs Memory buffer.

2017-01-29 Thread Sven Barth
Am 29.01.2017 23:33 schrieb "Lars" : > > On Sun, January 29, 2017 6:04 am, José Mejuto wrote: > > El 28/01/2017 a las 13:32, fredvs escribió: > > > > > >> TOpusFileCallbacks = record > >> read: op_read_func; > >> seek: op_seek_func; > >> tell: op_tell_func; > >> close:

Re: [fpc-pascal] Feature announcement: Interface RTTI

2017-01-28 Thread Sven Barth
On 28.01.2017 15:25, Michael Van Canneyt wrote: > > > On Sat, 28 Jan 2017, Sven Barth wrote: > >> Hello together! >> >> I'm pleased to finally announce the addition of Interface RTTI to Free >> Pascal. >> >> Interface RTTI essentially provides a

[fpc-pascal] Feature announcement: Interface RTTI

2017-01-28 Thread Sven Barth
Hello together! I'm pleased to finally announce the addition of Interface RTTI to Free Pascal. Interface RTTI essentially provides a list of all methods available in an interface if it's declared is parsed with $M+ or has such an interface as parent. For now however this only applies to COM

Re: [fpc-pascal] Deleting 'Nonexistent' files under windows

2017-01-22 Thread Sven Barth
Am 23.01.2017 05:54 schrieb "Rolf Grunsky" : > > Is it possible to access files that have path lengths too long to access from explorer through Windows API from Pascal? > > I keep ending up with these very long file names which then I can not access. It seems that Windows

Re: [fpc-pascal] Array as result in function.

2017-01-21 Thread Sven Barth
On 20.01.2017 23:36, fredvs wrote: > Re-hello. > > Ok, thanks Silvio, I will take this one from your advice, it works like > charm: > > type > TOggOpusFile = THandle; > TDArFloat = array of cfloat; > PDArFloat = ^TDArFloat; > > op_read: function(OpusFile: TOggOpusFile; pcm : PDArFloat;

Re: [fpc-pascal] Array as result in function.

2017-01-20 Thread Sven Barth
Am 20.01.2017 13:18 schrieb "fredvs" : > > Thanks very much for answers. > > @ silvioprog: > > > using that function as callback with some (C/C++) library? > > Yes and check its parameter calling convention is ok. You shouldn't use Pascal arrays when interfacing with C/C++

Re: [fpc-pascal] FPC run (run program after compile)

2017-01-16 Thread Sven Barth
Am 16.01.2017 08:07 schrieb "Lars" : > > Is there a way to compile a program with fpc at the command line and run > it right after? > > Something like > fpc run project1.pas -Fu../ No, FPC is a compiler, not a "runner" or debugger. That would even be one of the few points

Re: [fpc-pascal] Size of program vs library ?

2017-01-14 Thread Sven Barth
On 14.01.2017 17:18, fredvs wrote: >>> Sorry to insist on that, but the size of fp library is very too big vs > other libraries (C for example). > >> The size of FPC libraries will always(*) be bigger then e.g. C ones, >> because in FPC the RTL is statically linked into the program/library, >>

Re: [fpc-pascal] ppcjvm issues

2017-01-11 Thread Sven Barth
Am 11.01.2017 08:54 schrieb "Michael Schnell" : > > On 10.01.2017 05:13, Jon Foster wrote: >> >> On 01/07/2017 10:39 AM, leledumbo wrote: >> >> So that leaves me with the question: What about destructors? Must I call free/destroy on all objects I create, or do they

Re: [fpc-pascal] ppcjvm issues

2017-01-10 Thread Sven Barth
Am 10.01.2017 06:06 schrieb "Jon Foster" : > What I don't quite get from your example is using "self" as the second argument to setPositiveButton() & setNegativeButton. That parameter is asking for an OnClickListener() class. When I tried that I received a compile

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 18:36, Bernd Oppolzer wrote: > Am 08.01.2017 um 18:22 schrieb Sven Barth: >> >> Am 08.01.2017 17:32 schrieb "Bernd Oppolzer" >> <bernd.oppol...@t-online.de <mailto:bernd.oppol...@t-online.de>>: >> > >> > Am 08.01.2017 um 11

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
Am 08.01.2017 17:32 schrieb "Bernd Oppolzer" <bernd.oppol...@t-online.de>: > > Am 08.01.2017 um 11:46 schrieb Sven Barth: >> >> On 08.01.2017 10:55, Ryan Joseph wrote: >>> >>> I’m going to attempt to translate a perlin noise function (from

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 14:05, Ryan Joseph wrote: > >> On Jan 8, 2017, at 7:54 PM, Sven Barth <pascaldra...@googlemail.com> wrote: >> >> Ehm, right. Add the Math unit, it contains an operator overload for >> floating points. Alternatively you can use (also from the

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 13:01, Ryan Joseph wrote: > >> On Jan 8, 2017, at 6:55 PM, Ryan Joseph wrote: >> >> why am I getting this error? Operator is not overloaded: "Double" mod >> “LongInt”. Mod can’t be used with double and integers like in C? > > > Sorry for the repeat.

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 12:55, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:46 PM, Sven Barth <pascaldra...@googlemail.com> wrote: >> >>> 2) % is the mod operator in pascal right? So what is the modular assignment >>> %=? num = num mod repeat? >>> >>&g

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
On 08.01.2017 11:36, Ryan Joseph wrote: > >> On Jan 8, 2017, at 5:22 PM, Sven Barth <pascaldra...@googlemail.com> wrote: >> >> 1. Why are you trying to assign something to io when you already did >> that with "obj := …"? > > I used absolute here

Re: [fpc-pascal] ppcjvm issues

2017-01-08 Thread Sven Barth
On 07.01.2017 03:12, Jon Foster wrote: > I've been working on building an app for Android using the FPC's JVM > target. I'm using fpc 3.0.0. I've run into a couple of things that I'm > not sure if they're bugs or I just don't know what I'm doing. I was > using fpc to avoid having to learn Java and

Re: [fpc-pascal] C# translatation

2017-01-08 Thread Sven Barth
On 08.01.2017 10:55, Ryan Joseph wrote: > I’m going to attempt to translate a perlin noise function (from > https://gist.github.com/Flafla2/f0260a861be0ebdeef76) but there are a few > things that stopped me from starting. > > 1) What is & doing in this assignment? I see this many places in

Re: [fpc-pascal] FPC 3.0.0 seed compiler for Rasperry Pi ARM?

2017-01-08 Thread Sven Barth
On 08.01.2017 11:20, Bo Berglund wrote: > On Sat, 7 Jan 2017 12:24:39 +0100 (CET), "Karoly Balogh (Charlie/SGR)" > wrote: > Then I went looking for the new ppcarm compiler and found it in these > locations: > > /home/pi/dev/fpc/3.0.2RC1/compiler/ppcarm (in the source

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
On 08.01.2017 10:35, Ryan Joseph wrote: > >> On Jan 8, 2017, at 2:37 AM, Andrew Hall wrote: >> >> If you cast your “something” to a typed pointer, the compiler will do the >> work for you in the usual way: >> >> PDouble(something)^ := myDouble; >> PAnsiString(something)^ :=

Re: [fpc-pascal] Untyped var params

2017-01-08 Thread Sven Barth
Am 08.01.2017 04:43 schrieb "Dmitry Boyarintsev" : > > On Sat, Jan 7, 2017 at 6:02 PM, Lars wrote: >> >> Some brave soldiers once tried to reinvent generics using these tricks.. > > > Well, Pascal run-time has been using "hidden" generics forever. > >

Re: [fpc-pascal] FPC 3.0.0 seed compiler for Rasperry Pi ARM?

2017-01-07 Thread Sven Barth
Am 07.01.2017 11:33 schrieb "Bo Berglund" : > make all install FPC="/home/pi/bin/fpc/3.0.0" > INSTALL_PREFIX="/home/pi/bin/fpc/3.0.2RC1" OPT="-dFPC_ARMHF" > > Will this put the binaries into the /home/pi/bin/fpc/3.0.2RC1 ? > > I really do not want the make install command

Re: [fpc-pascal] FPC clean room project

2017-01-06 Thread Sven Barth
On 06.01.2017 16:44, Lars wrote: > On Tue, January 3, 2017 6:10 pm, Snorkl e wrote: >> They might with a change of ownership, who knows these days, but the >> fact they did use it in the past would not look good for any litigation >> from some bottom feeder. > > The fact that they use FPC, means

Re: [fpc-pascal] FPC clean room project

2017-01-03 Thread Sven Barth
Am 03.01.2017 19:02 schrieb "Dmitriy Pomerantsev" : > > Doesn't matter since FPC license allowing that. You don't get the point, do you? I don't think they'd use FPC themselves if they'd sue it the next time around. Regards, Sven ___

Re: [fpc-pascal] FPC clean room project

2017-01-02 Thread Sven Barth
Am 02.01.2017 19:15 schrieb "Santiago A." : > Nevertheless, as someone has pointed, Embarcadero hasn't make any legal movement. Maybe because it thinks there is no legal base; or maybe because it doesn't care that much and thinks it's not worth the bad publicity. Not to

Re: [fpc-pascal] Question on type helpers

2017-01-02 Thread Sven Barth
Am 02.01.2017 15:26 schrieb "Bart" : > >> PS How can I get the "make install" to generate a fpc.cfg file? > > > > I think we have a generator for it in utils or so. I've never used it > > however... > > I just copied the 3.0 config and did a search and replace on the paths.

Re: [fpc-pascal] Question on type helpers

2017-01-02 Thread Sven Barth
Am 01.01.2017 17:52 schrieb "Bart" <bartjun...@gmail.com>: > > On 1/1/17, Sven Barth <pascaldra...@googlemail.com> wrote: > > > Could indeed be the case due to codepaged strings being different types. > > I think there already is a bug report along th

Re: [fpc-pascal] Question on type helpers

2016-12-31 Thread Sven Barth
Am 31.12.2016 22:47 schrieb "Bart" : > > On 12/31/16, Bart wrote: > > > NB. These are my compiler options: > > -MObjFPC -Scghi -Cirot -g -gl -gh -l -vewnhibq -Filib\i386-win32 -Fu. > > -FUlib\i386-win32 -FcUTF8 > > When I remove the -FcUTF8,

Re: [fpc-pascal] Question on type helpers

2016-12-31 Thread Sven Barth
Am 31.12.2016 16:28 schrieb "Bart" : > > Hi, > > Why is it that type helpers must be declared in the Interface section > of a unit and cannot be private in Implementation section? > > Consider this (useless) example: > > unit thtest; > > {$mode objfpc}{$H+} > {$modeswitch

Re: [fpc-pascal] Linux installation, where to put fpc?

2016-12-31 Thread Sven Barth
Am 31.12.2016 14:37 schrieb "Bo Berglund" : > > On Sat, 31 Dec 2016 14:20:27 +0100, Bart > wrote: > > >Note: I never build fpc or change it's source files, so I'm with them > >being in a location that I have no write access to. > > Yes, in that case

Re: [fpc-pascal] How to split file of whitespace separated numbers?

2016-12-24 Thread Sven Barth
Am 24.12.2016 12:53 schrieb "Mark Morgan Lloyd" < markmll.fpc-pas...@telemetry.co.uk>: > > On 24/12/16 11:30, Lars wrote: >> >> On Fri, December 23, 2016 12:54 pm, Graeme Geldenhuys wrote: >>> >>> On 2016-12-23 18:27, Marco van de Voort wrote: >>> Writing or even worse, reading/debugging

Re: [fpc-pascal] How to split file of whitespace separated numbers?

2016-12-23 Thread Sven Barth
Am 23.12.2016 12:54 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2016-12-23 08:14, Bo Berglund wrote: > > Is there a quick way to split a string of whitespace separated values > > into the separate members? > > > That problem is perfectly suited for regular expressions. And

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-14 Thread Sven Barth
Am 14.12.2016 14:31 schrieb "Lars" : > I think I once thought, can I make an "array of array of const" to try to > expand on the power of array of const. Which seems like a silly idea, but > academically interesting. Also, Varients are related to general > programming (generic).

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-14 Thread Sven Barth
Am 14.12.2016 12:59 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2016-12-14 10:14, Sven Barth wrote: > >> > enough in HTML enough. But that's not really a real point, that's just a > >> > pet peeve to deal with... > >

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-14 Thread Sven Barth
Am 14.12.2016 08:35 schrieb "Lars" : > But I don't know enough about fps generics to know if stuff needs to be > forced into a class, as I have to start using generics and testing it out > to really know. From what I've seen though, I'm certainly not and have > never been a fan

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-14 Thread Sven Barth
Am 14.12.2016 08:09 schrieb "Lars" : > A general purpose function that handles multiple types of arrays without > rewriting the code for each array type looks like this: > > procedure AddItemToArray( > const item: {$I T.inc}; var arr: {$I TArr.inc}); overload; > var

Re: [fpc-pascal] FPImage and mult-page TIFF support

2016-12-09 Thread Sven Barth
Am 09.12.2016 10:05 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > The most widely used image editing software for X11 based > systems, The GIMP, doesn't even support 16bit color channel images. If I remember correctly the next major version of The GIMP is supposed to support

Re: [fpc-pascal] how to use Default to replace this ' FillChar(aRecord, sizeof(aRecord), 0);

2016-12-07 Thread Sven Barth
Am 08.12.2016 05:14 schrieb "Lars" : > > On Mon, December 5, 2016 4:46 am, Dennis Poon wrote: > > > > > > > Lars wrote: > > > >> Do you know about this feature: > >> > >> > >> var SomeRec: TSomeRecord = (); > >> > > This is good for global variable. > > But I wonder whether it

Re: [fpc-pascal] Is there a way to create a generic pointer to a generic record

2016-12-06 Thread Sven Barth
On 21.11.2016 02:05, Le Duc Hieu wrote: > Is there any entry on Mantis for me to keep track of this bug status? I've fixed that bug now (it did already work in mode Delphi by the way), so now you can use this: === code begin === type generic TGList = record public type PGList =

Re: [fpc-pascal] For..in enumerator for generic records?

2016-12-06 Thread Sven Barth
On 02.12.2016 08:22, Ryan Joseph wrote: > Yes but the problem is doing this with generics. :) That’s where I got stuck > and I don’t think it’s possible. Ah, yes, right, sorry. Attached is a corrected version :) Regards, Sven program trecenum; {$mode objfpc} {$modeswitch advancedrecords}

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-05 Thread Sven Barth
Am 05.12.2016 12:01 schrieb "denisgolovan" <denisgolo...@yandex.ru>: > > > 05.12.2016, 13:35, "Sven Barth" <pascaldra...@googlemail.com>: >> >> I really don't get why some people think of generics as complex -.- > > > Exactly for the c

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-05 Thread Sven Barth
Am 05.12.2016 11:01 schrieb "Lars" : > With data structures like this it does seem people are reinventing it, > especially when people use a TStringList to store integers (I have done > this before, a shame indeed, bad programming practice)... Or complex > generics which just

Re: [fpc-pascal] how to use Default to replace this " FillChar(aRecord, sizeof(aRecord), 0);

2016-12-05 Thread Sven Barth
Am 05.12.2016 08:24 schrieb "Dennis" : > > In this old statement, I don't need to know the type of aRecord > but if I want to use Default, I have to know the exact type of the varaible aRecord and pass it to Default(aRecordType) e.g. aRecord := Default(aRecordType) //where

Re: [fpc-pascal] List of integers? Any class available in RTL or FCL to help?

2016-12-04 Thread Sven Barth
Am 04.12.2016 11:25 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Then you should have a look at TFPGList, even if you do not like > > generics. TFPGList is our approach to extend FPC carefully with generics. > > At the moment I'm using FPC 2.6.4 for the work I'm doing. I can't

Re: [fpc-pascal] For..in enumerator for generic records?

2016-12-01 Thread Sven Barth
On 30.11.2016 12:36, Ryan Joseph wrote: > > >> On Nov 30, 2016, at 6:24 PM, Graeme Geldenhuys >> wrote: >> >> What would you iterate/enumerate in that? I can understand iterating an >> "array of TMyRec", but not TMyRec itself. > > I have a dynamic array inside

<    7   8   9   10   11   12   13   14   15   16   >