00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <stdio.h>
00025 #include <stdarg.h>
00026
00027 #include <it/types.h>
00028 #include <it/vec.h>
00029 #include <it/io.h>
00030
00031 int main ()
00032 {
00033 int d1 = 5, d2 = 7;
00034 double f1 = 3.14159, f2 = -5.6;
00035 cplx mycplx;
00036 char *s = "toto";
00037 char *char_vec = " [ 1.23, 45.6,-78, 9 ,10 ]";
00038 char *char_ivec = " [ 1,-478, 9 ,-10 ]";
00039 char *char_cplx = "i";
00040 char c = 'x';
00041
00042
00043 vec v = vec_new_arithm (1, -2, 15);
00044 ivec iv = ivec_new_geom (1, 2, 8);
00045 bvec bv = bvec_new_ones (4), bvr;
00046
00047 vec v2 = vec_new_string ("35 2.3 634 -34;");
00048 ivec iv2 = ivec_new_string (" 35 2 634,-34");
00049 bvec bv2 = bvec_new_string ("[35 2 23 34] ");
00050 cvec cv2 = cvec_new_string ("[35+1i -2+3i 634i i -34 -i +1+i] ");
00051
00052
00053 it_read_cplx (char_cplx, &mycplx);
00054 it_printf ("mycplx = %z\n", mycplx);
00055
00056
00057 printf ("d1=%5d\nd2=%d\nf1=%2.5g\nf2=%3f\ns=%s\nc=%c\n\n",
00058 d1, d2, f1, f2, s, c);
00059
00060 it_printf ("d1=%5d\nd2=%d\nf1=%2.5g\nf2=%3f\ns=%s\nc=%c\n\n",
00061 d1, d2, f1, f2, s, c);
00062
00063
00064 it_printf ("v=$.3f\niv=$d\nbv=$b\n", v, iv, bv);
00065
00066
00067 it_read_vec (char_vec, &v);
00068 it_read_ivec (char_ivec, &iv);
00069 it_printf ("read string %s\nv = $v\n", char_vec, v);
00070 it_printf ("read string %s\niv = $i\n", char_ivec, iv);
00071
00072 it_printf ("v2 = $v\n", v2);
00073 it_printf ("iv2 = $i\n", iv2);
00074 it_printf ("bv2 = $b\n", bv2);
00075 it_printf ("cv2 = $.3z\n", cv2);
00076
00077 bvec_push (bv, 1);
00078 bvec_push (bv, 0);
00079 bvec_push (bv, 1);
00080 bvec_push (bv, 0);
00081 bvec_push (bv, 1);
00082 bvec_file_write_bits ("test_io_bvec", bv);
00083 bvr = bvec_file_read_bits ("test_io_bvec", bvec_length (bv));
00084 it_printf ("bvr = $b\n", bvr);
00085
00086 vec_delete (v);
00087 ivec_delete (iv);
00088 bvec_delete (bv);
00089 vec_delete (v2);
00090 ivec_delete (iv2);
00091 bvec_delete (bv2);
00092 bvec_delete (bvr);
00093 return 0;
00094 }