libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00041 /* prevent following headers from being loaded a zillion times */ 00042 #ifndef LIBDXF_SRC_GLOBAL_H 00043 #define LIBDXF_SRC_GLOBAL_H 00044 00045 #include <stdarg.h> 00046 #include <stdio.h> 00047 #include <stdint.h> /* not part of the C++ standard */ 00048 #include <stdlib.h> 00049 #include <ctype.h> 00050 #include <inttypes.h> 00051 #include <sys/types.h> 00052 #include <sys/stat.h> 00053 #include <fcntl.h> 00054 #include <unistd.h> 00055 #include <string.h> 00056 #include <getopt.h> 00057 #include <math.h> 00058 #include <errno.h> 00059 #include <time.h> 00060 #include <limits.h> 00061 00062 /* 00063 * Standard gettext macros. 00064 */ 00065 #ifdef ENABLE_NLS 00066 # include <libintl.h> 00067 # undef _ 00068 # define _(String) dgettext (PACKAGE, String) 00069 # define Q_(String) g_strip_context ((String), gettext (String)) 00070 # ifdef gettext_noop 00071 # define N_(String) gettext_noop (String) 00072 # else 00073 # define N_(String) (String) 00074 # endif 00075 #else 00076 # define textdomain(String) (String) 00077 # define gettext(String) (String) 00078 # define dgettext(Domain,Message) (Message) 00079 # define dcgettext(Domain,Message,Type) (Message) 00080 # define bindtextdomain(Domain,Directory) (Domain) 00081 # define _(String) (String) 00082 # define Q_(String) g_strip_context ((String), (String)) 00083 # define N_(String) (String) 00084 #endif 00085 00086 00087 #include "dbg.h" 00088 #include "entity.h" 00089 00090 00091 #ifdef __MSDOS__ 00092 # ifndef MSDOS 00093 # define MSDOS 00094 00100 # endif 00101 #endif 00102 00103 #ifdef __TURBOC__ 00104 # define __MSC 00105 00106 #endif 00107 00108 #ifdef MSDOS 00109 # undef UNIX 00110 00111 #endif 00112 00113 /* In general it is possible to check for 64-bit with the architecture 00114 * builtins of GCC, e.g. with: */ 00115 #if defined (__alpha__)\ 00116 || defined (__ia64__)\ 00117 || defined (__ppc64__)\ 00118 || defined (__s390x__)\ 00119 || defined (__x86_64__) 00120 #define BUILD_64 1 00121 00122 #endif 00123 00124 /* For other platforms check the length of word size: */ 00125 #if (__WORDSIZE == 64) 00126 #define BUILD_64 1 00127 00128 #endif 00129 00130 #ifndef DEBUG 00131 # define DEBUG 0 00132 00136 #endif 00137 00138 #define INTER_ACTIVE_PROMPT 0 00139 00144 #ifndef TRUE 00145 # define TRUE 1 00146 00147 #endif 00148 00149 #ifndef OUTSIDE 00150 # define OUTSIDE 2 00151 00152 #endif 00153 00154 #ifndef INSIDE 00155 # define INSIDE 3 00156 00157 #endif 00158 00159 #ifndef ON_EDGE 00160 # define ON_EDGE 4 00161 00162 #endif 00163 00164 #ifndef FALSE 00165 # define FALSE 0 00166 00167 #endif 00168 00169 #ifndef DXF_ERROR 00170 # define DXF_ERROR -1 00171 00172 #endif 00173 00174 #define DXF_DEBUG_BEGIN \ 00175 fprintf (stderr, \ 00176 (_("[File: %s: line: %d] Entering %s () function.\n")), \ 00177 __FILE__, __LINE__, __FUNCTION__); 00178 00182 #define DXF_DEBUG_END \ 00183 fprintf (stderr, \ 00184 (_("[File: %s: line: %d] Leaving %s () function.\n")), \ 00185 __FILE__, __LINE__, __FUNCTION__); 00186 00194 typedef struct 00195 dxf_file_struct 00196 { 00197 FILE *fp; 00199 char *filename; 00201 int line_number; 00203 int last_id_code; 00205 int acad_version_number; 00207 int follow_strict_version_rules; 00209 } DxfFile; 00210 00211 00215 typedef struct 00216 dxf_char_struct 00217 { 00218 char *value; 00220 int length; 00222 struct DxfChar *next; 00225 } DxfChar; 00226 00227 00231 typedef struct 00232 dxf_double_struct 00233 { 00234 double value; 00236 struct DxfDouble *next; 00239 } DxfDouble; 00240 00241 00245 typedef struct 00246 dxf_int_struct 00247 { 00248 int value; 00250 struct DxfInt *next; 00253 } DxfInt; 00254 00255 00256 /* AutoCAD(TM) versions by name */ 00257 #define AutoCAD_1_0 0 00258 00259 #define AutoCAD_1_2 120 00260 00261 #define AutoCAD_1_40 140 00262 00263 #define AutoCAD_1_50 150 00264 00265 #define AutoCAD_2_10 210 00266 00267 #define AutoCAD_2_21 221 00268 00269 /* 00270 #define AutoCAD_2_22 222 00271 */ 00272 #define AutoCAD_2_22 1001 00273 00274 #define AutoCAD_2_50 1002 00275 00276 #define AutoCAD_2_60 1003 00277 00278 #define AutoCAD_9 1004 00279 00280 #define AutoCAD_10 1006 00281 00282 #define AutoCAD_11 1009 00283 00284 #define AutoCAD_12 1009 00285 00286 #define AutoCAD_13 1012 00287 00288 #define AutoCAD_14 1014 00289 00290 #define AutoCAD_2000 1015 00291 00292 #define AutoCAD_2000i 1016 00293 00294 #define AutoCAD_2002 1017 00295 00296 #define AutoCAD_2004 1018 00297 00298 #define AutoCAD_2005 1019 00299 00300 #define AutoCAD_2006 1020 00301 00302 #define AutoCAD_2007 1021 00303 00304 #define AutoCAD_2008 1022 00305 00306 #define AutoCAD_2009 1023 00307 00308 #define AutoCAD_2010 1024 00309 00310 #define AutoCAD_2011 1025 00311 00312 #define AutoCAD_2012 1026 00313 00314 #define AutoCAD_2013 1027 00315 00316 #define AutoCAD_LT2 1009 00317 00318 #define AutoCAD_LT95 1012 00319 00320 #define AutoCAD_LT97 1014 00321 00322 #define AutoCAD_LT98 1014 00323 00325 /* AutoCAD(TM) versions by version string */ 00326 #define MC0_0 0 00327 00328 #define AC1_2 120 00329 00330 #define AC1_40 140 00331 00332 #define AC1_50 150 00333 00334 #define AC2_10 210 00335 00336 #define AC2_21 221 00337 00338 #define AC2_22 222 00339 00342 #define AC1001 1001 00343 00344 #define AC1002 1002 00345 00346 #define AC1003 1003 00347 00348 #define AC1004 1004 00349 00350 #define AC1006 1006 00351 00352 #define AC1009 1009 00353 00354 #define AC1012 1012 00355 00356 #define AC1014 1014 00357 00358 #define AC1015 1015 00359 00360 #define AC1016 1016 00361 00362 #define AC1017 1017 00363 00364 #define AC1018 1018 00365 00366 #define AC1019 1019 00367 00368 #define AC1020 1020 00369 00370 #define AC1021 1021 00371 00372 #define AC1022 1022 00373 00374 #define AC1023 1023 00375 00376 #define AC1024 1024 00377 00378 #define AC1025 1025 00379 00380 #define AC1026 1026 00381 00382 #define AC1027 1027 00383 00386 #define DXF_MAX_PARAM 2000 00387 00389 #define DXF_MAX_NUMBER_OF_DASH_LENGTH_ITEMS 16 00390 00393 #ifdef MSDOS 00394 # define DXF_MAX_STRING_LENGTH 255 00395 00399 #else 00400 # define DXF_MAX_STRING_LENGTH 2049 00401 00404 #endif 00405 00406 #define DXF_COLOR_INDEX_MAX_NUMBER_OF_COLORS 256 00407 00409 #define DXF_COLOR_BYBLOCK 0 00410 00413 #define DXF_COLOR_RED 1 00414 00417 #define DXF_COLOR_YELLOW 2 00418 00421 #define DXF_COLOR_GREEN 3 00422 00425 #define DXF_COLOR_CYAN 4 00426 00429 #define DXF_COLOR_BLUE 5 00430 00433 #define DXF_COLOR_MAGENTA 6 00434 00437 #define DXF_COLOR_WHITE 7 00438 00441 #define DXF_COLOR_GREY 8 00442 00445 #define DXF_COLOR_BYLAYER 256 00446 00449 #define DXF_FLATLAND 0 00450 00453 #define DXF_MODELER_FORMAT_CURRENT_VERSION 1 00454 00456 #define DXF_MODELSPACE 0 00457 00462 #define DXF_PAPERSPACE 1 00463 00469 #define DXF_DEFAULT_LAYER "0" 00470 00475 #define DXF_DEFAULT_LINETYPE "BYLAYER" 00476 00481 #define DXF_DEFAULT_LINETYPE_SCALE 1.0 00482 00484 #define DXF_DEFAULT_VISIBILITY 0 00485 00487 #define DXF_DEFAULT_PROXY_ENTITY_ID 498 00488 00490 #define DXF_DEFAULT_TEXTSTYLE "STANDARD" 00491 00496 #define DXF_MAX_LAYERS 2048 00497 00499 #define DXF_VIEWPORT_APP_NAME "ACAD" 00500 00504 #define DXF_VIEWPORT_DATA "MVIEW" 00505 00509 #define DXF_VIEWPORT_WINDOW_BEGIN "{" 00510 00514 #define DXF_VIEWPORT_WINDOW_END "}" 00515 00519 #define DXF_VIEWPORT_FROZEN_LAYER_LIST_BEGIN "{" 00520 00524 #define DXF_VIEWPORT_FROZEN_LAYER_LIST_END "}" 00525 00529 #define DXF_CHECK_BIT(var,pos) ((var & (1 << pos)) == (1 << pos)) 00530 00532 #define DXF_SYMBOL_TABLE_ENTRY_IS_EXTERNALLY_DEPENDANT 16 00533 00536 #define DXF_SYMBOL_TABLE_ENTRY_DEPENDENCY_IS_RESOLVED 32 00537 00540 #define DXF_SYMBOL_TABLE_ENTRY_IS_REFERENCED 64 00541 00545 #endif /* LIBDXF_SRC_GLOBAL_H */ 00546 00547 00548 /* EOF */