Re: [Lazarus] TForm.OnKeyPress event missing some characters using usb barcode reader

2016-05-23 Thread Bernd
I can confirm this behavior with Lazarus 1.6 (gtk2) / FPC 3.0 on Xubuntu 16.04.

Typing keys rapidly (even by hand with a normal keyboard) will make it
lose keypress events occasionally, using a barcode reader (it emulates
an USB-Keyboard) through the KeyPress event is virtually impossible
with Gtk2-LCL. No problems on Windows.

Bypassing the LCL and binding a handler directly to the gtk signal
proves that gtk will fire events for *all* keys, no matter how rapidly
the keyboard will send them, its just LCL that is missing some of them
:-(

2013-03-25 14:17 GMT+01:00 byungho jeon :
> I'm using CodeTyphon 4.10 on ubuntu mint 14 desktop (x86-64)
> - CodeTyphon 4.10 = FPC 2.7.1, Lazarus 2013-03-25 SVN 40461CT
> x86_64-linux-gtk2
>
> Barcode reader is MOTOROLA DS3578 with FIPS model (configed HID Keyboard
> Emulation, USB Type)
>
> I make reader code using TForm.KeyPreview property.
>
> 1. There is main form. (Keypreview := True)
> 2. Make OnKeyPress event handler
> 3. Read a sample QRCode ( http://localhost/qrcode/Test_2012/A001 )
> 4. OnKeyPress missing some characters.
> -> Readed -> http://localhost/qrcode/est2012/001
> -> Missed capital character(T, A) and under bar character(_)
> -> Lower case character is no problem.
>
> When I read barcode(qrcode) focus to text editor like pluma, qrcode data is
> inserted correctly without missing characters.
>
> Here is test project main form unit source code:
>
> //--- SAMPLE CODE
> unit Unit1;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
>   Classes, SysUtils, FileUtil, ubarcodes, Forms, Controls, Graphics,
> Dialogs,
>   StdCtrls, LCLType;
>
> type
>   { TForm1 }
>   TForm1 = class(TForm)
> Button1: TButton;
> Button2: TButton;
> procedure Button1Click(Sender: TObject);
> procedure Button2Click(Sender: TObject);
> procedure FormCreate(Sender: TObject);
> procedure FormKeyPress(Sender: TObject; var Key: char);
>   private
> FBuffer: string;
>   public
> { public declarations }
>   end;
>
> var
>   Form1: TForm1;
>
> implementation
>
> {$R *.lfm}
>
> { TForm1 }
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
>   KeyPreview := True;
> end;
>
> procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
> begin
>   FBuffer += Key;
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   ShowMessage(FBuffer);
> end;
>
> procedure TForm1.Button2Click(Sender: TObject);
> begin
>   FBuffer := '';
> end;
>
> end.
>
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Is there a bug in auto indentation in 1.4 or is it just me?

2015-07-09 Thread Bernd
Ok, I have a working minimal example, see the attached file.

It seems to be related to the setting: "context sensitive"

In my above example I have two functions "foo" and "bar". The first
one is formatted like K+R-Style (begin on end of line), I have been
doing this with all my code since the early days already without
problems, the only times I am using traditional formatting is when I
am working on someone elses project with different formatting. The
second function uses the traditional Pascal formatting (begin on own
line).

* It only ever seems to affect the else branch of an if, no other
constructs I have found to be affected.

In the first function it will still work, it seems when it is trying
to figure out the formatting it is looking at the second function
(which is formattet like the standard pascal formatting). But as soon
as there is more than one else with K+R formatting in the file it will
stop working correctly.

* Even if my entire file is formatted strictly K+R it won't be able to
indent the else branch correctly anymore, but all other constructs
seem to work just fine with this formatting style.
* If I turn "context sensitive" OFF then all problems disappear (even
with mixed traditional and K+R formatting).
* If I use an entirely K+R formatted laz_indentation file it makes no
difference, it still always works (even for mixed sources).
* If context sensitive is ON it will stop working, regardless of the
formatting of the laz_indentation file, even if there is NO (!)
laz_indentation file at all, the else branch will always be broken in
K+R, all other constructs will be working fine.

Bernd



2015-07-08 15:22 GMT+02:00 Martin Frb :
> On 08/07/2015 10:51, Bernd wrote:
>>
>>
>> I cannot find any way to influence this behavior in the editor
>> settings (which are very confusing btw), I cannot even change anything
>> at all there, even if I set everything to 4 spaces instead of 2 it
>> will still use 2 spaces everywhere (and 4 in an else begin branch).
>>
>> Is this just me or is this a bug in the 1.4 release?
>>
>
> You probably have "smart indent" on (see codetools section of config). The
> editor section has a link that takes you there too.
>
> afaik the smart indent takes it rules from a sample source in the config
> path...
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Unit1.pas
Description: Binary data
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Is there a bug in auto indentation in 1.4 or is it just me?

2015-07-08 Thread Bernd
if I write the following code:

procedure foo;
begin
  if true then
  begin
X
  end
  else
  begin
  X
  end;
end;

The "x" marks the place where it puts my cursor after hitting enter.
After the the if then begin it will correctly place me 2 spaces
indented relative to the begin, but after the end else begin it will
place me 4 spaces relative to the begin.

I cannot find any way to influence this behavior in the editor
settings (which are very confusing btw), I cannot even change anything
at all there, even if I set everything to 4 spaces instead of 2 it
will still use 2 spaces everywhere (and 4 in an else begin branch).

Is this just me or is this a bug in the 1.4 release?

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] lazbuild to user directory on Windows

2015-04-25 Thread Bernd Berger

Hi,

I'd like to use Lazarus for my pupils in school (Win 7), and our 
sysadmin has installed Lazarus to a read only network directory. After a 
test compile the unit win9xwsmanager was not found, so I tried to 
recompile the lclbase package.


Package rebuild for a read only lazarus installation does not work 
without administrator rights under Windows, as the lazbuild results will 
go directly into the lazarus directory tree. While under Linux, lazbuild 
results will be put into the user's directory under ~/.lazarus/lib, thus 
Package rebuild is possible for normal users under Linux.


Unfortunately, I could not find any settings for Lazarus to make 
lazbuild's results also go under Windows to the user directory (i. e. to 
C:\Users\\AppData\Local\lazarus\lib). Can anyone tell me how 
to do this?  (Of course, in my case it will be just nice if the complete 
build will be later available from the read only lazarus directory, but 
first I want to test everything, as I am not the administrator user.)


Regards

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Eye Candy Controls 0.1.11

2014-09-21 Thread Bernd
Can you please upload some screenshots somewhere?

2014-09-21 11:48 GMT+02:00 Vojtěch Čihák :
> Hello,
>
> I'd like to announce new version of Eye-Candy Controls. I keep conservative 
> numbering, so version is 0.1.11 but they are stable, at least on LCL-Qt 
> (where I developed them). I had some problems with debugging under Wine but I 
> guess it is related to Wine rather than ECC.
>
> It is a set of visual components based on Themes. Contains ruler, 
> position-bar, image menu and visually atractive alternatives to TTrackBar, 
> TProgressBar, TCheckBox, TRadioGroup, TCheckGroup, TSpeedButton, TEditButton, 
> TColorEdit, TFloatSpinEdit and TUpDown with some extra options.
>
> News:
> License changed to modified LGPL
> TECScheme - new visual component for various configurations
> TBaseScrollControl - new abstract class for managing scrollbars (TECScheme is 
> derived from it)
> TECSpeedBtn - now supports multiline Caption
> and more small improvements, see CHANGELOG.txt.
> Note (for those who do not have Lazarus - SVN and install ECC for the first 
> time):
>
> ECControls requires following change in control.pp:
> these two methods must be virtual:
> line ~722 procedure GetSpaceAround(var SpaceAround: TRect); virtual;
>
> line ~724 function GetSpace(Kind: TAnchorKind): Integer; virtual;
>
> This is done in Lazarus trunk r.44805.
> That's all. Without it will package not compile.
> No matter if you have stable Lazarus (1.2) or trunk (1.3).
> No matter if you have stable FPC (2.6.4) or trunk (2.7.1)
> (but there were some patches to fpdoc which are not in 2.6.4,
>  so if you want to create html docs via attached script, you need 2.7.1).
>
> You can download preferably from SourceForge: 
> http://sourceforge.net/projects/eccontrols/files/
> or alternatively from MediaFire: https://www.mediafire.com/#3odj0y75aogy8
>
> There are five archives now:
> ECC.zip - Eye Candy Control package
> ECC-Demo.zip - demo that shows possibilities of ECC (except TECScheme)
> ECScale-Demo.zip - demo that shows how to use TECScale inyour own components
> SchemeDesigner.zip - tool for designing of TECScheme (don't forget to try to 
> attached demo.xml)
> ECSchemeDesc.zip - simple demo that shows how to create a visual component 
> derived from TECScheme (overridden painting routines etc.)
> Note: I tested them on Qt, GTK2 and Win32 (Win). I never tried with Carbon. 
> Feedback from Carbon testers is welcome.
>
> Thank you and have a nice day.
>
> Vojtěch
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] customdrawn typo

2014-09-07 Thread Bernd
svn diff customdrawn_common.pas
Index: customdrawn_common.pas
===
--- customdrawn_common.pas  (Revision 46149)
+++ customdrawn_common.pas  (Arbeitskopie)
@@ -699,7 +699,7 @@
   ADest.Line(ASize.cx - 1, ASize.cy - 1, ASize.cx - 1, -1);
   ADest.Pen.FPColor := TColorToFPColor($0099A8AC);
   ADest.Line(1, ASize.cy - 2, ASize.cx - 2, ASize.cy - 2);
-  ADest.Line(ASize.cx - 2, ASize.cx - 2, ASize.cx - 2, 0);
+  ADest.Line(ASize.cx - 2, ASize.cy - 2, ASize.cx - 2, 0);
   ADest.Pen.FPColor := TColorToFPColor($00E2EFF1);
   ADest.Line(1, 1, ASize.cx - 2, 1);
   ADest.Line(1, 1, 1, ASize.cy - 2);



This is responsible for a small 2 pixel sized irregularitity at the
lower right corner of a customdrawn button. I noticed it when trying
to change the border colors to something less bright, then it becomes
even more obvious.

I needed to write this down quickly before I forget it again, so I'm
posting it here.

Bernd.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote debugger looses connection to target on Windows 7

2014-04-11 Thread Bernd Mueller

Martin Frb wrote:


There are several possibilities, that I can think off:

1) some setting the IDE uses.
- Gather all the "set foo=" commands that the IDE sends, and see if 
applying them to your manual driven gdb session makes a different.
- Run your manual gdb with "gdb.exe -i mi " to enable mi mode (I  do not 
think that is it, but )


2) Timing (again, and not unlikely)
If you open gdb in a terminal, it prints to that terminal. In the IDE it 
prints to a pipe. That may take different amount off time.


thank you, for pointing this out.

Also, does your sniffer give the time, between the "step over" sent to 
the target, and the packet that comes pack, and is ignored? compared to 
when it works?


In both cases, it shows nearly identically times. It takes about 1,9 ms 
until the breakpoint reply packet has reached the host. Nearly the same 
on Win2000.


If I activate gdbservers debug log, then it takes about 5,2 ms.

Regards, Bernd.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote debugger looses connection to target on Windows 7

2014-04-10 Thread Bernd Mueller

Martin Frb wrote:

On 10/04/2014 15:06, Bernd Mueller wrote:

Martin Frb wrote:

gdbserver seems to have some options to track problems, maybe try them?

Options:
  --debug   Enable general debugging output.
This is very strange. If I activate --debug, then everything seems to 
work. As if slowing down the target (by printing all the debug 
messages in its console) is helping somehow with the communication.


Odd, that makes it even more look like a gdb bug.

Though, I am not sure it is communication, it might be timing on the 
local interaction between gdb and the debuggee.


If I use the standalone gdb on the Win7 Host instead of Lazarus, 
debugging on the remote target works correct.


I had a look into the network traffic between target and host while 
debugging with Lazarus. If the stepping fails, one can see that the 
target is sending its breakpoint replay packet "+$T" which seems to 
be ignored completely by the host.


If the stepping does not fail, the host acknowledges this packet with 
"+" and starts to read memory from the target via the "$m" Packet.


I am trying to go more into detail...

Regards, Bernd.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote debugger looses connection to target on Windows 7

2014-04-10 Thread Bernd Mueller

Martin Frb wrote:

If gdb server can detect the connection loss (at "stop"), then it was 
still connected. So gdb has failed on a different level. I assume that 
the gdbserver on the arm target is the same, when you try from win7, as 
it is when you try from win2000?


yes, I have only one target. So I am working always with the same gdbserver.



Maybe something with the AV or firewall on win7?

Not impossible. But I doubt it.


Maybe trying a different version of gdb on win7?

I have done this already.


gdbserver seems to have some options to track problems, maybe try them?

Options:
  --debug   Enable general debugging output.
This is very strange. If I activate --debug, then everything seems to 
work. As if slowing down the target (by printing all the debug messages 
in its console) is helping somehow with the communication.



You can also try the following.



Rebuild the IDE. Then in the log, watch out for
  >> TCmdLineDebugger.SendCmdLn "n &"


This is the log:

  >> TCmdLineDebugger.SendCmdLn "n &"
  << TCmdLineDebugger.ReadLn "&"n &\n""
  << TCmdLineDebugger.ReadLn "^running"


then wait till the error happens, and see what happens if you press pause.
Then the assembler window pops up. But I have the impression, that 
IDE/Debugger and target are not in sync any more. But maybe, I am doing 
something wrong. I have to check this in detail.


Regards, Bernd.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote debugger looses connection to target on Windows 7

2014-04-10 Thread Bernd Mueller

Martin Frb wrote:


I have the log file attached.


What code is on this line?


This is not always the same line when the problem appears.

   repeat
  Writeln('Test');
  Sleep(500);
   until FALSE;

It can happen, that I press F8, when the grey bar is on the line with 
the Writeln statement and the debugger does not come back to the next 
line with the Sleep statement.


I made another simple test case, which fails on Windows 7 (but works on 
Windows 2000):


program project2;

begin
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
   Writeln('Test');
end.

On Windows 7, I am not able to step until the end of the program. At 
some time, when I step over with F8, the grey selection bar does not 
come back to the next Writeln statement. I can see, that the target has 
stopped, because there is no further output in the console.


[valuable information snipped]

You could try, if you are on that line, instead of stepping (F8), set a 
breakpoint the next line (lines, if there is a conditional), and use F9.


Then, with F9 you should be able to use the pause button



And then try, what happens if you hit the pause button in the IDE?


yes, pause seems to work.



So the remote printed connection lost, when you pressed stop in the IDE. 
Then it was still connected?


The exact message from the target is:

"Remote side has terminated connection. GDBServer will reopen connection.
Listening on port "

Regards, Bernd.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Remote debugger looses connection to target on Windows 7

2014-04-09 Thread Bernd Mueller

Hello,

I am using Lazarus 1.2.0. On Windows 2000 I am able to debug an 
application via the remote debugger (gdbserver) on an ARM-LINUX target.

Using the same setup does not work reliable on Windows 7.

If I step through the application, at some point, the grey bar, which 
marks the current source line in the IDE disappears and no further 
stepping is possible. I can see, that the target has executed the last 
line correctly and seems to wait for the next command from IDE/debugger.


Looking at the last lines from the debug output, it seems, as if the IDE 
misses the answer from the debugger, when the target has stopped:


<-exec-next>
^running
*running,thread-id="all"
(gdb)

The message *stopped,reason=... is missing.

Remote debugging the application without Lazarus is working without 
problems.


Any help would be greatly appreciated.

Regards, Bernd.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Text selection with numeric keypad on Linux

2012-12-21 Thread Bernd Mueller

Martin wrote:

On 21/12/2012 09:17, Bernd Mueller wrote:

Mattias Gaertner wrote:



Here the filter shows "Select Up".

strange, please see attached screen shot. There is no text selection 
command for Select Up and Select Down available. I tried with Lazarus 
1.0.4 on Ubuntu 10.04 and Lazarus 1.0 on Windows 98. Does this only 
work with the trunk version of Lazarus?


Yes, they where only made configurable, recently


if there is a version 1.0.6 in the works, could this be merged back?

Regards, Bernd.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Text selection with numeric keypad on Linux

2012-12-20 Thread Bernd Mueller

Mattias Gaertner wrote:


In that case the GTK sends for Shift+Numpad 1 a "Numpad 1" key (without the
Shift).
You can grab that key ("Numpad 1" without Shift) to the "Select Line End" key
mapping of Lazarus. The Shift+Numpad 1 selects til the end.


thank you, that works.

Now I have the problem with Shift-Up and Shift-Down. I want to replace 
these keys too, but I can not find the corresponding commands.


I used the "Find key combination" in the "Key Mappings" dialog and 
"grabbed" then for Shift-Up. Then the filter is active, but there is no 
single command available in the list box. The list box is completely 
empty. The same for Shift-Down. Aren't these keys not mappable?


Regards, Bernd.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Text selection with numeric keypad on Linux

2012-12-20 Thread Bernd Mueller

Mattias Gaertner wrote:

Hans-Peter Diettrich  hat am 20. Dezember 2012 um 15:02
geschrieben:

Bernd Mueller schrieb:

Hello,

on Windows the text selection is possible via the numeric keypad in
conjunction with the Shift key. For example Shift-End selects the text
from the current cursor position to the end of the line.

But this does not work on Linux (Ubuntu 8x, 10x in my case). The Lazarus
editor seems to ignore the key combination.

This may be a Linux problem. Traditionally the Shift key inverts NumLock
for the numeric keypad. Not every Linux offers an option "Windows
compatible Shift key behaviour".

What happens in any other editor, when you press Shift-End etc.?


The standard Text Editor 'gedit' inserts a '1', same as Lazarus.


I have have "Shift with numeric keypad keys works as in MS Windows" 
enabled and gedit selects the whole line, in contrary to Lazarus, on my 
system.


Regards, Bernd.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Text selection with numeric keypad on Linux

2012-12-20 Thread Bernd Mueller

Hello,

on Windows the text selection is possible via the numeric keypad in 
conjunction with the Shift key. For example Shift-End  selects the text 
from the current cursor position to the end of the line.


But this does not work on Linux (Ubuntu 8x, 10x in my case). The Lazarus 
editor seems to ignore the key combination.


I tried then to extend the Key Mappings for the "Select line end" 
command with an alternative key. So I "grabbed" the key combination 
Shift-End and saved the settings. But the editor behavior did not change.


BTW there is a difference between Windows and Linux, when I use the 
"Grab key" feature. When I press Shift-End on Linux, the dialog 
recognizes only the Numpad 1 key. On Windows, the correct key 
combination (Shift-End) is shown.


Any hints, how I can enable the desired text selection on Linux?

Thanks. Regards, Bernd.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] sleep function don't passed before executing the next statement

2012-11-21 Thread Bernd
2012/11/19 Eric Kom :

> Thanks for all Martin, it's works
>
>
> StatusBar.SimpleText := 'My name is Tux';
> StatusBar.Update;
> sleep(2000);
> StatusBar.SimpleText := 'am ready';
>
> I will try the hard code also

You should generally try your best to avoid using Sleep() in the above
way in most cases. If you have a very simple sequence of waiting times
(in your example you have only one) you can easily get away with
simply placing a TTimer onto your form and using that to generate a
*second* event when the 2 seconds have passed. Using your example with
the status bar text in the first event you would set the statusbar
text to 'My name is Tux', then start the timer and let your method
return. In the timer event set the status bar text to 'am ready' and
then also immediately return. During the 2 seconds between these two
events the GUI will stay fully functional because nothing is blocking
the main thread and other events are able to fire as needed.

The more complicated solution would be to start a thread in the first
event and let the thread do the sleep (or the long running task) but
note that it is absolutely *not* allowed to directly call any LCL
methods from within this worker thread (this makes it slightly more
complicated) you would need to use Synchronize() or
Application.QueueAsyncCall() to notify the main thread.

The general idea is to make sure all your event methods will return as
fast as possible because all the GUI is running from within only one
thread (the main thread) and this is basically the only thread that
should *never* sleep or block or do long computations. As long as one
of your event methods is wasting time in Sleep() (or doing other long
running things) the entire GUI will be frozen during this time, this
will give a very bad user experience, no other events will be able to
fire during this time, no resize, no screen update (this is what you
observed), not even closing the form will be possible.

There are some concepts you should study, they are not restricted to
Lazarus, most GUI frameworks use the event driven concept, so even if
you understand how it works (or how you would do it) for example in
C++/Qt or Java/Swing or in GTK or in wxWidgets or basically almost any
other framework then you can apply the same knowledge to FPC/Lazarus.
Only the Methods will have different names but the problems and their
solutions are the same. Try to find examples, discussions, etc. about
the following topics:

 "event driven programming"
 "TTimer"
 "worker threads"
 "TThread" and "TThread.Synchronize"
 "TApplication.QueueAsyncCall"

And if you are doing networking (I am inferring this from the name of
your method) I strongly recommend using the LNet components, LNet has
an extremely neat architecture and a fully asynchronous event driven
model (no sleeping, no blocking ever) that fits nicely into the rest
of LCL. Unfortunately it is not very extensively documented but on the
other hand it is very small (only ~1000 lines without the optional
protocol units) and its actually quite easy to use.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How do you install Lazarus on Debian?

2012-11-09 Thread Bernd
2012/11/8 Howard Lee Harkness :
> I tried that first. Didn't work. Some problem with
>
> deb http://www.hu.freepascal.org/lazarus/ lazarus-stable universe

You can try the following repository for fpc 2.6.0 and Lazarus 1.0.2:

https://launchpad.net/~prof7bit/+archive/lazarus-1.0.0

I don't know if you can simply do apt-add-repository in debian,
probably not since its an Ubuntu invention  but you can also add the
repository to your sources manually:

deb http://ppa.launchpad.net/prof7bit/lazarus-1.0.0/ubuntu precise main
deb-src http://ppa.launchpad.net/prof7bit/lazarus-1.0.0/ubuntu precise main

These should work with Debian too. First uninstall all lazarus, lcl-*,
fpc, fpc-* and fp-* packages that might exist on your PC after
attemting to install the broken packages from official Debian, add the
above repository to your sources list, apt-get update and apt-get
install lazarus. This will also pull in fpc and fpc-src (2.6.0) from
the above repository.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FPC Source Error: directory not found

2012-11-08 Thread Bernd
2012/11/8 Bernd :
> 2012/11/8 Mark Morgan Lloyd :
>
>> Could ppcXXX return its build directory?
>
> This is not a good idea. For example rpm or deb packages would contain
> a compiler that was compiled in some arbitrary folder and then later
> the sources will be copied to somewhere else by the installer.

Since this problem only ever occurs when fpc is installed manually
(with make) it might be a better idea to provide another make target
in the fpc makefile that would allow to do

sudo make installsource

that would install the sources into $(PREFIX)/share/fpcsrc/$(VERSION)
the same place the installer packages would have installed it and
lazarus is already looking for it and then the official instructions
for installing fpc from source would contain also the above line and
everybody who is following the instructions wold not have to wonder
whether there is a separate procedure to install the sources or what
exactly to install if installing manually, etc.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FPC Source Error: directory not found

2012-11-08 Thread Bernd
2012/11/8 Mark Morgan Lloyd :

> Could ppcXXX return its build directory?

This is not a good idea. For example rpm or deb packages would contain
a compiler that was compiled in some arbitrary folder and then later
the sources will be copied to somewhere else by the installer.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FPC Source Error: directory not found

2012-11-08 Thread Bernd
2012/11/8 Eric Kom :

> After changed the path to /usr/local/lib/fpc/2.7.1/

This is not the source directory.

Judging from your previous pots you have compiled fpc from svn and
sucessfully installed it. make install will only install the binaries
and compiled units where they belong, it will not install the fpc
source.

But the good news is you don't actually need to install it into any
special place, the svn folder where you checked out fpc trunk is
perfectly ok already. Simply point Lazarus to the folder that contains
the fpc sources from svn and Lazarus will find what it needs there.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] how to install fpc trunk

2012-11-05 Thread Bernd
2012/11/5 Eric Kom :
> Good day,
>
> Please how can I install fpc trunk after have fetched from svn?

make all PP="/path/to/bootstrap/compiler"
sudo make install
sudo make -C compiler installsymlink
sudo /usr/local/lib/fpc/2.7.1/samplecfg /usr/local/lib/fpc/2.7.1/ /etc

should do it if nothing essential has changed

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote application

2012-10-30 Thread Bernd
2012/10/30 Michael Schnell :
> On 10/30/2012 12:48 PM, Bernd wrote:
>>
>> * It is possible to attach to a local running desktop (only to the entire
>> Desktop as far as I know) but then the performance degrades heavily
>
> I don't see why this should be that way, but I would need to do further
> investigations to find out if/how this can be avoided when time should come
> to it.

Its probably because of the way NX hooks into the X11 protocol. When
started inside an NX session the applications will *not* connect to
the real xorg xserver but to the virtual NX display server instead
which then does all kind of caching and compression of the X11
protocol when forwarding it to the real display on the client side.
Its probably not posible to do the same when the applications are
already connected to an existing xserver, then it can not intercept
and redirect the X11 communication directly it can only do what vnc
would do: move the final resulting bitmaps over the network that drop
out of the other end of the xorg xserver.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote application

2012-10-30 Thread Bernd
2012/10/30 Michael Schnell :

> 1) the "Server" is an ARM device
> 2) the application is already running (supposedly showing it's GUI on some
> virtual Desktop provided by the NX infrastructure) when NX attaches to it.

* It is possible to attach to a local running desktop (only to the
entire Desktop as far as I know) but then the performance degrades
heavily and becomes a bad as VNC because it seems then it cannot do
the efficient X11 compression and caching and needs to fall back to
VNC protocol, I'm not sure if there are any advantages over VNC in
this case.

* You can start a virtual session through nx and detach from it and
later re-attach, then there won't be performance problems but then you
need to start the application inside an NX session (I'm not sure how
easy it is to initiate this locally (on boot) to create a detached
session with the application running in it without the client actually
connecting and creating it (maybe a scripted local nx client
connecting to localhost, starting the application and then immediately
detaching from it, might be possible with some advanced scripting
trickery).

Alternatively split your application into a service that is started at
boot an running always and a GUI that can be started and stopped at
any time without interfering with the ongoing operations of the
service. This seems to look like a much cleaner solution to your
scenario.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote application

2012-10-30 Thread Bernd
2012/10/29 Santiago A. :

> Thank you very much, that is exactly what I wanted.
> What about performance and latency?

There still is a noticeable delay but it is orders of magnitude faster
than VNC or conventional X11 tunneling. It is comparable to the
performance of RDP.

You should try it and judge yourself:
http://www.nomachine.com/testdrive.php
(you can either try a complete Gnome session or a few selected
applications alone)

And then you should try to setup a server yourself to see how it
behaves in your environment.

BTW: I'm not trying to make advertisement for a nomachine here, there
exist open source implementatios for most of this stuff (the X11
compression and caching protocol is based on open source code
anyways), the server side (for Linux) is available through freenx
(free, open) and the commercial windows client from nomachine is
available at no charge, so it is possible to make all kinds of
experiments with this technology or even setup a production
environment without paying for any licenses.

You should also test whether it is possible to mount local media and
printers if this is needed for your application, I have NOT tested
this because I used it only during a limited period of 6 months last
year and only to gain remote access to some applications that did NOT
need local printers and local drives.

Also other commercial solutions have been mentioned, you should
compare all features and try to test-drive them all. I *personally*
would try to choose NX again (with freenx on the server) because
essential parts of it are based on open source protocols and libraries
and it is mainly centered around Linux on the server side but your
mileage might vary.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Remote application

2012-10-29 Thread Bernd
2012/10/29 Antonio Fortuny :

>>> Using a remote Xwindows server (Are there good Xwindows server for
>>> win32?)
>>
>> I once used XMing. It did work, but I think NX Free seems more advanced.
>>
>> -Michael
>
> Right. I'm using it with OpenSuse 11.2 as server and a Windows client on
> Vista 32. Looks perfect until now.

NX also has the advantage you can just forward one application only,
not the entire desktop. A possible setup would be:

* write the application in Lazarus as usual, compile and install it on
a Linux box (so that it would operate normally if a local user sitting
in front of this linux pc started it it locally)

* install ssh server and freenx on this linux machine

* create a user account for every remote user with normal linux
administration tools.

* install nx client on the windows machine, configure it so that on
login it will start your application (not the desktop session, only
your application.

It will behave similar to old school X11 tunneling a single
application through an SSH tunnel, only 1000 times faster and workable
even on 56k modem connections. It will *not* start a full desktop
session for every user, it will essentially only start your
application as the only process for that user and will seamlessly
integrate all its windows into the client desktop.

Its easy to use for your users, essentially the user just clicks an
icon, enters his password, clicks ok and a few seconds later your
application will pop up on his desktop.

you don't need to design the application in any special way, you just
need to make it work on Linux/GTk2 (or Qt). Setup of nx on the server
is a childs play, at least on ubuntu, the last time i installed it
from scratch I did not need to configure anything, it just worked,
just make sure you can reach your ssh-server from the outside).

Technically it works like this:
* client logs in via ordinary ssh, gets a remote shell on the server
* client executes (through that remote shell) a script that starts nx
display proxy (yes, there is no permanent nx server process running
and waiting, only a thin wrapper gets started through the ssh shell
for each user after login, thats why the only thing that needs to be
configured is the ssh server) and then it starts your application.
* display and user interaction for this application (and all its child
processes and windows) will then be tunneled through the same ssh
connection.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-10-28 Thread Bernd
2012/10/27 Bernd :
> 2012/10/27 Krzysztof :
>
>> make: *** [build] Błąd 2
>
> The real error must have happened earlier, please post the lines
> before this error message.

Error has been found: lazbuild executable was not in the search path
on the build machine.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-10-27 Thread Bernd
2012/10/27 Krzysztof :

> make: *** [build] Błąd 2

The real error must have happened earlier, please post the lines
before this error message.

Also please note that yesterday I have committed a change that
entirely removes the need for a makefile (you can still use one if you
like but it is not auto-generated anymore). For this I also have
changed the default debian/rules file template to replace its
functionality (its probably not complete yet, expect more updates). If
you update to the newest version you must therefore reset the rules
file template.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-26 Thread Bernd
2012/10/26 Martin :
>
> Changing the buildmode should already rebuild the LCL (if something relevant
> changed, compared to the previous buildmode)

Is this in trunk (1.1) because I cannot observe the behavior you
describe in 1.0.3, no matter what compiler or linker settings I set in
my project options, they will only affect the project itself, I could
not find a way to have the LCL compiled with any different settings
than what is defined in the "Build Lazarus" -Settings. I think what
the OP is missing (and I think it would be useful too) would be an
option in the project settings, someting like:

[x] ignore "build lazarus"-settings and compile LCL and other
dependent packages with project settings.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Running on mipsel (was: Re: Cross-compiling -> MIPS)

2012-10-25 Thread Bernd
2012/10/25 Mark Morgan Lloyd :

> something else appeared to be messing up e.g. the IDE's ability to
> store/access ~/.lazarus configuration settings: because of this lazbuild
> wasn't able to build a trivial test project prepared on a different system.

You can put environmentoptions.xml pointing to valid lazarus directory
into /etc/lazarus/ (lazbuild only needs the lazarus directory,
otherwise the xml file can be completely empty) and lazbuild should be
able to build LCL applications without existing ~/.lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets, ´"eventer"

2012-10-25 Thread Bernd
2012/10/25 Michael Schnell :

> I suppose you mean "...is required by the user to be handled". That means
> that the waiting (here of course not "sleeping", as the "sleeping" is done
> in the LCL) is done in some "magical" way in the guts of the lnet code. This
> does sound nice. Could you explain how it is done and if it is done in a
> _decent_ way (i.e. not performing any polling which would introduce latency
> and CPU cycle overhead) ?

On windows it is handled by existing windows API that fires windows
messages on socket events, the recommended way to do networking on
windows. On other widgetsets I have not yet deeply looked into the
code how it is done but I guess it is using the recommended ways to do
this with the help of the widgetset libs directly there too. The code
for these LCL eventers is separate from the rest of the lnet code, its
not in the lib folder, its in the folder that contains the lazarus
packages.

>> All other eventers (select, epoll, kqueue) are only meant to be used
>> when you explicitly not want the events to be generated by the LCL
>> main thread,
>
> Good for applications that don't use the LCL and (maybe) for using it in
> worker Threads.
>>
>> These eventers always
>> block.
>
> That is what I understand an "eventer" does: It blocks until one of the
> affiliated events is scheduled.

exactly. The select eventer for example is just a thin wrapper around
the unix select() function, the TEventer object maintains a list of
sockets it is responsible for and when you call CallAction() it calls
a blocking select() with this list of sockets and after that returns
it loops through all affected sockets and calls their appropriate
OnXxx methods and then CallAction() returns (and you are supposed to
call it again and again).

>> They have a timeout, so you can make them wake up every x
>> milliseconds but still they block all of the time.
>
> So the events that can be affiliated are generated by the socket in question
> plus a timeout. No more ?

See above, the select is called with this timeout parameter to make it
return after some time even if no evens have happened but only meant
to check some things (maybe the program wants to end) and then you are
supposed to immediately call it again. If select() returns because an
event has happened the eventer goes through all affected sockets in
its list and calls the OnRead, OnWrite or OnError methods and the
socket objects themselves (depending on what type they are or which
state they are in) then call their appropriate OnConnect,
OnDisconnect, OnReceive, OnAccept handlers, all that ultimately
happens from the eventer thread and originates from within this
CallAction() call. In the LCL eventer thee calls originate from the
receiving of a windows message sent from the system.

> What do you mean by "LCL eventers" (in fact I already searched the LCL
> source code and "eventer" is nowhere to be found).

Its part of the Lazarus package in lnet (a separate folder in the lnet
download) there you find code that derives from TEventer base class
and implements all the stuff needed to hooks into the LCL and the
widgetset. These eventers do not have this blocking CallAction()
method because they are supposed to somehow register and react to
windows messages on windows (and some similar magic on other
widgetsets, I am not very familiar with this part of lnet becaue I
have spent most of my time with lnet using it inside a non-gui library
and there I have used the select eventer and one dedicated eventer
thread and my own homegrown message pump to communicate between
threads.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-25 Thread Bernd
2012/10/25 Antonio Fortuny :

> You got it. This is how the WinCE application runs:
> user reacts on a Form
> the appropriate form event is lauched
>   some information is needed from the server before carry on any further
> processing
>   ask the net server:
> open connection
> send request
> wait for answer
> close connection
> decide what to do next in case of any error
> process answer and do whatever has to be done
> this means that the application Q cannot be used: the user event method
> cannot be exited before the answer to the remote server. The application is
> freezed, ok.

Here is an alternative way to implement it (this one can even reply
and have a conversation of multiple commands going forth an back
between the client and server):

pocedure OnEverythingGetsStarted;
begin
   if State = WAITING then exit;
   State := WAITING
   maybe also disable some buttons that might interfere
   open the connection
   send the request
   start the timeout timer
   // return from that event
end;

procedure OnTimer;
begin
  if State = WAITING then begin
Disconnect
State := IDLE
enable the disabled buttons
  end;
end;

procedure OnReceive(S: TLSocket);
begin
  Answer := S.GetMessage()
  case Answer of
  'foo': begin
 DoThis();
 SendAnotherCommand();
  end
  'bar': begin
 DoThat();
 SendSomeThingDifferent();
  end
  else begin
 DoWhateverNeedsToBeDone();
 S.Disconnect;
 State := IDLE;
 enable the disabled buttons
  end;
end;

This will never block and never freeze and never eat any unneeded CPU
cycles and it is les code than messing around with the eventers and
CallAction directly and also less code than low level programming
against sockets and/or winsock2 directly.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets, ´"eventer"

2012-10-25 Thread Bernd
2012/10/25 Michael Schnell :

> Some questions:
>
>  - Can such an "eventer" be used in the main thread and in worker threads ?
>  - If used in the main thread, can the "eventer" decently coexist with LCL
> based Events (such as TTimer, GIU, QueueAsyncCall, ...),
>  - If Yes: How ?

The eventer that is used by default when putting an lnet component
onto an LCL form is different from the other eventers that lnet
provides. This one is tightly integrated into the LCL and fires its
event from the main thread, just like button clicks and other GUI
events. No sleeping and blocking is required here by your application
and no worker threads.

All other eventers (select, epoll, kqueue) are only meant to be used
when you explicitly not want the events to be generated by the LCL
main thread, for example when there is no LCL at all because you are
writing a command line program or using a different GUI framework for
which no lnet eventer has been written (yet). These eventers always
block. They have a timeout, so you can make them wake up every x
milliseconds but still they block all of the time. So the usual way to
use them is a separate thread that does nothing other than to wait in
a CallAction() call. All the OnXxxx methods of your socket objects
will then be called from within that thread and you need to take care
of that fact when talking to the main thread. Thats the reason you
should use the existing LCL eventers when you have LCL in your
application, they will free you from all this trouble.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Michael Schnell :

>> WaitForSingleObject ?
>> Is this an LCL application?
>
>
> This is Windows stuff.

I assumed he is making an LCL appplication because LCL exits for
win-CE too. Also there are platform independent locks and events in
the RTL. (RTLEventWaitFor() and friends)

It is not clear to me what exactly "the application needs to wait"
should exactly mean in this context. For example it could just as well
pop up a modal dialog (with a cancel button) and the timer event (or
the receive event, whichever comes first and both would come from the
main thread) could close it again, maybe this would be "waiting"
enough already?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Bernd :

> Is this an LCL application? If yes then you may MOT block the main

sorry, typo: NOT (not MOT)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Antonio Fortuny :

> Question is: The two pieces of code for the timer(1) and the socket(2) will
> they be active when the main thread enters the wait state thru the
> WaitForSingleObject ?

Is this an LCL application? If yes then you may MOT block the main
thread that way. Neither the timer nor the lnet event would be able to
fire anymore, it would be frozen forever.

Why don't you just make it everything entirely evented and do not
block anything?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Michael Schnell :

> AFAIK epoll (and "select()" is strictly Linux based and he wants top use CE.

select eventer works on windows too, this is what TBestEventer will
choose on windows. There are problems when using more than 63 sockets
with the select eventer on windows because the winsock unit has this
hardcoded upper limit in it (while it would be configurable in the
original C headers) but the svn version of lnet includes a patch that
will change this number to 1023 to make it comparable to the unix
implementations.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Deep exe strip :)

2012-10-24 Thread Bernd
2012/10/24 Krzysztof :

>
> 2. Same project options, but IDE rebuild with -CX and -XX options

Note that you do not actually need to rebuild the IDE, it is enough to
just change the IDE build options, save and then rebuild your project.
It will then rebuild on demand only those parts of the LCL and
packages for your project that are actually needed by your project and
not the entire IDE.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Antonio Fortuny :

>> Its all meant to be used completely asynchronously. The easiest way
>> would be to start a TTimer and when the timer event fires check
>> whether you have received an answer already or otherwise close the
>> connection.
>
> Yeah. Got the same with my Sleep loop.
> Not very clean.

You can also run the lnet in some kind of blocking mode, for this you
need to assign a different eventer. (select eventer or epoll eventer
or TBestEventer to automatically chooe the most appropriate eventer)
and then you make a separate thread that will just call the CallAction
method in an infinite loop. CallAction will block until an event
happens and then you call it again and again. Note that with this
approach all your lnet event methods will be called from within this
event thread.

You can either use only one eventer (and only one event thread) for
all your sockets (if you have multiple connections going on
simultanously)  or alternatively you could also create a new separate
eventer and a new separate thread for each new connection. The latter
will give you the same functionality as with blocking sockets.

The eventer has a timeout property, if you set it to a non zero value
in milliseconds the callaction call will block only up to that amount
of time, this way you can also count time and trigger actions on
timeout in the eventer thread (and if you make one separate eventer
thread for every connection you can easily achieve what you are trying
to do).

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Bad quality packages on Ubuntu 12.10 - x64

2012-10-24 Thread Bernd
2012/10/24 Kjow :
> Same thing of http://bugs.freepascal.org/view.php?id=22598

Please try the packages from the PPA below:
https://launchpad.net/~prof7bit/+archive/lazarus-1.0.0

They are *unofficial* alternative builds using a different way of
packaging (If you find problems with packaging please tell me). The
above PPA currently provides fpc-2.6.0 and Lazarus 1.0.2


There is also an unofficial PPA containing nightly FPC-2.6.1 (Precise
and Quantal):
https://launchpad.net/~prof7bit/+archive/fpc-2.6-latest

and an unofficial PPA containing nightly Lazarus 1.0.3 (Precise and Quantal):
https://launchpad.net/~prof7bit/+archive/lazarus-1.0-latest

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lnet sockets

2012-10-24 Thread Bernd
2012/10/24 Antonio Fortuny :

> Connect to server
> send the request
> wait for answer <<<-- this is the point
> check answer OR timeout
> disconnect
>
> I can't firgure out where the check for a timeout as the component does not
> implement nor defines any property or method to deal with timeouts.
> The event (that I use) OnReceive does its job

Its all meant to be used completely asynchronously. The easiest way
would be to start a TTimer and when the timer event fires check
whether you have received an answer already or otherwise close the
connection.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-21 Thread Bernd
2012/10/20 Bernd :

> I found another one while trying to package current trunk (svn39145)
> to install into /usr/lib/lazarus, this one is in synedit:
>
> components/synedit/design/languages

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

Patching also some other Makefile problems.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-20 Thread Bernd
2012/10/17 Mattias Gaertner :
> Don't try. Just create the output directories to make mkdir -p happy. They 
> don't
> hurt.

I found another one while trying to package current trunk (svn39145)
to install into /usr/lib/lazarus, this one is in synedit:

components/synedit/design/languages

If the directory exists and is empty I can re-build the IDE, otherwise
it will throw an error and fail.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Bernd
2012/10/17 Mattias Gaertner :

> Looking for startlazarus in the search path might find one of a different
> version. Then you can get very strange errors. So if possible I would avoid
> searching in path.

This should not be possible since the deb would have installed its own
startlazarus symlink into /usr/bin

There is one more minor problem with startlazarus I noticed: If
lazarus folder is /usr/share/lazarus and startlazarus and lazarus
executables exist in lazarus folder and custom built lazarus is in
~/.lazarus/ then startlazarus will ask the user which lazarus to start
(the system installed or the one in the config directory).

But when the entire lazarus folder is in /usr/lib/lazarus (exact same
direcrory layout, only everything in /usr/lib instead of /usr/share
then startlazarus will always immediately start the custom built
lazarus in ~/.lazarus all the time without asking. This is not a big
problem since this is what the user most likely wanted to do anyways
and relatively easily circumvent by starting lazarus-ide (which points
to /usr/lib/lazarus/lazarus) from the command line but I think
(without looking at the code now) this means that there are still some
hardcoded paths in startlazarus where to look for the natively
installed lazarus (instead of using the lazarus dir setting and
finding it in /usr/lib/lazarus)

Now  if I make an (almost empty) folder /usr/share/lazarus and copy
only the two binaries (startlazarus and lazarus) over to
/usr/share/lazarus (but not making any config changes, just put copies
of those two binaries there) then starting startlazarus (when started
from within /usr/shar/lazarus) will again open the question dialog.
(but the one in /usr/lib/lazarus will still not see it, it only works
when started from within /usr/share/lazarus!)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-17 Thread Bernd
2012/10/17 Mattias Gaertner :

> True. But Lazarus and fpc easily need one or two GB, so 45MB is not that much.
> And it is some kind of show stopper if the IDE recompiles everything to 
> install
> one package.
> Of course the binary will be smaller and some users have slow internet.
> So it has pros and cons. I can live with it.

Yesterday after doing more rigorous attempts to remove *all* binaries
from the install directory (so that contents of /usr/share/ becomes
truly architecture independent which is a *must* and the very
definition and purpose of /usr/share/) I noticed that this gives some
more subtle problems, when restarting the IDE after successful rebuild
of the IDE it will look for startlazarus in the lazarus folder (and
not on the search path). Therefore I have for now decided to install
the entire lazarus into /usr/lib/lazarus and leave the executables it
is looking for where they are.

This would make it possible to leave also the compiled units in the
lazarus folder again (but of course only makes sense if I don't
compile them with custom options). In the end this is only a change of
one line in the rues file and does not break other things and it is
nice to know that it is at least possible to make such a stripped down
installer that still provides a fully functional Lazarus.

> I'm not sure I can follow you here. How can I reproduce the bug?

It is because of the typical directory layout when building a .deb
package. I will try to explain. Consider this simple hello world
directory layout after unzipping and preparing the source for package
building immediately before the actual build is started:

hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr

after "make all" it might look like this:

hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr
hello-world-1.0/hello.ppu
hello-world-1.0/hello.o
hello-world-1.0/hello

now it will call "make install" with PREFIX set to a special path that
it will later use to zip the installation contents. This PREFIX folder
is a subdirectory of the debian folder!

Our example makefile (just for illustration purpose) would for example
install into $(PREFIX)/lib/hello and also a symlink into $(PREFIX)/bin
so after make install it should look like this:

hello-world-1.0/debian/hello-world/usr/lib/hello/hello
hello-world-1.0/debian/hello-world/usr/bin/hello  -> ../lib/hello/hello
hello-world-1.0/debian/changelog
hello-world-1.0/debian/control
hello-world-1.0/debian/rules
hello-world-1.0/Makefile
hello-world-1.0/hello.lpi
hello-world-1.0/hello.lpr
hello-world-1.0/hello.ppu
hello-world-1.0/hello.o
hello-world-1.0/hello

then after make install has completed debhelper tools will zip
everything below debian/hello-world/ and make it the data.tar.gz
member of the .deb

the reason why "make install" of lazarus fails is that at one point it does a

cp -r . $(PREFIX)/share/lazarus/

and with prefix set to ./debian/lazarus/usr this will expand like that:

cp -r . ./debian/lazarus/usr/share/lazarus/

which would attempt to copy the entire folder (*including* the debian
folder!) into a subdirectory of itself (into the debian folder) and
this will fail with error, cp will refuse to do this, it will start
copying a few files but then when it comes to copying the ./debian
folder into ./debian/lazarus/usr/share/lazarus/ it will abort with
error.

this can be avoided by either copying only the needed files
explicitly. I worked around this by installing into a temp dir
*outside* the current directory and then in a separate step moving it
back into ./debian/lazarus/usr where debhelper tools will expect it to
be and removing the debian directory (and other unwanted stuff) from
the final install directory again.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: Build-Depends: imagemagick

2012-10-17 Thread Bernd
2012/10/17 Kamen Ketev :

> Arrows not shown. I think this is because I am new and can't transfer from
> win to linux. Is there a way to automatically compile from Windows to Linux?

Its more complicated to set up a working cross-compiler from windows
to linux than the other way around, installing and using the cross
compiler on linux is much simpler. But this will not help with the
subtle differences that different LCL widgetsets are having, they are
not intentional (some of them are bugs) but some subtle differences in
behavior simply cannot be avoided, you will still have to test your UI
on Windows and Linux separately.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Fwd: How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-16 Thread Bernd
Sorry, again the message went only to Mattias while I thought we were
still talking on the mailinglist, It must be the gmail web interface
that sometimes makes it easy to accidentally press the wrong reply
button or the reply on the wrong copy of the message while gmail still
makes it appear as if it were part of the original thread. Here again
a copy (sorry for eventual duplicate)

-- Forwarded message --
From: Bernd 
Date: 2012/10/16
Subject: Re: [Lazarus] How to change default editor font *before*
primary config ~/.lazarus is created?
To: Mattias Gaertner 


2012/10/16 Mattias Gaertner :

>> OPT="-g- -Xs"
>
> Why?

I'm still working on it on my local pc (with rather slow disk) and
want fast compiles and small files. Also because I do not actually use
the compiled units I am only interested in a stripped lazarus binary,
for running on the build farm (which are much more powerful machines)
I would even add -CX -XX here.

>> override_dh_auto_clean:
>> $(MAKE) -C $(ORIG) cleanbigide distclean
>> find $(ORIG) -name "*.a" -exec rm {} \;
>> $(RM) $(ORIG)/lazarus
>> $(RM) $(ORIG)/startlazarus
>> $(RM) $(ORIG)/lazbuild
>> $(RM) -r /tmp/lazarus
>
> Better start with an svn export.

This is again a convenience for me doing repeated builds on my local
machine. On the build server the $(ORIG) folder will contain a freshly
unzipped upstream tarball or for my nightly fixes on launchpad it will
contain a fresh snapshot of the fixes branch (this is created newly
every time by a bzr-builder recipe from a mirror of the lazarus fixes
branch in the launchpad bzr repository).

This could be created by a separate script when run locally (it may
*not* happen inside rules because the build servers do not have access
to anything other than what is contained in the source package when
the build has started)


>> # we do not need to install any of the compiled units because
>> # they are never used, they would be a waste of disk space.
>> # everything will be compiled on demand into ~/.lazarus/lib/
>> find $(ORIG) -name "*.ppu" -exec rm {} \;
>> find $(ORIG) -name "*.o" -exec rm {} \;
>> find $(ORIG) -name "*.a" -exec rm {} \;
>
> Maybe not a good idea: The compile takes a lot of time, on multi user systems
> (e.g. student pools) you get duplicates, home can be on a network share 
> (slow).

This is a valid point. But is it really significant for most users or
for typical users nowadays? At one point (when they change lazarus
build options) it will compiled into ~/.lazarus/ anyways. And its
really fast, even on my very old laptop and happens only for the very
first time (and then only after options have changed but this would
happen anyways). On the other hand all the above brings down my entire
deb package to only 45MB and reduces installed size in /usr/share
greatly.

>> # we cannot directly install into $(ROOT)/usr
>> # because lazarus make install is broken (copy into itself)
>> # so we install into a temp dir outside of this tree
>> # please fix this in lazarus makefile
>> $(MAKE) -C $(ORIG) install PREFIX=/tmp/lazarus/usr
>
> This works here:
> sudo make install

no, it cannot work. The typical setup for package building is that
$(ORIG) and $(CURDIR) are identical (debian folder is in the same
directory as the top level makefile). Actually I made this distinction
between $(ORIG) and $(CURDIR) only because I need to workaround it for
my nightlies because of the existing debian folder (i complained
about) i cannot merge upstream and my own packaging, so i nest entire
upstream into a subdirectory but I do this only for the nightlies and
this is a very ugly hack and I ultimately want to avoid it. Ideally
and normally $(ORIG) and $(CURDIR) are identical.

And when ./debian/lazarus/usr/ is a subfolder of ./ then the following
cp -r . ./somewhere/ will fail with error about recurively copying a
folder into a subdirectory of itself. It should instead copy only what
it needs explicitly.

>> # install forgot to install desktop start menu item
>> # please fix this in lazarus makefile
>> mkdir -p $(ROOT)/usr/share/applications
>> mkdir -p $(ROOT)/usr/share/pixmaps
>> cp $(ORIG)/install/lazarus.desktop $(ROOT)/usr/share/applications/
>> convert $(ORIG)/images/icons/aqua.ico[0] 
>> $(ROOT)/usr/share/pixmaps/lazarus.png
>
> Do not use 'cp'. Use 'install':

yes, you are right, install would be better.

>> # the following is INCOMPLETE and its only a dirty workaround!
>> # create most probably needed unit directories for rebuilding ide
>> # the ide - when building itself - will try to mkdir -p them
>
> ok

mkdir -p unit output directory seems to happen though some
autogenerated (by fpcmake) snippet of makefile code that is
automatically in all fpcmake Makefiles, it will probably not be easy
to remove it.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-16 Thread Bernd
2012/10/16 Bernd :

> Yes it is copied, one can see this when halting execution in the
> constructor of TEditorOptions but when continuing to run some
> milliseconds later it is overwritten with an almost empty default
> file. Tested with 1.0.2 and 1.0.3 from yesterday.

I have tried to debug it last night to find the reason for this
behavior until my eyes hurt, I could not find it. Then as a desperate
workaround I patched main.pp right after the command line options are
parsed and then it started working as expected. But this is *not a
fix*, its only a dirty workaround:

--- ide/main.pp.orig2012-10-15 23:22:20.0 +0200
+++ ide/main.pp 2012-10-15 23:32:02.0 +0200
@@ -1291,6 +1291,9 @@
   DebugLn('TMainIDE.ParseCmdLineOptions:');
   Debugln('  PrimaryConfigPath="',UTF8ToConsole(GetPrimaryConfigPath),'"');
   Debugln('  SecondaryConfigPath="',UTF8ToConsole(GetSecondaryConfigPath),'"');
+
+  DebugLn('work around bug: copy editor options template early');
+  LazConf.CopySecondaryConfigFile('editoroptions.xml');
 end;

 procedure TMainIDE.LoadGlobalOptions;

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-16 Thread Bernd
2012/10/16 Mattias Gaertner :
>
> Are you reinventing the wheel or do you use the deb scripts that are used for 
> sf
> packages?

I studied these scripts for some inspiration but I cannot use them as
they are for the ubuntu build servers. They are constructing a package
from the outside (they are putting the files together and calling the
dpkg tools explicitly) but the way it should work is to have the
package build *itself* with its rules file. debuild will first look
for the debian folder, changelog, control and rules already in place
and then call the targets in debian/rules that will perform the build
and installation process.

Ideally (in a perfect world where make install does a correct and
complete intallation) the rues file (which itself is a makefile too)
would just look like this:

override_dh_auto_clean:
make clean

override_dh_auto_build:
make bigide

override_dh_auto_install:
make install PREFIX=$(CURDIR)/debian/lazarus/usr

%:
  dh $@

This (along with the metadata in the other debian files) would
normally be all that is needed to debianize any piece of software.
When uploaded to the build servers they will unzip, look for the
debian folder and call the targets in debian/rules.

currently my rules file looks like this (its still quite simple, 70%
of it are comments with my rants about shortcomings of make install):

#!/usr/bin/make -f

OPT="-g- -Xs"
ROOT = $(CURDIR)/debian/lazarus
ORIG = $(CURDIR)


override_dh_auto_clean:
$(MAKE) -C $(ORIG) cleanbigide distclean
find $(ORIG) -name "*.a" -exec rm {} \;
$(RM) $(ORIG)/lazarus
$(RM) $(ORIG)/startlazarus
$(RM) $(ORIG)/lazbuild
$(RM) -r /tmp/lazarus

override_dh_auto_build:
$(MAKE) -C $(ORIG) bigide OPT=$(OPT)

override_dh_auto_install:
# we do not need to install any of the compiled units because
# they are never used, they would be a waste of disk space.
# everything will be compiled on demand into ~/.lazarus/lib/
find $(ORIG) -name "*.ppu" -exec rm {} \;
find $(ORIG) -name "*.o" -exec rm {} \;
find $(ORIG) -name "*.a" -exec rm {} \;

# we cannot directly install into $(ROOT)/usr
# because lazarus make install is broken (copy into itself)
# so we install into a temp dir outside of this tree
# please fix this in lazarus makefile
$(MAKE) -C $(ORIG) install PREFIX=/tmp/lazarus/usr

# because of the above now need to move it where it belongs
mkdir -p $(ROOT)
mv /tmp/lazarus/usr $(ROOT)/
$(RM) -r /tmp/lazarus

# install forgot to install desktop start menu item
# please fix this in lazarus makefile
mkdir -p $(ROOT)/usr/share/applications
mkdir -p $(ROOT)/usr/share/pixmaps
cp $(ORIG)/install/lazarus.desktop $(ROOT)/usr/share/applications/
convert $(ORIG)/images/icons/aqua.ico[0] 
$(ROOT)/usr/share/pixmaps/lazarus.png

# install forgot to install mime-types file and icons
# please fix this in lazarus makefile
mkdir -p $(ROOT)/usr/share/mime/packages
mkdir -p $(ROOT)/usr/share/icons/hicolor/48x48/mimetypes
cp $(ORIG)/install/lazarus-mime.xml 
$(ROOT)/usr/share/mime/packages/lazarus.xml
cp debian_other/mime_icons/* 
$(ROOT)/usr/share/icons/hicolor/48x48/mimetypes/

# install default config files
# please fix this in lazarus makefile
mkdir -p $(ROOT)/etc/lazarus
cp debian_other/etc/* $(ROOT)/etc/lazarus/

# remove all symlinks (entire /usr/bin), we let them create
# automatically through the debian/links file
$(RM) -r $(ROOT)/usr/bin

# unneeded stuff left over in the install directory
$(RM) -r $(ROOT)/usr/share/lazarus/install
$(RM) -r $(ROOT)/usr/share/lazarus/debian
$(RM) -r $(ROOT)/usr/share/lazarus/debian_other

# the following is INCOMPLETE and its only a dirty workaround!
# create most probably needed unit directories for rebuilding ide
# the ide - when building itself - will try to mkdir -p them
# which would fail because of permissions but it will never actually
# write anything into them (it will use ~/.lazarus/units/ instead)
# we are perfectly happy if these directories exist and are empty.
# Launchpad has only two architectures and Lazarus only two stable
# widgetsets for Linux, so I am creating only those directories.
# please fix this in lazarus makefile
mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/gtk2
mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/qt
mkdir -p $(ROOT)/usr/share/lazarus/units/i386-linux/nogui
mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/gtk2
mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/qt
mkdir -p $(ROOT)/usr/share/lazarus/units/x86_64-linux/nogui

# probably a lot more stuff nee

Re: [Lazarus] How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-15 Thread Bernd
I have filed a bug. There is something strange going on during IDE
startup that defies all logic:

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] How to change default editor font *before* primary config ~/.lazarus is created?

2012-10-15 Thread Bernd
I'm making a new installer for Lazarus on Debian and Ubuntu because
the existing ones in their repositories are just plain wrong and
broken beyond repair. I got everything working smoothly now, the only
remaining (minor) problem is to replace the default editor font
"Courier New" with something more appropriate on a Linux desktop.

Unfortunately Lazarus is ignoring /etc/lazarus/editoroptions.xml
(according to strace it is opening the file but its contents do not
seem to have any effect on the default font or any other editor
setting I have tried. Is this a bug? I think so!)  Where would be the
proper place to patch the Lazarus sources, I grepped the Lazarus
sources for "Courier New"  but the only place that came up and made
sense in this context was synedit.pp but I doubt its a good idea to
simply patch the default font for SynEdit itself, I would rather avoid
to patch anything that could potentially be linked into a user's
application compiled with Lazarus.

Where should I have a look to either fix this bug (ignoring secondary
config file) or to properly patch the default font?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fwd: Build-Depends: imagemagick

2012-10-15 Thread Bernd
2012/10/15 Kamen Ketev :

> I install Lazarus from  Debian Repository  under Ubuntu and compyle new
> project without problem.

is the 0.9.30 version from the Debian repositories better than the
0.9.30 from the Ubuntu repositories? The Ubuntu version is missing all
.lpk files in the components directory and because of this refusing to
start without errors, it is missing a dependency on fpc-source which
must therefore be installed manually, it is constantly trying to save
a config file /usr/lib/lazarus/0.9.30.2/JCFSettings.cfg which is of
course not writable by user and if you finally get it running it will
not compile anything - not even the empty default project - because it
cannot find unit interfaces.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Fwd: Build-Depends: imagemagick

2012-10-13 Thread Bernd
[forwarded another copy to the list because of mailinglist was missing
in recipients]

2012/10/8 Mattias Gaertner :

>  That's a lot
> of work and I'm glad they do it.

The problem is the Debian packages from Debian don't do it either!

They consist of many hundred lines of convoluted unmaintained(!)
script that is trying to press every possible button the debian
packaging system provides (except the new dh overrides which would
simplify matters) (it has meta-packages and virtual packages and
versioned packages, it is using update-alternatives for no reason (who
wants to install two different ancient(!) versions of Lazarus
simultaneously?)), it is ripping apart lazarus into many small pieces
and introducing new bugs and damaging Lazarus' reputation and the only
thing it is *NOT* doing is installing all needed files where they
belong! It does not install mime types, it is trying to intstall a
default config file that does not even exist anymore, when you start
it for the first time it will complain about wrong paths and packages
installed but no .lpk files found (probably because lazarus-ide fails
to depend on lazarus-src which is *essential* for using the ide, why
did they split it in the first place?), even a simple make install
even in the current limited form would immediately give a better
install than the debs from Debian.

I would rather not see any of these half-baked and broken Debian
packages at all in any of the repositories so that no new user
accidentally installs them and then immediately comes to the
conclusion that Lazarus is completely broken and unusable because that
is exactly what currently happens when one installs Lazarus from the
Ubuntu software center.

I vote for dumping this broken and unmaintained packaging entirely and
rewrite it from scratch in a much simpler way with only two packages,
one containing everything needed for building from the command line
with lazbuild and another package containing the ide, the source and
all the rest that is needed to use the ide because this is the only
logical and natural separation that would make sense. Everything going
beyond that would be nonsense and wasted manpower.

If Lazarus and Pascal programming and Pascal units are by design
incompatible with the way how Debian is organized or how its ancient
bureaucratic policies blindly dictate and they cannot put such simple
and working packages into their Repository then so be it! It doesn't
matter! An alternative repository can be set up in one afternoon and
Debian could no longer damage the reputation of Lazarus by providing
ancient and broken packages.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Include files extension

2012-10-11 Thread Bernd
2012/10/10 Marco Aurelio Ramirez Carrillo :

> Altought FPC, allows you to include a text file with any extension, I
> would like to propose that the Lazarus I.D.E.
> explicitly allows an additional file extension,
> maybe "*.incpas", "*.ipas" or "*.incp".

I'm not a fan of too many different file extensions for the same
purpose. Ideally there should only be one and personally I even find
the existence of *.pp vs. *.pas already a bit annoying.

My own practical problem with file extensions is that services like
for example github don't know all possible file extensions when it
comes to syntax highlighting or collecting info about used programming
languages (I want to contribute pascal usage to the statistics) and my
personal solution to circumvent this is to use only .pas for my own
code and even my include files now all have the extension .pas
(currently I am using inc_something.pas or unitname_inc_something.pas
so that all my include files appear next to each other in a directory
listing, previously I have tried to use .inc.pas but Lazarus did
complain about dotted names so I don't do this anymore)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Please define "delphi compatibility"

2012-10-10 Thread Bernd
2012/10/10 Bernd :

>> I am often doubting whether it is worth to stay with Pascal.
>> If it is an dead end I would not want to waste any more time on it.
>
> Is here any alternative that can seriously compete with FPC/Lazarus?
s/here/there

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Please define "delphi compatibility"

2012-10-10 Thread Bernd
2012/10/10 Jürgen Hestermann :

> I am often doubting whether it is worth to stay with Pascal.
> If it is an dead end I would not want to waste any more time on it.

Is here any alternative that can seriously compete with FPC/Lazarus?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Documentation for the packages shipped with Lazarus

2012-10-10 Thread Bernd
2012/10/10 Kenneth Cochran :

> My final question is: If I were to research each of these packages and
> determine their purpose how would I go about contributing more detailed
> descriptions?

You could send a patch for each package that updates its description
to the Lazarus bug tracker, there is a section "patches" in the bug
tracker, this way each of your contributions can't be accidentally
forgotten, has a number you can refer to and you can comfortably track
which of them is still open. The mailing list has a tendency to
"forget" things after a while if they are not super critical or
somebody is not already working on it.

The simplest way to generate the patch is to check out svn trunk, make
your changes locally and then use svn diff to generate the patch file
for the changed files. (make sure the patch file affects only the
files and contains only the changes you actually want to submit and
not other unrelated changes). After this you can still use svn up to
keep it synched with trunk even in the presence of local changes.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-09 Thread Bernd
2012/10/9 Sven Barth :

> Than this seems to apply only to non-Windows platforms indeed... (or maybe
> only if the external linker is used).

Yes. Probably ld simply needs it this way while the internal linker
can more or less implement it like it wants.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] FPC-2.6.1 daily build for Ubuntu Precise and Quantal, i386 and amd64

2012-10-08 Thread Bernd
I have set up a daily build of latest 2.6.1:
https://code.launchpad.net/~prof7bit/+archive/fpc-2.6-latest
ppa:prof7bit/fpc-2.6-latest
(should update automatically from now on without manual intervention)

and also (because I needed it once for bootstrapping and will also
need it for lazarus-1.0.0) two builds of fpc-2.6.0 (for Precise only)
https://launchpad.net/~prof7bit/+archive/fpc-2.6.0
ppa:prof7bit/fpc-2.6.0

I have not used the official debian packaging files, instead I have
made a much simpler packaging (similar to the ones produced by the
build scripts in lazarus/tools/install) they consist of only two
packages: fpc and fpc-source and replace all the fpc-* and fp-* from
the official debian/ubuntu packages.

Please test.

I am planning to do the same with lazarus 1.0.0 and 1.0.x during the
next few days

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Sven Barth :

> You just need to test yourself: create a unit with a bit of code and compile
> using "-CX". At least on my system I haven't found a "libUNITNAME.a" file.

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--
--($)-- ls
insgesamt 20
drwxr-xr-x  2 bernd bernd 4096 Okt  9 01:44 .
drwx-- 12 bernd bernd 4096 Okt  9 01:37 ..
-rw-r--r--  1 bernd bernd   48 Okt  9 01:39 prog.pas
-rw-r--r--  1 bernd bernd   51 Okt  9 01:41 unita.pas
-rw-r--r--  1 bernd bernd   51 Okt  9 01:41 unitb.pas

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--

--($)-- cat prog.pas
program prog;

uses
unita,
    unitb;

begin
end.

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--
--($)-- cat unita.pas
unit unita;

interface

implementation

begin
end.

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--
--($)-- cat unitb.pas
unit unitb;

interface

implementation

begin
end.

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--
--($)-- fpc -CX -XX prog.pas
Free Pascal Compiler version 2.6.0 [2012/10/07] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling prog.pas
Compiling unita.pas
Compiling unitb.pas
Linking prog
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
24 lines compiled, 1.5 sec

--(bernd@t40)-(/home/bernd/Desktop/smartlinktest)--
--($)-- ls
insgesamt 104
drwxr-xr-x  2 bernd bernd  4096 Okt  9 01:46 .
drwx-- 12 bernd bernd  4096 Okt  9 01:37 ..
-rw-r--r--  1 bernd bernd 16026 Okt  9 01:46 libpprog.a
-rw-r--r--  1 bernd bernd  8988 Okt  9 01:46 libpunita.a
-rw-r--r--  1 bernd bernd  8988 Okt  9 01:46 libpunitb.a
-rwxr-xr-x  1 bernd bernd 21980 Okt  9 01:46 prog
-rw-r--r--  1 bernd bernd  1696 Okt  9 01:46 prog.o
-rw-r--r--  1 bernd bernd48 Okt  9 01:39 prog.pas
-rw-r--r--  1 bernd bernd   791 Okt  9 01:46 unita.o
-rw-r--r--  1 bernd bernd51 Okt  9 01:41 unita.pas
-rw-r--r--  1 bernd bernd   624 Okt  9 01:46 unita.ppu
-rw-r--r--  1 bernd bernd   791 Okt  9 01:46 unitb.o
-rw-r--r--  1 bernd bernd51 Okt  9 01:41 unitb.pas
-rw-r--r--  1 bernd bernd   624 Okt  9 01:46 unitb.ppu

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Sven Barth :
>> afaik .a result from compiling with -CX.
>
>
> No. They are necessary for DLL imports at least on the Windows platforms.

citing the manual: http://www.freepascal.org/docs-html/prog/progse29.html

"When a unit foo.pp is smartlinked, the name of the codefile is
changed to libfoo.a.

Technically speaking, the compiler makes small assembler files for
each procedure and function in the unit, as well as for all global
defined variables (whether they’re in the interface section or not).
It then assembles all these small files, and uses ar to collect the
resulting object files in one archive. "

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Mattias Gaertner :

> .a are not created.

here are 1082 .a files left over after cleanbigide cleanall clean distclean:
http://pastebin.com/dY1ih1K0

and 44 .res files:
http://pastebin.com/dyUFMRdM

I could not find any .ppu or .o but after removing all these a files
compressed size is reasonable 46MB again. Ideally make clean would rm
-rf all these i386-linux folders entirely, the makefile should know
the folder name for the current architecture and os.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Mattias Gaertner :

> No. Bernd, please help us to fix the bug.

Yes, this is my intention. I also have one or two complaints about
make install as it is currently (it will fail with error when run by
dh_auto_install because of recursive copy into itself, thats why I am
now forced to not use it at all and instead copy all stuff manually, I
will file a bug for this too.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build-Depands: imagemagick

2012-10-08 Thread Bernd
2012/10/8 Mattias Gaertner :

> The Makefile is critical and therefore maintained by the Laz devels.
> The debian files are maintained and understood only by the debian package
> maintainers.

Thats why I said: remove it from lazarus sources entirely.

And encourage debian maintainers to give *feedback*, file bugs if they
find that original make install does something incredibly stupid (for
example not respecting $(DESTDIR) or doing a recursive cp -r .
$(SOMEWHERE)  that will fail if the $(SOMEWHERE) is a sub directory
and similar things). Unfortunately debian maintainers have the habit
of giving no feedback at all, not even asking how things are supposed
to work and rather spend lot of time to write hundreds of lines of
completely redundant *duplicate* makefile *from scratch* instead of
just asking the original makefile authors to make it accept just one
more variable.

Ideally the debian/rules file should just call the original make
install which will then do a proper install suitable for most systems
out of the box and then do only some minor adjustments to satisfy
debian policy. They should not be forced or even encouraged to rewrite
almost the entire makefile from scratch.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Mattias Gaertner :

> .a are not created.

afaik .a result from compiling with -CX.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-08 Thread Bernd
2012/10/8 Graeme Geldenhuys :

> My point is, a simple 'find ...' command will not clean out all
> non-repository files. You need something a bit more intelligent like
> 'git clean'.

git-clean is also only a workaround, its just using the information it
knows about which files are version controlled and which are not (and
I can only use it on my local machine, not inside a build script on
sources that are uploaded to launchpad). Ideally the clean target of
each makefile in each directory should exactly know which files (and
which folders) could have been created and rm -rf them.

I'm going to make a diff to see what exactly is left behind (which
makefiles are broken) but not today (and also not tomorrow). Until
then I think I use the recursive find method as a quick & dirty hack
just to get the sheer file size down before uploading to launchpad
(Currently I'm mostly worried about file size because I have slow
ADSL, not so much about empty directories).

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Build-Depands: imagemagick

2012-10-08 Thread Bernd
2012/10/8 Mattias Gaertner :

> In debian/rules the 48x48 icon is downsized to 32x32.
> The sf debian packages simply install the 128x128 icon, which is
> needed by nowadays desktops.
>
> So, maybe the debian/rules file should be adapted.

I believe much of the stuff in debian/rules should go into the
Makefile itself and be maintained there.  Its not really easy to see
which parts of this rues file exist only to satisfy debian policy and
which part exist simply as a complete *replacement* of the original
make install and which parts are outdated or not needed anymore. make
install is used a lot of times by many people but debian/rules is used
only once or twice per year and as soon as it has successfully built
the package it is left alone again for another 6 months. This is why I
think it should be *small*, only a *thin* wrapper around often used,
well tested and maintained makefile targets, not a full blown
alternative makefile on its own.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] make clean is leaving more than 20MB stuff behind (this number is after compression!)

2012-10-07 Thread Bernd
I also tried distclean cleanall cleanbigide

There are compiled units all over the place in lib/* folders left over
after clean, a fresh download compresses into 46MB tarball, after
first successful build I cannot get it smaller than 65MB. How do I
*really* clean the source directory? Is there yet another makefile
target for this purpose or do I have to write a script and recursively
find and delete all these files myself?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Build-Depands: imagemagick

2012-10-07 Thread Bernd
I found this in debian/control. Which part of Lazarus depends on
imagemagick during building of Lazarus?

Also please could this entire debian directry please be removed
entirely? It really make packaging much more complicated. Original
upstream sources should not contain any debian packaging data, the
package maintainer will maintain and provide this directory on his own
and patch it into the original sources during packaging, this way also
the debian changes diff (changes between orig.tar.gz and deb package)
becomes much more clear and meaningful.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] fpc version 2.6.1 source code

2012-10-05 Thread Bernd
2012/10/5 Mattias Gaertner :
> On Thu, 4 Oct 2012 15:10:23 +0200
> Bernd  wrote:
>
>> 2012/10/4 Eric Kom :
>>
>> > I never browse the lazarus source code from svn, let me clone and see. So
>> > ask you are saying the lazarus developer are already make a build script 
>> > for
>> > .debs package inside the lazarus source directories?
>>
>> Yes. And I believe these are the exact same scripts that are also used
>> to produce the debs on sourceforge, fpc, fpc-source and lazarus.
>
> No. The three on sf are created by the
> scripts in tools/install.

These are the ones I was talking about. Are there more alternative
install deb build scripts somewhere hidden in the lazarus source tree?
Is the makefile target Vincent mentioned doing something different? (I
have tried only these scripts directly, never the make deb target)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] fpc version 2.6.1 source code

2012-10-04 Thread Bernd
2012/10/4 Eric Kom :

> I never browse the lazarus source code from svn, let me clone and see. So
> ask you are saying the lazarus developer are already make a build script for
> .debs package inside the lazarus source directories?

Yes. And I believe these are the exact same scripts that are also used
to produce the debs on sourceforge, fpc, fpc-source and lazarus.

The debs in the official Debian repository are built by someone else
(someone from Debian) using a different method and I believe thats
also the reason why the Debian debs are needlessly split into a myriad
of separate packages while the ones resulting from the Lazarus build
scripts are just fpc, fpc-source and lazarus.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] fpc version 2.6.1 source code

2012-10-04 Thread Bernd
2012/10/4 Eric Kom :

> Thats is the problem, I used to package for debian before, I will see what I
> can do

There are script in one of the the lazarus directories that will build
and package .debs for fpc and lazarus from your intallled version. So
if you have a working fpc/lazarus installed locally you could try to
invoke these build scripts to locally build binary .deb packages from
the sources that you have from svn.

Then you could either directly give these debs to other users (to
manually install with dpkg -i) or use the reprepro tool to set up a
debian repository with these debs and put the resulting directory
structure on a webserver and others could add this url to their
sources.list and use them with apt-get

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] fpc version 2.6.1 source code

2012-10-04 Thread Bernd
2012/10/4 Eric Kom :

> am a debian user, they is not lazarus 1.1 on debian, and the deb packages
> provide on lazarus project doesn't provide the version 1.1 with fpc above
> 2.6.0 so not support for mysql5.5 users

The Debian/Ubuntu situation is very catastrophic at the moment. There
is not even a Lazarus 1.0 package, not even in Debian experimental.
I'm not sure if the Debian maintainer is no longer interested, I could
not find any signs of life or anything, I fear if nobody does anything
about it (it won't magically package itself and put itself into the
repository without the help of a Debian maintainer who has write
access there) we will be stuck with Lazarus 0.9.30 on Ubuntu for
another year.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] fpc version 2.6.1 source code

2012-10-04 Thread Bernd
2012/10/4 Eric Kom :

> Please am looking for the free pascal compiler version 2.6.1 for linux.

2.6.1 is ongoing development, so strictly speaking there is no
definitive 2.6.1-version that will stay the same from now on, 2.6.1 is
the branch that will once become stable 2.6.2 release. All versions
from this branch currently carry the version number 2.6.1 but it will
receive patches from time to time and the "2.6.1" from today will not
be the same 2.6.1 from tomorrow.

But it still makes sense to use it, the way I recommend is to checkout
the branch from svn:

svn checkout http://svn.freepascal.org/svn/fpc/branches/fixes_2_6 fpc

and then svn up from time to time or every time you see new commits
coming to this branch. This is what many people do, this way you will
always have the most recent fixes for the stable 2.6.x line of
versions, its not as adventurous as being on the bleeding edge of on
trunk all the time, no bad surprises or huge changes are expected to
happen here, I am using it myself too.

There also exist complete downloads of snapshots, see this website for
some links and some more information:
http://www.freepascal.org/develop.var

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-10-02 Thread Bernd
2012/9/30 Bernd :

> http://prof7bit.github.com/lazdebian/

I renamed the entire project, including the github repository and website URL:
http://prof7bit.github.com/LazPackager/
https://github.com/prof7bit/LazPackager

all units are renamed also to reflect this change, the only thing I
still need to rename now is the .lpk file itself, it will be called
lazpackager.lpk (later this evening maybe or tomorrow). Also the names
of the settings in the project file have changed and there is now
(internally) a distinction between settings that are needed (or
useful) for all packagers and setting that apply to a specific
packager (debian) only, the settings names in the project file now
reflect this. So after updating all your settings will be reset to the
defaults.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-10-01 Thread Bernd
2012/10/1 zeljko :

> Great, I guess that it won't be a big deal to create an rpm package creator
> too, and yes I'd like to see it in lazarus/components

I have refactored it a little yesterday evening and put all debian
specific stuff into a separate class (only the backend, not the gui
yet). I guess then it would also need a different name because
"lazdebian" implies that it is debian only.

Maybe then it would also make sense to implement creating windows
installers and android packages.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-09-30 Thread Bernd
2012/9/30 Krzysztof :
> Wow. I have not tested it yet. But are you planning create something
> similar for RPM?

I don't have any RPM based distribution but maybe at least for the
binary debs it should be possible to make an option to run the
produced .deb through alien. The produced binary debs are quite simple
and do not contain any sophisticated debian-related voodoo so I guess
it should be possible without problems.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] lazdebian.lpk - Create Debian package from exiting Lazarus Project

2012-09-30 Thread Bernd
I made a Lazarus package for creating Debian packages from Lazarus projects:

* Create binary (.deb) Package
  - optionally signed with gpg key

* Create Debian source package
  - optionally signed
  - optionally upload to Launchpad PPA for automatic building and publishing.

Screenshots, source code  and short explanation here:
http://prof7bit.github.com/lazdebian/

Now we can start flooding the Ubuntu ecosystem with high quality
Lazarus Applications with only a few clicks of the mouse.

The package is 95% complete already, works with simple projects out of
the box with default settings, only need to fix some small remaining
problems, maybe one day it would qualify for inclusion in the packages
that ship with Lazarus by default (for this I still need a proper
solution to my other question (version info), maybe a newly
implemented macro that returns the version number)?

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] getting version info of active project from within a design time package

2012-09-29 Thread Bernd
2012/9/28 Bernd :
> I need to read the version number of the currently active project in
> my design time package. For this I have written the following code:
>
> function TSettings.GetVersion: String;
> var
>   Res: TAbstractProjectResources;
>   ResVer: TProjectVersionInfo;
> begin
>   Res := LazarusIDE.ActiveProject.Resources as TAbstractProjectResources;
>   ResVer := Res.Resource[TProjectVersionInfo] as TProjectVersionInfo;
>   Result := Format('%d.%d.%d.%d',  [ResVer.MajorVersionNr,
> ResVer.MinorVersionNr,
> ResVer.RevisionNr,
> ResVer.BuildNr]);
> end;
>
> It needs the unit W32VersionInfo which is in the package LCL. Now I
> have noticed that when adding LCL as a depedency to my package I
> cannot compile the IDE from a clean directory, obviously when using
> IDE while IDE is not yet compiled seems to be not such a good idea. Is
> there a better way to get the version number? I could not find any
> other place to access it.
>
> Bernd



type

  { TMyAbstractProjectResources }
  TMyAbstractProjectResources = class(TAbstractProjectResources)
// need this to call a protected class function
class function GetList: TList;
  end;

  TFileProductVersion = array[0..3] of word;

  {This should have the same memory layout as the original one}
  TSameLayoutAsTProjectVersionInfo = class(TAbstractProjectResource)
FAutoIncrementBuild: boolean;
FHexCharSet: string;
FHexLang: string;
FStringTable: TObject;
FUseVersionInfo: boolean;
FVersion: TFileProductVersion;
// more fields follow but we are not
// interested anymore, only need FVersion
  end;



function TSettings.GetVersion: String;
var
  ResList: TAbstractProjectResources;
  Resource: TAbstractProjectResource;
  ResClass: TAbstractProjectResourceClass;
  ResClassList: TList;
  P: Pointer;
  VerInfo: TSameLayoutAsTProjectVersionInfo;

begin
  ResList := LazarusIDE.ActiveProject.Resources as TAbstractProjectResources;
  ResClassList := TMyAbstractProjectResources.GetList;
  for P in ResClassList do begin
ResClass := TAbstractProjectResourceClass(P);
Resource := ResList.Resource[ResClass];
if Resource.ClassName = 'TProjectVersionInfo' then begin
  VerInfo := TSameLayoutAsTProjectVersionInfo(Resource);
  Result := Format('%d.%d.%d.%d', [VerInfo.FVersion[0],
   VerInfo.FVersion[1],
   VerInfo.FVersion[2],
   VerInfo.FVersion[3]]);
  break;
end;
  end;
end;

As you can see I am really desperate. The problem with the above code
is that it will break as soon as there are changes made to the layout
of the first 6 fields of the TProjectVersionInfo class. I have also
tried to find any way to read from the currently opened projectinfo
file but I cannot find anything other other than CustomData (and I
don't want to read it directly from disk because there could be
unsaved changes to the version number). Is there really no "normal"
way for me to read the version number?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Running external process from within Lazarus design package

2012-09-29 Thread Bernd
2012/9/28 Bernd :
> I need to run an external program from within my lazarus package.

Ok, I think I have found this one myself, this seems to work:

uses
  IDEExternToolIntf;


begin
  ...
  Tool := TIDEExternalToolOptions.Create;
  Tool.Filename := '/bin/sh';
  Tool.CmdLineParams := 'DEBUILD.sh';
  Tool.WorkingDirectory := Settings.GetProjectDir;
  Tool.ShowAllOutput := True;
  RunExternalTool(Tool);
  Tool.Free;


My other question (the other thread) regarding the version info is still open.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] getting version info of active project from within a design time package

2012-09-28 Thread Bernd
I need to read the version number of the currently active project in
my design time package. For this I have written the following code:

function TSettings.GetVersion: String;
var
  Res: TAbstractProjectResources;
  ResVer: TProjectVersionInfo;
begin
  Res := LazarusIDE.ActiveProject.Resources as TAbstractProjectResources;
  ResVer := Res.Resource[TProjectVersionInfo] as TProjectVersionInfo;
  Result := Format('%d.%d.%d.%d',  [ResVer.MajorVersionNr,
ResVer.MinorVersionNr,
ResVer.RevisionNr,
ResVer.BuildNr]);
end;

It needs the unit W32VersionInfo which is in the package LCL. Now I
have noticed that when adding LCL as a depedency to my package I
cannot compile the IDE from a clean directory, obviously when using
IDE while IDE is not yet compiled seems to be not such a good idea. Is
there a better way to get the version number? I could not find any
other place to access it.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Running external process from within Lazarus design package

2012-09-28 Thread Bernd
I need to run an external program from within my lazarus package.
Unfortunately it will need significant time to run, so I cannot just
wait for it in the main thread and also it will produce some important
diagnostic console output that I would like to print into the messages
window.

Is there any possibility to use the same mechanism that is used when
compiling or when running other external tools (tools menu) from
within my lazarus package? It would be enough if someone could point
me to some existing lines of code where this has been done already or
maybe just name the needed ide units or the TBoss or manager
class that is responsible for this and where to find it.

Bernd

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Switching projects causes Access Violation

2012-09-27 Thread Bernd
2012/9/26 Graeme Geldenhuys :

> It seems to be related to Anchor Docking. After I uninstalled the two anchor
> docking packages (runtime & designtime) the problem has not occurred again.

Afaik there are still some serious bugs open regarding the
anchordocking, for example it cannot properly save and restore every
possible layout and unfortunately I have not seen any activity (any
commits regarding anchordocking) for a very long time now, I would not
expect it to be less broken today than it was already a year ago.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cannot load libpq.so

2012-09-25 Thread Bernd
2012/9/25 Mark Morgan Lloyd :

> As I understand it, there's an optional parameter on the library
> initialisation call to specify the exact library name, and there was recent
> discussion about how best to expose this to programmers via the LCL.

Libraries should simply be loaded by their soname and not by the name
of the symlink (which exists only when the dev package of the lib is
installed), the symlink only exists as a hint for ld at link time so
it can follow it and find the real soname to link the binary against.
The soname is the canonical name of the library and is guaranteed to
exist.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cannot load libpq.so

2012-09-25 Thread Bernd
2012/9/25 Leonardo M. Ramé :
> libpq.so (libc6) => /usr/local/pgsql/lib/libpq.so
>
> It seems to be installed correctly.

maybe libpq.so itself has some dependency problems and will refuse to
load (but I am not sure how the error message would look like in this
case, so this is only an unfounded guess. try ldd on the library
itself)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cannot load libpq.so

2012-09-25 Thread Bernd
2012/9/25 Bernd :
> 2012/9/25 Leonardo M. Ramé :
>
>> Do you know a way to know where's the loader looking for libraries?,
>> from command line.
>
> ldconfig --print-cache
>
> Your library should appear there if installed correctly

It also might be installed as something like libpq.so.1 while your
program is trying to load libpq.so. Then you might need to add a
symlink. This is normally not a problem when linking at link time
because ld would resolve the symlink (which only exists when the
headers are installed) and insert the real name (the so called soname)
into the binary but this does not work when you are loading
dynamically at runtime.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cannot load libpq.so

2012-09-25 Thread Bernd
2012/9/25 Leonardo M. Ramé :

> Do you know a way to know where's the loader looking for libraries?,
> from command line.

ldconfig --print-cache

Your library should appear there if installed correctly

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Cannot load libpq.so

2012-09-25 Thread Bernd
2012/9/25 Leonardo M. Ramé :
> Hi, I've installed PostgreSql from sources on a Linux machine, it's
> installed on /usr/local/pgsql. It's libraries are in
> /usr/local/pgsql/lib, and I updated my /etc/ld.so.conf to look there,
> but still, when I run a simple testing app written with lazarus I'm
> getting this:

did you run

sudo ldconfig

after changing /etc/ld.so.conf or installing new libs to update the cache?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SynEdit: AutoIndent with Tabs instead of spaces, is this possible?

2012-09-24 Thread Bernd
2012/9/24 Martin :
> its in the beautifier
>
>   TSynBeautifier = class(TSynCustomBeautifier)
>   published
> property IndentType: TSynBeautifierIndentType read FIndentType write
> FIndentType;
>
> Make sure you have the correct beautifier, the default is one instance (not
> sure which class) for all edits.

Ok, assigned it a newly created beautifier, set its properties
appropriately and now it works as expected.

Thank you.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] SynEdit: AutoIndent with Tabs instead of spaces, is this possible?

2012-09-24 Thread Bernd
2012/9/24 Martin :

> You can select 1 of the 3
> "spaces"
> "space/tab" as previous line
> "pos only"

What combination of Options and Options2 do I need for that or how is
the property called? I can't find it.

> press F1 the wiki describes them.

"No help found for this topic" (TSynEdit)

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] SynEdit: AutoIndent with Tabs instead of spaces, is this possible?

2012-09-24 Thread Bernd
I cannot find any way to convince SynEdit to indent the next line with
a tab when I press enter on an indented line, it will always use
spaces, even if eoTabsToSpaces is false and eoTabIndent is true and
the previous line is intended with a Tab. Pressing Tab to indent works
as expected but not the AutoIndent. I need to edit Makefile templates,
they may not be indented with spaces or it will be a syntax error. The
only way I have found is to disable AutoIndent completely or do a
string replace after editing.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-24 Thread Bernd
2012/9/23 Bernd :

> I'm going to write a wiki page with instructions next week.

Maybe an IDE package for producing a .deb from any Lazarus project or
uploading to launchpad build servers with a click of the mouse would
be even better :-)

Is there an existing package or example where I can see and study how
it is done to add a new tab to the project dialog?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
Success!

https://launchpadlibrarian.net/117069202/buildlog_ubuntu-precise-i386.laz-launchpad-example_1.0.7-ppa1_BUILDING.txt.gz


Build-Depends: fpc, lcl, lcl-utils, lazarus


I always thought that lazarus alone would pull in all required
dependencies to use Lazarus and build LCL applications. Isn't this how
it is supposed to be?

If anybody wants to experiment with this here is an empty skeleton
containing only an empty Lazarus project and my makefile:
https://launchpad.net/~prof7bit/+archive/lazarus-ppa-skeleton/+files/laz-launchpad-example_1.0.7.orig.tar.gz

customize the makefile, change email address, author name, package
name, ppaname, lpiname, exename, use the email address that
corresponds to your own gpg key and that is also associated with your
launchpad account, if necessary tweak the 3 targets (clean, all,
install) to fit your purpose and then

  make ubuntu_src

and check that it ran without errors (this will create a DEBUILD
directory with a bunch of files in it) and then if there was no error

  make ubuntu_upload

This will ask for your gpg passphrase to sign the files and then
upload it to your PPA and enqueue it for building on their build farm.
Check your email for error messages and log files. Increment the
version number for every new upload with changed sources or it will
complain.

For local testing (until you know it works) you can also do

  make ubuntu_deb

This will perform all steps and build the .deb locally for debugging
the build process.

I'm going to write a wiki page with instructions next week.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
2012/9/23 Bernd :

> here is my Makefile:

What I am actually trying to do here is to make an empty skeleton
Lazarus project with a Makefile that will allow automaticaly creating
and uploading a source package to launchpad build servers so that
everybody can convert his Lazarus project into an ubuntu debian
package simply by

* putting just this one makefile into the project folder
* customizing the constants at the top of that file
* maybe a little tweaking of the clean/all/install targets

then for every release:
* increment the version number
* make ubuntu_src
* make ubuntu_upload

and then just wait until the .deb packages for x86 and amd64 are
automatically built on their build farm and put into the ppa
repository and users can simply apt-get install or upgrade them

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
Ok, I am making porogress:
https://launchpadlibrarian.net/117051530/buildlog_ubuntu-precise-i386.laz-launchpad-example_1.0.3-ppa1_FAILEDTOBUILD.txt.gz

Now I have specified following dependencies (I added lcl to the list):

lazarus, lcl, lcl-utils

now it installs the following (from above log file):

  fp-compiler
  fp-compiler-2.4.4 fp-units-base fp-units-base-2.4.4 fp-units-fcl
  fp-units-fcl-2.4.4 fp-units-gtk2 fp-units-gtk2-2.4.4 fp-units-rtl-2.4.4

and

  lazarus-0.9.30.2
  lazarus-doc-0.9.30.2 lazarus-ide-0.9.30.2 lazarus-ide-gtk2-0.9.30.2
  lazarus-src-0.9.30.2 lcl-0.9.30.2 lcl-gtk2-0.9.30.2 lcl-units-0.9.30.2
  lcl-utils-0.9.30.2

and it fails differently now:

  Fatal: Can't find unit iconvenc used by LConvEncoding

I just hope I don't run out of allowed build-jobs per day today so I
don't have to wait until tomorrow until I am allowed to continue
debugging this...

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
2012/9/23 Mattias Gaertner :

> Have you tried removing ~/.lazarus?

No, it always starts with a freshly bootstrapped clean and virgin
virtual ubuntu server, I have no other influence than specifying build
dependencies in the source package and maybe some ugly hackish
trickery in my "all" target. Here is the complete log:

https://launchpadlibrarian.net/117046564/buildlog_ubuntu-precise-i386.laz-launchpad-example_1.0.2-ppa1_FAILEDTOBUILD.txt.gz



here is my Makefile:


# this will be the name of our ubuntu package
PACKAGENAME = laz-launchpad-example

# you need a new UPSTREAMVERSION everytime you try a new upload to
# launchpad because this will be considered the version of the
# upstream .orig.tar.gz and since we basically *are* upstream and indeed
# have changed upstream sources we also need a new uptream version number
UPSTREAMVERSION = 1.0.2
FULLDEBVERSION = $(UPSTREAMVERSION)-ppa1
DESCRIPTION = demo package
EXDESCRIPTION = extended description may not be empty
AUTHOR = Bernd Kreuss
COPYRIGHT = 2012 $(AUTHOR)

# this must be the same email address used in launchpad AND in the gpg key!
# make ubuntu_upload will ask for passphrase to sign the source package
# and after uploading launchpad will check the signature to authenticate you
EMAIL = prof7...@gmail.com
PPANAME = ppa:prof7bit/lazarus-ppa-skeleton


# some licenses need a second line referring to the license file
LICENSE = GPL-2
LICENSE2 = /usr/share/common-licenses/GPL-2

# more tweaking can be done by directly altering the code
# that creates the debian/* files near the end of this makefile

DISTRIBUTION = precise
BUILD_DEPENDS = lazarus, lcl-utils, debhelper (>= 8)
DEPENDS =

EXENAME = project1
LPINAME = project1.lpi

SRCDIRNAME = $(PACKAGENAME)-$(UPSTREAMVERSION)
TARBALLNAME = $(PACKAGENAME)_$(UPSTREAMVERSION).orig.tar.gz

# need bash with extglob for some of the synax in this makefile
SHELL = /bin/bash -O extglob

##
# all, clean and install are totally standard stuff and  #
# are supposed to work the same without debuild. #
##

# all will build the entire project from source, using lazbuild,
# this assumes that there exists a build mode "Release"
all:
#lazbuild --build-mode=Release $(LPINAME)
lazbuild --build-mode=Debug $(LPINAME)


# clean will remove all compiled files
clean:
$(RM) -r lib
$(RM) $(EXENAME)
$(RM) *.res

$(RM) -r DEBUILD


# install all the files into their final destinations. This should
# work without debuild (for testing or normal install without .deb)
# and also work when called during debuild (debuild will also set
# the $(DESTDIR) variable to install into a fakeroot) so don't forget
# to prefix all destination paths with $(DESTDIR) and also don't forget
# to install with -D so that it will create missing directories.
install:
install -D $(EXENAME) $(DESTDIR)/usr/bin/$(EXENAME)


# uninstall is not used for the packaging, or anywhere else, I only use
# it during development after testing the installer on my local machine
uninstall:
$(RM) /usr/bin/$(EXENAME)



#
# here comes the debian specific stuff. #
#

# make ubuntu_src does everything needed to create a debian source package.
# It will create a BUILDEB directory, copy the entire source there,
# make the .orig.tar.gz tarball from it and then call itself again from
# within this new location to make the debian files and all the rest.
# after this has completed you can call make ubuntu_upload
ubuntu_src: _copyorig
$(MAKE) -C DEBUILD/$(SRCDIRNAME) _ubuntu_src

# make ubuntu_bin is similar to ubuntu_src but it makes a binary package
# this should be used to debug the build proces, test the .deb but it
# can not be used to produce the source package. Use this only for
# debugging. Use ubuntu_src instead to produce the launchpad upload files.
ubuntu_bin: _copyorig
$(MAKE) -C DEBUILD/$(SRCDIRNAME) _ubuntu_bin

# after you have run make ubuntu_src (and confirmed that all is ok)
# you call make ubuntu_upload which will then sign your source package
# and upload it to your ppa. It will first ask you for your gpg
# passphrase twice to sign the two files (.dsc and .changes) and then
# upload them using dput. You don't need your launchpad password,
# launchpad will authenticate you by your gpg signature, launchpad will
# send you a notification email to inform you about errors or success.
ubuntu_upload:
cd DEBUILD/$(SRCDIRNAME); debsign -S
dput $(PPANAME) DEBUILD/$(PACKAGENAME)_$(FULLDEBVERSION)_source.changes

_copyorig: clean
mkdir -p DEBUILD/$(SRCDIRNAME)
cp -r !(DEBUILD) DEBUILD/$(SRCDIRNAME)/
cd DEBUILD; tar czf $(TARBALLNAME) $(SRCDIRNAME)




# everything below h

Re: [Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
2012/9/23 Mattias Gaertner :

> How did you install Lazarus?

the build server did it (probably with apt-get) satisfying my two
build-dependencies:
lazarus lcl-utils

so theoretically the equivalent on the command line would have been:
sudo apt-get install lazarus lcl-utils

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Can't find unit Interfaces on launchpad's build farm - is Lazarus/FPC broken in Ubuntu 12.04?

2012-09-23 Thread Bernd
Ubuntu precise (12.04), simple empty lazarus hello world project,
This is the build log:
https://launchpadlibrarian.net/117046564/buildlog_ubuntu-precise-i386.laz-launchpad-example_1.0.2-ppa1_FAILEDTOBUILD.txt.gz

Around line 258 it begins installing necessary packages, I have
specified the following build dependencies:
lazarus, lcl-utils

At line 672 the build is started with
lazbuild --build-mode=Debug project1.lpi

producing some strange warnings:
invalid Package Link: file
"/usr/lib/lazarus/0.9.30.2/components/codetools/codetools.lpk" does
not exist.
invalid Package Link: file
"/usr/lib/lazarus/0.9.30.2/components/lazcontrols/lazcontrols.lpk"
does not exist.

and then around line 687 it will fail with:
Fatal: Can't find unit Interfaces used by project1

Am I missing something obvious or is it just broken in Ubuntu and I
simply won't ever be able to use launchpad to build packages? This
would be really bad :-(

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Debugging shared libraries

2012-09-20 Thread Bernd
2012/9/16 Mark Morgan Lloyd :

> interesting question: can Lazarus+gdb be persuaded to trace into a shared
> library?

While developing the libpurpletorchat plugin (a libpurple plugin) I
did not notice any problems debugging the library.

In Lazarus I set /usr/bin/pidgin as host application and then click
the run button,
pidgin (written in C) then loads libpurple
libpurple (also written in C) loads my plugin (library written in Free Pascal)

all breakpoints worked, callstack worked and stepping through my
library (and even from there back into libpurple) was no problem at
all. I did this on Linux/i386, I did not try debugging on windows. I
did not notice any debugging problems at all due to the fact that it
is a library instead of a program, it worked exceptionally well.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TProcess

2012-09-13 Thread Bernd
2012/9/13 Antonio Fortuny :

> CmdLine.Text := '/bin/sh -c ''ps -s | grep something'' '

Now you additionally asume that:
* there exists /bin/sh (recent linux distros begin to move all that
into /usr/bin/)
* there exists ps and grep in your path

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Parsing command line options

2012-09-10 Thread Bernd
2012/9/10 J.A. de Vries :

> Might I make a suggestion? Why try and invent the wheel ourselves?
> There's a very good library named getopts that has been used by masses
> of programmers for years now. Maybe we could learn from that and
> re-implement the choices made in there?

But isn't this a completely separate problem? If I understand this
thread correctly then the problem here is properly emulating what the
shell would do when parsing one line of text (splitting the line at
unquoted spaces, removing quotes, maybe even expanding wildcards) and
then *producing* the argv array while getopts on the other hand can be
used to extract key-value pairs that follow a certain syntax from an
already existing argv array?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


  1   2   3   4   5   >