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

World: r3wp

[Red] Red language group

Dockimbel
15-Mar-2011
[399]
ELF seems to be a bit smarter about page loading, it doesn't require 
explicit padding to page boundaries in the file itself, so can generate 
smaller exe. (It's possible with PE too with some hacking).
Kaj
15-Mar-2011
[400]
My client/server executables are 3 KB. That's two orders of magnitude 
smaller than REBOL. Who would have thought?
Dockimbel
15-Mar-2011
[401x4]
New revision pushed online.
:-) That's the good side of being closer to the metal.
Btw, the newer revision requires explicit calling convention to be 
added to imported DLL, see %red-system/runtime/win32.r
Windows DLL: stdcall
C DLL: cdecl (or stdcall if that's the required convention)
Kaj
15-Mar-2011
[405]
Yes, thanks
Dockimbel
15-Mar-2011
[406]
Btw, can't color the R letter in red in the Linux version, not sure 
it's possible at all to make ANSI sequences interpreted using only 
syscalls.
Kaj
15-Mar-2011
[407x2]
Probably depends on the terminal definition the system is running 
under (which can vary wildly)
Do you plan to implement #import for Linux soon?
Dockimbel
15-Mar-2011
[409x2]
Andreas is supposed to give it a try this week.
OMQ: still getting the same error message, got at least 3 versions 
of Visual C++ 2008 redistribuable package (added the one from your 
link too).
Kaj
15-Mar-2011
[411]
Odd; must be something else
Andreas
15-Mar-2011
[412]
very nice, doc. the ELF hello works like a charm here :)
Dockimbel
15-Mar-2011
[413]
Goog to know.
Andreas
15-Mar-2011
[414]
re the size of executables, for comparison: basic 0MQ examples ("hwserver/hwclient") 
written in C compiled & linked dynamically with GCC & gold on Linux 
are ~6KB in size.
Kaj
15-Mar-2011
[415x3]
The 0MQ error code function is called zmq_errno. If the error message 
is about zmq_err0 it seems the name is being truncated somewhere 
on Windows
This function differs in that it has no parameters, only a return 
value. Might have something to do with it
Actually, this name truncation is in the symbol table, so it's a 
bug in the Red code generator that doesn't disturb WINE if the function 
isn't called
Dockimbel
15-Mar-2011
[418]
Looking at the server.exe content, I see the zmq_err0 in the imported 
functions list. So it seems to be corrupted inside the executable.
Kaj
15-Mar-2011
[419]
The name is garbled from zmq_errno to zmq_err0
Dockimbel
15-Mar-2011
[420x2]
I'm looking into the linker to find the cause.
Found the issue: #define no 0 :-))
Andreas
15-Mar-2011
[422]
heh, good catch :)
Dockimbel
15-Mar-2011
[423]
The preprocessor is a bit too aggressive.
Andreas
15-Mar-2011
[424x2]
is it case-sensitive?
yes
Dockimbel
15-Mar-2011
[426]
yep
Andreas
15-Mar-2011
[427]
so sticking to the C convention of ALL_CAPS_DEFINES is probably a 
good idea (at least for now) :)
Dockimbel
15-Mar-2011
[428x2]
That would be safer, until we get a smarter one.
I thought about adding a full macros system, I think it will be useful 
until we can compose Red/System code from Red itself.
Kaj
15-Mar-2011
[430]
Right, I ran into the preprocessor zeal before, and replaced some 
other values with variables
Dockimbel
15-Mar-2011
[431x2]
Once that definition fixed in %ZeroMQ-binding.reds, I can compile 
working versions of client & server...testing...seems to work ok, 
the server is receiving a list of Hello messages from the client. 
:-)
Congrats!
Kaj
15-Mar-2011
[433x2]
Thanks :-)
Is the preprocessor necessary at all? It's usually much nicer to 
implement this functionality at a more integrated level in a language
Dockimbel
15-Mar-2011
[435]
I'm thinking about descending it one level below to process the script 
at block! level instead of string! level, after all, the compiler 
has the full power of REBOL.
Kaj
15-Mar-2011
[436]
Yes
Dockimbel
15-Mar-2011
[437]
That should avoid the nasty side-effects.
Kaj
15-Mar-2011
[438]
With the Linux backend, did the system loose its ability to cross-compile 
to Windows?
Dockimbel
15-Mar-2011
[439x2]
Nope, I just need to adjust the compiler front-end (rsc.r) to pass 
an option for the desired format (PE, ELF, ...).
Currently, a default format is applied depending on the REBOL binary 
used.
BrianH
15-Mar-2011
[441x2]
You can compose Red/System from REBOL in lieu of a preprocessor, 
until the compiler is ported to Red.
I mean in lieu of preprocessor macros
Dockimbel
15-Mar-2011
[443x2]
Do you mean replacing .reds scripts by .r scripts?
Kaj: if you want to cross-compile, you currently need to hardcode 
the target format in %compiler.r at:

    fmt: select [			;TBD: allow cross-compilation!
        3	'PE			;-- Windows
        4	'ELF			;-- Linux
        5	'Mach-o		;-- Mac OS X
    ] system/version/4
BrianH
15-Mar-2011
[445x2]
No, I mean that when you say that your long-term strategy is to compose 
Red/System code in Red, thus making preprocessor macros unnecessary 
in Red/System, you could start that strategy much earlier by composing 
the code in REBOL. What you learn from doing so and the code you 
write can be adapted to Red later once that exists.
Doc, would you mind if I started some research on generating Dalvik 
binaries? I notice it's not on your list of planned platforms.
Dockimbel
15-Mar-2011
[447x2]
Sure, no problem.
I plan to support ARM directly.