From 09a431f0b34aeee68c53c4365a32af75216f957b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 29 Nov 2008 20:15:04 -0600 Subject: [PATCH 1/3] dlist>seq now preserves f entries as reported by leifkb --- basis/dlists/dlists-tests.factor | 4 ++++ basis/dlists/dlists.factor | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/dlists/dlists-tests.factor b/basis/dlists/dlists-tests.factor index 6df3e306dd..084aa0ac89 100644 --- a/basis/dlists/dlists-tests.factor +++ b/basis/dlists/dlists-tests.factor @@ -75,3 +75,7 @@ IN: dlists.tests dup clone 3 over push-back [ dlist>seq ] bi@ ] unit-test + +[ V{ f 3 1 f } ] [ 1 over push-front 3 over push-front f over push-front f over push-back dlist>seq ] unit-test + +[ V{ } ] [ dlist>seq ] unit-test diff --git a/basis/dlists/dlists.factor b/basis/dlists/dlists.factor index bd4e7c46e6..d8b78558d4 100644 --- a/basis/dlists/dlists.factor +++ b/basis/dlists/dlists.factor @@ -154,7 +154,7 @@ M: dlist clear-deque ( dlist -- ) [ obj>> ] prepose dlist-each-node ; inline : dlist>seq ( dlist -- seq ) - [ ] pusher [ dlist-each ] dip ; + [ drop t ] pusher [ dlist-each ] dip ; : 1dlist ( obj -- dlist ) [ push-front ] keep ; From 1a50bcce759caec22b91ebc56c287cfc05379047 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 29 Nov 2008 20:17:16 -0600 Subject: [PATCH 2/3] dlist>seq was defined in dlists and linked-assocs --- basis/linked-assocs/linked-assocs.factor | 3 --- 1 file changed, 3 deletions(-) diff --git a/basis/linked-assocs/linked-assocs.factor b/basis/linked-assocs/linked-assocs.factor index 7330ac1a56..f9f84fbbae 100644 --- a/basis/linked-assocs/linked-assocs.factor +++ b/basis/linked-assocs/linked-assocs.factor @@ -28,9 +28,6 @@ M: linked-assoc set-at [ 2dup assoc>> key? [ 2dup delete-at ] when add-to-dlist ] 2keep assoc>> set-at ; -: dlist>seq ( dlist -- seq ) - [ ] pusher [ dlist-each ] dip ; - M: linked-assoc >alist dlist>> dlist>seq ; From bc14b8c7c85c480207ca0f3e84c5b57259b27f5b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 29 Nov 2008 20:19:40 -0600 Subject: [PATCH 3/3] fix a netbsd struct definition and some >r r> usage --- basis/unix/process/process.factor | 2 +- basis/unix/statfs/netbsd/netbsd.factor | 4 ++-- basis/unix/unix.factor | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/basis/unix/process/process.factor b/basis/unix/process/process.factor index 030f0977e2..175425f948 100644 --- a/basis/unix/process/process.factor +++ b/basis/unix/process/process.factor @@ -33,7 +33,7 @@ FUNCTION: int execve ( char* path, char** argv, char** envp ) ; [ first ] [ ] bi exec-with-path ; : exec-args-with-env ( seq seq -- int ) - >r [ first ] [ ] bi r> exec-with-env ; + [ [ first ] [ ] bi ] dip exec-with-env ; : with-fork ( child parent -- ) [ [ fork-process dup zero? ] dip [ drop ] prepose ] dip diff --git a/basis/unix/statfs/netbsd/netbsd.factor b/basis/unix/statfs/netbsd/netbsd.factor index 56c632edb4..ad7c161713 100644 --- a/basis/unix/statfs/netbsd/netbsd.factor +++ b/basis/unix/statfs/netbsd/netbsd.factor @@ -31,8 +31,8 @@ C-STRUCT: statvfs { "uid_t" "f_owner" } { { "uint32_t" 4 } "f_spare" } { { "char" _VFS_NAMELEN } "f_fstypename" } - { { "char" _VFS_NAMELEN } "f_mntonname" } - { { "char" _VFS_NAMELEN } "f_mntfromname" } ; + { { "char" _VFS_MNAMELEN } "f_mntonname" } + { { "char" _VFS_MNAMELEN } "f_mntfromname" } ; FUNCTION: int statvfs ( char* path, statvfs *buf ) ; diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index ca8a7a2e60..d917425bf9 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -198,10 +198,10 @@ FUNCTION: ssize_t readlink ( char* path, char* buf, size_t bufsize ) ; : PATH_MAX 1024 ; inline : read-symbolic-link ( path -- path ) - PATH_MAX dup >r - PATH_MAX - [ readlink ] unix-system-call - r> swap head-slice >string ; + PATH_MAX dup [ + PATH_MAX + [ readlink ] unix-system-call + ] dip swap head-slice >string ; FUNCTION: ssize_t recv ( int s, void* buf, size_t nbytes, int flags ) ; FUNCTION: ssize_t recvfrom ( int s, void* buf, size_t nbytes, int flags, sockaddr-in* from, socklen_t* fromlen ) ;