00001 #ifndef AT_OK
00002 #include <timeio.h>
00003
00004 #ifndef SOI_VERSION_INCL
00005 #include "soi_version.h"
00006 #endif
00007
00008 typedef struct at_struct {
00009 char *pathname;
00010 char *delim;
00011 char *tokdelim;
00012 int rows;
00013 int row;
00014 int maxrows;
00015 int cols;
00016 int maxcols;
00017 int header_done;
00018 char **col_name;
00019 char ***col_vals;
00020 int *col_width;
00021 int last_error;
00022 char *last_called;
00023 } AT;
00024
00025
00026
00027 AT *at_read (char *pathname);
00028 int at_write (AT *at, char *pathname);
00029
00030
00031
00032 AT *at_new ();
00033 AT *at_create (char *header_info);
00034 AT *at_define_table (int cols, int rows);
00035 int at_put_info (AT *at, char *header_info);
00036 int at_put_value (AT *at, int col, int row, double value);
00037 int at_put_time (AT *at, int col, int row, double value);
00038 int at_put_string (AT *at, int col, int row, char *text);
00039 int at_put_name (AT *at, int col, char *name);
00040 char *at_error_msg (AT *at);
00041
00042
00043
00044 int at_cols (AT *at);
00045 int at_rows (AT *at);
00046 int at_col (AT *at, char *data_name);
00047 char *at_get_name (AT *at, int col);
00048 double at_get_value (AT *at, int col, int row);
00049 double at_get_time (AT *at, int col, int row);
00050 char *at_get_string (AT *at, int col, int row);
00051 char *at_get_ascii (AT *at, int col, int row);
00052 int at_in_bounds (AT *at, int col, int row);
00053 int at_check_n_grow (AT *at, int col, int row);
00054 void at_free (AT *at);
00055
00056
00057
00058 char *at_rec_getkey_str (AT *at, int rec, char *key);
00059 char *AT_rec_getkey_str (AT *at, int rec, char *key);
00060 int at_rec_getkey_int (AT *at, int rec, char *key);
00061 unsigned int at_rec_getkey_uint (AT *at, int rec, char *key);
00062 double at_rec_getkey_double (AT *at, int rec, char *key);
00063 TIME at_rec_getkey_time (AT *at, int rec, char *key);
00064 TIME at_rec_getkey_time_interval (AT *at, int rec, char *key);
00065
00066
00067
00068 int at_rec_setkey_str (AT *at, int rec, char *key, char *val);
00069 int at_rec_setkey_int (AT *at, int rec, char *key, int ival);
00070 int at_rec_setkey_uint (AT *at, int rec, char *key, unsigned int ival);
00071 int at_rec_setkey_double (AT *at, int rec, char *key, double dval);
00072 int at_rec_setkey_time (AT *at, int rec, char *key, TIME tval);
00073 int at_rec_setkey_time_interval (AT *at, int rec, char *key, TIME tival);
00074
00075 int at_copy_row (AT *at, int new, int old);
00076 int at_remove_row (AT *at, int row);
00077 int at_remove_rows (AT *at, int row0, int row1);
00078
00079 #define AT_EMPTY_LINE (-7)
00080 #define AT_BAD_NAMELIST (-6)
00081 #define AT_MALLOC_ERROR (-5)
00082 #define AT_BAD_DATA_VALUE (-4)
00083 #define AT_BAD_TYPE (-3)
00084 #define AT_BAD_REC_NUMBER (-2)
00085 #define AT_BAD_COL_COUNT (-1)
00086 #define AT_BAD (0)
00087 #define AT_OK (1)
00088 #define AT_MIN_ROW_ALLOC (256)
00089 #define AT_MIN_COL_ALLOC (16)
00090 #define AT_MAX_LINE (10000)
00091 #define AT_DELIM "\t"
00092 #define AT_TOKDELIM "\n\t"
00093
00094 #endif
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152