1 //==============================================================================================
2 //
3 // This file is part of LiDIA --- a library for computational number theory
4 //
5 // Copyright (c) 1994--2001 the LiDIA Group. All rights reserved.
6 //
7 // See http://www.informatik.tu-darmstadt.de/TI/LiDIA/
8 //
9 //----------------------------------------------------------------------------------------------
10 //
11 // $Id$
12 //
13 // Author : Patrick Theobald (PT)
14 // Changes : See CVS log
15 //
16 //==============================================================================================
17
18
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22 #include "LiDIA/LiDIA.h"
23 #include <cstring>
24 #include <cstdlib>
25
26
27
28 #ifdef LIDIA_NAMESPACE
29 namespace LiDIA {
30 #endif
31
32
33
34 int qo_info = 0;
35 bool qo_special = false;
36
37
38
lidia_internal_xinfo(const char * v,lidia_size_t a,lidia_size_t b)39 void lidia_internal_xinfo(const char *v, lidia_size_t a, lidia_size_t b)
40 {
41 // GET ENV Variable
42 static char *LIDIA_INFO_MODE = NULL;
43
44 if (LIDIA_INFO_MODE == NULL) {
45 LIDIA_INFO_MODE = getenv("LIDIA_INFO_MODE");
46 if (LIDIA_INFO_MODE == NULL) {
47 LIDIA_INFO_MODE = new char[256];
48 strcpy(LIDIA_INFO_MODE, "NONE");
49 }
50 }
51 if (strcmp(LIDIA_INFO_MODE, "MODE_1") == 0) {
52 char buffer[256]; // This should really be replaced by a std::string and sstream!
53 sprintf(buffer, "%s: (%d/%d) ", v, a, b);
54 std::cout << buffer << std::flush;
55 lidia_size_t len = strlen(buffer);
56 for (lidia_size_t j = 0; j < len; j++)
57 std::cout << "\b" << std::flush;
58 }
59 else
60 if (strcmp(LIDIA_INFO_MODE, "MODE_2") == 0) {
61 char buffer[256]; // This should really be replaced by a std::string and sstream!
62 sprintf(buffer, "%s: (%d/%d) ", v, a, b);
63 std::cout << buffer << std::endl;
64 }
65 }
66
67
68
69 #ifdef LIDIA_NAMESPACE
70 } // end of namespace LiDIA
71 #endif
72