World: r4wp
[Rebol School] REBOL School
older newer | first last |
Maxim 13-Sep-2012 [969] | you can only implement the devices which are built-in, you cannot add your own. |
Kaj 13-Sep-2012 [970] | OK, but the implementations are in the host kit |
BrianH 13-Sep-2012 [971] | All of the implementations of the current devices are built into the host portion of the C code, but are not made with extensions. |
Kaj 13-Sep-2012 [972] | As far as I know, Saphirion hasn't been able to solve the threading and callback problems |
Maxim 13-Sep-2012 [973] | yes, cause they are platform dependent. The latest host-kits merged two projects... the command! interface (extensions) and the platform abstraction (host) |
BrianH 13-Sep-2012 [974] | IIRC they had some success with the pattern of using a callback to signal R3 to grab data using a synchronous call. |
Maxim 13-Sep-2012 [975] | to allow full (run-time) extensibility of R3 as it is, it needs two other apis: -a decent event registration mechanism (add new types and specs) -a device registration system (so we can link schemes and protocols to them). |
Kaj 13-Sep-2012 [976] | Hm, my Atari 8-bit already had that. I guess that's progress these days |
Maxim 13-Sep-2012 [977] | I must admit that if you can receive events in the host, you can just execute a code string within the root ( just like if one enters a command in the prompt). It worked very well for interfacing with GLUT ... I had just built a little pseudo event system which I called from within the glut callback and it was fast enough to handle all events in real-time. |
Marco 16-Sep-2012 [978] | How can I convert an integer! that is a pointer to a C struct returned by a library function to a binary! ? |
BrianH 16-Sep-2012 [979x2] | With more C code that copies the binary to a REBOL-allocated buffer. You can't deallocate a pointer in REBOL. |
I mean dereference. | |
Gregg 16-Sep-2012 [981] | Will this work? LPINT-def: [value [integer!]] none LPINT: make struct! LPINT-def none make-LPINT: does [make struct! LPINT-def none] get-dereferenced-data: func [ {Given a pointer to memory, copy the target data into a REBOL struct.} pointer [struct!] "LPINT structure" struct-def [block!] "Contains a sub-struct that is the real struct you want." /local struct data orig-pointer result ] [ struct: make struct! compose/deep/only [ ; make wrapper struct sub [struct! (struct-def)] ] none orig-pointer: third struct ; store original inner pointer change third struct third pointer ; change inner pointer to ref'd data data: copy third struct/sub ; copy data from the inner struct ;print mold data change third struct orig-pointer ; restore inner pointer result: make struct! struct-def none ; make result struct change third result data ; change data in result struct ;probe result struct: data: orig-pointer: none ;recycle result ] It's from some old code, so no guarantees. |
Marco 16-Sep-2012 [982] | @BrianH I am writing in Rebol, I am not able to write C code. @Gregg I need to pass an integer! to a function that converts it to a binary, and your function expects a struct! how do I change it? |
Gregg 16-Sep-2012 [983x2] | Put the integer value in an LPINT struct. |
That is, use make-LPINT, set the /value, and pass that. | |
Marco 16-Sep-2012 [985] | Ok, thanks. |
Gregg 16-Sep-2012 [986] | Also, get-dereferenced-data maps the buffer into another REBOL struct. If you just want the binary data, you can adapt it not to do that. |
Marco 16-Sep-2012 [987] | ok it seems to work. it becomes: integer-address: get-address "hello" ; function courtesy of Anton Rolls pointer: make-LPINT pointer/value: integer-address probe third get-dereferenced-data pointer [l1 [int] l2 [int]] |
Kaj 16-Sep-2012 [988x2] | In my 0MQ binding, I import the memory copying function from the C library: |
http://rebol.esperconsultancy.nl/REBOL-2-ZeroMQ-binding/dir?ci=tip | |
Ladislav 16-Sep-2012 [990] | You can't deallocate a pointer in REBOL. - that is false, use the http://www.fm.tul.cz/~ladislav/rebol/library-utils.r |
BrianH 16-Sep-2012 [991] | I meant defererence, but I'm sure you're right. |
MagnussonC 18-Sep-2012 [992] | I read a file, line by line and want parts of each line in certain variables. First is an integer then a space and then a 3-4 character word then a space and then the rest of the line in a string. I guess there is no way like in Perl to match those variabels at once and put the value in numbered variables. I suppose I need to parse that line with something like (thru "a" copy b to "c") once for each variable (or perhaps first char with line/1)!? |
MaxV 18-Sep-2012 [993x2] | Please put some example, you are a bit vague |
Read this http://rebol2.blogspot.it/2012/05/text-extraction-with-parse.html ;-) | |
Maxim 18-Sep-2012 [995x3] | does this help? -------------------------- a: {123 abcd bla blca bla 534 hged bla blca bla 947 ahg psogie rpgioseg seo[rgieh rpgiu} digits: charset "0123456789" letters: charset [#"A" - #"Z" #"a" - #"z"] space: charset " " data: complement charset "^/" ctx: copy [ ] parse/all a [ some [ copy id some digits space copy var 3 4 letters space copy line-data some data ; we have a match for all data, add it in our container ( append ctx copy reduce [ to-set-word rejoin [var "-" id] line-data] ) "^/" ] ] ctx: context ctx probe ctx |
obviously, this depends on the input data being pristine... if there are chances that the input isn't, then a bit more code would allow you to safely skip invalid lines. | |
I added a bit of processing to show how to use parse in order to actually do things beyond just match patterns. note that the paren is at the end, once we have all data we want to match. An error people often do is to start processing too soon. | |
MagnussonC 18-Sep-2012 [998] | Thank you both! Now I have something to work with. Didn't realize you could do parse complex like that. |
Maxim 18-Sep-2012 [999] | believe me... this is very simple parsin ;-) |
Gabriele 19-Sep-2012 [1000] | Max... "copy reduce" ? :-) |
MagnussonC 19-Sep-2012 [1001] | Haven't had time to try the above yet. It would be interesting to see more complex examples of parsing. No need to write it here, only if you can redirect me to any existing code online. The examples I have found seems simple, but maybe there are things implicated in those examples that I don't grasp ... |
Maxim 19-Sep-2012 [1002] | gab... oh yeah... copy isn't needed there.... it just evolved that way :-) |
Gregg 19-Sep-2012 [1003] | Magnusson, have you looked at the REBOL manual that explains the parse grammar? |
Ladislav 19-Sep-2012 [1004] | See also http://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Parse/Parse_expressions |
MagnussonC 20-Sep-2012 [1005] | Gregg, yes. Ladislav, I'll check that also. The example Maxim gave was more what I was looking for, I think. Haven't had time to test it yet. Thanks for the help.. |
NickD 23-Sep-2012 [1006] | There has to be something Rebol is doing beyond a simple language api to get level of security purported by Carl. What kind of pipes does it use? |
Kaj 23-Sep-2012 [1007x2] | What kind of pipes do you have in mind? |
There's nothing much special in REBOL regarding security | |
NickD 23-Sep-2012 [1009] | My misunderstanding then. I do not even know what 'pipes' are. I am posing the question on behalf of another. The question started based on the understanding from a conversation with Carl concerning the security benefits of AltMe and the once pending contract with the CIA. |
Kaj 23-Sep-2012 [1010x5] | Pipes usually refer to network connections. The encryption that is usually employed there (SSL) is missing from many REBOL versions |
Pipes can also refer to local connections between processes, but that's originally a Unix technology | |
AltME is secure for partly different reasons. We are told it employs encryption over the network, but we can't check that, because it's closed source | |
When AltME was introduces a decade ago, many communication systems were unencrypted, so it was good then. Like Lotus Notes at the time | |
It's also more secure because you run your own server, instead of handing your data to a provider. That's fundamental, as long as you keep the data safe on all AltME clients. Which is hard, because it's not encrypted on disk | |
NickD 23-Sep-2012 [1015] | Ah. Ok. Thanks so much |
MarcS 3-Oct-2012 [1016x2] | does anyone have time to sanity check / comment on the style of the following script: http://0branch.com/highlight/snippets/rfunc.r? |
(i left in a couple of examples to demonstrate usage) | |
Henrik 3-Oct-2012 [1018] | it's certainly quite clean looking. did not analyse the code yet. |
older newer | first last |