8 #include "constraint.h"
13 #define MAX_LINE_LENGTH 1024
15 DynamicDebug::DynamicDebug(ifstream
& DebugConfigStream
)
17 char line
[MAX_LINE_LENGTH
];
18 while (DebugConfigStream
.getline(line
, MAX_LINE_LENGTH
)) {
19 // parse line. Possible formats:
21 // DEBUG_PARAMETER level
25 for(i
=0; !isspace(line
[i
]) && line
[i
]!=0; i
++)
27 while (isspace(line
[i
] && line
[i
]!=0)) i
++;
29 // start parsing level;
31 level
= strtol(line
+i
, &p
, 10);
32 while(isspace(*p
) && *p
!=0) p
++;
34 cerr
<<"Error while parsing Debug Parameters!!\n"
35 <<"for parameter '"<<word
<<"', "
36 <<" found level "<<level
<<", but level was "
37 <<"not last non-white on line."<<endl
;
46 inline DynamicDebug::DynamicDebug(const char* DebugConfigFile
)
48 ifstream
DebugConfigStream(DebugConfigFile
);
49 char line
[MAX_LINE_LENGTH
];
50 while (DebugConfigStream
.getline(line
, MAX_LINE_LENGTH
)) {
51 // parse line. Possible formats:
53 // DEBUG_PARAMETER level
57 for(i
=0; !isspace(line
[i
]) && line
[i
]!=0; i
++)
59 while (isspace(line
[i
] && line
[i
]!=0)) i
++;
61 // start parsing level;
63 level
= strtol(line
+i
, &p
, 10);
64 while(isspace(*p
) && *p
!=0) p
++;
66 cerr
<<"Error while parsing Debug Parameters!!\n"
67 <<"for parameter '"<<word
<<"', "
68 <<" found level "<<level
<<", but level was "
69 <<"not last non-white on line."<<endl
;
78 //ifstream DEBUG_CONFIGURATION_FILE("DEBUG_POLYAST");
79 DynamicDebug
DebugBlackboard("DEBUG_POLYAST");
81 deque
<string
> split_underscore(const string
& s
)
84 const char* word_begin
= s
.c_str();
85 const char* c
=s
.c_str();
88 result
.push_back(string(word_begin
, c
-word_begin
));
93 result
.push_back(string(word_begin
, c
-word_begin
));
94 cout
<<"in split_underscore("<<s
<<"): returned (";
95 for (unsigned i
=0;i
<result
.size();i
++)
96 cout
<<((i
!=0)?",":"")<<result
[i
];