AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 43 |
r3wp | 567 |
total: | 610 |
results window for this page: [start: 501 end: 600]
world-name: r3wp
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
Maxim: 26-Apr-2011 | in R2, the best way is to set a word to the value you're evaluating, and conditional to that value's pass/fail, you switch the following rule to allow it to continue or track back, so it matches another rule. here is a rather verbose example. note that this can be tweaked to be a shorter rule, but it becomes hard to map out how each part of the rules relate.. here, each part is clearly layed out. rebol [] pass-rule: [none] fail-rule: [thru end] condition-rule: pass-rule parse [ word-a "ere" 835 word-b 15 word 86 bullshit #doglieru3 word-c ][ any [ [ ; this rule only matches words ending with "-?" set val word! [ [ ( val: to-string val either #"-" = pick (back back tail val) 1 [ condition-rule: pass-rule ][ condition-rule: fail-rule ] ) condition-rule (print ["PATTERN WORD:" val]) ] |[ (print ["Arbitrary word: " val]) ] ] ] | skip ] ] ask "" | |
Ladislav: 1-Nov-2011 | as follows: entities-map: make map! [] foreach entity entities-block [entities-map/:entity: true] | |
Group: !REBOL2 Releases ... Discuss 2.x releases [web-public] | ||
BrianH: 31-Dec-2009 | By the way, the backports include FUNCT, closures (faked), typesets (faked), the REFLECT and *-OF functions, APPLY, MAP-EACH, ... | |
Janko: 28-Jan-2010 | I used latest R2 to do experiment something with rebol yesterday.. I saw the map-each function but I didn't find the accumulate . Is it under some other name maybe? | |
Janko: 5-Feb-2010 | it's a little less nice looking but it would be more uniform and logical .. the way of "least surprise" because now when you write your own functions liek map-each you don't know or make it look like foreach with or make all custom functions not accept active words which makes your code more systematic and easyer to understand , but then your function is not in style with rebol's foreach forall ..etc | |
BrianH: 26-Mar-2010 | Since there are mezzanines for them already, it's not a problem (though the ASSERT mezzanine still sucks). Same with MAP-EACH. | |
Group: !REBOL3 Extensions ... REBOL 3 Extensions discussions [web-public] | ||
Pekr: 26-Aug-2009 | Geomol - Cyphre told me, that you could map parts of AGG to HW acceleration, but then it can look differently on each gfx card/driver .. | |
Maxim: 11-Sep-2009 | they are REBOL plugins. you must map the libwmp3.dll or libwmp3.lib inside of the extension... | |
Maxim: 16-Sep-2009 | tombon: the thing is that rebol has to map its datatypes to the basic and static data representations of C and other compiled languages. the R2 tried to do this within rebol, but it ended-up being useless for many libs which used types that rebol cannot translate natively... like unsigned integers or single precision floats, arrays... etc. extensions do the rebol datatype conversion in the C side, so that it can directly map ANY C code to a form that rebol functions can understand directly and vice versa... so for now we could use blocks as an interface for structs, even though R3 doesn't understand anything about structs. :-) Its MUCH faster to map in C and makes the lib completely integrated into REBOL when used. So for example, we can use tuples as colors within REBOL, and the DLL's functions will be called with a struct or an array, to map the 3 channels. | |
Maxim: 25-Sep-2009 | I also thought of a very neat way to map c methods and struct access :-) | |
Rebolek: 5-Nov-2009 | I try to keep this as short as possible. Imagine you have this file, called %test.r: ==file== REBOL[ Title: {Simple extension test} Name: ext-test Type: extension Exports: [] ] map-words: command []{ word_ids = RXI_MAP_WORDS(RXA_SERIES(frm, 1)); return RXR_TRUE; } fibc: command[ len [integer!] ]{ RXA_TYPE(frm, 1) = RXT_INTEGER; i64 o = 0; i64 l = RXA_INT64(frm, 1); i64 i; for (i = 0; i <= l; i++) o = o + i; RXA_INT64(frm, 1) = o; return RXR_VALUE; } add5: command [ a [integer!] ][ a: a + 5 return a ] ==end of file== And now imagine that in R3 console you are in the directory where you have the file %test.r . Now you type: >> compile %test.r >> import %test.dll >> fibc 10 == 55 >> add5 5 == 10 And that's all. If you want to try it, you need to have TCC (TinyC Compiler) - get it from http://download.savannah.nongnu.org/releases/tinycc/tcc-0.9.25-win32-bin.zip The script expects it instaled to %/c/tcc/ but it can be changed. Then go to r3 console and type: >> do http://box.lebeda.ws/~rebolek/rebol/srec.rip >> cd %srec/ >> do %srec.r Then you can try COMPILE etc. (see above). %test.r is included in the archive. SREC is shortcut for Simple REBOL Extension Compiler. Enjoy! (if it works ;) | |
Maxim: 9-Dec-2009 | brian, yes we can add our own devices... in fact, it seems quite easy, and I will probably be adding a DB trigger device within a week or two. :-) the thing is that there aren't any exposed or documented *native* hooks from the host into the core... so far, I've got a callback library (called wire) working which executes rebol code in global context using the Reb_Do_String() r3lib.dll exported function :-) now I just need to use that library within the extension and see how it goes... the moment I have *something* which works... I'll stop improving the hack... from there on, I'll just work on the architecture of the caller and callee, to see how we could make it simple and easy to setup, from the extension and within the application using that extension... generically. the code in between can change completely, it wouldn't actually change the extension or application code (that's the idea anyways)... just a few includes and headers which map how to link to the callback system. I'll also try to build a device, just to see how that can be used instead of callbacks... but I still need to use a callback from the extension in order to access the host... so for now my hack is essential, whatever I do. in this case, I'll be dispatching the GLUT events within the rebol using this architecture... I should have an interactive OpenGL window by tomorrow... crossing my fingers. for now I am busy rebuilding my old OpenGL project within the new cleaned-up MSVS solution I've been working on for 2 days now... there are soooo many properties, its scary and long to setup... especially in this setup where there are several interdependent projects within the solution... but now, at least, when I change stuff at any layer and build, it builds all the stuff correctly in one step... | |
Maxim: 28-Jan-2010 | anyhow. I wonder, can anyone tell me if its easy to load dll and map functions dynamically on LINUX? | |
Maxim: 31-Jan-2010 | so did anyone start on the R3 /library extension? if not I can work on that for windows, and make it so its very easy for someone else to map it to linux ( as a few stubs to re-implement ). | |
Maxim: 9-Feb-2010 | hehehe I'll do my first tests, and then I'll see If I can wrap the platform-specifc parts of the process through dyncall's source code. this way we will be able to compile the /library extension for any platform without any source code changes. my design is to use header file macros which actually map the calling conventions based on your platform... THAT I can definitely borrow from dyncall if it BSD licensed :-) | |
Carl: 17-Jul-2010 | Has some useful new ext funcs: void *(*make_block)(u32 size); void *(*make_string)(u32 size, int unicode); int (*get_string)(REBSER *series, u32 index, void **str); u32 (*map_word)(REBYTE *string); u32 *(*map_words)(REBSER *series); REBYTE *(*word_string)(u32 word); u32 (*find_word)(u32 *words, u32 word); int (*series_info)(REBSER *series, REBCNT what); int (*get_char)(REBSER *series, u32 index); u32 (*set_char)(REBSER *series, u32 index, u32 chr); int (*get_value)(REBSER *series, u32 index, RXIARG *val); int (*set_value)(REBSER *series, u32 index, RXIARG val, int type); u32 *(*words_of_object)(REBSER *obj); int (*get_field)(REBSER *obj, u32 word, RXIARG *val); int (*set_field)(REBSER *obj, u32 word, RXIARG val, int type); | |
Maxim: 20-Jul-2010 | one fun thing is that we do not have to use the C source types as the interfaces for the commands. my next test is to build a generic object to parameter map. so, if you have a C func declared as: int myFunc (int a, int b) you'll be able to call it from rebol using: obj: context [a: 1 b: 2] myFunc obj | |
jocko: 11-Aug-2010 | The external sample extension works partly (apart from several string and word functions, like t-word-map)I understand that I have to recompile, but it's not so easy to find the proper headers. Furthermore, I am not sure that the old make-ext.r script which generates the init_block is still usable. It would be useful to actualize the external sample extension. By the way, where is the page giving the main changes from a101 (changes from char * to REBSER*, t-word-map etc) ? I am not able to find it out. | |
Andreas: 11-Aug-2010 | My personal summary for the extensions API: - A100 is basically the same as the previous extensions-only API release (A77). - A101 adds map_word, word_of_string, words_of_object, get_field, set_field - A102 adds make_image and gc_protect, renames the constants used for series_info from RXI_INFO_* to RXI_SER_* and adds RXI_SER_DATA | |
ChristianE: 21-Aug-2010 | http://www.rebol.com/r3/docs/concepts/extensions-making.html#section-17 says it's out of date and I'm really having trouble including words as symbols in a result block of an extension command. It works fine with an *INIT_BLOCK defined as const char *init_block = "REBOL [\nTitle: {Power Management}\nName: power\nType: extension\nExports: [power-status]\n]\n" "lib-boot: does [map-words words] ;-- Is that a good idea?\n" "words: [ac-line battery remains of high low critical charging]\n" "map-words: command [words [block!]]\n" "power-status: command []\n" ; if after IMPORT %power.dll I call SYSTEM/MODULES/POWER/LIB-BOOT. Is there a way to have IMPORT automatically execute the LIB-BOOT code with a simple extension not included into the host code with host-kit? | |
ChristianE: 21-Aug-2010 | I'm trying to return a block containg a word not taken from a commands arguments. Say, I want to return a block like [BATTERY CHARGING]: That works with u32 *word_ids = 0; // used to hold word identifiers enum power_words {W_POWER_BATTERY = 1, W_POWER_CHARGING}; RXIEXT int RX_Call(int cmd, RXIFRM *frm, void *data) { /* .... */ v.int32a = word_ids[W_POWER_BATTERY]; RXI_SET_VALUE(s, pos++, v, RXT_WORD); v.int32a = word_ids[W_POWER_CHARGING]; RXI_SET_VALUE(s, pos++, v, RXT_WORD); /* .... */ } only after importing the DLL I "manually" init the words with a MAP-WORDS command. I was thinking that IMPORT eventually triggers LIB-BOOT init-code from the INIT_BLOCK. It seems like the init code is not executed. | |
ChristianE: 21-Aug-2010 | That MAP-WORDS command only does: word_ids = RXI_MAP_WORDS(RXA_SERIES(frm, 1)); return RXR_TRUE; | |
ChristianE: 22-Aug-2010 | Ouch! Now that problem above has a really simple solution: Just putting the module init code in the CONST CHAR *INIT_BLOCK works great: const char *init_block = "REBOL [\n" "Title: {Power Management}\n" "Name: power\n" "Type: extension\n" "Exports: [power-status capture-screen]\n" "]\n" "words: [ac-line battery remains of high low critical charging]\n" "map-words: command [words [block!]]\n" "power-status: command [{Returns ac-line and battery status information.}]\n" "capture-screen: command [{Returns screenshot as an image.}]\n" "map-words words\n"; The "magic" is the last line, where MAP_WORDS WORDS is evaluated ofter loading the module, that command inits the dll with the word ids used by the extension. | |
ChristianE: 30-Nov-2010 | Not sure If that's what you're after, but anyways ... ---- REBOL side ---- convert: command [value [number!] unit [word!]] ---- C side ---- if (unit == RL_MAP_WORD("ppi")) { // do something } elseif (unit == RL_MAP_WORD("ppcm")) { // do some other thing } Do you get the idea? >> convert 18 'ppi >> convert 20 'ppcm | |
ChristianE: 30-Nov-2010 | Would that work? Is it even proper C? typedef enum { PixelsPerInchResolution = RL_MAP_WORD("ppi"), PixelsPerCentimeterResolution = RL_MAP_WORD("ppcm"), ... } | |
Oldes: 30-Nov-2010 | if (unit == RL_MAP_WORD("PixelsPerInchResolution")) { SomeFunc(PixelsPerInchResolution); } elseif (unit == RL_MAP_WORD("PixelsPerCentimeterResolution")) { SomeFunc(PixelsPerCentimeterResolution); } else { SomeFunc(UndefinedResolution); } it just looks strange. | |
ChristianE: 30-Nov-2010 | I was about to suggest RXIEXT int SomeFunc(RXIFRM *frm) { int unit = RL_GET_VALUE(frm, 0, RXT_WORD); if (unit == RL_MAP_WORD("PixelsPerInchResolution")) { } elseif (unit == RL_MAP_WORD("PixelsPerCentimeterResolution")) { } else { } } | |
ChristianE: 30-Nov-2010 | How is the above superior to ---- REBOL ---- some-func 'pixels-per-centimeter-resolution ---- C ---- if (unit == RL_MAP_WORD("pixels-per-centimeter-resolution") { SomeFunc(unit); return RXR_TRUE; } But a dialected approach like >> some-func: func [unit [word!]] [select [pixels-per-inch-resolution 1 pixels-per-centimeter-resolution 2] unit] does look ok to me, though. At least, that way, assigning other numerical values to the "keywords" wouldn't harm. | |
Oldes: 30-Nov-2010 | the problem with the above is, that in A110: words: [pixels-per-centimeter-resolution] export testword: command ['wrd [lit-word!]] ... case testword: { int unit = RL_MAP_WORD("pixels-per-centimeter-resolution"); RL->print("int: %d\n", unit); } prints int: 1399 = something what I don't expect :) | |
Oldes: 30-Nov-2010 | with: case CMD_GRAPHICS_INIT_WORDS: //temp hack - will be removed later graphics_ext_words = RL_MAP_WORDS(RXA_SERIES(frm,1)); break; | |
ChristianE: 1-Dec-2010 | Here's how I explained to myself how things went: With A102, the time I started playing around with extensions, there was this RL_FIND_WORD which is supposed to map words against an "extension local" word block. But sadly, I never got that working. It was the "temp hack" comment from which I concluded that the preferred method then became RL_MAP_WORD, which maps a word to a global word id, hence the 1381 number you've got yesterday. With that, you don't need to ENUM in your code but can just compare words supplied with words known. But, I may be totally off track with that reasoning ... wouldn't take me any wonder :-) | |
BrianH: 26-Jan-2011 | Kaj, here's an example %rebol.r for your scenario: REBOL [] use [sys-path] [ sys-path: %/some/safe/directory/full/of/extensions/ sys/load-module/delay map-each x read sys-path [sys-path/:x] ] | |
BrianH: 26-Jan-2011 | Remember, on many Linuxes you just want to load libc, but the actual file is something like libc.so.6 or something (I'm paraphrasing here). Having LOAD-EXTENSION translate .rx is no different from that. You can even have a filename map on your platform if you like. | |
Robert: 13-Feb-2011 | Or is there a better way to map the error message back to the source file? | |
ChristianE: 20-Feb-2011 | Not in conjunction with RL_Words_Of_Object, but RL_MAP_WORD, e.g.: type = RL_GET_FIELD(database, RL_MAP_WORD("connection"), &value); ... value.addr = henv; RL_SET_FIELD(database, RL_MAP_WORD("environment"), value, RXT_HANDLE); | |
Robert: 6-Mar-2011 | For callbacks to set the callback function, your C code must have a pointer to the object where it resides (an object you made or some other system context) and the name of the function, as a word id. Those need to be set in the CBI structure: cbi->obj = obj; cbi->word = word; The word ID can be retrieved with RL_MAP_WORD. And a self created context in the same way. But how do I rerieve the ID of the global context (do we still have such a thing?)? | |
Kaj: 6-Mar-2011 | There are no context IDs and there's no need for RL_MAP_WORD. RXA_WORD handles that | |
Group: !REBOL3 GUI ... [web-public] | ||
Ashley: 25-Jan-2010 | I've spent a bit of time going over R3/View and believe it now has all the "building blocks" required to build a modern/fast gob! based GUI. The amazing thing is that these building blocks are the 10 natives that View adds [to Core]. They are: gob! caret-to-offset cursor draw effect map-event map-gob-offset offset-to-caret show size-text With these 10 natives (gob! is actually a type!) we should be able to construct simple but powerfull gob!-based GUIs with a smaller mezz footprint than R2. My preliminary conversion of RebGUI to R3 seems to take about 50% the code to do the same thing [compared to R2] ... very promising at first glance. To get a feeling for how tight the code can be the next post is the entire [skeleton] source of a working gob!-based GUI. | |
Ashley: 25-Jan-2010 | ctx-rebgui3: make object! [ cursors: make object! [ app-start: 32650 hand: 32649 help: 32651 hourglass: 32650 arrow: 32512 cross: 32515 i-shape: 32513 no: 32648 size-all: 32646 size-nesw: 32643 size-ns: 32645 size-nwse: 32642 size-we: 32644 up-arrow: 32516 wait: 32514 ] colors: make object! [ page: white edit: white text: black true: leaf false: red link: blue theme: [165.217.246 0.105.207 0.55.155] outline: [207.207.207 160.160.160 112.112.112] ] metrics: make object! [ cell: 4 gap: cell * 2 line: cell * 5 margin: cell * 4 margin-size: as-pair margin margin radius: 2 ] ; Private functions set 'make-gob make function! [[ spec [block!] ; offset, size and one or more attribute/value pairs /data object /local size text gob axis ][ size: spec/2 if any [negative? size/x negative? size/y] [ text: select spec 'text all [block? text text: first find text string!] size: 8x4 + size-text make gob! compose [size: 9999x9999 text: (text)] all [negative? spec/2/x spec/2/x: size/x] all [negative? spec/2/y spec/2/y: size/y] ] gob: copy [] ; attributes are (text, color, effect, image and draw) foreach [attribute value] spec [ switch attribute [ box [ attribute: 'draw value: compose [ pen (get value/1) line-width 1 fill-pen (get value/2) box 0x0 (spec/2 - 1x1) (metrics/radius) ] ] pill [ attribute: 'draw axis: either spec/2/x >= spec/2/y [2] [1] value: compose/deep [ pen (colors/outline/3) line-width 1 grad-pen linear (spec/2/:axis * .1) (spec/2/:axis * .9) (all [axis = 2 90]) [(colors/outline/1) (white) (colors/outline/1)] box 0x0 (spec/2 - 1x1) (metrics/radius) ] ] ] append gob reduce [attribute value] ] spec: gob gob: make gob! compose [offset: spec/1 size: spec/2 (to set-word! spec/3) spec/4 data: (make object! any [object copy []])] foreach [attribute value] skip spec 2 [ append gob make gob! compose [offset: 0x0 size: spec/2 (to set-word! attribute) value] ] gob ]] ; Public functions set 'display make function! [[ title spec /local gob xy max-x max-y left-to-right? after-count after-limit here arg append-widget widget last-widget word action handler size text color ][ xy: metrics/margin-size max-x: xy/x max-y: xy/y left-to-right?: true after-count: 1 after-limit: 9999 gob: make gob! compose [text: (title) data: (make object! [])] append-widget: make function! [[][ unless widget [exit] unless handler [ handler: compose/deep [on-down: make function! [[event][(action)]]] ] append gob switch widget [ bar [ make-gob compose [(xy) (as-pair max-x - metrics/margin 1) color (colors/outline/3)] ] button [ all [none? size size: 15x5] make-gob/data compose/deep [(xy) (size * metrics/cell) pill none text [center (text)]] handler ] text [ all [none? size size: 15x5] make-gob/data compose/only [(xy) (size * metrics/cell) color (white) text (text)] handler ] ] last-widget: last gob/pane ; 1st reverse item? unless left-to-right? [ last-widget/offset/x: last-widget/offset/x - last-widget/size/x ] xy: last-widget/offset ; max vertical size max-y: max max-y xy/y + last-widget/size/y ; horizontal pos adjustments all [ left-to-right? xy/x: xy/x + last-widget/size/x max-x: max max-x xy/x ] ; after limit reached? either after-count < after-limit [ ; spacing xy/x: xy/x + either left-to-right? [metrics/gap] [negate metrics/gap] ++ after-count ] [ xy: as-pair metrics/margin max-y + metrics/gap after-count: 1 ] all [:word set :word last-widget] word: widget: action: handler: size: text: color: none ]] parse reduce/only spec [after bar button handler return reverse rich text] [ any [ opt [here: set arg paren! (here/1: do arg) :here] [ 'return ( append-widget xy: as-pair metrics/margin max-y + metrics/gap left-to-right?: true after-limit: 9999 ) | 'reverse ( append-widget xy: as-pair max-x max-y + metrics/gap left-to-right?: false after-limit: 9999 ) | 'after set arg integer! ( ; return unless this is first widget if widget [ append-widget xy: as-pair metrics/margin max-y + metrics/gap ] after-count: 1 after-limit: arg ) | 'handler set arg block! (handler: arg) | 'rich set arg block! (text: arg) | [set arg integer! | set arg pair!] (size: arg) | set arg string! (text: arg) | [set arg tuple! | set arg none!] (color: arg) | set arg block! (action: arg) | set arg set-word! (append-widget word: :arg) | set arg word! (append-widget widget: arg) ] ] ] append-widget gob/size: metrics/margin-size + as-pair max-x max-y gob/offset: system/view/metrics/work-size - gob/size / 2 append system/view/screen-gob gob show system/view/screen-gob ]] set 'undisplay make function! [[gob][ remove find system/view/screen-gob gob show system/view/screen-gob ]] ; Start global GUI event handler active-gob: none system/view/event-port: open [scheme: 'event] system/view/event-port/awake: make function! [[event /local evt gob][ evt: map-event event gob: evt/gob while [not object? gob/data] [gob: gob/parent] if all [event/type = 'move gob <> active-gob] [ attempt [active-gob/data/on-away event] active-gob: gob attempt [active-gob/data/on-over event] ] evt: to word! ajoin ['on- event/type] attempt [gob/data/:evt event] ]] ] | |
Carl: 15-Feb-2010 | For example, the primary multitouch I miss in VID on OS X is 2-finger scroll, but it can be packaged as a scroll event, so should map. (The issues we face will also be faced by all web browsers, so we're in good company.) | |
Henrik: 23-Feb-2010 | As I see it, you would want to map any facet in face 1 to any facet in face 2. Afterwards, you can judge whether that makes sense or not. This could be by checking for accepted datatypes in the target face at attach-time, but maybe that's too simple? Also facet attachment should happen on as many faces as you need. If you want a slider to control 20 other faces with different facets as input and output, that should be possible. It's starting to look like a flow engine, so maybe we should take a look at what Maxim has done. | |
Henrik: 6-Mar-2010 | Something more to consider... dynamic: group 1 [field field field] record [table1] For when you want to set up fields where you know the order, and really want to minimize the layout code. The outer panel would be set up with an ON-EMIT actor that traverses the inner faces. We already have this in the prototype, so maybe we can map the traverse order to the table columns. | |
Pekr: 8-Sep-2010 | OK, nice. And then, in draw block, I expect variables being used, which will map particular preselected material? | |
Henrik: 21-Sep-2010 | shaders must be very simple for speed. I'm not so terribly interested in actual realism, just a way to map a linear value to a specular value, which then gets tinted with a color. | |
Pekr: 9-Nov-2010 | Maybe we need two separate things - style grouping (use gui/widgets for that), and style hierarchy - tree or other map of styles, their inheritance and dependencies (maybe this is what Rebolek now referst to as an object browser?) | |
Oldes: 24-Dec-2010 | the functions map-inner and map-outer are not used anymore? | |
Oldes: 24-Dec-2010 | Ah... map-event is the old map-inner native function | |
shadwolf: 7-Jan-2011 | I'm doing actually an API map for the R3-hostkit and this single page document is already much more instructive than any of what was done in 2010 ...!!! | |
Henrik: 14-Jan-2011 | we started to use multiple draw blocks? - they've been there for a good while now. :-) regarding naming, I think it should reflect the specific state, rather than having a "default". I usually prefer 'up, 'up-hover, 'down, etc. This is easier to map to a state machine. | |
Ladislav: 20-Jan-2011 | you should use a map when you don't like a block | |
Pekr: 27-Jan-2011 | I am still busy on my business trip, returning home tomorrow. I am thinking about producing Wiki article about what I find non optimal, or what I don't understand. So far I have gripes with 'options block, which does not map directly to facets, but is - artificial. That part has to move to declarative style definition, as it influences how you use the dialect .... | |
Pekr: 17-Feb-2011 | I think I understand the difference, but I was not easily able to see what is what, unless I studied it more deeply, and unless Ladislav told me during our meeting, that layout level 'options does not necessarily directly map to face/facets .... | |
Cyphre: 17-Feb-2011 | Pekr, you said "layout level 'options does not necessarily directly map to face/facets"...that's why I don't want to rename OPTIONS to FACETS in the layout block. Also so far you are the only one who has problem understanding the 'options in layout vs. 'options in style definition and in fact you haven't proposed any concrete solution (evenin your CC ticket). I'm not saying I'm against reasonable change here but since there is no good viable solution(and noone except you cares) we should either wait until it pops out from someones head or just let it be as it is now. | |
Henrik: 18-Feb-2011 | This is part of Carl's original design and I imagine that he made the idea of "slots" as you call it, so there is a simple way to map grouped areas of code to faces, when they are created. Note in the source, the definition of a style and a face are right next to eachother. So it becomes "how do I create a face from a model of a face, as quickly and easily as possible?" | |
Kaj: 18-Feb-2011 | ARGS and PARAMS are ugly abbreviations of technical words. If the problem is that OPTIONS do not map directly to options in the face, it seems that WITH was the better name :-) | |
Group: !REBOL3 ... [web-public] | ||
Andreas: 24-Mar-2011 | >> m: map [a: 42] >> protect m >> m/a ** Script error: protected value or series - cannot modify Known bug? Not a bug, but a feature? | |
BrianH: 21-Apr-2011 | There are some real limits to op! evaluation that makes them unsafe for general use for now. For one thing, the type of the first argument is not checked at call time relative to the typespec by the evaluator - it has to be checked by the function itself internally. This is not a problem with most existing ops because they map to actions (which have their type compatibility handled by the action dispatcher), or in some cases natives that perform their own internal type checking. I believe this was a speeed tradeoff. If you allowed full user creation of ops even with their current restriction to actions and natives, you could bypass the typespecs of natives and corrupt R3's memory. Adding in that typespec check to the op! evaluator would slow down op! evaluation a little, but would be necessary if you really wanted to make user-defined ops possible. | |
Geomol: 17-May-2011 | Is a closure a function, where the vars is in a map (or whatever data structure is used for an object/context) instead of on the stack? | |
Geomol: 21-May-2011 | Thanks, Ladislav. Good examples! The thing, I missed, was that REBOL has this extra internal data structure to hold symbols (words), I though, just the contexts was used for that. So comparing words (that are not bound to any context) are much faster than comparing strings in REBOL. I see different possibilities, depending on implementation. If a word is changed to the result from a hash calculation, then two different words might give the same result, right? It's unlikely, but it could happen. That's why map datastructures are combined with lists, when two different hash calculations give same result. The other possibility is, that words are changed to pointers pointing to their entry in the map (hash table). Do you know, what of the two, REBOL implement? In other words, could two different words be equal in REBOL? About the strings, then it's possible to do kind of the same with hashing. Lua does that. If you have two different but identical strings (same string content) in Lua, they share the same memory area. Hashing is involved, and I guess, comparing string would be equal fast as comparing words, if REBOL did the same. (unless words are exchanged with the result from the hash calculation, but then two words might be equal) | |
Gregg: 17-Jul-2011 | The original was written before MAP-EACH and the new COLLECT. Here is the source I have, updated to use those as the current version does, but with the last rule reverted to the original. Related cc reports: http://issue.cc/r3/1096 http://issue.cc/r3/690 split: func [ "Split a series into pieces; fixed or variable size, fixed number, or at delimiters" series [series!] "The series to split" dlm [block! integer! char! bitset! any-string!] "Split size, delimiter(s), or rule(s)." /into "If dlm is an integer, split into n pieces, rather than pieces of length n." /local size count mk1 mk2 ][ either all [block? dlm parse dlm [some integer!]] [ map-each len dlm [ either positive? len [ copy/part series series: skip series len ] [ series: skip series negate len ; return unset so that nothing is added to output () ] ] ][ size: dlm ; alias for readability collect [ parse/all series case [ all [integer? size into] [ if size < 1 [cause-error 'Script 'invalid-arg size] count: size - 1 size: round/down divide length? series size [ count [copy series size skip (keep/only series)] copy series to end (keep/only series) ] ] integer? dlm [ if size < 1 [cause-error 'Script 'invalid-arg size] [any [copy series 1 size skip (keep/only series)]] ] 'else [ ; = any [bitset? dlm any-string? dlm char? dlm] [any [mk1: some [mk2: dlm break | skip] (keep copy/part mk1 mk2)]] ] ] ] ] ] | |
Gregg: 17-Jul-2011 | split: func [ "Split a series into pieces; fixed or variable size, fixed number, or at delimiters" series [series!] "The series to split" dlm [block! integer! char! bitset! any-string!] "Split size, delimiter(s), or rule(s)." /into "If dlm is an integer, split into n pieces, rather than pieces of length n." /local size piece-size count mk1 mk2 res fill-val add-fill-val ][ either all [block? dlm parse dlm [some integer!]] [ map-each len dlm [ either positive? len [ copy/part series series: skip series len ] [ series: skip series len ; return unset so that nothing is added to output () ] ] ][ size: dlm ; alias for readability res: collect [ parse/all series case [ all [integer? size into] [ if size < 1 [cause-error 'Script 'invalid-arg size] count: size - 1 piece-size: to integer! round/down divide length? series size if zero? piece-size [piece-size: 1] [ count [copy series piece-size skip (keep/only series)] copy series to end (keep/only series) ] ] integer? dlm [ if size < 1 [cause-error 'Script 'invalid-arg size] [any [copy series 1 size skip (keep/only series)]] ] 'else [ ; = any [bitset? dlm any-string? dlm char? dlm] [any [mk1: some [mk2: dlm break | skip] (keep/only copy/part mk1 mk2)]] ] ] ] ;-- Special processing, to handle cases where the spec'd more items in ; /into than the series contains (so we want to append empty items), ; or where the dlm was a char/string/charset and it was the last char ; (so we want to append an empty field that the above rule misses). fill-val: does [copy either any-block? series [[]] [""]] add-fill-val: does [append/only res fill-val] case [ all [integer? size into] [ ; If the result is too short, i.e., less items than 'size, add ; empty items to fill it to 'size. ; We loop here, because insert/dup doesn't copy the value inserted. if size > length? res [ loop (size - length? res) [add-fill-val] ] ] ; integer? dlm [ ; ] 'else [ ; = any [bitset? dlm any-string? dlm char? dlm] ; If the last thing in the series is a delimiter, there is an ; implied empty field after it, which we add here. case [ bitset? dlm [ ; ATTEMPT is here because LAST will return NONE for an ; empty series, and finding none in a bitest is not allowed. if attempt [find dlm last series] [add-fill-val] ] char? dlm [ if dlm = last series [add-fill-val] ] string? dlm [ if all [ find series dlm empty? find/last/tail series dlm ] [add-fill-val] ] ] ] ] res ] ] | |
Gregg: 17-Jul-2011 | split: func [ "Split a series into pieces; fixed or variable size, fixed number, or at delimiters" series [series!] "The series to split" dlm [block! integer! char! bitset! any-string!] "Split size, delimiter(s), or rule(s)." /into "If dlm is an integer, split into n pieces, rather than pieces of length n." /local size piece-size count mk1 mk2 res fill-val add-fill-val ][ either all [block? dlm parse dlm [some integer!]] [ map-each len dlm [ either positive? len [ copy/part series series: skip series len ] [ series: skip series negate len ; return unset so that nothing is added to output () ] ] ][ size: dlm ; alias for readability res: collect [ parse/all series case [ all [integer? size into] [ if size < 1 [cause-error 'Script 'invalid-arg size] count: size - 1 piece-size: to integer! round/down divide length? series size if zero? piece-size [piece-size: 1] [ count [copy series piece-size skip (keep/only series)] copy series to end (keep/only series) ] ] integer? dlm [ if size < 1 [cause-error 'Script 'invalid-arg size] [any [copy series 1 size skip (keep/only series)]] ] 'else [ ; = any [bitset? dlm any-string? dlm char? dlm] [any [mk1: some [mk2: dlm break | skip] (keep/only copy/part mk1 mk2)]] ] ] ] ;-- Special processing, to handle cases where the spec'd more items in ; /into than the series contains (so we want to append empty items), ; or where the dlm was a char/string/charset and it was the last char ; (so we want to append an empty field that the above rule misses). fill-val: does [copy either any-block? series [[]] [""]] add-fill-val: does [append/only res fill-val] case [ all [integer? size into] [ ; If the result is too short, i.e., less items than 'size, add ; empty items to fill it to 'size. ; We loop here, because insert/dup doesn't copy the value inserted. if size > length? res [ loop (size - length? res) [add-fill-val] ] ] ; integer? dlm [ ; ] 'else [ ; = any [bitset? dlm any-string? dlm char? dlm] ; If the last thing in the series is a delimiter, there is an ; implied empty field after it, which we add here. case [ bitset? dlm [ ; ATTEMPT is here because LAST will return NONE for an ; empty series, and finding none in a bitest is not allowed. if attempt [find dlm last series] [add-fill-val] ] char? dlm [ if dlm = last series [add-fill-val] ] string? dlm [ if all [ find series dlm empty? find/last/tail series dlm ] [add-fill-val] ] ] ] ] res ] ] | |
BrianH: 10-Nov-2011 | Too bad we don't have a hierarchy of inequalities. Only two levels would be needed. Maybe a /case option to the functions that the the operators map to? Is it even possible to map an op! to a function that can take an option? | |
Group: !REBOL3 Host Kit ... [web-public] | ||
Maxim: 26-Oct-2010 | it allows you to hook up alternate graphics drawing within AGG or directly on the window which view opens. though you still have to map all that nasty OS specific windowing event stuff first. keep in mind that you might be able to do stuff like a datatype viewer right into the view engine :-) | |
ssolie: 7-Nov-2010 | Would CTRL-C map to the EVT_INTERRUPT event? I'm asking because when I do this: >> wait system/view/event-port R3 never returns and I cannot interrupt it. I'd like to fix this is possible. | |
Group: !REBOL3 Modules ... Get help with R3's module system [web-public] | ||
Carl: 1-Nov-2010 | The word "sufficient" there isn't quite true. Explicit naming is more powerful... and provides a map as well from name to filename. | |
Group: Core ... Discuss core issues [web-public] | ||
Andreas: 31-Oct-2010 | Even simpler: >> map-each item [["xxx"] ["yyy"] ["zzz"]] [first item] == ["xxx" "yyy" "zzz"] | |
GrahamC: 31-Oct-2010 | heh .. not used map-each or collect before .. are these in R2 ? | |
BrianH: 3-Dec-2010 | EXTRACT works well for that, and maybe MAP-EACH too if you do nested blocks. | |
BrianH: 3-Dec-2010 | You might look at EXTRACT or MAP-EACH then. For simple queries with no joins, SQL is overrated. | |
Andreas: 23-Feb-2011 | >> map-each a [] [1] ** Throw Error: Return or exit not in function ** Where: map-each ** Near: return any [output make block! 0] >> system/version == 2.7.8.4.2 | |
BrianH: 23-Feb-2011 | Here's a working version: map-each: func [ "Evaluates a block for each value(s) in a series and returns them as a block." [throw catch] 'word [word! block!] "Word or block of words to set each time (local)" data [block!] "The series to traverse" body [block!] "Block to evaluate each time" /into "Collect into a given series, rather than a new block" output [any-block! any-string!] "The series to output to" ; Not image! /local init len x ][ ; Shortcut return for empty data either empty? data [any [output make block! 0]] [ ; BIND/copy word and body word: either block? word [ if empty? word [throw make error! [script invalid-arg []]] copy/deep word ; /deep because word is rebound before errors checked ] [reduce [word]] word: use word reduce [word] body: bind/copy body first word ; Build init code init: none parse word [any [word! | x: set-word! ( unless init [init: make block! 4] ; Add [x: at data index] to init, and remove from word insert insert insert tail init first x [at data] index? x remove x ) :x | x: skip ( throw make error! reduce ['script 'expect-set [word! set-word!] type? first x] )]] len: length? word ; Can be zero now (for advanced code tricks) ; Create the output series if not specified unless into [output: make block! divide length? data max 1 len] ; Process the data (which is not empty at this point) until [ ; Note: output: insert/only output needed for list! output set word data do init unless unset? set/any 'x do body [output: insert/only output :x] tail? data: skip data len ] ; Return the output and clean up memory references also either into [output] [head output] ( set [word data body output init x] none ) ] ] | |
MikeL: 4-Apr-2011 | I am making a simple (I hope) worfkflow prototype and want to use REBOL objects which I can SAVE and LOAD. A workflow object! to have a node-map collection in it of simple nodes of the workflow graph. Source ->A -> B -> SINK where the workflow knows about the next node and status. Externally there is UI to support the work part ... which is URL data on a given node. Looks like it fits into Cheyenne RSP well - maybe zmq when I get a bit further along. Save a flow in process as a .txt file using SAVE/ALL filename.txt work-flow-instance. But no success with work-flow-instance: LOAD filename.txt Do I have to BIND on LOAD to re-instantiate the object? | |
MikeL: 4-Apr-2011 | probe load %/c/cheyenne/www/makework/data/wf001.txt [make object! [ id: 'wf001 name: "Add Work" node-map: [make object! [ id: 'SOURCE Description: "Add new software for Site" status: 'Complete Next-Node: 'A sub-tasks: "1. Used RFA to enter." When-completed: [] Time: 60 Notify: none status-url: func [] [ join http://localhost/makework/status.rsp?id=ID ] action-url: none mark-complete: func [] [ Status: 'Complete ] ] make object! [ .... | |
MikeL: 4-Apr-2011 | They stay as object! definitions viz obj: do load %data/wf001.txt >> probe obj make object! [ id: 'wf001 name: "Add Software" node-map: [make object! [ id: 'SOURCE Description: "Add new software for Site" | |
onetom: 20-Apr-2011 | >> map-each e [] [e] ** Throw Error: Return or exit not in function ** Where: map-each ** Near: return any [output make block! 0] is it a known bug? im new to cure code. i don't even know where to look for it. can some one help? (it works in r3) | |
Dockimbel: 20-Apr-2011 | CureCode: http://curecode.org/rebol3/view-tickets.rsp Click on "Search" filter type, type "map-each" in input field, then hit [Find]. | |
BrianH: 20-Apr-2011 | Onetom, that error has been reported already and fixed in R2/Forward, but it hasn't made it into R2 yet. Here is the revised MAP-EACH: map-each: func [ "Evaluates a block for each value(s) in a series and returns them as a block." [throw catch] 'word [word! block!] "Word or block of words to set each time (local)" data [block!] "The series to traverse" body [block!] "Block to evaluate each time" /into "Collect into a given series, rather than a new block" output [any-block! any-string!] "The series to output to" ; Not image! /local init len x ][ ; Shortcut return for empty data either empty? data [any [output make block! 0]] [ ; BIND/copy word and body word: either block? word [ if empty? word [throw make error! [script invalid-arg []]] copy/deep word ; /deep because word is rebound before errors checked ] [reduce [word]] word: use word reduce [word] body: bind/copy body first word ; Build init code init: none parse word [any [word! | x: set-word! ( unless init [init: make block! 4] ; Add [x: at data index] to init, and remove from word insert insert insert tail init first x [at data] index? x remove x ) :x | x: skip ( throw make error! reduce ['script 'expect-set [word! set-word!] type? first x] )]] len: length? word ; Can be zero now (for advanced code tricks) ; Create the output series if not specified unless into [output: make block! divide length? data max 1 len] ; Process the data (which is not empty at this point) until [ ; Note: output: insert/only output needed for list! output set word data do init unless unset? set/any 'x do body [output: insert/only output :x] tail? data: skip data len ] ; Return the output and clean up memory references also either into [output] [head output] ( set [word data body output init x] none ) ] ] | |
Geomol: 14-May-2011 | Tonight's Moment of REBOL Zen: Literal and Get Arguments in R2 see: http://www.rebol.com/docs/core23/rebolcore-9.html#section-3.2 These functions use Literal Arguments: ++ -- ? ?? cd default deflag-face first+ flag-face flag-face? for forall foreach forskip help l ls map-each remove-each repeat secure set-font set-para source This function uses Get Argument: quote It could be questioned, why functions like get set unset in catch throw checksum , which all have arguments named WORD, don't use Literal Arguments? | |
BrianH: 14-May-2011 | Breakdown by reason: - The word is pseudo-syntax for loop vars: FOR FORALL FOREACH FORSKIP MAP-EACH REMOVE-EACH REPEAT - The function is pseudo-syntax for modifying operations on literal words as variables: ++ -- DEFAULT FIRST+ - Keyword arguments that aren't generally in expressions: DEFLAG-FACE FLAG-FACE FLAG-FACE? SECURE SET-FONT SET-PARA - Interactive shell functions: CD LS ? ?? HELP SOURCE | |
Henrik: 4-Jun-2011 | Looks like SORT uses this datatype map internally: [unset! datatype! native! action! function! object! word! set-word! get-word! lit-word! refinement! none! logic! integer! decimal! money! time! date! char! pair! event! tuple! bitset! string! issue! binary! file! email! url! tag! image! block! paren! path! get-path! set-path! lit-path! hash! list!] | |
Geomol: 21-Jul-2011 | >> source to-map to-map: func [value][to hash! :value] | |
Henrik: 18-Sep-2011 | MAP-EACH under R3: >> map-each v [] [v] == [] MAP-EACH under R2: >> map-each v [] [v] ** Throw Error: Return or exit not in function ** Where: map-each | |
Henrik: 18-Sep-2011 | the incorrect behavior won't necessarily cause a crash, but of course, it's probably not likely that map-each is used that way. | |
BrianH: 19-Sep-2011 | map-each: func [ "Evaluates a block for each value(s) in a series and returns them as a block." [throw catch] 'word [word! block!] "Word or block of words to set each time (local)" data [block!] "The series to traverse" body [block!] "Block to evaluate each time" /into "Collect into a given series, rather than a new block" output [any-block! any-string!] "The series to output to" ; Not image! /local init len x ][ ; Shortcut return for empty data either empty? data [any [output make block! 0]] [ ; BIND/copy word and body word: either block? word [ if empty? word [throw make error! [script invalid-arg []]] copy/deep word ; /deep because word is rebound before errors checked ] [reduce [word]] word: use word reduce [word] body: bind/copy body first word ; Build init code init: none parse word [any [word! | x: set-word! ( unless init [init: make block! 4] ; Add [x: at data index] to init, and remove from word insert insert insert tail init first x [at data] index? x remove x ) :x | x: skip ( throw make error! reduce ['script 'expect-set [word! set-word!] type? first x] )]] len: length? word ; Can be zero now (for advanced code tricks) ; Create the output series if not specified unless into [output: make block! divide length? data max 1 len] ; Process the data (which is not empty at this point) until [ ; Note: output: insert/only output needed for list! output set word data do init unless unset? set/any 'x do body [output: insert/only output :x] tail? data: skip data len ] ; Return the output and clean up memory references also either into [output] [head output] ( set [word data body output init x] none ) ] ] | |
BrianH: 28-Oct-2011 | R2's COLLECT is pretty similar. The backports try to be as compatible with R3 as is practical in R2, though is a couple cases they are a bit ahead of their R3 versions, where there are some tickets that haven't gone through yet. In particular ENLINE/with, DELINE block!, and MAP-EACH/into come to mind. | |
Group: !REBOL3 Proposals ... For discussion of feature proposals [web-public] | ||
BrianH: 9-Nov-2010 | If you want to talk about intimidating R2 functions, look at APPLY or MAP-EACH. Neither of those would be accepted for R3. | |
BrianH: 12-Nov-2010 | I've noticed that FOREACH, FORALL and MAP-EACH are used the most. | |
Andreas: 20-Jan-2011 | It's not decimal precision which makes the FIND (and STRICT-MAP!) discussion so cumbersome. | |
BrianH: 20-Jan-2011 | Strangely enough, it's not binding or exact decimal comparison that are at issue with FIND or strict-map! either, it's case and type. Nonetheless, this would make it easier to point to the distinction between STRICT-EQUAL? and STRICT-EQUIV? when talking about those, precisely because those aren't at issue. | |
Andreas: 20-Jan-2011 | Ladislav, thanks. Seems the better option then would be to map == and !== to strict-equiv? and strict-not-equiv?. | |
Group: Red ... Red language group [web-public] | ||
Kaj: 10-Apr-2011 | I fear it is going to lead to problems if not all words are available to use in a context. Suppose there is an external source of data with named values that map naturally to a context. The ability to import that data easily will be broken if certain words are interpreted as hex values | |
Kaj: 21-Apr-2011 | Syllable maps the kernel into the first half of the address range. Programs are supposed to go into the upper half, but a Linux executable probably tries to map itself into Syllable's kernel area | |
BrianH: 6-Nov-2011 | 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. | |
Kaj: 9-Dec-2011 | I have a basic binding with OSM GPS Map working | |
Kaj: 9-Dec-2011 | #include %OSM-GPS-Map.reds gtk-view [ gtk-maximize "OSM GPS Map Browser" osm-gps-map ogm-new-osd ] | |
Kaj: 10-Dec-2011 | The presentation of the map bindings at GeoFreedomDay went well - that is, after I could coerce my Linux to display on the beamer | |
Kaj: 11-Dec-2011 | http://red.esperconsultancy.nl/screenshots/OSM-GPS-Map-browser-on-RedSystem.png | |
Kaj: 11-Dec-2011 | http://red.esperconsultancy.nl/screenshots/Champlain-map-browser-on-RedSystem.png | |
Kaj: 14-Dec-2011 | I've published the map bindings here: |
501 / 610 | 1 | 2 | 3 | 4 | 5 | [6] | 7 |