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

World: r4wp

[#Red] Red language group

Kaj
23-Jun-2013
[8614x2]
That's an unreleased GoboLinux-on-Syllable-Server FrankenLinux
So it's a pretty big difference in optimisation, and MSVC doesn't 
show it
XieQ
23-Jun-2013
[8616]
I use VS2012 and it's MSVC ver 17.
Kaj
23-Jun-2013
[8617]
Thanks
Arnold
23-Jun-2013
[8618]
We

 are a team! Yoho!! According to Frank Ruben on the Red mailinglist. 
 He has a question about interfacing a C app in Red/System.
XieQ
24-Jun-2013
[8619]
Now in Red/System, we can't pass a function as parameter to Red/System 
FUNC,
but we can pass it to external C FUNC, right?


cmp-func!: alias function! [left [byte-ptr!] rihgt [byte-ptr!] return: 
[integer!]] 
quick-sort: func [
	base	 [byte-ptr!]
	n		 [integer!]
	size	 [integer!]
	cmp-func [cmp-func!]	
][
	; can't use cmp-func in this function
]
DocKimbel
24-Jun-2013
[8620x3]
XieQ, that should work too.
You should try passing the function! pointer as integer! then type-cast 
it inside the function. IIRC, function! cannot be  yet used in a 
Red/System func spec block.
(But as you mentioned, function! is accepted for external functions)
XieQ
24-Jun-2013
[8623x2]
I write a simple test  try to understand it, it's can be compiled, 
but the output is not expected
Red/System []


cmp-func!: alias function! [left [byte-ptr!] right [byte-ptr!] return: 
[integer!]]

cmp-int: func [
	left [byte-ptr!] right [byte-ptr!]
	return: [integer!]
	/local a b
][
	a: as int-ptr! left
	b: as int-ptr! right
	a/value - b/value
]

bar: func [
	cmp-func [cmp-func!]
][
	a: 1
	b: 2
	print cmp-func :a :b
]

bar :cmp-int
Pekr
24-Jun-2013
[8625]
XieQ - that's what Doc stated, no? you use cmp-func! function type 
in func spec block, which is not allowed (except the external functions, 
whatever that means). Sorry if misunderstood on my side, just trying 
to point that out ...
XieQ
24-Jun-2013
[8626x2]
it's print a memery address ( 00401A8F in my windows 7)
Pekr, I will try again
DocKimbel
24-Jun-2013
[8628]
Yes, because the compiler is not yet able to process `cmp-func [cmp-func!]` 
correctly. Try to declare an integer! there and then type cast it 
to a cmp-func! inside the body.
XieQ
24-Jun-2013
[8629x2]
Got the right result! Thanks Doc
bar: func [
	cmp-func [integer!]
	/local compare result
][
	a: 1
	b: 2
	compare: as cmp-func! cmp-func
	result: compare as byte-ptr! :a as byte-ptr! :b
	print result
]

bar as-integer :cmp-int
DocKimbel
24-Jun-2013
[8631x3]
I guess I should complete the function! support at some point before 
starting on Red/System 2.0.
New try for the Red port on Android demo:
http://static.red-lang.org/hello2.apk


This time it should work fine on all devices, please let me know 
if you find any issues. Just be sure to uninstall previous version 
before installing this one (just to be sure you won't report false 
positives).
Source code for the demo: http://pastebin.com/R5ySC8sw
Andreas
24-Jun-2013
[8634]
I'm happy to confirm that this now works on my Nexus 4 :)
DocKimbel
24-Jun-2013
[8635]
Great! :)
XieQ
24-Jun-2013
[8636]
Nice! works fine on all my devices (my phone 2.3.7 and my pad 4.1.1)
DocKimbel
24-Jun-2013
[8637]
Good, so we're almost ready to start infecting the Android world 
with the Red virus. ;-)
Endo
24-Jun-2013
[8638]
Works on Samsung S3 Galaxy, Android 2.3.6
Maxim
24-Jun-2013
[8639]
doesn't work on my 4S 5.01  ;-)
DocKimbel
24-Jun-2013
[8640x2]
Actually it does even on your 4S using iAndroid emulator: http://www.youtube.com/watch?v=gehh6zIijXM
;-)
Endo, thanks for testing it.
AdrianS
24-Jun-2013
[8642]
It still won't install on my Galaxy Nexus with 4.2.2.
DocKimbel
24-Jun-2013
[8643]
AdrianS: do you have a previous version already installed? What is 
the installation error message?
AdrianS
24-Jun-2013
[8644]
It's a very nondescript message - "App not installed"
DocKimbel
24-Jun-2013
[8645x3]
The only reasons I can think of for that issue are:
1) Not enough internal memory available for new apps.
2) You have a debug version of the same app already installed.
Also, you might want to check if you have allowed installation of 
apps from "unstrusted sources". You need to have that option checked 
to be able to install apps coming from outside of the PlayStore.
untrusted sources
Pekr
24-Jun-2013
[8648]
works again on my htc sensation 4.0.3
AdrianS
24-Jun-2013
[8649]
Nenad, I've installed all kinds of apps by sideloading. Even one 
from you a while back, where the app ran, but all it showed was "Hello" 
as the title of a screen with no other content. Not sure what the 
difference is with the latest one you linked.
DocKimbel
24-Jun-2013
[8650]
The difference is that the new one is supposed to work. :-) Have 
you uninstalled the previous one? (It was most probably a "debug" 
version you had while the new one is a "release" version, this is 
one of the cases where the installer would block the new app installation)
Pekr
24-Jun-2013
[8651]
on my HTC, I even don't know how to uninstall. I just download, choose 
to launch, it says previous version is going to be removed, then 
I install, run, and it is ok ...
AdrianS
24-Jun-2013
[8652x2]
I've uninstalled any earlier apps from you. Do you still have that 
earlier one around just so that I can see if that one, at least, 
will install?
Just re-downloaded it - it now doesn't work either.
Pekr
24-Jun-2013
[8654]
AdrianS: does R3/Droid work for you? Not sure it would help Doc, 
but maybe he could check on some things with Cyphre?
AdrianS
24-Jun-2013
[8655x3]
Yeah, R3Droid works
But it was installed earlier - maybe if I tried to install it now 
it would fail. I just installed some self-built apps the other day 
though, so I'm not sure what could be the problem.
Tried to build an app just now with Processing and launched it on 
the phone with no problem.
DocKimbel
24-Jun-2013
[8658x5]
AdrianS: you would need to have a look at the logcat output to diagnose 
the issue. You can do that with ADB if you know how to use it, else 
the simplest way is to use one of the logcat viewing apps, like this 
one:

https://play.google.com/store/apps/details?id=org.jtb.alogcat&hl=en
I don't have the old one. I will release the demo app source very 
soon, so you'll be able to recompile it fully and test locally.
Pekr: I doubt that Red port on Android and R3/Droid have much in 
common. Though, as there's no R3/Droid source released, I can't be 
entirely sure.
R3/Droid is most probably using a NativeActivity container, while 
Red relies on a Activity one.
Also, R3 relies on the gcc toolchain, while Red has its own unique 
one. So, there's not much to share there.
Pekr
24-Jun-2013
[8663]
Dockimbel - I thought so, my idea was, that Cyphre used some ELF 
support from Adrian too ... or who did it ...