[PATCH 2/2] Add setpoint support for CSV import

Dirk Hohndel dirk at hohndel.org
Tue Jul 21 07:41:21 PDT 2015


On Tue, Jul 21, 2015 at 04:37:42PM +0300, Miika Turkia wrote:
> The import of setpoint values is tested with Seabear data.

Thanks for your continued work on that...

>  extern int parse_file(const char *filename);
> -extern int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2Sensor1f, int o2Sensor2f, int o2Sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx);
> +extern int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int o2Sensor1f, int o2Sensor2f, int o2Sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int setpointf, int sepidx, const char *csvtemplate, int unitidx);

This must be one of my favorite APIs that we have 17 arguments is just
lovely.

> +void init_csv_file_parsing(char **params, char *timebuf, char *depthbuf, char *tempbuf, char *po2buf, char *o2sensor1buf, char *o2sensor2buf, char *o2sensor3buf, char *cnsbuf, char *ndlbuf, char *ttsbuf, char *stopdepthbuf, char *pressurebuf, char *setpointbuf, char *unitbuf, char *separator_index, time_t *now, struct tm *timep, char *curdate, char *curtime, int timef, int depthf, int tempf, int po2f, int o2sensor1f, int o2sensor2f, int o2sensor3f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int setpointf, int sepidx, const char *csvtemplate, int unitidx)

But then again, there are 36 arguments to init_csv_file_parsing that
really roll off your tongue...

Wouldn't it be better to have a structure and pass around a pointer?
Especially since the 17 arguments of the first function are a subset of
these 36 if I'm not mistaken...

So we could fill them in stages or something?

Would this make things easier?

/D


More information about the subsurface mailing list