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

World: r3wp

[Red] Red language group

Andreas
14-Jun-2011
[1983]
If someone wants to test the generated ELF binaries on Syllable, 
I have a pre-built "hello.reds" available at http://bolka.at/2011/tmp/hello-syllable.bin
Steeve
14-Jun-2011
[1984]
btw, I tried to install syllabe within VirtualBox some weeks ago, 
And It failed/
Dockimbel
14-Jun-2011
[1985]
Andreas: tested on Syllable, works flawlessly!
Andreas
14-Jun-2011
[1986x2]
Oh, great to hear :)
Wouldn't have expected that, actually.
Dockimbel
14-Jun-2011
[1988]
Is it compiled with C bindings? (length? == strlen( ))?
Andreas
14-Jun-2011
[1989x4]
Compiled with the current default settings.
So yes, with C bindings.
readelf says that alloc, free, memset, memmove, strlen are imported 
in the binary.
malloc*
Dockimbel
14-Jun-2011
[1993x2]
Steeve: which system image file have you used?
Great! :)
Steeve
14-Jun-2011
[1995x2]
I check it
SyllableDesktop-0.6.6.i586.iso
Dockimbel
14-Jun-2011
[1997x3]
I am currently working on runtime error catching. I have successfully 
redirected default handlers for SIGILL, SIGSEGV, SIGFPE on Linux, 
but on Windows, the systems seems to ignore my handlers (using signal( 
) function). So I am currently testing with SetUnhandledExceptionFilter() 
(http://msdn.microsoft.com/en-us/library/ms680634%28VS.85%29.aspx)
If anyone has experience with that API on Windows, advices and tips 
are welcome. :-)
Steeve: I failed to install that version too, but here are special 
install images for Vmware and VirtualBox under "Emulate Syllable" 
bar here: http://web.syllable.org/pages/get-Syllable.html#installation-CD
Steeve
14-Jun-2011
[2000]
Thanks, I'll try it
Dockimbel
14-Jun-2011
[2001]
My Syllable image on Vmware works well (as long as I keep the mouse 
in the VM during the boot sequence, else it fails to be detected).
Steeve
14-Jun-2011
[2002]
Btw, How do you use a Vmware image instead of an iso one. I don't 
see any option to do so with VirtualBox
Dockimbel
14-Jun-2011
[2003x2]
You just do from menu: File->Open.
(on Vmware)
Steeve
14-Jun-2011
[2005]
Hmm...
Gregg
14-Jun-2011
[2006]
Great to see continued progress on Red!
Dockimbel
14-Jun-2011
[2007]
Thanks Gregg, we are currently reaching the first milestone of the 
project with a fully capable Red/System language, just a few more 
implementation fixes, the specification draft to complete, and I 
will declare it beta (means "usable" for real work).
Kaj
14-Jun-2011
[2008x5]
Cool news :-)
Steeve, did you use the VirtualBox boot entry?
hello-syllable.bin confirmed working on the Syllable Desktop development 
build. Thanks to Andreas
The INTERP section can be removed from the binary because it is not 
applicable to Syllable
This removes the last barrier for me to start using Red for real 
work :-)
Mchean
16-Jun-2011
[2013]
Is Red is just Linux at the moment?
nve
16-Jun-2011
[2014x4]
No Win32
also Win32
And MacOSX
The aim is to be cross platform including ARM support
Mchean
16-Jun-2011
[2018x2]
and does it have a console?
like the rebol console?
Kaj
16-Jun-2011
[2020x2]
Windows, Linux and Syllable, no Mac
No console, but you can just use the system's console
Mchean
16-Jun-2011
[2022]
well this is very cool!
Kaj
16-Jun-2011
[2023x2]
BSD definitions are currently being entered into Red, so maybe the 
platforms list is already out of date :-)
It should be quite easy to get it to run on the BSD systems from 
the current state
jocko
17-Jun-2011
[2025]
I tried to write a console input function (no one is available up 
to now AFAK).
This one works (for windows):
#import [
	"kernel32.dll" stdcall [
		ReadConsole: "ReadConsoleA" [
		  	handle		[integer!]
		  	buffer		[c-string!]
		  	len			[integer!]
		  	read		[struct! [value [integer!]]]
		  	reserved	[integer!]
		  	return:	[integer!]
		]
	]

]

stdin: GetStdHandle WIN_STD_INPUT_HANDLE
__read: struct [value [integer!]]
	

input: func [s [c-string!] return: [c-string!] /local in][
		;in: "" ; don't work
		in: allocate 255  ; must be freed after !
		prin s
		ReadConsole stdin in 255 __read 0
		a: __read/value - 1; because of the line return symbol \n
		in/a: #"^(00)" ; necessary to add it !
		in
	]

; usage :
res: input "enter a string : "
print res

my questions : 
- is this correct ?
- how and where de-allocate the c-string ?
- why the end-string symbol is not added automatically ?
Kaj
17-Jun-2011
[2026x3]
My C library binding has a range of input functions
I don't know if your code is correct, because it's Windows specific. 
It's quite possible that the Windows functions don't close strings 
with the trailing zero. My impression is that Windows wasn't originally 
built on the C standard library
The memory you allocate in your input function is returned from the 
function, so it must be freed outside the function, after every call
jocko
17-Jun-2011
[2029x2]
Have you tried the input functions of your C library binding ? I 
tried input-line (under windows) some time ago, and it did not work. 
At that time, i did not try to allocate the c-string
Under windows, the problems with input-line (which uses gets) are 
probably the same as those that I faced in my implementation : to 
allocate the c-string buffer, to terminate the string properly.
Andreas
17-Jun-2011
[2031x2]
man gets:
BUGS
       Never use gets().