]> www.ginac.de Git - cln.git/blob - src/base/cl_as_err.cc
* Adjusted dates and final touches for 1.1.1.
[cln.git] / src / base / cl_as_err.cc
1 // cl_as_error().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_N.h"
8
9
10 // Implementation.
11
12 #include "cln/io.h"
13 #include "cln/abort.h"
14
15 namespace cln {
16
17 void cl_as_error (const cl_number& obj, const char * typestring, const char * filename, int line)
18 {
19         fprint(std::cerr, "Type assertion failed: in file ");
20         fprint(std::cerr, filename);
21         fprint(std::cerr, ", line ");
22         fprintdecimal(std::cerr, line);
23         fprint(std::cerr, ", not ");
24         fprint(std::cerr, typestring);
25         fprint(std::cerr, ": ");
26 #if 0 // This brings in a dependency from the complex and float printer and all the float stuff.
27         fprint(std::cerr, obj);
28 #else
29         fprint(std::cerr, "@0x");
30         fprinthexadecimal(std::cerr, (unsigned long)(void*)&obj);
31         fprint(std::cerr, ": 0x");
32         fprinthexadecimal(std::cerr, (unsigned long)obj.word);
33 #endif
34         fprint(std::cerr, "\n");
35         cl_abort();
36 }
37
38 }  // namespace cln