utils

package
v0.0.0-...-0e42c13 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Is_Enable_amd64 = false

Variables

View Source
var Debug string
View Source
var Ext = ""
View Source
var MapSet = sync.Pool{
	New: func() interface{} {
		return make(map[string]struct{})
	},
}
View Source
var StdOne = make(map[string]StdInfo, 0)
View Source
var UROOT string

Functions

func Deferfunc

func Deferfunc()

func Elem

func Elem(T string) (string, string, bool)

element type 返回连续类型的元素类型与长度,以及是不是连续类型

func FindU

func FindU(dir string) ([]string, error)

FindU 寻找目录下的U文件

func GenerateGenericTypes

func GenerateGenericTypes(BaseName string, ActualType []string) string

GenerateGenericTypes 生成已经实际实例化的泛型类型名

func GeneratePackageSymbol

func GeneratePackageSymbol(packageName string, Name string) string

GeneratePackageSymbol 生成包含包名的符号

func Generate_mempool_Name

func Generate_mempool_Name(linenum int, filename string) string

Generate_mempool_Name 生成 自动释放快 的实现 内存池变量名 - linenum是行号 - filename是文件名

func IsNil

func IsNil(n interface{}) bool

IsNil 判断接口存储的值是否为nil

func IsNoType

func IsNoType(kind enum.Symbol) bool

IsNoType 判断是否不是类型

func IsPtr

func IsPtr(typ string) bool

IsPtr 判断类型是不是指针类型

func Is_In_AutoFree

func Is_In_AutoFree(name string) bool

Is_In_AutoFree 返回是否是在自动释放块内函数

func MoveFile

func MoveFile(oldname, newname string) error

MoveFile 实现移动文件

func MustErr

func MustErr(err error)

MustErr 对于非空错误,panic

func NoExtBase

func NoExtBase(f string) string

NoExtBase 调用 filepath.Base 并去除扩展名

func PutMapSet

func PutMapSet(m map[string]struct{})

func ReadAllLine

func ReadAllLine(r *bufio.Reader) ([]string, error)

ReadAllLine 读取全部并按行分割

func Ret_no_lea

func Ret_no_lea(s string) string

Ret_no_lea 返回类型的非取地址表示

func Ret_type_no_lea

func Ret_type_no_lea(s string) (string, int)

Ret_type_no_lea 返回类型的非取地址表示,以及包含几个取地址

  • 对于 &T,返回T,1
  • 对于 T,返回T,0

func Split_package_name

func Split_package_name(s string) (string, string)

Split_package_name 返回去除包名的字符串

func Typ_is_equal

func Typ_is_equal(src1 string, src2 string) bool

Typ_is_equal 判等两个类型是否相等

Types

type StdInfo

type StdInfo struct {
	CFile []string
	HDir  []string
}

type WaitGroup

type WaitGroup struct {
	Thread bool
	// contains filtered or unexported fields
}

WaitGroup 用来管理一组同时以并发或串行执行的函数

func NewWaitGroup

func NewWaitGroup(Thread bool) *WaitGroup

NewWaitGroup 从 sync.Pool 中获取一个 *WaitGroup

func (*WaitGroup) Add

func (wg *WaitGroup) Add()

Add 记录新增执行一个函数

func (*WaitGroup) Close

func (wg *WaitGroup) Close()

Close 将 一个 *WaitGroup 放入 sync.Pool

func (*WaitGroup) Done

func (wg *WaitGroup) Done()

Done 记录一个函数执行完毕

func (*WaitGroup) Go

func (wg *WaitGroup) Go(f func())

Go 执行一个函数,该函数没有参数,该函数无需调用 WaitGroup.Add

  • 如果以串行执行,调用传入函数,执行完毕后返回
  • 如果以并发执行,安排传入函数在一个goroutine执行,然后直接返回

func (*WaitGroup) GoI

func (wg *WaitGroup) GoI(f func(gi int), i int)

GoI 执行一个函数,该函数接受一个int型参数,该函数无需调用 WaitGroup.Add

  • 如果以串行执行,调用传入函数,执行完毕后返回
  • 如果以并发执行,安排传入函数在一个goroutine执行,然后直接返回

func (*WaitGroup) GoI2

func (wg *WaitGroup) GoI2(f func(i1, i2 int), i1, i2 int)

GoI2 执行一个函数,该函数接受两个int型参数,该函数无需调用 WaitGroup.Add

  • 如果以串行执行,调用传入函数,执行完毕后返回
  • 如果以并发执行,安排传入函数在一个goroutine执行,然后直接返回

func (*WaitGroup) Wait

func (wg *WaitGroup) Wait()

Wait 等待所有函数执行完毕

Jump to

Keyboard shortcuts

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