From 0f2d8b218bbbd1ae9552b06e274dba3186f0509c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 21 Feb 2005 01:38:24 +0000 Subject: [PATCH] memory word cleanups, sdl numlock fix --- TODO.FACTOR.txt | 2 -- library/sdl/sdl-keysym.factor | 5 +++-- library/tools/memory.factor | 12 +++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 3bf4259ac6..b6659bb1fb 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -14,13 +14,11 @@ - code gc - #jump-f #jump-f-label - extract word inside M:, C:, and structure browsing for these -- references primitive - fix completion invoke in middle of word - don't hardcode so many colors - ffi unicode strings: null char security hole - utf16 string boxing - more accurate types for various words -- optimize out >array, >tuple, >hashtable etc - write read: write should flush + compiler/ffi: diff --git a/library/sdl/sdl-keysym.factor b/library/sdl/sdl-keysym.factor index d66063fd48..7233ed2656 100644 --- a/library/sdl/sdl-keysym.factor +++ b/library/sdl/sdl-keysym.factor @@ -42,8 +42,9 @@ SYMBOL: modifiers [[ "ALT" HEX: 0200 ]] [[ "META" HEX: 0400 ]] [[ "META" HEX: 0800 ]] - [[ "NUM" HEX: 1000 ]] - [[ "CAPS" HEX: 2000 ]] +! We ignore these two modifiers since they're mighty useless +! [[ "NUM" HEX: 1000 ]] +! [[ "CAPS" HEX: 2000 ]] [[ "MODE" HEX: 4000 ]] ] modifiers set diff --git a/library/tools/memory.factor b/library/tools/memory.factor index f4cb1205c8..f7f5143f6c 100644 --- a/library/tools/memory.factor +++ b/library/tools/memory.factor @@ -36,12 +36,12 @@ namespaces prettyprint stdio unparser vectors words ; end-scan rethrow ] catch ; inline -: instances ( class -- list ) - #! Return a list of all instances of a built-in or tuple - #! class in the image. +: instances ( quot -- list ) + #! Return a list of all object that return true when the + #! quotation is applied to them. [ [ - dup class pick = [ , ] [ drop ] ifte + [ swap call ] 2keep rot [ , ] [ drop ] ifte ] each-object drop ] make-list ; @@ -70,9 +70,7 @@ M: object (each-slot) ( quot obj -- ) : references ( obj -- list ) #! Return a list of all objects that refer to a given object #! in the image. - [ ] [ - pick over refers? [ swons ] [ drop ] ifte - ] each-object nip ; + [ dupd refers? ] instances nip ; : vector+ ( n index vector -- ) [ vector-nth + ] 2keep set-vector-nth ;