<commit_before>// Copyright ©2017 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rmeta

import (
	"fmt"
	"reflect"
	"strings"

	"go-hep.org/x/hep/groot/root"
)

var GoType2ROOTEnum = map[reflect.Type]Enum{
	reflect.TypeOf(int8(0)):  Char,
	reflect.TypeOf(int16(0)): Short,
	reflect.TypeOf(int32(0)): Int,
	reflect.TypeOf(int64(0)): Long,
	//	reflect.TypeOf(int64(0)): Long64,
	reflect.TypeOf(float32(0)): Float,
	reflect.TypeOf(float64(0)): Double,
	reflect.TypeOf(uint8(0)):   UChar,
	//	reflect.TypeOf(uint8(0)): CharStar,
	reflect.TypeOf(uint16(0)): UShort,
	reflect.TypeOf(uint32(0)): UInt,
	reflect.TypeOf(uint64(0)): ULong,
	//	reflect.TypeOf(uint64(0)): ULong64,
	reflect.TypeOf(false):            Bool,
	reflect.TypeOf(root.Float16(0)):  Float16,
	reflect.TypeOf(root.Double32(0)): Double32,
	reflect.TypeOf(""):               TString,
}

var GoType2Cxx = map[string]string{
	"bool":    "bool",
	"byte":    "unsigned char",
	"uint":    "unsigned int",
	"uint8":   "unsigned char",
	"uint16":  "unsigned short",
	"uint32":  "unsigned int",
	"uint64":  "unsigned long",
	"int":     "int",
	"int8":    "char",
	"int16":   "short",
	"int32":   "int",
	"int64":   "long",
	"float32": "float",
	"float64": "double",
}

var CxxBuiltins = map[string]reflect.Type{
	"bool": reflect.TypeOf(false),

	/*
		"uint":   reflect.TypeOf(uint(0)),
		"uint8":  reflect.TypeOf(uint8(0)),
		"uint16": reflect.TypeOf(uint16(0)),
		"uint32": reflect.TypeOf(uint32(0)),
		"uint64": reflect.TypeOf(uint64(0)),

		"int":   reflect.TypeOf(int(0)),
		"int8":  reflect.TypeOf(int8(0)),
		"int16": reflect.TypeOf(int16(0)),
		"int32": reflect.TypeOf(int32(0)),
		"int64": reflect.TypeOf(int64(0)),

		"float32": reflect.TypeOf(float32(0)),
		"float64": reflect.TypeOf(float64(0)),
	*/

	// C/C++ builtins

	"unsigned":       reflect.TypeOf(uint(0)),
	"unsigned char":  reflect.TypeOf(uint8(0)),
	"unsigned short": reflect.TypeOf(uint16(0)),
	"unsigned int":   reflect.TypeOf(uint32(0)),
	"unsigned long":  reflect.TypeOf(uint64(0)),<commit_msg>groot/rmeta: add stdint to CxxBuiltins<commit_after>// Copyright ©2017 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package rmeta

import (
	"fmt"
	"reflect"
	"strings"

	"go-hep.org/x/hep/groot/root"
)

var GoType2ROOTEnum = map[reflect.Type]Enum{
	reflect.TypeOf(int8(0)):  Char,
	reflect.TypeOf(int16(0)): Short,
	reflect.TypeOf(int32(0)): Int,
	reflect.TypeOf(int64(0)): Long,
	//	reflect.TypeOf(int64(0)): Long64,
	reflect.TypeOf(float32(0)): Float,
	reflect.TypeOf(float64(0)): Double,
	reflect.TypeOf(uint8(0)):   UChar,
	//	reflect.TypeOf(uint8(0)): CharStar,
	reflect.TypeOf(uint16(0)): UShort,
	reflect.TypeOf(uint32(0)): UInt,
	reflect.TypeOf(uint64(0)): ULong,
	//	reflect.TypeOf(uint64(0)): ULong64,
	reflect.TypeOf(false):            Bool,
	reflect.TypeOf(root.Float16(0)):  Float16,
	reflect.TypeOf(root.Double32(0)): Double32,
	reflect.TypeOf(""):               TString,
}

var GoType2Cxx = map[string]string{
	"bool":    "bool",
	"byte":    "unsigned char",
	"uint":    "unsigned int",
	"uint8":   "unsigned char",
	"uint16":  "unsigned short",
	"uint32":  "unsigned int",
	"uint64":  "unsigned long",
	"int":     "int",
	"int8":    "char",
	"int16":   "short",
	"int32":   "int",
	"int64":   "long",
	"float32": "float",
	"float64": "double",
}

var CxxBuiltins = map[string]reflect.Type{
	"bool": reflect.TypeOf(false),

	/*
		"uint":   reflect.TypeOf(uint(0)),
		"uint8":  reflect.TypeOf(uint8(0)),
		"uint16": reflect.TypeOf(uint16(0)),
		"uint32": reflect.TypeOf(uint32(0)),
		"uint64": reflect.TypeOf(uint64(0)),

		"int":   reflect.TypeOf(int(0)),
		"int8":  reflect.TypeOf(int8(0)),
		"int16": reflect.TypeOf(int16(0)),
		"int32": reflect.TypeOf(int32(0)),
		"int64": reflect.TypeOf(int64(0)),

		"float32": reflect.TypeOf(float32(0)),
		"float64": reflect.TypeOf(float64(0)),
	*/

	// stdint
	"int8_t":   reflect.TypeOf(int8(0)),
	"int16_t":  reflect.TypeOf(int16(0)),
	"int32_t":  reflect.TypeOf(int32(0)),
	"int64_t":  reflect.TypeOf(int64(0)),
	"uint8_t":  reflect.TypeOf(uint8(0)),
	"uint16_t": reflect.TypeOf(uint16(0)),
	"uint32_t": reflect.TypeOf(uint32(0)),
	"uint64_t": reflect.TypeOf(uint64(0)),

	// C/C++ builtins

	"unsigned":       reflect.TypeOf(uint32(0)),
	"unsigned char":  reflect.TypeOf(uint8(0)),
	"unsigned short": reflect.TypeOf(uint16(0)),
	"unsigned int":   reflect.TypeOf(uint32(0)),
	"unsigned long":  reflect.TypeOf(uint64(0)),
{'fraction_non_alphanumeric': 0.20082411624376492, 'fraction_numerical': 0.06636304489264802, 'mean_word_length': 4.6107055961070555, 'pattern_counts': {'":': 72, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3664514', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1856, 'n_words': 328}