* SRFI 27::
* SRFI 39::
* SRFI 69::
+* SRFI 112::
* SRFI 115::
* SRFI 124::
* SRFI 125::
* SRFI 27::
* SRFI 39::
* SRFI 69::
+* SRFI 112::
* SRFI 115::
* SRFI 124::
* SRFI 125::
@tab @nicode{parameterize}
@end multitable
-@node SRFI 69, SRFI 115, SRFI 39, Standards Support
+@node SRFI 69, SRFI 112, SRFI 39, Standards Support
@section SRFI 69: Basic Hash Tables
@findex alist->hash-table
@findex hash
@tab @nicode{string-hash}
@end multitable
-@node SRFI 115, SRFI 124, SRFI 69, Standards Support
+@node SRFI 112, SRFI 115, SRFI 69, Standards Support
+@section SRFI 112: Environment Inquiry
+@findex cpu-architecture
+@findex implementation-name
+@findex implementation-version
+@findex machine-name
+@findex os-name
+@findex os-version
+
+@cartouche
+@table @b
+@item Description
+Provides human-readable information at run time about the hardware and
+software configuration on which a Scheme program is being executed.
+@item URL
+@srfiurl{112}
+@item Support
+Fully supported.
+@item Libraries
+@nicode{(srfi 112)}
+@item Global
+All names are bound in the @mitgnu{} global environment.
+@end table
+@end cartouche
+
+@multitable @columnfractions .5 .5
+@item @nicode{cpu-architecture}
+@tab @nicode{implementation-name}
+@item @nicode{implementation-version}
+@tab @nicode{machine-name}
+@item @nicode{os-name}
+@tab @nicode{os-version}
+@end multitable
+
+@node SRFI 115, SRFI 124, SRFI 112, Standards Support
@section SRFI 115: Scheme Regular Expressions
@findex char-set->sre
@findex regexp
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS_ONCE([sys/time.h])
-AC_CHECK_HEADERS([bsdtty.h fcntl.h fenv.h ieeefp.h malloc.h poll.h])
-AC_CHECK_HEADERS([sgtty.h stropts.h])
-AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/mount.h sys/param.h])
-AC_CHECK_HEADERS([sys/ptyio.h sys/socket.h sys/timex.h sys/un.h])
+AC_CHECK_HEADERS([bsdtty.h dlfcn.h fcntl.h fenv.h ieeefp.h malloc.h netdb.h])
+AC_CHECK_HEADERS([poll.h sgtty.h stdint.h stropts.h])
+AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/mman.h sys/mount.h sys/param.h])
+AC_CHECK_HEADERS([sys/ptyio.h sys/socket.h sys/timex.h sys/un.h sys/utsname.h])
AC_CHECK_HEADERS([sys/vfs.h])
AC_CHECK_HEADERS([termio.h termios.h unistd.h util.h utime.h])
-AC_CHECK_HEADERS([dlfcn.h netdb.h])
-AC_CHECK_HEADERS([sys/mman.h stdint.h])
define([SCM_INC_TIME],
[
#ifdef HAVE_SOCKETS
# include "uxsock.h"
#endif
+
+#ifdef HAVE_SYS_UTSNAME_H
+# include "sys/utsname.h"
+#endif
\f
DEFINE_PRIMITIVE ("FILE-TIME->STRING", Prim_file_time_to_string, 1, 1,
"Convert a file system time stamp into a date/time string.")
PRIMITIVE_RETURN (UNSPECIFIC);
#endif
}
+
+DEFINE_PRIMITIVE ("uname", Prim_uname, 0, 0, 0)
+{
+#ifdef HAVE_SYS_UTSNAME_H
+ struct utsname buf;
+ STD_VOID_SYSTEM_CALL (syscall_uname, (UX_uname (&buf)));
+ SCHEME_OBJECT v = (allocate_marked_vector (TC_VECTOR, 5, true));
+ VECTOR_SET (v, 0, (char_pointer_to_string (buf.sysname)));
+ VECTOR_SET (v, 1, (char_pointer_to_string (buf.nodename)));
+ VECTOR_SET (v, 2, (char_pointer_to_string (buf.release)));
+ VECTOR_SET (v, 3, (char_pointer_to_string (buf.version)));
+ VECTOR_SET (v, 4, (char_pointer_to_string (buf.machine)));
+ PRIMITIVE_RETURN (v);
+#else
+ error_unimplemented_primitive ();
+ PRIMITIVE_RETURN (UNSPECIFIC);
+#endif
+}
syscall_terminal_set_state,
syscall_time,
syscall_times,
+ syscall_uname,
syscall_unlink,
syscall_utime,
syscall_vfork,
extern int UX_closefrom (int);
# define EMULATE_CLOSEFROM
#endif
+
+#ifdef HAVE_SYS_UTSNAME_H
+# define UX_uname uname
+#endif
\f
/* poll is somewhat busted on Mac OSX 10.4 (Tiger), so use select. */
#ifdef __APPLE__
"terminal-set-state",
"time",
"times",
+ "uname",
"unlink",
"utime",
"vfork",
srfi-39 ;Parameter objects
srfi-62 ;S-expression comments
srfi-69 ;Basic Hash Tables
+ srfi-112 ;Environment Inquiry
srfi-115 ;Scheme Regular Expressions
srfi-124 ;Ephemerons
srfi-125 ;Intermediate hash tables
make-hash-table
string-ci-hash
string-hash))
+
+(define-standard-library '(srfi 112)
+ '(cpu-architecture
+ implementation-name
+ implementation-version
+ machine-name
+ os-name
+ os-version))
\f
(define-standard-library '(srfi 115)
'(char-set->sre
(extend-package (runtime os-primitives)
(files "unxprm")
(export ()
+ cpu-architecture ;(srfi 112)
delete-environment-variable!
file-attributes/gid
file-attributes/inode-number
file-attributes/uid
+ implementation-name ;(srfi 112)
+ implementation-version ;(srfi 112)
+ machine-name ;(srfi 112)
+ os-name ;(srfi 112)
+ os-version ;(srfi 112)
set-environment-variable!
unix/current-gid
unix/current-pid
unix/current-uid
unix/gid->string
unix/system
- unix/uid->string))))
+ unix/uid->string
+ unix/uname))))
(define-package (runtime legacy-string)
(files "legacy-string")
(list "-c" command))
(define (os/executable-pathname-types)
- '())
\ No newline at end of file
+ '())
+\f
+;;;; SRFI 112
+
+(define (unix/uname)
+ ;; Returns a vector of
+ ;; #(sysname nodename version release machine)
+ ((ucode-primitive uname 0)))
+
+(define (implementation-name) "MIT/GNU Scheme")
+
+(define (implementation-version)
+ (get-subsystem-version-string "Release"))
+
+(define (cpu-architecture)
+ (vector-ref (unix/uname) 4))
+
+(define (machine-name)
+ (vector-ref (unix/uname) 1))
+
+(define (os-name)
+ microcode-id/operating-system-variant)
+
+(define (os-version)
+ (string-append (vector-ref (unix/uname) 2)
+ " "
+ (vector-ref (unix/uname) 3)))
\ No newline at end of file