|
degate 0.1.1
|
00001 /* -*-c++-*- 00002 00003 This file is part of the IC reverse engineering tool degate. 00004 00005 Copyright 2008, 2009, 2010 by Martin Schobert 00006 00007 Degate is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 any later version. 00011 00012 Degate is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with degate. If not, see <http://www.gnu.org/licenses/>. 00019 00020 */ 00021 00022 00023 #ifndef __GLOBALS_H__ 00024 #define __GLOBALS_H__ 00025 00026 #include <stdio.h> 00027 #include <stdint.h> 00028 #include <tr1/memory> 00029 #include <map> 00030 #include <assert.h> 00031 #include "degate_exceptions.h" 00032 00033 /** 00034 * @namespace degate The namespace 'degate' is the namespace for everything that belongs to libdegate. 00035 */ 00036 namespace degate { 00037 00038 #define DEBUG 1 00039 00040 #define SIGNUM(x) ((x > 0) ? 1 : (x < 0) ? -1 : 0) 00041 00042 enum ret_t { 00043 RET_OK = 0, 00044 RET_ERR = 1, 00045 RET_INV_PTR = 2, 00046 RET_MALLOC_FAILED = 3, 00047 RET_INV_PATH = 4, 00048 RET_MATH_ERR = 5, 00049 RET_CANCEL = 6 00050 }; 00051 00052 #define RET_IS_OK(call_res) ((call_res) == RET_OK) 00053 #define RET_IS_NOT_OK(call_res) ((call_res) != RET_OK) 00054 00055 00056 #define degate_mime_type "application/degate" 00057 00058 #if (__SIZEOF_POINTER__ == 4) || (__WORDSIZE == 32) 00059 #define ARCH_32 00060 #define MAP_FILES_ON_DEMAND 00061 #elif (__SIZEOF_POINTER__ == 8) || (__WORDSIZE == 64) 00062 #define ARCH_64 00063 #else 00064 #error "Unknown architecture" 00065 #endif 00066 00067 00068 #define DEGATE_VERSION "0.1.1" 00069 00070 } 00071 00072 #define TM __FILE__,__LINE__ 00073 00074 #ifdef DEBUG 00075 void debug(const char * const module, int line, const char * const format, ...); 00076 #else 00077 #define debug(module, line, format, ...) ; 00078 #endif 00079 00080 00081 namespace degate { 00082 // we need some forward declerations here 00083 00084 class Circle; 00085 typedef std::tr1::shared_ptr<Circle> Circle_shptr; 00086 00087 class Line; 00088 typedef std::tr1::shared_ptr<Line> Line_shptr; 00089 00090 class Rectangle; 00091 typedef std::tr1::shared_ptr<Rectangle> Rectangle_shptr; 00092 00093 class ConnectedLogicModelObject; 00094 typedef std::tr1::shared_ptr<ConnectedLogicModelObject> ConnectedLogicModelObject_shptr; 00095 00096 class PlacedLogicModelObject; 00097 typedef std::tr1::shared_ptr<PlacedLogicModelObject> PlacedLogicModelObject_shptr; 00098 00099 class RemoteObject; 00100 typedef std::tr1::shared_ptr<RemoteObject> RemoteObject_shptr; 00101 00102 class Net; 00103 typedef std::tr1::shared_ptr<Net> Net_shptr; 00104 00105 class Gate; 00106 00107 class GatePort; 00108 typedef std::tr1::shared_ptr<GatePort> GatePort_shptr; 00109 00110 class GateTemplate; 00111 typedef std::tr1::shared_ptr<GateTemplate> GateTemplate_shptr; 00112 00113 class GateLibrary; 00114 typedef std::tr1::shared_ptr<GateLibrary> GateLibrary_shptr; 00115 00116 class Layer; 00117 typedef std::tr1::shared_ptr<Layer> Layer_shptr; 00118 00119 class Wire; 00120 typedef std::tr1::shared_ptr<Wire> Wire_shptr; 00121 00122 class Via; 00123 typedef std::tr1::shared_ptr<Via> Via_shptr; 00124 00125 class EMarker; 00126 typedef std::tr1::shared_ptr<EMarker> EMarker_shptr; 00127 00128 class Annotation; 00129 typedef std::tr1::shared_ptr<Annotation> Annotation_shptr; 00130 00131 class Module; 00132 typedef std::tr1::shared_ptr<Module> Module_shptr; 00133 00134 00135 class LogicModel; 00136 typedef std::tr1::shared_ptr<LogicModel> LogicModel_shptr; 00137 00138 typedef unsigned int layer_position_t; 00139 00140 00141 /** defines the type for colors */ 00142 typedef uint32_t color_t; 00143 00144 typedef unsigned long long object_id_t; 00145 typedef unsigned long long layer_id_t; 00146 typedef unsigned long long transaction_id_t; 00147 typedef unsigned int diameter_t; 00148 typedef unsigned int length_t; 00149 typedef int pos_t; 00150 00151 00152 std::string gen_tabs(int n); 00153 00154 00155 enum ENTITY_COLOR { 00156 DEFAULT_COLOR_WIRE, 00157 DEFAULT_COLOR_VIA_UP, 00158 DEFAULT_COLOR_VIA_DOWN, 00159 DEFAULT_COLOR_GRID, 00160 DEFAULT_COLOR_ANNOTATION, 00161 DEFAULT_COLOR_ANNOTATION_FRAME, 00162 DEFAULT_COLOR_GATE, 00163 DEFAULT_COLOR_GATE_FRAME, 00164 DEFAULT_COLOR_GATE_PORT, 00165 DEFAULT_COLOR_TEXT, 00166 DEFAULT_COLOR_EMARKER 00167 }; 00168 00169 typedef std::map<ENTITY_COLOR, color_t> default_colors_t; 00170 00171 } 00172 00173 #endif
1.7.4