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

World: r3wp

[Red] Red language group

Kaj
30-Oct-2011
[3658x2]
What the Doc ordered:
http://red.esperconsultancy.nl/screenshots/Topaz-in-RedSystem-browser.png
james_nak
30-Oct-2011
[3660]
Kaj, this may be a dumb question but what OS are you using?
Kaj
30-Oct-2011
[3661]
Linux Mint 10, "Julia"
james_nak
30-Oct-2011
[3662]
Thanks. I was wondering if you were using Syllable.
Kaj
30-Oct-2011
[3663]
Unfortunately, not yet, but in the next step I hope to integrate 
this in Syllable Server
Ashley
31-Oct-2011
[3664]
Wow, this is the sort of stuff to showcase Red with, "A browser in 
only 21Kb, a ... in only ...". Fantastic progress guys.
Endo
31-Oct-2011
[3665]
Wow! That's great! Cool work Kaj!
ddharing
31-Oct-2011
[3666]
Very nice, Kaj.
Kaj
31-Oct-2011
[3667]
Thanks. It's remarkable how big the gap is between the low and high 
hanging fruit. I've spent ten years on Syllable and REBOL, and three 
hours on this browser so far, including the WebKitGTK+ binding
Geomol
31-Oct-2011
[3668]
:) The cool factor!
Gregg
31-Oct-2011
[3669]
Very cool indeed Kaj.
Kaj
31-Oct-2011
[3670x2]
Reviewed some Python, Ruby and Haskell bindings for GTK, and they 
all look like my Goodbye Cruel World example in various incarnations, 
instead of my Hello World example :-)
GTK's, and other IDEs', idea has always been that Glade, and now 
a newer interface builder, makes it easier, but combining a generated 
XML interface definition manually with some code language doesn't 
compare to Red/System
Dockimbel
1-Nov-2011
[3672]
Kaj: you might want to add something to the comments here: https://gist.github.com/1326101#comments
Kaj
2-Nov-2011
[3673]
Done, thanks
MikeL
3-Nov-2011
[3674]
For the RED import, I am getting "Compilation Error: attempt to redefine 
existing function name: printf" when trying to compile the example 
for variadic  http://static.red-lang.org/red-system-specs-light.html
    Get same message for "free" when trying to compile example from 
9.1 #import.     What novice error am I  making?
Dockimbel
3-Nov-2011
[3675]
You can't reuse a function name in Red/System. `printf`and `free` 
are already defined in the runtime source code (%red-system/runtime/). 
If you provide alternative names (not used by the runtime) for those 
imported functions, it will work correctly.
Kaj
5-Nov-2011
[3676]
Doc has got Red/System running on Android
AdrianS
6-Nov-2011
[3677]
Great to hear! What kind of output is the app able to do?
Dockimbel
6-Nov-2011
[3678x4]
Console output only for now.
Being able to make GUI apps on Android requires at least two more 
steps:
- have Red/System linker be able to generate shared libraries

- build a generic Java bridge to be able to instanciate java objects, 
invoke methods and receive events
A shorter, but less efficient path, could be to use TCP sockets (or 
a lib like ZeroMQ) to setup a communication channel with the generic 
Java bridge.
Also the NDK could have been an interesting option, but AFAIU, it 
compiles C/C++ sources to Dalvik bytecode, so natively interfacing 
with Red/System binaries might not be possible.
Pekr
6-Nov-2011
[3682x3]
Are "native" Android GUI apps posible? I mean - e.g. GTK based ones. 
Or if View would be ported - it uses own methods to draw stuff, no? 
Although windowing is native, so probably some link to JAVA still 
required. Pity MeeGo did not become popular instead (pure Linux based 
IIRC)
I finally find some time to read Red/System doc, and I have a novice 
question - what is basically the difference of cdecl or stdcall? 
Respectively - when wrapping API stuff, how do I know which one to 
use? I expect this area is for more skilled C developers, than occassional 
interface users?
In 13.6.2: isn't there a typo?

show-args 123 -p hello

it would output:

count: 4
1: test-logic2
2: 123
3: -p
4: hello

I would expect 1: being a "show-args"
Dockimbel
6-Nov-2011
[3685x3]
what is basically the difference of cdecl or stdcall?


See this wikipedia page for some basic info about calling conventions: 
http://en.wikipedia.org/wiki/X86_calling_conventions


Respectively - when wrapping API stuff, how do I know which one to 
use? 


When you're wrapping an API, you should find out how the library 
was compiled, and infer from that what calling convention is required. 
Most of C libs are using cdecl, while the Windows win32 API uses 
stdcall.
13.6.2: yes, it's a typo.
Typo fixed.
Pekr
6-Nov-2011
[3688]
small typos:

Similary, it is also possible to modify the c-string's bytes
  .... "similarly"
alias names should end with a exclamation mark
  .....  "an exclamation"
The stdcall attribut is also accepted
  ....  "attribute"


But - those are really small typos, you can probably spend your valuable 
time elsewhere :-)
Dockimbel
6-Nov-2011
[3689]
Thanks for reporting them. I will fix them now, that's just a couple 
minute work.
Pekr
6-Nov-2011
[3690]
btw: why was 'declare word used instead of 'make? Will there be 'make 
in a RED level, so you wanted to keep the difference?
Dockimbel
6-Nov-2011
[3691x3]
`make` implies a dynamic creation (at run-time), while these are 
static value declarations (at compile-time). There was a debate about 
that on the Red ML, see the thread for more info.
Right, `make` at Red level will have the same meaning as in REBOL.
BTW, there's no memory manager at Red/System level, so that you can't 
"make" a value, you can only declare it at compile-time. If you need 
dynamic values at run-time, you will need to use malloc/free wrappers 
provided by the Red/System runtime library.
BrianH
6-Nov-2011
[3694x2]
The NDK compiles C/C++ to fat binaries native code, not Dalvik. The 
native code interfaces with Dlvik code through JNI standard ABI. 
If you make Red compile to the JNI calling conventions, to will be 
much easier than rigging up a TCP control interface.
The NDK supports compiling to 3 different native formats right now 
- two ARM platforms, and x86. You can create an APK that supports 
one or more of these platforms. The binaries are packaged into an 
archive, with the binaries of different platforms put into subdirectories 
in that archive. When an APK is installed, only the binaries for 
the supported platform(s) are loaded.
Dockimbel
6-Nov-2011
[3696]
Using a JNI interface is my plan, but it requires to be able to generate 
Red/System shared libraries. I was mentioning the TCP option, as 
it could be done right now.
BrianH
6-Nov-2011
[3697]
If you are making a native compiler for Android, integrating with 
the NDK is the best way to go. Unless what you are making is a compiler 
that runs *on* Android devices, which would be great; then you would 
make the libraries for that compiler integrate with the NDK.
Dockimbel
6-Nov-2011
[3698]
Does the NDK provide access to all the GUI framework?
BrianH
6-Nov-2011
[3699]
Yes. Though some levels of access require more recent versions of 
Android. Fully native apps require 2.3 or above.
Dockimbel
6-Nov-2011
[3700]
That's very good news.
BrianH
6-Nov-2011
[3701x4]
Most Android phones run 2.2 or below, so that good is a bit limited.
I would personally appreciate it if you supported 2.2, as that is 
the last version that my phone model currently has been upgraded 
to. It would be a good idea to look up the stats for which percentages 
of Android phones are running which versions. I haven't seen a 1.5 
phone in over a year, but my gf's phone won't be upgraded past 1.6 
(I need to get her a new phone).
We did a lot of research into the NDK for the R3 project. I was really 
interested in how an Android host program would be structured, how 
the Android application model would map to the R3 model. Hint: Android 
doesn't really have applications at all.
In a lot of ways, Android reminds me of the Oberon System. You don't 
install apps, you install system services, that for some of the types 
of services provide a UI, and for other types of services provide 
an API or task execution model.
Dockimbel
6-Nov-2011
[3705]
I will probably go for 2.1 or 2.2 as minimal system requirement.
BrianH
6-Nov-2011
[3706x2]
Go for 2.0, and you'll cover almost everything. Certain Red facilities 
could require more recent versions, but between 2.0 and 2.2 there 
were mostly just features added, as far as native code is concerned. 
If you support pre-2.3, you might as well set the baseline as far 
back as 2.0.
There are a lot of people still waiting for their manufacturers to 
provide upgrades from 2.1 to 2.2, so 2.1 support is a good idea. 
The main thing added in 2.2 was the Dalvik JIT compiler, and that 
doesn't really affect native code that much. The NDK docs have a 
pretty good changelog that tells you what was added in each version.