From ba68a3732dbc1bdf5becc0db03e2ea2a2e54d054 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Mon, 14 Jan 2008 15:49:13 -1000
Subject: [PATCH 01/11] better support for http-get redirects

---
 extra/http/client/client.factor | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/extra/http/client/client.factor b/extra/http/client/client.factor
index f117a4fda1..7c385c0bb3 100644
--- a/extra/http/client/client.factor
+++ b/extra/http/client/client.factor
@@ -9,11 +9,14 @@ IN: http.client
     #! Extract the host name and port number from an HTTP URL.
     ":" split1 [ string>number ] [ 80 ] if* ;
 
+SYMBOL: domain
+
 : parse-url ( url -- host resource )
-    "http://" ?head [
-        "URL must begin with http://" throw
-    ] unless
-    "/" split1 [ "/" swap append ] [ "/" ] if* ;
+    dup "https://" head? [
+        "ssl not yet supported: " swap append throw
+    ] when "http://" ?head drop
+    "/" split1 [ "/" swap append ] [ "/" ] if*
+    >r dup empty? [ drop domain get ] [ dup domain set ] if r> ;
 
 : parse-response ( line -- code )
     "HTTP/" ?head [ " " split1 nip ] when
@@ -52,7 +55,9 @@ DEFER: http-get-stream
 
 : http-get ( url -- code headers string )
     #! Opens a stream for reading from an HTTP URL.
-    http-get-stream [ stdio get contents ] with-stream ;
+    [
+        http-get-stream [ stdio get contents ] with-stream
+    ] with-scope ;
 
 : download ( url file -- )
     #! Downloads the contents of a URL to a file.

From 27d56e998ddb29640072dbc0ca5391300e69b076 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Wed, 16 Jan 2008 10:18:53 -1000
Subject: [PATCH 02/11] make lots of calendar words GENERIC: clean up the codez

---
 extra/calendar/calendar.factor | 134 +++++++++++++++++++++++----------
 1 file changed, 96 insertions(+), 38 deletions(-)

diff --git a/extra/calendar/calendar.factor b/extra/calendar/calendar.factor
index c9b62ce7aa..8c1c2fb3a6 100755
--- a/extra/calendar/calendar.factor
+++ b/extra/calendar/calendar.factor
@@ -4,7 +4,8 @@
 USING: arrays hashtables io io.streams.string kernel math
 math.vectors math.functions math.parser namespaces sequences
 strings tuples system debugger combinators vocabs.loader
-calendar.backend structs alien.c-types math.vectors ;
+calendar.backend structs alien.c-types math.vectors
+math.ranges shuffle ;
 IN: calendar
 
 TUPLE: timestamp year month day hour minute second gmt-offset ;
@@ -115,14 +116,18 @@ GENERIC: +second ( timestamp x -- timestamp )
 
 : /rem ( f n -- q r )
     #! q is positive or negative, r is positive from 0 <= r < n
-    [ /f floor >bignum ] 2keep rem ;
+    [ /f floor >integer ] 2keep rem ;
 
 : float>whole-part ( float -- int float )
-    [ floor >bignum ] keep over - ;
+    [ floor >integer ] keep over - ;
 
-: leap-year? ( year -- ? )
+GENERIC: leap-year? ( obj -- ? )
+M: integer leap-year? ( year -- ? )
     dup 100 mod zero? 400 4 ? mod zero? ;
 
+M: timestamp leap-year? ( timestamp -- ? )
+    timestamp-year leap-year? ;
+
 : adjust-leap-year ( timestamp -- timestamp )
     dup >date< 29 = swap 2 = and swap leap-year? not and [
         dup >r timestamp-year 3 1 r> [ set-date ] keep
@@ -161,7 +166,7 @@ M: real +minute ( timestamp n -- timestamp )
     float>whole-part rot swap 60 * +second swap +minute ;
 
 M: number +second ( timestamp n -- timestamp )
-    over timestamp-second + 60 /rem >r >bignum r>
+    over timestamp-second + 60 /rem >r >integer r>
     pick set-timestamp-second +minute ;
 
 : +dt ( timestamp dt -- timestamp )
@@ -178,6 +183,9 @@ M: number +second ( timestamp n -- timestamp )
     <timestamp> [ 0 seconds +dt ] keep
     [ = [ "invalid timestamp" throw ] unless ] keep ;
 
+: make-date ( year month day -- timestamp )
+    0 0 0 gmt-offset make-timestamp ;
+
 : array>dt ( vec -- dt ) { dt f } swap append >tuple ;
 : +dts ( dt dt -- dt ) [ tuple-slots ] 2apply v+ array>dt ;
 
@@ -214,14 +222,14 @@ M: timestamp <=> ( ts1 ts2 -- n )
     [ [ >date< julian-day-number ] 2apply - 86400 * ] 2keep
     [ >time< >r >r 3600 * r> 60 * r> + + ] 2apply - + ;
 
-: unix-1970
+: unix-1970 ( -- timestamp )
     1970 1 1 0 0 0 0 <timestamp> ;
 
 : unix-time>timestamp ( n -- timestamp )
     >r unix-1970 r> seconds +dt ;
 
 : timestamp>unix-time ( timestamp -- n )
-    unix-1970 timestamp- >bignum ;
+    unix-1970 timestamp- >integer ;
 
 : timestamp>timeval ( timestamp -- timeval )
     timestamp>unix-time 1000 * make-timeval ;
@@ -240,14 +248,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
 : from-now ( dt -- timestamp ) now swap +dt ;
 : ago ( dt -- timestamp ) before from-now ;
 
-: days-in-year ( year -- n ) leap-year? 366 365 ? ;
 : day-counts { 0 31 28 31 30 31 30 31 31 30 31 30 31 } ;
-: days-in-month ( year month -- n )
-    swap leap-year? [
-        [ day-counts nth ] keep 2 = [ 1+ ] when
-    ] [
-        day-counts nth
-    ] if ;
 
 : zeller-congruence ( year month day -- n )
     #! Zeller Congruence
@@ -258,33 +259,79 @@ M: timestamp <=> ( ts1 ts2 -- n )
         [ 1+ 3 * 5 /i + ] keep 2 * + r>
     1+ + 7 mod ;
 
-: day-of-week ( timestamp -- n )
+GENERIC: days-in-year ( obj -- n )
+
+M: integer days-in-year ( year -- n ) leap-year? 366 365 ? ;
+M: timestamp days-in-year ( timestamp -- n ) timestamp-year days-in-year ;
+
+GENERIC: days-in-month ( obj -- n )
+
+M: array days-in-month ( obj -- n )
+    first2 dup 2 = [
+        drop leap-year? 29 28 ?
+    ] [
+        nip day-counts nth
+    ] if ;
+
+M: timestamp days-in-month ( timestamp -- n )
+    { timestamp-year timestamp-month } get-slots 2array days-in-month ;
+
+GENERIC: day-of-week ( obj -- n )
+
+M: timestamp day-of-week ( timestamp -- n )
     >date< zeller-congruence ;
 
-: day-of-year ( timestamp -- n )
-    [
-        [ timestamp-year leap-year? ] keep
-        [ >date< 3array ] keep timestamp-year 3 1 3array <=>
-        0 >= and 1 0 ?
-    ] keep
-    [ timestamp-month day-counts swap head-slice sum + ] keep
-    timestamp-day + ;
+M: array day-of-week ( array -- n )
+    first3 zeller-congruence ;
 
-: print-day ( n -- )
+GENERIC: day-of-year ( obj -- n )
+
+M: array day-of-year ( array -- n )
+    first3
+    3dup day-counts rot head-slice sum +
+    swap leap-year? [
+        -roll
+        pick 3 1 make-date >r make-date r>
+        <=> 0 >= [ 1+ ] when
+    ] [
+        3nip
+    ] if ;
+
+M: timestamp day-of-year ( timestamp -- n )
+    { timestamp-year timestamp-month timestamp-day } get-slots
+    3array day-of-year ;
+
+GENERIC: day. ( obj -- )
+
+M: integer day. ( n -- )
     number>string dup length 2 < [ bl ] when write ;
 
-: print-month ( year month -- )
+M: timestamp day. ( timestamp -- )
+    timestamp-day day. ;
+
+GENERIC: month. ( obj -- )
+
+M: array month. ( pair -- )
+    first2
     [ month-names nth write bl number>string print ] 2keep
     [ 1 zeller-congruence ] 2keep
-    days-in-month day-abbreviations2 " " join print
+    2array days-in-month day-abbreviations2 " " join print
     over "   " <repetition> concat write
     [
-        [ 1+ print-day ] keep
+        [ 1+ day. ] keep
         1+ + 7 mod zero? [ nl ] [ bl ] if
     ] with each nl ;
 
-: print-year ( year -- )
-    12 [ 1+ print-month nl ] with each ;
+M: timestamp month. ( timestamp -- )
+    { timestamp-year timestamp-month } get-slots 2array month. ;
+
+GENERIC: year. ( obj -- )
+
+M: integer year. ( n -- )
+    12 [ 1+ 2array month. nl ] with each ;
+
+M: timestamp year. ( timestamp -- )
+    timestamp-year year. ;
 
 : pad-00 number>string 2 CHAR: 0 pad-left write ;
 
@@ -298,9 +345,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
     timestamp-second >fixnum pad-00 ;
 
 : timestamp>string ( timestamp -- str )
-    [
-        (timestamp>string)
-    ] string-out ;
+    [ (timestamp>string) ] string-out ;
 
 : timestamp>http-string ( timestamp -- str )
     #! http timestamp format
@@ -319,9 +364,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
     timestamp-second >fixnum pad-00 CHAR: Z write1 ;
 
 : timestamp>rfc3339 ( timestamp -- str )
-    >gmt [
-        (timestamp>rfc3339)
-    ] string-out ;
+    >gmt [ (timestamp>rfc3339) ] string-out ;
 
 : expect read1 assert= ;
 
@@ -340,9 +383,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
     0 <timestamp> ;
 
 : rfc3339>timestamp ( str -- timestamp )
-    [
-        (rfc3339>timestamp)
-    ] string-in ;
+    [ (rfc3339>timestamp) ] string-in ;
 
 : file-time-string ( timestamp -- string )
     [
@@ -370,6 +411,23 @@ M: timestamp <=> ( ts1 ts2 -- n )
 : friday ( timestamp -- timestamp ) 5 day-this-week ;
 : saturday ( timestamp -- timestamp ) 6 day-this-week ;
 
+: beginning-of-day ( timestamp -- new-timestamp )
+    clone dup >r 0 0 0 r>
+    { set-timestamp-hour set-timestamp-minute set-timestamp-second }
+    set-slots ; inline
+
+: beginning-of-month ( timestamp -- new-timestamp )
+    beginning-of-day 1 over set-timestamp-day ;
+
+: beginning-of-week ( timestamp -- new-timestamp )
+    beginning-of-day sunday ;
+
+: beginning-of-year ( timestamp -- new-timestamp )
+    beginning-of-month 1 over set-timestamp-month ;
+
+: seconds-since-midnight ( timestamp -- x )
+    dup beginning-of-day timestamp- ;
+
 {
     { [ unix? ] [ "calendar.unix" ] }
     { [ windows? ] [ "calendar.windows" ] }

From 93187f356b5905c7a5c42427100e71e1f3601237 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Wed, 16 Jan 2008 10:19:50 -1000
Subject: [PATCH 03/11] add map-index, each-index, 2quot-with, or?, and?

---
 extra/combinators/lib/lib.factor | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/extra/combinators/lib/lib.factor b/extra/combinators/lib/lib.factor
index 9356d6c9b5..aae4c5d9ab 100755
--- a/extra/combinators/lib/lib.factor
+++ b/extra/combinators/lib/lib.factor
@@ -191,3 +191,23 @@ MACRO: construct-slots ( assoc tuple-class -- tuple )
 
 : either ( object first second -- ? )
     >r keep swap [ r> drop ] [ r> call ] ?if ; inline
+
+: 2quot-with ( obj seq quot1 quot2 -- seq quot1 quot2 )
+    >r pick >r with r> r> swapd with ;
+
+: or? ( obj quot1 quot2 -- ? )
+    >r keep r> rot [ 2nip ] [ call ] if* ; inline
+
+: and? ( obj quot1 quot2 -- ? )
+    >r keep r> rot [ call ] [ 2drop f ] if ; inline
+
+: prepare-index ( seq quot -- seq n quot )
+    >r dup length r> ; inline
+
+: each-index ( seq quot -- )
+    #! quot: ( elt index -- )
+    prepare-index 2each ; inline
+
+: map-index ( seq quot -- )
+    #! quot: ( elt index -- obj )
+    prepare-index 2map ; inline

From 40df3eefc34ee50e79791da75e026f65977311c1 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Wed, 16 Jan 2008 10:20:28 -1000
Subject: [PATCH 04/11] add >Upper, >Upper-dashes

---
 extra/strings/lib/lib.factor | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/extra/strings/lib/lib.factor b/extra/strings/lib/lib.factor
index 870e72b385..223fdb2090 100644
--- a/extra/strings/lib/lib.factor
+++ b/extra/strings/lib/lib.factor
@@ -1,8 +1,14 @@
-
-USING: math arrays sequences ;
-
+USING: math arrays sequences kernel splitting strings ;
 IN: strings.lib
 
 : char>digit ( c -- i ) 48 - ;
 
 : string>digits ( s -- seq ) [ char>digit ] { } map-as ;
+
+: >Upper ( str -- str )
+    dup empty? [
+        unclip ch>upper 1string swap append
+    ] unless ;
+
+: >Upper-dashes ( str -- str )
+    "-" split [ >Upper ] map "-" join ;

From 225ead4cedd94c0192d75f273d985a7dfb8a3abd Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Wed, 16 Jan 2008 11:25:29 -1000
Subject: [PATCH 05/11] move hashtables.lib to assocs.lib

---
 extra/assocs/lib/lib.factor     | 7 +++++--
 extra/automata/ui/ui.factor     | 4 ++--
 extra/boids/ui/ui.factor        | 4 ++--
 extra/namespaces/lib/lib.factor | 6 +++---
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/extra/assocs/lib/lib.factor b/extra/assocs/lib/lib.factor
index 0181514ab4..50da66e669 100644
--- a/extra/assocs/lib/lib.factor
+++ b/extra/assocs/lib/lib.factor
@@ -11,14 +11,17 @@ IN: assocs.lib
 
 ! set-hash with alternative stack effects
 
-: put-hash* ( table key value -- ) swap rot set-at ;
+: put-hash* ( table key value -- ) spin set-at ;
 
 : put-hash ( table key value -- table ) swap pick set-at ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : set-hash-stack ( value key seq -- )
-  dupd [ key? ] when find-last nip set-at ;
+    dupd [ key? ] with find-last nip set-at ;
 
 : at-default ( key assoc -- value/key )
     dupd at [ nip ] when* ;
+
+: at-peek ( key assoc -- value ? )
+    at* dup >r [ peek ] when r> ;
diff --git a/extra/automata/ui/ui.factor b/extra/automata/ui/ui.factor
index 5cf9ccc71f..ab424cdab6 100644
--- a/extra/automata/ui/ui.factor
+++ b/extra/automata/ui/ui.factor
@@ -14,7 +14,7 @@ USING: kernel namespaces math quotations arrays hashtables sequences threads
        ui.gadgets.packs
        ui.gadgets.grids
        ui.gadgets.theme
-       namespaces.lib hashtables.lib vars
+       namespaces.lib assocs.lib vars
        rewrite-closures automata ;
 
 IN: automata.ui
@@ -85,4 +85,4 @@ over @center grid-add
 
 : automata-window ( -- ) [ [ automata-window* ] with-scope ] with-ui ;
 
-MAIN: automata-window
\ No newline at end of file
+MAIN: automata-window
diff --git a/extra/boids/ui/ui.factor b/extra/boids/ui/ui.factor
index 235ccc3914..6d04a4d623 100644
--- a/extra/boids/ui/ui.factor
+++ b/extra/boids/ui/ui.factor
@@ -20,7 +20,7 @@ USING: kernel namespaces
        ui.gadgets.grids
        ui.gestures
        combinators.cleave
-       hashtables.lib vars rewrite-closures boids ;
+       assocs.lib vars rewrite-closures boids ;
 
 IN: boids.ui
 
@@ -163,4 +163,4 @@ VARS: population-label cohesion-label alignment-label separation-label ;
 
 : boids-window ( -- ) [ [ boids-window* ] with-scope ] with-ui ;
 
-MAIN: boids-window
\ No newline at end of file
+MAIN: boids-window
diff --git a/extra/namespaces/lib/lib.factor b/extra/namespaces/lib/lib.factor
index 79a4855c04..6e66119cb0 100644
--- a/extra/namespaces/lib/lib.factor
+++ b/extra/namespaces/lib/lib.factor
@@ -1,8 +1,8 @@
 
-! USING: kernel quotations namespaces sequences hashtables.lib ;
+! USING: kernel quotations namespaces sequences assocs.lib ;
 
 USING: kernel namespaces namespaces.private quotations sequences
-       hashtables.lib ;
+       assocs.lib ;
 
 IN: namespaces.lib
 
@@ -16,4 +16,4 @@ IN: namespaces.lib
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
-: set* ( val var -- ) namestack* set-hash-stack ;
\ No newline at end of file
+: set* ( val var -- ) namestack* set-hash-stack ;

From 36518ef3921b0d0892a3c0961427899e0fe1b55e Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Wed, 16 Jan 2008 11:26:30 -1000
Subject: [PATCH 06/11] remove hashtables.lib

---
 extra/hashtables/lib/lib.factor | 19 -------------------
 1 file changed, 19 deletions(-)
 delete mode 100755 extra/hashtables/lib/lib.factor

diff --git a/extra/hashtables/lib/lib.factor b/extra/hashtables/lib/lib.factor
deleted file mode 100755
index ee35093929..0000000000
--- a/extra/hashtables/lib/lib.factor
+++ /dev/null
@@ -1,19 +0,0 @@
-
-USING: kernel sequences assocs ;
-
-IN: hashtables.lib
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: ref-hash ( table key -- value ) swap at ;
-
-! set-hash with alternative stack effects
-
-: put-hash* ( table key value -- ) spin set-at ;
-
-: put-hash ( table key value -- table ) swap pick set-at ;
-
-! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-: set-hash-stack ( value key seq -- )
-  dupd [ key? ] with find-last nip set-at ;

From 43ee25cdf701e70b3734afc35143fc5acc2e31b3 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Thu, 17 Jan 2008 12:53:29 -1000
Subject: [PATCH 07/11] fix load errors

---
 extra/shufflers/shufflers-docs.factor    | 3 ++-
 extra/shufflers/shufflers.factor         | 2 +-
 extra/state-machine/state-machine.factor | 4 ++--
 extra/tools/deploy/shaker/shaker.factor  | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/extra/shufflers/shufflers-docs.factor b/extra/shufflers/shufflers-docs.factor
index efeb4dc8a4..ac372534ae 100644
--- a/extra/shufflers/shufflers-docs.factor
+++ b/extra/shufflers/shufflers-docs.factor
@@ -1,4 +1,5 @@
-USING: shufflers help.syntax help.markup ;
+USING: help.syntax help.markup ;
+IN: shufflers
 
 HELP: SHUFFLE:
 { $syntax "SHUFFLE: alphabet #" }
diff --git a/extra/shufflers/shufflers.factor b/extra/shufflers/shufflers.factor
index 01b5133a80..172db1def1 100644
--- a/extra/shufflers/shufflers.factor
+++ b/extra/shufflers/shufflers.factor
@@ -29,7 +29,7 @@ IN: shufflers
 : define-shuffles ( names max-out -- )
     in-shuffle over length make-shuffles [
         [ shuffle>string create-in ] keep
-        shuffle>quot dupd define-compound put-effect
+        shuffle>quot dupd define put-effect
     ] with each out-shuffle ;
 
 : SHUFFLE:
diff --git a/extra/state-machine/state-machine.factor b/extra/state-machine/state-machine.factor
index 85f4812d9a..ac0bdc81c7 100644
--- a/extra/state-machine/state-machine.factor
+++ b/extra/state-machine/state-machine.factor
@@ -7,7 +7,7 @@ IN: state-machine
     ";" parse-tokens
     [ length ] keep
     unclip add
-    [ create-in swap 1quotation define-compound ] 2each ; parsing
+    [ create-in swap 1quotation define ] 2each ; parsing
 
 TUPLE: state place data ;
 
@@ -27,7 +27,7 @@ M: missing-state error.
 
 : define-machine ( word state-class -- )
     execute make-machine
-    >r over r> define-compound
+    >r over r> define
     "state-table" set-word-prop ;
 
 : MACHINE:
diff --git a/extra/tools/deploy/shaker/shaker.factor b/extra/tools/deploy/shaker/shaker.factor
index d157571757..fcdb6ba76e 100755
--- a/extra/tools/deploy/shaker/shaker.factor
+++ b/extra/tools/deploy/shaker/shaker.factor
@@ -5,7 +5,7 @@ assocs kernel vocabs words sequences memory io system arrays
 continuations math definitions mirrors splitting parser classes
 inspector layouts vocabs.loader prettyprint.config prettyprint
 debugger io.streams.c io.streams.duplex io.files io.backend
-quotations words.private tools.deploy.config ;
+quotations words.private tools.deploy.config compliler.units ;
 IN: tools.deploy.shaker
 
 : show ( msg -- )

From b03548caad3eb1a28a59956803c2ec803c0850d5 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Thu, 17 Jan 2008 13:00:50 -1000
Subject: [PATCH 08/11] fix typo

---
 extra/tools/deploy/shaker/shaker.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extra/tools/deploy/shaker/shaker.factor b/extra/tools/deploy/shaker/shaker.factor
index fcdb6ba76e..4ab12bf352 100755
--- a/extra/tools/deploy/shaker/shaker.factor
+++ b/extra/tools/deploy/shaker/shaker.factor
@@ -5,7 +5,7 @@ assocs kernel vocabs words sequences memory io system arrays
 continuations math definitions mirrors splitting parser classes
 inspector layouts vocabs.loader prettyprint.config prettyprint
 debugger io.streams.c io.streams.duplex io.files io.backend
-quotations words.private tools.deploy.config compliler.units ;
+quotations words.private tools.deploy.config compiler.units ;
 IN: tools.deploy.shaker
 
 : show ( msg -- )

From e29d665a10b9aab987bb60d0b36ae768c29837d7 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Sat, 19 Jan 2008 10:18:35 -1000
Subject: [PATCH 09/11] fix up misc/factor.sh add bootstrap option fix usage()

---
 misc/factor.sh | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/misc/factor.sh b/misc/factor.sh
index b2cbb836e6..8dca786846 100755
--- a/misc/factor.sh
+++ b/misc/factor.sh
@@ -237,19 +237,19 @@ maybe_download_dlls() {
 	fi
 }
 
+get_config_info() {
+	check_installed_programs
+	find_build_info
+	check_libraries
+}
+
 bootstrap() {
 	./$FACTOR_BINARY -i=$BOOT_IMAGE
 }
 
-usage() {
-	echo "usage: $0 install|install-x11|update|quick-update"
-}
-
 install() {
 	check_factor_exists
-	check_installed_programs
-	find_build_info
-	check_libraries
+	get_config_info
 	git_clone
 	cd_factor
 	make_factor
@@ -259,9 +259,7 @@ install() {
 }
 
 update() {
-	check_installed_programs
-	find_build_info
-	check_libraries
+	get_config_info
 	git_pull_factorcode
 	make_clean
 	make_factor
@@ -288,11 +286,16 @@ install_libraries() {
 	sudo apt-get install libc6-dev libfreetype6-dev libx11-dev xorg-dev glutg3-dev wget git-core git-doc rlwrap
 }
 
+usage() {
+	echo "usage: $0 install|install-x11|self-update|quick-update|update|bootstrap"
+}
+
 case "$1" in
 	install) install ;;
 	install-x11) install_libraries; install ;;
 	self-update) update; make_boot_image; bootstrap;;
 	quick-update) update; refresh_image ;;
 	update) update; update_bootstrap ;;
+	bootstrap) get_config_info; bootstrap ;;
 	*) usage ;;
 esac

From 80fcbf2514a18bcead63601948c428bd4964a6f0 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Sat, 19 Jan 2008 10:18:52 -1000
Subject: [PATCH 10/11] add missing use

---
 extra/io/unix/backend/select/select.factor | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extra/io/unix/backend/select/select.factor b/extra/io/unix/backend/select/select.factor
index b132c8b9e8..3c808a278f 100644
--- a/extra/io/unix/backend/select/select.factor
+++ b/extra/io/unix/backend/select/select.factor
@@ -1,7 +1,7 @@
 ! Copyright (C) 2004, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien.syntax kernel io.nonblocking io.unix.backend
-bit-arrays sequences assocs unix math namespaces ;
+bit-arrays sequences assocs unix math namespaces structs ;
 IN: io.unix.backend.select
 
 TUPLE: unix-select-io ;

From 654574181b0c3e5fd481192cc7c10fdfd44018c4 Mon Sep 17 00:00:00 2001
From: Doug Coleman <erg@jjjj.local>
Date: Sun, 20 Jan 2008 09:52:50 -0700
Subject: [PATCH 11/11] fix up some old code

---
 extra/hexdump/hexdump.factor | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/extra/hexdump/hexdump.factor b/extra/hexdump/hexdump.factor
index 57bbbe2481..6a91cd65c5 100644
--- a/extra/hexdump/hexdump.factor
+++ b/extra/hexdump/hexdump.factor
@@ -1,4 +1,6 @@
-USING: arrays io io.streams.string kernel math math.parser namespaces prettyprint sequences splitting strings ;
+USING: arrays combinators.lib io io.streams.string
+kernel math math.parser namespaces prettyprint
+sequences splitting strings ;
 IN: hexdump
 
 <PRIVATE
@@ -6,12 +8,16 @@ IN: hexdump
 : header. ( len -- )
     "Length: " write dup unparse write ", " write >hex write "h" write nl ;
 
-: offset. ( lineno -- ) 16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
-: h-pad. ( digit -- ) >hex 2 CHAR: 0 pad-left write ;
+: offset. ( lineno -- )
+    16 * >hex 8 CHAR: 0 pad-left write "h: " write ;
+
+: h-pad. ( digit -- )
+    >hex 2 CHAR: 0 pad-left write ;
+
 : line. ( str n -- )
     offset.
     dup [ h-pad. " " write ] each
-    16 over length - "   " <array> concat write
+    16 over length - 3 * CHAR: \s <string> write
     [ dup printable? [ drop CHAR: . ] unless write1 ] each
     nl ;
 
@@ -19,9 +25,8 @@ PRIVATE>
 : hexdump ( seq -- str )
     [
         dup length header.
-        16 <sliced-groups> dup length [ line. ] 2each
+        16 <sliced-groups> [ line. ] each-index
     ] string-out ;
 
 : hexdump. ( seq -- )
     hexdump write ;
-