[fpc-pascal] Converting String to array of Char generates duplicate local var

2011-09-02 Thread cobines
Hello.

I have definitions:

PluginDir: packed array [0..Pred(16384)] of AnsiChar;
sName: AnsiString;

When I assign AnsiString to array of Char compiler generates code like this:

-4(%ebp) is source string
-17252(%ebp) is local temporary array
4(%ebx) is my destination array of char

# [411] PluginDir:= sName;
movl-4(%ebp),%ecx
leal-17252(%ebp),%eax
movl$16383,%edx
callfpc_ansistr_to_chararray
leal4(%ebx),%edi
leal-17252(%ebp),%esi
cld
movl$4096,%ecx
rep
movsl

The result is copying data twice and as you see array is quite big.
Is it not possible to write directly to 4(%ebx)?

FPC 2.7.1 i386-Linux

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


[fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread Reinier Olislagers
Hi all,

If I Googled correctly, the following field size limits are present for
the various DBase formats:
3: DBase III: 10 characters
4: DBase IV: 10 characters
7: DBase VII: 32 characters
8: FoxPro: 10 characters

3,4: http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_STRUCT

7: IIRC, from http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm
(forwarded by Wikipedia), but that page is down now

8:
http://www.dynamic.com/v7/what-are-limitations-foxpro-full-isam-file
http://www.foxite.com/archives/foxpro-field-names-066805.htm
Apparently Visual FoxPro 8 has 27 characters in a DBC (Database
container) file, but only 10 in a DBF file.

Is that correct?
The reason I ask:

In packages\fcl-db\src\export\fpdbfexport.pp
These tablelevels/formats are defined:
  TTableFormat = (tfDBaseIII,tfDBaseIV,tfDBaseVII,tfFoxPro);

In function
function TFPCustomDBFExport.BindFields: Boolean;
there is this part (line 136):
  If FormatSettings.AutoRenameFields and
(FormatSettings.TableFormat=tfDbaseIII) then
CheckExportFieldNames;

1. Shouldn't this be amended to (don't know if you can use in in this way):
  If FormatSettings.AutoRenameFields and (FormatSettings.TableFormat in
[tfDbaseIII,tfDbaseIV,FoxPro]) then
CheckExportFieldNames;

2.
http://devzone.advantagedatabase.com/dz/webhelp/Advantage8.1/server1/table_dbf_.htm
Characters allowed seem to be for standard Xbase DBF tables that are
compatible with CA-Clipper DBF tables, Microsoft FoxPro DBF tables, and
dBASE III+ DBF tables:

may only contain the letters ‘a’-‘z’ and ‘A’-‘Z’, digits ‘0’-‘9’, and
the underscore ‘_’ character

Presumably the CheckExportFieldNames could be amended for that, too, right?

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


Re: [fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread Reinier Olislagers
On 2-9-2011 13:23, michael.vancann...@wisa.be wrote:
 
 On Fri, 2 Sep 2011, Reinier Olislagers wrote:
 
 Hi all,
snip long-winded post
 
 Presumably, yes.
 
 Michael.
;)

Thanks, I'll give it a go and attach a patch to Mantis...

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


Re: [fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread Reinier Olislagers
On 2-9-2011 13:23, michael.vancann...@wisa.be wrote:
 On Fri, 2 Sep 2011, Reinier Olislagers wrote:
snip
 In packages\fcl-db\src\export\fpdbfexport.pp
 These tablelevels/formats are defined:
  TTableFormat = (tfDBaseIII,tfDBaseIV,tfDBaseVII,tfFoxPro);

 In function
 function TFPCustomDBFExport.BindFields: Boolean;
 there is this part (line 136):
  If FormatSettings.AutoRenameFields and
 (FormatSettings.TableFormat=tfDbaseIII) then
CheckExportFieldNames;

 1. Shouldn't this be amended to (don't know if you can use in in this
 way):
  If FormatSettings.AutoRenameFields and (FormatSettings.TableFormat in
 [tfDbaseIII,tfDbaseIV,FoxPro]) then
CheckExportFieldNames;
sip
 Presumably, yes.
 
 Michael.
Uploaded a patch, issue 20134
http://bugs.freepascal.org/view.php?id=20134

I think I've also found the solution to
http://bugs.freepascal.org/view.php?id=20069
(patch attached), so if somebody would be so kind to review  apply
them, I'd be very happy.

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


Re: [fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread michael . vancanneyt



On Fri, 2 Sep 2011, Reinier Olislagers wrote:


On 2-9-2011 13:23, michael.vancann...@wisa.be wrote:

On Fri, 2 Sep 2011, Reinier Olislagers wrote:

snip

In packages\fcl-db\src\export\fpdbfexport.pp
These tablelevels/formats are defined:
 TTableFormat = (tfDBaseIII,tfDBaseIV,tfDBaseVII,tfFoxPro);

In function
function TFPCustomDBFExport.BindFields: Boolean;
there is this part (line 136):
 If FormatSettings.AutoRenameFields and
(FormatSettings.TableFormat=tfDbaseIII) then
   CheckExportFieldNames;

1. Shouldn't this be amended to (don't know if you can use in in this
way):
 If FormatSettings.AutoRenameFields and (FormatSettings.TableFormat in
[tfDbaseIII,tfDbaseIV,FoxPro]) then
   CheckExportFieldNames;

sip

Presumably, yes.

Michael.

Uploaded a patch, issue 20134
http://bugs.freepascal.org/view.php?id=20134

I think I've also found the solution to
http://bugs.freepascal.org/view.php?id=20069
(patch attached), so if somebody would be so kind to review  apply
them, I'd be very happy.


You can start being happy.

Thanks for the patches!

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


Re: [fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread Reinier Olislagers
On 2-9-2011 15:09, michael.vancann...@wisa.be wrote:
 On Fri, 2 Sep 2011, Reinier Olislagers wrote:
 On 2-9-2011 13:23, michael.vancann...@wisa.be wrote:
 On Fri, 2 Sep 2011, Reinier Olislagers wrote:
 I think I've also found the solution to
 http://bugs.freepascal.org/view.php?id=20069
 (patch attached), so if somebody would be so kind to review  apply
 them, I'd be very happy.
 
 You can start being happy.
 
 Thanks for the patches!
 
 Michael.

:) :) :)

Thanks a lot, Michael, one step closer to a working data
processing/export program the hard way (i.e. getting FPC patches in for
everything that seems wrong, apart from my newbie mistakes)

Yes, I have a masochistic streak - but it's nice to be able contribute
back for a change.

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


Re: [fpc-pascal] DBF Field name length and fpdbfexport

2011-09-02 Thread waldo kitty

On 9/2/2011 06:00, Reinier Olislagers wrote:

may only contain the letters ‘a’-‘z’ and ‘A’-‘Z’, digits ‘0’-‘9’, and
the underscore ‘_’ character


well, that's interesting... i was writing back to say that the above all 
appeared as garbage characters while i was reading the message... evidently 
they are UTF-8 or such and my message reading settings are not UTF-8 
compatible... what surprised me was that they appeared correctly when i started 
this reply with them quoted...


PS: sorry for offtopic if such...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal