safe_defaultroutine, and it's only a matter of time when it turns out to be broken without it?
@loziniak the result of the evaluation is passed at the bottom of the stack frame, not at the top: this is what
SET_RETURN macro essentially does for you. Note that
08B78C40 is the same address that
ref, the first argument being passed to routine (at the bottom of the stack frame), has.
Your earlier code worked simply because
string! slot, pushed by
string/load, was already in the right place (since
xorurl-base routine has 0 arguments and the evaluation stack was empty).
radio button doesn't toggle in GTK.
Because this fails on my system:
Red/System  #define STDIN 0 #define STDOUT 1 ; http://asm.sourceforge.net/syscall.html #define SYS-write 4 ; ssize_t sys_write(unsigned int fd, const char * buf, size_t count) #define SYS-read 3 ; ssize_t sys_read (unsigned int fd, char * buf, size_t count) #define SYS-exit 1 ; int sys_exit(int status) #define null-byte #"^@" #define rot 13 #syscall [ write: SYS-write [ fd [integer!] buffer [c-string!] count [integer!] return: [integer!] ] read: SYS-read [ fd [integer!] buffer [c-string!] count [integer!] return: [integer!] ] quit: SYS-exit [ status [integer!] ] ] c: #" " ix: 0 ; upper = 65, lower = 97, 0 otherwise s: " " ; for sys_read case?: func [c [byte!] return: [integer!]][ if all[c >= #"A" c <= #"Z"][return 65] if all[c >= #"a" c <= #"z"][return 97] return 0 ] length?: func [str [c-string!] return: [integer!] /local i [integer!]][ i: 0 while [str/1 <> null-byte][ str: str + 1 i: i + 1 ] return i ] print: func [msg [c-string!] return: [integer!]][ write STDOUT msg length? msg ] getch: func[return: [byte!] /local l][ l: read STDIN s 1 if l < 1 [return null-byte] return s/1 ] while [true] [ c: getch if c = null-byte [break] ix: case? c if ix > 0 [ c: c - ix + rot if c >= as byte! 26 [ c: c - 26 ] c: c + ix ] s/1: c print s ] quit 0
/argsare mentioned there
Compiling to native code... *** Red/System Compiler Internal Error: Script Error : Invalid path value: symbols *** Where: build *** Near: [emit-page-aligned out rejoin job/sections/symbols/2]
#includethis file https://github.com/red/red/blob/master/runtime/simple-io.reds to get file IO. Or call OS functions directly.
When manipulating blocks in routine's Red/System code, creating blocks in blocks there and creating many boxed an unboxed red-values in these, it is — so I guess —, always a certain sign of me doing sth. wrong when I get visual signs of GC kicking in with messages like
root: 6474/107152, runs: 2, mem: 3252744 => 2651976, mark: 7.9ms, sweep: 1.0ms
right? If so, it must happen somewhere in a > 4000 LOC script (2/3 Red/System, 1/3 Red code). So far I had no luck in breaking it down in a digestable minimal example to reproduce the issue. Hence just this top-levekl question. What are the most common traps I should avoid wrt to these messages? Any advice or pointers would be much appreciated.
--compiledevelopment mode. Sometimes you just have to ask to give yourself the answer ...
Given I have a value
bin of type
red-binary! cointaing UTF-16LE string bytes, how can I treat that as a red-string! in R/S?
str: as red-string! as red-value! bin set-type as red-value! str TYPE_STRING series: GET_BUFFER(str) series/flags: series/flags or flag-UTF16-cache SET_RETURN(str)
isn't sufficient, it returns
string/loadwould do even I could load from the binary node's series.