id

package
v0.72.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 24 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

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 (
	GenerateTilH   bool
	GenerateTilC   bool
	GenerateTilCS  bool
	GenerateRpcH   bool
	GenerateRpcC   bool
	WriteAllColors bool
)
View Source
var (
	Verbose          bool            // Verbose gives more information on output if set. The value is injected from main packages.
	DryRun           bool            // DryRun if set, inhibits real changes
	FnJSON           = "til.json"    // FnJSON is the filename for the JSON formatted ID list.
	LIFnJSON         string          // LIFnJSON is the filename for the JSON formatted location information list.
	Min              = TriceID(1000) // Min is the smallest allowed ID for normal trices.
	Max              = TriceID(7999) // Max is the biggest allowed ID for normal trices.
	SearchMethod     = "random"      // SearchMethod is the next ID search method.
	LiPathIsRelative bool            // LiPathIsRelative causes to store relative paths instead of base names only inside li.json.
	Srcs             ArrayFlag       // Srcs gets multiple files or directories.
	IDRange          ArrayFlag       // IDPolicy gets ID ranges for Trice ID message channels like "err:".
	IDData           idData

	ExtendMacrosWithParamCount bool

	// DefaultTriceBitWidth tells the bit width of TRICE macros having no bit width in their names, like TRICE32 or TRICE8.
	//
	// One target can use only one bit width for bare TRICE macros and the setting inside the target code must match DefaultTriceBitWidth.
	DefaultTriceBitWidth = "32"

	// DefaultStampSize is used for written uppercase TRICE macros without ID|Id|id at all, to determine
	// if `trice insert` should put ID(n) for 32 OR Id(n) for 16 OR id(n) for 0 bis stamps.
	// Normally use TRice, Trice or trice to select the stamp size or write TRICE(ID(0)... or TRICE(Id(0)... or TRICE(id(0)... .
	DefaultStampSize = 32

	// StampSizeId gets set according to the DefaultStampSize value.
	StampSizeId string

	// SpaceInsideParenthesis set true, if your code autoformatter sets a space after opening braces.
	SpaceInsideParenthesis = false

	// TriceCacheEnabled needs to be true to use the Trice cache.
	TriceCacheEnabled bool

	// UserHomeDir needs to be changed for cache tests.
	UserHomeDir string
)
View Source
var Logging bool // Logging is true, when sub command log is active.
View Source
var SkipAdditionalChecks bool

Functions

func CompactSrcs added in v0.67.0

func CompactSrcs()

CompactSrcs adds local dir to Srcs if Srcs is empty and reduces variable Scrs to the minimum to address all intended folders.

func ConstructFullTriceInfo added in v0.72.4

func ConstructFullTriceInfo(origType string, paramCount int) (fullTriceType string, err error)

ConstructFullTriceInfo returns full TRICE info, if not exist in orig‚Type string For examples see TestConstructFullTriceInfo see also AddFmtCount

func CopyFileWithMTime added in v0.70.0

func CopyFileWithMTime(fSys *afero.Afero, dst, src string) error

CopyFileWithMTime copies file src into dst and sets dst mtime equal to src mtime.

func EvaluateIDRangeStrings added in v0.71.0

func EvaluateIDRangeStrings() error

EvaluateIDRangeStrings reads the -IDRange strings and fills the IDData.IDSpace accordingly. Each tag (like "err:") is allowed to occur only once, so a "e:" will fail after "err" was applied. IDRanges are not allowed to overlap.

func MTime added in v0.70.0

func MTime(fSys *afero.Afero, fName string) time.Time

func SubCmdAddToList added in v0.66.0

func SubCmdAddToList(w io.Writer, fSys *afero.Afero) (err error)

SubCmdAddToList extends the trice id list by 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.

func SubCmdGenerate added in v0.72.4

func SubCmdGenerate(w io.Writer, fSys *afero.Afero) (err error)

SubCmdIdGenerate performs sub-command generate, creating support files/output.

func SubCmdIdAdd added in v0.66.0

func SubCmdIdAdd(w io.Writer, fSys *afero.Afero) error

SubCmdIdAdd performs sub-command add, setting getting trice IDs from source tree to til.json.

func SubCmdIdClean added in v0.61.0

func SubCmdIdClean(w io.Writer, fSys *afero.Afero) error

SubCmdIdClean performs sub-command clean, zeroing or removing trice IDs from source tree.

func SubCmdIdInsert added in v0.61.0

func SubCmdIdInsert(w io.Writer, fSys *afero.Afero) (e error)

SubCmdIdInsert performs sub-command insert, adding trice IDs to source tree.

func ToFileTilH added in v0.72.4

func ToFileTilH(fSys afero.Fs, fn string) (err error)

ToFileTilH generates lang:C header file.

Types

type ArrayFlag added in v0.10.0

type ArrayFlag []string

ArrayFlag is a slice type for multi flag

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 TagEntry added in v0.71.0

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

TagEntry is a Trice tag specific ID space, specified with the -IDTag CLI switch. Example: "trice insert -IDTag err:10,99" specifies for the Trice tag "err" the ID space 10-99.

type TriceFmt added in v0.18.4

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

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

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 command line 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(w io.Writer, fSys *afero.Afero, fn string) TriceIDLookUp

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

func (TriceIDLookUp) AddFmtCount added in v0.26.0

func (ilu TriceIDLookUp) AddFmtCount(w io.Writer)

AddFmtCount adds inside ilu to all trice type names without format specifier count the appropriate count. Special Trices are ignored, but checked, because they have a fixed format specifier count: TRICE_S triceS TriceS TRiceS: 1 (1 value) TRICE_N triceN TriceN TRiceN: 1 (2 values) TRICE_B triceB TriceB TRiceB: 1 (2 values) TRICE_F triceF TriceF TRiceF: 0 (2 values) example change: `map[10000:{Trice8_2 hi %03u, %5x} 10001:{TRICE16 hi %03u, %5x}] `map[10000:{Trice8_2 hi %03u, %5x} 10001:{TRICE16_2 hi %03u, %5x}] ice" -> ice_n", ice8" -> ice8_n" B" -> B", F" -> F", S" -> S", N" -> N" _n" -> _n", see also ConstructFullTriceInfo

func (TriceIDLookUp) FileWatcher added in v0.18.4

func (lu TriceIDLookUp) FileWatcher(w io.Writer, fSys *afero.Afero, m *sync.RWMutex)

FileWatcher checks the 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 (ilu TriceIDLookUp) FromJSON(b []byte) (err error)

FromJSON converts JSON byte slice to ilu.

func (TriceIDLookUp) ToFileRpcC added in v0.72.4

func (ilu TriceIDLookUp) ToFileRpcC(fSys afero.Fs, fn string) (err error)

ToFileRpcC generates lang:C helpers for a third party tool.

func (TriceIDLookUp) ToFileTilC added in v0.72.4

func (ilu TriceIDLookUp) ToFileTilC(fSys afero.Fs, fn string) (err error)

ToFileTilC generates lang:C helpers for a third party tool.

func (TriceIDLookUp) ToFileTilCSharp added in v0.72.4

func (ilu TriceIDLookUp) ToFileTilCSharp(fSys afero.Fs, fn string) (err error)

ToFileTilCSharp generates C# helpers for a third party tool.

func (TriceIDLookUp) ToFileTriceRpcH added in v0.72.4

func (ilu TriceIDLookUp) ToFileTriceRpcH(fSys afero.Fs, fn string) (err error)

ToFileTriceRpcH generates RPC header file.

type TriceIDLookUpLI added in v0.53.0

type TriceIDLookUpLI map[TriceID]TriceLI

func NewLutLI added in v0.53.0

func NewLutLI(w io.Writer, fSys *afero.Afero, fn string) TriceIDLookUpLI

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

func (TriceIDLookUpLI) FileWatcher added in v0.53.0

func (li TriceIDLookUpLI) FileWatcher(w io.Writer, fSys *afero.Afero)

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

func (TriceIDLookUpLI) FromJSON added in v0.53.0

func (li TriceIDLookUpLI) FromJSON(b []byte) (err error)

FromJSON converts JSON byte slice to li.

type TriceIDs added in v0.56.0

type TriceIDs []TriceID

TriceIDs is a slice of trice IDs.

type TriceLI added in v0.53.0

type TriceLI struct {
	File string `json:"File"` // source file name of trice id
	Line int    `json:"Line"` // source file line of trice id
}

TriceLI is the trice location information assigned to a trice ID.

Jump to

Keyboard shortcuts

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