builtin

Compiler-provided functions for heap allocation and command-line arguments, plus operating system and build configuration constants. The builtin namespace is available without an import.

0 structs · 2 enums · 2 constants · 3 functions · Public API

Enums

OS

enum
OS : enum {
    Windows,
    MacOs,
    Linux
}
Operating system values used by CHIC_OS. Use these enum members in compile-time platform conditions.

BuildConfiguration

enum
BuildConfiguration : enum { Debug, Release }
Build configuration values used by CHIC_BUILD_CONFIG.

Constants

CHIC_OS

constant
CHIC_OS : OS
Compile-time operating system constant with a value of OS.Windows, OS.MacOs, or OS.Linux.

Available directly as CHIC_OS or qualified as builtin.CHIC_OS. Its value is supplied by the compiler build.

CHIC_BUILD_CONFIG

constant
CHIC_BUILD_CONFIG : BuildConfiguration
Compile-time build configuration constant. It is BuildConfiguration.Debug when the compiler is built with CHIC_DEBUG, or BuildConfiguration.Release with CHIC_RELEASE.

Available directly as CHIC_BUILD_CONFIG or qualified as builtin.CHIC_BUILD_CONFIG.

Functions

alloc

func
alloc : func(size : i64) -> ^void
Allocates size bytes using the C heap and fills the storage with zeroes. Call it as builtin.alloc(size).

The memory belongs to the caller. Release it with core.libc.free when finished. For allocation status codes and arena or pool policies, use core.memory.

get_argc

func
get_argc : func() -> i32
Returns the number of command-line arguments, including the executable name at index 0. Call it as builtin.get_argc().

get_arg

func
get_arg : func(index : i32) -> string
Returns the command-line argument at index as a string. Call it as builtin.get_arg(index).

Use an index from 0 up to, but excluding, builtin.get_argc(). Index 0 is the executable name. The returned string refers to the process argument storage; do not free it or its data pointer.