Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef dwarf_DST_mem_INCLUDED
00037 #define dwarf_DST_mem_INCLUDED
00038
00039
00040
00041
00042
00043
00044
00045
00046 #if defined(_SOLARIS_SOLARIS) && !defined(__GNUC__)
00047 #else
00048 #ifdef __cplusplus
00049 extern "C" {
00050 #endif
00051 #endif
00052
00053
00054 #include "defs.h"
00055
00056
00057
00058
00059
00060
00061 typedef mINT32 DST_BYTE_IDX;
00062 typedef mINT32 DST_BLOCK_IDX;
00063
00064
00065 typedef struct DST_idx
00066 {
00067 DST_BYTE_IDX byte_idx;
00068 DST_BLOCK_IDX block_idx;
00069 } DST_IDX;
00070
00071 #define DST_INVALID_BLOCK_IDX -1
00072 #define DST_INVALID_BYTE_IDX -1
00073 #define DST_FOREIGN_BLOCK_IDX -2
00074 #define DST_FOREIGN_BYTE_IDX -2
00075
00076
00077
00078
00079
00080 extern const DST_IDX DST_INVALID_IDX;
00081 #define DST_INVALID_INIT {DST_INVALID_BYTE_IDX, DST_INVALID_BLOCK_IDX}
00082 #define DST_FOREIGN_INIT {DST_FOREIGN_BYTE_IDX, DST_FOREIGN_BLOCK_IDX}
00083
00084
00085
00086
00087 #define DST_IS_NULL(i) (((i).byte_idx == DST_INVALID_BYTE_IDX) ||\
00088 ((i).block_idx == DST_INVALID_BLOCK_IDX))
00089
00090
00091 #define DST_IS_FOREIGN_OBJ(i) (((i).byte_idx == DST_FOREIGN_BYTE_IDX) || \
00092 ((i).block_idx == DST_FOREIGN_BLOCK_IDX))
00093
00094
00095 #ifdef __cplusplus
00096
00097 inline bool operator==(const DST_IDX& x, const DST_IDX& y) {
00098 return x.byte_idx == y.byte_idx && x.block_idx == y.block_idx;
00099 }
00100
00101 inline bool operator!=(const DST_IDX& x, const DST_IDX& y) {
00102 return x.byte_idx != y.byte_idx || x.block_idx != y.block_idx;
00103 }
00104
00105 inline bool operator<(const DST_IDX& x, const DST_IDX& y) {
00106 return (x.block_idx < y.block_idx) ||
00107 (x.block_idx == y.block_idx && x.byte_idx < y.byte_idx);
00108 }
00109
00110 inline DST_IDX make_DST_IDX(DST_BYTE_IDX byte_idx, DST_BLOCK_IDX block_idx) {
00111 DST_idx result;
00112 result.byte_idx = byte_idx;
00113 result.block_idx = block_idx;
00114 return result;
00115 }
00116
00117
00118 struct DST_IDX_hash {
00119 size_t operator()(DST_IDX idx) const {
00120 return (static_cast<size_t>(idx.block_idx) << 10) +
00121 static_cast<size_t>(idx.byte_idx);
00122 }
00123 };
00124
00125 #endif
00126
00127
00128
00129
00130
00131
00132
00133
00134 extern char * DST_idx_to_string(DST_IDX);
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 typedef enum DST_block_kind
00147 {
00148 DST_include_dirs_block = 0,
00149 DST_file_names_block = 1,
00150 DST_macro_info_block = 2,
00151 DST_file_scope_block = 3,
00152 DST_local_scope_block = 4,
00153 DST_noblock = 5
00154 } DST_BLOCK_KIND;
00155
00156
00157
00158 typedef void* DST_TYPE;
00159 extern DST_TYPE Current_DST;
00160
00161 #ifdef USE_DST_INTERNALS
00162
00163 typedef struct block_header_struct {
00164 DST_BLOCK_KIND kind;
00165 mINT32 size;
00166 mINT32 allocsize;
00167 char *offset;
00168 } block_header;
00169
00170 typedef struct dst_rec {
00171 block_header *dst_blocks;
00172 block_header *current_dst;
00173 DST_BLOCK_IDX last_block_header;
00174 DST_BLOCK_IDX max_block_header;
00175 DST_BLOCK_IDX current_block_header;
00176 DST_BLOCK_IDX block_list[DST_noblock];
00177 } DST_Type;
00178
00179 #define FOREACH_DST_BLOCK(i) \
00180 for (i = 0; i <= ((DST_Type *)Current_DST)->last_block_header; i++)
00181
00182 #endif
00183
00184
00185
00186
00187
00188
00189 extern DST_TYPE
00190 New_DST (void);
00191
00192
00193
00194
00195
00196 extern void
00197 DST_Init (char *start, INT32 num_blocks);
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 extern void
00208 DST_begin_block(DST_BLOCK_KIND block_kind);
00209
00210
00211
00212
00213
00214 extern void
00215 DST_return_to_block(DST_IDX idx);
00216
00217
00218
00219
00220
00221
00222
00223
00224 extern DST_IDX
00225 DST_allocate(INT32 bytes, INT32 align);
00226
00227
00228
00229
00230
00231 extern DST_IDX
00232 DST_get_include_dirs(void);
00233
00234
00235
00236
00237
00238 extern DST_IDX
00239 DST_get_file_names(void);
00240
00241
00242
00243
00244
00245 extern DST_IDX
00246 DST_get_macro_info(void);
00247
00248
00249
00250
00251
00252 extern DST_IDX
00253 DST_get_compile_unit(void);
00254
00255 #if defined(_SOLARIS_SOLARIS) && !defined(__GNUC__)
00256 #else
00257 #ifdef __cplusplus
00258 }
00259 #endif
00260 #endif
00261
00262 #endif