*** empty log message ***

This commit is contained in:
David Rose 2001-03-22 18:48:27 +00:00
parent 84a5eadefc
commit c124fea0a3
26 changed files with 137 additions and 363 deletions

View File

@ -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

View File

@ -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 <unistd.h>/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

View File

@ -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

View File

@ -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

View File

@ -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>
{{{
}}}
###############################################################################

View File

@ -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 <iostream>
#include <fstream>
#else
#include <iostream.h>
#include <fstream.h>
#endif
#include <string>
// 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 <io.h>
#include <malloc.h>
#else
#include <unistd.h>
#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

View File

@ -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

View File

@ -4,9 +4,8 @@
////////////////////////////////////////////////////////////////////
#include "dcAtomicField.h"
#include "indent.h"
#include "dcindent.h"
#include <assert.h>
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;
}

View File

@ -4,9 +4,7 @@
////////////////////////////////////////////////////////////////////
#include "dcClass.h"
#include "indent.h"
#include <assert.h>
#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];
}

View File

@ -7,7 +7,6 @@
#include "dcParserDefs.h"
#include "dcLexerDefs.h"
#include <assert.h>
////////////////////////////////////////////////////////////////////
// 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];
}

View File

@ -9,9 +9,8 @@
#include "dcLexerDefs.h"
#include "dcParserDefs.h"
#include "dcParser.h"
#include "indent.h"
#include "dcindent.h"
#include <assert.h>
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();

View File

@ -5,9 +5,8 @@
#include "dcMolecularField.h"
#include "dcAtomicField.h"
#include "indent.h"
#include "dcindent.h"
#include <assert.h>
////////////////////////////////////////////////////////////////////
@ -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];
}

View File

@ -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;

View File

@ -35,6 +35,8 @@ enum DCSubatomicType {
ST_int32array,
ST_uint16array,
ST_uint32array,
ST_invalid
};
END_PUBLISH

View File

@ -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 <directbase.h>
#include <notify.h>
#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 <iostream>
#include <fstream>
#else
#include <iostream.h>
#include <fstream.h>
#endif
#include <string>
#include <assert.h>
// 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 <io.h>
#include <malloc.h>
#else
#include <unistd.h>
#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

View File

@ -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

View File

@ -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 <indent.h>
#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