[fpc-pascal] Extended property can't have default value?

2008-10-06 Thread Graeme Geldenhuys
Why is the following not allowed in a class declaration?

property Increment: extended read FIncrement write SetIncrement default 1.0;


yet this is...

property Increment: integer read FIncrement write SetIncrement default 1;


What would be the major obstacle between Extended and Integer types?
How can I overcome this issue?


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Antal
>
>  It is a plain text file, each row is separated with CRLF (#13#10), each
>> cell separated with tab (#9)
>>
>
> errm, surely that should be a comma, not a tab!


The Tab as separator is just a good way to avoid using the double quote :P
It just comes from the good old Lotus123.
Anyway, just try to copy/paste to a notepad from an Excel and you will see
how it works.
And then, saved as .CSV reopen it with Office and it might work. Or it might
not :P
I am currently using this, since it is easier to manage as the double
quotes.
___
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 Jonas Maebe


On 06 Oct 2008, at 12:48, Graeme Geldenhuys wrote:


Why is the following not allowed in a class declaration?

   property Increment: extended read FIncrement write SetIncrement  
default 1.0;


Because default values are stored in a 32 bit location inside the  
compiler. I have no idea what the reason for this is, how Delphi does  
this and what it allows, whether this not only a matter of the  
compiler but also of the rtti, ...



How can I overcome this issue?


You cannot.


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

Graeme Geldenhuys wrote:

Why is the following not allowed in a class declaration?

property Increment: extended read FIncrement write SetIncrement default 1.0;


yet this is...

property Increment: integer read FIncrement write SetIncrement default 1;


What would be the major obstacle 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 Michael Van Canneyt


On Mon, 6 Oct 2008, Jonas Maebe wrote:

> 
> On 06 Oct 2008, at 12:48, Graeme Geldenhuys wrote:
> 
> >Why is the following not allowed in a class declaration?
> >
> >   property Increment: extended read FIncrement write SetIncrement default
> >   1.0;
> 
> Because default values are stored in a 32 bit location inside the compiler. I
> have no idea what the reason for this is, how Delphi does this and what it
> allows, whether this not only a matter of the compiler but also of the rtti,
> ...

FPC is 100% Delphi compatible as FPC. Default values for sets are also only 
allowed
for sets that fit in 32-bits. We can change this, but that would require quite 
some
work in the RTTI structures.

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

Jonas Maebe wrote:


On 06 Oct 2008, at 12:48, Graeme Geldenhuys wrote:


Why is the following not allowed in a class declaration?

   property Increment: extended read FIncrement write SetIncrement 
default 1.0;


Because default values are stored in a 32 bit location inside the 
compiler. I have no idea what the reason for this is, how Delphi does 
this and what it allows, whether this not only a matter of the compiler 
but also of the rtti, ...


If this area is typed, and the size is 64 for the 64 bits compiler, you 
could store a pextended instead of the value itself. Just a thought.


--
Joao Morais
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Tomas Hajny
On Mon, October 6, 2008 05:33, Antal wrote:
>>
>>  It is a plain text file, each row is separated with CRLF (#13#10), each
>>> cell separated with tab (#9)
>>>
>>
>> errm, surely that should be a comma, not a tab!
>
>
> The Tab as separator is just a good way to avoid using the double quote :P
> It just comes from the good old Lotus123.
> Anyway, just try to copy/paste to a notepad from an Excel and you will see
> how it works.
> And then, saved as .CSV reopen it with Office and it might work. Or it
> might
> not :P
> I am currently using this, since it is easier to manage as the double
> quotes.

An additional issue with delimiters in this case is the fact, that "C" in
"CSV" may not always be a comma (or that spreadsheet applications may
expect different characters depending on locale - e.g. semicolons, etc.).

Tomas


___
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 Graeme Geldenhuys
On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt
<[EMAIL PROTECTED]> wrote:
>
> FPC is 100% Delphi compatible as FPC. Default values for sets are also only 
> allowed
> for sets that fit in 32-bits. We can change this, but that would require 
> quite some
> work in the RTTI structures.

So do you think this will change in 64bit Delphi and then in 64bit
FPC?  RTTI structures also supporting 64bit values? It would make
sense (to me at least). :-)

I just thought it odd that I couldn't use a simple type (I consider
Extended a simple type, like Integer and String) in a property with a
default value.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
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 Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt
> <[EMAIL PROTECTED]> wrote:
> >
> > FPC is 100% Delphi compatible as FPC. Default values for sets are also only 
> > allowed
> > for sets that fit in 32-bits. We can change this, but that would require 
> > quite some
> > work in the RTTI structures.
> 
> So do you think this will change in 64bit Delphi and then in 64bit
> FPC?

Integer is still 32-bit on x86_64 ?
___
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 Michael Van Canneyt


On Mon, 6 Oct 2008, Graeme Geldenhuys wrote:

> On Mon, Oct 6, 2008 at 4:13 PM, Michael Van Canneyt
> <[EMAIL PROTECTED]> wrote:
> >
> > FPC is 100% Delphi compatible as FPC. Default values for sets are also only 
> > allowed
> > for sets that fit in 32-bits. We can change this, but that would require 
> > quite some
> > work in the RTTI structures.
> 
> So do you think this will change in 64bit Delphi and then in 64bit
> FPC?  RTTI structures also supporting 64bit values? It would make
> sense (to me at least). :-)
> 
> I just thought it odd that I couldn't use a simple type (I consider
> Extended a simple type, like Integer and String) in a property with a
> default value.

No, only ordinal types... Strings are also not supported.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] linklib c using mingw, cygwin, both, or ...

2008-10-06 Thread wolfram . klaeger
I'm trying to follow the tutorial, How to use C code in FreePascal projects,

ftp://ftp.freepascal.org/pub/fpc/docs-pdf/CinFreePascal.pdf

In order to get gcc running on Windows, I tried both options, mingw and cygwin. 
This or that way, compiling hello.c to hello.o works. Linking hello.o to 
hello.pas via {$linklib c} fails, when hello.o was created via mingw/gcc. FPC 
can't find libc.dll or libc.a, since mingw does not install it. 

With cygwin's gcc, libc.a can be found straightforward, where I would expect 
it, in c:/cygwin/lib/. fpc compiles without warning, now windows needs 
cygwin1.dll. Done, as well, but my hello.exe still ends up with runtime error 
216.

Any advice, another way around?

Thanks in advance
Wolfram
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Frank Peelo

Tomas Hajny wrote:

On Mon, October 6, 2008 05:33, Antal wrote:


It is a plain text file, each row is separated with CRLF (#13#10), each


cell separated with tab (#9)



errm, surely that should be a comma, not a tab!



The Tab as separator is just a good way to avoid using the double quote :P
It just comes from the good old Lotus123.
Anyway, just try to copy/paste to a notepad from an Excel and you will see
how it works.
And then, saved as .CSV reopen it with Office and it might work. Or it
might
not :P
I am currently using this, since it is easier to manage as the double
quotes.



An additional issue with delimiters in this case is the fact, that "C" in
"CSV" may not always be a comma (or that spreadsheet applications may
expect different characters depending on locale - e.g. semicolons, etc.).


CSV is occasionally referred to as something other than "Comma Separated 
Values". I'm not sure why. If you're using CSV, stick to what most 
applications understand by csv and benefit from some level of 
compatibility. Why make hassle for yourself? Excel (for example) can 
save tab delimited .txt files easily, but when you open them again you 
have to tell it what's used as a delimiter. If you save some data 
tab-delimited, but call it csv, then it's just /wrong/ when you open it 
again. Save it comma-delimited, and you can have any sort of text value 
in a cell, and it just opens.


Lack of a formal specification is a problem, but you could do worse than
http://tools.ietf.org/html/rfc4180
or even
http://en.wikipedia.org/wiki/Comma-separated_values

Oh, and since it's a text file, you'll want to be careful about whether 
to use CR, LF or CRLF as a line delimiter, they're all valid somewhere :)


Which is all getting very off-topic so I'll shut up now.

Frank



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Marco van de Voort
In our previous episode, Frank Peelo said:
> > An additional issue with delimiters in this case is the fact, that "C" in
> > "CSV" may not always be a comma (or that spreadsheet applications may
> > expect different characters depending on locale - e.g. semicolons, etc.).
> 
> CSV is occasionally referred to as something other than "Comma Separated 
> Values". I'm not sure why. 

Because the comma is a bad separator for countries where the comma is the
decimal separator, like most of mainland Europe.

http://en.wikipedia.org/wiki/Decimal_separator#Countries_using_Arabic_numerals_with_decimal_comma
http://en.wikipedia.org/wiki/Decimal_separator#Countries_using_Arabic_numerals_with_decimal_point
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Frank Peelo

Marco van de Voort wrote:

In our previous episode, Frank Peelo said:


An additional issue with delimiters in this case is the fact, that "C" in
"CSV" may not always be a comma (or that spreadsheet applications may
expect different characters depending on locale - e.g. semicolons, etc.).


CSV is occasionally referred to as something other than "Comma Separated 
Values". I'm not sure why. 



Because the comma is a bad separator for countries where the comma is the
decimal separator, like most of mainland Europe.


But CSV handles that fine! "12,345","67,890","I paid Ç12,34 for my lunch 
and I didn't even get chips!"

(For some reason € comes out as Ç when saved by Excel.)
It's being read/written by a spreadsheet anyway, which doesn't mind 
putting/reading extra quote chars.


(apropos spreadsheets, awkward delimiters and being off-topic: I notice 
that using '-' as a delimiter *in* *the* *filename* can give the 
spreadsheet indigestion. Specifically in a file with a name like 
Data_2008-10-06.xls when specifying an output reference for the 
Histogram tool in the Data Analysis Toolkit. Seems to want to evaluate 
(Data_2008 - 10 - 06.xls) as an expression. I only mention it in the 
hope that it gives someone a chuckle.)


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Francisco Reyes

Michael Van Canneyt writes:


If buying is an option: You can buy FlexCel from TMS software.
It works with FPC/Lazarus.


Thanks for the pointer.

75 EUR is a little steep for what will end up been an open source app.
Specially since it will be a text based program. Will try the Lazarus 
component and if that doesn't work, will consider FlexCel. Also if I used 
FlexCel the program will pretty much never have other people work the 
project. Few people will pay that money so they could work on an open source 
project.


To those who mentioned CSV as I mentioned in my original post I am 
trying to create tabs. The ocassional conversion is fine with CSV, but when 
one has a process that needs to take multiple ASCII files and put it into a 
single spreadsheet on a regular bases, CSV is far from ideal.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Michael Van Canneyt


On Mon, 6 Oct 2008, Francisco Reyes wrote:

> Michael Van Canneyt writes:
> 
> > If buying is an option: You can buy FlexCel from TMS software.
> > It works with FPC/Lazarus.
> 
> Thanks for the pointer.
> 
> 75 EUR is a little steep for what will end up been an open source app.
> Specially since it will be a text based program. Will try the Lazarus
> component and if that doesn't work, will consider FlexCel. Also if I used
> FlexCel the program will pretty much never have other people work the project.
> Few people will pay that money so they could work on an open source project.

Well, that's why I said "If buying is an option"...

> 
> To those who mentioned CSV as I mentioned in my original post I am trying
> to create tabs. The ocassional conversion is fine with CSV, but when one has a
> process that needs to take multiple ASCII files and put it into a single
> spreadsheet on a regular bases, CSV is far from ideal.

If you ask me, it can't be hard to write the older text excel file format. 
See
http://chicago.sourceforge.net/devel/docs/excel/
or
http://chicago.sourceforge.net/
and
http://chicago.sourceforge.net/xlhtml/

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Tomas Hajny
On 6 Oct 08, at 18:00, Frank Peelo wrote:
> Marco van de Voort wrote:
> > In our previous episode, Frank Peelo said:
> >
> >>>An additional issue with delimiters in this case is the fact, that "C" in
> >>>"CSV" may not always be a comma (or that spreadsheet applications may
> >>>expect different characters depending on locale - e.g. semicolons, etc.).
> >>
> >>CSV is occasionally referred to as something other than "Comma Separated
> >>Values". I'm not sure why.
> >
> >
> > Because the comma is a bad separator for countries where the comma is the
> > decimal separator, like most of mainland Europe.
>
> But CSV handles that fine! "12,345","67,890","I paid Ç12,34 for my lunch
> and I didn't even get chips!"
 .
 .

Well, CSV handles it fine, but the applications don't and that was
exactly my point: Opening such a CSV (commas used as delimiters as
described above and the whole file named *.csv) with MS Excel running
on Windows with e.g. Czech locale, the whole lines end up in one
cell. If you want to avoid this behaviour (with MS Excel), you need
to use semicolons or start the import explicitly from a previously
started MS Excel instance (rather than opening the *.csv file
directly by double-clicking it in Explorer or so), because that
allows specifying a non-default delimiter (like a comma in this case).

Tomas

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Marco van de Voort
In our previous episode, Frank Peelo said:
> >>CSV is occasionally referred to as something other than "Comma Separated 
> >>Values". I'm not sure why. 
> > 
> > 
> > Because the comma is a bad separator for countries where the comma is the
> > decimal separator, like most of mainland Europe.
> 
> But CSV handles that fine!

CSV is just that comma separated.

Quoting is one common workaround. Another is to use a different separator.
And iirc Excel does that sometimes too. Maybe it is version dependant.

My favorite "csv" experience is to get csv's from the web opened in Excel,
for both Dutch as English locales. Really a sport :-)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Ralf A. Quint

At 12:40 PM 10/6/2008, Marco van de Voort wrote:

In our previous episode, Frank Peelo said:
> >>CSV is occasionally referred to as something other than "Comma Separated
> >>Values". I'm not sure why.
> >
> >
> > Because the comma is a bad separator for countries where the comma is the
> > decimal separator, like most of mainland Europe.
>
> But CSV handles that fine!

CSV is just that comma separated.

Quoting is one common workaround. Another is to use a different separator.
And iirc Excel does that sometimes too. Maybe it is version dependant.


Sorry, but that is rather application depended. And there are a lot 
that handle, both for writing and reading, "quoted" fields not 
properly, though there is a relevant RFC about this in RFC4180 
(http://tools.ietf.org/html/rfc4180)




My favorite "csv" experience is to get csv's from the web opened in Excel,
for both Dutch as English locales. Really a sport :-)


I do this a lot, in and out of Excel and other application and Excel 
in fact handles this better than anything else. If the CSV file has 
been written properly to begin with...


Ralf 


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Marco van de Voort
In our previous episode, Ralf A. Quint said:
> > > > Because the comma is a bad separator for countries where the comma is 
> > > > the
> > > > decimal separator, like most of mainland Europe.
> > >
> > > But CSV handles that fine!
> >
> >CSV is just that comma separated.
> >
> >Quoting is one common workaround. Another is to use a different separator.
> >And iirc Excel does that sometimes too. Maybe it is version dependant.
> 
> Sorry, but that is rather application depended. And there are a lot 
> that handle, both for writing and reading, "quoted" fields not 
> properly, though there is a relevant RFC about this in RFC4180 
> (http://tools.ietf.org/html/rfc4180)

Correct.
 
> >My favorite "csv" experience is to get csv's from the web opened in Excel,
> >for both Dutch as English locales. Really a sport :-)
> 
> I do this a lot, in and out of Excel and other application and Excel 
> in fact handles this better than anything else. If the CSV file has 
> been written properly to begin with...

It depends heavily on the mimetype also. Application/vnd.excel or so gave
the best results. But that is unstandarize OS specific, so it couldn't be
used on a "neutral" government site.

And the existance of characters that Excel (XP or 2003 it was I think) could
see as signal chars to switch charsets was also a problem.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] linklib c using mingw, cygwin, both, or ...

2008-10-06 Thread Wolfram Kläger
> I'm trying to follow the tutorial, How to use C code in FreePascal projects,
> 
> ftp://ftp.freepascal.org/pub/fpc/docs-pdf/CinFreePascal.pdf
> 
> In order to get gcc running on Windows, I tried both options, mingw and 
> cygwin. ...

Solved. Instead of 

{$linklib c}

as described in the tutorial, read

http://community.freepascal.org:1/bboards/message?message_id=268811&forum_id=24083

and give 

{$linklib c:/mingw/lib/libmsvcrt.a}

a try. Instead of specifying the absolute path, add the following line to the 
library search path of your fpc.cfg

-Flc:/mingw/lib

or wherever your mingw installation resides. The tutorial mentions, other 
linking errors might occur or might not, if 

{$link gcc}

is specified, or not. The earlier poster even had to add a

{$Linklib kernel32}

In my case, neither nor is required.

Wolfram

PS Maybe it's a good idea, providing Gilles Marcou's tutorial as a wiki instead 
of a PDF. At least me, I'd be happy to see continuous updates to such 
essentials and would not hesitate to do it by myself.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Spreadsheet library/unit?

2008-10-06 Thread Francisco Reyes

Michael Van Canneyt writes:

If you ask me, it can't be hard to write the older text excel file format. 


Thanks for the links will take a look later.
For now I will go with http://wiki.lazarus.freepascal.org/FPSpreadsheet
and see how that works out.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal