{$R file} support on non-Windows targets

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

{$R file} support on non-Windows targets

Craig Peterson-4
Does any version of FPC support the {$R file} syntax for resources on
non-Windows targets?  I'd prefer that to Lazarus's LResources unit.  I
have the impression that some work on it was done as part of Simon
Kissel's CrossFPC project, but I haven't been able to verify that.  Was
work done and never completed?  Is it a TODO that just doesn't have
anyone to work on it?

Thanks,
Craig Peterson
Scooter Software

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Michael Van Canneyt


On Wed, 9 Jul 2008, Craig Peterson wrote:

> Does any version of FPC support the {$R file} syntax for resources on
> non-Windows targets?  I'd prefer that to Lazarus's LResources unit.  I have
> the impression that some work on it was done as part of Simon Kissel's
> CrossFPC project, but I haven't been able to verify that.  Was work done and
> never completed?  Is it a TODO that just doesn't have anyone to work on it?

All targets in 2.3.1 now support {$R file} syntax.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Felipe Monteiro de Carvalho
On Wed, Jul 9, 2008 at 2:20 PM, Michael Van Canneyt
<[hidden email]> wrote:
> All targets in 2.3.1 now support {$R file} syntax.

So I assume we have a cross-platform resource compiler now, so is
windres unnecessary? Was pre-processing also implemented?

Also, how do you access the resources? With TResourceStream?

thanks,
--
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Giulio Bernardi
Felipe Monteiro de Carvalho ha scritto:
> On Wed, Jul 9, 2008 at 2:20 PM, Michael Van Canneyt
> <[hidden email]> wrote:
>> All targets in 2.3.1 now support {$R file} syntax.
>
> So I assume we have a cross-platform resource compiler now, so is
> windres unnecessary? Was pre-processing also implemented?

No. To compile .rc files to .res you still need windres. In general you
can compile and run it fine on little endian machines, but it doesn't
work (at least, it didn't work 6 months ago, don't know if newer
versions are endian safe) on big endian machines.
So there is still no .rc compiler. However the 2.3.1 fpcres is able to
compile dfm/lfm/xfm files.

>
> Also, how do you access the resources? With TResourceStream?

With RTL functions like FindResource, LoadResource and so on.
TResourceStream uses these functions.

Giulio
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
In reply to this post by Craig Peterson-4
2008/7/9 Craig Peterson <[hidden email]>:
> Thanks,
> Craig Peterson
> Scooter Software

Is this Scooter Software that brought the awesome Beyond Compare 2 to
Windows users?  If so, I sure hope the query is because work on BC
2.xx or 3.x involves other platforms like Linux. ;-)

If not, it's ok, BC2 works very nice via Linux + WINE.

Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Craig Peterson-4
> Is this Scooter Software that brought the awesome Beyond Compare 2 to
> Windows users?  If so, I sure hope the query is because work on BC
> 2.xx or 3.x involves other platforms like Linux. ;-)

Yes it is, and you must not be on the beta list. ;-)  V3 is in public
beta and the Linux port is already available.  We're currently using
Kylix, but we're looking into swapping out the compiler for FPC first,
with a transition from CLX to LCL sometime later.

http://www.scootersoftware.com/beta3/

Regards,
Craig Peterson
Scooter Software


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
2008/7/9 Craig Peterson <[hidden email]>:
> Yes it is, and you must not be on the beta list. ;-)  V3 is in public beta
> and the Linux port is already available.  We're currently using Kylix, but
> we're looking into swapping out the compiler for FPC first, with a
> transition from CLX to LCL sometime later.

My day is just getting better, Thanks Craig! :-)  I'll try and
download the beta now. I'm a Linux junkie, but there are 3 Windows
products I can't do without. Beyond Compare 2, Total Commander and
PINS.  Hopefully soon, that will be down to only 2 Windows products.
;-)

Keep up the good work!

Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Paul Ishenin-2
In reply to this post by Michael Van Canneyt
Michael Van Canneyt wrote:

> On Wed, 9 Jul 2008, Craig Peterson wrote:
>
>  
>> Does any version of FPC support the {$R file} syntax for resources on
>> non-Windows targets?  I'd prefer that to Lazarus's LResources unit.  I have
>> the impression that some work on it was done as part of Simon Kissel's
>> CrossFPC project, but I haven't been able to verify that.  Was work done and
>> never completed?  Is it a TODO that just doesn't have anyone to work on it?
>>    
>
> All targets in 2.3.1 now support {$R file} syntax
And lazarus with fpc 2.3.1 can load forms from native resources. If you
look at LResources.pas you will see:
{$IFDEF FPC_HAS_WINLIKERESOURCES}
  {$DEFINE UseRES}
{$ENDIF}

There you can also look how UseRES is used.

Best regards,
Paul Ishenin.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
In reply to this post by Giulio Bernardi
On Wed, Jul 9, 2008 at 8:17 PM, Giulio Bernardi <[hidden email]> wrote:
>> So I assume we have a cross-platform resource compiler now, so is
>> windres unnecessary? Was pre-processing also implemented?
>
> No. To compile .rc files to .res you still need windres. In general you can
> compile and run it fine on little endian machines, but it doesn't work (at
> least, it didn't work 6 months ago, don't know if newer versions are endian
> safe) on big endian machines.

So is that the technical issue with cross-platform resource compilers?
The endian handling? Or is there some other technical issue? I
remember even Kylix didn't have a resource compiler and couldn't
understand why.  After all, most C/C++ compilers are cross platform
and they seem to have resource compilers, so what is wrong with Object
Pascal compilers...

Sorry if this is dumb, but I obviously don't understand the full issue here...


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Giulio Bernardi
Graeme Geldenhuys ha scritto:

> On Wed, Jul 9, 2008 at 8:17 PM, Giulio Bernardi <[hidden email]> wrote:
>>> So I assume we have a cross-platform resource compiler now, so is
>>> windres unnecessary? Was pre-processing also implemented?
>> No. To compile .rc files to .res you still need windres. In general you can
>> compile and run it fine on little endian machines, but it doesn't work (at
>> least, it didn't work 6 months ago, don't know if newer versions are endian
>> safe) on big endian machines.
>
> So is that the technical issue with cross-platform resource compilers?
> The endian handling? Or is there some other technical issue? I
> remember even Kylix didn't have a resource compiler and couldn't
> understand why.  After all, most C/C++ compilers are cross platform
> and they seem to have resource compilers, so what is wrong with Object
> Pascal compilers...
>
> Sorry if this is dumb, but I obviously don't understand the full issue here...
>

The concept of "resources" is a bit vague when talking about different
platforms. Some systems have this concept, some no, and they are all
different things, though the basic thing that they provide is a way to
embed data in applications.
E.g. windows has it's own definition of resources, classic Mac OS
another, Mac OS X another, OS/2 another one, Unix doesn't have
"resources", and so on. So a "cross platform resource compiler" is not
common because there isn't a standardized resource format.
In 2.3.1 we support resources "the windows way" on non-windows systems:
the 2.3.1 fpcres is able to convert .res files to object files which
will be linked in your application. However we don't have a resource
compiler yet (a compiler that is able to compile .rc files to .res
files). There is gnu windres though which is able to do this work.
Windres can also be compiled on Linux (and on other unixes I think).
However, windres isn't endian safe so it's useless on big endian
machines: maybe they never thought about the possibility of
crosscompilation from, say, linux powerpc to win32.
You can of course embed already made .res files, since the 2.3.1 fpcres
is endian safe. And it can also compile dfm/lfm/xfm files.

Regarding the fact that most C/C++ compilers have resource compilers...
well in general OS vendors provide resource compilers if their system
have this concept (rc.exe from microsoft, ReZ from Apple). Moreover some
compiler vendor provide their own (brcc32 from borland, wrc from watcom,
gorc), but they are not "cross platform", even if wrc is able to compile
  win32, win16 and os2 resource files for those systems.

Giulio
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
On Thu, Jul 10, 2008 at 9:13 AM, Giulio Bernardi <[hidden email]> wrote:
> vendor provide their own (brcc32 from borland, wrc from watcom, gorc), but
> they are not "cross platform", even if wrc is able to compile  win32, win16
> and os2 resource files for those systems.

You stole my example! :-) I was just about to mention Watcom's
resource compiler. If it works for Win32, Win16 and OS/2, how can it
not be cross-platform?  Or do you mean not cross-platform, because a
.res file compiled under OS/2 cannot be used as-is under Win32?  If
the latter, would that really be an issue for FPC with a slogan like
"write once, compile everywhere". As long as the application is
compiled on the platform it needs to run on, the resource will be
correct.  This excludes cross-compiling, no idea how that works.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Giulio Bernardi
Graeme Geldenhuys ha scritto:
> On Thu, Jul 10, 2008 at 9:13 AM, Giulio Bernardi <[hidden email]> wrote:
>> vendor provide their own (brcc32 from borland, wrc from watcom, gorc), but
>> they are not "cross platform", even if wrc is able to compile  win32, win16
>> and os2 resource files for those systems.
>
> You stole my example! :-) I was just about to mention Watcom's
> resource compiler. If it works for Win32, Win16 and OS/2, how can it
> not be cross-platform?  Or do you mean not cross-platform, because a
> .res file compiled under OS/2 cannot be used as-is under Win32?

Exactly. E.g. OS/2's .res format is like the win16 one but without
support for string IDs (that is, you can't have a os/2 resource named
'MYFORM'). Moreover they have little syntax differences here and there.
For what regards wrc, it's simple: you tell wrc you want to compile a
win32 rc file, and it will output a win32 .res file. If you tell it to
use win16 format, .rc file must use that syntax and it will be compiled
as a win16 resource.
So you can't use wrc to compile a win32 rc file to a os2 res file: it's
like to have three separate resource compilers in one.

>  If
> the latter, would that really be an issue for FPC with a slogan like
> "write once, compile everywhere". As long as the application is
> compiled on the platform it needs to run on, the resource will be
> correct.  This excludes cross-compiling, no idea how that works.
>
The idea is that we support win32 resources everywhere, since the {$R}
stuff comes from delphi, where it's used for win32 resources.
At the moment, winlike resources aren't supported on os/2 or classic mac
os because one might want to use their platform-specific resources. One
idea I have is to add something like {$resmode native/win32} (example
case: lazarus starts using resources, someone decides to port lazarus to
os/2, we have a problem. With the switch a program could contain both
win32 resources used by lazarus and os2 resources like the program icon
and so on).

Giulio

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Joost van der Sluis
In reply to this post by Graeme Geldenhuys-2
Op woensdag 09-07-2008 om 23:23 uur [tijdzone +0200], schreef Graeme
Geldenhuys:

> My day is just getting better, Thanks Craig! :-)  I'll try and
> download the beta now. I'm a Linux junkie, but there are 3 Windows
> products I can't do without. Beyond Compare 2, Total Commander and
> PINS.  Hopefully soon, that will be down to only 2 Windows products.
> ;-)

Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
latest version also written in fpc.

Joost

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Donald Shimoda
2008/7/13 Joost van der Sluis <[hidden email]>:
> Op woensdag 09-07-2008 om 23:23 uur [tijdzone +0200], schreef Graeme
> Geldenhuys:
>
>> My day is just getting better, Thanks Craig! :-)  I'll try and
>> download the beta now. I'm a Linux junkie, but there are 3 Windows
>> products I can't do without. Beyond Compare 2, Total Commander and
>> PINS.  Hopefully soon, that will be down to only 2 Windows products.
>> ;-)

Beyond compare already have a linux version (BC 3) and work like a sharm.


HTH

Donald Shimoda

http://donaldshimoda.blogspot.com
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
In reply to this post by Joost van der Sluis
On Sun, Jul 13, 2008 at 9:56 PM, Joost van der Sluis <[hidden email]> wrote:
>
> Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
> latest version also written in fpc.

Last time I tried Tux Commander, it didn't come close to Total
Commander.  Maybe I give it another try as it's been a few months.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Donald Shimoda
2008/7/13 Graeme Geldenhuys <[hidden email]>:
> On Sun, Jul 13, 2008 at 9:56 PM, Joost van der Sluis <[hidden email]> wrote:
> Last time I tried Tux Commander, it didn't come close to Total
> Commander.  Maybe I give it another try as it's been a few months.
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/

Big OT, your site is not working. I wanna try fpgui on lazarus.

Besty regards.

Donald Shimoda

http://donaldshimoda.blogspot.com/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Valdas Jankūnas
In reply to this post by Graeme Geldenhuys-2
Graeme Geldenhuys rašė:
> On Sun, Jul 13, 2008 at 9:56 PM, Joost van der Sluis <[hidden email]> wrote:
>> Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
>> latest version also written in fpc.
>
> Last time I tried Tux Commander, it didn't come close to Total
> Commander.  Maybe I give it another try as it's been a few months.

How about Krusader (http://krusader.org/):

"...is an advanced twin panel (commander style) file manager for KDE and
other desktops in the *nix world, similar to Midnight or Total Commander..."


--
   Valdas Jankūnas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
In reply to this post by Donald Shimoda
On Sun, Jul 13, 2008 at 11:47 PM, German Gentile
<[hidden email]> wrote:
>> fpGUI - a cross-platform Free Pascal GUI toolkit
>> http://opensoft.homeip.net/fpgui/
>
> Big OT, your site is not working. I wanna try fpgui on lazarus.

They were working on our backup generator over the weekend, so we had
to power everything down. All is back to normal again.  The SubVersion
repository is on SourceForge, so you could still have gotten a copy.
Sorry for any inconvenience.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
http://www.sourceforge.net/projects/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Graeme Geldenhuys-2
In reply to this post by Valdas Jankūnas
On Mon, Jul 14, 2008 at 2:10 AM, Valdas Jankūnas <[hidden email]> wrote:
>
> How about Krusader (http://krusader.org/):

I haven't tried that in years.

I found a project called Double Commander (doublecmd) on SourceForge.
It still has many visual issues (it looks quite ugly under GTK1), but
it seems to have potential - like it has a couple of nice features
like support for Total Commander plugins, very customizable etc...
I'll definitely keep my eye on this project.

By the way, it's a Lazarus based project as well!  :-)


Regards,
 - Graeme -


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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: {$R file} support on non-Windows targets

Luiz Americo Pereira Camara-2
In reply to this post by Graeme Geldenhuys-2
Graeme Geldenhuys wrote:

> On Sun, Jul 13, 2008 at 11:47 PM, German Gentile
> <[hidden email]> wrote:
>  
>>> fpGUI - a cross-platform Free Pascal GUI toolkit
>>> http://opensoft.homeip.net/fpgui/
>>>      
>> Big OT, your site is not working. I wanna try fpgui on lazarus.
>>    
>
> They were working on our backup generator over the weekend, so we had
> to power everything down. All is back to normal again.  The SubVersion
> repository is on SourceForge, so you could still have gotten a copy.
> Sorry for any inconvenience.
>
>  

I still can not access the website or the news server

Luiz
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
12