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

World: r3wp

[Red] Red language group

Dockimbel
14-Feb-2012
[5041x3]
Compilation time: absolute speed is not the issue currently, we're 
talking about relative speed of the preprocessing compared to whole 
compilation time.
 it is about the process of building app vs dynamic prototyping using 
 interpreter


Well, I don't know how you build apps, I have never built one from 
the console, but only from a code editor. Console is nice for testing 
some small snippets when unsure, but coding is usually done in a 
decent code editor, where you usually launch your script using a 
shortcut. From that POV, there will be no differences with Red for 
the users. And to avoid further misunderstanding, Red will have a 
console, like R2 does, with similar features and possibilities.
Btw - how do I wrap properly function, which does not return any 
result? I tried just without the return clause, but it is not possible. 
Is e.g. return: [] (empty block allowed?)


It's in the spec document and same as the routine! interface in R2, 
just do not put a RETURN: definition if the function does not return 
anything:

http://static.red-lang.org/red-system-specs.html#section-14.1
Pekr
14-Feb-2012
[5044x2]
Doc - I use text editor too, for some complex stuff.Yet for trial 
and error I use console. Several users expressed in the past, that 
one of the nice values of R2 is its console, for the quick prototyping 
around.
As for the return value - I was switching between R2, Red, World, 
so not sure, but ommiting return clause raised an error. Not sure 
it was Red or other environment. Will try that ...
Dockimbel
14-Feb-2012
[5046]
LedCtrl.dll (from ledset-source package): 

1) How is it supposed to react if a board is not connected?


2) The DLL is a C++ program with static functions (acting as wrappers 
I guess). Have these static functions been compiled with an "extern 
C" directive? If not, there's no chance it can work with anything 
other than a compatible C++ compiler.


I think that the crash has nothing to do with Red/System, the "unknown" 
error might be caused by the DLL functions corrupting the data segment 
of the Red/System binary where the runtime error data is located. 
I will try to track it anyway, just to be sure, it's not a missing 
code in the Red/System runtime error processing routine.
Pekr
14-Feb-2012
[5047x4]
I think too, it is not a Red/System. I used the generated exe also 
on a LED screen PC. I can turn screen on/off, led-is-power? works 
correctly, ditto for led-is-locked?, but led-get-brightness fails 
... so if some functions work, it means that DLL has properly exported 
values? All use the same declaration ...
It is a pity that my first attempt has some such problems. Just don't 
loose the time with it, if you have more important stuff to do. Kaj 
tried to do his best here, ditto Andreas.
Btw - if some func retunrs void, how should my return value look?
Also - what is a difference in passing a "void" to func, and passing 
it no value? Aren't following definitions just the same?

typedef void (WINAPI *LSN_BRIGHTDLG)(void);
typedef int	 (WINAPI *LSN_GETBRIGHT)();
Dockimbel
14-Feb-2012
[5051]
Btw - if some func retunrs void, how should my return value look?

 Void is the C way to indicate "no return value". In Red/System, you 
 just don't add a RETURN: clause in such case.
Pekr
14-Feb-2012
[5052]
OK, thank, that just clears the situation for me a bit ....
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?