system

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package system provides system interface primitives.

System Interface (R7RS 6.14)

  • command-line: return command-line arguments as list
  • exit: terminate with exit status
  • emergency-exit: terminate immediately without cleanup

Environment variable access (get-environment-variable, get-environment-variables) lives in the envvars extension. Implementation feature detection (features) lives in the introspection extension.

Time

  • current-second: current time as inexact seconds since epoch
  • current-jiffy: high-resolution monotonic time
  • jiffies-per-second: resolution of current-jiffy

Use Extension or AddToRegistry to register all primitives.

Package system provides system-level primitives.

Index

Constants

This section is empty.

Variables

View Source
var AddToRegistry = Builder.AddToRegistry

AddToRegistry registers all system primitives.

View Source
var Builder = registry.NewRegistryBuilder(addPrimitives)

Builder aggregates all system registration functions.

View Source
var Extension = registry.NewDescribedExtension("system",
	"System primitives: command-line, exit/emergency-exit, and time (current-second, current-jiffy, jiffies-per-second).",
	AddToRegistry)

Extension is the system extension.

View Source
var ProgramStartTime = time.Now()

ProgramStartTime is used for current-jiffy to measure elapsed time.

Functions

func PrimCommandLine

func PrimCommandLine(mc machine.CallContext) error

PrimCommandLine implements the (command-line) primitive per R7RS §6.14. Returns a list whose first element is the script name and the rest are script arguments. Falls back to os.Args when no script is being executed. Reading the host argv is gated as process:read, symmetric with the env:read gate on get-environment-variable: an embedder that installs a denying authorizer does not leak os.Args.

func PrimCurrentJiffy

func PrimCurrentJiffy(mc machine.CallContext) error

PrimCurrentJiffy implements the (current-jiffy) primitive. Returns current time in jiffies since program start.

func PrimCurrentSecond

func PrimCurrentSecond(mc machine.CallContext) error

PrimCurrentSecond implements the (current-second) primitive. Returns current time in seconds since Unix epoch.

func PrimEmergencyExit

func PrimEmergencyExit(mc machine.CallContext) error

PrimEmergencyExit implements the (emergency-exit) primitive. Exits the program immediately without cleanup or finalization.

func PrimExit

func PrimExit(mc machine.CallContext) error

PrimExit implements the (exit) primitive. Exits the program with an optional status code.

func PrimJiffiesPerSecond

func PrimJiffiesPerSecond(mc machine.CallContext) error

PrimJiffiesPerSecond implements the (jiffies-per-second) primitive. Returns the number of jiffies per second (1 billion nanoseconds).

func SetCommandLine added in v1.5.0

func SetCommandLine(args []string)

SetCommandLine sets the command-line arguments returned by (command-line). The first element should be the script name, followed by script arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL