diff --git a/c/cli/mlrcli.h b/c/cli/mlrcli.h index c9841abe9..3fedb53ff 100644 --- a/c/cli/mlrcli.h +++ b/c/cli/mlrcli.h @@ -6,6 +6,7 @@ #define MLRCLI_H #include "containers/sllv.h" +#include "cli/quoting.h" #include "input/lrec_reader.h" #include "mapping/mapper.h" #include "output/lrec_writer.h" @@ -34,7 +35,7 @@ typedef struct _cli_opts_t { char* json_flatten_separator; char* ofmt; - int oquoting; + quoting_t oquoting; lrec_reader_t* plrec_reader; sllv_t* pmapper_list; diff --git a/c/cli/quoting.h b/c/cli/quoting.h index d8df3e9b8..d144da2f7 100644 --- a/c/cli/quoting.h +++ b/c/cli/quoting.h @@ -1,9 +1,11 @@ #ifndef QUOTING_H #define QUOTING_H -#define QUOTE_ALL 0xb1 -#define QUOTE_NONE 0xb2 -#define QUOTE_MINIMAL 0xb3 -#define QUOTE_NUMERIC 0xb4 +typedef enum _quoting_t { + QUOTE_ALL, + QUOTE_NONE, + QUOTE_MINIMAL, + QUOTE_NUMERIC +} quoting_t; #endif // QUOTING_H diff --git a/c/output/lrec_writer_csv.c b/c/output/lrec_writer_csv.c index 7a8856213..c42b537e2 100644 --- a/c/output/lrec_writer_csv.c +++ b/c/output/lrec_writer_csv.c @@ -32,7 +32,7 @@ static void quote_minimal_output_func(FILE* fp, char* string, char* ors, char* o static void quote_numeric_output_func(FILE* fp, char* string, char* ors, char* ofs, int orslen, int ofslen); // ---------------------------------------------------------------- -lrec_writer_t* lrec_writer_csv_alloc(char* ors, char* ofs, int oquoting, int headerless_csv_output) { +lrec_writer_t* lrec_writer_csv_alloc(char* ors, char* ofs, quoting_t oquoting, int headerless_csv_output) { lrec_writer_t* plrec_writer = mlr_malloc_or_die(sizeof(lrec_writer_t)); lrec_writer_csv_state_t* pstate = mlr_malloc_or_die(sizeof(lrec_writer_csv_state_t)); diff --git a/c/output/lrec_writers.h b/c/output/lrec_writers.h index 19cc566c5..0f0b9e697 100644 --- a/c/output/lrec_writers.h +++ b/c/output/lrec_writers.h @@ -1,8 +1,9 @@ #ifndef LREC_WRITERS_H #define LREC_WRITERS_H +#include "cli/quoting.h" #include "output/lrec_writer.h" -lrec_writer_t* lrec_writer_csv_alloc(char* ors, char* ofs, int oquoting, int headerless_csv_output); +lrec_writer_t* lrec_writer_csv_alloc(char* ors, char* ofs, quoting_t oquoting, int headerless_csv_output); lrec_writer_t* lrec_writer_csvlite_alloc(char* ors, char* ofs, int headerless_csv_output); lrec_writer_t* lrec_writer_dkvp_alloc(char* ors, char* ofs, char* ops); lrec_writer_t* lrec_writer_json_alloc(int stack_vertically, int wrap_json_output_in_outer_list,