rebol

REBOL 3 - How to update a layout that has already been viewed?

雨燕双飞 提交于 2020-01-04 02:46:06
问题 I'm trying to add a field to a layout after it has been viewed view/no-wait m: [field "hello"] insert tail m 'field insert tail m "hello" update-face m ** Script error: update-face does not allow block! for its face argument I want to update the whole layout, not just the field or some part of it. If I try to use view m , it opens a new window. Do I just have to un-view it and then view again? 回答1: You can use the LAYOUT function in R3-GUI as well. See the example below: view/no-wait m:

rebol parse rule with compose/deep and append function

情到浓时终转凉″ 提交于 2020-01-03 06:30:13
问题 This works great (thanks to Sunanda's suggestion How can I parse [a / b] ? syntax error in Rebol?): attribute: copy [] class: copy [] definition-rule: compose/deep [some [set class word! 'is 'defined 'by [some [copy attribute to (to-lit-word "/") thru (to-lit-word "/") ]] copy attribute to end]] parse [Customer is defined by First Name / Last Name / Email] definition-rule but I now need to add some append instructions (append output class) and it doesn't work any more: attribute: copy []

Rebol Multitasking with Async: why do I get Invalid port spec

会有一股神秘感。 提交于 2020-01-03 03:03:05
问题 I tried http://www.mail-archive.com/rebol-list@rebol.com/msg19437.html (I just changed to www.reboltutorial.com) : do http://www.rebol.it/giesse/async-protocol.r handler: func [port [port!] state [word! error!] /local tmp cmd] [ if error? :state [print mold disarm state return true] switch state [ connect [ ; do HTTP request insert port {GET /files/2009/10/word.png HTTP/1.0^M^JHost: www.reboltutorial.com^M^J^M^J} false ] read [false] write [false] close [ ; get data data: copy port close port

How do I pass a URL a cookie using Rebol 3?

ぃ、小莉子 提交于 2020-01-02 05:07:27
问题 Using R3, I need to get a localized version of a page from a website that uses cookies to handle this. In REBOL 2.x, I could do this: page: http://www.rci.com/resort-directory/resortDetails?resortCode=0450 read/custom page [header [Cookie: "USER_LOCALE=fr_FR"]] Based on the sketchy docs for R3, I should be able to do something like: result: write page [GET [Cookie: "USER_LOCALE"] {fr_FR}] Anyone have any ideas? The R2 method worked well, but since R2 doesn't handle UTF-8 needed for many

Dynamically adding words to a context in REBOL

只愿长相守 提交于 2020-01-02 03:17:08
问题 Imagine the following REBOL code: foo: context [bar: 3] I now have a context foo in which 'bar is defined. How can I dynamically inject a new word into this context? Is it possible? I've tried: set/any in foo 'baz 3 But that doesn't work because the expression in foo 'baz fails because there is no word 'baz defined in the foo context. I should add that I realize one way to do this is as follows: foo-prototype: [bar: 3] foo: context foo-prototype foo: context head append foo-prototype [baz: 3]

call curl from rebol or red doesn't work

纵饮孤独 提交于 2019-12-30 10:37:35
问题 On dos cmd this works: curl.exe -L https://dl.uxnr.de/build/curl/curl_winssl_msys2_mingw64_stc/curl-7.53.1/curl-7.53.1.zip > curl.zip On red or rebol, following suggestion Cannot read a binary file with red from http, I tried code below but it doesn't work why ? call {curl.exe -L https://dl.uxnr.de/build/curl/curl_winssl_msys2_mingw64_stc/curl-7.53.1/curl-7.53.1.zip > curl.zip} I also tried call/wait, it doesn't work either. 回答1: Rebol2: call/output {curl.exe -L https://www.example.com} data:

How to use IN with a block instead of an object?

天大地大妈咪最大 提交于 2019-12-30 10:34:41
问题 The IN function in Rebol finds out if a field is in an object: USAGE: IN object word DESCRIPTION: Returns the word or block in the object's context. IN is a native value. ARGUMENTS: object (any-object! block!) word -- (modified if series) (any-word! block! paren!) The claim is it works with objects or blocks. It works okay if I try it with an object: >> in object [foo: 10 bar: 20] 'foo == foo But if I just try it with a raw block, it gives back NONE: >> in [foo: 10 bar: 20] 'foo == none Guess

Rebo/Red parse: Is it possible to copy between two marks embedding nested div

此生再无相见时 提交于 2019-12-25 03:12:03
问题 Subsequent to Rebol/Red parse: how to copy between 2 marks let's now suppose I achieve to mark a string with some marks with a complex parse rule having nested div (whatever that rule), is there a general way to copy between mark1 and mark2, at least is there a specific way for this kind of nested div example: { <div> a ; <- mark1 <div> b </div> <div> c </div> d ; <- mark2 </div> <div> e <div> f </div> <div> g </div> h </div> } rule: [ mark1: ... mark2: copy mark1 to mark2 ] 回答1: This is no

Rebol PARSE rule to match thru first occurrence of at least 2 spaces

旧街凉风 提交于 2019-12-24 11:14:30
问题 rule: [while [not ["--"] skip] some "-"] parse "a-bc----d" [rule ??] prints ??: "d" But I need a more efficient rule (e.g. using to #"-" )... EDIT: t: copy "" append/dup t "." 10000 append t "-..---..--" rule: [while [not ["--"] skip] some "-"] print [delta-time [loop 1000 [parse t [rule] ]]] => ~ 15.4 sec on my phone rule: [any ["--" break | skip] any "-"] => ~ 8.2 sec rule: [to "--" some "-"] (@sqlab response) => ~ 0.3 sec 回答1: What prevents you to use to as e.g. rule: [to "--" some "-" x:]

Rebol/Red parse: how to copy between 2 marks

ⅰ亾dé卋堺 提交于 2019-12-24 08:57:22
问题 I want to be able to parse between 2 marks in parse rule. For a contrieved example: src: {a b c d e f} rule: [ to "b" mark1: thru "e" mark2: to mark1 copy text to mark2 ] This doesn't work, text contains "[" instead of what I'd like to get: b c d e 回答1: You're trying to implement a "DO desire" of copying using PARSE. PARSE's COPY is looking for patterns, not treating the series as positions. You can escape into DO in mid-parse via a PAREN!, it will run if the parse rule reaches that point.