diff --git a/direct/metalibs/direct/Sources.pp b/direct/metalibs/direct/Sources.pp index aa005eec57..6ef6a6a60f 100644 --- a/direct/metalibs/direct/Sources.pp +++ b/direct/metalibs/direct/Sources.pp @@ -8,7 +8,7 @@ #define BUILDING_DLL BUILDING_DIRECT #define COMPONENT_LIBS \ - directbase dcparse showbase deadrec + directbase dcparser showbase deadrec #define OTHER_LIBS panda pandaexpress dtoolconfig dtool diff --git a/direct/src/dcparse/Makefile.gnu b/direct/src/dcparse/Makefile.gnu deleted file mode 100644 index 5fe25bf4c8..0000000000 --- a/direct/src/dcparse/Makefile.gnu +++ /dev/null @@ -1,34 +0,0 @@ -OFILES = \ - dcParser.o dcLexer.o \ - dcAtomicField.o dcClass.o dcField.o dcFile.o dcMolecularField.o \ - dcSubatomicType.o indent.o \ - dcparse.o - -# Cheesy dependencies. -HFILES = \ - dcAtomicField.h dcClass.h dcClassDescription.h dcField.h dcFile.h \ - dcLexerDefs.h dcMolecularField.h dcParser.h dcParserDefs.h \ - dcSubatomicType.h dcbase.h indent.h - -dcparse : $(OFILES) - g++ -o $@ $(OFILES) - -dcParser.cxx : dcParser.yxx - bison -d --name-prefix=dcyy -o $@ $< - mv $@.h dcParser.h - -dcLexer.cxx : dcLexer.lxx - flex -Pdcyy -ot.lex $< - sed '/#include /d' t.lex >$@ - rm -f t.lex - -%.o: %.cxx $(HFILES) - g++ -c -g -Wall -o $@ $< - -clean: - rm -f *.o dcparse - -zip: - rm -f dcparse.zip - zip dcparse.zip Makefile.gnu *.cxx *.h *.lxx *.yxx *.dc \ - dc.dsp dc.dsw diff --git a/direct/src/dcparse/Sources.pp b/direct/src/dcparse/Sources.pp index bb0848bf82..d18897aa7d 100644 --- a/direct/src/dcparse/Sources.pp +++ b/direct/src/dcparse/Sources.pp @@ -1,30 +1,15 @@ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ dtoolutil:c dtoolbase:c dtool:m -#define YACC_PREFIX dcyy +#define LOCAL_LIBS \ + dcparser +#define C++FLAGS -DWITHIN_PANDA -#begin lib_target +#begin bin_target #define TARGET dcparse - - #define SOURCES \ - dcAtomicField.cxx dcAtomicField.h dcClass.cxx dcClass.h \ - dcField.cxx dcField.h dcFile.cxx dcFile.h dcLexer.lxx dcLexerDefs.h \ - dcMolecularField.cxx dcMolecularField.h dcParser.yxx \ - dcParserDefs.h dcSubatomicType.cxx dcSubatomicType.h dcbase.h \ - indent.cxx indent.h - - #define EXTRA_DIST test.dc dc.dsp dc.dsw - - #define IGATESCAN all -#end lib_target - -#begin test_bin_target - #define TARGET dcparse - #define LOCAL_LIBS dcparse + #define LOCAL_LIBS dcparser #define OTHER_LIBS $[OTHER_LIBS] pystub #define SOURCES \ dcparse.cxx - - #define EXTRA_DIST test.dc dc.dsp dc.dsw -#end test_bin_target +#end bin_target diff --git a/direct/src/dcparse/dc.dsp b/direct/src/dcparse/dc.dsp deleted file mode 100644 index 669edf3cc5..0000000000 --- a/direct/src/dcparse/dc.dsp +++ /dev/null @@ -1,184 +0,0 @@ -# Microsoft Developer Studio Project File - Name="dc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=dc - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "dc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "dc.mak" CFG="dc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dc - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "dc - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "dc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "dc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "dc - Win32 Release" -# Name "dc - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\dcAtomicField.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcClass.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcField.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcFile.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcLexer.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcMolecularField.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcparse.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcParser.cxx -# End Source File -# Begin Source File - -SOURCE=.\dcSubatomicType.cxx -# End Source File -# Begin Source File - -SOURCE=.\indent.cxx -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\dcAtomicField.h -# End Source File -# Begin Source File - -SOURCE=.\dcbase.h -# End Source File -# Begin Source File - -SOURCE=.\dcClass.h -# End Source File -# Begin Source File - -SOURCE=.\dcClassDescription.h -# End Source File -# Begin Source File - -SOURCE=.\dcField.h -# End Source File -# Begin Source File - -SOURCE=.\dcFile.h -# End Source File -# Begin Source File - -SOURCE=.\dcLexerDefs.h -# End Source File -# Begin Source File - -SOURCE=.\dcMolecularField.h -# End Source File -# Begin Source File - -SOURCE=.\dcParser.h -# End Source File -# Begin Source File - -SOURCE=.\dcParserDefs.h -# End Source File -# Begin Source File - -SOURCE=.\dcSubatomicType.h -# End Source File -# Begin Source File - -SOURCE=.\indent.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/direct/src/dcparse/dc.dsw b/direct/src/dcparse/dc.dsw deleted file mode 100644 index 19535d4c6c..0000000000 --- a/direct/src/dcparse/dc.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "dc"=.\dc.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/direct/src/dcparse/dcbase.h b/direct/src/dcparse/dcbase.h deleted file mode 100644 index a6bc31dcf2..0000000000 --- a/direct/src/dcparse/dcbase.h +++ /dev/null @@ -1,66 +0,0 @@ -// Filename: dcbase.h -// Created by: drose (05Oct00) -// -//////////////////////////////////////////////////////////////////// - -#ifndef DCBASE_H -#define DCBASE_H - -// This file defines a few headers and stuff necessary for compilation -// of this project. Most compiler-specific decisions should be -// grouped up here. - -#ifdef WIN32 -/* C4786: 255 char debug symbols */ -#pragma warning (disable : 4786) -/* C4503: decorated name length exceeded */ -#pragma warning (disable : 4503) -#endif /* WIN32_VC */ - -#if defined(WIN32) || defined(CPPPARSER) -#include -#include -#else -#include -#include -#endif - -#include - -// These header files are needed to compile dcLexer.cxx, the output -// from flex. flex doesn't create a perfectly windows-friendly source -// file right out of the box. -#ifdef WIN32 -#include -#include -#else -#include -#endif - -using namespace std; - -#ifdef CPPPARSER -// We define the macro PUBLISHED to mark C++ methods that are to be -// published via interrogate to scripting languages. However, if -// we're not running the interrogate pass (CPPPARSER isn't defined), -// this maps to public. -#define PUBLISHED __published -#else -#define PUBLISHED public -#endif - -/* - We define the macros BEGIN_PUBLISH and END_PUBLISH to bracket - functions and global variable definitions that are to be published - via interrogate to scripting languages. - */ -#ifdef CPPPARSER -#define BEGIN_PUBLISH __begin_publish -#define END_PUBLISH __end_publish -#else -#define BEGIN_PUBLISH -#define END_PUBLISH -#endif - -#endif - diff --git a/direct/src/dcparser/Sources.pp b/direct/src/dcparser/Sources.pp new file mode 100644 index 0000000000..c3af3d7a69 --- /dev/null +++ b/direct/src/dcparser/Sources.pp @@ -0,0 +1,21 @@ +#define OTHER_LIBS \ + express:c pandaexpress:m \ + interrogatedb:c dconfig:c dtoolconfig:m \ + dtoolutil:c dtoolbase:c dtool:m +#define LOCAL_LIBS \ + directbase +#define YACC_PREFIX dcyy +#define C++FLAGS -DWITHIN_PANDA + +#begin lib_target + #define TARGET dcparser + + #define SOURCES \ + dcAtomicField.cxx dcAtomicField.h dcClass.cxx dcClass.h \ + dcField.cxx dcField.h dcFile.cxx dcFile.h dcLexer.lxx dcLexerDefs.h \ + dcMolecularField.cxx dcMolecularField.h dcParser.yxx \ + dcParserDefs.h dcSubatomicType.cxx dcSubatomicType.h dcbase.h \ + dcindent.cxx dcindent.h + + #define IGATESCAN all +#end lib_target diff --git a/direct/src/dcparse/dcAtomicField.cxx b/direct/src/dcparser/dcAtomicField.cxx similarity index 98% rename from direct/src/dcparse/dcAtomicField.cxx rename to direct/src/dcparser/dcAtomicField.cxx index e898f08724..04b7e8e1cf 100644 --- a/direct/src/dcparse/dcAtomicField.cxx +++ b/direct/src/dcparser/dcAtomicField.cxx @@ -4,9 +4,8 @@ //////////////////////////////////////////////////////////////////// #include "dcAtomicField.h" -#include "indent.h" +#include "dcindent.h" -#include ostream & operator << (ostream &out, const DCAtomicField::ElementType &et) { @@ -47,7 +46,7 @@ get_num_elements() const { //////////////////////////////////////////////////////////////////// DCSubatomicType DCAtomicField:: get_element_type(int n) const { - assert(n >= 0 && n < (int)_elements.size()); + nassertr(n >= 0 && n < (int)_elements.size(), ST_invalid); return _elements[n]._type; } @@ -62,7 +61,7 @@ get_element_type(int n) const { //////////////////////////////////////////////////////////////////// int DCAtomicField:: get_element_divisor(int n) const { - assert(n >= 0 && n < (int)_elements.size()); + nassertr(n >= 0 && n < (int)_elements.size(), 1); return _elements[n]._divisor; } diff --git a/direct/src/dcparse/dcAtomicField.h b/direct/src/dcparser/dcAtomicField.h similarity index 100% rename from direct/src/dcparse/dcAtomicField.h rename to direct/src/dcparser/dcAtomicField.h diff --git a/direct/src/dcparse/dcClass.cxx b/direct/src/dcparser/dcClass.cxx similarity index 98% rename from direct/src/dcparse/dcClass.cxx rename to direct/src/dcparser/dcClass.cxx index 5ff7acf7b7..c2b7b29c94 100644 --- a/direct/src/dcparse/dcClass.cxx +++ b/direct/src/dcparser/dcClass.cxx @@ -4,9 +4,7 @@ //////////////////////////////////////////////////////////////////// #include "dcClass.h" -#include "indent.h" - -#include +#include "dcindent.h" //////////////////////////////////////////////////////////////////// // Function: DCClass::get_number @@ -50,7 +48,7 @@ has_parent() const { //////////////////////////////////////////////////////////////////// DCClass *DCClass:: get_parent() const { - assert(has_parent()); + nassertr(has_parent(), NULL); return _parents.front(); } @@ -75,7 +73,7 @@ get_num_fields() { //////////////////////////////////////////////////////////////////// DCField *DCClass:: get_field(int n) { - assert(n >= 0 && n < (int)_fields.size()); + nassertr(n >= 0 && n < (int)_fields.size(), NULL); return _fields[n]; } diff --git a/direct/src/dcparse/dcClass.h b/direct/src/dcparser/dcClass.h similarity index 100% rename from direct/src/dcparse/dcClass.h rename to direct/src/dcparser/dcClass.h diff --git a/direct/src/dcparse/dcField.cxx b/direct/src/dcparser/dcField.cxx similarity index 100% rename from direct/src/dcparse/dcField.cxx rename to direct/src/dcparser/dcField.cxx diff --git a/direct/src/dcparse/dcField.h b/direct/src/dcparser/dcField.h similarity index 100% rename from direct/src/dcparse/dcField.h rename to direct/src/dcparser/dcField.h diff --git a/direct/src/dcparse/dcFile.cxx b/direct/src/dcparser/dcFile.cxx similarity index 98% rename from direct/src/dcparse/dcFile.cxx rename to direct/src/dcparser/dcFile.cxx index 9cdb0a379f..1a7f5a7163 100644 --- a/direct/src/dcparse/dcFile.cxx +++ b/direct/src/dcparser/dcFile.cxx @@ -7,7 +7,6 @@ #include "dcParserDefs.h" #include "dcLexerDefs.h" -#include //////////////////////////////////////////////////////////////////// // Function: DCFile::Constructor @@ -146,7 +145,7 @@ get_num_classes() { //////////////////////////////////////////////////////////////////// DCClass *DCFile:: get_class(int n) { - assert(n >= 0 && n < (int)_classes.size()); + nassertr(n >= 0 && n < (int)_classes.size(), NULL); return _classes[n]; } diff --git a/direct/src/dcparse/dcFile.h b/direct/src/dcparser/dcFile.h similarity index 100% rename from direct/src/dcparse/dcFile.h rename to direct/src/dcparser/dcFile.h diff --git a/direct/src/dcparse/dcLexer.lxx b/direct/src/dcparser/dcLexer.lxx similarity index 99% rename from direct/src/dcparse/dcLexer.lxx rename to direct/src/dcparser/dcLexer.lxx index 047541f1fb..459dd6236a 100644 --- a/direct/src/dcparse/dcLexer.lxx +++ b/direct/src/dcparser/dcLexer.lxx @@ -9,9 +9,8 @@ #include "dcLexerDefs.h" #include "dcParserDefs.h" #include "dcParser.h" -#include "indent.h" +#include "dcindent.h" -#include static int yyinput(void); // declared by flex. extern "C" int dcyywrap(); @@ -109,7 +108,7 @@ dcyywarning(const string &msg) { // stdio FILE pointer. This is flex-specific. static void input_chars(char *buffer, int &result, int max_size) { - assert(inp != NULL); + nassertv(inp != NULL); if (*inp) { inp->read(buffer, max_size); result = inp->gcount(); diff --git a/direct/src/dcparse/dcLexerDefs.h b/direct/src/dcparser/dcLexerDefs.h similarity index 100% rename from direct/src/dcparse/dcLexerDefs.h rename to direct/src/dcparser/dcLexerDefs.h diff --git a/direct/src/dcparse/dcMolecularField.cxx b/direct/src/dcparser/dcMolecularField.cxx similarity index 96% rename from direct/src/dcparse/dcMolecularField.cxx rename to direct/src/dcparser/dcMolecularField.cxx index 5c50f006d3..194c0a7e64 100644 --- a/direct/src/dcparse/dcMolecularField.cxx +++ b/direct/src/dcparser/dcMolecularField.cxx @@ -5,9 +5,8 @@ #include "dcMolecularField.h" #include "dcAtomicField.h" -#include "indent.h" +#include "dcindent.h" -#include //////////////////////////////////////////////////////////////////// @@ -43,7 +42,7 @@ get_num_atomics() const { //////////////////////////////////////////////////////////////////// DCAtomicField *DCMolecularField:: get_atomic(int n) const { - assert(n >= 0 && n < (int)_fields.size()); + nassertr(n >= 0 && n < (int)_fields.size(), NULL); return _fields[n]; } diff --git a/direct/src/dcparse/dcMolecularField.h b/direct/src/dcparser/dcMolecularField.h similarity index 100% rename from direct/src/dcparse/dcMolecularField.h rename to direct/src/dcparser/dcMolecularField.h diff --git a/direct/src/dcparse/dcParser.yxx b/direct/src/dcparser/dcParser.yxx similarity index 100% rename from direct/src/dcparse/dcParser.yxx rename to direct/src/dcparser/dcParser.yxx diff --git a/direct/src/dcparse/dcParserDefs.h b/direct/src/dcparser/dcParserDefs.h similarity index 100% rename from direct/src/dcparse/dcParserDefs.h rename to direct/src/dcparser/dcParserDefs.h diff --git a/direct/src/dcparse/dcSubatomicType.cxx b/direct/src/dcparser/dcSubatomicType.cxx similarity index 95% rename from direct/src/dcparse/dcSubatomicType.cxx rename to direct/src/dcparser/dcSubatomicType.cxx index 0d65bdc42c..4cad5608ab 100644 --- a/direct/src/dcparse/dcSubatomicType.cxx +++ b/direct/src/dcparser/dcSubatomicType.cxx @@ -52,6 +52,9 @@ operator << (ostream &out, DCSubatomicType type) { case ST_uint32array: return out << "uint32array"; + + case ST_invalid: + return out << "invalid"; } return out << "invalid type: " << (int)type; diff --git a/direct/src/dcparse/dcSubatomicType.h b/direct/src/dcparser/dcSubatomicType.h similarity index 98% rename from direct/src/dcparse/dcSubatomicType.h rename to direct/src/dcparser/dcSubatomicType.h index f8573dd18c..278dca1644 100644 --- a/direct/src/dcparse/dcSubatomicType.h +++ b/direct/src/dcparser/dcSubatomicType.h @@ -35,6 +35,8 @@ enum DCSubatomicType { ST_int32array, ST_uint16array, ST_uint32array, + + ST_invalid }; END_PUBLISH diff --git a/direct/src/dcparser/dcbase.h b/direct/src/dcparser/dcbase.h new file mode 100644 index 0000000000..5e45e83b9b --- /dev/null +++ b/direct/src/dcparser/dcbase.h @@ -0,0 +1,75 @@ +// Filename: dcbase.h +// Created by: drose (05Oct00) +// +//////////////////////////////////////////////////////////////////// + +#ifndef DCBASE_H +#define DCBASE_H + +// This file defines a few headers and stuff necessary for compilation +// of the files in this directory. This is different from most of the +// other source directories within Panda, since the dcparser is +// designed to be compilable outside of Panda (for use by the server +// code). Therefore, it must not depend on including any of the Panda +// header files, and we have to duplicate some setup stuff here. + +#ifdef WITHIN_PANDA +// On the other hand, if WITHIN_PANDA is defined, we *are* safely +// within the Panda environment. + +#include +#include + +#else + +#ifdef WIN32 +/* C4786: 255 char debug symbols */ +#pragma warning (disable : 4786) +/* C4503: decorated name length exceeded */ +#pragma warning (disable : 4503) +#endif /* WIN32_VC */ + +#if defined(WIN32) +#include +#include +#else +#include +#include +#endif + +#include +#include + +// These header files are needed to compile dcLexer.cxx, the output +// from flex. flex doesn't create a perfectly windows-friendly source +// file right out of the box. +#ifdef WIN32 +#include +#include +#else +#include +#endif + +using namespace std; + +// These symbols are used within the Panda environment for exporting +// classes and functions to the scripting language. They're largely +// meaningless if we're not compiling within Panda. +#define PUBLISHED public +#define BEGIN_PUBLISH +#define END_PUBLISH + +// Panda defines some assert-type macros. We map those to the +// standard assert macro outside of Panda. +#define nassertr(condition, return_value) assert(condition) +#define nassertv(condition) assert(condition) + +// Panda defines these export symbols for building DLL's. Outside of +// Panda, we assume we're not putting this code in a DLL, so we define +// them to nothing. +#define EXPCL_DIRECT +#define EXPTP_DIRECT + +#endif // WITHIN_PANDA + +#endif // DCBASE_H diff --git a/direct/src/dcparse/indent.cxx b/direct/src/dcparser/dcindent.cxx similarity index 84% rename from direct/src/dcparse/indent.cxx rename to direct/src/dcparser/dcindent.cxx index 0ccd4d5ef4..363df48212 100644 --- a/direct/src/dcparse/indent.cxx +++ b/direct/src/dcparser/dcindent.cxx @@ -1,9 +1,11 @@ -// Filename: indent.cxx +// Filename: dcindent.cxx // Created by: drose (05May00) // //////////////////////////////////////////////////////////////////// -#include "indent.h" +#include "dcindent.h" + +#ifndef WITHIN_PANDA //////////////////////////////////////////////////////////////////// // Function: indent @@ -16,3 +18,5 @@ indent(ostream &out, int indent_level) { } return out; } + +#endif diff --git a/direct/src/dcparse/indent.h b/direct/src/dcparser/dcindent.h similarity index 70% rename from direct/src/dcparse/indent.h rename to direct/src/dcparser/dcindent.h index 13641019d6..1954fb0590 100644 --- a/direct/src/dcparse/indent.h +++ b/direct/src/dcparser/dcindent.h @@ -1,16 +1,20 @@ -// Filename: indent.h +// Filename: dcindent.h // Created by: drose (16Jan99) // //////////////////////////////////////////////////////////////////// -#ifndef INDENT_H -#define INDENT_H +#ifndef DCINDENT_H +#define DCINDENT_H #include "dcbase.h" -// We rename indent() so it won't clash with the similar function -// defined in Panda. -#define indent dcindent +#ifdef WITHIN_PANDA +// If we're compiling this within Panda, we use the function defined +// there. +#include + +#else +// Otherwise, we must define it for ourselves. //////////////////////////////////////////////////////////////////// // Function: indent @@ -23,7 +27,6 @@ ostream & indent(ostream &out, int indent_level); -#endif - - +#endif // WITHIN_PANDA +#endif // DCINDENT_H