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

World: r4wp

[#Red] Red language group

Oldes
13-May-2013
[7799x3]
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
[7819x3]
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. 
;-)
You should start Red and Red/System compilers from the console as 
explained in the docs, paths are sensible as long as you start it 
from "sources". Once we get it encapped, it will be much simpler.
Pekr
14-May-2013
[7822]
btw - -= Red Compiler =-
Compiling /C/!rebol/!red/red/red/tests/hello.red ...

*** Compilation Error: comp-literal: unsupported type 14-May-2013/13:24:25+2:00
*** in file: %/C/!rebol/!red/red/red/tests/hello.red
*** near: [14-May-2013/13:24:25+2:00]
DocKimbel
14-May-2013
[7823]
There's no date! type in Red yet.
Pekr
14-May-2013
[7824x3]
well, I just tried to run hello.red, nothing more :-)
So demo.red and hello.red are not supposed to work yet? Or am I doing 
anything wrong?
OK, deleted the repo, resync, now it compiles ....
DocKimbel
14-May-2013
[7827x2]
I don't know where you got those dates from, but certainly not from 
Red github's repo.
Are you using a tool that messes up Red file headers?
Pekr
14-May-2013
[7829]
I still don't know, how to properly work with Git. I use Windows 
Git, nice looking app. But when I switch between the branches, I 
fear it mixes the files? It syncs various branches into the same 
dir .... not sure that was the problem, though ....
DocKimbel
14-May-2013
[7830x3]
I have no such issues with TortoiseGit.
Switching to any branch from same folder.
The only time when the switching fails is when a versioned file is 
locked by an app (like a code editor sometimes).
Pekr
14-May-2013
[7833]
I used tortoise git on my old notebook, now I am using Windows Git. 
There was simply something messed with my files, could not even compile 
Java bridge example. Now everything works again ....
DocKimbel
15-May-2013
[7834x7]
Red/Java bridge prototype released: 

https://github.com/dockimbel/Red/tree/dyn-lib-emitter/red/bridges/java
This is a higher-level API for controlling Java from Red. Please 
read the commit log:

https://github.com/dockimbel/Red/commit/5d43ad443a0524f91418fe62c0f5e90e3d143f75
I've ported the JNI low-level hello example to Red, see how it looks 
now:

https://github.com/dockimbel/Red/blob/dyn-lib-emitter/red/bridges/java/hello.red
Though, this is not the final API I have in mind for Android, as 
I want a cross-platform API.
The API will probably slightly change in the next days as I refine 
and improve it.
(Constructive) feedback is welcome.
This bridge will be the foundation of Red complete port to Android 
even if most of Red developers on mobile devices will probably never 
have to go down to this platform-specific API.
Kaj
15-May-2013
[7841]
Is the Android GUI AWT?
DocKimbel
15-May-2013
[7842]
Nope, AWT is an old GUI built-in Java, so it's handy for doing simple 
GUI demo.
Kaj
15-May-2013
[7843]
I thought so
DocKimbel
15-May-2013
[7844]
I will do a prototype wrapping of the Android GUI API in a few days, 
so you'll be able to put your VID-like dialect on top of it. ;-)
Kaj
15-May-2013
[7845]
Nice
james_nak
15-May-2013
[7846]
Yes, very cool.
Kaj
15-May-2013
[7847x2]
Would it be possible to have #export work not only on libraries, 
but also executables?
PicoGL is a library that defines four or so functions in which an 
OpenGL program should be defined. Although PicoGL is a dynamic library 
loaded by the program, it expects the program to provide those functions