extensions

package
v0.82.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 27 Imported by: 2

Documentation

Overview

Package mappings some go built in functions to grol functions. Same mechanism can be used to map other go functions to grol functions and further extend the language.

Index

Constants

View Source
const DefaultTrimSet = " \r\n\t"
View Source
const GrolFileExtension = ".gr" // Also the default filename for LoadSaveEmptyOnly.
View Source
const MaxImageDimension = 1024 // in pixels.

TODO: make this configurable and use the slice check as well as some sort of LRU.

Variables

This section is empty.

Functions

func HSLToRGB added in v0.66.0

func HSLToRGB(h, s, l float64) color.NRGBA

HSLToRGB converts HSL values to RGB. h, s and l in [0,1].

func Init

func Init(c *Config) error

Init initializes the extensions, can be called multiple time safely but should really be called only once before using GROL repl/eval. If the passed Config pointer is nil, default (safe) values are used.

func MustCreate added in v0.63.0

func MustCreate(ext object.Extension)

func TryParseTime added in v0.65.0

func TryParseTime(input string) (time.Time, error)

Types

type Config added in v0.41.0

type Config struct {
	HasLoad           bool // load() only present if this is true.
	HasSave           bool // save() only present if this is true.
	LoadSaveEmptyOnly bool // Restrict load/save to a single .gr file inside the current directory.
	UnrestrictedIOs   bool // Dangerous when true: can overwrite files, read any readable file etc...
}

Configure restrictions and features. Currently about IOs of load and save functions.

type GrolImage added in v0.68.0

type GrolImage struct {
	Image *image.NRGBA
	Vect  *vector.Rasterizer
	W, H  int
}

type ImageMap added in v0.66.0

type ImageMap map[object.Object]GrolImage

type OneFloatInOutFunc

type OneFloatInOutFunc func(float64) float64

Jump to

Keyboard shortcuts

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