diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-07-10 20:54:18 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-10 12:40:25 -0700 |
commit | 89d74888b395b29cf0ff75b3d844720428300164 (patch) | |
tree | 8d24c17a6d1e5735c4f54f7892a5f47fe7c3074e /file.c | |
parent | 9262d8a5187475b157dde399f84b58ee0ff8e4b5 (diff) | |
download | subsurface-89d74888b395b29cf0ff75b3d844720428300164.tar.gz |
Add support for importing pressure from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -384,11 +384,11 @@ int parse_file(const char *filename) #define MAXCOLDIGITS 3 #define MAXCOLS 100 -int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int cnsf, int ndlf, int ttsf, int stopdepthf, int sepidx, const char *csvtemplate, int unitidx) +int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int po2f, int cnsf, int ndlf, int ttsf, int stopdepthf, int pressuref, int sepidx, const char *csvtemplate, int unitidx) { struct memblock mem; int pnr = 0; - char *params[25]; + char *params[27]; char timebuf[MAXCOLDIGITS]; char depthbuf[MAXCOLDIGITS]; char tempbuf[MAXCOLDIGITS]; @@ -397,6 +397,7 @@ int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int p char ndlbuf[MAXCOLDIGITS]; char ttsbuf[MAXCOLDIGITS]; char stopdepthbuf[MAXCOLDIGITS]; + char pressurebuf[MAXCOLDIGITS]; char unitbuf[MAXCOLDIGITS]; char separator_index[MAXCOLDIGITS]; time_t now; @@ -404,7 +405,7 @@ int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int p char curdate[9]; char curtime[6]; - if (timef >= MAXCOLS || depthf >= MAXCOLS || tempf >= MAXCOLS || po2f >= MAXCOLS || cnsf >= MAXCOLS || ndlf >= MAXCOLS || cnsf >= MAXCOLS || stopdepthf >= MAXCOLS) + if (timef >= MAXCOLS || depthf >= MAXCOLS || tempf >= MAXCOLS || po2f >= MAXCOLS || cnsf >= MAXCOLS || ndlf >= MAXCOLS || cnsf >= MAXCOLS || stopdepthf >= MAXCOLS || pressuref >= MAXCOLS) return report_error(translate("gettextFromC", "Maximum number of supported columns on CSV import is %d"), MAXCOLS); snprintf(timebuf, MAXCOLDIGITS, "%d", timef); @@ -415,6 +416,7 @@ int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int p snprintf(ndlbuf, MAXCOLDIGITS, "%d", ndlf); snprintf(ttsbuf, MAXCOLDIGITS, "%d", ttsf); snprintf(stopdepthbuf, MAXCOLDIGITS, "%d", stopdepthf); + snprintf(pressurebuf, MAXCOLDIGITS, "%d", pressuref); snprintf(separator_index, MAXCOLDIGITS, "%d", sepidx); snprintf(unitbuf, MAXCOLDIGITS, "%d", unitidx); time(&now); @@ -441,6 +443,8 @@ int parse_csv_file(const char *filename, int timef, int depthf, int tempf, int p params[pnr++] = ttsbuf; params[pnr++] = "stopdepthField"; params[pnr++] = stopdepthbuf; + params[pnr++] = "pressureField"; + params[pnr++] = pressurebuf; params[pnr++] = "date"; params[pnr++] = curdate; params[pnr++] = "time"; |