dcparser: Add BUILDING_DIRECT_DCPARSER switch

Resolves GH #342.
This commit is contained in:
Sam Edwards 2018-08-15 20:38:00 -06:00
parent 06f7da5215
commit 97d6d84ade
25 changed files with 37 additions and 23 deletions

View File

@ -23,7 +23,7 @@
* parameter type accepts an arbitrary (or possibly fixed) number of nested * parameter type accepts an arbitrary (or possibly fixed) number of nested
* fields, all of which are of the same type. * fields, all of which are of the same type.
*/ */
class DCArrayParameter : public DCParameter { class EXPCL_DIRECT_DCPARSER DCArrayParameter : public DCParameter {
public: public:
DCArrayParameter(DCParameter *element_type, DCArrayParameter(DCParameter *element_type,
const DCUnsignedIntRange &size = DCUnsignedIntRange()); const DCUnsignedIntRange &size = DCUnsignedIntRange());

View File

@ -27,7 +27,7 @@
* This defines an interface to the Distributed Class, and is always * This defines an interface to the Distributed Class, and is always
* implemented as a remote procedure method. * implemented as a remote procedure method.
*/ */
class DCAtomicField : public DCField { class EXPCL_DIRECT_DCPARSER DCAtomicField : public DCField {
public: public:
DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field); DCAtomicField(const std::string &name, DCClass *dclass, bool bogus_field);
virtual ~DCAtomicField(); virtual ~DCAtomicField();

View File

@ -41,7 +41,7 @@ class DCParameter;
/** /**
* Defines a particular DistributedClass as read from an input .dc file. * Defines a particular DistributedClass as read from an input .dc file.
*/ */
class DCClass : public DCDeclaration { class EXPCL_DIRECT_DCPARSER DCClass : public DCDeclaration {
public: public:
DCClass(DCFile *dc_file, const std::string &name, DCClass(DCFile *dc_file, const std::string &name,
bool is_struct, bool bogus_class); bool is_struct, bool bogus_class);

View File

@ -23,7 +23,7 @@ class DCClass;
* This represents a class (or struct) object used as a parameter itself. * This represents a class (or struct) object used as a parameter itself.
* This means that all the fields of the class get packed into the message. * This means that all the fields of the class get packed into the message.
*/ */
class DCClassParameter : public DCParameter { class EXPCL_DIRECT_DCPARSER DCClassParameter : public DCParameter {
public: public:
DCClassParameter(const DCClass *dclass); DCClassParameter(const DCClass *dclass);
DCClassParameter(const DCClassParameter &copy); DCClassParameter(const DCClassParameter &copy);

View File

@ -26,7 +26,7 @@ class DCSwitch;
* only purpose is so that classes and typedefs can be stored in one list * only purpose is so that classes and typedefs can be stored in one list
* together so they can be ordered correctly on output. * together so they can be ordered correctly on output.
*/ */
class DCDeclaration { class EXPCL_DIRECT_DCPARSER DCDeclaration {
public: public:
virtual ~DCDeclaration(); virtual ~DCDeclaration();

View File

@ -34,7 +34,7 @@ class HashGenerator;
/** /**
* A single field of a Distributed Class, either atomic or molecular. * A single field of a Distributed Class, either atomic or molecular.
*/ */
class DCField : public DCPackerInterface, public DCKeywordList { class EXPCL_DIRECT_DCPARSER DCField : public DCPackerInterface, public DCKeywordList {
public: public:
DCField(); DCField();
DCField(const std::string &name, DCClass *dclass); DCField(const std::string &name, DCClass *dclass);

View File

@ -29,7 +29,7 @@ class DCDeclaration;
* Represents the complete list of Distributed Class descriptions as read from * Represents the complete list of Distributed Class descriptions as read from
* a .dc file. * a .dc file.
*/ */
class DCFile { class EXPCL_DIRECT_DCPARSER DCFile {
PUBLISHED: PUBLISHED:
DCFile(); DCFile();
~DCFile(); ~DCFile();

View File

@ -25,7 +25,7 @@ class HashGenerator;
* define a communication property associated with a field, for instance * define a communication property associated with a field, for instance
* "broadcast" or "airecv". * "broadcast" or "airecv".
*/ */
class DCKeyword : public DCDeclaration { class EXPCL_DIRECT_DCPARSER DCKeyword : public DCDeclaration {
public: public:
DCKeyword(const std::string &name, int historical_flag = ~0); DCKeyword(const std::string &name, int historical_flag = ~0);
virtual ~DCKeyword(); virtual ~DCKeyword();

View File

@ -23,7 +23,7 @@ class HashGenerator;
* This is a list of keywords (see DCKeyword) that may be set on a particular * This is a list of keywords (see DCKeyword) that may be set on a particular
* field. * field.
*/ */
class DCKeywordList { class EXPCL_DIRECT_DCPARSER DCKeywordList {
public: public:
DCKeywordList(); DCKeywordList();
DCKeywordList(const DCKeywordList &copy); DCKeywordList(const DCKeywordList &copy);

View File

@ -25,7 +25,7 @@ class DCParameter;
* This represents a combination of two or more related atomic fields, that * This represents a combination of two or more related atomic fields, that
* will often be treated as a unit. * will often be treated as a unit.
*/ */
class DCMolecularField : public DCField { class EXPCL_DIRECT_DCPARSER DCMolecularField : public DCField {
public: public:
DCMolecularField(const std::string &name, DCClass *dclass); DCMolecularField(const std::string &name, DCClass *dclass);

View File

@ -23,7 +23,7 @@
* to constrain simple numeric types, as well as array sizes. * to constrain simple numeric types, as well as array sizes.
*/ */
template <class NUM> template <class NUM>
class DCNumericRange { class EXPCL_DIRECT_DCPARSER DCNumericRange {
public: public:
typedef NUM Number; typedef NUM Number;

View File

@ -19,7 +19,7 @@
/** /**
* This is a block of data that receives the results of DCPacker. * This is a block of data that receives the results of DCPacker.
*/ */
class DCPackData { class EXPCL_DIRECT_DCPARSER DCPackData {
PUBLISHED: PUBLISHED:
INLINE DCPackData(); INLINE DCPackData();
INLINE ~DCPackData(); INLINE ~DCPackData();

View File

@ -31,7 +31,7 @@ class DCSwitchParameter;
* See also direct/src/doc/dcPacker.txt for a more complete description and * See also direct/src/doc/dcPacker.txt for a more complete description and
* examples of using this class. * examples of using this class.
*/ */
class DCPacker { class EXPCL_DIRECT_DCPARSER DCPacker {
PUBLISHED: PUBLISHED:
DCPacker(); DCPacker();
~DCPacker(); ~DCPacker();

View File

@ -26,7 +26,7 @@ class DCSwitchParameter;
* requested from a particular field; its ownership is retained by the field * requested from a particular field; its ownership is retained by the field
* so it must not be deleted. * so it must not be deleted.
*/ */
class DCPackerCatalog { class EXPCL_DIRECT_DCPARSER DCPackerCatalog {
private: private:
DCPackerCatalog(const DCPackerInterface *root); DCPackerCatalog(const DCPackerInterface *root);
DCPackerCatalog(const DCPackerCatalog &copy); DCPackerCatalog(const DCPackerCatalog &copy);

View File

@ -64,7 +64,7 @@ END_PUBLISH
* Normally these methods are called only by the DCPacker object; the user * Normally these methods are called only by the DCPacker object; the user
* wouldn't normally call these directly. * wouldn't normally call these directly.
*/ */
class DCPackerInterface { class EXPCL_DIRECT_DCPARSER DCPackerInterface {
public: public:
DCPackerInterface(const std::string &name = std::string()); DCPackerInterface(const std::string &name = std::string());
DCPackerInterface(const DCPackerInterface &copy); DCPackerInterface(const DCPackerInterface &copy);

View File

@ -32,7 +32,7 @@ class HashGenerator;
* This may also be a typedef reference to another type, which has the same * This may also be a typedef reference to another type, which has the same
* properties as the referenced type, but a different name. * properties as the referenced type, but a different name.
*/ */
class DCParameter : public DCField { class EXPCL_DIRECT_DCPARSER DCParameter : public DCField {
protected: protected:
DCParameter(); DCParameter();
DCParameter(const DCParameter &copy); DCParameter(const DCParameter &copy);

View File

@ -43,7 +43,7 @@ extern DCFile *dc_file;
// that has member functions in a union), so we'll use a class instead. That // that has member functions in a union), so we'll use a class instead. That
// means we need to declare it externally, here. // means we need to declare it externally, here.
class DCTokenType { class EXPCL_DIRECT_DCPARSER DCTokenType {
public: public:
union U { union U {
int s_int; int s_int;

View File

@ -25,7 +25,7 @@
* divisor, which is meaningful only for the numeric type elements (and * divisor, which is meaningful only for the numeric type elements (and
* represents a fixed-point numeric convention). * represents a fixed-point numeric convention).
*/ */
class DCSimpleParameter : public DCParameter { class EXPCL_DIRECT_DCPARSER DCSimpleParameter : public DCParameter {
public: public:
DCSimpleParameter(DCSubatomicType type, unsigned int divisor = 1); DCSimpleParameter(DCSubatomicType type, unsigned int divisor = 1);
DCSimpleParameter(const DCSimpleParameter &copy); DCSimpleParameter(const DCSimpleParameter &copy);

View File

@ -27,7 +27,7 @@ class DCField;
* and represents two or more alternative unpacking schemes based on the first * and represents two or more alternative unpacking schemes based on the first
* field read. * field read.
*/ */
class DCSwitch : public DCDeclaration { class EXPCL_DIRECT_DCPARSER DCSwitch : public DCDeclaration {
public: public:
DCSwitch(const std::string &name, DCField *key_parameter); DCSwitch(const std::string &name, DCField *key_parameter);
virtual ~DCSwitch(); virtual ~DCSwitch();

View File

@ -23,7 +23,7 @@ class DCSwitch;
* This represents a switch object used as a parameter itself, which packs the * This represents a switch object used as a parameter itself, which packs the
* appropriate fields of the switch into the message. * appropriate fields of the switch into the message.
*/ */
class DCSwitchParameter : public DCParameter { class EXPCL_DIRECT_DCPARSER DCSwitchParameter : public DCParameter {
public: public:
DCSwitchParameter(const DCSwitch *dswitch); DCSwitchParameter(const DCSwitch *dswitch);
DCSwitchParameter(const DCSwitchParameter &copy); DCSwitchParameter(const DCSwitchParameter &copy);

View File

@ -23,7 +23,7 @@ class DCParameter;
* This represents a single typedef declaration in the dc file. It assigns a * This represents a single typedef declaration in the dc file. It assigns a
* particular type to a new name, just like a C typedef. * particular type to a new name, just like a C typedef.
*/ */
class DCTypedef : public DCDeclaration { class EXPCL_DIRECT_DCPARSER DCTypedef : public DCDeclaration {
public: public:
DCTypedef(DCParameter *parameter, bool implicit = false); DCTypedef(DCParameter *parameter, bool implicit = false);
DCTypedef(const std::string &name); DCTypedef(const std::string &name);

View File

@ -70,6 +70,11 @@
#define END_PUBLISH #define END_PUBLISH
#define BLOCKING #define BLOCKING
// These control the declspec(dllexport/dllimport) on Windows. When compiling
// outside of Panda, we assume we aren't part of a DLL.
#define EXPCL_DIRECT_DCPARSER
#define EXPTP_DIRECT_DCPARSER
// Panda defines some assert-type macros. We map those to the standard assert // Panda defines some assert-type macros. We map those to the standard assert
// macro outside of Panda. // macro outside of Panda.
#define nassertr(condition, return_value) assert(condition) #define nassertr(condition, return_value) assert(condition)

View File

@ -20,7 +20,7 @@
/** /**
* This class generates an arbitrary hash number from a sequence of ints. * This class generates an arbitrary hash number from a sequence of ints.
*/ */
class HashGenerator { class EXPCL_DIRECT_DCPARSER HashGenerator {
public: public:
HashGenerator(); HashGenerator();

View File

@ -30,7 +30,7 @@ typedef std::vector<int> vector_int;
* For a given integer n, it will return the nth prime number. This will * For a given integer n, it will return the nth prime number. This will
* involve a recompute step only if n is greater than any previous n. * involve a recompute step only if n is greater than any previous n.
*/ */
class PrimeNumberGenerator { class EXPCL_DIRECT_DCPARSER PrimeNumberGenerator {
public: public:
PrimeNumberGenerator(); PrimeNumberGenerator();

View File

@ -18,6 +18,7 @@
/* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */ /* BUILDING_DIRECT is just a buildsystem shortcut for all of these: */
#ifdef BUILDING_DIRECT #ifdef BUILDING_DIRECT
#define BUILDING_DIRECT_DCPARSER
#define BUILDING_DIRECT_DEADREC #define BUILDING_DIRECT_DEADREC
#define BUILDING_DIRECT_DIRECTD #define BUILDING_DIRECT_DIRECTD
#define BUILDING_DIRECT_INTERVAL #define BUILDING_DIRECT_INTERVAL
@ -26,6 +27,14 @@
#define BUILDING_DIRECT_DISTRIBUTED #define BUILDING_DIRECT_DISTRIBUTED
#endif #endif
#ifdef BUILDING_DIRECT_DCPARSER
#define EXPCL_DIRECT_DCPARSER EXPORT_CLASS
#define EXPTP_DIRECT_DCPARSER EXPORT_TEMPL
#else
#define EXPCL_DIRECT_DCPARSER IMPORT_CLASS
#define EXPTP_DIRECT_DCPARSER IMPORT_TEMPL
#endif
#ifdef BUILDING_DIRECT_DEADREC #ifdef BUILDING_DIRECT_DEADREC
#define EXPCL_DIRECT_DEADREC EXPORT_CLASS #define EXPCL_DIRECT_DEADREC EXPORT_CLASS
#define EXPTP_DIRECT_DEADREC EXPORT_TEMPL #define EXPTP_DIRECT_DEADREC EXPORT_TEMPL