World: r4wp
[#Red] Red language group
older newer | first last |
Kaj 17-Jun-2013 [8469x6] | Arnold, all sorts of constructs with pointers are valid, but the correction I gave is the correct translation of the C source |
pointer/value: value | |
stores a value in an array. There are such examples in the Red manual | |
pointer: :value | |
initialises the pointer itself. It sets the address of where the array is in memory | |
You have to initialise a pointer before you can use it | |
Arnold 17-Jun-2013 [8475] | I copied this from the documentation: http://static.red-lang.org/red-system-specs.html#section-4.8 paragraph 4.8.3 Dereferencing |
Kaj 17-Jun-2013 [8476x3] | Yes, but the C code is not dereferencing the pointer there; it's initialising the pointer |
The example in 4.8.8 is what you need | |
http://static.red-lang.org/red-system-specs.html#section-4.8.8 | |
Arnold 17-Jun-2013 [8479] | Yes, in one way or another this is a trick to check if the initialisation step already has been performed. Hopelessly overcomplicated if you ask me. |
Kaj 17-Jun-2013 [8480] | It's confusing, yes, but it's typical C code. And it's by the holy Knuth, so you can't question it ;-) |
Arnold 17-Jun-2013 [8481] | Time for the Red rebolution to improve the readability of software. I have been playing with the Mersenne Twister code, from C to Red/System. There is no unsigned integer in Red/System? |
Kaj 17-Jun-2013 [8482x2] | No, just integer! |
If you use it as unsigned, you have to check very carefully what you're doing with the highest bit | |
Arnold 17-Jun-2013 [8484] | Unsined integers is on the wish-list for Red/System v2 https://github.com/dockimbel/Red/wiki/Red-System-v2-Wish-List point 29 |
DocKimbel 17-Jun-2013 [8485x3] | You can always have an unsigned integer using a simple pointer. |
Also, "unsigned" is just a convention, the data is same as the signed version. | |
As Kaj said, you can achieve the same calculation with signed integers, you just need to be careful. | |
Maxim 17-Jun-2013 [8488x2] | one question for Red/System. can it already, ( or is it planned ) to export static libs for use within (C/C++, other?) compiler/linkers? |
this would be an nice way for users to try red and progressively replace their binary code base, one source file at a time... instead of a whole project at once. | |
Kaj 17-Jun-2013 [8490] | Yes, not yet, but it's in the roadmap. Currently, you can replace a project one shared library at a time, or one 0MQ service at a time |
DocKimbel 18-Jun-2013 [8491x3] | I have a new test pre-release version for Android, could some of you test it on different devices? http://static.red-lang.org/hello2.apk |
It should display an input field and a "Do" button, allowing you to evaluate arbitrary Red code. The result of evaluation scrolls up, below the button. | |
On Nexus4, it doesn't run. I would like to see how it reacts on other 4.x devices and also older ones. It runs fine on my HTC 2.3.5. | |
Bo 18-Jun-2013 [8494] | On my Motorola XT881 running 4.1.2, Red opens and then immediately closes again. |
DocKimbel 18-Jun-2013 [8495] | Thanks Bo. Anyone with a 4.0.x device? |
XieQ 18-Jun-2013 [8496x2] | It runs fine on my Motorola ME525+ 2.3.6, but can't use PRINT, is that OK? |
And on my ONDA Pad 4.1.1, it's opens and then immediately closes again. | |
DocKimbel 18-Jun-2013 [8498x3] | The printing is redirected to the logcat. To see it, you need a logcat viewer like eLogcat from PlayStore. |
I just remembered that I bought a few months ago a cheap Android 4.1 USB stick, I will look at the 4.x issues tomorrow. | |
When we'll have a true Red console emulation for Android, we'll be able to redirect the printing functions back to the console. | |
AdrianS 18-Jun-2013 [8501] | The .apk wouldn't install on my Galaxy Nexus with 4.2.2. |
GrahamC 18-Jun-2013 [8502] | Curious it installed on my N7 |
Pekr 18-Jun-2013 [8503x2] | runs on my htc sensation 4.0.1 |
the only strange thing - the evaluator, when I mistakenly put: 1 + t = 1 | |
DocKimbel 19-Jun-2013 [8505] | Ah, so it's HTC-friendly it seems. :-) |
Arnold 19-Jun-2013 [8506] | t=0 |
Pekr 19-Jun-2013 [8507] | I did not define 't, expected error being raised ... |
Arnold 19-Jun-2013 [8508] | so, it solved the equation! Pretty smart thing. |
DocKimbel 19-Jun-2013 [8509] | Actually, you got an error message sent to your logcat. :-) Once things will be stabilized for 4.x support, I'll redirect printing to the GUI. |
Endo 19-Jun-2013 [8510] | It works on Samsung S3 Galaxy, Android 2.3.6 |
DocKimbel 19-Jun-2013 [8511] | I've reproduced the 4.x issue on my Rikomagic USB stick. |
Arnold 19-Jun-2013 [8512] | Login on SO requires a OpenID account. Don't want to link all my info on the web. SO is over for me. |
Pekr 19-Jun-2013 [8513] | I don't have OpenID, yet I am using SO, is it really a necessity? |
Maxim 19-Jun-2013 [8514] | AFAIK you can create an account just for SO |
Arnold 19-Jun-2013 [8515x2] | I have an account on Wordpress.com lying around, even can login to Wpress, but SO says "You don't own that identity" :( |
creating a separate account | |
Arnold 20-Jun-2013 [8517] | The deobfuscating Knuth's random program project is progressing into its final stage. It turned out that with getting the results of the program the same only the first part of the puzzle got solved. To use it in real programs you use the provided ran_arr_next function. This involved some pointer aritmetic that is not 100% supported by Red/System. I finally got the function to produce the same results as the C version. The downside is it is now quite a mess with pointer indeces and other variables, so a lot of cleaning up to do and/or rework only using the index on the array approach. |
DocKimbel 20-Jun-2013 [8518] | This involved some pointer aritmetic that is not 100% supported by Red/System. What is it lacking precisely? |
older newer | first last |