]> gitweb.factorcode.org Git - factor.git/commitdiff
move monotonic-clock to basis
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 30 Nov 2009 23:03:36 +0000 (17:03 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 30 Nov 2009 23:03:36 +0000 (17:03 -0600)
20 files changed:
basis/monotonic-clock/authors.txt [new file with mode: 0644]
basis/monotonic-clock/monotonic-clock.factor [new file with mode: 0755]
basis/monotonic-clock/unix/authors.txt [new file with mode: 0644]
basis/monotonic-clock/unix/macosx/authors.txt [new file with mode: 0644]
basis/monotonic-clock/unix/macosx/macosx.factor [new file with mode: 0755]
basis/monotonic-clock/unix/macosx/tags.txt [new file with mode: 0644]
basis/monotonic-clock/unix/unix.factor [new file with mode: 0644]
basis/monotonic-clock/windows/authors.txt [new file with mode: 0644]
basis/monotonic-clock/windows/tags.txt [new file with mode: 0644]
basis/monotonic-clock/windows/windows.factor [new file with mode: 0755]
extra/monotonic-clock/authors.txt [deleted file]
extra/monotonic-clock/monotonic-clock.factor [deleted file]
extra/monotonic-clock/unix/authors.txt [deleted file]
extra/monotonic-clock/unix/macosx/authors.txt [deleted file]
extra/monotonic-clock/unix/macosx/macosx.factor [deleted file]
extra/monotonic-clock/unix/macosx/tags.txt [deleted file]
extra/monotonic-clock/unix/unix.factor [deleted file]
extra/monotonic-clock/windows/authors.txt [deleted file]
extra/monotonic-clock/windows/tags.txt [deleted file]
extra/monotonic-clock/windows/windows.factor [deleted file]

diff --git a/basis/monotonic-clock/authors.txt b/basis/monotonic-clock/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/monotonic-clock/monotonic-clock.factor b/basis/monotonic-clock/monotonic-clock.factor
new file mode 100755 (executable)
index 0000000..678c527
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2009 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators system vocabs.loader ;
+IN: monotonic-clock
+
+HOOK: monotonic-count os ( -- n )
+
+{
+    { [ os macosx? ] [ "monotonic-clock.unix.macosx" ] }
+    { [ os unix? ] [ "monotonic-clock.unix" ] }
+    { [ os windows? ] [ "monotonic-clock.windows" ] }
+} cond require
diff --git a/basis/monotonic-clock/unix/authors.txt b/basis/monotonic-clock/unix/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/monotonic-clock/unix/macosx/authors.txt b/basis/monotonic-clock/unix/macosx/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/monotonic-clock/unix/macosx/macosx.factor b/basis/monotonic-clock/unix/macosx/macosx.factor
new file mode 100755 (executable)
index 0000000..5bdb8ff
--- /dev/null
@@ -0,0 +1,24 @@
+! Copyright (C) 2009 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors alien.syntax classes.struct kernel math
+monotonic-clock system unix.types ;
+IN: monotonic-clock.unix.macosx
+
+STRUCT: mach_timebase_info
+    { numer uint32_t }
+    { denom uint32_t } ;
+
+TYPEDEF: mach_timebase_info* mach_timebase_info_t
+TYPEDEF: mach_timebase_info mach_timebase_info_data_t
+
+FUNCTION: uint64_t mach_absolute_time ( ) ;
+FUNCTION: kern_return_t mach_timebase_info ( mach_timebase_info_t info ) ;
+FUNCTION: kern_return_t mach_wait_until ( uint64_t deadline ) ;
+
+ERROR: mach-timebase-info ret ;
+
+M: macosx monotonic-count 
+    mach_absolute_time
+    \ mach_timebase_info <struct> [
+        mach_timebase_info [ mach-timebase-info ] unless-zero
+    ] keep [ numer>> ] [ denom>> ] bi / * ;
diff --git a/basis/monotonic-clock/unix/macosx/tags.txt b/basis/monotonic-clock/unix/macosx/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/monotonic-clock/unix/unix.factor b/basis/monotonic-clock/unix/unix.factor
new file mode 100644 (file)
index 0000000..d739735
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2009 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.syntax calendar.unix classes.struct
+kernel monotonic-clock system unix unix.time unix.types ;
+IN: monotonic-clock.unix
+
+LIBRARY: librt
+
+FUNCTION: int clock_settime ( clockid_t clock_id, timespec* tp ) ;
+FUNCTION: int clock_gettime ( clockid_t clock_id, timespec* tp ) ;
+FUNCTION: int clock_getres ( clockid_t clock_id, timespec* res ) ;
+
+CONSTANT: CLOCK_REALTIME 0
+CONSTANT: CLOCK_MONOTONIC 1
+CONSTANT: CLOCK_PROCESS_CPUTIME_ID 2
+CONSTANT: CLOCK_THREAD_CPUTIME_ID 3
+
+CONSTANT: TIMER_ABSTIME 1
+
+M: unix monotonic-count
+    CLOCK_MONOTONIC timespec <struct> [ clock_gettime io-error ] keep
+    timespec>nanoseconds ;
diff --git a/basis/monotonic-clock/windows/authors.txt b/basis/monotonic-clock/windows/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/monotonic-clock/windows/tags.txt b/basis/monotonic-clock/windows/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/monotonic-clock/windows/windows.factor b/basis/monotonic-clock/windows/windows.factor
new file mode 100755 (executable)
index 0000000..bb47941
--- /dev/null
@@ -0,0 +1,20 @@
+! Copyright (C) 2009 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.c-types alien.data fry kernel monotonic-clock
+system windows.errors windows.kernel32 math ;
+IN: monotonic-clock.windows
+
+<PRIVATE
+
+: execute-performance-query ( word -- n )
+    [ "LARGE_INTEGER*" <c-object> ] dip
+    '[ _ execute win32-error=0/f ] keep *ulonglong ; inline
+
+PRIVATE>
+
+: cpu-frequency ( -- n )
+    \ QueryPerformanceFrequency execute-performance-query ;
+
+M: windows monotonic-count  ( -- n )
+    \ QueryPerformanceCounter execute-performance-query
+    1000000000 * cpu-frequency /i ;
diff --git a/extra/monotonic-clock/authors.txt b/extra/monotonic-clock/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/extra/monotonic-clock/monotonic-clock.factor b/extra/monotonic-clock/monotonic-clock.factor
deleted file mode 100755 (executable)
index 678c527..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: combinators system vocabs.loader ;
-IN: monotonic-clock
-
-HOOK: monotonic-count os ( -- n )
-
-{
-    { [ os macosx? ] [ "monotonic-clock.unix.macosx" ] }
-    { [ os unix? ] [ "monotonic-clock.unix" ] }
-    { [ os windows? ] [ "monotonic-clock.windows" ] }
-} cond require
diff --git a/extra/monotonic-clock/unix/authors.txt b/extra/monotonic-clock/unix/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/extra/monotonic-clock/unix/macosx/authors.txt b/extra/monotonic-clock/unix/macosx/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/extra/monotonic-clock/unix/macosx/macosx.factor b/extra/monotonic-clock/unix/macosx/macosx.factor
deleted file mode 100755 (executable)
index 5bdb8ff..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.syntax classes.struct kernel math
-monotonic-clock system unix.types ;
-IN: monotonic-clock.unix.macosx
-
-STRUCT: mach_timebase_info
-    { numer uint32_t }
-    { denom uint32_t } ;
-
-TYPEDEF: mach_timebase_info* mach_timebase_info_t
-TYPEDEF: mach_timebase_info mach_timebase_info_data_t
-
-FUNCTION: uint64_t mach_absolute_time ( ) ;
-FUNCTION: kern_return_t mach_timebase_info ( mach_timebase_info_t info ) ;
-FUNCTION: kern_return_t mach_wait_until ( uint64_t deadline ) ;
-
-ERROR: mach-timebase-info ret ;
-
-M: macosx monotonic-count 
-    mach_absolute_time
-    \ mach_timebase_info <struct> [
-        mach_timebase_info [ mach-timebase-info ] unless-zero
-    ] keep [ numer>> ] [ denom>> ] bi / * ;
diff --git a/extra/monotonic-clock/unix/macosx/tags.txt b/extra/monotonic-clock/unix/macosx/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/extra/monotonic-clock/unix/unix.factor b/extra/monotonic-clock/unix/unix.factor
deleted file mode 100644 (file)
index d739735..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.syntax calendar.unix classes.struct
-kernel monotonic-clock system unix unix.time unix.types ;
-IN: monotonic-clock.unix
-
-LIBRARY: librt
-
-FUNCTION: int clock_settime ( clockid_t clock_id, timespec* tp ) ;
-FUNCTION: int clock_gettime ( clockid_t clock_id, timespec* tp ) ;
-FUNCTION: int clock_getres ( clockid_t clock_id, timespec* res ) ;
-
-CONSTANT: CLOCK_REALTIME 0
-CONSTANT: CLOCK_MONOTONIC 1
-CONSTANT: CLOCK_PROCESS_CPUTIME_ID 2
-CONSTANT: CLOCK_THREAD_CPUTIME_ID 3
-
-CONSTANT: TIMER_ABSTIME 1
-
-M: unix monotonic-count
-    CLOCK_MONOTONIC timespec <struct> [ clock_gettime io-error ] keep
-    timespec>nanoseconds ;
diff --git a/extra/monotonic-clock/windows/authors.txt b/extra/monotonic-clock/windows/authors.txt
deleted file mode 100644 (file)
index 7c1b2f2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
diff --git a/extra/monotonic-clock/windows/tags.txt b/extra/monotonic-clock/windows/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/extra/monotonic-clock/windows/windows.factor b/extra/monotonic-clock/windows/windows.factor
deleted file mode 100755 (executable)
index bb47941..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-! Copyright (C) 2009 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types alien.data fry kernel monotonic-clock
-system windows.errors windows.kernel32 math ;
-IN: monotonic-clock.windows
-
-<PRIVATE
-
-: execute-performance-query ( word -- n )
-    [ "LARGE_INTEGER*" <c-object> ] dip
-    '[ _ execute win32-error=0/f ] keep *ulonglong ; inline
-
-PRIVATE>
-
-: cpu-frequency ( -- n )
-    \ QueryPerformanceFrequency execute-performance-query ;
-
-M: windows monotonic-count  ( -- n )
-    \ QueryPerformanceCounter execute-performance-query
-    1000000000 * cpu-frequency /i ;