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

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp1209
r3wp4537
total:5746

results window for this page: [start: 5601 end: 5700]

world-name: r3wp

Group: Red ... Red language group [web-public]
Dockimbel:
31-Jan-2012
Oh, I forgot to mention Flash also as a possible back-end for GUI, 
if Oldes makes the AVM2 port for Red/System some day. ;-)
Andreas:
31-Jan-2012
on the other hand, i'm certain that you can model Red/System's syntactical 
structure with a context-free grammar. it's just that the CST/AST 
would look quite different from other languages (i.e. in that it 
does not explicitly model function call structures)
BrianH:
1-Feb-2012
You could try to make the Coco/R syntax specific to the Red/System 
dialect or you could make at least the tokenizer general for Red 
code and implement the Red/System dialect in the parse rules. The 
latter would be a more useful approach for REBOL-like languages :)
BrianH:
1-Feb-2012
Paths are made up of tokens, yes, just like the other block types 
except with more restrictions about what types of data may go in 
the paths. I don't (currently) know what subset of path syntax and 
semantics that Red/System supports though.
Gabriele:
1-Feb-2012
Evgeniy, function calls are not really part of the syntax in REBOL, 
or Topaz and i think even Red/System. So, yes, it is a CFG, it's 
just not like other languages (more like XML or JSON).
Pekr:
1-Feb-2012
Doc - congrats on finishing floating support in Red/System. Now all 
to-do list items seems to be done right? So time to move on onto 
Red itself? :-)
Dockimbel:
2-Feb-2012
gtk-view label "Hello, Red/System GTK+ world!"
Dockimbel:
2-Feb-2012
Right, I've added a lot of debug logs to GTK to follow the calls...(the 
planned stack trace feature for Red/System is climbing in priority)
Pekr:
5-Feb-2012
What's your experience with Red/System wrapping interface? Is it 
suitable to wrap (relatively saying) "any" C defines? I am recently 
scripting VLC a bit, to see if I can use that player instead of LED 
Studio (which is really bad chinese standard LED accompanying sw) 
for our LED screen.


So far, I am fine talking to VLC via TCP - 10 lines of Rebol code. 
But their RC (remote control interface) missess advanced playlist 
handling. I was looking into vlccore library API, and I found various 
wrappers, and e.g. Python one, is auto-generated, by going thru includes.


IIRC, Max worked on something similar for R3, but never released 
the code. Now I wonder, how difficult would it be to achieve using 
Red/System?
Kaj:
5-Feb-2012
Red/System's way to write bindings is the best I've seen. Barring 
C features it doesn't have yet, it should be able to bind any C function. 
Mostly only 64 bits integers and importing data values are still 
missing by now
Kaj:
6-Feb-2012
Your multi-purpose TV contains an operating system. VLC is not an 
operating system
Kaj:
6-Feb-2012
He has started months ago with the memory allocator and the tokeniser, 
but Red/System keeps postponing the rest
Kaj:
6-Feb-2012
On the other hand, implementing things such as the allocator yields 
experience for further developing Red/System
Pekr:
6-Feb-2012
I am also not sure, that in the case of Red, eventual R3 source release 
would help to speed things up, as Red "natives" are going to be written 
in Red/System, not C, or so is my understanding of the platform.
Pekr:
6-Feb-2012
I had something other in mind - RT releasing sources for R3, it might 
be easier for Doc to rewrite R3 C code into Red/System, than implementing 
all functions "from scratch".
Kaj:
6-Feb-2012
Also, the plan is to implement as few functions as possible in Red/System. 
Red will be preferred instead, to work at a higher level
GrahamC:
6-Feb-2012
And I take it we are not waiting for Red/System to be rewritten in 
Red/system before work on red starts?
PeterWood:
6-Feb-2012
A few points releting to recent posts:

Nenad is already working fulltime on Red.


He has already accepted contributions to the Red/System compiler 
from both Andreas and Oldes.


Finding bugs by using Red/System will help speed the process of Red 
especially as Nenad's current design is to generate Red/System code 
from Red.
Kaj:
6-Feb-2012
Graham, programs can be written in Red/System right now
Henrik:
7-Feb-2012
if one wants to test Red/System: port some simple C stuff?
Oldes:
7-Feb-2012
After adding the float! support, the main thing is a series! datatyte. 
Should we wait for Red to implement it properly or do we want ti 
in red/system as well? (I know I can use pointer math to access values, 
but it's not so easy for ordinary scripting)
Dockimbel:
7-Feb-2012
Red/System is not meant for scripting but low-level and system programming. 
Red is for scripting, so series! support as well as all others scripting 
facilites will be provided by Red.
Dockimbel:
7-Feb-2012
Red/System: already anwsered by me, Kaj and others (also, there's 
a todo list on red-lang.org for contributors that are searching for 
tasks to handle).
Pekr:
7-Feb-2012
I am for a quick solution to appear, so - Red. If that turns out 
being slow, there is a later chance to reimplement some stuff in 
Red/System. Of course such aproach itself does not bring more comfort 
to Red/System, as e.g. availability of array type would be for e.g. 
But there are some priorities ....
Kaj:
7-Feb-2012
if one wants to test Red/System: port some simple C stuff?
Pekr:
11-Feb-2012
I am trying to wrap our LED screen control dll. I am not sure how 
well it is defined, as LED Studio and surrounding SW is rather weak 
and sometimes crashes, but I tried in R2, thinking I again reached 
some R2 DLL interfacing limit/bug, and am trying now in Red/System. 
Well, my first attempt to wrap some DLL functions here. So - I can 
turn-on/off led screen, even if I don't set COM port, open-sending-card, 
etc. But when I try to call functions to get e.g. brightness, contrast, 
it crashes. Those funcs are defined as e.g.:

typedef int	 (WINAPI *LSN_GETBRIGHT)();       // 0..100
typedef bool (WINAPI *LSN_SETBRIGHT)(int);
typedef int (WINAPI *LSN_GETCOLORTEMP)(int);//ScreenNumb

typedef bool (WINAPI *LSN_SETCOLORTEMP)(int,int);//ScreenNumb,nColorId 
0,1,2,3


None of above functions work for me, although above code is from 
sources to LEDSet application, where those funcitons work, those 
are just being set via dialog boxes (which I can invoke even from 
Red/System, so those are part of DLL ...

My definitions are:

      led-get-brightness: "LSN_GetBright" [
         return: [integer!]
      ]           

      led-set-brightness: "LSN_SetBright" [
         brightness [integer!]
         return: [integer!]
      ]

      led-get-color-temperature: "LSN_GetColorTemp" [
          screen-number [integer!]
          return: [integer!]
       ]                 


etc. So what coul be causing run time error? I am running on a PC, 
where I don't have internal LED screen communication card. I thought, 
that DLL functionality might check for the screen, can't find it, 
and so the app returns error, which does not fit return value - e.g. 
some error code/string, or a dialog box. But moving the exe to the 
PC where the card is, it i just the same - some functions work, I 
can see LED screen being turned on/off, but those brightness etc. 
don't ....
Pekr:
11-Feb-2012
Maybe one another question - I know Red/System is supposed to be 
closer to C, but it will be also used by those, who would like to 
proceed using Red itself (that is why I did not like the print-line, 
?? vs print/prin) - so the question - why is there so many constructors, 
instead of one make! and e.g. a block format? I mean:

declare struct!
alias struct!
#import for a library

Intead of:

make struct!
make lit-struct!
make routine!


? I will understand the answer of a type, that it is better to be 
understood by those knowing C language. So far, I can't e.g. understand, 
why a library is wrapped in a preprocessor kind of way, using #import, 
which does not fit those preprocessor things like #define, #ifdef, 
etc.?
Pekr:
11-Feb-2012
If it would be upon me, I would better try to stay consistent with 
the Red level - so if Red will have make!, Red/System should have 
make too, no matter how C users will aproach it. Those who will use 
Red/System, are going to use Red most probably too, so I can not 
see much reasons to differ, just because we can state - Red and Red/System 
are two different things :-) I am curious how you will keep up with 
such a differences in future, once Red layer becomes available :-)
Kaj:
11-Feb-2012
There are no literals in Red/System, at least not as symbols
Pekr:
11-Feb-2012
It is more of a philosophy, what is more confusing to whom. E.g. 
Carl proposes dialecting as the same word, being simply used in different 
context. In real life, it might work, but not sure about programming. 
E.g. 'copy in 'parse having slightly different aspects than 'copy 
in REBOL itself. That is why I thought that make! could be used even 
in Red/System, but not sure ...
Pekr:
11-Feb-2012
The reason why I am also opting for such an aproach is, that there 
will be possibility to inline Red/System in Red itself, so it should 
look similar, where possible. I e.g. liked how Cyphre did JIT to 
R2 - the code still looks like REBOL, it is just a limited subset 
...
Kaj:
11-Feb-2012
I think Doc will say that we'll reconsider them in the Red/System 
rewrite in Red
Pekr:
11-Feb-2012
Yes, that might actually happen, after all Red/System is the target, 
so new needs might show-up during the Red design, who knows ....
Pekr:
11-Feb-2012
Never mind, I just wanted to try it in Red. Good way to become familiar 
with the system trying to use it for practical purpose. I might try 
to continue investigatin COM communication, but R2 serial communication 
is also not much to be desired :-)
Andreas:
11-Feb-2012
typedef int (WINAPI *LSN_GETBRIGHT)()


^^ That defines LSN_GETBRIGHT to be another name for a pointer to 
a stdcall function that takes no arguments and returns an int. (WINAPI 
== __stdcall)

extern LSN_GETBRIGHT		fpGetBright	;


^^ That now is the actual "function", although held indirectly as 
a function pointer. So somewhere in a library is a fpGetBright value 
which holds a LSN_GETBRIGHT function pointer.


In C you can directly call that as e.g. `int brightness = fpGetBright();`. 
However, I fear in Red/System it's at the moment not possible to 
perform that call.
Kaj:
12-Feb-2012
The complex issue is that the functions are imported through pointers. 
Red/System can use function pointers if you write wrapper functions 
and pass them the function pointers. But Red/System can't import 
simple values yet, only functions, so you can't import the function 
pointers the way the C code does
Pekr:
12-Feb-2012
btw - does that mean, that Red/System is still not generally good 
enough, to wrrap "any" C interfacing?
PeterWood:
12-Feb-2012
I guess you're correct;  Red/System is not generally good enough 
to wrap "any and all" C libraries yet.


What is most important to me about Red/System at this time is that 
it needs to be good enough to allow Red to be developed. I believe 
the addition of partial float support to Red/System was not absolutely 
essential for the development of Red though I'm sure it will help. 


There are lots of other improvements that could and will eventually 
be made to Red/System but they don't seem as important as work on 
Red ... at least to me.
Pekr:
12-Feb-2012
btw - is/will something like inlined/included C/ASM code be possible 
in Red/System?
Andreas:
12-Feb-2012
Lua's C interface design is not applicable to Red/System; it can 
provide inspiration for Red, but I think the plan is to interface 
with C/C-level code from Red via Red/System.
Andreas:
12-Feb-2012
Re "inline C/ASM in Red/System":


Possible in general, yes. Neither planned (afaik) nor worth it (imo), 
at the moment. Remember that Doc's primary reason for Red/System 
is to use it to bootstrap/write Red.
Kaj:
12-Feb-2012
http://static.red-lang.org/red-system-specs-light.html#section-19.9
Kaj:
12-Feb-2012
You should bind the GetProcAddress function (I think there are already 
Red/System Windows examples floating around that use it), find out 
how to get the value of the g_hLedCtrlInst library handle, and use 
them to load the functions like the C code does
Kaj:
12-Feb-2012
Then for each function you have to write a Red/System wrapper function 
and pass it the function pointer as if it were a callback function, 
and call it. There are examples of such constructs in my bindings
Kaj:
12-Feb-2012
There's not much still missing to have Red/System inferface to any 
C code. Basically just importing external variables and support for 
64 bits integers. I think 16 bits integers can be faked on most CPUs
Pekr:
12-Feb-2012
I understand the first two steps, but I don't understand, how such 
a function wrapper in Red/System would look like ...
Pekr:
12-Feb-2012
hmm, as I am not loading the library myself (IIRC R2 had something 
like addres-of), but Red/System is doing so. I wonder, if there is 
a way of how actually get the library handle ...
Kaj:
12-Feb-2012
Hm, I'm not sure either if the wrapper function can currently be 
written like I said. You'd have to use the specific declaration as 
function! type for the function pointer, but the Red/System type 
checker may not currently support getting the function pointer in 
the right type
Pekr:
12-Feb-2012
Hmm, so in my case the situation in Red/System is even worse than 
possibly in R2 and World, where I could get such a handle from load/library 
directive, whereas in Red/System, what you describe, is writing completly 
separate layer. In fact, C's LoadLibrary is not difficult to handle, 
but still - a C level coding, which I thought is almost eliminated 
for wrapping purposes ...
Kaj:
12-Feb-2012
The Red/System situation is certainly not worse: it's the other way 
around. You can program manual loading with just a few well defined 
functions, the same that R2 and World use. But normally, you use 
automatic loading by the operating system, which is the standard 
and most efficient way to do it, and which R2 and World can't use 
because they execute bindings at run time
Pekr:
12-Feb-2012
Some Red/System type casting will not help? :-)
Maxim:
13-Feb-2012
note that currently, what you see isn't RED... its RED/System.
Evgeniy Philippov:
13-Feb-2012
So, all preprocessor directives can easily be removed from a language 
of Red/System, and replaced by normal keywords.
Evgeniy Philippov:
13-Feb-2012
Red/System v2. Without a preprocessor directives at all.
Evgeniy Philippov:
13-Feb-2012
Maxim, from a R/S spec: "Red/System ... will be embedded in Red scripts"

Maxim:
13-Feb-2012
AFAICT, Red/system is used more like a high-level VM (compilable 
source rather than interpreted opcodes) which can be natively compiled. 
  RED won't have RED/System semantics.
Pekr:
13-Feb-2012
Max, I share some sentiments with Evgeniy. I too don't understand 
some design decisions - my first take is, that Red/System should 
be as much compatible to Red, as possible. Hence I will never agree 
to decision for 'print differing from its Red counterpart. I don't 
give a <censored> to C users, as imo noone will use Red/system, unless 
that person also plans to use Red itself.


My take is, that compatibility between Red and Red/System is much 
more important, that compatibility between the Red/System and C.


Ditto the strange aproach to use kind of preprocessor for importing 
the libraries, whereas R2 and World are OK with just make routine!

Ditto for strange declaration stuff:

declare struct!
alias struct!
#import for a library

Intead of:

make struct!
make lit-struct!
make routine!


If Red/System is going to be inlined in Red, the aproach to costructors 
should be as much the same as possible. This is a dialecting - the 
same words have different meaning in different context usage. I don't 
give a <censored> about protecting a possible C user's knowledge 
...
Pekr:
13-Feb-2012
That is what I call a protecting C nonsense. We are REBOL, not C, 
period. I am so mad about it, that if there would not be option to 
use print along with block, I would stop using Red/System ...
Pekr:
13-Feb-2012
The decision was based clearly upon the fear, that Red/System is 
going to be used mainly by C ppl, and that in C print doeas not add 
new line by default ... that is imo a wrong design decision ...
Maxim:
13-Feb-2012
Pekr,  Red and Red/System don't have the same semantics so I see 
no reason why they have to be compatible in any way except lexically.
PeterWood:
13-Feb-2012
I feel that there is a lot of merit in Evgeniy's approach, not least 
the possibility of a one-pass compiler. 


I think it is worth remembering that the current version of Red/System 
is a "bootstrap" version with which to build Red. Once Red is built, 
Red/System will be re-written in Red.


It is most likely that there will be many imporvements to Red/System 
, some may involve syntax changes. 


I feel we should all expect to have to re-visit existing Red/System 
code when the "real" Red/System is released.
PeterWood:
13-Feb-2012
Whilst I cannot speak for Nenad, I'm sure he will recognise these 
advantages. He may of course have other strategies up his sleeve 
to achieve speedy compilation.


Whether he would choose to improve the bootstrap version of Red/System 
at the expense of delaying work on Red is the big question.
Dockimbel:
14-Feb-2012
Pekr: (short answer) Red/System (and Red) generate executable binaries 
while R2/R3, while World and all other interpreted languages just 
run code in an interpreter or VM. This is a big difference, because 
Red can use the OS to load libraries at "load-time" instead of having 
to write code to do it (as all others interpreted languages require). 
This is also faster than loading manually. Red/System doesn't have 
yet a x-platform extension for adding "run-time" library loading 
support, just because we don't need it at all for now, but it can 
be added easily, by wrapping libFFI for example, or implementing 
it purely in Red/System.
Dockimbel:
14-Feb-2012
But all the OS and third-party libraries we're currently using in 
Red/System have stable API, not the need for runtime loading has 
not appeared yet.
Pekr:
14-Feb-2012
OK, so if I understand it correctly, Red/System loads the library 
at an executable load time, whereas load/library does so dynamically 
in the app run-time. Stil - I wonder, if we could get a handle to 
such a library? I mean, syntactically #import is just like preprocessor 
construct - you can't assign it to any variable. Not sure it would 
be usefull, to be able to retrieve a handle to such wrapped library 
plus handles (entry points) to wrapped function calls?
Dockimbel:
14-Feb-2012
Evgeniy: (short answer)


1) IIRC, there's no recompilation of included files in Red/System, 
the only overhead is parsing the preprocessor directives and reducing 
them. I agree that the whole compilation process would be significantly 
faster without a preprocessor, but that's another topic.


2) Preprocessor is a handy addition for compiled languages, that's 
why it was introduced in Red/System, not because it was a planned 
feature, but just because we _needed_ it for going further. The distinctive 
# prefix is used to make it clear both for users and the compiler 
that these parts are reduced at "compile-time" instead of "run-time" 
and avoid confusing both users and the compiler. For example, from 
your examples, the compiler has no way to distinguish a "compile-time" 
IF from a "run-time" IF, unless you make it a lot slower by doing 
static analysis and complex inference (the cost would be huge compared 
to the preprocessor). Also, this might also introduce a lot of new 
restrictions in the language semantics, which is not desirable.


3) IMPORT is better than INCLUDE: you might have missed it, but we 
can't yet generate libraries, so importing Red/System code now is 
not an option.
Dockimbel:
14-Feb-2012
Also, the plan for me since the beginning was to use Red to help 
construct dynamically Red/System programs without requiring any preprocessor. 
As Red is not ready yet, I'm glad we have the preprocessor now in 
Red/System, to make our life easier.
Oldes:
14-Feb-2012
I was not using preprocessor in my Rebol/Flash dialect and I must 
say, I find the Red/System way useful. It may be true, that additional 
pass may slow the compilation a little bit, but it also provide additional 
features. Also I don't expect that it will be used in some huge projects 
with MB of sources so if it's a few ms slower is not a problem. And 
as Red/System is open, everybody can provide own version:)
Pekr:
14-Feb-2012
Doc - we have got the right function names, that is not the problem. 
The problem is the crash, and we were trying to identify, if Red/System 
library wrapping system still needs some improvements for some cases, 
or simply the DLL is doing something internally, that some functions 
work, and some crash. Here's example:


fpGetBright= (LSN_GETBRIGHT)GetProcAddress(g_hLedCtrlInst, "LSN_GetBright");
wrapped as:
led-get-brightness: "LSN_GetBright" [return: [integer!]]


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?)
Pekr:
14-Feb-2012
As for compilation time. I don't know guys, but Red/System compiles 
REALLY fast. I do remember my dos times, where compiling took 30 
secs. Where's the problem? It's not imo about the compilation speed, 
at least for me - it is about the process of building app vs dynamic 
prototyping using interpreter. I don't like much the compile/build/run 
process, but I expect something like R2 console for prototyping appear 
in distant future for Red ....
Dockimbel:
14-Feb-2012
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
Dockimbel:
14-Feb-2012
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
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 ...
Dockimbel:
14-Feb-2012
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.
Evgeniy Philippov:
14-Feb-2012
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.
Evgeniy Philippov:
14-Feb-2012
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.
Dockimbel:
14-Feb-2012
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...
Pekr:
16-Feb-2012
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 ...
Pekr:
16-Feb-2012
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]
Dockimbel:
17-Feb-2012
It seems that the issue is caused by FPU control word settings used 
by Red/System that make webkit crash. I need to find a common setting 
that would work for both.
Dockimbel:
17-Feb-2012
It wraps the webkit component of GTK, so you can add a webkit view 
in a GTK window and pass it an URL to open. As we already have a 
pretty broad support of GTK components, you can now build your own 
custom web browser in Red/System!
Dockimbel:
17-Feb-2012
Yeah, same issue than previously with the "float invalid operation" 
exception. Webkit seems to mask them all, while Red/System let them 
pop up.
Pekr:
17-Feb-2012
what is C init routines topic about? I mean - why Red/System needs 
it?
Dockimbel:
17-Feb-2012
Kaj: I will see if I can quickly add support for `system/fpu/flags` 
so users can set it as they want/need.
Dockimbel:
17-Feb-2012
Pekr: it is possible to divide by zero in IEEE-754, that gives you 
+/- INF. I have not decided yet how it should be handled in Red/System, 
I would be in favor of raising an error rather than introducing INFs.
Kaj:
17-Feb-2012
For non-variadic C functions, Red/System's compiler will promote 
float32! to float! automatically.
Kaj:
19-Feb-2012
I've added Mandelbrot drawing floating point examples to the C library 
binding, for Red/System and seven other languages, to compare them
Endo:
19-Feb-2012
I see, so it should be corrected on the web page, Red/System Language 
Specification.
Dockimbel:
19-Feb-2012
That's the way C works, the enumerations in Red/System is a direct 
transposition, works the same way.
Dockimbel:
20-Feb-2012
Added support for `system/fpu/*` read/write properties. This allow 
controling the FPU at very low-level at runtime.

When compiling in debug mode, `show-fpu-state` function is available 
to print the current FPU properties: `show-fpu-state`

When called on IA-32, it would output::

FPU type: x87
- control word: 0000037A
- rounding    : nearest
- precision   : double extended (80-bit)
- raise exceptions for:
    - precision  : no
    - underflow  : no
    - overflow   : no
    - zero-divide: yes
    - denormal   : no
    - invalid-op : yes


See %red-system/runtime/system.reds for definitions and %debug.reds 
for a usage example.
Dockimbel:
20-Feb-2012
Kaj: in order to get the LazySunday browser working, you need to 
add at the beginning of %math.reds:

#if target = 'IA-32 [
	system/fpu/mask/zero-divide: on
	system/fpu/mask/invalid-op:  on
	system/fpu/update
]


This will disable the exceptions used by Red/System to raise runtime 
errors on float operations. All x87 exceptions should be disabled 
when  calling C functions.
Dockimbel:
20-Feb-2012
BTW, I guess I should also turn underflow and overflow exceptions 
for Red/System by default...
Kaj:
20-Feb-2012
Unfortunately, if I put that code in the C binding now, there will 
be no compatible Red/System release, so I'll put it in the WebKit 
binding first
Dockimbel:
21-Feb-2012
Kaj: I have enabled underflow and overflow exceptions in x87 by default 
for Red/System. This will help us write more reliable code. We'll 
be able to optionally disable all FPU exceptions once we get support 
for INF and NaN. So the init code for C lib is now:

#if target = 'IA-32 [
	system/fpu/mask/underflow: on
	system/fpu/mask/overflow: on
	system/fpu/mask/zero-divide: on
	system/fpu/mask/invalid-op:  on
	system/fpu/update
]

or in shorter, but less readable form:

#if target = 'IA-32 [
	system/fpu/control-word:  033Fh 
	system/fpu/update
]
Pekr:
22-Feb-2012
One question towards library wrapping and type casting. One DLL function 
is defined as:

typedef bool (WINAPI *LSN_OPENCARD)(void);//open led card 


When I defined the return type of wrapper funciton as LOGIC!, it 
was always true. When I defined it as an integer, it was either 1, 
or some really high integer number. So i took Cyphre's advice towards 
R2's interface, and in R2 I used CHAR, and in Red/System, I used 
BYTE! type.


Pity construct of a type return: "as integer! [byte!]" is not allowed, 
but at least I now get correct result - 0, or 1, in my print statement, 
where I do: print [as integer! led-open-card lf]


So my question is - why using Red/System's LOGIC! did not work? Is 
C level BOOL a clearly defined type, or can it be defined in various 
ways, so I can't say, that I can automatically use LOGIC! = BOOL 
logic, when wrapping stuff?
PeterWood:
22-Feb-2012
From the spec Red/System does not support the use of  the logic! 
datatype in #import  - http://static.red-lang.org/red-system-specs.html#section-14.1


The spec is also silent about how a the logic! field is actually 
stored. I'd guess a byte! but I'd probably be wrong.


By the way no need to cast byte! to integer!, just test for #"^(00)" 
or #"^(01)".
Kaj:
22-Feb-2012
The "other standard" for true is -1, but there are no signed integers 
in red/System, so that's where you get the high value from
Kaj:
22-Feb-2012
It's very nice that Red/System has a first class logic! but external 
code doesn't know that
Dockimbel:
22-Feb-2012
Integer! _is_ signed in Red/System, byte! is not.
Pekr:
22-Feb-2012
yes, I confused it - ti came from R2, where I put char as a return 
value, and then to-integer ... I develop in in R2, Red/System, World, 
to see if eventual crashes are environment specific, or library specific
5601 / 574612345...545556[57] 58