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

World: r4wp

[#Red] Red language group

Kaj
1-Feb-2013
[5423]
It requires a completely extra set of bindings, including to the 
Java VM and the GUI. We're thinking about it
Bo
4-Feb-2013
[5424]
OK.  Say I have a fresh Windows PC and I want to start coding in 
Red/System for the target of Raspberry Pi.  Help me understand what 
I need to do.  Here is what I assume needs to be done, but I may 
be wrong.

1. Download R2, I assume.  Any particular version?
2. Download Red/System compiler.  From where?
3. Write the program on the PC.

4. Compile it with Red/System on the PC, but for the Raspberry Pi 
target.  Is that just a setting somewhere?
5. Move the compiled file to the Raspberry Pi and execute it.
Andreas
4-Feb-2013
[5425x2]
The following should have you covered:
https://github.com/dockimbel/Red#readme
Target for Raspberry Pi is "Linux-ARM".
Bo
4-Feb-2013
[5427]
That's exactly what I was looking for.  It would be great if that 
was prominently linked from red-lang.org. :-)
Kaj
4-Feb-2013
[5428]
It is
Arnold
4-Feb-2013
[5429]
View for windows, there is a helper script redcompiler.r on rebol.org 
to facilitate (cross-)compiling
DocKimbel
5-Feb-2013
[5430]
Last week Red presentation in The Netherlands, remastered by HostileFork: 
http://www.youtube.com/watch?v=JjPKj0_HBTY
Arnold
5-Feb-2013
[5431x2]
Bas is still couching the presentation together :)
coughing not couching ;)
Kaj
5-Feb-2013
[5433]
I implemented compose/deep. With the latest Red fixes, it works now
Kaj
6-Feb-2013
[5434]
Is FOREVER not implemented in Red?
Bo
6-Feb-2013
[5435x4]
If I wanted to access JPG pixel data in Red/System, is there an easy 
way to do that?
As the youngsters say, EPIC!  I just compiled and ran my first Red/System 
program on the Raspberry Pi running Arch Linux.
But I still want to figure out how to access JPG pixel data. :-)
Reading the Red/System Documentation on red-lang.org, I don't see 
any way to access files.  IIRC, someone said that wasn't implemented 
yet?
Pekr
7-Feb-2013
[5439]
Bo - R/S is low level - mostly a wrapper to C to enable Red like 
syntax. It will not contain stuff to open files and do more advanced 
things imo, unless you link to some library and create a wrapper 
for such a purpose. I am too eagerly waiting for Red to get more 
advanced stuff. I think, that once Doc finishes the interpreter stuff 
ec., he is back to objects/ports, and then networking/files IO will 
come and more fun begins :-)
DocKimbel
7-Feb-2013
[5440x2]
FOREVER: not yet supported by the compiler.
mostly a wrapper to C
 Red/System doesn't wrap C, it replaces it. ;-)
Pekr
7-Feb-2013
[5442]
:-)
Kaj
7-Feb-2013
[5443x11]
Congrats, Bo
Feels good, doesn't it? :-)
File I/O is available for Red/System in the C library binding:
http://red.esperconsultancy.nl/Red-C-library/dir?ci=tip
There's also standard input for Red there. Further, there's a wrapper 
for full-file I/O for both Red and Red/System that includes network 
I/O through the cURL binding:
http://red.esperconsultancy.nl/Red-common/dir?ci=tip
This gets you reading and writing files, but you have to do any decoding 
yourself. So for reading JPEG data, you would probably write a binding 
to LibJPEG
If it doesn't need to be as specific as JPEG, you could write a binding 
to some wrapper library that supports multiple formats. For example, 
a simple BMP loading function is available for Red/System in the 
SDL binding:
http://red.esperconsultancy.nl/Red-SDL/dir?ci=tip
An example of loading an image is here in PeterPaint:
http://red.esperconsultancy.nl/Red-SDL/dir?ci=tip&name=examples
Pekr
7-Feb-2013
[5454x2]
or xnview command line - then you just need a CALL ....
ah, wrong, I thought that you just need an image info, not actually 
an access to the bitmap data ...
Kaj
7-Feb-2013
[5456x2]
There's also a basic binding to image loading in GDK, so that would 
load you all image types that GDK supports, including JPEG:
http://red.esperconsultancy.nl/Red-GTK/dir?ci=tip
Bo
7-Feb-2013
[5458x3]
GTK sounds like a winner.

Thanks for all the tips, guys!
For future reference, is it possible to use Red/System for commercial 
products?  Are there any restrictions?
Also, does anyone have an idea of how fast Red/System code is compared 
to comparable C code?
BrianH
7-Feb-2013
[5461x2]
It's as fast as C core with the optimizer turned off, at least for 
now.
core -> code
Bo
7-Feb-2013
[5463]
Sorry for my ignorance, but how much faster is C with the optimizer 
turned on?  2x faster, 10% faster...?
DocKimbel
7-Feb-2013
[5464]
No restriction for commercial use of binaries produced by Red and 
Red/System compilers.
Kaj
7-Feb-2013
[5465]
Bo, in my tests, GCC produced twice as fast code with the regular 
optimisation of -O2. More than I thought
BrianH
7-Feb-2013
[5466x2]
Bo, it depends on the code in question and the processor it's running 
on. It could be the same speed, it could be many times faster, and 
for some code it could be resolved completely at compile time and 
replaced with a constant.
We could run similar optimizations on Red/System code, as soon as 
we've implemented them.
Bo
7-Feb-2013
[5468]
Great!
BrianH
7-Feb-2013
[5469]
Some optimizations will be very difficult or impossible to do if 
Red/System is used as the intermediate language, because those optimizations 
sometimes depend on the semantic model of the intermediate language, 
and Red/System doesn't have the semantic model of a compiler intermediate 
language. Optimization is hard work and people get PHDs for doing 
it. We can hope to catch up with modern C compilers, but don't expect 
it. One advantage is that Red is a high-level-enough language that 
an optimizer can make assumptions that a C compiler can't, so it 
is possible that we could get better code - it depends on the language 
and how much time we want to allocate on optimization.
Bo
7-Feb-2013
[5470]
I'm feeling nostalgic.  I used to hand-craft machine code on the 
6502/6510 series of processors back in the 80's, so I have an idea 
of what you're talking about.  There are some pretty neat tricks 
you can do when you're dealing with memory addresses directly.  I 
crafted more than one self-modifying program to squeeze every bit 
of computing power out of a processor.  I know that a lot of that 
ability has been removed by protected memory and abstraction, though.
Bo
8-Feb-2013
[5471]
Kaj, now that I've had a chance to do some work with Red/System, 
it's amazing to me how much work you've already done on adding features!


Here's something that I think would really help out a lot of us who 
want to make use of all your hard work.  Would it be hard to create 
http://red.esperconsultancy.nl/index.htmlwith a link to all the 
Red stuff you've done?  The only way I found what I needed to download 
was by searching through AltME for links, and had to manually enter 
in things like Red-common, Red-C-library, Red-cURL, Red-GTK, etc.
Kaj
8-Feb-2013
[5472]
Thanks. A website is planned, but I haven't gotten around to it yet. 
I figure the time is better spent doing Red work