Panda3D

dcbase.h

00001 // Filename: dcbase.h
00002 // Created by:  drose (05Oct00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef DCBASE_H
00016 #define DCBASE_H
00017 
00018 // This file defines a few headers and stuff necessary for compilation
00019 // of the files in this directory.  This is different from most of the
00020 // other source directories within Panda, since the dcparser is
00021 // designed to be compilable outside of Panda (for use by the server
00022 // code).  Therefore, it must not depend on including any of the Panda
00023 // header files, and we have to duplicate some setup stuff here.
00024 
00025 #ifdef WITHIN_PANDA
00026 // On the other hand, if WITHIN_PANDA is defined, we *are* safely
00027 // within the Panda environment.
00028 
00029 #include "directbase.h"
00030 #include "pnotify.h"
00031 #include "numeric_types.h"
00032 #include "filename.h"
00033 #include "pvector.h"
00034 #include "pmap.h"
00035 #include "pset.h"
00036 
00037 #else  // WITHIN_PANDA
00038 
00039 #ifdef WIN32
00040 /* C4786: 255 char debug symbols */
00041 #pragma warning (disable : 4786)
00042 /* C4503: decorated name length exceeded */
00043 #pragma warning (disable : 4503)
00044 #endif  /* WIN32_VC */
00045 
00046 #include <iostream>
00047 #include <fstream>
00048 #include <iomanip>
00049 #include <sstream>
00050 
00051 #include <string>
00052 #include <assert.h>
00053 
00054 // These header files are needed to compile dcLexer.cxx, the output
00055 // from flex.  flex doesn't create a perfectly windows-friendly source
00056 // file right out of the box.
00057 #ifdef WIN32
00058 #include <io.h>
00059 #include <malloc.h>
00060 #else
00061 #include <unistd.h>
00062 #endif
00063 
00064 using namespace std;
00065 
00066 #define INLINE inline
00067 #define TYPENAME typename
00068 
00069 // These symbols are used within the Panda environment for exporting
00070 // classes and functions to the scripting language.  They're largely
00071 // meaningless if we're not compiling within Panda.
00072 #define PUBLISHED public
00073 #define BEGIN_PUBLISH
00074 #define END_PUBLISH
00075 #define BLOCKING
00076 
00077 // Panda defines some assert-type macros.  We map those to the
00078 // standard assert macro outside of Panda.
00079 #define nassertr(condition, return_value) assert(condition)
00080 #define nassertr_always(condition, return_value) assert(condition)
00081 #define nassertv(condition) assert(condition)
00082 #define nassertv_always(condition) assert(condition)
00083 
00084 // Panda defines these export symbols for building DLL's.  Outside of
00085 // Panda, we assume we're not putting this code in a DLL, so we define
00086 // them to nothing.
00087 #define EXPCL_DIRECT
00088 #define EXPTP_DIRECT
00089 
00090 // Panda defines a special Filename class.  We'll use an ordinary
00091 // string instead.
00092 typedef string Filename;
00093 
00094 // Panda defines WORDS_BIGENDIAN on a bigendian machine; otherwise,
00095 // the machine is assumed to be littleendian.  Outside of Panda,
00096 // you're responsible for defining this yourself if necessary.
00097 //#define WORDS_BIGENDIAN
00098 
00099 #include <vector>
00100 #include <map>
00101 #include <set>
00102 #define pvector vector
00103 #define pmap map
00104 #define pset set
00105 
00106 #ifdef WIN32
00107 typedef __int64 PN_int64;
00108 typedef unsigned __int64 PN_uint64;
00109 #else
00110 typedef long long PN_int64;
00111 typedef unsigned long long PN_uint64;
00112 #endif
00113 
00114 typedef unsigned char PN_uint8;
00115 typedef unsigned short PN_uint16;
00116 typedef unsigned int PN_uint32;
00117 
00118 typedef ifstream pifstream;
00119 typedef ofstream pofstream;
00120 typedef fstream pfstream;
00121 
00122 #endif  // WITHIN_PANDA
00123 
00124 //typedef       unsigned long   CHANNEL_TYPE;
00125 typedef       PN_uint64   CHANNEL_TYPE;
00126 typedef       PN_uint32   DOID_TYPE;
00127 typedef       PN_uint32   ZONEID_TYPE;
00128 
00129 #endif  // DCBASE_H
 All Classes Functions Variables Enumerations