compiler/utils/platform

  Source   Edit

Types

Target = object
  targetCPU*, hostCPU*: TSystemCPU
  targetOS*, hostOS*: TSystemOS
  intSize*: int
  floatSize*: int
  ptrSize*: int
  tnl*: string
  Source   Edit
TInfoCPU = tuple[name: string, intSize: int, endian: Endianness,
                 floatSize, bit: int]
  Source   Edit
TInfoOS = tuple[name: string, parDir: string, dllFrmt: string,
                altDirSep: string, objExt: string, newLine: string,
                pathSep: string, dirSep: string, scriptExt: string,
                curDir: string, exeExt: string, extSep: string,
                props: TInfoOSProps]
  Source   Edit
TInfoOSProp = enum
  ospNeedsPIC, ospCaseInsensitive, ospPosix, ospLacksThreadVars
  Source   Edit
TSystemCPU = enum
  cpuNone, cpuI386, cpuM68k, cpuAlpha, cpuPowerpc, cpuPowerpc64, cpuPowerpc64el,
  cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips, cpuMipsel, cpuArm,
  cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430, cpuSparc64, cpuMips64,
  cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32, cpuE2k, cpuLoongArch64
  Source   Edit
TSystemOS = enum
  osNone, osDos, osWindows, osOs2, osLinux, osMorphos, osSkyos, osSolaris,
  osIrix, osNetbsd, osFreebsd, osOpenbsd, osDragonfly, osCrossos, osAix,
  osPalmos, osQnx, osAmiga, osAtari, osNetware, osMacos, osMacosx, osIos,
  osHaiku, osAndroid, osVxWorks, osGenode, osJS, osNimVM, osStandalone,
  osNintendoSwitch, osFreeRTOS, osAny
  Source   Edit

Consts

CPU: array[succ(low(TSystemCPU)) .. high(TSystemCPU), TInfoCPU] = [
    (name: "i386", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
    (name: "m68k", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), (
    name: "alpha", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
    (name: "powerpc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), (
    name: "powerpc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64), (
    name: "powerpc64el", intSize: 64, endian: littleEndian, floatSize: 64,
    bit: 64),
    (name: "sparc", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
    (name: "vm", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
    (name: "hppa", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
    (name: "ia64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), (
    name: "amd64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
    (name: "mips", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32), (
    name: "mipsel", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
    (name: "arm", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), (
    name: "arm64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
    (name: "js", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
    (name: "nimvm", intSize: 32, endian: bigEndian, floatSize: 64, bit: 32),
    (name: "avr", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16), (
    name: "msp430", intSize: 16, endian: littleEndian, floatSize: 32, bit: 16),
    (name: "sparc64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64),
    (name: "mips64", intSize: 64, endian: bigEndian, floatSize: 64, bit: 64), (
    name: "mips64el", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), (
    name: "riscv32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), (
    name: "riscv64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
    (name: "esp", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32), (
    name: "wasm32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
    (name: "e2k", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64), (
    name: "loongarch64", intSize: 64, endian: littleEndian, floatSize: 64,
    bit: 64)]
  Source   Edit
EndianToStr: array[Endianness, string] = ["littleEndian", "bigEndian"]
  Source   Edit
OS: array[succ(low(TSystemOS)) .. high(TSystemOS), TInfoOS] = [(name: "DOS",
    parDir: "..", dllFrmt: "$1.dll", altDirSep: "/", objExt: ".obj",
    newLine: "\r\n", pathSep: ";", dirSep: "\\", scriptExt: ".bat", curDir: ".",
    exeExt: ".exe", extSep: ".", props: {ospCaseInsensitive}), (name: "Windows",
    parDir: "..", dllFrmt: "$1.dll", altDirSep: "/", objExt: ".obj",
    newLine: "\r\n", pathSep: ";", dirSep: "\\", scriptExt: ".bat", curDir: ".",
    exeExt: ".exe", extSep: ".", props: {ospCaseInsensitive}), (name: "OS2",
    parDir: "..", dllFrmt: "$1.dll", altDirSep: "/", objExt: ".obj",
    newLine: "\r\n", pathSep: ";", dirSep: "\\", scriptExt: ".bat", curDir: ".",
    exeExt: ".exe", extSep: ".", props: {ospCaseInsensitive}), (name: "Linux",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "MorphOS",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "SkyOS",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "Solaris",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "Irix",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "NetBSD",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "FreeBSD",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "OpenBSD",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "DragonFly", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "CROSSOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "AIX", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "PalmOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospNeedsPIC}), (name: "QNX",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "Amiga",
    parDir: "..", dllFrmt: "$1.library", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC}), (name: "Atari",
    parDir: "..", dllFrmt: "$1.dll", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: "", curDir: ".",
    exeExt: ".tpp", extSep: ".", props: {ospNeedsPIC}), (name: "Netware",
    parDir: "..", dllFrmt: "$1.nlm", altDirSep: "/", objExt: "",
    newLine: "\r\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: ".nlm", extSep: ".", props: {ospCaseInsensitive}), (name: "MacOS",
    parDir: "::", dllFrmt: "$1Lib", altDirSep: ":", objExt: ".o", newLine: "\r",
    pathSep: ",", dirSep: ":", scriptExt: "", curDir: ":", exeExt: "",
    extSep: ".", props: {ospCaseInsensitive}), (name: "MacOSX", parDir: "..",
    dllFrmt: "lib$1.dylib", altDirSep: ":", objExt: ".o", newLine: "\n",
    pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".", exeExt: "",
    extSep: ".", props: {ospNeedsPIC, ospPosix, ospLacksThreadVars}), (
    name: "iOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "Haiku", parDir: "..", dllFrmt: "lib$1.so", altDirSep: ":",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".",
    props: {ospNeedsPIC, ospPosix, ospLacksThreadVars}), (name: "Android",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospPosix}), (name: "VxWorks",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ";", dirSep: "\\", scriptExt: ".sh", curDir: ".",
    exeExt: ".vxe", extSep: ".",
    props: {ospNeedsPIC, ospPosix, ospLacksThreadVars}), (name: "Genode",
    pardir: "..", dllFrmt: "$1.lib.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: "", curDir: "/",
    exeExt: "", extSep: ".", props: {ospNeedsPIC, ospLacksThreadVars}), (
    name: "JS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {}), (name: "NimVM", parDir: "..",
    dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o", newLine: "\n",
    pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".", exeExt: "",
    extSep: ".", props: {}), (name: "Standalone", parDir: "..",
                              dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
                              newLine: "\n", pathSep: ":", dirSep: "/",
                              scriptExt: ".sh", curDir: ".", exeExt: "",
                              extSep: ".", props: {}), (name: "NintendoSwitch",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: ".elf", extSep: ".", props: {ospNeedsPIC, ospPosix}), (
    name: "FreeRTOS", parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/",
    objExt: ".o", newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh",
    curDir: ".", exeExt: "", extSep: ".", props: {ospPosix}), (name: "Any",
    parDir: "..", dllFrmt: "lib$1.so", altDirSep: "/", objExt: ".o",
    newLine: "\n", pathSep: ":", dirSep: "/", scriptExt: ".sh", curDir: ".",
    exeExt: "", extSep: ".", props: {})]
  Source   Edit

Procs

proc listCPUnames(): seq[string] {....raises: [], tags: [].}
  Source   Edit
proc listOSnames(): seq[string] {....raises: [], tags: [].}
  Source   Edit
proc nameToCPU(name: string): TSystemCPU {....raises: [], tags: [].}
  Source   Edit
proc nameToOS(name: string): TSystemOS {....raises: [], tags: [].}
  Source   Edit
proc setTarget(t: var Target; o: TSystemOS; c: TSystemCPU) {....raises: [],
    tags: [].}
  Source   Edit
proc setTargetFromSystem(t: var Target) {....raises: [], tags: [].}
  Source   Edit