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

World: r3wp

[Red] Red language group

Evgeniy Philippov
1-Feb-2012
[4685x2]
Well. I give up. I don't like languages with preprocessors since 
they are slower than languages with no preprocessor. So I send an 
original .ATG to Dockimbel, and stop my work. Looking at the RED 
spec made me sigh about the preprocessor.
And I am restarting my work on simple Oberon-like language.
BrianH
1-Feb-2012
[4687]
I was just talking about the token portion of the Coco/R syntax rules, 
as opposed to the parse rule portion. But agreed, any Oberon-like 
language will have a simpler syntax than any REBOL-like language, 
and will have been designed with LL(1 or so) in mind.
Evgeniy Philippov
1-Feb-2012
[4688]
paths seems to be tokens, too
BrianH
1-Feb-2012
[4689x2]
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.
In some other REBOL-like languages there are some inherent conflicts 
between some path element types (notably dates) and the path separator 
/ itself, plus the final : on a set-path is considered part of the 
path instead of being a set-word element contained in the path, and 
the same for a leading : in a get-path not being part of a get-word 
first element (in R3). There's a fairly well-defined set of precedence 
rules, but for REBOL-like languages other than Red those rules are 
not very well documented, and they can therefore sometimes vary from 
language to language.
Gabriele
1-Feb-2012
[4691]
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
[4692]
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? :-)
Jerry
1-Feb-2012
[4693]
Doc, According your slides, Red's boxed value composes of 4-byte 
head and 12-byte payload. Why so? I guess R3 is 2-byte head and 10-byte 
payload. Just curious. :-)
Dockimbel
1-Feb-2012
[4694x3]
Pekr: thanks but only the float-partial branch is done (still some 
bugs to fix also).
Jerry: values needs space to store various flags, and type information. 
Also, payload access needs to be 32-bit aligned at least.
Why do you think that the R3 values header is 2 bytes long only?
Jerry
1-Feb-2012
[4697]
2-byte head is just my guess. 10-byte payload is my guess too, based 
on the max limit of tuple!. With your explaination, now I know why 
4-12 is choosed. Thanks.
Oldes
1-Feb-2012
[4698]
is it possible to get pointer value from variable declared as c-string?
Kaj
1-Feb-2012
[4699x3]
R3 has 16 bytes cells, too
Oldes, wrap it in a struct. I call those references
If you mean a pointer to the string payload, that's what a c-string 
already is
Ladislav
1-Feb-2012
[4702]
I guess R3 is 2-byte head and 10-byte payload.
 - that is a wrong guess
amacleod
1-Feb-2012
[4703]
Raspberrypi shipping any day now! http://www.raspberrypi.org/Lets 
see Red on it!
PeterWood
1-Feb-2012
[4704]
Oldes: A c-string is a byte-ptr!. It can be cast to an int-ptr! if 
needed.
Dockimbel
2-Feb-2012
[4705]
Kaj: I cannot compile GTK+ examples anymore using the latest GTK+ 
binding version...Where can I find the missing GLib.reds file?
PeterWood
2-Feb-2012
[4706]
Here http://red.esperconsultancy.nl/Red-GLib/info/12c18cb30c?
Dockimbel
2-Feb-2012
[4707x2]
Thanks Peter.
Kaj: I gave a new try on making the GTK+ binding work on Linux/ARM, 
I was able to track the crash up to the call to `gtk-append-container` 
from `gtk-window` function. The argument values passed are:

    window: 0006C000 value: 12

which results in a Runtime Error 1: access violation (segfault)
Oldes
2-Feb-2012
[4709x2]
Kaj: my problem is, that I have a routine: MagickRelinquishMemory 
which should release memory from routines where some returns c-string, 
and some for example pointer to array values... So the best would 
be to accept pointer! with MagickRelinquishMemory, but still to be 
able return just c-string from some routines, if you understand me. 
I know there are workarounds, but it could be quite simple
What about implementing any-pointer! type?
Dockimbel
2-Feb-2012
[4711]
Oldes: why can't use simply use type casting when required?
Oldes
2-Feb-2012
[4712]
and is it possible to cast pointer from c-string?
Dockimbel
2-Feb-2012
[4713x2]
Sure: 

    p: declare int-ptr!
    s: as c-string! p		;-- or use `as-c-string` defined
You can freely cast any pointer type to any other pointer type (struct 
and c-string are part of any-pointer! internal typeset).
Oldes
2-Feb-2012
[4715x2]
I would prefere to be able simply define:   MagickRelinquishMemory: 
"MagickRelinquishMemory" [return: [any-pointer!]] which would accept 
c-string!, struct!, pointer! [byte!], pointer! [integer!] etc..
sorry..   MagickRelinquishMemory: "MagickRelinquishMemory" [resource 
[any-pointer!]]
Dockimbel
2-Feb-2012
[4717x2]
You can already have it: #define any-pointer! byte-ptr!
Ah you want implicit casting...sorry.
Oldes
2-Feb-2012
[4719]
But it's true I can use:
	MagickRelinquishMemory as-c-string query
where query is an array... just it's not so clear
Dockimbel
2-Feb-2012
[4720x2]
You should rather use byte-ptr! (which is more "generic" than c-string!) 
as return type for MagickRelinquishMemory and cast values to byte-ptr! 
when required.
Pull request #201: Oldes, thank you very much for your changes. It 
should be ok now for merging, I will just run a few more tests before 
that.
Kaj
2-Feb-2012
[4722x5]
Oldes, I had the same problem as you with the generic memory freeing 
routine in the C library, so I use this define:
#define free-any	[free as-binary ]
Which uses this in turn:
#define binary!	[pointer! [byte!]]
#define as-binary	[as binary! ]
Instead of pointer! [byte!] you could use byte-ptr! now, as Doc said
Dockimbel
2-Feb-2012
[4727x2]
Enumeration branch from Oldes merged to float-partial branch. Thank 
to Oldes for this nice addition and quality work!
I will update the language spec document to include #enum description.
Kaj
2-Feb-2012
[4729x3]
Kaj: I gave a new try on making the GTK+ binding work on Linux/ARM, 
I was able to track the crash up to the call to `gtk-append-container` 
from `gtk-window` function. The argument values passed are:

    window: 0006C000 value: 12

which results in a Runtime Error 1: access violation (segfault)
Here's the code line:
gtk-append-container  as gtk-container! window  as gtk-widget! value
Dockimbel
2-Feb-2012
[4732]
Also, with this contribution comes an ImageMagick library binding!
Kaj
2-Feb-2012
[4733x2]
Cool :-)
value is supposed to be a widget object, so the 12 is bogus