State of FPC target Native NT kernel mode (was: Re: [fpc-pascal] Re: Building kernel modules using fpc (for fun))

2011-01-16 Thread Sven Barth

On 16.01.2011 04:39, Paul Breneman wrote:

Sven Barth wrote:

On 15.01.2011 21:10, Lukasz Sokol wrote:

Henry Vermaak writes:



On 15 January 2011 19:48, Sven Barth wrote:

I might not be able to help you regarding this topic, but I believe
that
you'll get a wall of "use C, god damnit" if you ask there :P


@Sven : it's for fun. Whether I'd be having fun is probably debatable
but it may
be fun for many ;) And then, you know the steps : first they laugh at
you...


Yes, I don't want to spoil your fun. I even do such things myself
sometimes. See the port to Native NT (which also allows you basically
to write Windows NT drivers). But the developers on a Linux kernel
list might not be that open minded ^^


I have hopes that ReactOS might be usable for some embedded stuff, and
it is good to know if I need any custom drivers that something exists in
FPC. :)


It's not fully implemented currently. The last big update from me was to 
get the RTL nearly completly running for user mode applications. I 
haven't tested it inside kernel mode yet. But even if it works I 
wouldn't recommend to use the functions provided by the RTL inside a 
device driver, because you have to less control over what happens inside 
those functions (especially regarding paged vs. non-paged memory).


The state of the kernel mode part of Native NT is currently this:
* only legacy type device drivers tested (none of the more current 
driver frameworks)
* no usage of the kernel's exception handling (also applies to user 
mode); currently you'd need to do this manually in assembler

* no thread related functions
* only x86 currently

It should be not a big problem to enable x86_64, but currently I don't 
have a machine to test this (when I upgrade my "server" I hope to be 
able to run x86_64 Windows in a VM).


I also plan to add ARM support once ReactOS' ARM port can boot to user 
mode (I'd need to test this...)


You might want to keep an eye on this wiki page: 
http://wiki.freepascal.org/Target_NativeNT


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


[fpc-pascal] Re: Building kernel modules using fpc (for fun)

2011-01-16 Thread Lukasz Sokol
Lukasz Sokol  writes:

I have posted
http://pastebin.com/rM5GKB1q

which is the new version of http://pastebin.com/9D9ye7Pt.

This contains all 4 files needed for compilation, also moved the {$LINK } to the
kernel_module.pas (and also the printk() declaration moved there; Added some of
my touch to the files but went extra mile to keep the original author
(hopefully) happy.

It builds and insmods/rrmmods, printing Hello World and Bye-bye into dmesg ;)

(this is trivial enough code that I don't think it should eat my computer, so I
didn't bother with UML ;) or just like living dangerously... )

Why I decided to take the printk() definition out of system.pas ?

Well it seems to me more like 'Pascal way' that way. I think my next move would
be to put all the available versions of printk() (and all you can think of that
should be associated with it, but not module specific) into linux/printk.pas or
whatever would be appropriate and find out if it can be just added into the
'uses' section of the main kernel module pascal code... (implementation/uses,
probably ?)

(That way it should also be easier to track the never-changing-story of kernel
internals ;)
But that's for another hour of fun next time round ;)

For now,
enjoy and you have some fun too ;)
Lukasz

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


Re: [fpc-pascal] Converting .doc and/or .html to .pdf

2011-01-16 Thread Marcos Douglas
On Sat, Jan 15, 2011 at 7:39 PM, Andreas Schneider  wrote:
> On Saturday, January 15, 2011 22:18 Marcos Douglas wrote:
>> Hi,
>> There are libs, in Pascal,  to convert .doc and/or .html files to .pdf?
>
> I   don't   think   so,   but  I  would  suggest  to  use  a  headless
> OpenOffice.org/LibreOffice  for  the  conversion. Using the Pascal UNO
> Bridge  you  may even be able to control it from a Pascal application,
> but  for a simple conversion it's probably a lot easier to just invoke
> it via commandline.

You're right. The command line is more simple.
Thanks for the tip, I will try this.

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


[fpc-pascal] Re: Building kernel modules using fpc (for fun)

2011-01-16 Thread Lukasz Sokol
Paul Breneman  writes:


> This looks *very* interesting.  I'd like to add it (with *big* red flags 
> and notes not to try it on a production PC) to this page:
>http://www.turbocontrol.com/helloworld.htm

Yes please, you're welcome :) from my side no contradictions - you may like to
talk to the man who started it ;) There is still some stuff I'd like to do to
it, but a link to original instructions (fpc wiki) first, and the link to the
pastebin after that, would probably do all right ;)

I intend to play a bit more with it anyway, it is not finished to the point I'd
like to have it;

But there is something to start with.

Lukasz




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


[fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Pew (piffle.the.cat)

Hi all,

I am trying to build fp from 3.5.1 snapshot and I don't know what the 
command is.


I have downloaded fpc-2.5.1.i386-linux.tar.gz and extracted to /juni/fpc 
and downloaded fpcbuild.zip and extracted to /juni/3.5.1/.


I cannot find any instructions on how I can build fp from the source. 
What is the command for Linux for me to create fp ?


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


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Robert Wolfe

On 01/16/2011 11:03 AM, Pew (piffle.the.cat) wrote:

Hi all,

I am trying to build fp from 3.5.1 snapshot and I don't know what the 
command is.


I have downloaded fpc-2.5.1.i386-linux.tar.gz and extracted to 
/juni/fpc and downloaded fpcbuild.zip and extracted to /juni/3.5.1/.


I cannot find any instructions on how I can build fp from the source. 
What is the command for Linux for me to create fp ?


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



Pew, knowling how to build anything under linux is a fundamental skill 
that's necessary to run linux.  However, the usual way to build binaries 
from source code is to run ./configure first from the source code parent 
directory, then run make then run 'make install' as sudo.

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


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Mark Morgan Lloyd

Robert Wolfe wrote:

On 01/16/2011 11:03 AM, Pew (piffle.the.cat) wrote:

Hi all,

I am trying to build fp from 3.5.1 snapshot and I don't know what the 
command is.


I have downloaded fpc-2.5.1.i386-linux.tar.gz and extracted to 
/juni/fpc and downloaded fpcbuild.zip and extracted to /juni/3.5.1/.


I cannot find any instructions on how I can build fp from the source. 
What is the command for Linux for me to create fp ?


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



Pew, knowling how to build anything under linux is a fundamental skill 
that's necessary to run linux.  However, the usual way to build binaries 
from source code is to run ./configure first from the source code parent 
directory, then run make then run 'make install' as sudo.


Robert, I'm not sure you're being helpful since FPC does not use 
./configure.


Peter, I do not claim to be an experienced builder and I usually work 
from a source release (currently 2.4.2) rather than from SVN so your 
mileage may vary.


You will need the standard Linux binary utilities (as, ar, ld, make), 
how you get those depends on what distro you're using.


cd /fpcsrc
make NOGDB=1 clean all
make install

then check that the ppc symlink in /usr/local is correct.

There is a build FAQ for this which you will need when you start trying 
to do anything clever.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Pew (piffle.the.cat)

Hi Robert,

On 01/17/2011 03:59 AM, Mark Morgan Lloyd wrote:

Robert Wolfe wrote:

On 01/16/2011 11:03 AM, Pew (piffle.the.cat) wrote:

Hi all,

I am trying to build fp from 3.5.1 snapshot and I don't know what the
command is.

I have downloaded fpc-2.5.1.i386-linux.tar.gz and extracted to
/juni/fpc and downloaded fpcbuild.zip and extracted to /juni/3.5.1/.

I cannot find any instructions on how I can build fp from the source.
What is the command for Linux for me to create fp ?

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



Pew, knowling how to build anything under linux is a fundamental skill
that's necessary to run linux. However, the usual way to build
binaries from source code is to run ./configure first from the source
code parent directory, then run make then run 'make install' as sudo.


Robert, I'm not sure you're being helpful since FPC does not use
./configure.

Peter, I do not claim to be an experienced builder and I usually work
from a source release (currently 2.4.2) rather than from SVN so your
mileage may vary.

You will need the standard Linux binary utilities (as, ar, ld, make),
how you get those depends on what distro you're using.

cd /fpcsrc
make NOGDB=1 clean all


This command worked.


make install


This command did not work.

ls shows these files.

createbranch.sh
demo
fpcdocs
fpcsrc
install
logs
ls_result
Makefile
Makefile.fpc
readme.rev

sh ./createbranch.sh > temp1
gives this temp1 output.

Usage: createbranch.sh 

Example: createbranch.sh branches/fixes_2_1
 createbranch.sh tags/release_2_0_4

This makes no sense to me at all. Can someone please explain this to me.

Best Regards,
pew



then check that the ppc symlink in /usr/local is correct.

There is a build FAQ for this which you will need when you start trying
to do anything clever.



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


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Tomas Hajny
On 17 Jan 11, at 4:27, Pew (piffle.the.cat) wrote:

> Hi Robert,
> 
> On 01/17/2011 03:59 AM, Mark Morgan Lloyd wrote:
> > Robert Wolfe wrote:
> >> On 01/16/2011 11:03 AM, Pew (piffle.the.cat) wrote:
> >>> Hi all,
> >>>
> >>> I am trying to build fp from 3.5.1 snapshot and I don't know what the
> >>> command is.
> >>>
> >>> I have downloaded fpc-2.5.1.i386-linux.tar.gz and extracted to
> >>> /juni/fpc and downloaded fpcbuild.zip and extracted to /juni/3.5.1/.
> >>>
> >>> I cannot find any instructions on how I can build fp from the source.
> >>> What is the command for Linux for me to create fp ?
> >>>
> >>> Best Regards,
> >>> pew
> >>> ___
> >>> fpc-pascal maillist - fpc-pascal@lists.freepascal.org
> >>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> >>>
> >>
> >> Pew, knowling how to build anything under linux is a fundamental skill
> >> that's necessary to run linux. However, the usual way to build
> >> binaries from source code is to run ./configure first from the source
> >> code parent directory, then run make then run 'make install' as sudo.
> >
> > Robert, I'm not sure you're being helpful since FPC does not use
> > ./configure.
> >
> > Peter, I do not claim to be an experienced builder and I usually work
> > from a source release (currently 2.4.2) rather than from SVN so your
> > mileage may vary.
> >
> > You will need the standard Linux binary utilities (as, ar, ld, make),
> > how you get those depends on what distro you're using.
> >
> > cd /fpcsrc
> > make NOGDB=1 clean all
> 
> This command worked.
> 
> > make install
> 
> This command did not work.
> 
> ls shows these files.
> 
> createbranch.sh
> demo
> fpcdocs
> fpcsrc
> install
> logs
> ls_result
> Makefile
> Makefile.fpc
> readme.rev
> 
> sh ./createbranch.sh > temp1
> gives this temp1 output.
> 
> Usage: createbranch.sh 
> 
> Example: createbranch.sh branches/fixes_2_1
>   createbranch.sh tags/release_2_0_4
> 
> This makes no sense to me at all. Can someone please explain this to me.

createbranch.sh is not relevant for you, don't worry about it. Go to 
fpcsrc ("cd fpcsrc") and use the make command proposed in the other e-
mail.

Tomas

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


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Mark Morgan Lloyd

Pew (piffle.the.cat) wrote:

On 01/17/2011 03:59 AM, Mark Morgan Lloyd wrote:



Peter, I do not claim to be an experienced builder and I usually work
from a source release (currently 2.4.2) rather than from SVN so your
mileage may vary.

You will need the standard Linux binary utilities (as, ar, ld, make),
how you get those depends on what distro you're using.

cd /fpcsrc
make NOGDB=1 clean all


This command worked.


make install


This command did not work.


/How/ did not work?


ls shows these files.

createbranch.sh
demo
fpcdocs
fpcsrc


You're in the wrong directory, or have a vey badly screwed directory 
structure.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] command for Linux for me to create fp ?

2011-01-16 Thread Tomas Hajny
On 16 Jan 11, at 17:36, Mark Morgan Lloyd wrote:
> Pew (piffle.the.cat) wrote:
> > On 01/17/2011 03:59 AM, Mark Morgan Lloyd wrote:
> 
> >> Peter, I do not claim to be an experienced builder and I usually work
> >> from a source release (currently 2.4.2) rather than from SVN so your
> >> mileage may vary.
> >>
> >> You will need the standard Linux binary utilities (as, ar, ld, make),
> >> how you get those depends on what distro you're using.
> >>
> >> cd /fpcsrc
> >> make NOGDB=1 clean all
> > 
> > This command worked.
> > 
> >> make install
> > 
> > This command did not work.
> 
> /How/ did not work?
> 
> > ls shows these files.
> > 
> > createbranch.sh
> > demo
> > fpcdocs
> > fpcsrc
> 
> You're in the wrong directory, or have a vey badly screwed directory 
> structure.

Most probably the former. This is the contents of the fpcbuild SVN 
repository, fpcsrc is inside this one (as suggested by the directory 
listing).

Tomas

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


Re: [fpc-pascal] FPC 2.x for old Solaris

2011-01-16 Thread Mark Morgan Lloyd

Mark Morgan Lloyd wrote:

Thanks for that, noted for next time :-) The solution turned out to be 
fairly easy: the Solaris compiler uses dynamic libraries since some 
(libm) don't exist in static form on 10 and others (libmd5 etc.) don't 
exist in static form at all. Taking ppcsparc from 10 and running it on 8 
failed because it was linked against libm.so which was a symlink to 
libm.so.2, it was resolving that at link time so required libm.so.2 
rather than libm.so. However libm.so.1 is on Solaris 10 and simply 
changing the symlink before linkage created a binary that would run on 
both 10 and 8.


So the remaining question is whether it it possible to tell FPC build to 
always link against libm.so.1 rather than using the symlink, since 
messing around with the symlink would obviously be undesirable on a 
system with multiple users.


As noted elsewhere I've got FPC on Solaris 10 to the state where it will 
compile (but not fully link) Lazarus, fpGUI appears OK so we're probably 
at a state where lazbuild on simple projects would work.


FPC 2.4.2 is OK on both Solaris 8 and 10, including the fp text IDE 
(without mouse or debugger support). Minor patches in bug 0018271 might 
be a prerequisite.


I'm not trying Lazarus on Solaris 8 on account of missing libraries etc.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] D-Bus. Non blocking listening for signals

2011-01-16 Thread dibo20
I found another way to register own callback events (this is example 
which connect to Pidgin instant messenger):


var
VTable: DBusObjectPathVTable;


function MessageHandler(connection: PDBusConnection; message_: PDBusMessage;
user_data: Pointer): DBusHandlerResult; cdecl;
begin
MemoLog.Lines.Add('New signal');

Result := DBUS_HANDLER_RESULT_HANDLED;
end;

function BusConnect: Boolean;
begin
Result := False;
dbus_error_init(@err);
MemoLog.Lines.Add('Listening for signals');
{ Connection }
conn := dbus_bus_get(DBUS_BUS_SESSION, @err);

if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Connection Error: ' + err.message);
dbus_error_free(@err);
end;

{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'im.pidgin.purple.PurpleInterface', 
DBUS_NAME_FLAG_REPLACE_EXISTING, @err);


if dbus_error_is_set(@err) <> 0 then
begin
MemoLog.Lines.Add('Name Error: ' + err.message);
dbus_error_free(@err);
Exit;
end;

// add a rule for which messages we want to see
dbus_bus_add_match(conn, 
'type=''signal'',interface=''im.pidgin.purple.PurpleInterface''', @err); 
// see signals from the given interface

dbus_connection_flush(conn);
if (dbus_error_is_set(@err) <> 0) then
begin
MemoLog.Lines.Add('Match Error (' + err.message + ')');
Exit;
end;
MemoLog.Lines.Add('Match rule sent');

VTable.message_function := @MessageHandler;
if dbus_connection_try_register_object_path(conn, 
'/im/pidgin/purple/PurpleObject', @VTable, nil, @err)=0 then

MemoLog.Lines.Add('Cant register');
if (dbus_error_is_set(@err) <> 0) then
begin
MemoLog.Lines.Add('Error in register (' + err.message + ')');
Exit;
end;

Result := True;
end;

But this same problem like with dbus_connection_set_wakeup_main_function 
- It works only on my computer (64 bit ubuntu). When I send this 
executable to my friends or compile and run on 32 bit ubuntu, then 
MessageHandler is never called. dbus_connection_try_register_object_path 
return TRUE and error is not set, so I don't know what is a reason. But 
this is another proof that something is wrong with receiving callback 
events by free pascal dbus. I have no idea what blocking this on other 
computers. Firewall? Missing some librarys? On each computer is same 
libdbus library.

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