r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Red] Red language group

Dockimbel
1-Jun-2011
[1815]
We could optionaly "bind" to a given module (namespace) or to a sandboxed 
execution context.
Kaj
1-Jun-2011
[1816]
I say environment, because I would like it to bind to a stack of 
contexts. If it can do that, it would be enough for me
Robert
2-Jun-2011
[1817]
Only following this whole cool stuff here from the side, but what 
would be really cool is, if Red can live without any specific C lib 
binding. Either by providing the used functions itself in a sideeffect 
free version or by adding support to a OS free lib that can run on 
bare metal.
Dockimbel
2-Jun-2011
[1818]
Robert: being free from any dependency (including C lib) is my intention, 
but:
- C lib is available as system library in any major OS

- C lib functions are more optimized, so will run faster than Red/System 
alternatives


However, as I would like to be able to make Red (or just Red/System) 
run on many embedded platform too (e.g. Arduino and NXT), I don't 
want to have to statically link with C lib there (because of the 
memory footprint). My current idea is to provide both: C lib bindings 
and alternative functions coded in Red/System only, in a transparent 
way for the user.
Endo
2-Jun-2011
[1819]
That is the most preferable way I think.
Henrik
2-Jun-2011
[1820]
Doc, hah! I was about to ask about the Arduino. :-)
Robert
2-Jun-2011
[1821x3]
Doc, the thing is, yes on an OS there is a c lib. But what if you 
don't have an OS or don't need one?
With all the plug computers coming with server sized ARM processors, 
being able to create bare-matel appliances that you just plug in 
and which are than balzing fast, is a pretty cool setup.
So, how about a way to always keep a list of external used functions? 
This make it simpler to make Red totally stand-alone later. The hard 
part to get rid of all the lics & OS stuff is, that you have to find 
out, which functions you have to "clone".
Dockimbel
2-Jun-2011
[1824]
I would be suprized if there was no C compiler for all those plug 
computers, but anyway, I will do my best to have a dependency-free 
Red core option. I will keep all the core bindings in separate per-OS 
files, so it will be easier to track them.


I guess it would be fun to implement a micro-OS in Red/System for 
these micro-platforms, I always wanted to get my hand on a custom 
TCP/IP stack implementation :-) .
Endo
2-Jun-2011
[1825]
I just hope that this will not make development time much longer.
Robert
2-Jun-2011
[1826x2]
There is a C compiler but the clib is mostly dependent on the OS 
as well. So, no standalone, bare metal C lib. That's the problem. 
Using the clib, you need to have the OS as well.
Like this stuff here: http://sourceware.org/newlib/

See section 14.1
Dockimbel
2-Jun-2011
[1828]
Endo: I will not let those sub-projects interfere with the main roadmap, 
they should just blend in. For example, the SheevaPlug could be a 
nice platform to develop and test the ARM port for Red/System: http://en.wikipedia.org/wiki/SheevaPlug
Endo
2-Jun-2011
[1829]
The manufacturer is Marvell, that's fun :)
Kaj
2-Jun-2011
[1830]
Implemented pseudo-random numbers in the C library binding. Everybody 
can start writing console games now ;-)
Henrik
2-Jun-2011
[1831]
and stock prediction tools
Kaj
2-Jun-2011
[1832]
I wouldn't want to put the chimpanzee out of work that they're using 
here
Robert
2-Jun-2011
[1833]
Doc, I have a SheevaPlug here. :-) That's the bare metal system I 
want to use :-)
Dockimbel
2-Jun-2011
[1834]
Well, it runs on Linux I guess, so no issue with libc?
Kaj
2-Jun-2011
[1835x8]
Implemented signals in the C library binding
So you can now for example make a server program that properly reacts 
to system signals
However, it may not yet work until Red generates cdecl functions
To get a handle on why Red/System tries to replace C, I think it's 
interesting to compare this function prototype:
void (*signal(int sig, void (*handler)(int)))(int)
Here's the Red binding, basically the same prototype in Red/System:
on-signal: "signal" [  ; Register handlers for receiving system signals.
	signal		[integer!]
	handler		[function!]  ; Flag or callback with integer! parameter
	return:		[function!]
]
I don't even know if I've translated that right, because I get a 
headache trying to read the C prototype
Andreas
2-Jun-2011
[1843]
typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);


Easier to read :) So yes, the translation looks correct. It does 
not carry the same amount of information, though (the signatures 
of the signal handler functions is missing).
Kaj
2-Jun-2011
[1844x3]
Yes, no typed pointers in Red yet
Implemented ABSOLUTE, quicksort and binary search
Again, SORT and binary search may not work yet, because they take 
a comparison function, that should be cdecl
Pekr
3-Jun-2011
[1847]
As Robert mentioned Photothead library few days ago ( http://www.sics.se/~adam/pt/
), I do remember finding some interesting event libraries in the 
past - liboop ( http://freshmeat.net/projects/liboop/)          
     and libevent ( http://monkey.org/~provos/libevent/- some other 
references there too) ... so just for a sake of a reference ...
Dockimbel
3-Jun-2011
[1848]
Kaj: do you have a web page for your C binding that I could reference 
on red-lang.org?
Andreas
3-Jun-2011
[1849]
most likely http://red.esperconsultancy.nl/Red-C-library/
Dockimbel
3-Jun-2011
[1850]
Thanks
onetom
3-Jun-2011
[1851x3]
it's awesome to see the growing of a language and the environment 
around it being fully documented! it will be very useful for the 
next generations
regarding bare metal version, i would be happy to help with a Microchip 
PIC version, in case it can fit into one...
my father would be a happy user probably, since he is using rebol/view 
now to write interfaces for those pic controllers he was programming 
in flash forth. however, im not sure if we can beat the interactivity 
of a forth system on such a resource constrained device...
Kaj
3-Jun-2011
[1854]
Doc, I'll make a real website for the Red bindings later. For now, 
you can indeed link the Fossil frontend
onetom
3-Jun-2011
[1855]
Kaj: regarding chimpanzees...

my father in law has some monkeys which normally help to twist off 
coconuts from palm trees. as these little guys get older, they get 
slower and also grumpier. 2 different ones already bit my father 
in law.

we might give these retired, veteran monkeys a second life as random 
number generator! i would be a great business in thailand if i think 
about how many coconut trees and monkeys do they have here :)
Kaj
3-Jun-2011
[1856]
Sounds familiar :-)
Henrik
3-Jun-2011
[1857]
onetom, put them on TV to comment on current events around the world. 
That would likely be more insightful than what media provide today.
Kaj
3-Jun-2011
[1858]
I don't know if people know the Chimpanzee story. Several years ago, 
journalists at an investment publication here in the Netherlands 
if I'm not mistaken, started having a Chimpanzee throw darts at a 
list of funds every year. The Chimp turned out to almost match the 
performance of high-end investment firms. They may still be doing 
it
onetom
3-Jun-2011
[1859]
:))) no, i haven't heard the story yet
Henrik
3-Jun-2011
[1860]
I have a variant: A few years ago, a TV station had some famous art 
critics comment on the paintings of a new, unknown artist. They made 
lengthy comments on how wonderful it all was and how it was a new 
style of art. They were not pleased to learn they had been tricked 
into commenting on works made by a monkey.
onetom
3-Jun-2011
[1861]
:P~~~ cool
Kaj
3-Jun-2011
[1862]
Picasso once said that when art critics meet, they discuss design 
and architecture and geometry, deeper meaning and social consequences; 
and when artists gather, they talk about where to get cheap turpentine
Dockimbel
3-Jun-2011
[1863]
onetom: I am also glad to see how it is evolving. About PIC support, 
these platforms might be too restricted for Red, but Red/System should 
be portable on some of them.
Pekr
3-Jun-2011
[1864]
Doc - as Red/System is relatively close to its completion, are you 
already thinking about the implementation plan of RED itself? I still 
might not understand the architecture well enough (my fault, have 
not read properly docs yet), but what e.g. networking port code? 
Will that be written in RED? RED/System? Or will it be just some 
BSD library code linked to Red?