Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: External library interface

From: cyphre:seznam:cz at: 3-Jul-2003 10:33

Hi Ladislav, Thanks for those handy functions! I think they should be a part of /View function set. Cyphre ----- Original Message ----- From: "Ladislav Mecir" <[lmecir--mbox--vol--cz]> To: <[rebol-list--rebol--com]> Sent: Thursday, July 03, 2003 10:02 AM Subject: [REBOL] Re: External library interface Hi all, for the ones who want to "play with fire", I wrote the functions described below. They work e.g. under Rebol/View 1.2.8. Usage: a: "1234" ; == "1234" adr: address? a get-mem? adr ; == #"1" get-mem? adr + 1 ; == #"2" get-mem? adr + 2 ; == #"3" get-mem? adr + 3 ; == #"4" get-mem? adr + 4 ; == #"^@" set-mem adr + 1 #"a" ; == #"a" a ; == "1a34" address?: function [ {get the address of a string} s [any-string!] ] [address] [ s: make struct! [s [string!]] reduce [s] address: make struct! [i [integer!]] none change third address third s address/i ] get-mem?: function [ {get the byte from a memory address} address [integer!] ] [m] [ address: make struct! [i [integer!]] reduce [address] m: make struct! [c [struct! [chr [char!]]]] none change third m third address m/c/chr ] set-mem: function [ {set a byte at a specific memory address} address [integer!] value [char!] ] [m] [ address: make struct! [i [integer!]] reduce [address] m: make struct! [c [struct! [chr [char!]]]] none change third m third address m/c/chr: value ] -L