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

World: r4wp

[#Red] Red language group

Rebolek
31-Jan-2013
[5410]
Can I pass function pointer as an argument to another function in 
Red/System?
Kaj
31-Jan-2013
[5411x3]
Yes
However, it's not yet supported for functions defined by #import, 
so if you need that, you have to write a wrapper function
Also, in some places you have to cast the function pointer to an 
integer to pass it
Rebolek
31-Jan-2013
[5414]
Ok, thanks. I unfortunatelly hadn't chance to check Red/System in 
last few months. I'm very glad it can be done, I have to find some 
time for Red/System again.
Kaj
31-Jan-2013
[5415]
Since Red needed jump tables, you can also go the other way around, 
and cast an integer/pointer to a function, then call it
Kaj
1-Feb-2013
[5416x2]
Here's the code for the Red GUI IDE:
Red []

#include %GTK/GTK.red

view/title [
	text: area
	button "Do" [
		unless any [
			none? script: get-area-text text
			empty? script
			empty? code: load script
			unset? result: do code
		][
			prin "== "
			probe result
		]
	]
	button "View" [
		all [
			script: get-area-text text
			not empty? script
			not empty? code: load script
			view code
		]
	]
	button "Quit" close
] "Red GTK+ IDE"
DocKimbel
1-Feb-2013
[5418]
Nice! It's amazing how fast you came up with a VID-like dialect for 
Red.
Kaj
1-Feb-2013
[5419x3]
Well, most of the work is in the Red/System layer that I did more 
than a year ago
Same for the other bindings
Plus, when putting a Red layer on top of it, you're staying within 
Red and Red/System, so you're on known terrain. Starting a new binding 
in Red/System throws you into the abyss of the external library's 
C code, headers and idiosyncracies, and documentation that may or 
may not exist or be correct
GrahamC
1-Feb-2013
[5422]
What can you do for Android where this is no gtk?
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
[5458x2]
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?