From 194e0d00c72f981b4b9c5f7c3c71162b81ebba5c Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 27 Feb 2008 18:15:18 -0600 Subject: [PATCH 1/3] unix: start removing the factored out types --- extra/unix/types/linux/linux.factor | 4 +-- extra/unix/unix.factor | 40 ++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/extra/unix/types/linux/linux.factor b/extra/unix/types/linux/linux.factor index 9be9756edd..8822366a3a 100644 --- a/extra/unix/types/linux/linux.factor +++ b/extra/unix/types/linux/linux.factor @@ -7,9 +7,9 @@ IN: unix.types TYPEDEF: ulonglong __uquad_type TYPEDEF: ulong __ulongword_type -TYPEDEF: uint __uword_type +TYPEDEF: long __sword_type +TYPEDEF: ulong __uword_type TYPEDEF: long __slongword_type -TYPEDEF: int __sword_type TYPEDEF: uint __u32_type TYPEDEF: int __s32_type diff --git a/extra/unix/unix.factor b/extra/unix/unix.factor index e8716ee074..68e46eb2ae 100755 --- a/extra/unix/unix.factor +++ b/extra/unix/unix.factor @@ -2,36 +2,36 @@ ! See http://factorcode.org/license.txt for BSD license. IN: unix USING: alien alien.c-types alien.syntax kernel libc structs -math namespaces system combinators vocabs.loader ; +math namespaces system combinators vocabs.loader unix.types ; ! ! ! Unix types -TYPEDEF: long word -TYPEDEF: ulong uword +! TYPEDEF: long word +! TYPEDEF: ulong uword -TYPEDEF: long longword -TYPEDEF: ulong ulongword +! TYPEDEF: long longword +! TYPEDEF: ulong ulongword -TYPEDEF: long ssize_t -TYPEDEF: longword blksize_t -TYPEDEF: longword blkcnt_t -TYPEDEF: longlong quad_t -TYPEDEF: ulonglong dev_t -TYPEDEF: uint gid_t +! TYPEDEF: long ssize_t +! TYPEDEF: longword blksize_t +! TYPEDEF: longword blkcnt_t +! TYPEDEF: longlong quad_t +! TYPEDEF: ulonglong dev_t +! TYPEDEF: uint gid_t TYPEDEF: uint in_addr_t -TYPEDEF: ulong ino_t -TYPEDEF: int pid_t +! TYPEDEF: ulong ino_t +! TYPEDEF: int pid_t TYPEDEF: uint socklen_t TYPEDEF: uint time_t -TYPEDEF: uint uid_t +! TYPEDEF: uint uid_t TYPEDEF: ulong size_t -TYPEDEF: ulong u_long -TYPEDEF: uint mode_t -TYPEDEF: uword nlink_t -TYPEDEF: void* caddr_t +! TYPEDEF: ulong u_long +! TYPEDEF: uint mode_t +! TYPEDEF: uword nlink_t +! TYPEDEF: void* caddr_t -TYPEDEF: ulong off_t -TYPEDEF-IF: bsd? ulonglong off_t +! TYPEDEF: ulong off_t +! TYPEDEF-IF: bsd? ulonglong off_t C-STRUCT: tm { "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?) From bef1d40964998c2784f208f3df93bcb9dc174791 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 27 Feb 2008 19:01:55 -0600 Subject: [PATCH 2/3] unix.types.macosx: fix using --- extra/unix/types/macosx/macosx.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra/unix/types/macosx/macosx.factor b/extra/unix/types/macosx/macosx.factor index 822e32251a..8f9c5082df 100644 --- a/extra/unix/types/macosx/macosx.factor +++ b/extra/unix/types/macosx/macosx.factor @@ -1,4 +1,6 @@ +USING: alien.syntax ; + IN: unix.types ! Darwin 9.1.0 ppc From 260acff9523601dcf3e4345d175eefe650cde811 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 27 Feb 2008 23:09:29 -0600 Subject: [PATCH 3/3] add coprime? to math.primes --- extra/math/primes/primes.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra/math/primes/primes.factor b/extra/math/primes/primes.factor index 68ab5b3221..685124e4e9 100644 --- a/extra/math/primes/primes.factor +++ b/extra/math/primes/primes.factor @@ -47,3 +47,5 @@ PRIVATE> primes-upto >r 1- next-prime r> [ [ <=> ] binsearch ] keep [ length ] keep ; foldable + +: coprime? ( a b -- ? ) gcd nip 1 = ; foldable