github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/wctype.go (about) 1 package libs 2 3 import ( 4 "unicode" 5 6 "github.com/gotranspile/cxgo/runtime/libc" 7 "github.com/gotranspile/cxgo/types" 8 ) 9 10 // https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html 11 12 const ( 13 wctypeH = "wctype.h" 14 ) 15 16 func init() { 17 RegisterLibrary(wctypeH, func(c *Env) *Library { 18 runeT := c.Go().Rune() 19 isT := c.FuncTT(types.BoolT(), runeT) 20 toT := c.FuncTT(runeT, runeT) 21 return &Library{ 22 Imports: map[string]string{ 23 "libc": RuntimeLibc, 24 "unicode": "unicode", 25 }, 26 Idents: map[string]*types.Ident{ 27 "iswalpha": c.NewIdent("iswalpha", "libc.IsAlpha", libc.IsAlpha, isT), 28 "iswalnum": c.NewIdent("iswalnum", "libc.IsAlnum", libc.IsAlnum, isT), 29 //"iswblank": c.NewIdent("iswblank", "libc.IsBlank", libc.IsBlank, isT), 30 "iswcntrl": c.NewIdent("iswcntrl", "unicode.IsControl", unicode.IsControl, isT), 31 "iswdigit": c.NewIdent("iswdigit", "unicode.IsDigit", unicode.IsDigit, isT), 32 "iswgraph": c.NewIdent("iswgraph", "unicode.IsGraphic", unicode.IsGraphic, isT), 33 "iswlower": c.NewIdent("iswlower", "unicode.IsLower", unicode.IsLower, isT), 34 "iswprint": c.NewIdent("iswprint", "unicode.IsPrint", unicode.IsPrint, isT), 35 "iswpunct": c.NewIdent("iswpunct", "unicode.IsPunct", unicode.IsPunct, isT), 36 "iswspace": c.NewIdent("iswspace", "unicode.IsSpace", unicode.IsSpace, isT), 37 "iswupper": c.NewIdent("iswupper", "unicode.IsUpper", unicode.IsUpper, isT), 38 "towlower": c.NewIdent("towlower", "unicode.ToLower", unicode.ToLower, toT), 39 "towupper": c.NewIdent("towupper", "unicode.ToUpper", unicode.ToUpper, toT), 40 }, 41 } 42 }) 43 }