system

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 9 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
  • get-environment-variable: get environment variable value
  • get-environment-variables: get all environment variables

Features

  • features: return list of implementation features

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.NewExtension("system", 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.MachineContext) 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.

func PrimCurrentJiffy

func PrimCurrentJiffy(mc *machine.MachineContext) error

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

func PrimCurrentSecond

func PrimCurrentSecond(mc *machine.MachineContext) error

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

func PrimEmergencyExit

func PrimEmergencyExit(mc *machine.MachineContext) error

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

func PrimExit

func PrimExit(mc *machine.MachineContext) error

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

func PrimGetEnvironmentVariable

func PrimGetEnvironmentVariable(mc *machine.MachineContext) error

PrimGetEnvironmentVariable implements the (get-environment-variable) primitive. Gets environment variable value.

func PrimGetEnvironmentVariables

func PrimGetEnvironmentVariables(mc *machine.MachineContext) error

PrimGetEnvironmentVariables implements the (get-environment-variables) primitive. Returns all environment variables.

func PrimJiffiesPerSecond

func PrimJiffiesPerSecond(mc *machine.MachineContext) 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