|
|
|
|
@ -50,59 +50,49 @@ func newCTypeInfos() *cTypeInfos {
|
|
|
|
|
mux : sync.RWMutex{},
|
|
|
|
|
cache: make(map[reflect.Type]func(value reflect.Value)CValue),
|
|
|
|
|
types: [maxCTypes+1]cTypeInfo{
|
|
|
|
|
|
|
|
|
|
/* 0 */ createCTypeInfo[any ](CTypeInvalid,"invalid" ,createCValueInvalid,
|
|
|
|
|
func(i *cTypeInfo) {
|
|
|
|
|
i.creators[createByPtr] = createCValueInvalid
|
|
|
|
|
i.creators[createByList] = createCValueInvalid
|
|
|
|
|
i.creators[createByLazy] = createCValueInvalid
|
|
|
|
|
}),
|
|
|
|
|
/* 1 */createCTypeInfo [any ](CTypeAny ,"any" ,CreateCValueAny),
|
|
|
|
|
/* 2 */createCTypeInfo [bool ](CTypeBool ,"bool" ,CreateCValueBool),
|
|
|
|
|
/* 3 */createCTypeInfo [int ](CTypeInt ,"int" ,CreateCValueInt),
|
|
|
|
|
/* 4 */createCTypeInfo [int8 ](CTypeInt8 ,"int8" ,CreateCValueInt8),
|
|
|
|
|
/* 5 */createCTypeInfo [int16 ](CTypeInt16 ,"int16" ,CreateCValueInt16),
|
|
|
|
|
/* 6 */createCTypeInfo [int32 ](CTypeInt32 ,"int32" ,CreateCValueInt32),
|
|
|
|
|
/* 7 */createCTypeInfo [int64 ](CTypeInt64 ,"int64" ,CreateCValueInt64),
|
|
|
|
|
/* 8 */createCTypeInfo [uint ](CTypeUint ,"uint" ,CreateCValueUint),
|
|
|
|
|
|
|
|
|
|
/* 9 */createCTypeInfo [uint8 ](CTypeUint8 ,"uint8" ,CreateCValueUint8,
|
|
|
|
|
/* 0 */createCTypeInfo[any ](CTypeInvalid ,"invalid" ,createCValueInvalid),
|
|
|
|
|
/* 1 */createCTypeInfo [any ](CTypeAny ,"any" ,CreateCValueAny),
|
|
|
|
|
/* 2 */createCTypeInfo [bool ](CTypeBool ,"bool" ,CreateCValueBool),
|
|
|
|
|
/* 3 */createCTypeInfo [int ](CTypeInt ,"int" ,CreateCValueInt),
|
|
|
|
|
/* 4 */createCTypeInfo [int8 ](CTypeInt8 ,"int8" ,CreateCValueInt8),
|
|
|
|
|
/* 5 */createCTypeInfo [int16 ](CTypeInt16 ,"int16" ,CreateCValueInt16),
|
|
|
|
|
/* 6 */createCTypeInfo [int32 ](CTypeInt32 ,"int32" ,CreateCValueInt32),
|
|
|
|
|
/* 7 */createCTypeInfo [int64 ](CTypeInt64 ,"int64" ,CreateCValueInt64),
|
|
|
|
|
/* 8 */createCTypeInfo [uint ](CTypeUint ,"uint" ,CreateCValueUint),
|
|
|
|
|
/* 9 */createCTypeInfo [uint8 ](CTypeUint8 ,"uint8" ,CreateCValueUint8,
|
|
|
|
|
// El []uint8 debe de ser considerado como de tipo bytes
|
|
|
|
|
func(i *cTypeInfo) {
|
|
|
|
|
i.creators[createByList] = func(v any) CValue { return CreateCValueBytes(v.([]uint8)) }
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
/* 10 */createCTypeInfo [uint16 ](CTypeUint16 ,"uint16" ,CreateCValueUint16),
|
|
|
|
|
/* 11 */createCTypeInfo [uint32 ](CTypeUint32 ,"uint32" ,CreateCValueUint32),
|
|
|
|
|
/* 12 */createCTypeInfo [uint64 ](CTypeUint64 ,"uint64" ,CreateCValueUint64),
|
|
|
|
|
/* 13 */createCTypeInfo [uintptr ](CTypeUintptr ,"uintptr" ,CreateCValueUintptr),
|
|
|
|
|
/* 14 */createCTypeInfo [float32 ](CTypeFloat32 ,"float32" ,CreateCValueFloat32),
|
|
|
|
|
/* 15 */createCTypeInfo [float64 ](CTypeFloat64 ,"float64" ,CreateCValueFloat64),
|
|
|
|
|
/* 16 */createCTypeInfo [complex64 ](CTypeComplex64,"complex64" ,CreateCValueComplex64),
|
|
|
|
|
/* 17 */createCTypeInfo [complex128 ](CTypeComplex128,"complex128" ,CreateCValueComplex128),
|
|
|
|
|
/* 18 */createCTypeInfo [Date ](CTypeDate ,"date" ,CreateCValueDate),
|
|
|
|
|
/* 19 */createCTypeInfo [Duration ](CTypeDuration ,"duration" ,CreateCValueDuration),
|
|
|
|
|
/* 20 */createCTypeInfo [string ](CTypeString ,"string" ,CreateCValueString),
|
|
|
|
|
/* 21 */createCTypeInfo [Bytes ](CTypeBytes ,"bytes" ,CreateCValueBytes),
|
|
|
|
|
/* 22 */createCTypeInfo [Stack ](CTypeStack ,"stack" ,CreateCValueStack),
|
|
|
|
|
/* 23 */createCTypeInfo [CValue ](CTypeCValue ,"cvalue" ,createCValueCValue),
|
|
|
|
|
|
|
|
|
|
/* 24 */createCTypeInfo [Packable ](CTypePackable ,"packable" ,CreateCValuePackable),
|
|
|
|
|
/* 25 */createCTypeInfo [Context ](CTypeContext ,"context" ,CreateCValueContext),
|
|
|
|
|
/* 26 */createCTypeInfo [error ](CTypeError ,"error" ,CreateCValueError),
|
|
|
|
|
|
|
|
|
|
/* 27 */createCTypeInfo [any ](CTypeNil ,"nil" ,CreateCValueNil),
|
|
|
|
|
/* 10 */createCTypeInfo [uint16 ](CTypeUint16 ,"uint16" ,CreateCValueUint16),
|
|
|
|
|
/* 11 */createCTypeInfo [uint32 ](CTypeUint32 ,"uint32" ,CreateCValueUint32),
|
|
|
|
|
/* 12 */createCTypeInfo [uint64 ](CTypeUint64 ,"uint64" ,CreateCValueUint64),
|
|
|
|
|
/* 13 */createCTypeInfo [uintptr ](CTypeUintptr ,"uintptr" ,CreateCValueUintptr),
|
|
|
|
|
/* 14 */createCTypeInfo [float32 ](CTypeFloat32 ,"float32" ,CreateCValueFloat32),
|
|
|
|
|
/* 15 */createCTypeInfo [float64 ](CTypeFloat64 ,"float64" ,CreateCValueFloat64),
|
|
|
|
|
/* 16 */createCTypeInfo [complex64 ](CTypeComplex64,"complex64" ,CreateCValueComplex64),
|
|
|
|
|
/* 17 */createCTypeInfo [complex128 ](CTypeComplex128,"complex128",CreateCValueComplex128),
|
|
|
|
|
/* 18 */createCTypeInfo [Date ](CTypeDate ,"date" ,CreateCValueDate),
|
|
|
|
|
/* 19 */createCTypeInfo [Duration ](CTypeDuration ,"duration" ,CreateCValueDuration),
|
|
|
|
|
/* 20 */createCTypeInfo [string ](CTypeString ,"string" ,CreateCValueString),
|
|
|
|
|
/* 21 */createCTypeInfo [Bytes ](CTypeBytes ,"bytes" ,CreateCValueBytes),
|
|
|
|
|
/* 22 */createCTypeInfo [Stack ](CTypeStack ,"stack" ,CreateCValueStack),
|
|
|
|
|
/* 23 */createCTypeInfo [CValue ](CTypeCValue ,"cvalue" ,createCValueCValue),
|
|
|
|
|
|
|
|
|
|
/* 24 */createCTypeInfo [Packable ](CTypePackable ,"packable" ,CreateCValuePackable),
|
|
|
|
|
/* 25 */createCTypeInfo [Context ](CTypeContext ,"context" ,CreateCValueContext),
|
|
|
|
|
/* 26 */createCTypeInfo [error ](CTypeError ,"error" ,CreateCValueError),
|
|
|
|
|
|
|
|
|
|
/* 27 */createCTypeInfo [any ](CTypeNil ,"nil" ,CreateCValueNil),
|
|
|
|
|
|
|
|
|
|
// Los tipos compuestos, solo pueden crearse por reflexion, las listas de los tipos claves ya estan
|
|
|
|
|
// definidas en el switch .(Type)
|
|
|
|
|
/* 28 */createCTypeInfo [any ](CTypeObject ,"object" ,createCValueInvalid),
|
|
|
|
|
/* 29 */createCTypeInfo [any ](CTypeLazy ,"lazy" ,createCValueInvalid),
|
|
|
|
|
/* 30 */createCTypeInfo [any ](CTypeList ,"list" ,createCValueInvalid),
|
|
|
|
|
/* 31 */createCTypeInfo [any ](CTypeMap ,"map" ,createCValueInvalid),
|
|
|
|
|
// Corresponde con el bit del flag del tipo de mapa, por lo que no puede generar un cvalue valido
|
|
|
|
|
/* 32 */createCTypeInfo [any ](CTypeInvalid,"invalid" ,createCValueInvalid),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 28 */createCTypeInfo [any ](CTypeObject ,"object" ,createCValueInvalid),
|
|
|
|
|
/* 29 */createCTypeInfo [any ](CTypeLazy ,"lazy" ,createCValueInvalid),
|
|
|
|
|
/* 30 */createCTypeInfo [any ](CTypeList ,"list" ,createCValueInvalid),
|
|
|
|
|
/* 31 */createCTypeInfo [any ](CTypeMap ,"map" ,createCValueInvalid),
|
|
|
|
|
//corresponde con el bit del flag del tipo de mapa, por lo que no puede generar un cvalue valido
|
|
|
|
|
/* 32 */createCTypeInfo [any ](CTypeInvalid ,"invalid" ,createCValueInvalid),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -124,7 +114,7 @@ func (i *cTypeInfos) getName(cType CType) string {
|
|
|
|
|
return "map@" + i.getName(k) + "|" + i.getName(v)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return i.types[getPos(cType)].name
|
|
|
|
|
return i.types[GetPos(cType)].name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -138,119 +128,119 @@ func (i *cTypeInfos) createCValue (value any) CValue {
|
|
|
|
|
|
|
|
|
|
switch value.(type) {
|
|
|
|
|
/* Valores simples */
|
|
|
|
|
//case any : f = i.types[getPos(CTypeAny )].creators[createByValue]
|
|
|
|
|
case bool : f = i.types[getPos(CTypeBool )].creators[createByValue]
|
|
|
|
|
case int : f = i.types[getPos(CTypeInt )].creators[createByValue]
|
|
|
|
|
case int8 : f = i.types[getPos(CTypeInt8 )].creators[createByValue]
|
|
|
|
|
case int16 : f = i.types[getPos(CTypeInt16 )].creators[createByValue]
|
|
|
|
|
case int32 : f = i.types[getPos(CTypeInt32 )].creators[createByValue]
|
|
|
|
|
case int64 : f = i.types[getPos(CTypeInt64 )].creators[createByValue]
|
|
|
|
|
case uint : f = i.types[getPos(CTypeUint )].creators[createByValue]
|
|
|
|
|
case uint8 : f = i.types[getPos(CTypeUint8 )].creators[createByValue]
|
|
|
|
|
case uint16 : f = i.types[getPos(CTypeUint16 )].creators[createByValue]
|
|
|
|
|
case uint32 : f = i.types[getPos(CTypeUint32 )].creators[createByValue]
|
|
|
|
|
case uint64 : f = i.types[getPos(CTypeUint64 )].creators[createByValue]
|
|
|
|
|
case uintptr : f = i.types[getPos(CTypeUintptr )].creators[createByValue]
|
|
|
|
|
case float32 : f = i.types[getPos(CTypeFloat32 )].creators[createByValue]
|
|
|
|
|
case float64 : f = i.types[getPos(CTypeFloat64 )].creators[createByValue]
|
|
|
|
|
case complex64 : f = i.types[getPos(CTypeComplex64 )].creators[createByValue]
|
|
|
|
|
case complex128 : f = i.types[getPos(CTypeComplex128)].creators[createByValue]
|
|
|
|
|
case Date : f = i.types[getPos(CTypeDate )].creators[createByValue]
|
|
|
|
|
case Duration : f = i.types[getPos(CTypeDuration )].creators[createByValue]
|
|
|
|
|
case string : f = i.types[getPos(CTypeString )].creators[createByValue]
|
|
|
|
|
case Bytes : f = i.types[getPos(CTypeBytes )].creators[createByValue]
|
|
|
|
|
case Stack : f = i.types[getPos(CTypeStack )].creators[createByValue]
|
|
|
|
|
case CValue : f = i.types[getPos(CTypeCValue )].creators[createByValue]
|
|
|
|
|
case Packable : f = i.types[getPos(CTypePackable )].creators[createByValue]
|
|
|
|
|
case Context : f = i.types[getPos(CTypeContext )].creators[createByValue]
|
|
|
|
|
case error : f = i.types[getPos(CTypeError )].creators[createByValue]
|
|
|
|
|
//case any : f = i.types[GetPos(CTypeAny )].creators[createByValue]
|
|
|
|
|
case bool : f = i.types[GetPos(CTypeBool )].creators[createByValue]
|
|
|
|
|
case int : f = i.types[GetPos(CTypeInt )].creators[createByValue]
|
|
|
|
|
case int8 : f = i.types[GetPos(CTypeInt8 )].creators[createByValue]
|
|
|
|
|
case int16 : f = i.types[GetPos(CTypeInt16 )].creators[createByValue]
|
|
|
|
|
case int32 : f = i.types[GetPos(CTypeInt32 )].creators[createByValue]
|
|
|
|
|
case int64 : f = i.types[GetPos(CTypeInt64 )].creators[createByValue]
|
|
|
|
|
case uint : f = i.types[GetPos(CTypeUint )].creators[createByValue]
|
|
|
|
|
case uint8 : f = i.types[GetPos(CTypeUint8 )].creators[createByValue]
|
|
|
|
|
case uint16 : f = i.types[GetPos(CTypeUint16 )].creators[createByValue]
|
|
|
|
|
case uint32 : f = i.types[GetPos(CTypeUint32 )].creators[createByValue]
|
|
|
|
|
case uint64 : f = i.types[GetPos(CTypeUint64 )].creators[createByValue]
|
|
|
|
|
case uintptr : f = i.types[GetPos(CTypeUintptr )].creators[createByValue]
|
|
|
|
|
case float32 : f = i.types[GetPos(CTypeFloat32 )].creators[createByValue]
|
|
|
|
|
case float64 : f = i.types[GetPos(CTypeFloat64 )].creators[createByValue]
|
|
|
|
|
case complex64 : f = i.types[GetPos(CTypeComplex64 )].creators[createByValue]
|
|
|
|
|
case complex128 : f = i.types[GetPos(CTypeComplex128)].creators[createByValue]
|
|
|
|
|
case Date : f = i.types[GetPos(CTypeDate )].creators[createByValue]
|
|
|
|
|
case Duration : f = i.types[GetPos(CTypeDuration )].creators[createByValue]
|
|
|
|
|
case string : f = i.types[GetPos(CTypeString )].creators[createByValue]
|
|
|
|
|
case Bytes : f = i.types[GetPos(CTypeBytes )].creators[createByValue]
|
|
|
|
|
case Stack : f = i.types[GetPos(CTypeStack )].creators[createByValue]
|
|
|
|
|
case CValue : f = i.types[GetPos(CTypeCValue )].creators[createByValue]
|
|
|
|
|
case Packable : f = i.types[GetPos(CTypePackable )].creators[createByValue]
|
|
|
|
|
case Context : f = i.types[GetPos(CTypeContext )].creators[createByValue]
|
|
|
|
|
case error : f = i.types[GetPos(CTypeError )].creators[createByValue]
|
|
|
|
|
|
|
|
|
|
/* Valores Listas */
|
|
|
|
|
case []any : f = i.types[getPos(CTypeAny )].creators[createByList]
|
|
|
|
|
case []bool : f = i.types[getPos(CTypeBool )].creators[createByList]
|
|
|
|
|
case []int : f = i.types[getPos(CTypeInt )].creators[createByList]
|
|
|
|
|
case []int8 : f = i.types[getPos(CTypeInt8 )].creators[createByList]
|
|
|
|
|
case []int16 : f = i.types[getPos(CTypeInt16 )].creators[createByList]
|
|
|
|
|
case []int32 : f = i.types[getPos(CTypeInt32 )].creators[createByList]
|
|
|
|
|
case []int64 : f = i.types[getPos(CTypeInt64 )].creators[createByList]
|
|
|
|
|
case []uint : f = i.types[getPos(CTypeUint )].creators[createByList]
|
|
|
|
|
case []any : f = i.types[GetPos(CTypeAny )].creators[createByList]
|
|
|
|
|
case []bool : f = i.types[GetPos(CTypeBool )].creators[createByList]
|
|
|
|
|
case []int : f = i.types[GetPos(CTypeInt )].creators[createByList]
|
|
|
|
|
case []int8 : f = i.types[GetPos(CTypeInt8 )].creators[createByList]
|
|
|
|
|
case []int16 : f = i.types[GetPos(CTypeInt16 )].creators[createByList]
|
|
|
|
|
case []int32 : f = i.types[GetPos(CTypeInt32 )].creators[createByList]
|
|
|
|
|
case []int64 : f = i.types[GetPos(CTypeInt64 )].creators[createByList]
|
|
|
|
|
case []uint : f = i.types[GetPos(CTypeUint )].creators[createByList]
|
|
|
|
|
// ya establecido como tipo base Bytes
|
|
|
|
|
//case []uint8 :
|
|
|
|
|
//
|
|
|
|
|
case []uint16 : f = i.types[getPos(CTypeUint16 )].creators[createByList]
|
|
|
|
|
case []uint32 : f = i.types[getPos(CTypeUint32 )].creators[createByList]
|
|
|
|
|
case []uint64 : f = i.types[getPos(CTypeUint64 )].creators[createByList]
|
|
|
|
|
case []uintptr : f = i.types[getPos(CTypeUintptr )].creators[createByList]
|
|
|
|
|
case []float32 : f = i.types[getPos(CTypeFloat32 )].creators[createByList]
|
|
|
|
|
case []float64 : f = i.types[getPos(CTypeFloat64 )].creators[createByList]
|
|
|
|
|
case []complex64: f = i.types[getPos(CTypeComplex64 )].creators[createByList]
|
|
|
|
|
case []complex128:f = i.types[getPos(CTypeComplex128)].creators[createByList]
|
|
|
|
|
case []Duration : f = i.types[getPos(CTypeDate )].creators[createByList]
|
|
|
|
|
case []Date : f = i.types[getPos(CTypeDuration )].creators[createByList]
|
|
|
|
|
case []string : f = i.types[getPos(CTypeString )].creators[createByList]
|
|
|
|
|
case []Bytes : f = i.types[getPos(CTypeBytes )].creators[createByList]
|
|
|
|
|
case []Stack : f = i.types[getPos(CTypeStack )].creators[createByList]
|
|
|
|
|
case []CValue : f = i.types[getPos(CTypeCValue )].creators[createByList]
|
|
|
|
|
case []Packable : f = i.types[getPos(CTypePackable )].creators[createByList]
|
|
|
|
|
case []Context : f = i.types[getPos(CTypeContext )].creators[createByList]
|
|
|
|
|
case []error : f = i.types[getPos(CTypeError )].creators[createByList]
|
|
|
|
|
case []uint16 : f = i.types[GetPos(CTypeUint16 )].creators[createByList]
|
|
|
|
|
case []uint32 : f = i.types[GetPos(CTypeUint32 )].creators[createByList]
|
|
|
|
|
case []uint64 : f = i.types[GetPos(CTypeUint64 )].creators[createByList]
|
|
|
|
|
case []uintptr : f = i.types[GetPos(CTypeUintptr )].creators[createByList]
|
|
|
|
|
case []float32 : f = i.types[GetPos(CTypeFloat32 )].creators[createByList]
|
|
|
|
|
case []float64 : f = i.types[GetPos(CTypeFloat64 )].creators[createByList]
|
|
|
|
|
case []complex64: f = i.types[GetPos(CTypeComplex64 )].creators[createByList]
|
|
|
|
|
case []complex128:f = i.types[GetPos(CTypeComplex128)].creators[createByList]
|
|
|
|
|
case []Duration : f = i.types[GetPos(CTypeDate )].creators[createByList]
|
|
|
|
|
case []Date : f = i.types[GetPos(CTypeDuration )].creators[createByList]
|
|
|
|
|
case []string : f = i.types[GetPos(CTypeString )].creators[createByList]
|
|
|
|
|
case []Bytes : f = i.types[GetPos(CTypeBytes )].creators[createByList]
|
|
|
|
|
case []Stack : f = i.types[GetPos(CTypeStack )].creators[createByList]
|
|
|
|
|
case []CValue : f = i.types[GetPos(CTypeCValue )].creators[createByList]
|
|
|
|
|
case []Packable : f = i.types[GetPos(CTypePackable )].creators[createByList]
|
|
|
|
|
case []Context : f = i.types[GetPos(CTypeContext )].creators[createByList]
|
|
|
|
|
case []error : f = i.types[GetPos(CTypeError )].creators[createByList]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Valores pasados por punteros */
|
|
|
|
|
//case *any : f = i.types[ 1/* Any */].creators[createByPtr]
|
|
|
|
|
case *bool : f = i.types[getPos(CTypeBool )].creators[createByPtr]
|
|
|
|
|
case *int : f = i.types[getPos(CTypeInt )].creators[createByPtr]
|
|
|
|
|
case *int8 : f = i.types[getPos(CTypeInt8 )].creators[createByPtr]
|
|
|
|
|
case *int16 : f = i.types[getPos(CTypeInt16 )].creators[createByPtr]
|
|
|
|
|
case *int32 : f = i.types[getPos(CTypeInt32 )].creators[createByPtr]
|
|
|
|
|
case *int64 : f = i.types[getPos(CTypeInt64 )].creators[createByPtr]
|
|
|
|
|
case *uint : f = i.types[getPos(CTypeUint )].creators[createByPtr]
|
|
|
|
|
case *uint8 : f = i.types[getPos(CTypeUint8 )].creators[createByPtr]
|
|
|
|
|
case *uint16 : f = i.types[getPos(CTypeUint16 )].creators[createByPtr]
|
|
|
|
|
case *uint32 : f = i.types[getPos(CTypeUint32 )].creators[createByPtr]
|
|
|
|
|
case *uint64 : f = i.types[getPos(CTypeUint64 )].creators[createByPtr]
|
|
|
|
|
case *uintptr : f = i.types[getPos(CTypeUintptr )].creators[createByPtr]
|
|
|
|
|
case *float32 : f = i.types[getPos(CTypeFloat32 )].creators[createByPtr]
|
|
|
|
|
case *float64 : f = i.types[getPos(CTypeFloat64 )].creators[createByPtr]
|
|
|
|
|
case *complex64 : f = i.types[getPos(CTypeComplex64 )].creators[createByPtr]
|
|
|
|
|
case *complex128: f = i.types[getPos(CTypeComplex128)].creators[createByPtr]
|
|
|
|
|
case *Duration : f = i.types[getPos(CTypeDate )].creators[createByPtr]
|
|
|
|
|
case *Date : f = i.types[getPos(CTypeDuration )].creators[createByPtr]
|
|
|
|
|
case *string : f = i.types[getPos(CTypeString )].creators[createByPtr]
|
|
|
|
|
case *Bytes : f = i.types[getPos(CTypeBytes )].creators[createByPtr]
|
|
|
|
|
case *Stack : f = i.types[getPos(CTypeStack )].creators[createByPtr]
|
|
|
|
|
case *CValue : f = i.types[getPos(CTypeCValue )].creators[createByPtr]
|
|
|
|
|
case *Packable : f = i.types[getPos(CTypePackable )].creators[createByPtr]
|
|
|
|
|
case *Context : f = i.types[getPos(CTypeContext )].creators[createByPtr]
|
|
|
|
|
case *error : f = i.types[getPos(CTypeError )].creators[createByPtr]
|
|
|
|
|
case *bool : f = i.types[GetPos(CTypeBool )].creators[createByPtr]
|
|
|
|
|
case *int : f = i.types[GetPos(CTypeInt )].creators[createByPtr]
|
|
|
|
|
case *int8 : f = i.types[GetPos(CTypeInt8 )].creators[createByPtr]
|
|
|
|
|
case *int16 : f = i.types[GetPos(CTypeInt16 )].creators[createByPtr]
|
|
|
|
|
case *int32 : f = i.types[GetPos(CTypeInt32 )].creators[createByPtr]
|
|
|
|
|
case *int64 : f = i.types[GetPos(CTypeInt64 )].creators[createByPtr]
|
|
|
|
|
case *uint : f = i.types[GetPos(CTypeUint )].creators[createByPtr]
|
|
|
|
|
case *uint8 : f = i.types[GetPos(CTypeUint8 )].creators[createByPtr]
|
|
|
|
|
case *uint16 : f = i.types[GetPos(CTypeUint16 )].creators[createByPtr]
|
|
|
|
|
case *uint32 : f = i.types[GetPos(CTypeUint32 )].creators[createByPtr]
|
|
|
|
|
case *uint64 : f = i.types[GetPos(CTypeUint64 )].creators[createByPtr]
|
|
|
|
|
case *uintptr : f = i.types[GetPos(CTypeUintptr )].creators[createByPtr]
|
|
|
|
|
case *float32 : f = i.types[GetPos(CTypeFloat32 )].creators[createByPtr]
|
|
|
|
|
case *float64 : f = i.types[GetPos(CTypeFloat64 )].creators[createByPtr]
|
|
|
|
|
case *complex64 : f = i.types[GetPos(CTypeComplex64 )].creators[createByPtr]
|
|
|
|
|
case *complex128: f = i.types[GetPos(CTypeComplex128)].creators[createByPtr]
|
|
|
|
|
case *Duration : f = i.types[GetPos(CTypeDate )].creators[createByPtr]
|
|
|
|
|
case *Date : f = i.types[GetPos(CTypeDuration )].creators[createByPtr]
|
|
|
|
|
case *string : f = i.types[GetPos(CTypeString )].creators[createByPtr]
|
|
|
|
|
case *Bytes : f = i.types[GetPos(CTypeBytes )].creators[createByPtr]
|
|
|
|
|
case *Stack : f = i.types[GetPos(CTypeStack )].creators[createByPtr]
|
|
|
|
|
case *CValue : f = i.types[GetPos(CTypeCValue )].creators[createByPtr]
|
|
|
|
|
case *Packable : f = i.types[GetPos(CTypePackable )].creators[createByPtr]
|
|
|
|
|
case *Context : f = i.types[GetPos(CTypeContext )].creators[createByPtr]
|
|
|
|
|
case *error : f = i.types[GetPos(CTypeError )].creators[createByPtr]
|
|
|
|
|
|
|
|
|
|
/* Valores pasados por functions Lazys */
|
|
|
|
|
case func()any : f = i.types[getPos(CTypeAny )].creators[createByLazy]
|
|
|
|
|
case func()bool : f = i.types[getPos(CTypeBool )].creators[createByLazy]
|
|
|
|
|
case func()int : f = i.types[getPos(CTypeInt )].creators[createByLazy]
|
|
|
|
|
case func()int8 : f = i.types[getPos(CTypeInt8 )].creators[createByLazy]
|
|
|
|
|
case func()int16 : f = i.types[getPos(CTypeInt16 )].creators[createByLazy]
|
|
|
|
|
case func()int32 : f = i.types[getPos(CTypeInt32 )].creators[createByLazy]
|
|
|
|
|
case func()int64 : f = i.types[getPos(CTypeInt64 )].creators[createByLazy]
|
|
|
|
|
case func()uint : f = i.types[getPos(CTypeUint )].creators[createByLazy]
|
|
|
|
|
case func()uint8 : f = i.types[getPos(CTypeUint8 )].creators[createByLazy]
|
|
|
|
|
case func()uint16 : f = i.types[getPos(CTypeUint16 )].creators[createByLazy]
|
|
|
|
|
case func()uint32 : f = i.types[getPos(CTypeUint32 )].creators[createByLazy]
|
|
|
|
|
case func()uint64 : f = i.types[getPos(CTypeUint64 )].creators[createByLazy]
|
|
|
|
|
case func()uintptr : f = i.types[getPos(CTypeUintptr )].creators[createByLazy]
|
|
|
|
|
case func()float32 : f = i.types[getPos(CTypeFloat32 )].creators[createByLazy]
|
|
|
|
|
case func()float64 : f = i.types[getPos(CTypeFloat64 )].creators[createByLazy]
|
|
|
|
|
case func()complex64: f = i.types[getPos(CTypeComplex64 )].creators[createByLazy]
|
|
|
|
|
case func()complex128:f = i.types[getPos(CTypeComplex128)].creators[createByLazy]
|
|
|
|
|
case func()Duration : f = i.types[getPos(CTypeDate )].creators[createByLazy]
|
|
|
|
|
case func()Date : f = i.types[getPos(CTypeDuration )].creators[createByLazy]
|
|
|
|
|
case func()string : f = i.types[getPos(CTypeString )].creators[createByLazy]
|
|
|
|
|
case func()Bytes : f = i.types[getPos(CTypeBytes )].creators[createByLazy]
|
|
|
|
|
case func()Stack : f = i.types[getPos(CTypeStack )].creators[createByLazy]
|
|
|
|
|
case func()CValue : f = i.types[getPos(CTypeCValue )].creators[createByLazy]
|
|
|
|
|
case func()Packable : f = i.types[getPos(CTypePackable )].creators[createByLazy]
|
|
|
|
|
case func()Context : f = i.types[getPos(CTypeContext )].creators[createByLazy]
|
|
|
|
|
case func()error : f = i.types[getPos(CTypeError )].creators[createByLazy]
|
|
|
|
|
case func()any : f = i.types[GetPos(CTypeAny )].creators[createByLazy]
|
|
|
|
|
case func()bool : f = i.types[GetPos(CTypeBool )].creators[createByLazy]
|
|
|
|
|
case func()int : f = i.types[GetPos(CTypeInt )].creators[createByLazy]
|
|
|
|
|
case func()int8 : f = i.types[GetPos(CTypeInt8 )].creators[createByLazy]
|
|
|
|
|
case func()int16 : f = i.types[GetPos(CTypeInt16 )].creators[createByLazy]
|
|
|
|
|
case func()int32 : f = i.types[GetPos(CTypeInt32 )].creators[createByLazy]
|
|
|
|
|
case func()int64 : f = i.types[GetPos(CTypeInt64 )].creators[createByLazy]
|
|
|
|
|
case func()uint : f = i.types[GetPos(CTypeUint )].creators[createByLazy]
|
|
|
|
|
case func()uint8 : f = i.types[GetPos(CTypeUint8 )].creators[createByLazy]
|
|
|
|
|
case func()uint16 : f = i.types[GetPos(CTypeUint16 )].creators[createByLazy]
|
|
|
|
|
case func()uint32 : f = i.types[GetPos(CTypeUint32 )].creators[createByLazy]
|
|
|
|
|
case func()uint64 : f = i.types[GetPos(CTypeUint64 )].creators[createByLazy]
|
|
|
|
|
case func()uintptr : f = i.types[GetPos(CTypeUintptr )].creators[createByLazy]
|
|
|
|
|
case func()float32 : f = i.types[GetPos(CTypeFloat32 )].creators[createByLazy]
|
|
|
|
|
case func()float64 : f = i.types[GetPos(CTypeFloat64 )].creators[createByLazy]
|
|
|
|
|
case func()complex64: f = i.types[GetPos(CTypeComplex64 )].creators[createByLazy]
|
|
|
|
|
case func()complex128:f = i.types[GetPos(CTypeComplex128)].creators[createByLazy]
|
|
|
|
|
case func()Duration : f = i.types[GetPos(CTypeDate )].creators[createByLazy]
|
|
|
|
|
case func()Date : f = i.types[GetPos(CTypeDuration )].creators[createByLazy]
|
|
|
|
|
case func()string : f = i.types[GetPos(CTypeString )].creators[createByLazy]
|
|
|
|
|
case func()Bytes : f = i.types[GetPos(CTypeBytes )].creators[createByLazy]
|
|
|
|
|
case func()Stack : f = i.types[GetPos(CTypeStack )].creators[createByLazy]
|
|
|
|
|
case func()CValue : f = i.types[GetPos(CTypeCValue )].creators[createByLazy]
|
|
|
|
|
case func()Packable : f = i.types[GetPos(CTypePackable )].creators[createByLazy]
|
|
|
|
|
case func()Context : f = i.types[GetPos(CTypeContext )].creators[createByLazy]
|
|
|
|
|
case func()error : f = i.types[GetPos(CTypeError )].creators[createByLazy]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if f != nil {
|
|
|
|
|
@ -433,7 +423,7 @@ func createCValueRAny (tname string) func(reflect.Value) CValue {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func getPos (t CType) int {
|
|
|
|
|
func GetPos(t CType) int {
|
|
|
|
|
if t == 0 {
|
|
|
|
|
// Si 't' es CType(0) (que corresponde a CTypeInvalid),
|
|
|
|
|
// se le asigna el índice 0. Esto es consistente con 'cTypeInfos[0]'
|
|
|
|
|
@ -455,12 +445,15 @@ func getPos (t CType) int {
|
|
|
|
|
// - El CType correspondiente al bit 1 (valor 2) mapea a 'cTypeInfos[2]'.
|
|
|
|
|
// - ... y así sucesivamente, hasta el CType para el bit 31 (valor 1 << 31)
|
|
|
|
|
// que mapearía al índice 32, el último índice válido en el array de 33 posiciones.
|
|
|
|
|
//
|
|
|
|
|
// si es un tipo compuesto debemos aplicar la mascara
|
|
|
|
|
if t.IsComposite() {
|
|
|
|
|
return bits.TrailingZeros32(uint32(t & maskCTypeComposite))+1
|
|
|
|
|
}
|
|
|
|
|
return bits.TrailingZeros32(uint32(t))+1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func reflectKindToCType (kind reflect.Kind, base bool) CType {
|
|
|
|
|
switch kind {
|
|
|
|
|
case reflect.Invalid: return CTypeInvalid
|
|
|
|
|
|