File: Arch.hs

package info (click to toggle)
haskell-cpu 0.1.2-9
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 84 kB
  • sloc: haskell: 171; ansic: 79; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,373 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{-# LANGUAGE CPP #-}
-- |
-- Module      : System.Arch
-- License     : BSD-style
-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
-- Stability   : experimental
-- Portability : unknown
--
module System.Arch
    ( Arch(..)
    , getSystemArch
    ) where

-- | List of all cpu architecture
data Arch = X86
          | X86_64
          | PPC
          | PPC64
          | Sparc
          | Arm
          | Mips
          | SH
          | IA64
          | S390
          | Alpha
          | Hppa
          | Rs6000
          | M68K
          | VAX
          deriving (Show,Eq)

-- | Return the system's cpu architecture
getSystemArch :: Arch
#if defined(ARCH_X86)
getSystemArch = X86
#elif defined(ARCH_X86_64)
getSystemArch = X86_64
#elif defined(ARCH_PPC)
getSystemArch = PPC
#elif defined(ARCH_PPC64)
getSystemArch = PPC64
#elif defined(ARCH_SPARC)
getSystemArch = Sparc
#elif defined(ARCH_ARM)
getSystemArch = Arm
#elif defined(ARCH_MIPS)
getSystemArch = Mips
#elif defined(ARCH_SH)
getSystemArch = SH
#elif defined(ARCH_IA64)
getSystemArch = IA64
#elif defined(ARCH_S390)
getSystemArch = S390
#elif defined(ARCH_ALPHA)
getSystemArch = Alpha
#elif defined(ARCH_HPPA)
getSystemArch = Hppa
#elif defined(ARCH_RS6000)
getSystemArch = Rs6000
#elif defined(ARCH_M68K)
getSystemArch = M68K
#elif defined(ARCH_VAX)
getSystemArch = VAX
#else
getSystemArch = undefined
#endif