Panda3D
dcParserDefs.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file dcParserDefs.h
10  * @author drose
11  * @date 2000-10-05
12  */
13 
14 #ifndef DCPARSERDEFS_H
15 #define DCPARSERDEFS_H
16 
17 #include "dcbase.h"
18 #include "dcSubatomicType.h"
19 #include "vector_uchar.h"
20 
21 class DCFile;
22 class DCClass;
23 class DCSwitch;
24 class DCField;
25 class DCAtomicField;
26 class DCParameter;
27 class DCKeyword;
28 class DCPacker;
29 
30 void dc_init_parser(std::istream &in, const std::string &filename, DCFile &file);
31 void dc_init_parser_parameter_value(std::istream &in, const std::string &filename,
32  DCPacker &packer);
33 void dc_init_parser_parameter_description(std::istream &in, const std::string &filename,
34  DCFile *file);
35 DCField *dc_get_parameter_description();
36 void dc_cleanup_parser();
37 int dcyyparse();
38 
39 extern DCFile *dc_file;
40 
41 // This structure holds the return value for each token. Traditionally, this
42 // is a union, and is declared with the %union declaration in the parser.y
43 // file, but unions are pretty worthless in C++ (you can't include an object
44 // that has member functions in a union), so we'll use a class instead. That
45 // means we need to declare it externally, here.
46 
47 class EXPCL_DIRECT_DCPARSER DCTokenType {
48 public:
49  union U {
50  int s_int;
51  unsigned int s_uint;
52  int64_t int64;
53  uint64_t uint64;
54  double real;
55  bool flag;
56  DCClass *dclass;
57  DCSwitch *dswitch;
58  DCField *field;
59  DCAtomicField *atomic;
60  DCSubatomicType subatomic;
61  DCParameter *parameter;
62  const DCKeyword *keyword;
63  } u;
64  std::string str;
65  vector_uchar bytes;
66 };
67 
68 // The yacc-generated code expects to use the symbol 'YYSTYPE' to refer to the
69 // above class.
70 #define YYSTYPE DCTokenType
71 
72 #endif
This represents a single keyword declaration in the dc file.
Definition: dcKeyword.h:28
DCSubatomicType
This defines the numeric type of each element of a DCAtomicField; that is, the particular values that...
A single field of a Distributed Class, either atomic or molecular.
Definition: dcField.h:37
This represents a switch statement, which can appear inside a class body and represents two or more a...
Definition: dcSwitch.h:30
Defines a particular DistributedClass as read from an input .dc file.
Definition: dcClass.h:44
A single atomic field of a Distributed Class, as read from a .dc file.
Definition: dcAtomicField.h:30
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents the complete list of Distributed Class descriptions as read from a .dc file.
Definition: dcFile.h:32
Represents the type specification for a single parameter within a field specification.
Definition: dcParameter.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class can be used for packing a series of numeric and string data into a binary stream,...
Definition: dcPacker.h:34