AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 50 |
r3wp | 689 |
total: | 739 |
results window for this page: [start: 101 end: 200]
world-name: r3wp
Group: RAMBO ... The REBOL bug and enhancement database [web-public] | ||
Will: 15-Sep-2005 | it would be nice if make-dir/deep worked with ftp! I use this instead: make-dir-deep: func [ f /local t u p h][ h: copy f until [exists? h: copy/part h next find/reverse back tail h "/"] t: parse find/tail f h "/" u: copy h foreach p t [if not exists? append u join p "/" [make-dir u]] ] | |
Maxim: 9-Nov-2006 | (again, just thinking out loud.. I am deep in my head resolving a get_username OS call, to get proper logon user on windows) hehe | |
Pekr: 19-Nov-2006 | were there so deep changes to kernel, that those already working things don't work? | |
Gabriele: 19-Nov-2006 | petr, the deep changes are, i guess, to make Carl's life easier. (i.e. compiler and string) | |
Group: Core ... Discuss core issues [web-public] | ||
JaimeVargas: 7-Apr-2005 | I hope this is useful for someone REBOL [] rest: func [s [series!]][skip s 1] define-object: func [ spec [block!] /local arg-spec ctx-spec object-name constructor-name predicate-name attributes spec-rule type-spec continue? w ][ arg-names: copy [] continue?: [none] ;used to stop parsing name-rule: [set w word! (insert tail arg-names w)] type-rule: [set w word! (unless datatype? attempt [get w] [continue?: [end skip]])] spec-rule: [name-rule some [name-rule opt [into [some [type-rule continue?]]]]] if any [ not parse spec spec-rule arg-names <> unique arg-names ][ make error! "invalid spec" ] object-name: to-string first arg-names constructor-name: to-word join 'make- object-name predicate-name: to-word join first arg-names '? attributes: rest arg-names arg-spec: copy [] foreach itm attributes [ insert tail arg-spec reduce [ to-word join itm '-value either block? w: select spec itm [w][[any-type!]] ] ] ctx-spec: copy [] arg-names: extract arg-spec 2 1 repeat i length? attributes [ insert tail ctx-spec reduce [to-set-word attributes/:i to-get-word arg-names/:i] ] ;create constructor function set constructor-name make function! compose [(reform ["Makes a new" uppercase object-name "object with attributes" mold attributes]) (arg-spec)] compose/only [make object! (ctx-spec)] ;body ;create predicate function set predicate-name make function! compose [(reform ["Determines if value is a" uppercase object-name "object"]) value [object!] /local types] compose/deep/only [ either (attributes) = rest first value [ foreach itm (attributes) [ unless any [ [any-type!] = types: select (arg-spec) to-word join itm '-value find types type?/word value/:itm ][return false] ] true ][ false ] ] ] | |
Henrik: 23-Jun-2005 | a find/deep would be very useful... recursive searching of blocks and objects. it could allow you to find a value in large objects and blocks quickly | |
Pekr: 23-Jun-2005 | find/deep is long requested feature, but it was said as not being as trivial, as blocks can contain self-references etc ... | |
DideC: 1-Jul-2005 | >> b: next next [1 2 3] == [3] >> head b == [1 2 3] >> head copy b == [3] >> c: [9] == [9] >> insert/only c b == [9] >> c == [[3] 9] >> d: copy/deep c == [[3] 9] >> head d/1 == [1 2 3] | |
DideC: 1-Jul-2005 | So why does 'copy/deep don't ? | |
Brett: 26-Jul-2005 | ; Q1: copy/deep will give you new strings: block: [none none none] new-block: copy/deep replace/all block 'none {} | |
Gabriele: 30-Jul-2005 | i guess you need copy/deep and poke ... copy pick ... | |
Volker: 30-Jul-2005 | if the arrays have multiple dimensions, you need copy/deep. And if there are objects inside, those objects are not copied, then you need explicit work (copying all objects in a loop using 'make) | |
Gabriele: 30-Jul-2005 | so, copy/deep, and, as volker suggests, you're likely to need to clone the objects too. | |
eFishAnt: 27-Aug-2005 | when you need a reduce/deep and there isn't one, what do you use instead? | |
eFishAnt: 27-Aug-2005 | reduce [ 'blah reduce [ to-word "desired-literal-word" reduce [to-word "deep-literal -word"]] ] ;ss this works...just talking to myself...nevermind | |
eFishAnt: 27-Aug-2005 | hmmn, reduce/deep or reduce/nested would be more elegant nonetheless. | |
Volker: 27-Aug-2005 | is compose/deep/only an option? Also a reduce/deep would be short, if you need it. | |
eFishAnt: 27-Aug-2005 | trying to reduce a set of nested blocks ... compose/deep/only would not reduce the inner blocks, but leave them as they are... | |
Volker: 27-Aug-2005 | compose/deep [ (a) [ (b) ] ] ; would work | |
eFishAnt: 27-Aug-2005 | I guess reduce/deep would not be very hard to implement...was just surprised there isn't one already...;-) | |
Volker: 27-Aug-2005 | depends if ou code some themplate, then maybe compose/deep. if its data, maybe better reduce/deep. | |
Volker: 27-Aug-2005 | sorry, compose/deep [ blah [ (to-word "desired-literal-word") ] ] | |
Volker: 27-Aug-2005 | and to be defensive, compose/deep/only. | |
Volker: 27-Aug-2005 | A first version: reduce-deep: func[blk /local][ blk: reduce blk forall blk[ if block? blk/1[ blk/1: reduce-deep blk/1 ] ] blk ] probe reduce-deep [ 1 + 2 [ 3 + 4 ] ] probe reduce-deep [ a: [1 + 2] a/1] ; limitation, does not work | |
Volker: 27-Aug-2005 | reduce-deep: func[blk /local][ forall blk[ if block? blk/1[ blk/1: reduce-deep blk/1 ] ] reduce blk ] probe reduce-deep [ 1 + 2 [ 3 + 4 ] ] probe reduce-deep [ a: [1 + 2] a/1] ; limitation, does not work [3 [7]] [[3] 3] | |
Volker: 27-Aug-2005 | this breaks then, because inner blocks are evaluated first: a: 2 probe reduce-deep [ a: 1 [a]] | |
Brett: 29-Aug-2005 | reduce-deep: func [ block [block!] /local queue result file eval-state sub-result ][ ; Initialise queue: make list! 10 result: reduce [] ; Loop until we exhaust all unfinished blocks and we exhaust current block. until [ either empty? :block [ ; If finished this block, but more to process - add our ; result to higher block result and set that block as current. if not empty? queue [ set/any 'sub-result get/any 'result set [result block] queue/1 insert/only tail result get/any 'sub-result queue: remove queue ] ][ ; Process current block item. either block? block/1 [ ; Save current level to process later, ; set this new block as current. queue: head insert/only queue reduce [result next block] result: reduce [] block: block/1 ][ ; Evaluate item. eval-state: do/next block insert/only tail result eval-state/1 block: eval-state/2 ] ] all [tail? block tail? queue] ] ; Return final result result ] | |
Chris: 13-Sep-2005 | Or doesn't deep copy. | |
Sunanda: 13-Sep-2005 | Chris was ahead of me there -- a working solution is block: copy/deep [do [a]] | |
Chris: 13-Sep-2005 | You would need to copy/deep. | |
JaimeVargas: 13-Sep-2005 | Should programmers concern about copy/deep when creating new objects from a spec? It seems strange that they do. | |
Ladislav: 13-Sep-2005 | The easiest rule is to write make object! copy/deep spec instead of make object! spec | |
JaimeVargas: 13-Sep-2005 | But is this appropriate, why not just have copy/deep by default on make object! ? | |
Chris: 13-Sep-2005 | Perhaps it could come under 'Gotchas' -- it's not a bug so much as a 'feature' of Rebol values and contexts? Just as much as 'copy does not automatically 'copy/deep... | |
Ladislav: 13-Sep-2005 | regarding the behaviour: I think, that it might be optimal to have a function like CONTEXT deep copying by default with eventual /no-copy refinement? | |
Gregg: 13-Sep-2005 | My view is that Carl made this a conscious choice, knowing that advanced users could do their own copy/deep when they need to, and it won't come up most of the time anyway. | |
Ladislav: 13-Sep-2005 | context: func [ "Defines a unique (underived) object." blk [block!] "Object variables and values." ][ make object! copy/deep blk ] | |
Ladislav: 13-Sep-2005 | a similar issue exists for USE (use copy/deep spec) , and FUNC (solved by my CLOSURE) | |
JaimeVargas: 13-Sep-2005 | closure, associative arrays, construct with deep copy, load on values that don't exist in system object, others. Some of the bugs that have been fixed are due to our need for more power, stable and predictable interpreter. | |
Ladislav: 15-Sep-2005 | BrianH: do you think, that you could give a simple example using MAKE OBJECT! that would break using the deep copying variant of CONTEXT? | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Henrik: 31-May-2007 | I find myself changing the mindset with REBOL every few years, because for a long time I was afraid of for example, using PARSE. PARSE is so central and important that it can change the way you work with REBOL, if you have stayed away from it. I had the same experience when starting to use the SDK and when starting to do networking stuff in REBOL to let scripts communicate with eachother. It's not just a new set of ideas that turn up that lets me add to existing scripts, but doing the same scripts in entirely different ways. I feel I know about 30-40% of REBOL. :-) It's so damn deep. | |
DaveC: 31-May-2007 | Yes, I can only swim so deep before I run out of air :-) I read a snippet of code related to the system object and think, Wow! I didn't even know that existed. As you say, Parse itself is such a powerful thing. What I find inspirational is to sit down in front of the console and just explore ideas. | |
Geomol: 31-May-2007 | REBOL is like a little, magic and very deep lake high up in the mountains. It doesn't look much on the surface, but you'll be surprised, again and again. It's a good exercise (maybe not for the totally newbie) to read some of the scripts, Carl has produced. They can be found e.g. in the Library. You find things like this one, that I trampled over in his color-code.r script: set [value new] load/next str load/next ... !!?? cute! :-) | |
btiffin: 4-Aug-2007 | And as you are pointing out now...the issue is goes deep enough to warrant discussion among high level REBOL programmers, although perhaps not at the 'tieing shoelaces' level. :) | |
btiffin: 4-Aug-2007 | Yeah, I explained to Robert that the group here may have to suffer through some 'Tier B' advice :) There is a knack to explaining the deeper issues that can only come with enlightenment. I have been trying to explain that the visible none is not the value none, but lack the vocabulary, based on the lack of deep understanding and experience. It will come. | |
RobertS: 5-Aug-2007 | ;; this is neat mold make object! ["test"] ;; warning: to preserve a spec block be sure to use obj: make object! copy/deep specBlk ;; copy/deep issues are rampant in Smalltalk ( if you get the impression that I think Smalltalkers neglect Rebol, yer rite ) | |
RobertS: 25-Aug-2007 | More and more I think that was is not obvious is no longer obvious once it is obvious There is an 'active' LISP tutorial that would be a good model for a 'Rebol for newbies' I would like to use the approach taken in the 2.3 "Official Guide" book to introduce unit testing in Rebol for TDD "from-the-get-go" In Smaltlalk we used to count on newbies exploring in a workspace: we reaped a culture where people thoght the point of O-O was to write subclasses and create deep hierarchies like, say, Collection. What was obvious was just wrong. Messages were the point, not classes, let alone sub-classing. Am I wrong to suggest to anyone new: "buy as used copy of "The Official Guide" " ? For Oz, which is so much like Rebol, I do not hesitate to recommend Peter Van Roy's CTM from MIT Press. Scheme has 'Little Schemer' and 'Simply Scheme' The latter would be my model for an interactive tutorial in which you LEARN. Smalltalk was supposed to be about how we model things ( how we learn how things interact ) I think it fair to say that it failed. Classes were not the point. Objects were not the point. Things went wrong early on in abandoning the Actor Model in early 70's I am hoping Rebol3 is getting it right ;-) ( Io, the language, is quite inspiring ( www.iolanguage.com ) but I still think Oz is a great intro to Rebol (they, too, lack an effective learning tool to "think in Oz " ) | |
RobertS: 13-Sep-2007 | But is any valid deep path only the forst word has to have a value associated with it. e.g. block/tag1/tag2/tag3 | |
Group: PDF-Maker ... discuss Gabriele's pdf-maker [web-public] | ||
Louis: 8-Aug-2005 | Here is my code: append top text pdf: copy [] page: compose/deep [ textbox [ font Courier 4.5 as-is (:top) ] ] append/only pdf page write/binary %deposit-slip.pdf layout-pdf pdf browse %deposit-slip.pdf | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
Graham: 10-Oct-2005 | split-text: func [ txt n /local frag result bl ][ bl: copy [] result: copy "" frag-rule: compose/deep [ copy frag (n) skip (print frag append result frag) copy frag to #" " (if not none? frag [ print frag append result frag ] append bl copy result clear result) ] parse/all txt [ some frag-rule ] bl ] | |
Ladislav: 11-Oct-2005 | compose/deep [ copy frag (n) skip (print frag append result frag) copy frag to #" " (if not none? frag [ print frag append result frag ] append bl copy result clear result) ] looks suspicious to me - don't forget that your parens are there for two different purposes. My guess is, that you don't need compose? | |
Graham: 1-Jul-2006 | Trying to do some macro expansion in text ... This is not working :( expand-macros: func [tmp [string!] macros [block!] /local white-rule rule len lexp ] [ white-rule: charset [#" " #"^/"] foreach [macro expansion] macros [ len: length? macro lexp: length? expansion rule: compose/deep copy [ [ to here: white-rule (macro) white-rule ( change/part here expansion len ?? macro) lexp skip ] to end ] parse/all tmp [some [rule]] ] tmp ] | |
Rebolek: 7-Jun-2007 | just a quick idea: FORALL is implemented as mezzanine function. It calls FORSKIP which is mezzanine also. As you can see, it's probably not the fastest method. So here's the idea. Cannnot be FORALL rewritten to make it faster and is it possible to use PARSE to do this? So I tried and came up with this simple function: parall: func [ 'word body /local data ][ data: get :word parse data compose/deep [ some [(to set-word! word) any-type! (to paren! [do bind body :word])] ] ] (parall is just a shortcut for parse version of forall). this is very simple function written in five minutes and not very well checked, it needs some additional work (eg. it does not return same value as 'forall etc). So let's do some test (using Ladislav's %timblk.r): >> n: copy [] repeat i 100 [append n i] == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... >> time-block [forall n [b: n/1 + 1]] 0.05 == 3.623046875E-4 >> time-block [parall n [b: n/1 + 1]] 0.05 == 3.814697265625E-6 >> 3.62e-4 / 3.81e-6 == 95.0131233595801 95x faster? whooo.... and what about bigger block? >> n: copy [] repeat i 10000 [append n i] == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... >> time-block [forall n [b: n/1 + 1]] 0.05 == 3.540625E-2 >> time-block [parall n [b: n/1 + 1]] 0.05 == 3.7994384765625E-6 >> 3.54e-2 / 3.8e-6 == 9315.78947368421 9000x ? omg... comments? | |
Rebolek: 8-Jun-2007 | I tried to enclose parse in loop 1 [] and it seems to handle break. I guess you'll probably prove me wrong, Brian :) parall: func [ 'word body /loc data ][ loop 1 [ data: get :word parse data compose/deep [ some [(to set-word! word) skip (to paren! [do body])] ] ] ] re: continue - this is not r3 ;) >> n: [1 2 3 4 5] parall n [if n/1 = 4 [break/return "break"] if n/1 > 4 [print "bad"]] == "break" | |
Ladislav: 28-Jun-2007 | this is possible, but my guess, that Steeve would call it ugly too: >> once-only: func [rule] [use [rule'] copy/deep [rule': :rule [rule' (rule': [end skip])]] ] >> rule: [(a': once-only a b': once-only b c': once-only c) 3 [a' | b' | c']] == [(a': once-only a b': once-only b c': once-only c) 3 [a' | b' | c']] | |
Geomol: 28-Jun-2007 | To do block parsing, I suggest: >> once-only: func [:rule] [use [rule'] copy/deep [rule': :rule [rule' (rule': [end])]]] >> rule: [(a': once-only 'a b': once-only 'b c': once-only 'c) 3 [a' | b' | c']] >> parse [c b a] rule == true | |
Geomol: 28-Jun-2007 | I see. That's also why my block parsing give false result with less input. So for block-parsing, it should be: >> once-only: func [:rule] [use [rule'] copy/deep [rule': :rule [rule' (rule': [end skip])]]] | |
Geomol: 28-Jun-2007 | >> once-only: func [rule] [use [rule'] copy/deep [rule': :rule [rule' (rule': [end skip])]]] >> rule: [(a': once-only 'a b': once-only 'b c': once-only 'c) 3 [a' | b' | c']] >> parse [a b c] rule ** Script Error: Invalid argument: a | |
btiffin: 6-Jul-2007 | How do you build parse rules? rule: copy [] word: "abc" ;; Want to compose the block to look like this ["abc" (print ["found word len" 3])] insert tail rule compose [(word) (print "found word len (length? word))] no go - obvious I've tried compose/deep [(word) (to paren! [print ["found word len" (length? word)])] but length? word doesn't get composed, it gets included in the to paren! expression compose/only/deep same thing I guess the question is what is the technique to compose something that is to include paren! expressions with data inside that needs to be composed? **With binding of course** :) | |
Chris: 7-Jul-2007 | reduce [word to paren! compose/deep [print ["Found Word of Length" (length? word)]]] | |
Chris: 7-Jul-2007 | compose [(word) (to paren! compose/deep [print ["found word len" (length? word)]])] | |
btiffin: 7-Jul-2007 | compose/deep before the to paren! block, makes so much sense...ummm, now. Now that I've seen it. :) | |
Group: MySQL ... [web-public] | ||
Dockimbel: 15-Nov-2008 | It now passes all my non-regression tests, but I've done several deep changes, so I'll consider it beta until the end of the year before declaring it the new official version. | |
Group: Dialects ... Questions about how to create dialects [web-public] | ||
btiffin: 21-Sep-2006 | I can't say I've been 'using' Rebol for long, but I've been playing for quite a while now. I discover something new every time I open up the system. It's too cool how RT has put something as wide and deep as the ocean into a cup, a cup with blinking lights no less. | |
Gabriele: 27-Feb-2009 | Brian, right, so I have to workaround all the time, write slow code with deep parse recursions, and all those funny and nice things. Or, give up and pretend REBOL was PHP. | |
Fork: 9-Jan-2010 | >> unmush/deep [rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j] == [r s fe c s [n: se [i 1 v 5 x 10 l 50 c 100 d 500 m 1000] tw c i ~ j [j: n cn] k: k + el j n [al n - j n: 0] 'j j: n] p k + j] | |
Group: Web ... Everything web development related [web-public] | ||
Anton: 26-Feb-2005 | read-thru: func [ {Read a net file from thru the disk cache. Returns binary, else none on error.} url [url! file!] /progress callback {Call func [total bytes] during transfer. Return true.} /update "Force update from source site" /expand "Auto-decompress after transfer." /check {Update only if version, checksum/secure, or date/size do not match.} info /to "Specify a file target, not cache." local-file [file! none!] /local file data purl loc-path ][ vbug ['read-thru url info] if none? file: path-thru url [return none] if local-file [file: local-file] if all [not update exists-thru?/check file info] [ if error? try [data: read/binary file] [return none] return data ] if file? url [ if error? try [data: read/binary url] [return none] return data ] loc-path: first split-path file if data: read-net/progress url :callback [ if not exists? loc-path [make-dir/deep loc-path] if all [expand find/match data "rebpress"] [ if error? try [data: decompress skip data 8] [return none] ] write/binary file data if all [check block? info info/2] [ error? try [set-modes file [modification-date: info/2]] ] ] vbug ['read-thru-ok? found? data] data ] | |
[unknown: 9]: 10-Feb-2006 | Joe you are asking a question that finds its answer in a completely different model. It reminds of the joke "What I meant to say, was, Mother, would you please pass the salt,' (look it up). The answer is to throw away the brochure (page) model of the web, and move to web 2.0, where there is a cohesive (continuous) model. The UI is complete separated from the backend, and the UI is a single entity, that is persistent during the session. Everything else is simply a pain. Most sites are horizontal (shallow) as opposed to vertical (deep). And most are still modeling on the brochure (page) as opposed to the space (like a desktop). | |
Group: !RebGUI ... A lightweight alternative to VID [web-public] | ||
Volker: 5-Jun-2005 | prebol: func [code "changes code" /local p f] [ parse code rule: [ any [ p: #include set f file! ( p: change/part p load f 2 ) :p | into rule | skip ] ] code ] ; changes code, use copy/deep if needed t1: now/precise save %test.r [The embedded stuff] p: prebol [Hello [World #include %test.r here] we are ] print[difference now/precise t1] | |
Volker: 5-Jun-2005 | prebol: func [code /local p f rule] [ if file? code [code: load code] parse code rule: [ any [ p: #include set f file! ( p: change/part p prebol load f 2 ) :p | into rule | skip ] ] code ] ; changes code, use copy/deep if needed t1: now/precise save %test.r [The embedded and #include %test2.r stuff] save %test2.r [Subembedded] p: prebol probe [Hello [World #include %test.r here] we are] print [difference now/precise t1 newline mold p] | |
Luc: 13-Jun-2005 | wind: compose/deep [ button "Ana" [do %anamonitor.r] obj: object return button "UP" [titlebar/size: titlebar/size + 10x0 show titlebar] text (join "REBOL/View : " system/version) ] display "Test du style de l'objet LadyBird" wind do-events | |
Normand: 27-Jun-2005 | do %rebgui.r display "RebGuiTest" compose/deep/only [ label "Query" t: text 40 "" return a: area 100x50 "In the beginning, " button "Insert" [ insert a/text "Title{}" ; edit-text a enter insert tail a/text "And from a barely documented VID, a need for something bare but easy to document: RebGui. And the user saw it was good." ; edit-text a enter show a ] do [at face/pane/3/text 10 insert tail face/pane/3/text "there was View 1.3. "] ] ; End Display do-events How to move the cursor to inside the brackets of Title{->Here<-}. How to enter a newline, and more generally use the function defined in rebgui-edit.r into the area? ** Script Error: edit-text has no value ** Where: action ** Near: edit-text a enter More generally, how to enter a string and move the cursor after the insertion of it. Thanks for an answer to this 'II am New' question pertaining to RebGui. | |
Ashley: 25-Aug-2005 | Graham, are you sure the disappearing text-list slider problem wasn't just the fact that all rows fit? Try the following code: b: copy [] repeat i 1000 [insert tail b i] display "Test" compose/deep [ text-list #H data [1 2 3 4 5 6 7 8 9 10] text-list #H data [(b)] ] When you maximize the window you'll see that the sliders only appear if needed. | |
Group: Rebol School ... Rebol School [web-public] | ||
Geomol: 22-Jun-2007 | To everyone: What characterize a good learning book? Do you prefer thick books with deep explanation and many examples, or do you prefer the thin book with the essentials? Look at your collection of technical book; about computer languages, OSs, databases or what you have. Which ones do you like, and which ones is no-good? | |
btiffin: 31-Jan-2008 | Sunanda; I'm starting to take a deep interest in RitC. But I have doubts. Doubts that need to be squashed. Sadly, Ontario (a fairly vast province) has standardised curriculum now. It's all schools or no schools here. I'm not a fan, the excuse was that some kids in some boards were getting sub-par educations, ignoring the fact that some boards were providing above-par educations and instead picking a middle-of-the-road bland education for all. | |
Group: rebcode ... Rebcode discussion [web-public] | ||
BrianH: 26-Oct-2005 | REBOL [] use [fixup-rule label-rule label-fixup-rule label-error-rule here] [ ; Initialize the intermediate rules label-rule: make block! 0 label-fixup-rule: make block! 0 label-error-rule: make block! 0 ; Build the fixup-rule based on the opcode-rule fixup-rule: copy/deep rebcode*/opcode-rule parse fixup-rule [ some [ here: lit-word! block! '| ( unless find ['bra 'brat 'braf] here/1 [insert here/2 [label-error-rule |]] ) | lit-word! 'word! '| ( unless 'label = here/1 [here/2: [label-error-rule | word!]] ) | lit-word! | '| | 'block! | 'series! | 'word! (here/1: [label-error-rule | word!]) | 'any-type! (here/1: [label-fixup-rule | any-type!]) | into ['integer! '| 'word! | 'word! '| 'integer!] ( insert here/1 [label-fixup-rule |] ) | block! (insert here/1 [label-error-rule |]) ] ] ; Replace the fix-bl function rebcode*/fix-bl: func [block /local labels here there label rule] bind [ labels: make block! 16 block-action: :fix-bl if debug? [print "=== Fixing binding and labels... ==="] parse block [ some [ here: subblock-rule (here/1: bind here/1 words) | 'label word! (here/1: bind here/1 words insert insert tail labels here/2 index? here) | 'offset word! integer! ( here/1: bind 'set words here/3: 3 + here/3 + index? here if (here/3 < 1) or (here/3 > 1 + length? block) [ error/with here "Offset out of bounds:" ] ) | opcode-rule (here/1: bind here/1 words) | skip (error here) ] ] either 0 < length? labels [ label-rule: make block! length? labels foreach [key val] labels [insert insert tail label-rule to-lit-word key '|] clear back tail label-rule label-fixup-rule: [there: label-rule (there/1: 2 + select labels there/1)] label-error-rule: [label-rule (error/with here "Cannot use label here:")] rule: fixup-rule ] [ rule: opcode-rule ] parse block [ some [ here: ['bra word! | 'brat word! | 'braf word!] ( if not label: select labels here/2 [error/with here "Missing label:"] here/2: label - index? here ) | rule | skip (error here) ] ] ] rebcode* ] | |
BrianH: 30-Oct-2005 | You can also reference the block of offsets through a word. Labels are not converted then - you must use numeric offsets that you count by hand (or in a compiler). Since these offsets are relative to the end of the branch statement, this block is only useful in one location. Also, when the rewrite phase comes back and they start using rewrite rules again, those hand-calculated offsets will likely be wrong. In theory, this could be used to implement a multi-state machine, but that kind of thing is deep magic that you should be doing with the parse engine anyways. It is theoretically possible to fill the block at runtime, which would technically be a computed branch, but this is so slow, awkward and unnecessary as to be ridiculous, especially for a branch block that can only be used from one location. | |
Maxim: 17-Feb-2007 | just that if you have some bugs or wandering about specifics, he has deep knowledge of it, he might even be able to give you hints on how to go around a few missing things. | |
Gregg: 20-Feb-2007 | I haven't done deep research, but mainly I view them as something like a "helper" for meditation, self-hypnosis, etc. | |
Group: Tech News ... Interesting technology [web-public] | ||
Volker: 16-May-2006 | Not deep enough toin Erlang to judge about problems, but if you can explain :) | |
Pekr: 8-Jun-2006 | maybe there is some setting for that, dunno .... Windows denerves me sometimes with so called - rought czech translation - delayed write was not successfull. Not sure how it happens, but somewhere deep in your profile there is a dir for such a feature, and if there is some file, you can see annoying messages each time Windows starts. | |
Henrik: 14-Jun-2006 | jaime, how deep can you go with it? I don't feel too inclined to dive into objC programming right now | |
[unknown: 9]: 30-Dec-2006 | I watched a program recently about crossing the street there. The trick being to begin to cross, and keep your speed exactly the same at all times. Which they demonstrated. Two women holding hands (one was a westerner) cross the very wide street with motorcycles and mopeds and tiny cars whizzing by. Scared me to simply watch it. I suspect he paused, which would be something most of us that are not used to that might do. It is a deep shame, as an absent minded professor, one of my big fears is being hit by a car. I used to walk home at about 3:00 a.m almost every night. My office and home were 3k apart. The streets were completely empty, and so I felt somewhat safe from cars. One night in deep thought I crossed the street (totally ignoring the state of the light) and was almost hit by a racing car. Often, when I would arrive at home I simply could not remember walking at all, I was so deep in thought. | |
Group: !REBOL3-OLD1 ... [web-public] | ||
Gregg: 14-Apr-2006 | The current library interface is servicable, but could be improved. For example, char arrays in C structs are a real pain to deal with, there is redundancy if you're importing a number of routines, from the same library, and extra work is required to deal with pointers to values. The biggest issue for me seems to be that I have to use COMPOSE heavily to get the results I want, or there's a lot of duplication in struct and routine defs. --- Easier Routine Declarations The only thing I've addressed in my lib interface dialect is making it easier to declare routines. I posted it to REBOl.org for discussion: http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=lib-dialect.r --- Pointers This is maybe a bit of an extreme example, but I had to do it, so it's not purely theoretical. LPINT-def: [value [integer!]] none LPINT: make struct! LPINT-def none This struct shows where a nested struct is needed. _FAX_JOB_PARAM-def: compose/deep/only [ SizeOfStruct [integer!] ; DWORD structure size, in bytes RecipientNumber [string!] ; LPCTSTR pointer to recipient's fax number RecipientName [string!] ; LPCTSTR pointer to recipient's name Tsid [string!] ; LPCTSTR pointer to transmitting station identifier SenderName [string!] ; LPCTSTR pointer to sender's name ;SenderName [struct! [value [string!]]] ; LPCTSTR pointer to sender's name SenderCompany [string!] ; LPCTSTR pointer to sender's company SenderDept [string!] ; LPCTSTR pointer to sender's department BillingCode [string!] ; LPCTSTR pointer to billing code ScheduleAction [integer!] ; DWORD job scheduling action code ;ScheduleTime [struct! (SYSTEMTIME-def)] ; SYSTEMTIME time to send fax wYear [short] wMonth [short] wDayOfWeek [short] wDay [short] wHour [short] wMinute [short] wSecond [short] wMilliseconds [short] DeliveryReportType [integer!] ; DWORD e-mail delivery report type DeliveryReportAddress [string!] ; LPCTSTR pointer to e-mail address DocumentName [string!] ; LPCTSTR pointer to document name to display CallHandle [integer!] ; HCALL reserved ;_PTR Reserved[3] [integer!] ; DWORD must be zero _PTR-0 [integer!] ; DWORD must be zero _PTR-1 [integer!] ; DWORD must be zero _PTR-2 [integer!] ; DWORD must be zero _PTR-3 [integer!] ; DWORD must be zero ] _FAX_JOB_PARAM: make struct! _FAX_JOB_PARAM-def none _FAX_JOB_PARAM/SizeOfStruct: length? third _FAX_JOB_PARAM fax-complete-job-params: make routine! compose/deep/only [ JobParams [struct! (LPINT-def)] ; ptr to job information struct CoverPageInfo [struct! (LPINT-def)] ; ptr to cover page struct return: [integer!] ] winfax.dll "FaxCompleteJobParamsA" So, the API call returns pointers to structs containing the data we want; to get it we need to dereference the pointers after the call. complete-job-params: func [ /local params-ptr cover-ptr ; API return pointers params cover ; REBOL structs with data from API ][ ; allocate return pointer structs for API call params-ptr: make-LPINT cover-ptr: make-LPINT ; make the API call reduce either 0 <> fax-complete-job-params params-ptr cover-ptr [ ; get data from pointers returned by the API params: get-dereferenced-data params-ptr _FAX_JOB_PARAM-def cover: get-dereferenced-data cover-ptr _FAX_COVERPAGE_INFO-def ... Getting the de-ref'd data is the real pain, and seems like it might be unsafe in the way I did it, though it worked. get-dereferenced-data: func [ {Given a pointer to memory, copy the target data into a REBOL struct.} pointer [struct!] "LPINT structure whose /value is the data pointer" struct-def [block!] "The struct you want returned with data" /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 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 struct: data: orig-pointer: none result ] --- char arrays in structs, or as routine parameters You can't just declare a fixed size block or string to do this, you have to (AFAIK), have individual elements for each item. That's a huge pain if you have a 128 element array, so I end up generating them dynamically. I think that was Cyphre's idea originally, but I don't have notes on it. make-elements: func [name count type /local result][ if not word? type [type: type?/word type] result: copy "^/" repeat i count [ append result join name [i " [" type "]" newline] ] to block! result ] GUID: make struct! GUID-def: compose [ Data1 [integer!] ; unsigned long Data2 [short] ; unsigned short Data3 [short] ; unsigned short (make-elements 'Data4 8 #"@") ; unsigned char ] none --- MAKE-ing structs How do other people make structs from prototypes? make-struct: func [prototype /copy /with data] [ make struct! prototype either copy [second prototype] [either with [reduce [data]][none]] ] --- BSTR type I've only needed it for one project, but it might be worth finding out if it would be worth adding BSTR support for Windows, as a routine datatype. | |
Anton: 15-Apr-2006 | I think with Swig you still need to be prepared to dive in pretty deep and swim around tying things together for a while. | |
Gabriele: 26-Apr-2006 | Maxim: no, it does not solve the copy problem; however, closures need to copy deep the function body at each call; so, it somewhat solves the copy problem as a side effect (only for blocks and parens though, probably, as there's no need to copy anything else). (however, i would not rely on it, since for example it would be a useful optimization not to copy empty blocks or blocks that contain no words etc) | |
Maxim: 26-Apr-2006 | well I didn't say "solve" ;-) but by what I understand of closures (and I have been reading a lot lately) if 'closure does a deep copy without empty series optimisation, then we could rely on it. actually, NOT copying empty series would make closures bugged, since all generated closures would referrence the same empty block from the context of the closure's definition. which is in direct contradiction to the concept no? | |
Graham: 1-May-2006 | Does the build dialect help with that situation where you have paraens inside an action block of the vid dialect, and you are using compose/deep on the whole layout? | |
Group: Postscript ... Emitting Postscript from REBOL [web-public] | ||
Henrik: 23-Feb-2008 | I think it's easier to debug it in ghostscript. The printers I've tried this on will not print stack information. Perhaps only if I dive really deep into the capabilities of the printer, which I have no time for. | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
Chris: 23-Apr-2007 | I haven't delved deep enough to understand if this'd be better written as a Cheyenne handler, though that would require forking the cgi script, which for the time being, also has to run under Apache. | |
Dockimbel: 6-Jun-2007 | Remember that I've done some deep changes in this version, so test it carefully before putting it online. | |
Group: DevCon2007 ... DevCon 2007 [web-public] | ||
Pekr: 10-May-2007 | what was the mention of deep copying of function? | |
Maxim: 10-May-2007 | R3 now deep copies by default... but its at mezz so you can revert if you need. | |
Pekr: 10-May-2007 | What does it deep copies? Function arguments? | |
Gabriele: 10-May-2007 | make function! spec copy/deep body | |
btiffin: 10-May-2007 | Doc; Cheyenne is proving itself pretty worthy so far here at peoplecards.ca Thanks. Not delved too deep, but runs nice and smooth. | |
[unknown: 9]: 11-May-2007 | Henrik, most of the beaches are only 1-2 meers deep. | |
btiffin: 11-May-2007 | It's a deep tool. | |
[unknown: 10]: 11-May-2007 | I like to see more of the sheets from Ron... goes pritty deep..nice... | |
Group: Games ... talk about using REBOL for games [web-public] | ||
Janko: 22-Jan-2010 | I plan to do something in my free time in a 3d engine .. I need that it works in a browser so unity seems the most obvious choice, adobe director is expensive and probably outdated, stonetrip / shiva seems even more IDE/GUI heavy than unity giving me even less controll (although I am not 100% sure bcause I haven't digged really deep in any of those.) Then there is Java (which has Ardor3d which is very early in the making , and jme which is somewhat "out") but starting with it would be at a lot more low level than unity and similar game engines, with no real docs and tools as far as I can see. |
101 / 739 | 1 | [2] | 3 | 4 | 5 | 6 | 7 | 8 |