github.com/gotranspile/cxgo@v0.3.7/libs/fenv.go (about)

     1  package libs
     2  
     3  import (
     4  	"github.com/gotranspile/cxgo/runtime/cmath"
     5  	"github.com/gotranspile/cxgo/types"
     6  )
     7  
     8  const (
     9  	fenvH = "fenv.h"
    10  )
    11  
    12  func init() {
    13  	RegisterLibrary(fenvH, func(c *Env) *Library {
    14  		gint := c.Go().Int()
    15  		intT := types.IntT(4)
    16  		return &Library{
    17  			Imports: map[string]string{
    18  				"cmath": RuntimePrefix + "cmath",
    19  			},
    20  			Idents: map[string]*types.Ident{
    21  				"FE_TOWARDZERO": c.NewIdent("FE_TOWARDZERO", "cmath.TowardZero", cmath.TowardZero, gint),
    22  				"fesetround":    c.NewIdent("fesetround", "cmath.FSetRound", cmath.FSetRound, c.FuncTT(intT, intT)),
    23  			},
    24  			// TODO
    25  			Header: `
    26  #include <` + BuiltinH + `>
    27  const _cxgo_go_int FE_TOWARDZERO = 1;
    28  _cxgo_sint32 fesetround(_cxgo_sint32 round);
    29  `,
    30  		}
    31  	})
    32  }