]> www.ginac.de Git - cln.git/blob - src/vector/output/cl_GV_number_aprint.cc
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / vector / output / cl_GV_number_aprint.cc
1 // print_vector().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cln/GV_complex.h"
8 #include "cln/GV_real.h"
9 #include "cln/GV_rational.h"
10 #include "cln/GV_integer.h"
11 #include "cl_GV_io.h"
12
13
14 // Implementation.
15
16 #include "cln/output.h"
17
18 namespace cln {
19
20 void print_vector (cl_ostream stream, const cl_print_flags& flags, void (* printfun) (cl_ostream, const cl_print_flags&, const cl_number&), const cl_GV_number& vector)
21 {
22         var uintL len = vector.length();
23         if (flags.vector_syntax == vsyntax_commonlisp) {
24                 fprintchar(stream,'#');
25                 fprintchar(stream,'(');
26         } else
27                 fprintchar(stream,'[');
28         for (var uintL i = 0; i < len; i++) {
29                 if (i > 0) {
30                         if (flags.vector_syntax == vsyntax_algebraic)
31                                 fprintchar(stream,',');
32                         fprintchar(stream,' ');
33                 }
34                 // The conversion to cl_number below is needed for SGI CC.
35                 printfun(stream,flags,(cl_number)vector[i]);
36         }
37         if (flags.vector_syntax == vsyntax_commonlisp)
38                 fprintchar(stream,')');
39         else
40                 fprintchar(stream,']');
41 }
42
43 }  // namespace cln