Re: [fpc-pascal] Free Pascal Directories

2014-10-04 Thread Sven Barth
Am 04.10.2014 00:03 schrieb Tomas Hajny xhaj...@hajny.biz:

 On 3 Oct 14, at 23:53, Sven Barth wrote:
  Am 03.10.2014 03:37 schrieb Philippe phili...@quarta.com.br:
  
   @cfg
  
   I read about that option in a previous message of the thread ...
clearly
  a better ideia!!! ... I´ll use it for sure!
  
   taking advantage of the oportunity. when one type fpc in the command
  line, he/she gets:
  
  
  
   D:\psl9\c9fpc
   Free Pascal Compiler version 2.6.4 [2014/03/06] for i386
   Copyright (c) 1993-2014 by Florian Klaempfl and others
   c:\FPC\2.6.4\bin\i386-Win32\ppc386.exe [options] inputfile [options]
  
   and so one ...
  
   and if I did not missed it, there is nothing about @cfg !
  
   that is the reason while I never used it!
 
  It should be listed if you show the help using -h parameter.

 Well, it's only listed in trunk since r28187 (7 July)... I had to
 modify the compiler in order to allow displaying an option not
 starting with '-'.

Right... Forgot that :/

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Windows type library files

2014-10-04 Thread Adriaan van Os

Sandro Cumerlato wrote:

Excellent, but sadly some libraries rely on OleCtrls and StdVCL.


I assume that's only for a few type declarations, because it's unlikely that Windows system 
libraries depend on Delphi for their implementation. But this does require some manual editing.


Regards,

Adriaan van Os

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


Re: [fpc-pascal] TIniFile: how to save bool as string?

2014-10-04 Thread Reinier Olislagers
On 03/10/2014 21:16, silvioprog wrote:
 When I use the TIniFile to save my configurations, it saves the boolean
 values as 0 and 1.
 
 Is there any way to save these values ​​as string (true/false) instead
 of integer (0/1)? If not, can I send a patch to implement that?!

1. Write your own wrapper?
2. AFAIR, there already is a bug report+patch in the bug tracker on
extending TInifiles.


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

Re: [fpc-pascal] TIniFile: how to save bool as string?

2014-10-04 Thread Mark Morgan Lloyd

Reinier Olislagers wrote:

On 03/10/2014 21:16, silvioprog wrote: When I use the TIniFile to save my configurations, 
it saves the boolean values as 0 and 1.  Is there any way to save these values as 
string (true/false) instead of integer (0/1)? If not, can I send a patch to implement 
that?!
1. Write your own wrapper?2. AFAIR, there already is a bug report+patch in the 
bug tracker onextending TInifiles.


At least if it saves (and presumably expects) 0 and 1 it's protected 
from internationalisation issues e.g. if a template .ini is supplied 
with an app.


I hacked a wrapper some while ago for my own use, which tries to 
preserve the form of the variable (i.e. if it's currently True then 
False is written, but if it's yes then no is written). That's 
obviously massively problematic if multiple languages have to be supported.


--
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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Free Pascal Directories

2014-10-04 Thread Graeme Geldenhuys
On 2014-10-02 18:21, Brian wrote:
 Is there any way to tell the compiler to just link existing .ppu and .o
 files ?

Yes. In the case of fpGUI (as as an example), the fpgui/src/build.bat
or build.sh builds the fpGUI framework and places the compiled units in
a library output directory fpgui/lib/fpctarget

The examples/demos of fpGUI doesn't recompile the fpGUI framework, it
simply uses the *.ppu and *.o files located in the 'lib/target/'
directory. See the extrafpc.cfg files in the demo directories.

Here is a snippet:

  -FUunits
  -Fu../../../lib/$fpctarget


Not the -Fu doesn't reference the fpgui/src/ directory, but rather the
lib directory.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Free Pascal Directories

2014-10-04 Thread Graeme Geldenhuys
On 2014-10-02 19:23, Brian wrote:
 When the helloworld.pas file is compiled using Geany 

Take a look at the fpgui/docs/INSTALL.txt file. There I explain how to
setup and use fpGUI with various IDE's and editors. Maybe some of that
information can be applied to Geany. Sorry I have never used Geany
myself, only saw it run about 4 years ago.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] I can't compile gvector.pp in package fcl-stl

2014-10-04 Thread Kiên Nguyễn Tiến Trung
Hello,

I can't compile following file

https://github.com/graemeg/freepascal/blob/master/packages/fcl-stl/src/gvector.pp

I want to use this unit because fcl-stl in fpc-2.6.4 is very old.

Can you show me the way to compile above file?

Thank you.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] TIniFile: how to save bool as string?

2014-10-04 Thread Graeme Geldenhuys
On 2014-10-03 20:16, silvioprog wrote:
 Is there any way to save these values ​​as string (true/false) instead of
 integer (0/1)? 

Yes, simply create a descendant of TINIFile, override the WriteBool()
virtual method and use BoolToStr() instead of BoolToChar() in its
implementation.

The same then needs to be done for ReadBool() as well.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Syserrormessage, parameter data type

2014-10-04 Thread Jürgen Hestermann

In my programs I use this code quite often:

SysErrorMessage(GetLastError);

But recently my program had a range check
error which let me have a look at the definiton
of the 2 functions GetLastError and SysErrorMessage.
GetLastError is from the WinAPI:

---
function GetLastError:DWORD; external 'kernel32' name 'GetLastError';
---

and SysErrorMessage is from SysUtils:

---
function SysErrorMessage(ErrorCode: Integer): String;
const MaxMsgSize = Format_Message_Max_Width_Mask;
var   MsgBuffer: pChar;

begin
GetMem(MsgBuffer, MaxMsgSize);
FillChar(MsgBuffer^, MaxMsgSize, #0);
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
   nil,
   ErrorCode,  - 3rd Parameter
   MakeLangId(LANG_NEUTRAL, SUBLANG_DEFAULT),
   MsgBuffer, { This function allocs the memory }
   MaxMsgSize,   { Maximum message size }
   nil);
SysErrorMessage := StrPas(MsgBuffer);
FreeMem(MsgBuffer, MaxMsgSize);
end;
---

GetLastError yields a DWORD but SysErrorMessage expects an INTEGER.
Why? This raises a range check for all error codes 2^31.

A closer look at SysErrorMessage shows that the ERRORCODE will
not be used in this routine but only handed over to
FormatMessageA which expects a DWORD!

---
function FormatMessageA(dwFlags:DWORD;
lpSource:LPCVOID;
dwMessageId:DWORD;- 3rd Parameter
dwLanguageId:DWORD;
lpBuffer:LPSTR;
nSize:DWORD;
Arguments:va_list):DWORD; external 'kernel32' name 
'FormatMessageA';
---

So if GetLastError gives a DWORD and FormatMessageA expects a DWORD
shouldn't SysErrorMessage use a DWORD too?



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


Re: [fpc-pascal] I can't compile gvector.pp in package fcl-stl

2014-10-04 Thread Sven Barth
Am 04.10.2014 13:17 schrieb Kiên Nguyễn Tiến Trung kc97...@gmail.com:

 Hello,

 I can't compile following file


https://github.com/graemeg/freepascal/blob/master/packages/fcl-stl/src/gvector.pp

 I want to use this unit because fcl-stl in fpc-2.6.4 is very old.

 Can you show me the way to compile above file?

You can't. It depends on fixes done in 2.7.1.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] I can't compile gvector.pp in package fcl-stl

2014-10-04 Thread Kiên Nguyễn Tiến Trung
Thank you.

I'll wait for fpc-2.8.0.

2014-10-05 4:10 GMT+07:00 Sven Barth pascaldra...@googlemail.com:

 Am 04.10.2014 13:17 schrieb Kiên Nguyễn Tiến Trung kc97...@gmail.com:

 
  Hello,
 
  I can't compile following file
 
 
 https://github.com/graemeg/freepascal/blob/master/packages/fcl-stl/src/gvector.pp
 
  I want to use this unit because fcl-stl in fpc-2.6.4 is very old.
 
  Can you show me the way to compile above file?

 You can't. It depends on fixes done in 2.7.1.

 Regards,
 Sven

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

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