lib

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const RWRR = 0755

Variables

View Source
var Hooks map[string][]*zygo.SexpSymbol

needs to be global because we can't feed an cfg object to AddHook() which is being called from user lisp code

Functions

func AddHook added in v1.0.17

func AddHook(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

AddHook() (called addhook from lisp code) can be used by the user to add a function to one of the available hooks provided by tablizer.

func Exists added in v1.2.0

func Exists[K comparable, V any](m map[K]V, v K) bool

generic map.Exists(key)

func FilterByPattern added in v1.2.0

func FilterByPattern(conf cfg.Config, input io.Reader) (io.Reader, error)

func HookExists added in v1.0.17

func HookExists(key string) bool

Check if a hook exists

func LoadAndEvalFile added in v1.2.0

func LoadAndEvalFile(env *zygo.Zlisp, path string) error

* Basic sanity checks and load lisp file

func PrepareColumns

func PrepareColumns(conf *cfg.Config, data *Tabdata) error

parse columns list given with -c, modifies config.UseColumns based on eventually given regex

func ProcessFiles

func ProcessFiles(conf *cfg.Config, args []string) error

func RegisterLib added in v1.0.17

func RegisterLib(env *zygo.Zlisp)

func RunFilterHooks added in v1.0.17

func RunFilterHooks(conf cfg.Config, line string) (bool, error)

Execute every user lisp function registered as filter hook.

Each function is given the current line as argument and is expected to return a boolean. True indicates to keep the line, false to skip it.

If there are multiple such functions registered, then the first one returning false wins, that is if each function returns true the line will be kept, if at least one of them returns false, it will be skipped.

func SetupLisp added in v1.0.17

func SetupLisp(conf *cfg.Config) error

* Setup lisp interpreter environment

func Splice2SexpList added in v1.0.17

func Splice2SexpList(list []string) zygo.Sexp

func String2Int added in v1.0.17

func String2Int(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

func StringReSplit added in v1.0.17

func StringReSplit(env *zygo.Zlisp, name string, args []zygo.Sexp) (zygo.Sexp, error)

Types

type Tabdata

type Tabdata struct {
	// contains filtered or unexported fields
}

contains a whole parsed table

func FilterByFields added in v1.2.0

func FilterByFields(conf cfg.Config, data Tabdata) (Tabdata, bool, error)

* Filter parsed data by fields. The filter is positive, so if one or * more filters match on a row, it will be kept, otherwise it will be * excluded.

func Parse added in v1.0.12

func Parse(conf cfg.Config, input io.Reader) (Tabdata, error)

Parser switch

func RunProcessHooks added in v1.0.17

func RunProcessHooks(conf cfg.Config, data Tabdata) (Tabdata, bool, error)

These hooks get the data (Tabdata) readily processed by tablizer as argument. They are expected to return a SexpPair containing a boolean denoting if the data has been modified and the actual modified data. Columns must be the same, rows may differ. Cells may also have been modified.

Replaces the internal data structure Tabdata with the user supplied version.

Only one process hook function is supported.

The somewhat complicated code is being caused by the fact, that we need to convert our internal structure to a lisp variable and vice versa afterwards.

func (*Tabdata) CloneEmpty added in v1.2.0

func (data *Tabdata) CloneEmpty() Tabdata

Jump to

Keyboard shortcuts

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