From cf39fd29f8a39c71033bd39887f2f31f1f390cbe Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sat, 13 Dec 2008 04:41:33 -0600 Subject: [PATCH] Fix Windows bootstrap --- basis/io/backend/windows/nt/nt.factor | 8 ++++---- basis/io/directories/directories.factor | 1 + basis/io/directories/windows/windows.factor | 12 ++++++++++++ basis/io/files/info/windows/nt/nt.factor | 9 --------- basis/io/files/info/windows/windows.factor | 20 +++++++++++++++++--- basis/io/files/windows/nt/nt.factor | 4 ++-- basis/io/files/windows/windows.factor | 20 +++++++------------- basis/io/launcher/launcher.factor | 3 +-- basis/io/launcher/windows/nt/nt.factor | 2 +- basis/io/launcher/windows/windows.factor | 2 +- basis/io/monitors/windows/nt/nt.factor | 3 ++- basis/tools/deploy/windows/windows.factor | 2 +- basis/tools/disassembler/gdb/gdb.factor | 8 ++++---- 13 files changed, 53 insertions(+), 41 deletions(-) mode change 100644 => 100755 basis/io/backend/windows/nt/nt.factor mode change 100644 => 100755 basis/io/directories/directories.factor mode change 100644 => 100755 basis/io/directories/windows/windows.factor mode change 100644 => 100755 basis/io/files/info/windows/nt/nt.factor mode change 100644 => 100755 basis/io/files/info/windows/windows.factor mode change 100644 => 100755 basis/io/launcher/launcher.factor mode change 100644 => 100755 basis/io/launcher/windows/nt/nt.factor mode change 100644 => 100755 basis/io/launcher/windows/windows.factor mode change 100644 => 100755 basis/tools/disassembler/gdb/gdb.factor diff --git a/basis/io/backend/windows/nt/nt.factor b/basis/io/backend/windows/nt/nt.factor old mode 100644 new mode 100755 index d6c74ed098..e41293b6de --- a/basis/io/backend/windows/nt/nt.factor +++ b/basis/io/backend/windows/nt/nt.factor @@ -1,9 +1,9 @@ USING: alien alien.c-types arrays assocs combinators continuations destructors io io.backend io.ports io.timeouts -io.backend.windows io.files.windows io.files io.buffers io.streams.c -libc kernel math namespaces sequences threads windows -windows.errors windows.kernel32 strings splitting qualified -ascii system accessors locals ; +io.backend.windows io.files.windows io.files.windows.nt io.files +io.pathnames io.buffers io.streams.c libc kernel math namespaces +sequences threads windows windows.errors windows.kernel32 +strings splitting qualified ascii system accessors locals ; QUALIFIED: windows.winsock IN: io.backend.windows.nt diff --git a/basis/io/directories/directories.factor b/basis/io/directories/directories.factor old mode 100644 new mode 100755 index 0b8fa13791..2630be8ce2 --- a/basis/io/directories/directories.factor +++ b/basis/io/directories/directories.factor @@ -83,4 +83,5 @@ M: object copy-file { { [ os unix? ] [ "io.directories.unix" require ] } + { [ os windows? ] [ "io.directories.windows" require ] } } cond \ No newline at end of file diff --git a/basis/io/directories/windows/windows.factor b/basis/io/directories/windows/windows.factor old mode 100644 new mode 100755 index 6520602b7e..c2955d3977 --- a/basis/io/directories/windows/windows.factor +++ b/basis/io/directories/windows/windows.factor @@ -1,7 +1,19 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. +USING: system io.directories io.encodings.utf16n alien.strings +io.pathnames io.backend io.files.windows destructors +kernel accessors calendar windows windows.errors +windows.kernel32 alien.c-types sequences splitting +fry continuations ; IN: io.directories.windows +M: windows touch-file ( path -- ) + [ + normalize-path + maybe-create-file [ &dispose ] dip + [ drop ] [ handle>> f now dup (set-file-times) ] if + ] with-destructors ; + M: windows move-file ( from to -- ) [ normalize-path ] bi@ MoveFile win32-error=0/f ; diff --git a/basis/io/files/info/windows/nt/nt.factor b/basis/io/files/info/windows/nt/nt.factor old mode 100644 new mode 100755 index e1b8062016..19ea0864ed --- a/basis/io/files/info/windows/nt/nt.factor +++ b/basis/io/files/info/windows/nt/nt.factor @@ -2,12 +2,3 @@ ! See http://factorcode.org/license.txt for BSD license. IN: io.files.info.windows.nt -ERROR: not-absolute-path ; - -M: winnt root-directory ( string -- string' ) - unicode-prefix ?head drop - dup { - [ length 2 >= ] - [ second CHAR: : = ] - [ first Letter? ] - } 1&& [ 2 head "\\" append ] [ not-absolute-path ] if ; diff --git a/basis/io/files/info/windows/windows.factor b/basis/io/files/info/windows/windows.factor old mode 100644 new mode 100755 index c3068dbafa..aecf42d9a2 --- a/basis/io/files/info/windows/windows.factor +++ b/basis/io/files/info/windows/windows.factor @@ -1,5 +1,11 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. +USING: byte-arrays math io.backend io.files.info +io.files.windows io.files.windows.nt kernel windows.kernel32 +windows.time windows accessors alien.c-types combinators +generalizations system alien.strings io.encodings.utf16n +sequences splitting windows.errors fry continuations destructors +calendar ascii combinators.short-circuit ; IN: io.files.info.windows TUPLE: windows-file-info < file-info attributes ; @@ -72,10 +78,10 @@ TUPLE: windows-file-info < file-info attributes ; get-file-information BY_HANDLE_FILE_INFORMATION>file-info ] if ; -M: winnt file-info ( path -- info ) +M: windows file-info ( path -- info ) normalize-path get-file-information-stat ; -M: winnt link-info ( path -- info ) +M: windows link-info ( path -- info ) file-info ; : volume-information ( normalized-path -- volume-name volume-serial max-component flags type ) @@ -103,7 +109,15 @@ M: winnt link-info ( path -- info ) TUPLE: win32-file-system-info < file-system-info max-component flags device-serial ; -HOOK: root-directory os ( string -- string' ) +ERROR: not-absolute-path ; + +: root-directory ( string -- string' ) + unicode-prefix ?head drop + dup { + [ length 2 >= ] + [ second CHAR: : = ] + [ first Letter? ] + } 1&& [ 2 head "\\" append ] [ not-absolute-path ] if ; M: winnt file-system-info ( path -- file-system-info ) normalize-path root-directory diff --git a/basis/io/files/windows/nt/nt.factor b/basis/io/files/windows/nt/nt.factor index f3a534388a..37c6e3190a 100755 --- a/basis/io/files/windows/nt/nt.factor +++ b/basis/io/files/windows/nt/nt.factor @@ -1,5 +1,5 @@ USING: continuations destructors io.buffers io.files io.backend -io.timeouts io.ports io.files.private io.backend.windows +io.timeouts io.ports io.pathnames io.files.private io.backend.windows io.files.windows io.backend.windows.nt io.encodings.utf16n windows windows.kernel32 kernel libc math threads system environment alien.c-types alien.arrays alien.strings sequences @@ -48,7 +48,7 @@ M: winnt FileArgs-overlapped ( port -- overlapped ) make-overlapped ; M: winnt open-append - [ dup file-info size>> ] [ drop 0 ] recover + 0 ! [ dup file-info size>> ] [ drop 0 ] recover [ (open-append) ] dip >>ptr ; M: winnt home "USERPROFILE" os-env ; diff --git a/basis/io/files/windows/windows.factor b/basis/io/files/windows/windows.factor index 30915f8c71..1a1ffe0dc7 100755 --- a/basis/io/files/windows/windows.factor +++ b/basis/io/files/windows/windows.factor @@ -1,11 +1,12 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types io.binary io.backend io.files io.buffers -io.encodings.utf16n io.ports io.backend.windows kernel math splitting -fry alien.strings windows windows.kernel32 windows.time calendar -combinators math.functions sequences namespaces make words -symbols system destructors accessors math.bitwise continuations -windows.errors arrays byte-arrays generalizations ; +USING: alien.c-types io.binary io.backend io.files +io.files.types io.buffers io.encodings.utf16n io.ports +io.backend.windows kernel math splitting fry alien.strings +windows windows.kernel32 windows.time calendar combinators +math.functions sequences namespaces make words symbols system +destructors accessors math.bitwise continuations windows.errors +arrays byte-arrays generalizations ; IN: io.files.windows : open-file ( path access-mode create-mode flags -- handle ) @@ -130,10 +131,3 @@ SYMBOLS: +read-only+ +hidden+ +system+ : (set-file-times) ( handle timestamp/f timestamp/f timestamp/f -- ) [ timestamp>FILETIME ] tri@ SetFileTime win32-error=0/f ; - -M: winnt touch-file ( path -- ) - [ - normalize-path - maybe-create-file [ &dispose ] dip - [ drop ] [ handle>> f now dup (set-file-times) ] if - ] with-destructors ; diff --git a/basis/io/launcher/launcher.factor b/basis/io/launcher/launcher.factor old mode 100644 new mode 100755 index ad2f7e44a9..f5809223fc --- a/basis/io/launcher/launcher.factor +++ b/basis/io/launcher/launcher.factor @@ -262,7 +262,6 @@ M: object run-pipeline-element { { [ os unix? ] [ "io.launcher.unix" require ] } - { [ os winnt? ] [ "io.backend.windows.nt.launcher" require ] } - { [ os wince? ] [ "io.launcher.windows" require ] } + { [ os winnt? ] [ "io.launcher.windows.nt" require ] } [ ] } cond diff --git a/basis/io/launcher/windows/nt/nt.factor b/basis/io/launcher/windows/nt/nt.factor old mode 100644 new mode 100755 index d098456486..5ebb38abc2 --- a/basis/io/launcher/windows/nt/nt.factor +++ b/basis/io/launcher/windows/nt/nt.factor @@ -6,7 +6,7 @@ windows.kernel32 windows namespaces make io.launcher kernel sequences windows.errors assocs splitting system strings io.launcher.windows io.files.windows io.backend io.files io.files.private combinators shuffle accessors locals ; -IN: io.backend.windows.nt.launcher +IN: io.launcher.windows.nt : duplicate-handle ( handle -- handle' ) GetCurrentProcess ! source process diff --git a/basis/io/launcher/windows/windows.factor b/basis/io/launcher/windows/windows.factor old mode 100644 new mode 100755 index 1e6d1f1a6d..0497754aa2 --- a/basis/io/launcher/windows/windows.factor +++ b/basis/io/launcher/windows/windows.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types arrays continuations io -io.backend.windows io.pipes.windows.nt libc io.ports +io.backend.windows io.pipes.windows.nt io.pathnames libc io.ports windows.types math windows.kernel32 namespaces make io.launcher kernel sequences windows.errors splitting system threads init strings combinators diff --git a/basis/io/monitors/windows/nt/nt.factor b/basis/io/monitors/windows/nt/nt.factor index 57bd07ef24..d2408a3dd1 100755 --- a/basis/io/monitors/windows/nt/nt.factor +++ b/basis/io/monitors/windows/nt/nt.factor @@ -6,7 +6,8 @@ hashtables sorting arrays combinators math.bitwise strings system accessors threads splitting io.backend io.backend.windows io.backend.windows.nt io.files.windows.nt io.monitors io.ports io.buffers io.files io.timeouts io.encodings.string -io.encodings.utf16n io windows windows.kernel32 windows.types ; +io.encodings.utf16n io windows windows.kernel32 windows.types +io.pathnames ; IN: io.monitors.windows.nt : open-directory ( path -- handle ) diff --git a/basis/tools/deploy/windows/windows.factor b/basis/tools/deploy/windows/windows.factor index 6188e78b0e..7ce635b1ba 100755 --- a/basis/tools/deploy/windows/windows.factor +++ b/basis/tools/deploy/windows/windows.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io io.files kernel namespaces sequences system +USING: io io.files io.directories kernel namespaces sequences system tools.deploy.backend tools.deploy.config tools.deploy.config.editor assocs hashtables prettyprint combinators windows.shell32 windows.user32 ; diff --git a/basis/tools/disassembler/gdb/gdb.factor b/basis/tools/disassembler/gdb/gdb.factor old mode 100644 new mode 100755 index 65d0e2f43a..e97cc203a2 --- a/basis/tools/disassembler/gdb/gdb.factor +++ b/basis/tools/disassembler/gdb/gdb.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2008 Slava Pestov, Jorge Acereda Macia. ! See http://factorcode.org/license.txt for BSD license. -USING: io.files io words alien kernel math.parser alien.syntax -io.launcher system assocs arrays sequences namespaces make -qualified system math io.encodings.ascii accessors -tools.disassembler ; +USING: io.files io.files.temp io words alien kernel math.parser +alien.syntax io.launcher system assocs arrays sequences +namespaces make qualified system math io.encodings.ascii +accessors tools.disassembler ; IN: tools.disassembler.gdb SINGLETON: gdb-disassembler