[fpc-pascal] strange behaviour of readkey...or not

2005-06-20 Thread Darius Blaszijk
Hi there,

I have a console app that reads keys being pressed and then does some
action. In short it would be like this:

repeat
  if fileage(myfile) <> imyfile then
  begin
writeln('file changed');
imyfile := fileage(myfile);
  end;

  ch := readkey;
until ch = 'q'

So what I want is that the fileage test is done continously and when a user
presses a key some other procedure is executed. But the problem is that when
"ch := readkey" is reached, the app seems to stay waiting until a key is
pressed. In other words it only does the fileage test when I press a key
other than q. In my example the fileage test is only done once.

Am I under the wrong impression that I should pull it off using readkey??
What is the alternative??

Darius Blaszijk


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


Re: [fpc-pascal] strange behaviour of readkey...or not

2005-06-20 Thread Darius Blaszijk
Florian,

Thanks. I have fixed it using:

if KeyPressed then
  ch := ReadKey
else
  ch := '';

I know I should have know better, but for some strange reason only readkey
in a previous version seemed to work just fine. Thats why I was confused.

Darius Blaszijk

- Original Message -
From: "Florian Klaempfl" <[EMAIL PROTECTED]>
To: "FPC-Pascal users discussions" 
Sent: Monday, June 20, 2005 7:37 PM
Subject: Re: [fpc-pascal] strange behaviour of readkey...or not


> Darius Blaszijk wrote:
>
> > Hi there,
> >
> > I have a console app that reads keys being pressed and then does some
> > action. In short it would be like this:
> >
> > repeat
> >   if fileage(myfile) <> imyfile then
> >   begin
> > writeln('file changed');
> > imyfile := fileage(myfile);
> >   end;
> >
> >   ch := readkey;
> > until ch = 'q'
> >
> > So what I want is that the fileage test is done continously and when a
user
> > presses a key some other procedure is executed. But the problem is that
when
> > "ch := readkey" is reached, the app seems to stay waiting until a key is
> > pressed. In other words it only does the fileage test when I press a key
> > other than q. In my example the fileage test is only done once.
> >
> > Am I under the wrong impression that I should pull it off using
readkey??
> > What is the alternative??
>
> Do check of keypressed first:
> http://www.freepascal.org/docs-html/rtl/crt/keypressed.html
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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


[fpc-pascal] Suspending app

2005-06-21 Thread Darius Blaszijk
Hi,

I have an app that checks several files continuously and when the fileage
has changed the app performs some instructions. I have put the checks in a
loop. The drawback is that the processor is now 100% loaded. I could use the
FindFirstChangeNotification API on windows. But is there a crossplatform
alternative??

Darius Blaszijk


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


[fpc-pascal] ExecuteProcess

2005-07-28 Thread Darius Blaszijk
I'm using ExecuteProcess to run a commandline application. This application
returns information to stdout. I have tried to pipe this to a file, but
unfortunately this does not work. I keep getting a message like: "error
resolving case of '>'"
Is ExecuteProcess not capable of handling pipes, is there a workaround, or
an alternative??

Darius Blaszijk


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


Re: [fpc-pascal] ExecuteProcess

2005-07-28 Thread Darius Blaszijk
> Have you checked out AssignStream.  It works well.. might be available on
*nix
> only though.

I will check it, although I "prefer" a platform independent aproach.

Darius Blaszijk


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


[fpc-pascal] XML question

2005-09-11 Thread Darius Blaszijk
Hi,

I have a problem with empty elements () in XML. Does anybody know
how I can fill them with data??

The code I was willing to use was this:

if not Assigned(n.FirstChild) then
  n.AppendChild(TDOMNode.Create(doc));

But it doesn't work. So how can I make it work??

I want to assign something to n.NodeValue eventually.

Darius Blaszijk


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


Re: [fpc-pascal] Extending FPDoc

2005-09-18 Thread Darius Blaszijk
On Fri, 2005-09-16 at 22:17, Michael Van Canneyt wrote:
> I'd rather you keep these todo separate. It'll slow down parsing
> (which is already horribly slow) and I see no added value. If you must
Could you elaborate on that?? I don't see a problem in adding a tag.
While indeed it will slow down parsing by a few mSec per node, the
generated pages will not suffer from this at all. Instead more useful
text will be shown for developers. Because that's the audience the
documentation is meant for right??

> In lazarus, you could even store the TODO in a separate file. If I'm correct,
> Lazarus has already a TODO system.
True, but it does not show in the documentation obviously.

> What concerns notes, there is already a  node. It is meant for 'Extra' 
> text.
> You can use that inside the package or module node.
Ok, good to hear, but can I use it also at the element level?? Although
pakage notes are usefull, they will never get into that much detail as
element notes. What I have in mind are detailed notes per element on
certain aspects in the code.

Darius


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


Re: [fpc-pascal] Extending FPDoc

2005-09-18 Thread Darius Blaszijk
On Fri, 2005-09-16 at 22:14, Sebastian Günther wrote:

> I think I can easily add this. I think it would be sufficient to 'just'
> support it, without usage within the doc writers?

I don't see much use in that. If text does not appear back in the
documentation then there is no point adding text.

Darius


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


Re: [fpc-pascal] FPDoc question

2005-09-27 Thread Darius Blaszijk
On Mon, 2005-09-26 at 10:10, Michael Van Canneyt wrote:
> > - can I find somewhere a description on topic tags?? I have searched the
> > reference manual, but it seems it's not documented there.
> 
> Strange, what version of the docs do you have ? It's definitely
> documented, it was already for 2.0 ; I just checked the sources again.
I'm using version 0.9 (may 7, 2005, the current version seems to be
still 0.9 but from may 15th?!?). I also checked the online version, but
it also does not show the topic and example tags. I did not check the
source code though.

One more question; the comments used in each XML file, can you specify
what the usage is in relationship to the documentation?? If there is
functionality, could the information be stored as an attribute instead??

Darius 

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


[fpc-pascal] polymorphism question

2006-03-03 Thread Darius Blaszijk



I would like to declare a polymorph class. The 
class has several properties and it's the read and write specifiers that I want 
to be virtual abstract. So derived classes override the read and write 
specifiers. The problem however is that I get an EAbstractError. The 
property is still considered to be abstract according to the compiler. So what 
did I wrong? I have added an example below.
Is it perhaps not allowed to use this construct? 
What would then be the best way?
Darius
 
<>
 
unit MyTest;
 
{$mode objfpc}{$H+}
 
interface
 
uses  Classes, ComCtrls, 
SysUtils;
 
type  TCustomClass = class  
private    //virtual 
mehods    function GetMyProperty: string; virtual; 
abstract;    procedure SetMyProperty(Value: string); virtual; 
abstract;  published
 
    property MyProperty: string Read 
GetMyProperty Write SetMyProperty;  end;
 
  TMyClass = class(TCustomClass)  
private    FMyProperty: string;
    function GetMyProperty: string; 
overload;    procedure SetMyProperty(Value: string); 
overload;  published    property 
MyProperty;  end;
 
implementation
 
function TMyClass .GetMyProperty: 
string;begin  Result := FMyProperty;end;
 
procedure TMyClass .SetMyProperty(Value: 
string);begin  if Value = FMyProperty then    
exit;  FMyProperty := 
Value;end;
end.
 
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Clueless here

2006-06-30 Thread Darius Blaszijk



I did as you and Michalis suggested, but it makes 
no difference the application keeps crashing. I keep getting a " Invalid 
floating point operation".
 
Darius

  - Original Message - 
  From: 
  mariano 
  podesta 
  To: FPC-Pascal users discussions 
  
  Sent: Thursday, June 29, 2006 10:20 
  PM
  Subject: Re: [fpc-pascal] Clueless 
  here
  hi daruischange this line
  
  


    Params[i] := 
@Parameters[i];with 
  thisParams[i]^ := Parameters[i];hope it works.marianop
  
  

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

Re: [fpc-pascal] Clueless here

2006-06-30 Thread Darius Blaszijk

I'm using 2.0.2 on winxp

Darius

- Original Message - 
From: "Dominique Leducq" <[EMAIL PROTECTED]>

To: 
Sent: Friday, June 30, 2006 5:15 PM
Subject: Re: [fpc-pascal] Clueless here



On Fri, 30 Jun 2006 12:30:33 +0200
"Darius Blaszijk" <[EMAIL PROTECTED]> wrote:

I did as you and Michalis suggested, but it makes no difference the 
application keeps crashing. I keep getting a " Invalid floating point 
operation".


What architecture are you working on? what version(s) of the compiler did 
you try? There are known bugs with floating point numbers on AMD64 with 
fpc 2.0.2 (and older 2.1.1), which seem to be fixed in fpc 2.0.3 (upcoming 
2.0.4) and recent 2.1.1.


Dominique

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


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


[fpc-pascal] fpcmake questions

2006-07-28 Thread Darius Blaszijk




I have two questions regarding 
FPCMake.
 
1. Whe I do an FPCMake I get the following 
error;
 
Processing Makefile.fpcError: Target "win32", 
package "rtl" not found
 
What is causing this error, what does it 
mean?
 
2. I'm using the LCL in my application and I need 
to enter it as a unitdir for the compiler. The problem is however that 
if anyone else wants to use the makefile he needs to modify this path and run 
FPCmake again. Is there a way to get around this? Can I use a config file with 
these paths for example? Or is it possible to use a environment 
variable?
 
Darius
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fpcmake questions

2006-07-28 Thread Darius Blaszijk

Thanks, Graeme. That did the trick

Darius

- Original Message - 
From: "Graeme Geldenhuys" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Friday, July 28, 2006 9:45 AM
Subject: Re: [fpc-pascal] fpcmake questions



Hi Darius,

I had the same issue ... Is my emails on the 9th July in FPC-Devel
mailing list. Titled "fpcmake keeps failing".

I had the FPCDIR set wrong...  It must point to the fpc source
directory and not the fpc root directory..

export FPC=/opt/fpc-2.1.1/bin/ppc386
export FPCDIR=/opt/fpc-2.1.1/src


Regards,
 Graeme.



On 7/28/06, Darius Blaszijk <[EMAIL PROTECTED]> wrote:




I have two questions regarding FPCMake.

1. Whe I do an FPCMake I get the following error;

Processing Makefile.fpc
Error: Target "win32", package "rtl" not found

What is causing this error, what does it mean?

2. I'm using the LCL in my application and I need to enter it as a 
unitdir

for the compiler. The problem is however that if anyone else wants to use
the makefile he needs to modify this path and run FPCmake again. Is there 
a

way to get around this? Can I use a config file with these paths for
example? Or is it possible to use a environment variable?

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





--
There's no place like 127.0.0.1
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal 


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


Re: [fpc-pascal] X Windows and FPC

2006-07-28 Thread Darius Blaszijk
Try this link, http://world.altavista.com/. It's not perfect, but it helps. 
;)


Darius


- Original Message - 
From: "Graeme Geldenhuys" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Friday, July 28, 2006 10:22 AM
Subject: [fpc-pascal] X Windows and FPC



Hi,

I found this 121 page document on the Internet, but I don't understand
Russian (or whatever it is written in).  I seems to cover a lot about
X Windows programming in FPC.

Anybody know if there is an English translation floating around somewhere?

I have the document in PDF format called xwinfpc.pdf (unfortunately I
never saved the original download link).  I also found the html
version at:

 http://pascal.sources.ru/graph/xwinfpc/index.htm


Regards,
 Graeme.


--
There's no place like 127.0.0.1
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal 


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


Re: [fpc-pascal] X Windows and FPC

2006-07-28 Thread Darius Blaszijk

Hi Graeme,

Why don't you release the code yet? Put a notification somewhere on the wiki 
with a download link, or even better ask nicely to the Lazarus or FPC crew 
to add it to SVN as a subproject. I'm shure they don't mind ;) Perhaps one 
or two will join you and you will get more done in less time.


Darius

- Original Message - 
From: "Graeme Geldenhuys" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Friday, July 28, 2006 1:44 PM
Subject: Re: [fpc-pascal] X Windows and FPC



On 7/28/06, Krishna <[EMAIL PROTECTED]> wrote:

What happened to the fpGui and fpGfx projects? I thought (back then)
they were coming along nicely.


The first version of my widget set was based around a heavily modified
LPTK.  I then discovered the discontinued fpGUI and fpGFX projects.  I
tried to contact the original author to no avail.  The fpGUI code
hasn't been touched since early 2002.  After studying the code for a
few weeks, I came to the conclusion that fpGUI is much closer to what
I strived to accomplish with my modified LPTK.  A lot was still
missing from fpGUI though.

After a long and hard think, I decided to start my widget set again,
but this time based on the work done in fpGUI and fpGFX (after all,
why reinvent the wheel).  I also added to the mix some good ideas I
saw in Qt. So far I have completed quite a few things missing in fpGUI
and created a TODO list of things outstanding which should get it to a
usable level.  I also added a lot of documentation as I go (hell yeah,
a programmer that documents... smile) as there was no documentation
included with fpGUI and fpGFX.

So I guess you can say I am doing a version 2 of fpGUI.  :-)

Regards,
 Graeme.


--
There's no place like 127.0.0.1
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal 


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


Re: [fpc-pascal] fpcmake questions

2006-07-28 Thread Darius Blaszijk

Is there somewhere a description on how to use environment variables in
FPCMake? I've been searching the programmers manual, but no success. Also is
it possible to use a config file to declare some variables?

Darius

- Original Message - 
From: "Darius Blaszijk" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Friday, July 28, 2006 9:24 AM
Subject: [fpc-pascal] fpcmake questions


I have two questions regarding FPCMake.

1. Whe I do an FPCMake I get the following error;

Processing Makefile.fpc
Error: Target "win32", package "rtl" not found

What is causing this error, what does it mean?

2. I'm using the LCL in my application and I need to enter it as a unitdir
for the compiler. The problem is however that if anyone else wants to use
the makefile he needs to modify this path and run FPCmake again. Is there a
way to get around this? Can I use a config file with these paths for
example? Or is it possible to use a environment variable?

Darius






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


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


Re: [fpc-pascal] best way to execute external program

2006-08-09 Thread Darius Blaszijk

Look for TProcess.

Darius

- Original Message - 
From: "Bisma Jayadi" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, August 09, 2006 1:49 PM
Subject: [fpc-pascal] best way to execute external program



Hi all...

What is the best approach to execute external program from within our own 
application, monitor the process, get the termination status, in 
multiplatform way? Is there a ShellExecute-like function in FPC/RTL but 
works on all platforms?


Thank you in advance for any suggestions.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal 


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


Re: [fpc-pascal] Free Pascal widget set

2006-08-18 Thread Darius Blaszijk




It looks like a very nice job. I like the auto-size for translation. I


Yeah the layout managers are great!!  I always liked the idea looking
at Glade and Qt.
Just a note, but the "auto-sizing" of components as depicted in the fig2. 
example is perfectly possible with Anchoring already. There's no need for a 
layout manager for that functionality.


Darius




wish you success in this project. :) It might become the default
widgetset of lazarus one day :)


That would be nice - consistent dialogs (button sizes and order come
to mind).  Baby steps though... :-)   fpGUI is still far away from
that dream.

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


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


Re: [fpc-pascal] fpcmake question

2006-08-29 Thread Darius Blaszijk
Can't answer that one for you (perhaps just try?). But I would suggest you 
try using prerules to set a variable. The LCLPLATFORM is such a variable in 
the lazarus makefiles;


[prerules]
#
# LCL Platform
ifndef LCL_PLATFORM
ifneq ($(findstring $(OS_TARGET),win32 win64),)
LCL_PLATFORM=win32
else
LCL_PLATFORM=gtk
override COMPILER_UNITDIR+=../lcl/nonwin32
endif
endif
export LCL_PLATFORM


The just use it like $(LCL_PLATFORM).

Ofcourse you need to adjust it for your use.

HTH

Darius


- Original Message - 
From: "Graeme Geldenhuys" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Tuesday, August 29, 2006 3:53 PM
Subject: [fpc-pascal] fpcmake question



Is the following allowed in a Makefile.fpc

[target]
units=unit1 unit2 unit3
dirs_linux=x11
dirs_freebsd=x11
dirs_win32=win32

I have read the docs and know the "dirs" is a valid setting in the
"target" section.   But I have seen somewhere an example where they
included the platform as well in the dirs line, but I can seem to find
any such option mentioned in the fpcmake docs.

Is the above valid?

On Linux and FreeBSD, make will also be run in the "x11" directory.
On Win32, make will be run in the "win32" directory instead.

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


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


Re: [fpc-pascal] Reading text from images

2006-12-09 Thread Darius Blaszijk
This technique is called OCR. No idea if there is a pascal implementation, 
but it should not be too hard to make one. It's based on neural networks 
that "learn" to recognize any character from any font.


Darius

- Original Message - 
From: "Antal" <[EMAIL PROTECTED]>

To: 
Sent: Saturday, December 09, 2006 3:09 PM
Subject: [fpc-pascal] Reading text from images


Does anybody have an idea about how to read text from an image, using 
freepascal?
There are lots of fonts, and so on, but it would be rather interesting to 
make able fpc to read from jpegs or gifs, since on the net there is so 
much information stored in images.

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


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


[fpc-pascal] OpenGL question

2007-01-02 Thread Darius Blaszijk
I'm porting an app from Delphi to FPC wich uses OpenGL. As this is my first 
experience with OpenGL I'm having some problems. Under windows it already 
works, but under linux I seem to need an alternative for wglUseFontBitmaps. 
I tried looking through the sources from the opengl package in FPC but 
without success.


Any ideas?

Darius 


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


Re: [fpc-pascal] Can someone help me to debug and correct this code?

2007-01-14 Thread Darius Blaszijk

Goksie,

You could also start reading the output of the FPC compiler :) Normally it 
gives hints, warning and errors where to start looking for to correct your 
code. Iow don't ask for the obvious before looking yourself first.


Darius

- Original Message - 
From: "Daniël Mantione" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "FPC-Pascal users discussions" 


Sent: Sunday, January 14, 2007 11:26 PM
Subject: Re: [fpc-pascal] Can someone help me to debug and correct this 
code?





Op Sun, 14 Jan 2007, schreef Goksie:


dear all,


Sorry, but this code is an unreadable mess and I have no idea what this
stuff isw supposed to do. I see some things that are illegal such as
starting an identifier with a number, which you might  want to fix first.
Can you please format and indent your code in a more readable form, so we
can at least read it?

Daniël


const maxliststore=30;
strmaxlen=20;
type objecttype=string[strmaxlen];
list=record
object:array[1..maxliststore]of objecttype;
last:integer;
End;
var choice:char;
position,number:integer;
str:Objecttype;
1st:List;
procedure copyobject(var obj1,obj2:Objecttype);
begin obj1:=obj2;
end;
procedure displayobj(obj:Objjecttype);
begin
write('',obj,'');
end;
procedure initialise(var 1st:list);
begin 1st.Last:=0
end;

function insert(ob:Objjecttype;position:integer;var 1st:List):integer;
vari:integer;
begin
insert:=0;
if not((position<1)or(position>1st.Last+1)
or(position>maxliststore))then
begin
for i:=1st.last downto position do
   copyobject(1st.object[i+1],1st.object[i]);
copyobject(1st.object[position],obj);
1st.last:=1st.last+1;
insert:=1;
end
end;

function delete(position:integer;var 1st:List):integer;
var i:integer;
begin
if not((position<1)or(position>1st.last))then
for i:=position to 1st.last do
copyobject(1st.object[i],1st.object[i+1]);
1st.last:=1st.last-1;
delete:=1;
end
end;
procedure displaylist(var1st:List);
var i:integer;
begin
for i:=1 to 1t.last do
displayobj(1st.object[i];
end;

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








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


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


Re: [fpc-pascal] Windows-->Linux library

2007-02-14 Thread Darius Blaszijk

There's also LNet. http://wiki.lazarus.freepascal.org/lNet
Here's a list of other available networking components: 
http://wiki.lazarus.freepascal.org/Components_and_Code_examples#Networking


Darius

- Original Message - 
From: "Matt Emson" <[EMAIL PROTECTED]>

To: "FPC-Pascal users discussions" 
Sent: Wednesday, February 14, 2007 12:39 PM
Subject: Re: [fpc-pascal] Windows-->Linux library


The fonctions use to manage sockets under Linux and Windows are 
different.


Rather than nasty ifdefs, you might want to look at the Free Pascal port 
of

the Synapse Sockets library. It will abstract away your OS differences and
pushes support of the network code away from your hands.

http://synapse.ararat.cz/

I used Synapse with Windows a few years ago and found it very good. YMMV.

HTH

M

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


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


[fpc-pascal] Question about TProcess

2007-05-10 Thread Darius Blaszijk
The following piece of code is giving me headaches. When I add the 
option poUsePipes, the application starts and does not seem to do 
anything else anymore. It just opens a commandline terminal and that is 
that. When I leave the option out the application actually starts "make" 
and then crashes because AProcess.Output is nil.

What did I forget? I'm working on WinXP. On Linux btw the code works.

Darius

procedure ExecuteApp(CmdLine: string);
var
 AProcess: TProcess;
 AStringList: TStringList;
begin
 AProcess := TProcess.Create(nil);
 AStringList := TStringList.Create;
 AProcess.CommandLine := CmdLine;
 AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
 AProcess.Execute;
 AStringList.LoadFromStream(AProcess.Output);
 AStringList.SaveToFile('output.txt');
 AStringList.Free;
 AProcess.Free;
end;

begin
 ExecuteApp('make');
end.

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


Re: [fpc-pascal] Question about TProcess

2007-05-10 Thread Darius Blaszijk

Thanks Vincent,

I did not think of it as there are only about 30lines of output. It 
works now.


Darius


Vincent Snijders wrote:

Darius Blaszijk schreef:
The following piece of code is giving me headaches. When I add the 
option poUsePipes, the application starts and does not seem to do 
anything else anymore. It just opens a commandline terminal and that 
is that. When I leave the option out the application actually starts 
"make" and then crashes because AProcess.Output is nil.

What did I forget? I'm working on WinXP. On Linux btw the code works.

Darius

procedure ExecuteApp(CmdLine: string);
var
 AProcess: TProcess;
 AStringList: TStringList;
begin
 AProcess := TProcess.Create(nil);
 AStringList := TStringList.Create;
 AProcess.CommandLine := CmdLine;
 AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
 AProcess.Execute;
 AStringList.LoadFromStream(AProcess.Output);
 AStringList.SaveToFile('output.txt');
 AStringList.Free;
 AProcess.Free;
end;

begin
 ExecuteApp('make');
end.


Maybe the output buffer is full and the application is waiting for you 
to read from the pipe. See the reading large output program at
http://wiki.lazarus.freepascal.org/Executing_External_Programs#Reading_large_output 



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



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


[fpc-pascal] CGI upload app

2007-06-05 Thread Darius Blaszijk
Hi I would like to upload a file through a web page. How can I do this 
using FPC? Is there any example available?


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


Re: [fpc-pascal] CGI upload app

2007-06-06 Thread Darius Blaszijk
Thanks to all for their help. For now I will stick to psp because I need 
it to work with 2.0.4.


Darius

Michael Van Canneyt wrote:

On Tue, 5 Jun 2007, Darius Blaszijk wrote:

  

Hi I would like to upload a file through a web page. How can I do this using
FPC? Is there any example available?



The fpweb or cgiapp components can do this for you.

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


  

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


Re: [fpc-pascal] Search order for libraries, how to influence; using GMP

2007-06-12 Thread Darius Blaszijk
BTW: JediMath has a 100% pascal implementation for arbitrary length 
arithmatic. Checkout JmLargeFloat.


Darius

Tom Verhoeff wrote:

I am trying to use the GNU Multi-Precision (GMP) library with
FreePascal under Linux.

I have a Pascal interface for GMP (originally for Kylix; translated
from C header file).

The header file libgmp.pas and my using program testgmp.pas compile fine.

But linking fails.  The message is

/usr/bin/ld: skipping incompatible /usr/lib/crti.o when searching for 
/usr/lib/crti.o
/usr/bin/ld: cannot find /usr/lib/crti.o

This might be caused by the fact that I use a 64-bit machine with
a 32-bit version of FPC.

For that reason, I added the command-line option:

-Fl/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32

Without this option, I get the message

/usr/bin/ld: skipping incompatible 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o when searching for 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o
/usr/bin/ld: cannot find /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/crtbegin.o

With the option, it does find the appropriate crtbegin.o.

Therefore, I also added the command-line option

-Fl/usr/lib32

But this does not help, since /usr/lib is searched first and there if
finds the incompatible (64-bit?) version of crti.o, and fails.

How can I force the linker to look in /usr/lib32 before /usr/lib ?

When inspecting link.res, it starts out

SEARCH_DIR(/lib/)
SEARCH_DIR(/usr/lib/)
SEARCH_DIR(/usr/X11R6/lib/)
SEARCH_DIR(/usr/lib32/)
SEARCH_DIR(/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/32/)
SEARCH_DIR(/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/)

Apparently, the first three are forced 'out of nowhere', then there are
the two options from the command line, and then the one from /etc/fpc.cfg,
followed by a long list of directories named /usr/lib/fpc/* .

Where do the first three come from?  Can those be (re)moved?

Thanks,

Tom
  

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


Re: [fpc-pascal] fpcunit documentation?

2007-06-12 Thread Darius Blaszijk
The link you gave below to the pdf seems to point to a valid file. 
Please recheck it.


Darius


Tom Verhoeff wrote:

I know FreePascal includes the fpcunit unit testing framework
(the compiler knows where to find it), but I can't seem to find any
documentation via the regular www.freepascal.org, or the fpc wiki,
or on the lazarus site?

Michael's fpcunit.pdf seems hidden.  Google tells me it is here



but that directory does not list it.

That is a pity.

Can someone educate me (or update the site)?

Is there any more up-to-date documentation.  I know some people
enhanced fpcunit after Michael's article from 9 October 2005.

Tom
  

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


Re: [fpc-pascal] Metaware

2007-06-18 Thread Darius Blaszijk



Tom Walsh wrote:

Daniël Mantione wrote:


Wow... I doubt I would recognize that code as Pascal if I wasn't told 
it was. Free Pascal implements the UCSD-Pascal derived dialects of 
the language (Turbo Pascal, Delphi, Metrowerks Pascal).


Daniël
 
 

== begin 
export (libdos4);

{ Include MetaWare libraries }
pragma c_include('implement.pf');
pragma c_include('language.pf');
...
...
pragma c_include('dospriv.inc');




Yes, I know.  I learned the UCSD Pascal dialect while programming old 
Apple ][ pascal.  Heh, that was a while ago.  This Metaware looks 
pretty much like UCSD code in a lot of respects, but then they go into 
these weird C-like extensions.


Fortunately, the developers are still very much active writing new 
code against the Metaware compiler.  You know how it is, just like 
Cobol, once you get them hooked (swindled?), management will keep 
shoveling money into it...



{$mode metaware}

:)


TomW





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


Re: [fpc-pascal] Alternative to Makefiles for fpGUI

2007-08-10 Thread Darius Blaszijk

Johann Glaser wrote:

Is there any documentation (like the things you've written in this
thread) in the Wiki? If not, I'd like to copy-paste (and clean up) your
discussion. Please point me to a place where the information best fits.
  
I was also thinking the same ;) . I've created a stub here: 
http://wiki.freepascal.org/FPMake


This page later can be the basis for documentation that can be 
distributed with FPC. I'm volunteering for the LaTeX conversion ;)


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


Re: [fpc-pascal] Alternative to Makefiles for fpGUI

2007-08-10 Thread Darius Blaszijk

Hi Michael,

Michael Van Canneyt wrote:
The idea is that you do a 


fppkg 

this will look in a database for the package, extract it, 
and the compile fpmake.pp and run it. The fpmake contains

all configuration to make and zip the package.
  
Aha, this clears up some mist in my mind. But I still don't really 
understand how the packages thing actually works on "standalone" 
projects. You once mentioned something  that one could register it's 
project as a package. What would the workflow be if fpmake would be used 
in a non fpc-devel related project?


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


[fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk
I was reading the readme in FPC\utils\fppkg and saw that there should be 
a tool called fpmkconv that converts makefile.fpc to fpmake.pp files. I 
just cannot find it in the FPC sources.


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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk

Michael,

Thanks for explaining that, but.

I tried to convert a sample Makefile.fpc, but I keep getting the 
following error message;


>fppkg convertmk Makefile.fpc
Loading global configuration from "C:\pp\bin\i386-Win32\fppkg.cfg"
Generating default compiler configuration in 
"C:\pp\bin\i386-Win32\fppkg\config\default"

The FPC make tool encountered the following error:
Compiler returns invalid information, check if fpc -iV works

>fpc -iV
2.3.1

I also tried to set the verbosity level higher, but I just cannot find 
out how to do that. I tried anything from -va to --verbosity=all to just 
-v and --verbosity. No luck.


Darius

Michael Van Canneyt wrote:

On Sat, 11 Aug 2007, Darius Blaszijk wrote:

  

I was reading the readme in FPC\utils\fppkg and saw that there should be a
tool called fpmkconv that converts makefile.fpc to fpmake.pp files. I just
cannot find it in the FPC sources.



fppkg does it by itself. The functionality has been integrated. 
I will update the README.


Just run

fppkg convertmk Makefile.fpc

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


  

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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk
You're right. I don't have a clue why, but when I remove poNoConsole for 
the TProcess it works. I attached a patch.


Unfortunately it still doesn't work. Fppkg cannot find the Makefile.fpc. 
Output below.


>fppkg convertmk Makefile.fpc
Loading global configuration from "C:\pp\bin\i386-Win32\fppkg.cfg"
Loading compiler configuration from 
"C:\pp\bin\i386-Win32\fppkg\config\default"

Loading packages information from "C:\pp\bin\i386-Win32\fppkg\packages.xml"
Loading local versions information from 
"C:\pp\bin\i386-Win32\fppkg\versions-default.dat"

The FPC make tool encountered the following error:
Package "Makefile.fpc" not found.

I also tried giving the full path to the makefile without success.

Darius

Michael Van Canneyt wrote:

On Sat, 11 Aug 2007, Darius Blaszijk wrote:

  

Michael,

Thanks for explaining that, but.

I tried to convert a sample Makefile.fpc, but I keep getting the following
error message;



fppkg convertmk Makefile.fpc
  

Loading global configuration from "C:\pp\bin\i386-Win32\fppkg.cfg"
Generating default compiler configuration in
"C:\pp\bin\i386-Win32\fppkg\config\default"
The FPC make tool encountered the following error:
Compiler returns invalid information, check if fpc -iV works



fpc -iV
  

2.3.1

I also tried to set the verbosity level higher, but I just cannot find out how
to do that. I tried anything from -va to --verbosity=all to just -v and
--verbosity. No luck.



You can't be more verbose for this. The problem is most likely that the tool
cannot execute the compiler (because it does not find it). 

It tries to capture the output of fpc -iVTPTO, and it expects to receive 3 words. 
If it does not, the error you get is displayed.


The error is in pkgoptions.pas, the function to read the output is in pkgglobals
pkgglobals.pp: GetCompilerInfo; The best is to see what goes wrong there...

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


  
Index: pkgglobals.pp
===
--- pkgglobals.pp	(revision 8260)
+++ pkgglobals.pp	(working copy)
@@ -245,9 +245,9 @@
 {$ELSE USE_SHELL}
   S:=TProcess.Create(Nil);
   S.Commandline:=ACompiler+' '+AOptions;
-  S.Options:=[poUsePipes,poNoConsole];
-  S.execute;
-  Count:=s.output.read(buf,BufSize);
+  S.Options:=[poUsePipes];
+  S.Execute;
+  Count:=S.Output.Read(buf,BufSize);
   S.Free;
 {$ENDIF USE_SHELL}
   SetLength(Result,Count);
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk

Michael Van Canneyt wrote:

fppkg mkconvert
  

Should be "fppkg convertmk" ;)
It will convert the Makefile.fpc in the current directory and compiles 
and runs it. I just tested here, and it works fine.
  

Right, much better indeed :) But

I got the following error message:

Unknown name/value pair in compiler section : unittargetdir
Unknown name/value pair in clean section : files

Which is:
unittargetdir=./units/$(CPU_TARGET)-$(OS_TARGET)
files=$(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(OEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(PPUEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(RSTEXT))


I suspect its something about the target macro's. What is your opinion? 
Can we implement something for these macro's? I have an idea already but 
would like to pass it trough you first, if that is ok with you.


PS, what did you think about the patch?

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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk

Peter Vreman wrote:

I got the following error message:

Unknown name/value pair in compiler section : unittargetdir
Unknown name/value pair in clean section : files

Which is:
unittargetdir=./units/$(CPU_TARGET)-$(OS_TARGET)
files=$(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(OEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(PPUEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(RSTEXT))


I suspect its something about the target macro's. What is your 
opinion? Can we implement something for these macro's? I have an idea 
already but would like to pass it trough you first, if that is ok 
with you.


That files line should not be necessary anymore. fpmake knows that 
.o/.ppu/.rst files are generated for units and needs to be clean. You 
only need to supply the unit names. But this part is still not 100% 
finished with things like implicit build units.
I'm with you, but fppkg keeps failing on the conversion of the macro's, 
which should be fixed imho. The question now is how.
But as you have already found out with the fpc execution the tool is 
still in (stalled) development.
Another reason why usage for non FPC projects should be supported ;) 
Increasing the usage will expose a lot of bugs and missing features 
which is good.

The poNoConsole patch is applied.

Thanks, although I still not understand why I had to remove the option.

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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk


Peter Vreman wrote:

I got the following error message:

Unknown name/value pair in compiler section : unittargetdir
Unknown name/value pair in clean section : files

Which is:
unittargetdir=./units/$(CPU_TARGET)-$(OS_TARGET)
files=$(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(OEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(PPUEXT)) \
 $(wildcard ./units/$(CPU_TARGET)-$(OS_TARGET)/*$(RSTEXT))


I suspect its something about the target macro's. What is your 
opinion? Can we implement something for these macro's? I have an 
idea already but would like to pass it trough you first, if that is 
ok with you.


That files line should not be necessary anymore. fpmake knows that 
.o/.ppu/.rst files are generated for units and needs to be clean. 
You only need to supply the unit names. But this part is still not 
100% finished with things like implicit build units.
I'm with you, but fppkg keeps failing on the conversion of the 
macro's, which should be fixed imho. The question now is how.


The convertmk is only a helper. It will never support 100% conversion. 
The macro and function support is one of those things that will not be 
supported.
I know what you mean, but if a feature is fairly simple to implement 
(like macros) then I see no objection to implement them. Why object? I 
am willing to make a patch for the feature, I was just informing on how 
to implement things.


But as you have already found out with the fpc execution the tool is 
still in (stalled) development.
Another reason why usage for non FPC projects should be supported ;) 
Increasing the usage will expose a lot of bugs and missing features 
which is good.


The main purpose for fppkg will be that all projects that want to 
distribute fpc units and execuatbles will be supported and produce a 
standard package that can be distributed from a web repository for 
easy  downloading and installation.


I was talking about fpmake.pp files, not fppkg which is FPC dependent 
indeed.

The poNoConsole patch is applied.

Thanks, although I still not understand why I had to remove the option.


I also don't know, but the latest fppkg features were only tested 
under linux and not under windows.
Like I said, not a bad thing using it for more than FPC, because that 
surfaces more bugs.


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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk

Btw,

How would

./units/$(CPU_TARGET)-$(OS_TARGET)

be translated to fpmake.pp format?

Do we need to use a "Case Installer.OS of" construct or can we 
implement$(CPU_TARGET) and $(OS_TARGET) as functions that return a 
string with the current targets?
I would say just replace the macros with {$I %FPCTARGETOS%} and {$I 
%FPCTARGETCPU%} but how do others feel?


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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-11 Thread Darius Blaszijk



Vincent Snijders wrote:

Darius Blaszijk schreef:
Do we need to use a "Case Installer.OS of" construct or can we 
implement$(CPU_TARGET) and $(OS_TARGET) as functions that return a 
string with the current targets?


I would say just replace the macros with {$I %FPCTARGETOS%} and {$I 
%FPCTARGETCPU%} but how do others feel?


I think that won't work for cross compilation. It returns the targetos 
where fpmake s running, not the targetos you want to compile too.


Are you shure? I mean once you have cross compiled the compiler, rtl and 
the lot using FPCTARGETOS or FPCTARGETCPU would yield the right 
information for that given compiler and rtl and the lot, not? Or do they 
give the actual system information? (which does not seem logical)


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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-12 Thread Darius Blaszijk

Vincent Snijders wrote:
I would say just replace the macros with {$I %FPCTARGETOS%} and {$I 
%FPCTARGETCPU%} but how do others feel?


I think that won't work for cross compilation. It returns the 
targetos where fpmake s running, not the targetos you want to 
compile too.


Are you shure? I mean once you have cross compiled the compiler, rtl 
and the lot using FPCTARGETOS or FPCTARGETCPU would yield the right 
information for that given compiler and rtl and the lot, not? Or do 
they give the actual system information? (which does not seem logical)


No, I am not sure, feel free to test and proof otherwise.
I can't actually cross compile here, so I will never be able to 
determine who's right unfortunately.



Suppose I am running on i386-linux and want to compile for i386-win32.

I compile fpmake which has {$I %FPCTARGETOS%} in its source. Suppose I 
compile fpmake for i386-win32, then it will contain the correct string 
for the unit path. Unfortunately, I cannot run that fpmake on my linux 
host, because it is compiled for win32.


So it is necessary to set fpctarget when compiling fpmake to the os of 
the host compiles the actual project using fpmake (i386-linux). In 
that case the unit dirs are only correct if you don't cross compile.
Sorry but I don't actually understand what you mean here. Is it that 
you mean that the following happens?


If Host = i386-linux and Target = i386-win32 then {$I %FPCTARGETOS%} = 
linux?
Instead of the expected {$I %FPCTARGETOS%} = win. Which is ok because 
the target IS i386-win32.


You never will run a "target" binary on the "host", unless the two are 
equal (which is normally the case). And therefore the FPC compiler info 
is always usable.


I'm not posing a proof here, but rather a Lemma ;)

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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-12 Thread Darius Blaszijk

Jonas Maebe wrote:


On 12 Aug 2007, at 09:51, Darius Blaszijk wrote:

If Host = i386-linux and Target = i386-win32 then {$I %FPCTARGETOS%} 
= linux?
Instead of the expected {$I %FPCTARGETOS%} = win. Which is ok because 
the target IS i386-win32.


Not the target for which you compile fpmake, because fpmake has to run 
on the host.
Must be my ignorance regarding cross-compiling, but don't you use two 
compilers in that case? I mean how is a win cross-compiler going to 
create valid executables on a linux host?


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


Re: [fpc-pascal] Where is fpmkconv?

2007-08-12 Thread Darius Blaszijk
I believe I found a better solution to the problem. In fprepos.pp two 
function OSToString and CPUToString are defined.


So a string ./units/$(CPU_TARGET)-$(OS_TARGET)

would be represented as './units/' + CPUToString(Defaults.CPU) + '-' + 
OSToString(Defaults.OS)


Darius

Jonas Maebe wrote:


On 12 Aug 2007, at 10:43, Darius Blaszijk wrote:


Jonas Maebe wrote:


On 12 Aug 2007, at 09:51, Darius Blaszijk wrote:

If Host = i386-linux and Target = i386-win32 then {$I 
%FPCTARGETOS%} = linux?
Instead of the expected {$I %FPCTARGETOS%} = win. Which is ok 
because the target IS i386-win32.


Not the target for which you compile fpmake, because fpmake has to 
run on the host.
Must be my ignorance regarding cross-compiling, but don't you use two 
compilers in that case? I mean how is a win cross-compiler going to 
create valid executables on a linux host?


Using a cross-assembler and cross-linker (either external or internal 
to the compiler). You only need a separate compiler if you compile for 
a different cpu platform. And even then you may also want to 
cross-compile the entire code on the host platform and only copy the 
resulting binary to the target platform.



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



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


[fpc-pascal] Inconsistencies in fpmake?

2007-08-12 Thread Darius Blaszijk
I was doing some tests with fpmake and came across what appears to be an 
inconsistency.


When fpmaking a program a units/cpu-os is created but the commandline 
parameters for FPC are "-FE." which causes the tool and possible other 
units to be placed in the directory where the program is located.
When calling "fpmake clean", the clean algorithm cannot find either the 
.ppu/.o or the .exe files as it searches the units directory and not the 
root dir.


I would like to patch this inconsistency, but I am not sure what the 
consensus is on fpmaking tools.


1) should -FU.units/cpu-os be used, so all compiled stuff is separated 
from the executable which will result in the root dir
2) should -FE. be used as it is now, but the units directory not be 
created anymore and the clean algorithm adjusted so it searches the 
right directory?


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


[fpc-pascal] Unknown usage of function FixPath

2007-08-13 Thread Darius Blaszijk
In fpmkunit.pp I found the function FixPath for which I don't understand 
the exact purpose of. What happens is that if I issue an install command 
the BaseInstallDir takes the FPCDIR env variable (which is c:\fpc in my 
case) (line 1472). This value is then passed on to FixPath which 
converts all '/','\',':' to PathDelim, so I end up with 'c\\fpc' as base 
install directory.


Two things

1) why is the colon converted to a slash which yields invalid paths (at 
least on windows)
2) although fpmake initially was developed to be a make tool for FPC, it 
can (and will be) used for other projects. Therefore I would propose not 
to initialize FBaseInstallDir with the FPC directory. But rather raise 
an exception if the basedir is not set in fpmake.pp (when issued an 
install command only ofcourse). This will make setting this variable 
mandatory.


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


Re: [fpc-pascal] Problem with interfaces

2007-08-19 Thread Darius Blaszijk
I've had similar issues some time ago. Have you tried FPC 2.3.1? It has 
a some interface fixes.


Darius

Joao Morais wrote:


Hello,

I have the following code:

{$mode objfpc}
interface

...

function DefaultObj: TObject;

implementation

var
  _Holder: IHolder;

function DefaultObj: TObject;
begin
  if not Assigned(_Holder) then
_Holder := THolder.Create(TSomeClass.Create);
  Result := _Holder.Instance;
end;

IHolder is an interface that the THolder class implements. The first 
call to the DefaultObj function creates the holder instance, as 
expected. New calls to the same function doesn't recreate it. Again, 
as expected.


The first call that I make to DefaultObj from *another* unit recreate 
the object, because, I don't know why, the _holder var points again to 
nil.


Changing the type of the _holder to THolder (ie an object pointer 
instead of an interface pointer) everything works flawlessly.


I have tried to create a small sample but couldn't reproduce the 
issue, anyway the source of the problem is gpl code. It fails under 
2.0.4 and current fixes_2_2 branch. Hints?


Thanks.

--
Joao Morais

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



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


[fpc-pascal] fpc verbosity

2007-08-22 Thread Darius Blaszijk

Is the following correct?

C:\FPC\rtl>fpc -v0 myproject.pp
Free Pascal Compiler version 2.3.1 [2007/08/22] for i386
Copyright (c) 1993-2007 by Florian Klaempfl

Shouldn't fpc -v0 -l myproject.pp give the above result?

I would expect not to see anything at all. Is there a way to prevent 
anything to show at all, only when an error occurs?


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


Re: [fpc-pascal] fpc verbosity

2007-09-06 Thread Darius Blaszijk

Anyone care to comment?

Darius

Darius Blaszijk wrote:

Vincent Snijders wrote:

Jonas Maebe schreef:


On 23 Aug 2007, at 01:09, Darius Blaszijk wrote:


Is the following correct?

C:\FPC\rtl>fpc -v0 myproject.pp
Free Pascal Compiler version 2.3.1 [2007/08/22] for i386
Copyright (c) 1993-2007 by Florian Klaempfl

Shouldn't fpc -v0 -l myproject.pp give the above result?


-l is in the default fpc.cfg file. -v0 has no effect on -l.


You can't turn it off by using -l- either. Maybe that can be 
implemented.



Please evaluate the following patch.

Darius


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


No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.484 / Virus Database: 269.12.2/967 - Release Date: 8/22/2007 6:51 PM
  

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


Re: [fpc-pascal] fpc verbosity

2007-09-06 Thread Darius Blaszijk



Anyone care to comment?


Sorry for that, I missed the commit.

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


[fpc-pascal] gprof setup on windows

2007-11-01 Thread Darius Blaszijk
I would like to profile my code on windows. I tried searching the wiki, 
but without much success on how to do that on windows. Can anyone 
explain me in a few words how this can be done?


Kind regards, Darius
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] streaming file from zip into my app

2007-12-01 Thread Darius Blaszijk

Marc Santhoff wrote:

Am Freitag, den 30.11.2007, 23:09 +0200 schrieb Graeme Geldenhuys:
  

On 30/11/2007, Marc Santhoff <[EMAIL PROTECTED]> wrote:


But I still have questions about the code. Do I understand correctly
that Graeme contributed the de-/compression code but it still has to get
integrated and used by the component?
  

We used the zlib (de)compression units from the tiOPF project. We
simply removed the references to other tiOPF units - it was pretty
stand-alone already so was easy.  So yes, what's left is to integrate
that code into the TZipFile component and do some tests. The
(de)compression code has already been well unit tested in tiOPF, so we
know that part works perfectly.  As I stated earlier, I have also
found a Object Pascal implementation of 7zip which I would like to add
to both TZipFile and tiOPF - I still need to double check the
licensing though.



I'm remembering slowly, zlib is for handling gzip format, pkzip format
is still missing. And 7zip, does it have it's own format or is this used
for the common ".zip"-files?

  
Both gzip and zip support DEFLATE compression. The main difference 
between the two is that gzip internally ias a solid archive and zip not. 
This enables the use of the zip format as a "filesystem" without 
requiring to inflate the entire archive.

7zip uses LZMA compression which is also supported by the zipfile format.

If I would want to complete the component, I'd try to use and maybe add
something to the unit I've already found in packages/extra/unzip. At
least the compression routines should do.
  
Wherever you will start it will boil down to implement the zlib 
compression / decompression (inflate / deflate) algorithms.


Darius


Marc


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


  

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


Re: [fpc-pascal] streaming file from zip into my app

2007-12-01 Thread Darius Blaszijk



Note if sb works on zlib, there still is a bugreport about OOo files and
zlib in mantis (mismatch in CRC). I tried to fix it, but got stuck 

  

Please note the following thread, as it might be the answer in this case.

http://groups.google.com/group/comp.compression/browse_thread/thread/c74cb43bfee50c70/cd976c21ac7460ca?lnk=gst&q=blaszijk#cd976c21ac7460ca

Darius

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