• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

DocKimbel
13-May-2013
[7771]
PE format does not require specific section names, so Red uses its 
own ones.
Oldes
13-May-2013
[7772]
be able to add just the empty .rsrc section would be a good start.
DocKimbel
13-May-2013
[7773x5]
Let me see...
Pushed it in new rsrc-support branch: https://github.com/dockimbel/Red/tree/rsrc-support
See the commit diff: https://github.com/dockimbel/Red/commit/160cf3dfa3629c63b4dc2e9465fb5337a43754b8
That base should be enough for a start, the hard part now is to generate 
the resources tree with all the right entries ...far from easy.
Oh, it seems I've stopped in the middle of the coding session at 
ligne 381 in PE.r.
Oldes
13-May-2013
[7778]
Hm.. I'm not sure this will help me. I have the rsrc data (parsed 
from valid file), just the section's adress is not correct.
DocKimbel
13-May-2013
[7779]
rsrc entries contain file offsets and memory addresses, if you plan 
to just insert a blob of data, it won't work.
Oldes
13-May-2013
[7780x3]
So I must call some commands in the middle, instead of just data 
and setting pointer to it, right?
Ok.. I will play with it even more for a while before going sleep.
For empty rsrc should be enough to provide: table/id-entries:    
 0 instead of 1 on line 377 of your commit and not adding the entry 
(at least that's what I see with exe containing empty rsrc). But 
line 369 of this commit is strange.
Gregg
13-May-2013
[7783x3]
Is the plan to use .res files? i.e., to have a resource compiler 
that the linker can include?
*Many* years ago, I wrote a resource compiler in VB. Too long ago 
to have any of it left in my brain, but something might come back 
is .res is the target.
If
 %.res is the target.
Oldes
13-May-2013
[7786x2]
if the .res is just binary representation of the rsrc section, why 
not. But be able to append icon without need to use hacking tools 
would be nice as well. But we must do small steps here. At least 
we, who don't have Doc's brain:)
So far adding the rswr section modifies these values:   [ entry-point-addr 
code-base data-base ] which should be same as without rsrc in my 
tests, and not increasing init-data-size.
DocKimbel
13-May-2013
[7788x2]
Line 369: it's for getting the memory pointer for last section, but 
it seems it's lacking an offset for skipping that last section size.
Gregg: no .res file, think .red file (or at least .ren). ;-)
Oldes
13-May-2013
[7790]
Why not .res? .res is compiled .rc
DocKimbel
13-May-2013
[7791x2]
So, yes, we need to build a resource compiler, but the description 
format needs to be specified in Red format.
Is .res binary?
Oldes
13-May-2013
[7793]
yes
DocKimbel
13-May-2013
[7794]
Do you have a link for the .res format spec?
Oldes
13-May-2013
[7795]
I believe it wil lbe just the raw content of the rsrc section. No, 
I don't have, but with tools like Resource Hacker you can build these 
from RC files which are what we don't want
DocKimbel
13-May-2013
[7796x2]
Using .rc and Resource Hacker is fine in the meantime, until we get 
our own compiler.
Looks like Gregg is a good candidate for building such compiler in 
the future. ;-)
Oldes
13-May-2013
[7798x4]
For me it would be enough to have correct PE header at this moment.
Ok.. moving [ build-rsrc job ] after [ build-import job ] leads to 
expected result with the  [entry-point-addr code-base data-base] 
values
no.. my mistake.. was parsing valid file instead of the one build 
in red with rsrc.
Ok, so the main problem will be, that oh/headers-size = 1024, but 
the pointer to code as a first section is 512. Now I must find why.
DocKimbel
13-May-2013
[7802]
Sorry, I'm in the middle of Java code, can't help you with that right 
now.
Gregg
13-May-2013
[7803]
For Windows, there are APIs now to interact with resources. I seem 
to recall they haven't always worked for me, based on using tools 
that took that approach, rather than doing the res dance. The best 
approach will depend on how Doc wants it to work.
Pekr
14-May-2013
[7804]
I might miss some basic OS understanding. Guys, how do you work with 
all the path? I have JAVA installed, REBOL installed, yet what I 
am strugling with, is path. When I follow docs, it always seems to 
be easy. Docs state:


do/args %rsc.r "-dlib %bridges/java/JNIdemo.reds -o %bridges/java/JNIdemo"


well, for normal user, in order to try that, user needs to understand, 
he has to start Rebol for that. So there are basically two options:


- running REBOL from icon. Then you have to change-dir to where Red 
is - in my case, something like C:\!Rebol\Red

- I thought, I might use just "pressing ENTER" upon Red.r, which 
launches console for me. But above still will not work, unless I 
change-dir into red-system subdir. It should be imo either stated 
in the docs, or some shortcuts provided, e.g. red-system.r, allowing 
me to launch console directly in that subdir, and then above command 
would run just OK.


I am not stating anything is wronk, it is upon user to improve the 
workflow, but surely it is an obstacle for occassional user.

Now back to docs:

2. Compile and run the JNIdemo.java app from console:

        $ javac JNIdemo.java
        $ java JNIdemo


Well, when in console, my console does not recognise javac, nor java 
executables. Apparently a path problem, but I have JAVA installed 
via installer. So I have to go inside JAVA dir, which means:

cd c:\Program Files (x86)\Java\jdk1.7.0_21\bin\
javac c:\!rebol\!Red\\red-system\bridges\java\

Any tips? :-)
GrahamC
14-May-2013
[7805x3]
install javac in your system path
type "set" at a dos shell to see if it's there or not.  If not, you 
have to add it.
control panel/System/Advanced system/settings/environment settings/system 
variables/path
DocKimbel
14-May-2013
[7808]
I also needed to add the Java folders to PATH manually, I don't know 
what Oracle is doing with its installers...
GrahamC
14-May-2013
[7809]
I don't think Sun did this either
Pekr
14-May-2013
[7810]
ok, thanks for the tips
DocKimbel
14-May-2013
[7811]
I don't understand the part of your post that starts with "I thought, 
I might use just "pressing ENTER" upon Red.r"
Pekr
14-May-2013
[7812x7]
well, you have Rebol installed and linked to .r ..... I am so much 
used to work with Total Commander, that I launch Rebol from icon 
sporadically. The trouble for me, is the path. So from time to time, 
I place kind of empty run.r script in some dir, which serves for 
nothing more, than just pressing enter upon it, and being run in 
particular directory, which means, in certain directory path
and I can find red.r in the main directory. Whne I hit enter, it 
just launches the console. But maybe I am missusing it :-)
that is why I thought that having red-system.r in the red-system 
subdir, would be handy. Than the examples in docs might be run without 
the proper path obstacles
I am not sure I am clear on my intentions :-)
or just bad habits ...
Also I would change version.r to either version.txt, or its content 
to:

REBOL []

print 0.3.2
halt


... so that by hitting enter or double clicks, it shows the version, 
not error ... well, just imo ... those are all absolutly minor concerns 
though, but would probably help to smooth the experience ....
But maybe you guys don't have .r associated with R2 interpreter?
DocKimbel
14-May-2013
[7819x2]
I never use the association, I always start Rebol scripts from my 
code editor or from the console (I just have a couple of Rebol shortcuts 
to start them in console mode).
%version.r is a data file used by Red compiler, it's not for decoration. 
;-)