This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [Needs: View] | |
scroll-max: 100 | |
start-pos: 0 | |
view [ | |
size 200x200 | |
backdrop cyan | |
p: panel 100x100 [button "ok"] | |
do [start-pos: p/offset/y] ;-- saves initial position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
count: function [][ | |
list: [native! 0 action! 0 op! 0 function! 0 routine! 0] | |
foreach w words-of system/words [ | |
if pos: find list type?/word get/any w [pos/2: pos/2 + 1] | |
] | |
list | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
detect: function [ | |
event [word!] | |
code [any-block! none!] | |
offset [integer!] | |
value [any-type!] | |
ref [any-type!] | |
frame [pair!] | |
][ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* PROLOG: when entering a function. | |
* EPILOG: when exiting a function. | |
* ENTER: when a block is about to be evaluated. | |
* EXIT: when current evaluated block's end has been reached. | |
* OPEN: when a new function (any-function!) call is pushed on stack and a new stack frame is opened. | |
* RETURN: when a function call has returned and its stack frame has been closed. | |
* FETCH: a value is read from the input block to be evaluated. | |
* PUSH: a value has been pushed on the stack. | |
* SET: a set-word is set to a value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Title: "Red Android bridge demo" | |
Author: "Nenad Rakocevic" | |
File: %eval2.red | |
Config: [type: 'dll libRed?: no libRedRT?: yes export-ABI: 'cdecl] | |
Tabs: 4 | |
Needs: 'View | |
Rights: "Copyright (C) 2013-2017 Nenad Rakocevic. All rights reserved." | |
License: { | |
Distributed under the Boost Software License, Version 1.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
Author: "Nenad Rakocevic" | |
Date: 29/11/2013 | |
] | |
bf: function [prog [string!]][ | |
size: 30000 | |
cells: make string! size | |
append/dup cells null size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] | |
digit-nz: charset "123456789" | |
digit: append copy digit-nz #"0" | |
hex: append copy digit "abcdefABCDEF" | |
sign: charset "+-" | |
exponent-e: charset "eE" | |
dquot: #"^"" | |
exponent: [ exponent-e opt sign some digit ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] L: charset "ABCDEFGHI" D: union N: charset "123456789" charset "0" | |
repeat y 9 [repeat x 9 [col: either x = 1 [#"^(2028)"][#"A" + (x - 2)] | |
append p: [] set ref: (to word! rejoin [col y - 1]) make face! [size: 90x24 | |
type: pick [text field] header?: (y = 1) or (x = 1) | |
offset: -20x10 + as-pair ((x - 1) * size/x + 2) ((y - 1) * size/y + 1) | |
text: form case [y = 1 [col] x = 1 [y - 1] 'else [copy ""]] | |
para: make para! [align: pick [center right] header?] | |
extra: object [name: form ref formula: old: none] | |
actors: context [on-create: on-unfocus: function [f e][f/color: none | |
if rel: f/extra/old [react/unlink rel 'all] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;-- Each line is limited to 82 characters. Requires Red build from 07/07/2016 at least. | |
;-- Save it to a file to be able to run it, or type at console's prompt `do [`, paste the code, type `]` and ENTER. | |
Red [] L: charset "ABCDEFGHI" D: union N: charset "123456789" charset "0" repeat | |
y 9 [repeat x 9 [col: either x = 1 [#"^(2028)"][#"A" + (x - 2)] append p: [] set | |
ref:(to word! rejoin [col y - 1]) make face! [size: 90x24 type: pick [text field] | |
header?: (y = 1) or (x = 1) offset: -20x10 + as-pair ((x - 1) * size/x + 2) ((y | |
- 1) * size/y + 1) text: form case [y = 1 [col] x = 1 [y - 1] 'else [copy ""]] | |
para: make para! [align: pick [center right] header?] extra: object [name: form | |
ref formula: old: none] actors: context [on-create: on-unfocus: function [f e][ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [] L: charset "ABCDEFGHI" D: union N: charset "123456789" charset "0" | |
repeat y 9 [repeat x 9 [col: either x = 1 [#"^(2028)"][#"A" + (x - 2)] | |
append p: [] set ref: (to word! rejoin [col y - 1]) make face! [size: 90x24 | |
type: pick [text field] header?: (y = 1) or (x = 1) | |
offset: -20x10 + as-pair ((x - 1) * size/x + 2) ((y - 1) * size/y + 1) | |
text: form case [y = 1 [col] x = 1 [y - 1] 'else [copy ""]] | |
para: make para! [align: pick [center right] header?] | |
extra: object [name: form ref formula: old: none] | |
actors: context [on-create: on-unfocus: function [f e][f/color: none | |
if rel: f/extra/old [react/unlink rel 'all] |
NewerOlder