Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Basic.h

00001 /**************************************************************************\
00002  * 
00003  *  FILE: Basic.h
00004  *
00005  *  This source file is part of DIME.
00006  *  Copyright (C) 1998-1999 by Systems In Motion.  All rights reserved.
00007  *
00008  *  This library is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License, version 2, as
00010  *  published by the Free Software Foundation.
00011  *
00012  *  This library is distributed in the hope that it will be useful, but
00013  *  WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *  General Public License (the accompanying file named COPYING) for more
00016  *  details.
00017  *
00018  **************************************************************************
00019  *
00020  *  If you need DIME for a non-GPL project, contact Systems In Motion
00021  *  to acquire a Professional Edition License:
00022  *
00023  *  Systems In Motion                                   http://www.sim.no/
00024  *  Prof. Brochs gate 6                                       sales@sim.no
00025  *  N-7030 Trondheim                                   Voice: +47 22114160
00026  *  NORWAY                                               Fax: +47 67172912
00027  *
00028 \**************************************************************************/
00029 
00030 #ifndef DIME_BASIC_H
00031 #define DIME_BASIC_H
00032 
00033 #include <stdlib.h>
00034 #include <stdio.h>
00035 #include <stdarg.h>
00036 #include <string.h>
00037 #include <assert.h>
00038 #include <math.h>
00039 
00040 // we prefer to use floats to save mem. Applications needing
00041 // scientific calculations should typedef this to double
00042 typedef float dxfdouble;
00043 
00044 #define DXFABS(x) ((x)<0?-(x):(x))
00045 #define DXFMAX(x,y) ((x)>(y)?(x):(y))
00046 #define DXFMIN(x,y) ((x)<(y)?(x):(y))
00047 #define DXFDEG2RAD(x) (M_PI*(x)/180.0)
00048 #define DXFRAD2DEG(x) (180.0*(x)/M_PI)
00049 
00050 
00051 #ifdef __sgi
00052 #define bool int
00053 #define true 1
00054 #define false 0
00055 #endif // __sgi
00056 
00057 
00058 template <class T> inline
00059 T DXFSQR(const T x)
00060 {
00061   return x*x;
00062 }
00063 
00064 #if defined(__BEOS__)
00065 #include <support/SupportDefs.h>
00066 #else // ! defined(__BEOS__)
00067 typedef signed char int8;
00068 typedef unsigned char uint8;
00069 typedef signed short int16;
00070 typedef unsigned short uint16;
00071 #ifdef _WIN32
00072 typedef long int32;
00073 #else // ! defined(_WIN32)
00074 typedef signed int int32;
00075 #endif // ! defined(_WIN32)
00076 typedef unsigned int uint32;
00077 #endif // ! defined(__BEOS__)
00078 
00079 #ifdef macintosh
00080  char* strdup( const char* );
00081 #endif
00082  
00083 #define ARRAY_NEW(memh, type, num) \
00084 memh ? (type*) memh->allocMem((num)*sizeof(type)) : new type[num]
00085 
00086 #define DXF_STRCPY(mh, d, s) \
00087 mh ? d = mh->stringAlloc(s) : d = new char[strlen(s)+1]; if (d) strcpy(d,s)
00088 
00089 typedef bool dimeCallbackFunc(const class dimeState * const, class dimeEntity *, void *);
00090 typedef dimeCallbackFunc * dimeCallback;
00091 
00092 typedef union {
00093   int8  int8_data;
00094   int16 int16_data;
00095   int32 int32_data;
00096   float float_data;
00097   dxfdouble double_data;
00098   const char *string_data;
00099   const char *hex_data;
00100 } dimeParam;
00101 
00102 #endif // ! DIME_BASIC_H
00103 

Copyright © 1998-1999, Systems In Motion <sales@sim.no>. All rights reserved.
System documentation was generated using doxygen.