00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef OUT_H
00022 #define OUT_H
00023
00024 #include "analy.h"
00025 #include "common.h"
00026 #include "global.h"
00027 #include "htdata.h"
00028
00029 class OutLine: public Object {
00030 public:
00031 int textlen;
00032 byte *text;
00033 int bytes;
00034 OutLine(byte *Text, int Textlen, int Bytes);
00035 ~OutLine();
00036 };
00037
00038
00039 class OutAddr: public Object {
00040 public:
00041 Address *addr;
00042 UINT time;
00043 ht_clist *lines;
00044 int size;
00045 int bytes;
00046
00047 OutAddr(Address *Addr, UINT Time);
00048 ~OutAddr();
00049 void appendLine(OutLine *l);
00050 void clear();
00051 OutLine *getLine(int i);
00052 void updateTime(UINT Time);
00053 };
00054
00055
00056
00057
00058 #define WORKBUF_LEN 1024
00059
00060 #define ELEMENT_TYPE_PRE_COMMENT 0
00061 #define ELEMENT_TYPE_COMMENT 1
00062 #define ELEMENT_TYPE_POST_COMMENT 2
00063 #define ELEMENT_TYPE_LABEL 3
00064 #define ELEMENT_TYPE_DATA_CODE 4
00065 #define ELEMENT_TYPE_HIGHLIGHT_DATA_CODE 5
00066 #define ELEMENT_TYPE_INDENT_XREF 6
00067
00068 #define EXTERNAL_LINK_SHOW_XREFS 0
00069 #define EXTERNAL_LINK_SHOW_COMMENTS 1
00070
00071 #define OUTPUT_GENERATE_ERR_OK 0
00072 #define OUTPUT_GENERATE_ERR_INVAL 1
00073 #define OUTPUT_GENERATE_ERR_ANALYSER_NOT_FINISHED 2
00074 #define OUTPUT_GENERATE_ERR_STREAM 3
00075
00076
00077
00078
00079 class AnalyserOutput: public Object {
00080 public:
00081 Analyser *analy;
00082 Address *addr;
00083 int line;
00084 Location *cur_addr;
00085 OutAddr *cur_out_addr;
00086 int bytes_line;
00087 int bytes_addr;
00088
00089 ht_dtree *out_addrs;
00090
00091 byte *work_buffer_start;
00092 byte *work_buffer;
00093
00094 byte *temp_buffer;
00095
00096 UINT current_time;
00097 int size;
00098
00099 int dis_style;
00100
00101 void init(Analyser *analy);
00102 virtual void done();
00103 virtual void beginAddr();
00104 virtual void beginLine();
00105 virtual void changeConfig();
00106 virtual int elementLength(const char *s);
00107 virtual void endAddr();
00108 virtual void endLine();
00109 virtual char * externalLink(char *s, int type1, int type2, int type3, int type4, void *special);
00110 virtual void footer();
00111 void generateAddr(Address *Addr, OutAddr *oa);
00112 int generateFile(Address *from, Address *to);
00113 virtual ht_stream * getGenerateStream();
00114 void generatePage(Address *from, int lines);
00115 OutAddr * getAddr(Address *Addr);
00116 OutLine * getLine(Address *Addr, int line);
00117 bool getLineString(char *buf, int maxlen, Address *Addr, int line);
00118 bool getLineByteLength(int &len, Address *Addr, int line);
00119 int getLineCount(Address *Addr);
00120 int getAddrByteLength(Address *Addr);
00121 virtual void header();
00122 void invalidateCache();
00123 virtual char * link(char *s, Address *Addr);
00124 int nextLine(Address *&Addr, int &line, int n, Address *max);
00125 int prevLine(Address *&Addr, int &line, int n, Address *min);
00126 virtual void putElement(int element_type, const char *element);
00127 void reset();
00128 void write(const char *s);
00129 void write(const char *s, int n);
00130 };
00131
00132 #endif