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