From 867e48199d943fda1931fa45b51de9867a5e0b91 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 7 Mar 2008 21:24:50 -0600 Subject: [PATCH] use SYMBOLS: in several places --- extra/crypto/md5/md5.factor | 11 ++------ extra/crypto/sha1/sha1.factor | 15 ++-------- extra/crypto/sha2/sha2.factor | 14 ++-------- extra/db/types/types.factor | 40 +++++---------------------- extra/ui/gestures/gestures.factor | 7 ++--- extra/ui/windows/windows.factor | 38 ++++++++++--------------- extra/xmode/marker/state/state.factor | 16 +++-------- 7 files changed, 33 insertions(+), 108 deletions(-) diff --git a/extra/crypto/md5/md5.factor b/extra/crypto/md5/md5.factor index debef26de4..224b203fba 100644 --- a/extra/crypto/md5/md5.factor +++ b/extra/crypto/md5/md5.factor @@ -3,19 +3,12 @@ USING: kernel io io.binary io.files io.streams.string math math.functions math.parser namespaces splitting strings sequences crypto.common byte-arrays locals sequences.private -io.encodings.binary ; +io.encodings.binary symbols ; IN: crypto.md5 bignum ; foldable diff --git a/extra/crypto/sha1/sha1.factor b/extra/crypto/sha1/sha1.factor index eaad6df622..e2398311b7 100644 --- a/extra/crypto/sha1/sha1.factor +++ b/extra/crypto/sha1/sha1.factor @@ -1,23 +1,12 @@ USING: arrays combinators crypto.common kernel io io.encodings.binary io.files io.streams.string math.vectors strings sequences namespaces math parser sequences vectors io.binary -hashtables ; +hashtables symbols ; IN: crypto.sha1 ! Implemented according to RFC 3174. -SYMBOL: h0 -SYMBOL: h1 -SYMBOL: h2 -SYMBOL: h3 -SYMBOL: h4 -SYMBOL: A -SYMBOL: B -SYMBOL: C -SYMBOL: D -SYMBOL: E -SYMBOL: w -SYMBOL: K +SYMBOL: h0 h1 h2 h3 h4 A B C D E w K ; : get-wth ( n -- wth ) w get nth ; inline : shift-wth ( n -- x ) get-wth 1 bitroll-32 ; inline diff --git a/extra/crypto/sha2/sha2.factor b/extra/crypto/sha2/sha2.factor index 8e7710f40f..07d38b83bb 100644 --- a/extra/crypto/sha2/sha2.factor +++ b/extra/crypto/sha2/sha2.factor @@ -1,19 +1,10 @@ USING: crypto.common kernel splitting math sequences namespaces -io.binary ; +io.binary symbols ; IN: crypto.sha2 word +SYMBOL: vars M K H S0 S1 process-M word-size block-size >word ; : a 0 ; : b 1 ; @@ -139,4 +130,3 @@ PRIVATE> : string>sha-256-string ( string -- hexstring ) string>sha-256 hex-string ; - diff --git a/extra/db/types/types.factor b/extra/db/types/types.factor index 023c72cd2d..c6d11281a1 100755 --- a/extra/db/types/types.factor +++ b/extra/db/types/types.factor @@ -4,7 +4,7 @@ USING: arrays assocs db kernel math math.parser sequences continuations sequences.deep sequences.lib words namespaces tools.walker slots slots.private classes mirrors tuples combinators calendar.format serialize -io.streams.string ; +io.streams.string symbols ; IN: db.types HOOK: modifier-table db ( -- hash ) @@ -14,11 +14,10 @@ HOOK: create-type-table db ( -- hash ) HOOK: compound-type db ( str n -- hash ) TUPLE: sql-spec class slot-name column-name type modifiers primary-key ; -! ID is the Primary key -! +native-id+ can be a columns type or a modifier -SYMBOL: +native-id+ -! +assigned-id+ can only be a modifier -SYMBOL: +assigned-id+ + +SYMBOLS: +native-id+ +assigned-id+ +autoincrement+ ++serial+ +unique+ +default+ +null+ +not-null+ ++foreign-id+ +has-many+ ; : (primary-key?) ( obj -- ? ) { +native-id+ +assigned-id+ } member? ; @@ -45,35 +44,10 @@ SYMBOL: +assigned-id+ : assigned-id? ( spec -- ? ) sql-spec-primary-key +assigned-id+ = ; -SYMBOL: +foreign-id+ - -! Same concept, SQLite has autoincrement, PostgreSQL has serial -SYMBOL: +autoincrement+ -SYMBOL: +serial+ -SYMBOL: +unique+ - -SYMBOL: +default+ -SYMBOL: +null+ -SYMBOL: +not-null+ - -SYMBOL: +has-many+ - : relation? ( spec -- ? ) [ +has-many+ = ] deep-find ; -SYMBOL: INTEGER -SYMBOL: BIG-INTEGER -SYMBOL: DOUBLE -SYMBOL: REAL -SYMBOL: BOOLEAN -SYMBOL: TEXT -SYMBOL: VARCHAR -SYMBOL: DATE -SYMBOL: TIME -SYMBOL: DATETIME -SYMBOL: TIMESTAMP -SYMBOL: BLOB -SYMBOL: FACTOR-BLOB -SYMBOL: NULL +SYMBOLS: INTEGER BIG-INTEGER DOUBLE REAL BOOLEAN TEXT VARCHAR +DATE TIME DATETIME TIMESTAMP BLOB FACTOR-BLOB NULL ; : spec>tuple ( class spec -- tuple ) [ ?first3 ] keep 3 ?tail* diff --git a/extra/ui/gestures/gestures.factor b/extra/ui/gestures/gestures.factor index 0edf82dbd1..e494afd46d 100755 --- a/extra/ui/gestures/gestures.factor +++ b/extra/ui/gestures/gestures.factor @@ -3,7 +3,7 @@ USING: arrays assocs kernel math models namespaces sequences words strings system hashtables math.parser math.vectors tuples classes ui.gadgets combinators.lib boxes -calendar alarms ; +calendar alarms symbols ; IN: ui.gestures : set-gestures ( class hash -- ) "gestures" set-word-prop ; @@ -49,10 +49,7 @@ TUPLE: select-all-action ; C: select-all-action tuple>array 1 head* >tuple ; ! Modifiers -SYMBOL: C+ -SYMBOL: A+ -SYMBOL: M+ -SYMBOL: S+ +SYMBOLS: C+ A+ M+ S+ ; TUPLE: key-down mods sym ; diff --git a/extra/ui/windows/windows.factor b/extra/ui/windows/windows.factor index 6cba5cfdf8..a1b513380c 100755 --- a/extra/ui/windows/windows.factor +++ b/extra/ui/windows/windows.factor @@ -6,7 +6,8 @@ math math.vectors namespaces prettyprint sequences strings vectors words windows.kernel32 windows.gdi32 windows.user32 windows.opengl32 windows.messages windows.types windows.nt windows threads libc combinators continuations command-line -shuffle opengl ui.render unicode.case ascii math.bitfields ; +shuffle opengl ui.render unicode.case ascii math.bitfields +locals symbols ; IN: ui.windows TUPLE: windows-ui-backend ; @@ -67,9 +68,7 @@ M: pasteboard set-clipboard-contents drop copy ; TUPLE: win hWnd hDC hRC world title ; C: win -SYMBOL: msg-obj -SYMBOL: class-name-ptr -SYMBOL: mouse-captured +SYMBOLS: msg-obj class-name-ptr mouse-captured ; : style ( -- n ) WS_OVERLAPPEDWINDOW ; inline : ex-style ( -- n ) WS_EX_APPWINDOW WS_EX_WINDOWEDGE bitor ; inline @@ -188,30 +187,21 @@ SYMBOL: mouse-captured ] if ] if ; -SYMBOL: lParam -SYMBOL: wParam -SYMBOL: uMsg -SYMBOL: hWnd - -: handle-wm-keydown ( hWnd uMsg wParam lParam -- ) - lParam set wParam set uMsg set hWnd set - wParam get exclude-key-wm-keydown? [ - wParam get keystroke>gesture - hWnd get window-focus send-gesture drop +:: handle-wm-keydown ( hWnd uMsg wParam lParam -- ) + wParam exclude-key-wm-keydown? [ + wParam keystroke>gesture + hWnd window-focus send-gesture drop ] unless ; -: handle-wm-char ( hWnd uMsg wParam lParam -- ) - lParam set wParam set uMsg set hWnd set - wParam get exclude-key-wm-char? ctrl? alt? xor or [ - wParam get 1string - hWnd get window-focus user-input +:: handle-wm-char ( hWnd uMsg wParam lParam -- ) + wParam exclude-key-wm-char? ctrl? alt? xor or [ + wParam 1string + hWnd window-focus user-input ] unless ; -: handle-wm-keyup ( hWnd uMsg wParam lParam -- ) - lParam set wParam set uMsg set hWnd set - wParam get keystroke>gesture - hWnd get window-focus send-gesture - drop ; +:: handle-wm-keyup ( hWnd uMsg wParam lParam -- ) + wParam keystroke>gesture + hWnd window-focus send-gesture drop ; : handle-wm-syscommand ( hWnd uMsg wParam lParam -- n ) dup alpha? [ 4drop 0 ] [ DefWindowProc ] if ; diff --git a/extra/xmode/marker/state/state.factor b/extra/xmode/marker/state/state.factor index e3e380798f..2cf12f301d 100755 --- a/extra/xmode/marker/state/state.factor +++ b/extra/xmode/marker/state/state.factor @@ -1,20 +1,12 @@ -USING: xmode.marker.context xmode.rules +USING: xmode.marker.context xmode.rules symbols xmode.tokens namespaces kernel sequences assocs math ; IN: xmode.marker.state ! Based on org.gjt.sp.jedit.syntax.TokenMarker -SYMBOL: line -SYMBOL: last-offset -SYMBOL: position -SYMBOL: context - -SYMBOL: whitespace-end -SYMBOL: seen-whitespace-end? - -SYMBOL: escaped? -SYMBOL: process-escape? -SYMBOL: delegate-end-escaped? +SYMBOLS: line last-offset position context + whitespace-end seen-whitespace-end? + escaped? process-escape? delegate-end-escaped? ; : current-rule ( -- rule ) context get line-context-in-rule ;