mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
allow flags on parameters too
This commit is contained in:
parent
957c8a27a9
commit
5755d6e9d4
@ -31,7 +31,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
DCAtomicField::
|
DCAtomicField::
|
||||||
DCAtomicField(const string &name) : DCField(name) {
|
DCAtomicField(const string &name) : DCField(name) {
|
||||||
_flags = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -154,117 +153,6 @@ get_element_divisor(int n) const {
|
|||||||
return simple_parameter->get_divisor();
|
return simple_parameter->get_divisor();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_required
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "required" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_required() const {
|
|
||||||
return (_flags & F_required) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_broadcast
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "broadcast" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_broadcast() const {
|
|
||||||
return (_flags & F_broadcast) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_p2p
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "p2p" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_p2p() const {
|
|
||||||
return (_flags & F_p2p) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_ram
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "ram" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_ram() const {
|
|
||||||
return (_flags & F_ram) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_db
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "db" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_db() const {
|
|
||||||
return (_flags & F_db) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_clsend
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "clsend" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_clsend() const {
|
|
||||||
return (_flags & F_clsend) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_clrecv
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "clrecv" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_clrecv() const {
|
|
||||||
return (_flags & F_clrecv) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_ownsend
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "ownsend" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_ownsend() const {
|
|
||||||
return (_flags & F_ownsend) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::is_airecv
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if the "airecv" flag is set for this
|
|
||||||
// field, false otherwise.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
is_airecv() const {
|
|
||||||
return (_flags & F_airecv) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::compare_flags
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns true if this field has the same flags
|
|
||||||
// settings as the other field, false if some flags
|
|
||||||
// differ.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
bool DCAtomicField::
|
|
||||||
compare_flags(const DCAtomicField &other) const {
|
|
||||||
return _flags == other._flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DCAtomicField::output
|
// Function: DCAtomicField::output
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
@ -286,35 +174,7 @@ output(ostream &out, bool brief) const {
|
|||||||
}
|
}
|
||||||
out << ")";
|
out << ")";
|
||||||
|
|
||||||
if ((_flags & F_required) != 0) {
|
output_flags(out);
|
||||||
out << " required";
|
|
||||||
}
|
|
||||||
if ((_flags & F_broadcast) != 0) {
|
|
||||||
out << " broadcast";
|
|
||||||
}
|
|
||||||
if ((_flags & F_p2p) != 0) {
|
|
||||||
out << " p2p";
|
|
||||||
}
|
|
||||||
if ((_flags & F_ram) != 0) {
|
|
||||||
out << " ram";
|
|
||||||
}
|
|
||||||
if ((_flags & F_db) != 0) {
|
|
||||||
out << " db";
|
|
||||||
}
|
|
||||||
if ((_flags & F_clsend) != 0) {
|
|
||||||
out << " clsend";
|
|
||||||
}
|
|
||||||
if ((_flags & F_clrecv) != 0) {
|
|
||||||
out << " clrecv";
|
|
||||||
}
|
|
||||||
if ((_flags & F_ownsend) != 0) {
|
|
||||||
out << " ownsend";
|
|
||||||
}
|
|
||||||
if ((_flags & F_airecv) != 0) {
|
|
||||||
out << " airecv";
|
|
||||||
}
|
|
||||||
|
|
||||||
out << ";";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -327,6 +187,7 @@ void DCAtomicField::
|
|||||||
write(ostream &out, bool brief, int indent_level) const {
|
write(ostream &out, bool brief, int indent_level) const {
|
||||||
indent(out, indent_level);
|
indent(out, indent_level);
|
||||||
output(out, brief);
|
output(out, brief);
|
||||||
|
out << ";";
|
||||||
if (!brief && _number >= 0) {
|
if (!brief && _number >= 0) {
|
||||||
out << " // field " << _number;
|
out << " // field " << _number;
|
||||||
}
|
}
|
||||||
@ -349,7 +210,7 @@ generate_hash(HashGenerator &hashgen) const {
|
|||||||
const ElementType &element = (*ei);
|
const ElementType &element = (*ei);
|
||||||
element._param->generate_hash(hashgen);
|
element._param->generate_hash(hashgen);
|
||||||
}
|
}
|
||||||
hashgen.add_int(_flags);
|
hashgen.add_int(get_flags());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -387,16 +248,6 @@ add_element(const DCAtomicField::ElementType &element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: DCAtomicField::add_flag
|
|
||||||
// Access: Public
|
|
||||||
// Description: Adds a new flag to the field.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void DCAtomicField::
|
|
||||||
add_flag(enum Flags flag) {
|
|
||||||
_flags |= flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DCAtomicField::ElementType::Constructor
|
// Function: DCAtomicField::ElementType::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -51,18 +51,6 @@ PUBLISHED:
|
|||||||
string get_element_name(int n) const;
|
string get_element_name(int n) const;
|
||||||
DCSubatomicType get_element_type(int n) const;
|
DCSubatomicType get_element_type(int n) const;
|
||||||
int get_element_divisor(int n) const;
|
int get_element_divisor(int n) const;
|
||||||
|
|
||||||
bool is_required() const;
|
|
||||||
bool is_broadcast() const;
|
|
||||||
bool is_p2p() const;
|
|
||||||
bool is_ram() const;
|
|
||||||
bool is_db() const;
|
|
||||||
bool is_clsend() const;
|
|
||||||
bool is_clrecv() const;
|
|
||||||
bool is_ownsend() const;
|
|
||||||
bool is_airecv() const;
|
|
||||||
|
|
||||||
bool compare_flags(const DCAtomicField &other) const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void output(ostream &out, bool brief) const;
|
virtual void output(ostream &out, bool brief) const;
|
||||||
@ -88,26 +76,11 @@ public:
|
|||||||
bool _has_default_value;
|
bool _has_default_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Flags {
|
|
||||||
F_required = 0x0001,
|
|
||||||
F_broadcast = 0x0002,
|
|
||||||
F_p2p = 0x0004,
|
|
||||||
F_ram = 0x0008,
|
|
||||||
F_db = 0x0010,
|
|
||||||
F_clsend = 0x0020,
|
|
||||||
F_clrecv = 0x0040,
|
|
||||||
F_ownsend = 0x0080,
|
|
||||||
F_airecv = 0x0100,
|
|
||||||
};
|
|
||||||
|
|
||||||
void add_element(const ElementType &element);
|
void add_element(const ElementType &element);
|
||||||
void add_flag(enum Flags flag);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef pvector<ElementType> Elements;
|
typedef pvector<ElementType> Elements;
|
||||||
Elements _elements;
|
Elements _elements;
|
||||||
|
|
||||||
int _flags; // A bitmask union of any of the above values.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -786,7 +786,9 @@ add_field(DCField *field) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
field->set_number(get_num_inherited_fields());
|
if (!is_struct()) {
|
||||||
|
field->set_number(get_num_inherited_fields());
|
||||||
|
}
|
||||||
_fields.push_back(field);
|
_fields.push_back(field);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
DCField::
|
DCField::
|
||||||
DCField(const string &name) : DCPackerInterface(name) {
|
DCField(const string &name) : DCPackerInterface(name) {
|
||||||
_number = -1;
|
_number = -1;
|
||||||
|
_flags = 0;
|
||||||
|
|
||||||
_has_nested_fields = true;
|
_has_nested_fields = true;
|
||||||
_num_nested_fields = 0;
|
_num_nested_fields = 0;
|
||||||
@ -179,6 +180,117 @@ validate_ranges(const string &packed_data) const {
|
|||||||
return (packer.get_num_unpacked_bytes() == packed_data.length());
|
return (packer.get_num_unpacked_bytes() == packed_data.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_required
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "required" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_required() const {
|
||||||
|
return (_flags & F_required) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_broadcast
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "broadcast" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_broadcast() const {
|
||||||
|
return (_flags & F_broadcast) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_p2p
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "p2p" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_p2p() const {
|
||||||
|
return (_flags & F_p2p) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_ram
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "ram" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_ram() const {
|
||||||
|
return (_flags & F_ram) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_db
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "db" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_db() const {
|
||||||
|
return (_flags & F_db) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_clsend
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "clsend" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_clsend() const {
|
||||||
|
return (_flags & F_clsend) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_clrecv
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "clrecv" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_clrecv() const {
|
||||||
|
return (_flags & F_clrecv) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_ownsend
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "ownsend" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_ownsend() const {
|
||||||
|
return (_flags & F_ownsend) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::is_airecv
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if the "airecv" flag is set for this
|
||||||
|
// field, false otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
is_airecv() const {
|
||||||
|
return (_flags & F_airecv) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::compare_flags
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if this field has the same flags
|
||||||
|
// settings as the other field, false if some flags
|
||||||
|
// differ.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DCField::
|
||||||
|
compare_flags(const DCField &other) const {
|
||||||
|
return _flags == other._flags;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DCField::pack_args
|
// Function: DCField::pack_args
|
||||||
@ -388,3 +500,68 @@ set_number(int number) {
|
|||||||
_number = number;
|
_number = number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::add_flag
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds a new flag to the field.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DCField::
|
||||||
|
add_flag(enum Flags flag) {
|
||||||
|
_flags |= flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::set_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Resets the flag bitmask to the indicated value.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DCField::
|
||||||
|
set_flags(int flags) {
|
||||||
|
_flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::get_flags
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the complete flag bitmask.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int DCField::
|
||||||
|
get_flags() const {
|
||||||
|
return _flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DCField::output_flags
|
||||||
|
// Access: Protected
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DCField::
|
||||||
|
output_flags(ostream &out) const {
|
||||||
|
if ((_flags & F_required) != 0) {
|
||||||
|
out << " required";
|
||||||
|
}
|
||||||
|
if ((_flags & F_broadcast) != 0) {
|
||||||
|
out << " broadcast";
|
||||||
|
}
|
||||||
|
if ((_flags & F_p2p) != 0) {
|
||||||
|
out << " p2p";
|
||||||
|
}
|
||||||
|
if ((_flags & F_ram) != 0) {
|
||||||
|
out << " ram";
|
||||||
|
}
|
||||||
|
if ((_flags & F_db) != 0) {
|
||||||
|
out << " db";
|
||||||
|
}
|
||||||
|
if ((_flags & F_clsend) != 0) {
|
||||||
|
out << " clsend";
|
||||||
|
}
|
||||||
|
if ((_flags & F_clrecv) != 0) {
|
||||||
|
out << " clrecv";
|
||||||
|
}
|
||||||
|
if ((_flags & F_ownsend) != 0) {
|
||||||
|
out << " ownsend";
|
||||||
|
}
|
||||||
|
if ((_flags & F_airecv) != 0) {
|
||||||
|
out << " airecv";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -54,6 +54,18 @@ PUBLISHED:
|
|||||||
|
|
||||||
bool validate_ranges(const string &packed_data) const;
|
bool validate_ranges(const string &packed_data) const;
|
||||||
|
|
||||||
|
bool is_required() const;
|
||||||
|
bool is_broadcast() const;
|
||||||
|
bool is_p2p() const;
|
||||||
|
bool is_ram() const;
|
||||||
|
bool is_db() const;
|
||||||
|
bool is_clsend() const;
|
||||||
|
bool is_clrecv() const;
|
||||||
|
bool is_ownsend() const;
|
||||||
|
bool is_airecv() const;
|
||||||
|
|
||||||
|
bool compare_flags(const DCField &other) const;
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
bool pack_args(DCPacker &packer, PyObject *sequence) const;
|
bool pack_args(DCPacker &packer, PyObject *sequence) const;
|
||||||
PyObject *unpack_args(DCPacker &packer) const;
|
PyObject *unpack_args(DCPacker &packer) const;
|
||||||
@ -72,8 +84,29 @@ public:
|
|||||||
|
|
||||||
void set_number(int number);
|
void set_number(int number);
|
||||||
|
|
||||||
|
enum Flags {
|
||||||
|
F_required = 0x0001,
|
||||||
|
F_broadcast = 0x0002,
|
||||||
|
F_p2p = 0x0004,
|
||||||
|
F_ram = 0x0008,
|
||||||
|
F_db = 0x0010,
|
||||||
|
F_clsend = 0x0020,
|
||||||
|
F_clrecv = 0x0040,
|
||||||
|
F_ownsend = 0x0080,
|
||||||
|
F_airecv = 0x0100,
|
||||||
|
};
|
||||||
|
void add_flag(enum Flags flag);
|
||||||
|
void set_flags(int flags);
|
||||||
|
int get_flags() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void output_flags(ostream &out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _number;
|
int _number;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int _flags; // A bitmask union of any of the above values.
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -454,7 +454,9 @@ add_class(DCClass *dclass) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dclass->set_number(get_num_classes());
|
if (!dclass->is_struct()) {
|
||||||
|
dclass->set_number(get_num_classes());
|
||||||
|
}
|
||||||
_classes.push_back(dclass);
|
_classes.push_back(dclass);
|
||||||
|
|
||||||
if (dclass->is_bogus_class()) {
|
if (dclass->is_bogus_class()) {
|
||||||
|
@ -82,6 +82,9 @@ get_atomic(int n) const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCMolecularField::
|
void DCMolecularField::
|
||||||
add_atomic(DCAtomicField *atomic) {
|
add_atomic(DCAtomicField *atomic) {
|
||||||
|
if (_fields.empty()) {
|
||||||
|
set_flags(atomic->get_flags());
|
||||||
|
}
|
||||||
_fields.push_back(atomic);
|
_fields.push_back(atomic);
|
||||||
|
|
||||||
int num_atomic_fields = atomic->get_num_nested_fields();
|
int num_atomic_fields = atomic->get_num_nested_fields();
|
||||||
|
@ -159,7 +159,12 @@ write_instance(ostream &out, bool brief, int indent_level,
|
|||||||
const string &postname) const {
|
const string &postname) const {
|
||||||
indent(out, indent_level);
|
indent(out, indent_level);
|
||||||
output_instance(out, brief, prename, name, postname);
|
output_instance(out, brief, prename, name, postname);
|
||||||
out << ";\n";
|
output_flags(out);
|
||||||
|
out << ";";
|
||||||
|
if (!brief && _number >= 0) {
|
||||||
|
out << " // field " << _number;
|
||||||
|
}
|
||||||
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -184,14 +189,20 @@ output_typedef_name(ostream &out, bool, const string &prename,
|
|||||||
// the typedef name instead.
|
// the typedef name instead.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCParameter::
|
void DCParameter::
|
||||||
write_typedef_name(ostream &out, bool, int indent_level, const string &prename,
|
write_typedef_name(ostream &out, bool brief, int indent_level,
|
||||||
const string &name, const string &postname) const {
|
const string &prename, const string &name,
|
||||||
|
const string &postname) const {
|
||||||
indent(out, indent_level)
|
indent(out, indent_level)
|
||||||
<< get_typedef()->get_name();
|
<< get_typedef()->get_name();
|
||||||
if (!prename.empty() || !name.empty() || !postname.empty()) {
|
if (!prename.empty() || !name.empty() || !postname.empty()) {
|
||||||
out << " " << prename << name << postname;
|
out << " " << prename << name << postname;
|
||||||
}
|
}
|
||||||
out << ";\n";
|
output_flags(out);
|
||||||
|
out << ";";
|
||||||
|
if (!brief && _number >= 0) {
|
||||||
|
out << " // field " << _number;
|
||||||
|
}
|
||||||
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -201,7 +212,9 @@ write_typedef_name(ostream &out, bool, int indent_level, const string &prename,
|
|||||||
// hash.
|
// hash.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void DCParameter::
|
void DCParameter::
|
||||||
generate_hash(HashGenerator &) const {
|
generate_hash(HashGenerator &hashgen) const {
|
||||||
// We specifically don't call up to DCField::generate_hash(), since
|
// We specifically don't call up to DCField::generate_hash(), since
|
||||||
// the parameter name is not actually significant to the hash.
|
// the parameter name is not actually significant to the hash.
|
||||||
|
|
||||||
|
hashgen.add_int(get_flags());
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ dc_cleanup_parser() {
|
|||||||
%type <u.dclass> dclass
|
%type <u.dclass> dclass
|
||||||
%type <u.dswitch> switch
|
%type <u.dswitch> switch
|
||||||
%type <u.atomic> atomic_name
|
%type <u.atomic> atomic_name
|
||||||
|
%type <u.s_int> server_flags
|
||||||
%type <u.field> dclass_field
|
%type <u.field> dclass_field
|
||||||
%type <u.field> switch_field
|
%type <u.field> switch_field
|
||||||
%type <u.field> atomic_field
|
%type <u.field> atomic_field
|
||||||
@ -306,24 +307,29 @@ dclass_fields:
|
|||||||
dclass_field:
|
dclass_field:
|
||||||
atomic_field
|
atomic_field
|
||||||
| molecular_field
|
| molecular_field
|
||||||
| unnamed_parameter ';'
|
| unnamed_parameter server_flags ';'
|
||||||
{
|
{
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
$$->set_flags($2);
|
||||||
}
|
}
|
||||||
| named_parameter
|
| named_parameter server_flags
|
||||||
{
|
{
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
$$->set_flags($2);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
atomic_field:
|
atomic_field:
|
||||||
IDENTIFIER '('
|
IDENTIFIER '('
|
||||||
{
|
{
|
||||||
|
$$ = current_atomic;
|
||||||
current_atomic = new DCAtomicField($1);
|
current_atomic = new DCAtomicField($1);
|
||||||
}
|
}
|
||||||
parameter_list ')' atomic_flags
|
parameter_list ')' server_flags
|
||||||
{
|
{
|
||||||
$$ = current_atomic;
|
$$ = current_atomic;
|
||||||
|
current_atomic = $<u.atomic>3;
|
||||||
|
$$->set_flags($6);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -820,43 +826,46 @@ type_token:
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
atomic_flags:
|
server_flags:
|
||||||
empty
|
empty
|
||||||
| atomic_flags KW_REQUIRED
|
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_required);
|
$$ = 0;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_BROADCAST
|
| server_flags KW_REQUIRED
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_broadcast);
|
$$ = $1 | DCAtomicField::F_required;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_P2P
|
| server_flags KW_BROADCAST
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_p2p);
|
$$ = $1 | DCAtomicField::F_broadcast;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_RAM
|
| server_flags KW_P2P
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_ram);
|
$$ = $1 | DCAtomicField::F_p2p;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_DB
|
| server_flags KW_RAM
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_db);
|
$$ = $1 | DCAtomicField::F_ram;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_CLSEND
|
| server_flags KW_DB
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_clsend);
|
$$ = $1 | DCAtomicField::F_db;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_CLRECV
|
| server_flags KW_CLSEND
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_clrecv);
|
$$ = $1 | DCAtomicField::F_clsend;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_OWNSEND
|
| server_flags KW_CLRECV
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_ownsend);
|
$$ = $1 | DCAtomicField::F_clrecv;
|
||||||
}
|
}
|
||||||
| atomic_flags KW_AIRECV
|
| server_flags KW_OWNSEND
|
||||||
{
|
{
|
||||||
current_atomic->add_flag(DCAtomicField::F_airecv);
|
$$ = $1 | DCAtomicField::F_ownsend;
|
||||||
|
}
|
||||||
|
| server_flags KW_AIRECV
|
||||||
|
{
|
||||||
|
$$ = $1 | DCAtomicField::F_airecv;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -898,7 +907,7 @@ molecular_atom_list:
|
|||||||
{
|
{
|
||||||
if ($3 != (DCAtomicField *)NULL) {
|
if ($3 != (DCAtomicField *)NULL) {
|
||||||
current_molecular->add_atomic($3);
|
current_molecular->add_atomic($3);
|
||||||
if (!current_molecular->get_atomic(0)->compare_flags(*$3)) {
|
if (!current_molecular->compare_flags(*$3)) {
|
||||||
yyerror("Mismatched flags in molecule between " +
|
yyerror("Mismatched flags in molecule between " +
|
||||||
current_molecular->get_atomic(0)->get_name() + " and " +
|
current_molecular->get_atomic(0)->get_name() + " and " +
|
||||||
$3->get_name());
|
$3->get_name());
|
||||||
|
@ -2013,6 +2013,7 @@ output_instance(ostream &out, bool brief, const string &prename,
|
|||||||
if (!prename.empty() || !name.empty() || !postname.empty()) {
|
if (!prename.empty() || !name.empty() || !postname.empty()) {
|
||||||
out << " " << prename << name << postname;
|
out << " " << prename << name << postname;
|
||||||
}
|
}
|
||||||
|
output_flags(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user