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 volatile int ofx_PARSER_msg = false;
00025 volatile int ofx_DEBUG_msg = false;
00026 volatile int ofx_DEBUG1_msg = false;
00027 volatile int ofx_DEBUG2_msg = false;
00028 volatile int ofx_DEBUG3_msg = false;
00029 volatile int ofx_DEBUG4_msg = false;
00030 volatile int ofx_DEBUG5_msg = false;
00031 volatile int ofx_STATUS_msg = false;
00032 volatile int ofx_INFO_msg = false;
00033 volatile int ofx_WARNING_msg = false;
00034 volatile int ofx_ERROR_msg = false;
00035 volatile int ofx_show_position = true;
00037 void show_line_number()
00038 {
00039 extern SGMLApplication::OpenEntityPtr entity_ptr;
00040 extern SGMLApplication::Position position;
00041
00042
00043 if((ofx_show_position == true))
00044 {
00045 SGMLApplication::Location *location = new SGMLApplication::Location(entity_ptr, position);
00046 cerr << "(Above message occured on Line "<<location->lineNumber<<", Column "<<location->columnNumber<<")"<<endl;
00047 delete location;
00048 }
00049 }
00050
00054 int message_out(OfxMsgType error_type, const string message)
00055 {
00056
00057
00058 switch (error_type){
00059 case DEBUG :
00060 if(ofx_DEBUG_msg==true){
00061 cerr << "LibOFX DEBUG: " << message<<"\n";
00062 show_line_number();
00063 }
00064 break;
00065 case DEBUG1 :
00066 if(ofx_DEBUG1_msg==true){
00067 cerr << "LibOFX DEBUG1: " << message<<"\n";
00068 show_line_number();
00069 }
00070 break;
00071 case DEBUG2 :
00072 if(ofx_DEBUG2_msg==true){
00073 cerr << "LibOFX DEBUG2: " << message<<"\n";
00074 show_line_number();
00075 }
00076 break;
00077 case DEBUG3 :
00078 if(ofx_DEBUG3_msg==true){
00079 cerr << "LibOFX DEBUG3: " << message<<"\n";
00080 show_line_number();
00081 }
00082 break;
00083 case DEBUG4 :
00084 if(ofx_DEBUG4_msg==true){
00085 cerr << "LibOFX DEBUG4: " << message<<"\n";
00086 show_line_number();
00087 }
00088 break;
00089 case DEBUG5 :
00090 if(ofx_DEBUG5_msg==true){
00091 cerr << "LibOFX DEBUG5: " << message<<"\n";
00092 show_line_number();
00093 }
00094 break;
00095 case STATUS :
00096 if(ofx_STATUS_msg==true){
00097 cerr << "LibOFX STATUS: " << message<<"\n";
00098 show_line_number();
00099 }
00100 break;
00101 case INFO :
00102 if(ofx_INFO_msg==true){
00103 cerr << "LibOFX INFO: " << message<<"\n";
00104 show_line_number();
00105 }
00106 break;
00107 case WARNING :
00108 if(ofx_WARNING_msg==true){
00109 cerr << "LibOFX WARNING: " << message<<"\n";
00110 show_line_number();
00111 }
00112 break;
00113 case ERROR :
00114 if(ofx_ERROR_msg==true){
00115 cerr << "LibOFX ERROR: " << message<<"\n";
00116 show_line_number();
00117 }
00118 break;
00119 case PARSER :
00120 if(ofx_PARSER_msg==true){
00121 cerr << "LibOFX PARSER: " << message<<"\n";
00122 show_line_number();
00123 }
00124 break;
00125 default:
00126 cerr << "LibOFX UNKNOWN ERROR CLASS, This is a bug in LibOFX\n";
00127 show_line_number();
00128 }
00129
00130 return 0;
00131 }
00132