00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __it_io_h
00026 #define __it_io_h
00027
00028 #include <stdarg.h>
00029 #include <assert.h>
00030 #include <it/mat.h>
00031
00032
00033
00034
00035
00036
00037
00038
00039 void it_vprintf (char *fmt, va_list args);
00040 void it_fprintf (FILE * output, char *fmt, ...);
00041 void it_printf (char *fmt, ...);
00042 void it_vfprintf (FILE * output, char *fmt, va_list ap);
00043
00044
00045 void it_warning (char *fmt, ...);
00046 void it_error (char *fmt, ...);
00047
00048 void __it_assert (int a, const char *filename, int line, char *message);
00049 #ifdef NDEBUG
00050 #define it_assert(a,expr) ((void) (0))
00051 #else
00052 #if defined(__GNUC__)
00053 #define it_assert(a,expr) __it_assert((long)(a), __FILE__, __LINE__, expr)
00054 #else
00055 #define it_assert(a,expr) __it_assert((long)(a), "", 0, expr)
00056 #endif
00057 #endif
00058
00059
00060 void it_set_vec_default_fmt (char *fmt);
00061
00062
00063 void it_set_mat_default_fmt (char *fmt);
00064
00065
00066
00067 char *it_read_int (char *s, int *p_val);
00068 char *it_read_float (char *s, float *p_val);
00069 char *it_read_double (char *s, double *p_val);
00070 char *it_read_cplx (char *s, cplx * p_val);
00071
00072
00073 char *it_read_vec (char *s, vec * v);
00074 char *it_read_fvec (char *s, vec * v);
00075 char *it_read_ivec (char *s, ivec * v);
00076 char *it_read_bvec (char *s, bvec * v);
00077 char *it_read_cvec (char *s, cvec * v);
00078
00079
00080 char *it_read_mat (char *s, mat * m);
00081 char *it_read_fmat (char *s, mat * m);
00082 char *it_read_imat (char *s, imat * m);
00083 char *it_read_bmat (char *s, bmat * m);
00084 char *it_read_cmat (char *s, cmat * m);
00085
00086
00087 vec vec_new_string (char *s);
00088 vec fvec_new_string (char *s);
00089 ivec ivec_new_string (char *s);
00090 bvec bvec_new_string (char *s);
00091 cvec cvec_new_string (char *s);
00092
00093
00094 mat mat_new_string (char *s);
00095 mat fmat_new_string (char *s);
00096 imat imat_new_string (char *s);
00097 bmat bmat_new_string (char *s);
00098 cmat cmat_new_string (char *s);
00099
00100
00101
00102
00103
00104 char pnm_type (const char *filename);
00105
00106
00107
00108 int pnm_info (const char *filename, char *p_pnm_type, int *p_width,
00109 int *p_height, int *p_max_val, char *comments, int length);
00110
00111
00112 mat mat_pgm_read (const char *filename);
00113
00114
00115 imat imat_pgm_read (const char *filename);
00116
00117
00118 int mat_pgm_write (const char *filename, mat m);
00119
00120
00121 int imat_pgm_write (const char *filename, imat m);
00122
00123
00124
00125 int wav_info (const char *filename, int *p_channels, int *p_srate,
00126 int *p_depth, int *p_length);
00127 mat mat_wav_read (const char *filename);
00128 imat imat_wav_read (const char *filename);
00129 void mat_wav_write (const char *filename, mat m, int srate, int depth);
00130 void imat_wav_write (const char *filename, imat m, int srate, int depth);
00131
00132
00133
00134
00135
00136 void vec_fwrite (FILE * stream, vec v);
00137 void fvec_fwrite (FILE * stream, vec v);
00138 void bvec_fwrite (FILE * stream, bvec v);
00139 void ivec_fwrite (FILE * stream, ivec v);
00140 void cvec_fwrite (FILE * stream, cvec v);
00141
00142
00143
00144 int vec_fread (FILE * stream, vec v);
00145 int fvec_fread (FILE * stream, vec v);
00146 int bvec_fread (FILE * stream, bvec v);
00147 int ivec_fread (FILE * stream, ivec v);
00148 int cvec_fread (FILE * stream, cvec v);
00149
00150
00151 vec vec_new_fread (FILE * stream);
00152 vec fvec_new_fread (FILE * stream);
00153 bvec bvec_new_fread (FILE * stream);
00154 ivec ivec_new_fread (FILE * stream);
00155 cvec cvec_new_fread (FILE * stream);
00156
00157 void mat_fwrite (FILE * stream, mat m);
00158 void fmat_fwrite (FILE * stream, mat m);
00159 void bmat_fwrite (FILE * stream, bmat m);
00160 void imat_fwrite (FILE * stream, imat m);
00161 void cmat_fwrite (FILE * stream, cmat m);
00162
00163
00164
00165 int vec_sread (void * buffer, vec v);
00166 int fvec_sread (void * buffer, vec v);
00167 int ivec_sread (void * buffer, ivec v);
00168
00169 mat mat_new_fread (FILE * stream);
00170 bmat bmat_new_fread (FILE * stream);
00171 imat imat_new_fread (FILE * stream);
00172 cmat cmat_new_fread (FILE * stream);
00173
00174
00175
00176
00177
00178
00179
00180 bvec bvec_file_read_bits (const char *filename, int nb_max);
00181
00182
00183 void bvec_file_write_bits (const char *filename, bvec v);
00184
00185
00186
00187 #endif