X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fspreadsheet-reader.h;h=9a46b35e9eb6a255e78403e9cfa242f6c133a754;hb=0a881d629fb4ad0326796076d127c341c65832fe;hp=77ed5ab9dbbe6551f59126ed21a6da2c3e53575f;hpb=5c210c96542db2a357cf1aa6b690ef2ea88a54b1;p=pspp diff --git a/src/data/spreadsheet-reader.h b/src/data/spreadsheet-reader.h index 77ed5ab9db..9a46b35e9e 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 @@ -31,17 +33,12 @@ struct spreadsheet_read_options 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) */ char *cell_range ; /* The cell range (in UTF-8) */ -}; - - -struct spreadsheet_read_info -{ - char *file_name ; /* The name of the file to open (in filename encoding) */ 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 */ }; -int pseudo_base26 (const char *str); +int ps26_to_int (const char *str); +char * int_to_ps26 (int); bool convert_cell_ref (const char *ref, int *col0, int *row0, @@ -59,29 +56,33 @@ enum spreadsheet_type SPREADSHEET_ODS }; + struct spreadsheet { + const char *file_name; + enum spreadsheet_type type; /* The total number of sheets in the "workbook" */ - int sheets; + int n_sheets; /* The dictionary */ struct dictionary *dict; }; -/* - 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); +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, int coli, int rowi); + +void spreadsheet_destroy (struct spreadsheet *); + + + #define SPREADSHEET_CAST(X) ((struct spreadsheet *)(X))