Re: [fpc-pascal] Currency and ABS(-674.59)
On Fri, Mar 9, 2012 at 06:36, Jonas Maebe wrote: > On 09 Mar 2012, at 10:23, Sven Barth wrote: > >> The buzzword for this is Fixed Point Arithmetic. See >> here: http://en.wikipedia.org/wiki/Fixed-point_arithmetic > > And in principle, it's exactly what currency should use. And in fact, it is > what it does use in FPC on platforms that don't support an x87 fpu. What about promote the consistency between all platforms and implement currency as a scaled integer? After all, internally, it isn't a floating point format. Joao Morais ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] status of MIPS port
Jorge Aldo G. de F. Junior wrote: Whats the status of the MIPS port ? I am currently working on a project called "OpenTik", wich aims at replacing mikrotik's routeros with a completely opensource alternative. Originally i wanted to use FreeBSD on ARM but theres no freepascal compiler for this. I switched to a Linux based system as the base, and freepascal to write a couple of complex components (like the console wich is way more powerfull than the mikrotik's original one). I am working on the captive portal system now, wich will be nicely integrated into the current (working already) xmlconsole. Later i plan to write a mac server using freepascal and libpcap and finally a winbox replacement called openbox. Current source code is here : http://code.google.com/p/opentik/ it implements a complete programming language on its own, besides a template system and a configuration management tool all integrated into a single system called xmlconsole (because it uses xml files to store config). My question is : Whats the status of Freepascal on the MIPS (both LE and BE) ? I ask this bacause MIPS is the single most used processor in the low end/low cost access point market and it would be quite nicey to have opentik running on those. It's work-in-progress. There's a port of 2.0.0 with limited functionality (i.e. only part of the RTL was compiled), that's currently being merged into trunk but I've not heard anything from the people looking at it over the last few days. There was relevant discussion in this ML at end-Jan/start-Feb, also see http://wiki.lazarus.freepascal.org/Native_MIPS_Systems which I knocked together when I started looking at it. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpWeb: Error when trying to call a module without an action
On Fri, 9 Mar 2012, michael.vancann...@wisa.be wrote: On Fri, 9 Mar 2012, Sven Barth wrote: I'm using the embedded webserver variant and the error only surfaced after I added a second module which let's me assume that the problem is the same as this: http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-June/063655.html And what exactly is the problem ? You can set the default module name in the TFPWebApplication. But in that case, the path is interpreted as the action to execute, so the correct URL would be http://localhost:4321/list to have the module first requires an additional property and patch. This is planned. I implemented the 'PreferModuleName' property in TWebHandler and TFPCustWebApplication in rev. 20495. if set to True, then the URL http://localhost:4321/treenode/ will select the 'treenode' module. Default for the new property is currently 'False', which is backwards compatible. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE : [fpc-pascal] FPC Advanced Records
> > > > where by the time ThisSize is accessed any disparity has been > > corrected? > > > > Not sure if this will be of any use. > > but you can always define an assignment incompatible type > WordLE = record data: Word; end; > > and define all required overloaded operators Or an endian independant implementation: type wordLE=packed record L1,L2:byte; end; operator := (w1:word) w2:wordLE; begin w2.L2:=(w1 shr 8) and $FF; w2.L1:=w1 and $FF; end; operator := (w1:wordLE) w2:word; begin w2:=((w1.L2 shl 8) and $FF00 ) or word(w1.L1); end; Ludo ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] status of MIPS port
Whats the status of the MIPS port ? I am currently working on a project called "OpenTik", wich aims at replacing mikrotik's routeros with a completely opensource alternative. Originally i wanted to use FreeBSD on ARM but theres no freepascal compiler for this. I switched to a Linux based system as the base, and freepascal to write a couple of complex components (like the console wich is way more powerfull than the mikrotik's original one). I am working on the captive portal system now, wich will be nicely integrated into the current (working already) xmlconsole. Later i plan to write a mac server using freepascal and libpcap and finally a winbox replacement called openbox. Current source code is here : http://code.google.com/p/opentik/ it implements a complete programming language on its own, besides a template system and a configuration management tool all integrated into a single system called xmlconsole (because it uses xml files to store config). My question is : Whats the status of Freepascal on the MIPS (both LE and BE) ? I ask this bacause MIPS is the single most used processor in the low end/low cost access point market and it would be quite nicey to have opentik running on those. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: xterm -e program-compiled-with-fpc2.4.0 doesn't work
Jonas Maebe-2 wrote > > The internal representation of real numbers has never been changed in > FPC. . > I may have expressed myself incorrectly, but there was the case when records of real numbers written to disk by a program compiled with fpc 1.0.4 , when read back by the same program compiled with fpc 1.9.4 were displayed completely wrong. I had a conversation about this back in 2006 with Michael van Canneyt when he thought that the 'alignment' in a record might have changed and advised of using only packed records in the future. I was only able to recover this by using the 2 versions of the fpc. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/xterm-e-program-compiled-with-fpc2-4-0-doesn-t-work-tp5519778p5552734.html Sent from the Free Pascal - General mailing list archive at Nabble.com. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Advanced Records
Sven Barth wrote: Am 09.03.2012 23:26, schrieb Mark Morgan Lloyd: Martin wrote: On 09/03/2012 21:26, Mark Morgan Lloyd wrote: but is there any way to define something like an endianness-correcting type, i.e.: Type TAWSHeader=Record ThisSize: WordLE; .. where by the time ThisSize is accessed any disparity has been corrected? Not sure if this will be of any use. but you can always define an assignment incompatible type WordLE = record data: Word; end; and define all required overloaded operators I think that could be of a lot of use, but I'll need to tinker :-) Noted your example, but apart from that is there any concise way to define a type such as WordLE with the explicit restriction that it requires an explicit definition of assignment operators (i.e. is never subject to implicit casts or type conversions)? Can this be done such that WordLE has a predefined size even if the assignment has to go via code? You could play around with a construct like the following: type generic TMyLEType = record Data: T; class operator := (aRight: TMyLEType): TMyLEType; class operator := (aRight: TMyLEType): T; end; TWordLE = specialize TMyLEType; TLongWordLE = specialize TMyLEType; // ... class operator TMyLEType.:= (aRight: TMyLEType): TMyLEType; begin Result.Data := aRight.Data end; class operator TMyLEType.:= (aRight: TMyLEType): T; begin // convert the value to the correct endianess here // you might want to use SizeOf(T) for a determination of the // correct size of T, so you can swap correctly end; Thanks. Thinking about it, Martin's example probably fits my criteria of conciseness etc. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Advanced Records
Am 09.03.2012 23:26, schrieb Mark Morgan Lloyd: Martin wrote: On 09/03/2012 21:26, Mark Morgan Lloyd wrote: but is there any way to define something like an endianness-correcting type, i.e.: Type TAWSHeader=Record ThisSize: WordLE; .. where by the time ThisSize is accessed any disparity has been corrected? Not sure if this will be of any use. but you can always define an assignment incompatible type WordLE = record data: Word; end; and define all required overloaded operators I think that could be of a lot of use, but I'll need to tinker :-) Noted your example, but apart from that is there any concise way to define a type such as WordLE with the explicit restriction that it requires an explicit definition of assignment operators (i.e. is never subject to implicit casts or type conversions)? Can this be done such that WordLE has a predefined size even if the assignment has to go via code? You could play around with a construct like the following: type generic TMyLEType = record Data: T; class operator := (aRight: TMyLEType): TMyLEType; class operator := (aRight: TMyLEType): T; end; TWordLE = specialize TMyLEType; TLongWordLE = specialize TMyLEType; // ... class operator TMyLEType.:= (aRight: TMyLEType): TMyLEType; begin Result.Data := aRight.Data end; class operator TMyLEType.:= (aRight: TMyLEType): T; begin // convert the value to the correct endianess here // you might want to use SizeOf(T) for a determination of the // correct size of T, so you can swap correctly end; Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal