src/Pure/ML/ml_system.ML
changeset 73228 0575cfd2ecfc
parent 72535 7cb68b5b103d
child 73263 ad60214bef09
equal deleted inserted replaced
73227:5cb4f7107add 73228:0575cfd2ecfc
     9   val name: string
     9   val name: string
    10   val platform: string
    10   val platform: string
    11   val platform_is_windows: bool
    11   val platform_is_windows: bool
    12   val platform_is_64: bool
    12   val platform_is_64: bool
    13   val platform_is_arm: bool
    13   val platform_is_arm: bool
       
    14   val platform_is_rosetta: unit -> bool
    14   val platform_path: string -> string
    15   val platform_path: string -> string
    15   val standard_path: string -> string
    16   val standard_path: string -> string
    16 end;
    17 end;
    17 
    18 
    18 structure ML_System: ML_SYSTEM =
    19 structure ML_System: ML_SYSTEM =
    21 val SOME name = OS.Process.getEnv "ML_SYSTEM";
    22 val SOME name = OS.Process.getEnv "ML_SYSTEM";
    22 val SOME platform = OS.Process.getEnv "ML_PLATFORM";
    23 val SOME platform = OS.Process.getEnv "ML_PLATFORM";
    23 val platform_is_windows = String.isSuffix "windows" platform;
    24 val platform_is_windows = String.isSuffix "windows" platform;
    24 val platform_is_64 = String.isPrefix "x86_64-" platform;
    25 val platform_is_64 = String.isPrefix "x86_64-" platform;
    25 val platform_is_arm = String.isPrefix "arm64-" platform;
    26 val platform_is_arm = String.isPrefix "arm64-" platform;
       
    27 
       
    28 fun platform_is_rosetta () =
       
    29   (case OS.Process.getEnv "ISABELLE_APPLE_PLATFORM64" of
       
    30     NONE => false
       
    31   | SOME "" => false
       
    32   | SOME apple_platform => apple_platform <> platform);
    26 
    33 
    27 val platform_path =
    34 val platform_path =
    28   if platform_is_windows then
    35   if platform_is_windows then
    29     fn path =>
    36     fn path =>
    30       if String.isPrefix "/" path andalso not (String.isPrefix "//" path) then
    37       if String.isPrefix "/" path andalso not (String.isPrefix "//" path) then