@@ -2913,6 +2913,120 @@ delimited_to_arrays(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
2913
2913
}
2914
2914
2915
2915
2916
+ static char * str_to_array_1d_kwarg_names [] = {
2917
+ "record" ,
2918
+ "split" ,
2919
+ "dtypes" ,
2920
+ "delimiter" ,
2921
+ "doublequote" ,
2922
+ "escapechar" ,
2923
+ "quotechar" ,
2924
+ "quoting" ,
2925
+ "skipinitialspace" ,
2926
+ "strict" ,
2927
+ "thousandschar" ,
2928
+ "decimalchar" ,
2929
+ NULL
2930
+ };
2931
+
2932
+ static PyObject *
2933
+ str_to_array_1d (PyObject * Py_UNUSED (m ), PyObject * args , PyObject * kwargs )
2934
+ {
2935
+ PyObject * record ;
2936
+ int split = -1 ; // index at which to select field for left partition
2937
+ PyObject * dtypes = NULL ;
2938
+ PyObject * delimiter = NULL ;
2939
+ PyObject * doublequote = NULL ;
2940
+ PyObject * escapechar = NULL ;
2941
+ PyObject * quotechar = NULL ;
2942
+ PyObject * quoting = NULL ;
2943
+ PyObject * skipinitialspace = NULL ;
2944
+ PyObject * strict = NULL ;
2945
+ PyObject * thousandschar = NULL ;
2946
+ PyObject * decimalchar = NULL ;
2947
+
2948
+ if (!PyArg_ParseTupleAndKeywords (args , kwargs ,
2949
+ "O|$iOOOOOOOOOO:str_to_array_1d" ,
2950
+ delimited_to_ararys_kwarg_names ,
2951
+ & record ,
2952
+ // kwarg only
2953
+ & split ,
2954
+ & dtypes ,
2955
+ & delimiter ,
2956
+ & doublequote ,
2957
+ & escapechar ,
2958
+ & quotechar ,
2959
+ & quoting ,
2960
+ & skipinitialspace ,
2961
+ & strict ,
2962
+ & thousandschar ,
2963
+ & decimalchar ))
2964
+ return NULL ;
2965
+
2966
+ // TODO: back record in a tuple of size 1, pass as file_like
2967
+ AK_DelimitedReader * dr = AK_DR_New (record ,
2968
+ 0 , // will mutate dr->axis_pos after creation
2969
+ delimiter ,
2970
+ doublequote ,
2971
+ escapechar ,
2972
+ quotechar ,
2973
+ quoting ,
2974
+ skipinitialspace ,
2975
+ strict );
2976
+ if (dr == NULL ) { // can happen due to validation of dialect parameters
2977
+ return NULL ;
2978
+ }
2979
+
2980
+ // Py_UCS4 tsep;
2981
+ // if (AK_set_char(
2982
+ // "thousandschar",
2983
+ // &tsep,
2984
+ // thousandschar,
2985
+ // '\0')) {
2986
+ // AK_DR_Free(dr);
2987
+ // return NULL; // default is off (skips evaluation)
2988
+ // }
2989
+ // Py_UCS4 decc;
2990
+ // if (AK_set_char(
2991
+ // "decimalchar",
2992
+ // &decc,
2993
+ // decimalchar,
2994
+ // '.')) {
2995
+ // AK_DR_Free(dr);
2996
+ // return NULL;
2997
+ // }
2998
+
2999
+ // // dtypes inc / dec ref bound within CPG life
3000
+ // AK_CodePointGrid* cpg = AK_CPG_New(dtypes, tsep, decc);
3001
+ // if (cpg == NULL) { // error will be set
3002
+ // AK_DR_Free(dr);
3003
+ // return NULL;
3004
+ // }
3005
+ // // TODO: implement AK_DR_ProcessRecord
3006
+ // // Consume all lines from dr and load into cpg
3007
+ // int status;
3008
+ // status = AK_DR_ProcessRecord(dr, cpg, line_select);
3009
+ // if (status == 1) {
3010
+ // continue; // more lines to process
3011
+ // }
3012
+ // else if (status == 0) {
3013
+ // break;
3014
+ // }
3015
+ // else if (status == -1) {
3016
+ // AK_DR_Free(dr);
3017
+ // AK_CPG_Free(cpg);
3018
+ // return NULL;
3019
+ // }
3020
+ // AK_DR_Free(dr);
3021
+
3022
+ // PyObject* arrays = AK_CPG_ToArrayList(cpg, axis, line_select, tsep, decc);
3023
+ // // NOTE: do not need to check if arrays is NULL as we will return NULL anyway
3024
+ // AK_CPG_Free(cpg); // will free reference to dtypes
3025
+ // return arrays; // could be NULL
3026
+ Py_RETURN_NONE ;
3027
+ }
3028
+
3029
+
2916
3030
static char * iterable_str_to_array_1d_kwarg_names [] = {
2917
3031
"iterable" ,
2918
3032
"dtype" ,
0 commit comments