File: dataio.h

package info (click to toggle)
gretl 0.99.2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,304 kB
  • ctags: 3,210
  • sloc: ansic: 43,338; sh: 6,567; makefile: 807; perl: 529
file content (118 lines) | stat: -rw-r--r-- 3,931 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* gretl - The Gnu Regression, Econometrics and Time-series Library
 * Copyright (C) 1999-2000 Ramu Ramanathan and Allin Cottrell
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License 
 * along with this software; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#include <stdio.h>
#include <string.h>

typedef enum {
    GRETL_DATA_FLOAT = 1, /* single-precision binary data */
    GRETL_DATA_DOUBLE,    /* double-precision binary data */
    GRETL_DATA_OCTAVE,    /* data in Gnu Octave format */
    GRETL_DATA_CSV,       /* data in Comma Separated Values format */
    GRETL_DATA_R,         /* data in Gnu R format */
    GRETL_DATA_R_ALT,     /* data in alternate Gnu R format */
    GRETL_DATA_GZIPPED,   /* gzipped data */
    GRETL_DATA_TRAD       /* traditional (ESL-style) data */
} data_options;

typedef enum {
    GRETL_NATIVE_DATA,    /* gretl native format data file */
    GRETL_XML_DATA,       /* gretl xml format data file */
    GRETL_CSV_DATA,       /* comma-separated data file */
    GRETL_BOX_DATA,       /* BOX1 format data file */
    GRETL_GNUMERIC,       /* gnumeric workbook data */
    GRETL_EXCEL,          /* MS Excel spreadsheet data */
    GRETL_SCRIPT,         /* file containing gretl commands */
    GRETL_UNRECOGNIZED    /* none of the above */
} gretl_filetypes;

typedef enum {
    CLEAR_FULL,
    CLEAR_SUBSAMPLE
} clear_codes;

#define free_datainfo(p) clear_datainfo(p, 0); free(p);

/* functions follow */

void free_Z (double **Z, DATAINFO *pdinfo);

DATAINFO *datainfo_new (void);

DATAINFO *create_new_dataset (double ***pZ, /* data matrix */
			      int nvar,     /* number of variables */
			      int nobs,     /* observations per variable */
			      int markers   /* case markers or not? */
			      );

void clear_datainfo (DATAINFO *pdinfo, int code);

int start_new_Z (double ***pZ, DATAINFO *pdinfo, int resample);

int dateton (const char *date, const DATAINFO *pdinfo);

void ntodate (char *datestr, const int nt, const DATAINFO *pdinfo);

int get_info (const char *hdrfile, PRN *prn);

int get_precision (double *x, int n);

int write_data (const char *fname, const int *list, 
		double **Z, const DATAINFO *pdinfo, 
	        int opt, PATHS *ppaths);

int is_gzipped (const char *fname);

int has_gz_suffix (const char *fname);

void gz_switch_ext (char *targ, char *src, char *ext);

int merge_data (double ***pZ, DATAINFO *pdinfo,
		double **addZ, DATAINFO *addinfo,
		PRN *prn, int gui);

int get_data (double ***pZ, DATAINFO *pdinfo, 
	      char *datfile, PATHS *ppaths, 
	      const int data_status, PRN *prn);

int open_nulldata (double ***pZ, DATAINFO *pdinfo, 
		   const int data_status, const int length,
		   PRN *prn);

int import_csv (double ***pZ, DATAINFO *pdinfo, 
                const char *fname, PRN *prn);

int import_box (double ***pZ, DATAINFO *pdinfo, 
		const char *fname, PRN *prn);

int add_case_markers (DATAINFO *pdinfo, const char *fname);

int detect_filetype (char *fname, PATHS *ppaths, PRN *prn);

int get_xmldata (double ***pZ, DATAINFO *pdinfo, char *fname,
		 PATHS *ppaths, int data_status, PRN *prn, int gui); 

char *get_xml_description (const char *fname);

int open_plugin (const PATHS *ppaths, const char *plugin, void **handle);

void *get_plugin_function (const char *funcname, void *handle);

void close_plugin (void *handle);