filename.ml, Makefile.nt: On utilise Sys.get_config au lieu de cpp.

sys.ml, sys.mli: ajout de Sys.get_config.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1056 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 1996-10-07 14:04:03 +00:00
parent d77533abfa
commit 3ae9ee4413
4 changed files with 27 additions and 28 deletions

View File

@ -44,16 +44,6 @@ pervasives.cmo: pervasives.ml
pervasives.cmx: pervasives.ml
$(CAMLOPT) $(COMPFLAGS) -nopervasives -c pervasives.ml
filename.ml: filename.mlp ..\config\Makefile.nt
@rm -f filename.ml
$(CPP) -DWIN32 filename.mlp > filename.ml
@attrib +r filename.ml
clean::
rm -f filename.ml
beforedepend:: filename.ml
.SUFFIXES: .mli .ml .cmi .cmo .cmx
.mli.cmi:

View File

@ -11,10 +11,12 @@
(* $Id$ *)
let systype = (Sys.get_config()).Sys.os_type;;
let current_dir_name =
match Sys.get_os_type () with
match systype with
| "Unix" -> "."
| "Windows NT" -> "."
| "Win32" -> "."
| "Macintosh" -> ":"
| _ -> failwith "Filename.current_dir_name: unknown system"
;;
@ -39,9 +41,9 @@ let mac_concat dirname filename =
;;
let concat =
match Sys.get_os_type () with
match systype with
| "Unix" -> unix_concat
| "Windows NT" -> wnt_concat
| "Win32" -> wnt_concat
| "Macintosh" -> mac_concat
| _ -> failwith "Filename.concat: unknown system"
;;
@ -70,9 +72,9 @@ let mac_is_absolute n =
;;
let is_absolute =
match Sys.get_os_type () with
match systype with
| "Unix" -> unix_is_absolute
| "Windows NT" -> wnt_is_absolute
| "Win32" -> wnt_is_absolute
| "Macintosh" -> mac_is_absolute
| _ -> failwith "Filename.is_absolute: unknown system"
;;
@ -101,9 +103,9 @@ let wnt_check_suffix name suff =
let mac_check_suffix = unix_check_suffix;;
let check_suffix =
match Sys.get_os_type () with
match systype with
| "Unix" -> unix_check_suffix
| "Windows NT" -> wnt_check_suffix
| "Win32" -> wnt_check_suffix
| "Macintosh" -> mac_check_suffix
| _ -> failwith "Filename.check_suffix: unknown system"
;;
@ -179,24 +181,24 @@ let mac_dirname name =
;;
let basename =
match Sys.get_os_type () with
match systype with
| "Unix" -> unix_basename
| "Windows NT" -> wnt_basename
| "Win32" -> wnt_basename
| "Macintosh" -> mac_basename
| _ -> failwith "Filename.basename: unknown system"
;;
let dirname =
match Sys.get_os_type () with
match systype with
| "Unix" -> unix_dirname
| "Windows NT" -> wnt_dirname
| "Win32" -> wnt_dirname
| "Macintosh" -> mac_dirname
| _ -> failwith "Filename.dirname: unknown system"
;;
let temporary_directory =
match Sys.get_os_type () with
match systype with
| "Unix" -> (try Sys.getenv "TMPDIR" with Not_found -> "/tmp")
| "Windows NT" -> (try Sys.getenv "TEMP" with Not_found -> "C:\\temp")
| "Win32" -> (try Sys.getenv "TEMP" with Not_found -> "C:\\temp")
| "Macintosh" -> (try Sys.getenv "TempFolder" with Not_found -> ":")
| _ -> failwith "Filename.temporary_directory: unknown system"
;;

View File

@ -13,6 +13,9 @@
(* System interface *)
type config = { os_type : string; word_size : int };;
external get_config: unit -> config = "sys_get_config"
external get_argv: unit -> string array = "sys_get_argv"
let argv = get_argv()
@ -24,7 +27,6 @@ external getenv: string -> string = "sys_getenv"
external command: string -> int = "sys_system_command"
external chdir: string -> unit = "sys_chdir"
external getcwd: unit -> string = "sys_getcwd"
external get_os_type: unit -> string = "sys_get_os_type"
let interactive = ref false

View File

@ -13,6 +13,14 @@
(* Module [Sys]: system interface *)
type config = { os_type : string; word_size : int };;
(* Configuration information:
- [os_type] is one of Unix, Win32, MacOS.
- [word_size] is the size of one word, in bits: 32 or 64
*)
external get_config: unit -> config = "sys_get_config"
(* Return the current run-time configuration. *)
val argv: string array
(* The command line arguments given to the process.
The first element is the command name used to invoke the program.
@ -37,9 +45,6 @@ val interactive: bool ref
(* This reference is initially set to [false] in standalone
programs and to [true] if the code is being executed under
the interactive toplevel [csltop]. *)
external get_os_type: unit -> string = "sys_get_os_type"
(* Return the operating system name. *)
(*** Signal handling *)
type signal_behavior =