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

World: r4wp

[#Red] Red language group

Kaj
25-Feb-2012
[30]
OpenGL
Andreas
25-Feb-2012
[31]
What function?
Kaj
25-Feb-2012
[32x2]
The main UI loop I can work around it
but I can
Andreas
25-Feb-2012
[34]
What are you using, GLUT?
Kaj
25-Feb-2012
[35]
No, but it's a GLUT like emulation on top of SDL
PeterWood
25-Feb-2012
[36]
Kaj: It's comment {} not comment []. ... I tested your example using 
{} and it compiled okay.
Kaj
25-Feb-2012
[37x2]
I suppose both are allowed, as in REBOL?
{} can go wrong if there's a curly bracket in the code
PeterWood
25-Feb-2012
[39]
Comment [] is the word comment followed by a block in REBOL. It works 
because the block doesn't get evalutated.
Kaj
25-Feb-2012
[40x2]
I thought COMMENT takes one parameter, as it were?
In any case, a block works in Red/System, so it doesn't get compiled
PeterWood
25-Feb-2012
[42x2]
I don't believe Comment is a function in Red/System as it is in REBOL. 
I think it is more like a compiler directive.
A block will work with the compiler but not the pre-processor because 
the complier is working with loaded REBOL values whereas the pre-processor 
is probably working with string data.
DocKimbel
25-Feb-2012
[44]
Kaj: could you replace `print` by `putchar` in the Mandelbrot bench, 
so it is equivalent to the C version? (Not sure it would change much 
the timings, but at least, the sources will be equivalent).

`print newline` would then become `putchar lf`
Kaj
25-Feb-2012
[45x3]
In earlier tests it made no difference, but it may now because the 
times are small. Better test that without printing at all
A better way would be to increase the number of iterations
The preprocessor is block oriented now, isn't it?
DocKimbel
25-Feb-2012
[48x3]
Yes it is.
To be more precise, there's a string stage and a block stage in the 
preprocessor. All the compiler directive are processed at the block 
stage. The string stage is just a front-end to handle R2-incompatible 
syntax, like the Red/System hex notation, and count source lines.
Kaj: do you know why __libc_csu_init and __libc_csu_fini are not 
defined in libc in Linux? How am I supposed to pass them to __libc_start_main 
if I can't access them?
Andreas
25-Feb-2012
[51]
Don't pass them.
DocKimbel
25-Feb-2012
[52]
Isn't the libc doing important initialization and clean-up in these 
two functions?
Andreas
25-Feb-2012
[53]
Nope, they can safely be NULL.
DocKimbel
25-Feb-2012
[54]
__libc_start_main by itself is not doing much work, just a few calls 
and some global var init (like __environ). When I disassemble a C 
binary, these two calls are doing a lot of work.
Andreas
25-Feb-2012
[55x7]
well, __libc_csu_init and __libc_csu_fini are functions that are 
linked by gcc into the generated executable.
__libc_csu_init calls _init which in turn calls two more functions: 
call_gmon_start and __do_global_ctors_aux
call_gmon_start is support for the gnu profiler
__do_global_ctors_aux is for traversing ELF "constructors" (stored 
in a .CTORS section) which are then rnu
run*
as red/s neither supports elf ctors/dtors nor gprof, none if this 
should be needed
(again, all of the above are functions linked into the program binary 
by gcc)
DocKimbel
25-Feb-2012
[62]
okay, thanks for checking that.
Andreas
25-Feb-2012
[63]
i'm pretty sure none of that is needed for actual glibc setup
DocKimbel
25-Feb-2012
[64x2]
New commit pushed to `libc-init` branch, new simplified and more 
conforming way to init libc (at least I hope).
I need to add support for Syllable, I have the right doc from Kaj 
for that, so no problem.


For Darwin, I would need the right stack layout description on starting 
a new process, I haven't found yet a recent and official description 
for that, just a lost page in google's cache from 2009: http://webcache.googleusercontent.com/search?q=cache:4zQ0NwtOKdsJ:blogs.embarcadero.com/eboling/2009/10/13/5620+MacOSX+stack+layout+on+start&cd=4&hl=fr&ct=clnk&gl=fr
Andreas
25-Feb-2012
[66x2]
from that doc, the osx stack layout looks identical to linux/elf
(so that should be easy to try)
DocKimbel
25-Feb-2012
[68]
identical from the main() POV, but I'm not sure that's the right 
kernel stack layout before libc is initialized.
Andreas
25-Feb-2012
[69]
in that doc, it's not describing the stack for main() but the stack 
layout as setup for the entry point ("_start")
DocKimbel
26-Feb-2012
[70x2]
Yes, that's what I am after.
_start
 emulation
Andreas
26-Feb-2012
[72x2]
yep
so osx looks just like linux :)
DocKimbel
26-Feb-2012
[74]
Okay, libc-init is now working fine for Linux and conforming to Gcc 
ABI. Once again, man has won over the machine, but I wonder how many 
neurons were killed both in my and Andreas brain during the battle...;-)
GrahamC
26-Feb-2012
[75]
the reverse ... you probably grew a few :)
Kaj
26-Feb-2012
[76x2]
It's a loosing battle
The documentation seems to describe that when you write a floating 
point constant, it will be a float32! if it fits. However, it turns 
out that it is interpreted as float64!
Andreas
26-Feb-2012
[78x2]
Indeed, the spec is misleading here. All literals are float64!, float32! 
has no literal form.
So the only way to construct a float32! from a literal, is by casting 
(`as float32!`) from a float64! literal.