id

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package id List is responsible for id List managing

Package id List is responsible for id List managing

Package id List is responsible for id List managing

Index

Constants

This section is empty.

Variables

View Source
var (
	// Verbose gives mor information on output if set. The value is injected from main packages.
	Verbose bool

	// DryRun if set, inhibits real changes
	DryRun bool

	// FnJSON is the filename for the JSON formatted ID list.
	FnJSON string

	// MinShort is the smallest allowed ID for short trices.
	MinShort = TriceID(1)

	// MaxShort is the biggest allowed ID for short trices.
	MaxShort = TriceID(32767)

	// Min is the smallest allowed ID for normal trices.
	Min = TriceID(32768)

	// Max is the biggest allowed ID for normal trices.
	Max = TriceID(65535)

	// SearchMethod is the next ID search method.
	SearchMethod = "random"

	// SharedIDs true: TriceFmt's without TriceID get equal TriceID if an equal TriceFmt exists already.
	// SharedIDs false: TriceFmt's without TriceID get a different TriceID if an equal TriceFmt exists already.
	SharedIDs = true
)

Functions

func ConditionalFilePath added in v0.10.0

func ConditionalFilePath(fn string) string

ConditionalFilePath returns absolute file path if fn is not "off" or "none".

func ScZero

func ScZero(SrcZ string, cmd *flag.FlagSet) error

ScZero does replace all ID's in source tree with 0

func SubCmdReNewList added in v0.18.4

func SubCmdReNewList() (err error)

SubCmdReNewList renews the trice id list parsing the source tree without changing any source file. It creates a new FnJSON and tries to add id:tf pairs from the source tree. If equal tf are found with different ids they are all added. If the same id is found with different tf only one is added. The others are reported as warning. If any TRICE* is found without Id(n) or with Id(0) it is ignored. SubCmdUpdate needs to know which IDs are used in the source tree to reliable add new IDs.

func SubCmdRefreshList added in v0.18.4

func SubCmdRefreshList() (err error)

SubCmdRefreshList refreshes the trice id list parsing the source tree without changing any source file. It only reads FnJSON and tries to add id:tf pairs from the source tree. If equal tf are found with different ids they are all added. If the same id is found with different tf only one is added. The others are reported as warning. If any TRICE* is found without Id(n) or with Id(0) it is ignored. SubCmdUpdate needs to know which IDs are used in the source tree to reliable add new IDs.

func SubCmdUpdate added in v0.18.4

func SubCmdUpdate() error

SubCmdUpdate is subcommand update

func ZeroSourceTreeIds added in v0.10.0

func ZeroSourceTreeIds(srcRoot string, run bool)

ZeroSourceTreeIds is overwriting with 0 all id's from source code tree srcRoot. It does not touch idlist.

Types

type ArrayFlag added in v0.10.0

type ArrayFlag []string

ArrayFlag is a slice type for multi flag

var (
	// Srcs gets multiple files or directories.
	Srcs ArrayFlag
)

func (*ArrayFlag) Set added in v0.10.0

func (i *ArrayFlag) Set(value string) error

Set is a needed method for multi flags.

func (*ArrayFlag) String added in v0.10.0

func (i *ArrayFlag) String() string

String method is the needed for interface satisfaction.

type TriceFmt added in v0.18.4

type TriceFmt struct {
	Type string `json:"Type"` // format type (bitsize and number of fmt string parameters)
	Strg string `json:"Strg"` // format string
}

TriceFmt is the trice format information assigned to a trice ID.

type TriceFmtLookUp added in v0.18.4

type TriceFmtLookUp map[TriceFmt]TriceID

TriceFmtLookUp is the TriceFmt-to-ID info translation map. Equal TriceFmt cannot have different IDs in this translation map.

It is derived from IDLookUp reversing it and can be used during SharedUpdate of src tree. Example: A:1, !C:5, C:7 (C.7 will overwrite C:5) If in source code equal TriceFmt's have different IDs they are not touched. If an additional equal TriceFmt occures without ID it gets one of the already for this format string used IDs. This is the default. For forcing different IDs on equal Fmt's a SolitaryUpdate function is needed. (to do)

type TriceID added in v0.18.4

type TriceID int

TriceID is the trice ID referencing to Fmt.

func (*TriceID) Set added in v0.18.4

func (id *TriceID) Set(value string) error

Set implements part of flag.Value interface. It initializes id from the partial commandline string

func (*TriceID) String added in v0.18.4

func (id *TriceID) String() string

String implements part of flag.Value interface. It returns id as string.

type TriceIDLookUp added in v0.18.4

type TriceIDLookUp map[TriceID]TriceFmt

TriceIDLookUp is the ID-to-TriceFmt info translation map. Different IDs can refer to equal TriceFmt's. It is used during logging. Example: 1:A, 5:C, 7:C An ID can point to one and only format string.

func NewLut added in v0.18.4

func NewLut(fn string) TriceIDLookUp

NewLut returns a look-up map generated from JSON map file named fn.

func (TriceIDLookUp) FileWatcher added in v0.18.4

func (lu TriceIDLookUp) FileWatcher(m *sync.RWMutex)

FileWatcher checks id List file for changes taken from https://medium.com/@skdomino/watch-this-file-watching-in-go-5b5a247cf71f

func (TriceIDLookUp) FromJSON added in v0.18.4

func (lu TriceIDLookUp) FromJSON(b []byte) (err error)

FromJSON converts JSON byte slice to lu.

Jump to

Keyboard shortcuts

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