00001
00002
00003
00004
00005
00006
00010
00011
00012
00013
00014
00015
00016
00017
00018
#include <iostream>
00019
#include <stdlib.h>
00020
#include <string>
00021
#include "ParserEventGeneratorKit.h"
00022
#include "ofx_utilities.hh"
00023
#include "messages.hh"
00024
00025 SGMLApplication::OpenEntityPtr
entity_ptr;
00026 SGMLApplication::Position
position;
00028 volatile int ofx_PARSER_msg =
false;
00029 volatile int ofx_DEBUG_msg =
false;
00030 volatile int ofx_DEBUG1_msg =
false;
00031 volatile int ofx_DEBUG2_msg =
false;
00032 volatile int ofx_DEBUG3_msg =
false;
00033 volatile int ofx_DEBUG4_msg =
false;
00034 volatile int ofx_DEBUG5_msg =
false;
00035 volatile int ofx_STATUS_msg =
false;
00036 volatile int ofx_INFO_msg =
false;
00037 volatile int ofx_WARNING_msg =
false;
00038 volatile int ofx_ERROR_msg =
false;
00039 volatile int ofx_show_position =
true;
00041
void show_line_number()
00042 {
00043
extern SGMLApplication::OpenEntityPtr
entity_ptr;
00044
extern SGMLApplication::Position
position;
00045
00046
00047
if((
ofx_show_position ==
true))
00048 {
00049 SGMLApplication::Location *location =
new SGMLApplication::Location(
entity_ptr,
position);
00050 cerr <<
"(Above message occured on Line "<<location->lineNumber<<
", Column "<<location->columnNumber<<
")"<<endl;
00051
delete location;
00052 }
00053 }
00054
00058 int message_out(OfxMsgType error_type,
const string message)
00059 {
00060
00061
00062
switch (error_type){
00063
case DEBUG :
00064
if(
ofx_DEBUG_msg==
true){
00065 cerr <<
"LibOFX DEBUG: " << message<<
"\n";
00066 show_line_number();
00067 }
00068
break;
00069
case DEBUG1 :
00070
if(
ofx_DEBUG1_msg==
true){
00071 cerr <<
"LibOFX DEBUG1: " << message<<
"\n";
00072 show_line_number();
00073 }
00074
break;
00075
case DEBUG2 :
00076
if(
ofx_DEBUG2_msg==
true){
00077 cerr <<
"LibOFX DEBUG2: " << message<<
"\n";
00078 show_line_number();
00079 }
00080
break;
00081
case DEBUG3 :
00082
if(
ofx_DEBUG3_msg==
true){
00083 cerr <<
"LibOFX DEBUG3: " << message<<
"\n";
00084 show_line_number();
00085 }
00086
break;
00087
case DEBUG4 :
00088
if(
ofx_DEBUG4_msg==
true){
00089 cerr <<
"LibOFX DEBUG4: " << message<<
"\n";
00090 show_line_number();
00091 }
00092
break;
00093
case DEBUG5 :
00094
if(
ofx_DEBUG5_msg==
true){
00095 cerr <<
"LibOFX DEBUG5: " << message<<
"\n";
00096 show_line_number();
00097 }
00098
break;
00099
case STATUS :
00100
if(
ofx_STATUS_msg==
true){
00101 cerr <<
"LibOFX STATUS: " << message<<
"\n";
00102 show_line_number();
00103 }
00104
break;
00105
case INFO :
00106
if(
ofx_INFO_msg==
true){
00107 cerr <<
"LibOFX INFO: " << message<<
"\n";
00108 show_line_number();
00109 }
00110
break;
00111
case WARNING :
00112
if(
ofx_WARNING_msg==
true){
00113 cerr <<
"LibOFX WARNING: " << message<<
"\n";
00114 show_line_number();
00115 }
00116
break;
00117
case ERROR :
00118
if(
ofx_ERROR_msg==
true){
00119 cerr <<
"LibOFX ERROR: " << message<<
"\n";
00120 show_line_number();
00121 }
00122
break;
00123
case PARSER :
00124
if(
ofx_PARSER_msg==
true){
00125 cerr <<
"LibOFX PARSER: " << message<<
"\n";
00126 show_line_number();
00127 }
00128
break;
00129
default:
00130 cerr <<
"LibOFX UNKNOWN ERROR CLASS, This is a bug in LibOFX\n";
00131 show_line_number();
00132 }
00133
00134
return 0;
00135 }
00136