Forum > Free Pascal

fpcres now supports compilation of RC files

<< < (4/5) > >>

lucamar:

--- Quote from: Fred vS on December 16, 2020, 03:21:12 pm ---But is it possible to use fpcres as stand-alone, something like:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpcres myresource.rcThat will produce a myresource.res.

And so first produce the .res , and in code, just use:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$R *.res}
--- End quote ---

You can always add it as an "Execute before" command in the "Compiler Commands" options of the project but you need an fpcres able to deal with .rc files; the only thing the currently released version (2.0) is able to do is convert a .res, normally into .o to link into the executable.

And even with the newish one you need to set all those options, as you have already discovered :)

Fred vS:

--- Quote from: lucamar on December 16, 2020, 04:13:06 pm ---
--- Quote from: Fred vS on December 16, 2020, 03:21:12 pm ---But is it possible to use fpcres as stand-alone, something like:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fpcres myresource.rcThat will produce a myresource.res.

And so first produce the .res , and in code, just use:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$R *.res}
--- End quote ---

You can always add it as an "Execute before" command in the "Compiler Commands" options of the project but you need an fpcres able to deal with .rc files; the only thing the currently released version (2.0) is able to do is convert a .res, normally into .o to link into the executable.

And even with the newish one you need to set all those options, as you have already discovered :)

--- End quote ---

Hello Lucamar.

Indeed, I did try with fpcres from FPC 3.2.0 and FPC 3.2.1 but rc format is not recognized.

But the one from FPC 3.3.1 trunk is working perfectly.
Very great job Sven.

Fre;D



PascalDragon:

--- Quote from: Fred vS on December 16, 2020, 04:07:44 pm ---OK, I get it, this works perfectly on Linux (note the last parameters):


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---fred@fiens ~/l/lazpaint> fpcres /home/fred/lazpaint-master/lazpaint/lazpaint.rc -o lazpaint.res -of res
--- End quote ---

Yes, we've decided against enabling res output by default (or some auto magic) due to backwards compatibility.

lucamar:

--- Quote from: PascalDragon on December 17, 2020, 09:23:36 am ---Yes, we've decided against enabling res output by default (or some auto magic) due to backwards compatibility.
--- End quote ---

But, what about .rc input? Is it also disabled unless an output format is set? 'Cause that would kind of defeat the purpose of the new feature  ... whatever that is :)

IMHO, when one adds a new input format one should also define a default output one for it, depending on the purpose of the tool. Since fpcres has 'most always been about creating an object for linking, it's understandable that res output be available only on demand, but the problem seems to be that there is no default support for rc input either.

I'm not criticizing or anything ... well, yes, a little, but in a good way: I just would like some gleaming on your thougths about it.

marcov:
I tried on one of my RCs (which embed shader files as resource streams), and it gives an error.

call:   

--- Code: ---fpcres shadersrc.rc -o shadersrc.res -of res
--- End code ---

error:

--- Code: ---#MAIN.RC(1:43): at "emptycirclevertex": syntax error
vertexemptycircle RCDATA emptycirclevertex.ssrc
                                          ^
--- End code ---

that first line is as reproduced in the error :


--- Code: ---vertexemptycircle RCDATA emptycirclevertex.ssrc
--- End code ---

which puts a shader source file as rcdata stream with name/ident vertexemptycircle. Note that some paths have windows style quoting, but it doesn't even get there:


--- Code: ---thefontmeta RCDATA "c:\candelasvn\candelatex\pic\fonts\arial.fnt"

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version