lib.go 779 B

12345678910111213141516171819202122232425262728293031
  1. package lib
  2. import . "kumachan/runtime/common"
  3. var NativeFunctionMaps = [] map[string]interface{} {
  4. ArithmeticFunctions,
  5. BitwiseFunctions,
  6. }
  7. var NativeFunctionMap map[string] NativeFunction
  8. var NativeFunctionIndex map[string] int
  9. var NativeFunctions [] NativeFunction
  10. var _ = func() interface{} {
  11. NativeFunctionMap = make(map[string] NativeFunction)
  12. for _, category := range NativeFunctionMaps {
  13. for name, f := range category {
  14. NativeFunctionMap[name] = AdaptNativeFunction(f)
  15. }
  16. }
  17. NativeFunctionIndex = make(map[string]int, len(NativeFunctionMap))
  18. NativeFunctions = make([]NativeFunction, len(NativeFunctionMap))
  19. var i = 0
  20. for name, f := range NativeFunctionMap {
  21. NativeFunctionIndex[name] = i
  22. NativeFunctions[i] = f
  23. i += 1
  24. }
  25. return nil
  26. } ()