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

World: r3wp

[Red] Red language group

Evgeniy Philippov
14-Feb-2012
[5053x2]
Steeve: The Red/system's compiler is not that far advanced. It can't 
perform dead code analysis. it's why it will get stuck with macros.


Evgeniy: dead code analysis for boolean constants is fairly simple 
and straigtforward

I could even help write


the only thing necessary is a boolean flag for a value that it is 
a CompileTimeConstant


if we have "IF(value)" and value is FALSE, we just remove the false 
code branch

from memory. And do not output code for it.

This renders #if useless...


Steeve: Yeah it seems pretty straightforward, feel free to ask in 
#Red :-)))))


Evgeniy: In Oberon, you can write VAR Procedure1: PROCEDURE1; BEGIN 
IF (ARCH1) Procedure1:=Arch1Module.Procedure1 ELSE Procedure1:=ArchOther.Procedure1 
END END


that's not so simple: there can be absent libraries and headers and 
files in dependent files on different archs. This must be taken into 
account and makes an implementation slightly complex.


Steeve, I've already asked that by previous discussion. I thought 
that this technique is obvious.
Oldes: And as Red/System is open, everybody can provide own version:)


Evgeniy: It seems to be necessary. I won't be attached to a language 
with a preprocessor. That's UNDERTHOUGHT OUT language.
Pekr
14-Feb-2012
[5055]
:-) We are just starting ... but you could help Carl to improve R3 
semantics :-)
Oldes
14-Feb-2012
[5056]
I'm really looking for to see your version Evgeniy. It's always good 
to see different approaches for same tasks.
Dockimbel
14-Feb-2012
[5057x3]
Adding dead code elimination in Red/System at this point of the project 
serves no purpose. Please re-read all the presentations slides, roadmap, 
discussions on the ML or here...
Evgeniy: it seems you've missed my post at 10:40:23 earlier today.
After using `??` a few hours, I realized that it was a mistake to 
use it as a shortcut for `print-line`. It is readable when used on 
a word, but with a block, it looks too esoteric and hurt the feelings 
of old rebolers that see it as a syntax error. So, I want to get 
rid of `??` but can't find anything to replace it that would be both 
short and consistent with `print`and `print-line`. I think that I'll 
just deprecate `??` but won't remove it for now as some of you are 
heavily using it.
Kaj
14-Feb-2012
[5060]
It does mean "print word value" in REBOL
Pekr
15-Feb-2012
[5061]
Doc - I did not like ?? eiher, looked weird. Nor did I liked print-line, 
so I adopted "print [something lf]" block aproach, which looks ok 
to me ...
Dockimbel
15-Feb-2012
[5062]
FYI, I am currently merging the float-partial branch and preparing 
for the 0.2.4 release.
Pekr
16-Feb-2012
[5063x4]
Downloaded new branch, and now my error message changed. Was there 
any change to error handling?

*** Runtime Error 101: no value matched in SWITCH
*** at: 004013ADh
I am able to disrupt R2 compilation session to the state, where its 
restart is needed. Not a big deal, but maybe you will see something 
obvious. The code causing it is as follows:

print ["led-set-language: " led-set-language 3 lf]


The trouble is, that led-set-language does not return any value (void). 
This is understandable, that 'print has problem with such a clause. 
The error returned was:

Compiling led/led.reds ...
Script: "Red/System IA-32 code emitter" (none)

*** Compiler Internal Error: Script Error : Out of range or past 
end
*** Where: resolve-path-head
*** Near:  [second either head? path [
compiler/resolve-type path/1
]]


Correcting the issue (moving function call away from the print block, 
I get another error:

Compiling led/led.reds ...
Script: "Red/System IA-32 code emitter" (none)

*** Compiler Internal Error: Script Error : Out of range or past 
end
*** Where: resolve-path-head
*** Near:  [second either head? path [
compiler/resolve-type path/1
]]


This error repeats, untill I restart the R2 compiler session, which 
is a proof, that I corrected the source code, as aftern the R2 restart, 
I can get clean pass ...
Sorry, wrong cut and paste. The first error was:

Compiling led/led.reds ...
Script: "Red/System IA-32 code emitter" (none)

*** Compilation Error: return type missing in function: led-set-language
*** in file: %led/led.reds
*** at line: 87
*** near: [led-set-language 3 lf]
OK, case closed - I got reply from Linsn, that the library is compiled 
to be used only by C++ compilers. Strange that half of the functions 
work correctly though (was able to turn led screen on/off for e.g.)
Maxim
16-Feb-2012
[5067]
pekr, in this case, wrap another dll around it, a.k.a. "thin layer" 
dll.


use a C++ compiler, but use the functions within a C sourced dll 
project.  this dll will then serve as your translation from the C++ 
libs to Red/Rebol whatever.    If the C++ use requires special steps 
on function entry/exit, the compiler will add these for you (when 
it compiles) and from outside the C function you'll be back into 
"normal land". 


 I've even read that some C++ compilers can't even properly use libs 
 from a different C++ compiler.
Dockimbel
16-Feb-2012
[5068]
Kaj: I did a few tests for the 0.2.4 candidate with some of your 
bindings on Windows and Linux. No issue so far. Could you please 
check if all your bindings latest versions are working fine before 
I make the release?
Pekr
16-Feb-2012
[5069x2]
Maxim: thanks, that was my idea. Will learn a bit of C too :-)
I just posted the result so that Doc could see, that now the error 
message is different (more concrete?). Did anything changed internally 
apart from float support? Also - before 0.2.4, the output exe was 
61xx bytes, whereas with 0.2.4 is 5632 bytes ...
Dockimbel
16-Feb-2012
[5071]
The runtime error handler now better catch unknown errors and the 
use of SWITCH has decreased the runtime code size significantly.
Steeve
16-Feb-2012
[5072]
I tried to resync my repository but lot of errors pop up. Can I rebuild 
a clean version without deleting my fork first ?
Andreas
16-Feb-2012
[5073]
Do you have local changes you want to keep?
Steeve
16-Feb-2012
[5074]
No
Andreas
16-Feb-2012
[5075]
Then what is it you "don't want to delete"?
Steeve
16-Feb-2012
[5076]
No I have no problem with that ,  I just  fear Github will not be 
happy :-)
Andreas
16-Feb-2012
[5077]
I don't think so :)
Pekr
16-Feb-2012
[5078]
just a note - solved the ledctrl problem. I noticed it generated 
system.con configuration file, but this file was just 210 bytes. 
So I copied over the larger one from real set-up, and those affected 
functions started to work. Tomorrow I will try directly with the 
ledscreen. So, although the library is said to be C++ only, it now 
works even from R2.
Kaj
16-Feb-2012
[5079x5]
Kaj: I did a few tests for the 0.2.4 candidate with some of your 
bindings on Windows and Linux. No issue so far. Could you please 
check if all your bindings latest versions are working fine before 
I make the release?
Will do. Fortunately, I just got the new Syllable development release 
out the door
Petr, that library is weird, and I guess the Windows environment 
makes it even weirder. The interface is so convoluted that I assumed 
the reason was to export normal C functions, so maybe that's the 
case after all
There's a problem with the WebKit binding:
bash-4.0# ./LazySundayAfternoon-Browser 

*** Runtime Error 9: float invalid operation
*** at: B66C5447h
Dockimbel
16-Feb-2012
[5084]
Looking into it...
Kaj
16-Feb-2012
[5085x3]
I'm also getting weird error messages on 0MQ, although it basically 
works:
bash-4.0# ./request-client 
0MQ version: 2.1.4

Connecting to Hello World server...
Sending request 1
Received reply 1: World
Resource temporarily unavailable
Sending request 2
Received reply 2: World
Resource temporarily unavailable
Sending request 3
Received reply 3: World
Resource temporarily unavailable
Sending request 4
Received reply 4: World
Resource temporarily unavailable
Sending request 5
Received reply 5: World
Resource temporarily unavailable
Sending request 6
Received reply 6: World
Resource temporarily unavailable
Sending request 7
Received reply 7: World
Resource temporarily unavailable
Sending request 8
Received reply 8: World
Resource temporarily unavailable
Sending request 9
Received reply 9: World
Resource temporarily unavailable
Sending request 10
Received reply 10: World
Resource temporarily unavailable
Resource temporarily unavailable
Resource temporarily unavailable
I've seen that before during development, but it had been fixed for 
quite some time. It must be generated during cleanup
Dockimbel
16-Feb-2012
[5088]
Webkit: can't run it on Windows, I was able to get a suitable libwebkit 
but it fails to find some functions in the dependent DLL. Trying 
on Linux.
Kaj
16-Feb-2012
[5089]
It seems that the newest WebKit versions have broken compatibility
Dockimbel
16-Feb-2012
[5090]
0MQ messages: I can see them on Windows too, do you have an idea 
on what causes them?
Kaj
16-Feb-2012
[5091]
It must somehow be unable to do cleanup, or the cleanup has already 
occurred. But the same code ran OK on earlier Red versions
Dockimbel
16-Feb-2012
[5092]
Webkit crash: reproduced on Linux.
Kaj
16-Feb-2012
[5093]
What Linux distro? I ask because the WebKit in the newest Linux Mint 
is incompatible
Dockimbel
16-Feb-2012
[5094]
Ubuntu 10.04 LTS.
Kaj
16-Feb-2012
[5095]
OK, thanks. 11.10 is the culprit. Not that it would crash, but the 
library names and versions have changed
Dockimbel
16-Feb-2012
[5096]
If I remove the x87 FPU init code, the crash disappears.
Kaj
16-Feb-2012
[5097x2]
I was suspecting something like that
The other bindings are OK
Dockimbel
16-Feb-2012
[5099]
I am not sure, but it might be a collision with C init routines.
Kaj
16-Feb-2012
[5100]
Well, they're still not called :-)
Dockimbel
16-Feb-2012
[5101x2]
I was thinking that libwebkit might be calling some of them in some 
way.
I wonder if activating the Intel FPU in x87 mode, then using SSE 
instructions (in libwebkit) could trigger such error. IIRC, the FPU 
needs to be    properly set in x87 or SSE mode before using an x87 
or SSE instruction.