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;
00039 int message_out(OfxMsgType error_type, const string message)
00040 {
00041 extern SGMLApplication::OpenEntityPtr entity_ptr;
00042 extern SGMLApplication::Position position;
00043 int show_line_number = false;
00044
00045 switch (error_type){
00046 case DEBUG :
00047 if(ofx_DEBUG_msg==true){
00048 cerr << "LibOFX DEBUG: " << message<<"\n";
00049 }
00050 break;
00051 case DEBUG1 :
00052 if(ofx_DEBUG1_msg==true){
00053 cerr << "LibOFX DEBUG1: " << message<<"\n";
00054 }
00055 break;
00056 case DEBUG2 :
00057 if(ofx_DEBUG2_msg==true){
00058 cerr << "LibOFX DEBUG2: " << message<<"\n";
00059 }
00060 break;
00061 case DEBUG3 :
00062 if(ofx_DEBUG3_msg==true){
00063 cerr << "LibOFX DEBUG3: " << message<<"\n";
00064 }
00065 break;
00066 case DEBUG4 :
00067 if(ofx_DEBUG4_msg==true){
00068 cerr << "LibOFX DEBUG4: " << message<<"\n";
00069 }
00070 break;
00071 case DEBUG5 :
00072 if(ofx_DEBUG5_msg==true){
00073 cerr << "LibOFX DEBUG5: " << message<<"\n";
00074 }
00075 break;
00076 case STATUS :
00077 if(ofx_STATUS_msg==true){
00078 cerr << "LibOFX STATUS: " << message<<"\n";
00079 }
00080 break;
00081 case INFO :
00082 if(ofx_INFO_msg==true){
00083 cerr << "LibOFX INFO: " << message<<"\n";
00084 }
00085 break;
00086 case WARNING :
00087 if(ofx_WARNING_msg==true){
00088 cerr << "LibOFX WARNING: " << message<<"\n";
00089 }
00090 break;
00091 case ERROR :
00092 if(ofx_ERROR_msg==true){
00093 cerr << "LibOFX ERROR: " << message<<"\n";
00094 }
00095 break;
00096 case PARSER :
00097 if(ofx_PARSER_msg==true){
00098 cerr << "LibOFX PARSER: " << message<<"\n";
00099 }
00100 break;
00101 default:
00102 cerr << "LibOFX UNKNOWN ERROR CLASS, This is a bug in LibOFX\n";
00103 }
00104
00105 if((show_line_number == true))
00106 {
00107 SGMLApplication::Location location;
00108 unsigned long line_number;
00109 location = entity_ptr->location(position);
00110 line_number = location.lineNumber;
00111 cout<< "(Line "<<line_number<<")";
00112 }
00113
00114 return 0;
00115 }
00116