From 293dc2062c11f9f45ed8001289d24993c48a69cb Mon Sep 17 00:00:00 2001 From: Slava Pestov <slava@slava-pestovs-macbook-pro.local> Date: Thu, 4 Dec 2008 12:07:33 -0600 Subject: [PATCH 1/2] Generalize specialized-arrays.direct: it should be able to wrap a byte array --- basis/specialized-arrays/direct/functor/functor.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/specialized-arrays/direct/functor/functor.factor b/basis/specialized-arrays/direct/functor/functor.factor index 2cde26b731..14fb739947 100755 --- a/basis/specialized-arrays/direct/functor/functor.factor +++ b/basis/specialized-arrays/direct/functor/functor.factor @@ -20,7 +20,7 @@ SET-NTH [ T dup c-setter array-accessor ] WHERE TUPLE: A -{ underlying alien read-only } +{ underlying c-ptr read-only } { length fixnum read-only } ; : <A> ( alien len -- direct-array ) A boa ; inline From e7d11f3b9cb63773a4f78f800115318a75202783 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos <dharmatech@finkelstein.stackeffects.info> Date: Thu, 4 Dec 2008 13:10:19 -0600 Subject: [PATCH 2/2] Add 'extra/sto' --- extra/sto/sto.factor | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 extra/sto/sto.factor diff --git a/extra/sto/sto.factor b/extra/sto/sto.factor new file mode 100644 index 0000000000..b43c9cc359 --- /dev/null +++ b/extra/sto/sto.factor @@ -0,0 +1,20 @@ + +USING: kernel lexer parser words quotations compiler.units ; + +IN: sto + +! Use 'sto' to bind a value on the stack to a word. +! +! Example: +! +! 10 sto A + +: sto + \ 1quotation parsed + scan + current-vocab create + dup set-word + literalize parsed + \ swap parsed + [ define ] parsed + \ with-compilation-unit parsed ; parsing