github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/setjmp.go (about) 1 package libs 2 3 import ( 4 "github.com/gotranspile/cxgo/types" 5 ) 6 7 const ( 8 setjmpH = "setjmp.h" 9 ) 10 11 func init() { 12 RegisterLibrary(setjmpH, func(c *Env) *Library { 13 gint := c.Go().Int() 14 bufT := types.NamedTGo("jmp_buf", "libc.JumpBuf", c.MethStructT(map[string]*types.FuncType{ 15 "SetJump": c.FuncTT(gint), 16 "LongJump": c.FuncTT(nil, gint), 17 })) 18 return &Library{ 19 Types: map[string]types.Type{ 20 "jmp_buf": bufT, 21 }, 22 Imports: map[string]string{ 23 "libc": RuntimeLibc, 24 }, 25 } 26 }) 27 }