def string_split_2(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("StringSplitImpl") func = module.get_or_insert_function( precomp_func.type.pointee, precomp_func.name) fnctx_arg = context.get_arguments(cgutils.get_function(builder))[0] cfnctx_arg = builder.bitcast(fnctx_arg, func.args[0].type) [s, sep] = args maxsplit = context.get_constant_struct(builder, IntVal, -1) cs = _conv_numba_struct_to_clang(builder, s, func.args[1].type) csep = _conv_numba_struct_to_clang(builder, sep, func.args[2].type) cmaxsplit = _conv_numba_struct_to_clang( builder, maxsplit, func.args[3].type) # result is StringVal with an array of StringVals in the buffer array_as_lowered_struct = builder.call( func, [cfnctx_arg, cs, csep, cmaxsplit]) array_as_struct = raise_return_type( context, builder, StringVal, array_as_lowered_struct) array_as_StringVal = StringValStruct( context, builder, value=array_as_struct) array_as_numba = context.make_array(sig.return_type)(context, builder) data_ptr = builder.bitcast( array_as_StringVal.ptr, array_as_numba.data.type) array_as_numba.data = data_ptr return array_as_numba._getvalue()
def string_split_2(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("StringSplitImpl") func = module.get_or_insert_function(precomp_func.type.pointee, precomp_func.name) fnctx_arg = context.get_arguments(cgutils.get_function(builder))[0] cfnctx_arg = builder.bitcast(fnctx_arg, func.args[0].type) [s, sep] = args maxsplit = context.get_constant_struct(builder, IntVal, -1) cs = _conv_numba_struct_to_clang(builder, s, func.args[1].type) csep = _conv_numba_struct_to_clang(builder, sep, func.args[2].type) cmaxsplit = _conv_numba_struct_to_clang(builder, maxsplit, func.args[3].type) # result is StringVal with an array of StringVals in the buffer array_as_lowered_struct = builder.call(func, [cfnctx_arg, cs, csep, cmaxsplit]) array_as_struct = raise_return_type(context, builder, StringVal, array_as_lowered_struct) array_as_StringVal = StringValStruct(context, builder, value=array_as_struct) array_as_numba = context.make_array(sig.return_type)(context, builder) data_ptr = builder.bitcast(array_as_StringVal.ptr, array_as_numba.data.type) array_as_numba.data = data_ptr return array_as_numba._getvalue()
def eq_stringval(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("EqStringValImpl") func = module.get_or_insert_function(precomp_func.type.pointee, precomp_func.name) [s1, s2] = args cs1 = _conv_numba_struct_to_clang(builder, s1, func.args[0].type) cs2 = _conv_numba_struct_to_clang(builder, s2, func.args[1].type) result = builder.call(func, [cs1, cs2]) return result # ret bool so no need to raise type
def add_stringval(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("AddStringValImpl") func = module.get_or_insert_function(precomp_func.type.pointee, precomp_func.name) fnctx_arg = context.get_arguments(cgutils.get_function(builder))[0] cfnctx_arg = builder.bitcast(fnctx_arg, func.args[0].type) [s1, s2] = args cs1 = _conv_numba_struct_to_clang(builder, s1, func.args[1].type) cs2 = _conv_numba_struct_to_clang(builder, s2, func.args[2].type) result = builder.call(func, [cfnctx_arg, cs1, cs2]) return raise_return_type(context, builder, StringVal, result)
def getitem_stringval(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("GetItemStringValImpl") func = module.get_or_insert_function(precomp_func.type.pointee, precomp_func.name) [s, i] = args cs = _conv_numba_struct_to_clang(builder, s, func.args[0].type) result = builder.call(func, [cs, i]) return raise_return_type(context, builder, StringVal, result)
def string_capitalize(context, builder, sig, args): module = cgutils.get_module(builder) precomp_func = context._get_precompiled_function("StringCapitalizeImpl") func = module.get_or_insert_function(precomp_func.type.pointee, precomp_func.name) fnctx_arg = context.get_arguments(cgutils.get_function(builder))[0] cfnctx_arg = builder.bitcast(fnctx_arg, func.args[0].type) [s] = args cs = _conv_numba_struct_to_clang(builder, s, func.args[1].type) result = builder.call(func, [cfnctx_arg, cs]) return raise_return_type(context, builder, StringVal, result)