Re: [fpc-devel] Full_Version_String in an application

2010-02-18 Thread Nikolai Zhubr

19.02.2010 1:24, JoshyFun:

I'm using:

CreatedUsing:='Created using Lazarus '+LCLVersion+' and free pascal '+{
$I %FPCVERSION%}+' ('+{$I %DATE%}+' '+{$I %TIME%}+')';


Cool! I'll use this. Thank you very much!

Nikolai

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


Re: [fpc-devel] Full_Version_String in an application

2010-02-18 Thread JoshyFun
Hello Nikolai,

Thursday, February 18, 2010, 10:43:54 PM, you wrote:

NZ> Hello people,

NZ> Is it possible in an application to somehow get the information about
NZ> FPC version was used to compile this application (in the form of string
NZ> or integers, whatever)?

NZ> Yes, I've searched through sources and googled, but still can't get it.

I'm using:

CreatedUsing:='Created using Lazarus '+LCLVersion+' and free pascal '+{
$I %FPCVERSION%}+' ('+{$I %DATE%}+' '+{$I %TIME%}+')';

-- 
Best regards,
 JoshyFun

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


Re: [fpc-devel] Full_Version_String in an application

2010-02-18 Thread Nikolai Zhubr

19.02.2010 0:43, Nikolai Zhubr:

Is it possible in an application to somehow get the information about
FPC version was used to compile this application (in the form of string
or integers, whatever)?
P.S.: I'm not asking about conditional defines (I know about them, of 
course, but they are not quite convenient for what I want)




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



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


[fpc-devel] Full_Version_String in an application

2010-02-18 Thread Nikolai Zhubr

Hello people,

Is it possible in an application to somehow get the information about 
FPC version was used to compile this application (in the form of string 
or integers, whatever)?


Yes, I've searched through sources and googled, but still can't get it.

Thank you.

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Graeme Geldenhuys
On 17 February 2010 16:47, Michael Schnell  wrote:
> What messages does it capture ?
> How to send a message from a thread ?


Just thought of something else. Not sure if this is a solution, but it
might head you in the right direction. Have a look at two behavioural
design patterns: Chain of Responsibility, Command.

These patterns describe something like what you are trying to do. If
you can't find documentation on these, I can email you the two
chapters from the Design Patterns (GoF) book.


-- 
Regards,
  - Graeme -


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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Nikolai Zhubr

18.02.2010 16:16, Michael Schnell:
[trim]

use "procedure  message". But In Delphi/Windows you don't need to
create a server. Just using "procedure  message" is enough o receive
a message from another process.
No. AFAIK even in Delphi, "message procedures" for non-components are 
pretty much abstract (and probably almost useless). The messaging system 
you are talking about only works automagically for components belonging 
to the Application component (and is therefore limited to the main thread).


If you create a thread in Delphi (even a Tthread descendant) you will 
not be able to insert components to it, because it is not a component 
itself. So, if you are going to make this messaging work to some degree 
in non-main thread on windows, you'll probably need to take care of some 
things manually. First, you'll need some window handle created within 
your thread, as otherwise OS will not even create a message queue for 
this thread. Delphi won't do this for you, AFAIK. Then, in the body of 
your thread, you'll need to regularily fetch new messages (GetMessage or 
PeekMessage etc) and actually dispatch them to some objects (maybe to 
this very tthread object for instance).


If this is possible with FPC/Linux, I

should make sure that it's still possible with the NoGUIApplication package.


When I ported some threaded delphi application to linux I replaced 
window handles (used for inter-thread communication) by unix pipes. 
These are not exactly the same, but generally provide sufficient 
functionality and are quite easy to use. No idea if it is anywhere 
appropriate in your case, though.


Hope this helps:)

Nikolai


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



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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Graeme Geldenhuys
On 18 February 2010 17:44, Michael Schnell  wrote:
>
> Of course I did try this, but the project seems to be abandoned:


It works fine here (from the office and home). I can also assure you
the project is not abandoned. :) I use it daily in our company and am
currently busy putting together the next (long overdue) release.

The project website is hosted on our company servers. We sometimes get
minor internet outages (we have ADSL), but I wasn't aware of any
today.


-- 
Regards,
  - Graeme -


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


Fwd: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Graeme Geldenhuys
Sorry, I posted the reply to the Lazarus list by accident.


-- Forwarded message --
From: Graeme Geldenhuys 
Date: 18 February 2010 19:16
Subject: Re: [fpc-devel] procedure ... message(); in Linux
To: Lazarus mailing list 


On 18 February 2010 15:16, Michael Schnell  wrote:
>
> Yep. Here you need to do a server and a client and it does not seem to

"client/server" is just a term used for communications. You could use pipes too.


> use "procedure  message". But In Delphi/Windows you don't need to
> create a server. Just using "procedure  message" is enough o receive

Well that "message" feature is Windows technology, and Delphi was
designed ONLY for Windows, so obviously it's not going to be the same
on other platforms. IPC is an alternative to accomplish a similar
task, and it works on multiple platforms.


--
Regards,
 - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



-- 
Regards,
  - Graeme -


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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Graeme Geldenhuys
On 18 February 2010 15:41, Michael Schnell  wrote:
>
> my fpc sources don't have any fpg* files other than fpglibc* and fpgtk*.
>
> Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it does
> not contain a file fpg_main.* and fpgPostMessage is not mentioned in any
> file :(.


Sorry for the confusion. I was talking about fpGUI, so thought it
would be obvious to look in the fpGUI repository for those methods and
units. fpGUI is not part of FPC or Lazarus, it's a separate project
like MSEgui.

fpGUI Home page:
  http://opensoft.homeip.net/fpgui/

SourceForge project page
  http://sourceforge.net/projects/fpgui/

Direct repository access:
  git clone git://fpgui.git.sourceforge.net/gitroot/fpgui/fpgui



-- 
Regards,
  - Graeme -


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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 04:50 PM, Jonas Maebe wrote:
>
> On 18 Feb 2010, at 16:44, Michael Schnell wrote:
>
>> Of course I did try this, but the project seems to be abandoned:
>>
>>  http://opensoft.homeip.net/fpgui/
>>
>>  ERROR
>>
>>The requested URL could not be retrieved
>
> It works fine here.
>
I'll try at home 

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 05:12 PM, Marc Weustink wrote:
>
> Nope. On non windows widgetrsets, lazarus implements its own
> messagequeue which is handled in application.Idle.

I'll try to find out how this works(and how things like Timer and
the waiting for events are done). Maybe it's an alternative to use this
code instead of the mse code (which actually does run fine for me when
(ported and) compiled with Lazarus) for NoGUIApplication.

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Marc Weustink

Michael Schnell wrote:

On 02/18/2010 02:48 PM, Sergei Gorelkin wrote:If this is possible with
FPC/Linux, I

should make sure that it's still possible with the NoGUIApplication
package.


Windows has a built-in transport for the messages, Linux doesn't. Of
course there
are libraries providing similar or even better functionality, but you
end up depending
on particular library.


I do know this. This is why I need to port Martin's NoGUIApplication,
which has an internal message queue, to Lazarus,

I suppose with Linux, FPC (or Lazarus ? ) uses X11 as a message queue
provider.


Nope. On non windows widgetrsets, lazarus implements its own 
messagequeue which is handled in application.Idle.
On some widgetsets (iirc Carbon and QT) this messagequeue is mixed with 
the messagequeue if that widgetset.




But I was not yet able to find out how to post a message into
the X11 queue (with a thread or another application) and capture this
message by an FPC "procedure ... message" construct. (with FPC/Lazarus
on Windows this does work fine using Windows messages)


AFAIK, X11 has no messagequeue but is based on callbacks.


If it does work with Linux/X1, I need to think how to make it work with
NoGUIApplication, as well. If it does not work in Linux, anyway, I don't
think I'll bother.



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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Jonas Maebe


On 18 Feb 2010, at 16:44, Michael Schnell wrote:


Of course I did try this, but the project seems to be abandoned:

 http://opensoft.homeip.net/fpgui/

 ERROR

   The requested URL could not be retrieved


It works fine here.


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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 02:49 PM, Jonas Maebe wrote:
>
> http://www.google.com/search?q=fpgui
>

Of course I did try this, but the project seems to be abandoned:


  http://opensoft.homeip.net/fpgui/


  ERROR


The requested URL could not be retrieved

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 02:48 PM, Sergei Gorelkin wrote:If this is possible with
FPC/Linux, I
>> should make sure that it's still possible with the NoGUIApplication
>> package.
>>
> Windows has a built-in transport for the messages, Linux doesn't. Of
> course there
> are libraries providing similar or even better functionality, but you
> end up depending
> on particular library.

I do know this. This is why I need to port Martin's NoGUIApplication,
which has an internal message queue, to Lazarus,

I suppose with Linux, FPC (or Lazarus ? ) uses X11 as a message queue
provider. But I was not yet able to find out how to post a message into
the X11 queue (with a thread or another application) and capture this
message by an FPC "procedure ... message" construct. (with FPC/Lazarus
on Windows this does work fine using Windows messages)

If it does work with Linux/X1, I need to think how to make it work with
NoGUIApplication, as well. If it does not work in Linux, anyway, I don't
think I'll bother.

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


[fpc-devel] Re: TProcess, bash, and escaping quotes

2010-02-18 Thread Seth Grover
Graeme wrote:
> Do you mean the same as this issue:
>  http://bugs.freepascal.org/view.php?id=14446
> TProcess does not support bash style syntax

Yes, I can see that now. I agree that being able to specify the
parameters as an array would be the ideal solution. Thanks.

-SG

--
This email is fiction. Any resemblance to actual events
or persons living or dead is purely coincidental.

Seth Grover
sethdgrover[at]gmail[dot]com
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Jonas Maebe


On 18 Feb 2010, at 14:41, Michael Schnell wrote:

Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it  
does
not contain a file fpg_main.* and fpgPostMessage is not mentioned in  
any

file :(.


http://www.google.com/search?q=fpgui


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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Sergei Gorelkin

Michael Schnell wrote:


Yep. Here you need to do a server and a client and it does not seem to
use "procedure  message". But In Delphi/Windows you don't need to
create a server. Just using "procedure  message" is enough o receive
a message from another process.


Things are more complicated than that. At the very least Delphi application
must receive the message from system (using GetMessage() or other API),
determine the target object and call its Dispatch method with message as 
parameter.


If this is possible with FPC/Linux, I
should make sure that it's still possible with the NoGUIApplication package.


Windows has a built-in transport for the messages, Linux doesn't. Of course 
there
are libraries providing similar or even better functionality, but you end up 
depending
on particular library.

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote:
>
> fpGUI has an internal event queue which later gets dispatched to the target
> using TObject.Dispatch(). fpGUI v0.4 and earlier used a Object based even
> system and had it's own distribution functions. Later version of fpGUI uses
> Record based messages and the 'message' language feature of Object Pascal.
>
> fpGUI has the following procedures defined in fpg_main.pas unit that work
> with the message queue.
>
> procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var
> aparams: TfpgMessageParams); overload;
>   

my fpc sources don't have any fpg* files other than fpglibc* and fpgtk*.

Lazarus does have a directory /lazarus/lcl/interfaces/fpgui/ but it does
not contain a file fpg_main.* and fpgPostMessage is not mentioned in any
file :(.

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote:
>
>> How to send a message from another process ?
>> 
>
> On example would be to use IPC as defined in the SimpleIPC unit - part of
> FCL. SimpleIPC documentation can be found at:
>
>   http://www.freepascal.org/docs-html/fcl/simpleipc/index.html
>
>   

Yep. Here you need to do a server and a client and it does not seem to
use "procedure  message". But In Delphi/Windows you don't need to
create a server. Just using "procedure  message" is enough o receive
a message from another process. If this is possible with FPC/Linux, I
should make sure that it's still possible with the NoGUIApplication package.

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


Re: [fpc-devel] ReallocMem & TotalAllocated: Round 2

2010-02-18 Thread Nikolai Zhubr

18.02.2010 0:29, Marco van de Voort:

I haven't sent this to mantis yet. Please someone let me know if this
example is appropriate (or not).


I think so, please enter it in Mantis.


I've created yet another (alternative) example for the same matter and 
filed a new bugreport including both.


http://bugs.freepascal.org/view.php?id=15805

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


Re: [fpc-devel] TProcess, bash, and escaping quotes

2010-02-18 Thread Graeme Geldenhuys
Seth Grover wrote:
> I'm working with TProcess, which for the most part I love, but I'm
> scratching my head right now because of a problem I'm experiencing.
> 
> Suppose I have the following command:
> 
> ifconfig | grep -E -e "inet6? addr:" | grep -v -E -e
> "(127.0.0.1|::1|Scope:Link)" | sed -e
> "s/^.*addr:\s*\(\S*\)\(\/\d+\)*.*$/\1/g"


Do you mean the same as this issue:

  http://bugs.freepascal.org/view.php?id=14446


TProcess does not support bash style syntax where parameters need to be
placed in quotes etc. This issue confuses the hell out of me as well. Marco
suggested a good solution - but it's not implemented yet. TProcess
parameters must be an array and not a string. anyway, read the bug report
to understand more of how TProcess interprets things.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

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


Re: [fpc-devel] RTL and Unicode filenames operations.

2010-02-18 Thread Florian Klaempfl
Felipe Monteiro de Carvalho schrieb:
> 2010/2/17 Flávio Etrusco :
>> I've read somewhere that Windows ANSI functions support utf-8?
>> (despite the name)
> 
> lol!!!
> 
> You read from someone deeply missinformed =D

Switch the console to a font supporting unicode, execute chcp 65001 and
you can output utf-8.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
Thanks for your valuable hints !

On 02/18/2010 09:21 AM, Graeme Geldenhuys wrote:
> You can obviously use other custom communications methods too.
>   
Of course I do know this, my current goal is to explore if/how I need to
support "procedure...message" with the upcoming NoGUIApplication package.

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Michael Schnell
On 02/17/2010 05:46 PM, Marco van de Voort wrote:
> Afaik it is nothing more than a table that says "for msg with value xxx call
> method yyy". IOW it is abstract.
>   

In Windows obviously an "msg" is a Windows message. But what is a "msg"
in Linux ?

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


Re: [fpc-devel] RTL and Unicode filenames operations.

2010-02-18 Thread Michael Schnell
On 02/17/2010 06:52 PM, Martin Schreiber wrote:
> Aren't filenames on Linux an array of bytes without any encoding by 
> definition?
>   
Right. But how to visualize them ?

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


Re: [fpc-devel] procedure ... message(); in Linux

2010-02-18 Thread Graeme Geldenhuys
I hope I understand your question correctly...


Michael Schnell wrote:
> What messages does it capture ?

Anything that fits into 'var message' parameter. fpGUI uses the following
base structure for the event queue.

  TfpgMessageRec = record
MsgCode: integer;
Sender: TObject;
Dest: TObject;
Params: TfpgMessageParams;
Stop: Boolean;
  end;



> How to send a message from a thread ?

fpGUI has an internal event queue which later gets dispatched to the target
using TObject.Dispatch(). fpGUI v0.4 and earlier used a Object based even
system and had it's own distribution functions. Later version of fpGUI uses
Record based messages and the 'message' language feature of Object Pascal.

fpGUI has the following procedures defined in fpg_main.pas unit that work
with the message queue.

procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var
aparams: TfpgMessageParams); overload;
procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer); overload;
procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer; var
aparams: TfpgMessageParams); overload;
procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer); overload;
procedure fpgDeliverMessage(var msg: TfpgMessageRec);
procedure fpgDeliverMessages;


Here is an example of the X11 backend in fpGUI translating the X11 window
messages into fpGUI messages and dispatching them to the message queue.

--
X.FocusIn:
fpgPostMessage(nil, FindWindowByHandle(ev.xfocus.window),
FPGM_ACTIVATE);

X.FocusOut:
fpgPostMessage(nil, FindWindowByHandle(ev.xfocus.window),
FPGM_DEACTIVATE);

X.EnterNotify:
fpgPostMessage(nil, FindWindowByHandle(ev.xcrossing.window),
FPGM_MOUSEENTER);

X.LeaveNotify:
fpgPostMessage(nil, FindWindowByHandle(ev.xcrossing.window),
FPGM_MOUSEEXIT);
--

All the above describes messages from main thread to component or thread to
component.

For one thread to another thread, I would imagine a simple thread-safe
message queue could be created (a simple list with message items). I'm not
sure if FPC supplies a thread-safe list class. Each thread will
periodically check the queue for messages related to itself, or post
messages for other threads. A multi-read-single-write synchronizer
(available in FPC as TMultiReadExclusiveWriteSynchronizer) could be used
when accessing the message queue.



> How to send a message from another process ?


On example would be to use IPC as defined in the SimpleIPC unit - part of
FCL. SimpleIPC documentation can be found at:

  http://www.freepascal.org/docs-html/fcl/simpleipc/index.html

You can obviously use other custom communications methods too.



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

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