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

World: r4wp

[#Red] Red language group

Pekr
3-Jul-2013
[9268]
Let's take e.g. 'read function. Where will it be created? Red/System 
level? Red level? Both? E.g. Red/System does not allow refinements, 
so I expect some "natives" code will be done using R/S, and higher 
abstraction via routines in Red level?
DocKimbel
3-Jul-2013
[9269]
Bo, congrats! Hope you'll demo it at the devcon.
Pekr
3-Jul-2013
[9270]
btw - my brother ordered 3x Arduino kit for our friends, and for 
me he ordered BeagleBone Black. So I will see, if I can get Red programs 
running on it :-)
DocKimbel
3-Jul-2013
[9271x2]
Red should run just fine on the BB Black.
My motion detection executable on the Pi is 30KB.  The same executable 
compiled for Windows is 15KB (50% the size).


Red currently emits only the standard ARM opcodes, so 32-bit per 
instruction. We'll add support in the future for Thumb mode (more 
compact instruction set). In the meantime, you can try to activate 
the literal pools by adding the following option to the Linux-ARM 
config block (in %config.r):

literal-pool?:	 yes


That should both reduce final binary size and give you a little speed 
improvement. But be sure to test is well as this mode has not been 
much used yet. Also, it might fail to compile if you use very big 
functions, or a lot of code in global context.
Kaj
3-Jul-2013
[9273x8]
Bo, your make-c-string leaks memory. read-file will allocate memory 
of the size to fit the file contents
Xie, read-file is a Red/System function that does much more than 
fread. It returns the file content itself as a string, not the number 
of bytes read
fread is mapped directly to read-array
Bo, your file must contain "1". The second number is the address 
where it is read into memory
Remember that a c-string! is a pointer to a memory address. Much 
like a string! in REBOL is a reference to the storage of a series 
value that can be referenced by multiple string!s, each with their 
own index
If you want to convert the content of your text file to an integer, 
my C library binding provides to-integer, just like in REBOL
Petr, the Red/System READ functions and the higher Red abstractions 
on top of it are already here. As I said yesterday, Doc is free to 
use parts of it when he makes a more elaborate I/O framework in Red
You're not wasting any time on them, are you (except by talking about 
them)? I need them now, and so do others
Bo
3-Jul-2013
[9281]
Thanks for the advice and comments, everyone!  I'm feeling really 
good about Red/System and the greater Red ecosystem now that I have 
a project under my belt.  Kaj's been an immense help and I thank 
others also for their input!
Arnold
3-Jul-2013
[9282]
No console input command yet for Red or Red/System
prin "Number of sweets:" number-of-sweets: input
number-of-kids: ask "How many kids?"

Is the support planned? Will work nice with the kids sharing candy 
storyline making their program better.
Kaj
3-Jul-2013
[9283]
Yes, there is, in my I/O binding and interpreter builds. The basic 
console has very little
Bo
3-Jul-2013
[9284]
Kaj, you said that 'read-file in Red/System automatically defines 
a large enough memory space for the file.  How about 'read-file-binary? 
 That one has a 'size parameter.  How can one determine how big to 
make that 'size parameter before reading the file?
Kaj
3-Jul-2013
[9285x3]
You don't make it any size. It works the same as read-file and the 
READ function in REBOL: it allocates the storage for you
In the case of read-string you get a c-string!, so you can get the 
size with LENGTH?. For read-file-binary that's not possible, so you 
pass a pointer to an integer! to be informed about the read size
Sorry, read-file
Bo
3-Jul-2013
[9288]
Thanks for that.  Another detail I wasn't understanding correctly.
Paul
3-Jul-2013
[9289]
Where is RED at these days in comparison to R3?
Kaj
3-Jul-2013
[9290x2]
Glass half full, half empty :-)
What are you interested in?
Paul
3-Jul-2013
[9292]
I guess more or less what is the major usuability items that are 
still lacking in each.  Maybe you can answer that towards what RED 
still lacks as a major need.
Kaj
3-Jul-2013
[9293]
Garbage collector, error trapping, objects, floating point, PARSE, 
other complex datatypes
Paul
3-Jul-2013
[9294]
Some major ones there.
Kaj
3-Jul-2013
[9295]
Yep, that's the glass half empty
Paul
3-Jul-2013
[9296x2]
Thanks Kaj.
There a timeline on those?
Kaj
3-Jul-2013
[9298]
More like an order than an ETA, but you'd have to ask Doc
Paul
3-Jul-2013
[9299x2]
ok
Good info - thanks.
DocKimbel
3-Jul-2013
[9301]
Hi Paul, we have some Windows drivers issues for you to solve, up 
to the challenge? ;-)
Paul
3-Jul-2013
[9302x3]
Hehe.  Possibly but got a new job that is hitting me hard.
Working mostly in SAN/NAS Cloud technologies.
What is your most pressing windows driver issue?
DocKimbel
3-Jul-2013
[9305]
Kaj will explain it to you. :-)
Paul
3-Jul-2013
[9306]
ok
DocKimbel
3-Jul-2013
[9307]
Basically, we have a minifilter driver in Red/System that can be 
installed through an INF file, but when started (using `sc start`) 
we get either error 1058 or error 2 (File not found).
Paul
3-Jul-2013
[9308x2]
SC is the service control manager command line utility
Is the process created as a service?
DocKimbel
3-Jul-2013
[9310]
The INF file installs the filter driver as a service, yes.
Paul
3-Jul-2013
[9311x2]
ok
What is the verbose for 1058?
DocKimbel
3-Jul-2013
[9313]
Just thinking loud, does that mean that the filter driver has to 
respond to service commands?
Paul
3-Jul-2013
[9314]
Yes most likely.
DocKimbel
3-Jul-2013
[9315]
1058: I don't know, that's Kaj's error.
Paul
3-Jul-2013
[9316]
ok
DocKimbel
3-Jul-2013
[9317]
Hmm, I guess we should try then implementing a suitable callback 
to answer properly to SCM commands...