X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fspreadsheet-reader.h;h=c03cf71642135f0ef12331e247a4fe44d58fb9a7;hb=04b3676d28e8c535e02a61fe904a91cd5d434e0b;hp=aa4c0174529c4a142cb8111be0c431d674d581b7;hpb=415dbf964ef32c89d6283a19487a6eb188f32ed2;p=pspp diff --git a/src/data/spreadsheet-reader.h b/src/data/spreadsheet-reader.h index aa4c017452..c03cf71642 100644 --- a/src/data/spreadsheet-reader.h +++ b/src/data/spreadsheet-reader.h @@ -19,6 +19,8 @@ #include +struct casereeader; + /* Default width of string variables. */ #define SPREADSHEET_DEFAULT_WIDTH 8 @@ -28,9 +30,9 @@ */ struct spreadsheet_read_options { - const char *sheet_name ; /* The name of the sheet to open (in UTF-8) */ + char *sheet_name ; /* The name of the sheet to open (in UTF-8) */ int sheet_index ; /* The index of the sheet to open (only used if sheet_name is NULL) */ - const char *cell_range ; /* The cell range (in UTF-8) */ + char *cell_range ; /* The cell range (in UTF-8) */ bool read_names ; /* True if the first row is to be used as the names of the variables */ int asw ; /* The width of string variables in the created dictionary */ }; @@ -43,9 +45,9 @@ bool convert_cell_ref (const char *ref, int *coli, int *rowi); -#define _xml(X) (CHAR_CAST (const xmlChar *, X)) +#define _xml(X) (CHAR_CAST (const xmlChar *, (X))) -#define _xmlchar_to_int(X) (atoi(CHAR_CAST (const char *, X))) +#define _xmlchar_to_int(X) ((X) ? atoi (CHAR_CAST (const char *, (X))) : -1) enum spreadsheet_type { @@ -54,9 +56,10 @@ enum spreadsheet_type SPREADSHEET_ODS }; + struct spreadsheet { - const char *file_name; + char *file_name; enum spreadsheet_type type; @@ -65,23 +68,25 @@ struct spreadsheet /* The dictionary */ struct dictionary *dict; + + int ref_cnt; }; -char *create_cell_ref (int col0, int row0, int coli, int rowi); +struct casereader * spreadsheet_make_reader (struct spreadsheet *, const struct spreadsheet_read_options *); + +const char * spreadsheet_get_sheet_name (struct spreadsheet *s, int n); +char * spreadsheet_get_sheet_range (struct spreadsheet *s, int n); + + +char * create_cell_ref (int col0, int row0); +char *create_cell_range (int col0, int row0, int coli, int rowi); + +void spreadsheet_unref (struct spreadsheet *); +void spreadsheet_ref (struct spreadsheet *); + -/* - Attempt to open the file called FILENAME as a spreadsheet. - It is not known a priori, what type of spreadsheet FILENAME is, or - even if it is a spreadsheet at all. - If it fails to open, then it will return NULL without any error or - warning messages. - */ -struct spreadsheet * spreadsheet_open (const char *filename); -void spreadsheet_close (struct spreadsheet *); -struct casereeader; -struct casereader * spreadsheet_make_reader (struct spreadsheet *s); #define SPREADSHEET_CAST(X) ((struct spreadsheet *)(X))