remove tab characters
This commit is contained in:
parent
608e473d74
commit
fcb24f02ef
|
|
@ -158,9 +158,9 @@ end_array() {
|
|||
// prepend the array length.
|
||||
int length = _default_value.length();
|
||||
_default_value =
|
||||
string(1, (char)(length & 0xff)) +
|
||||
string(1, (char)((length >> 8) & 0xff)) +
|
||||
_default_value;
|
||||
string(1, (char)(length & 0xff)) +
|
||||
string(1, (char)((length >> 8) & 0xff)) +
|
||||
_default_value;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ format_default_value(double num, string &formatted) const {
|
|||
|
||||
int length = str.length();
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
str += formatted[length - 1 - i];
|
||||
str += formatted[length - 1 - i];
|
||||
}
|
||||
formatted = str;
|
||||
}
|
||||
|
|
@ -277,9 +277,9 @@ format_default_value(const string &str, string &formatted) const {
|
|||
{
|
||||
int length = str.length();
|
||||
formatted =
|
||||
string(1, (char)(length & 0xff)) +
|
||||
string(1, (char)((length >> 8) & 0xff)) +
|
||||
str;
|
||||
string(1, (char)(length & 0xff)) +
|
||||
string(1, (char)((length >> 8) & 0xff)) +
|
||||
str;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <vector>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCAtomicField
|
||||
// Class : DCAtomicField
|
||||
// Description : A single atomic field of a Distributed Class, as read
|
||||
// from a .dc file. This defines an interface to the
|
||||
// Distributed Class, and is always implemented as a
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
class HashGenerator;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCClass
|
||||
// Class : DCClass
|
||||
// Description : Defines a particular DistributedClass as read from an
|
||||
// input .dc file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class DCMolecularField;
|
|||
class HashGenerator;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCField
|
||||
// Class : DCField
|
||||
// Description : A single field of a Distributed Class, either atomic
|
||||
// or molecular.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
class HashGenerator;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCFile
|
||||
// Class : DCFile
|
||||
// Description : Represents the complete list of Distributed Class
|
||||
// descriptions as read from a .dc file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ input_chars(char *buffer, int &result, int max_size) {
|
|||
// Truncate it at the newline.
|
||||
char *end = strchr(current_line, '\n');
|
||||
if (end != NULL) {
|
||||
*end = '\0';
|
||||
*end = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
class DCAtomicField;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DCMolecularField
|
||||
// Class : DCMolecularField
|
||||
// Description : A single molecular field of a Distributed Class, as
|
||||
// read from a .dc file. This represents a combination
|
||||
// of two or more related atomic fields, that will often
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ dc_cleanup_parser() {
|
|||
%%
|
||||
|
||||
dc:
|
||||
empty
|
||||
| dc ';'
|
||||
| dc dclass
|
||||
;
|
||||
empty
|
||||
| dc ';'
|
||||
| dc dclass
|
||||
;
|
||||
|
||||
dclass:
|
||||
KW_DCLASS IDENTIFIER
|
||||
KW_DCLASS IDENTIFIER
|
||||
{
|
||||
current_class = new DCClass;
|
||||
current_class->_name = $2;
|
||||
|
|
@ -96,11 +96,11 @@ dclass:
|
|||
yyerror("Duplicate class name: " + current_class->_name);
|
||||
}
|
||||
}
|
||||
dclass_derivation '{' dclass_fields '}'
|
||||
;
|
||||
dclass_derivation '{' dclass_fields '}'
|
||||
;
|
||||
|
||||
dclass_name:
|
||||
IDENTIFIER
|
||||
IDENTIFIER
|
||||
{
|
||||
DCFile::ClassesByName::const_iterator ni;
|
||||
ni = dc_file->_classes_by_name.find($1);
|
||||
|
|
@ -113,34 +113,34 @@ dclass_name:
|
|||
}
|
||||
|
||||
dclass_derivation:
|
||||
empty
|
||||
| ':' base_list
|
||||
;
|
||||
empty
|
||||
| ':' base_list
|
||||
;
|
||||
|
||||
base_list:
|
||||
dclass_name
|
||||
dclass_name
|
||||
{
|
||||
if ($1 != (DCClass *)NULL) {
|
||||
current_class->_parents.push_back($1);
|
||||
}
|
||||
}
|
||||
| base_list ',' dclass_name
|
||||
| base_list ',' dclass_name
|
||||
{
|
||||
if ($3 != (DCClass *)NULL) {
|
||||
current_class->_parents.push_back($3);
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
dclass_fields:
|
||||
empty
|
||||
| dclass_fields ';'
|
||||
| dclass_fields atomic_field
|
||||
| dclass_fields molecular_field
|
||||
;
|
||||
empty
|
||||
| dclass_fields ';'
|
||||
| dclass_fields atomic_field
|
||||
| dclass_fields molecular_field
|
||||
;
|
||||
|
||||
atomic_field:
|
||||
IDENTIFIER '('
|
||||
IDENTIFIER '('
|
||||
{
|
||||
current_atomic = new DCAtomicField;
|
||||
current_atomic->_name = $1;
|
||||
|
|
@ -148,11 +148,11 @@ atomic_field:
|
|||
yyerror("Duplicate field name: " + current_atomic->_name);
|
||||
}
|
||||
}
|
||||
parameter_list ')' atomic_flags
|
||||
;
|
||||
parameter_list ')' atomic_flags
|
||||
;
|
||||
|
||||
atomic_name:
|
||||
IDENTIFIER
|
||||
IDENTIFIER
|
||||
{
|
||||
DCField *field = current_class->get_field_by_name($1);
|
||||
$$ = (DCAtomicField *)NULL;
|
||||
|
|
@ -167,60 +167,60 @@ atomic_name:
|
|||
}
|
||||
|
||||
parameter_list:
|
||||
empty
|
||||
| nonempty_parameter_list
|
||||
;
|
||||
empty
|
||||
| nonempty_parameter_list
|
||||
;
|
||||
|
||||
nonempty_parameter_list:
|
||||
atomic_element
|
||||
| nonempty_parameter_list ',' atomic_element
|
||||
;
|
||||
atomic_element
|
||||
| nonempty_parameter_list ',' atomic_element
|
||||
;
|
||||
|
||||
atomic_element:
|
||||
type_token
|
||||
type_token
|
||||
{
|
||||
atomic_element = DCAtomicField::ElementType();
|
||||
atomic_element._type = $1;
|
||||
}
|
||||
atomic_element_definition
|
||||
atomic_element_definition
|
||||
{
|
||||
current_atomic->_elements.push_back(atomic_element)
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
atomic_element_definition:
|
||||
empty
|
||||
| atomic_element_definition '/' INTEGER
|
||||
empty
|
||||
| atomic_element_definition '/' INTEGER
|
||||
{
|
||||
atomic_element._divisor = $3;
|
||||
}
|
||||
| atomic_element_definition IDENTIFIER
|
||||
| atomic_element_definition IDENTIFIER
|
||||
{
|
||||
atomic_element._name = $2;
|
||||
}
|
||||
| atomic_element_definition '=' INTEGER
|
||||
| atomic_element_definition '=' INTEGER
|
||||
{
|
||||
if (!atomic_element.set_default_value($3)) {
|
||||
yyerror("Invalid default value: " + $<str>3);
|
||||
}
|
||||
}
|
||||
| atomic_element_definition '=' REAL
|
||||
| atomic_element_definition '=' REAL
|
||||
{
|
||||
if (!atomic_element.set_default_value($3)) {
|
||||
yyerror("Invalid default value: " + $<str>3);
|
||||
}
|
||||
}
|
||||
| atomic_element_definition '=' STRING
|
||||
| atomic_element_definition '=' STRING
|
||||
{
|
||||
if (!atomic_element.set_default_value($3)) {
|
||||
yyerror("Invalid default value: \"" + $3 + "\"");
|
||||
}
|
||||
}
|
||||
| atomic_element_definition '=' HEX_STRING
|
||||
| atomic_element_definition '=' HEX_STRING
|
||||
{
|
||||
atomic_element.set_default_value($3);
|
||||
}
|
||||
| atomic_element_definition '=' '{' default_array '}'
|
||||
| atomic_element_definition '=' '{' default_array '}'
|
||||
{
|
||||
if (!atomic_element.end_array()) {
|
||||
yyerror("Array default value inappropriate");
|
||||
|
|
@ -228,37 +228,37 @@ atomic_element_definition:
|
|||
atomic_element._has_default_value = true;
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
default_array:
|
||||
empty
|
||||
| default_array_def maybe_comma
|
||||
;
|
||||
empty
|
||||
| default_array_def maybe_comma
|
||||
;
|
||||
|
||||
maybe_comma:
|
||||
empty
|
||||
| ','
|
||||
;
|
||||
empty
|
||||
| ','
|
||||
;
|
||||
|
||||
default_array_def:
|
||||
default_array_element
|
||||
| default_array_def ',' default_array_element
|
||||
;
|
||||
default_array_element
|
||||
| default_array_def ',' default_array_element
|
||||
;
|
||||
|
||||
default_array_element:
|
||||
INTEGER
|
||||
INTEGER
|
||||
{
|
||||
if (!atomic_element.add_default_value($1)) {
|
||||
yyerror("Invalid default value: " + $<str>1);
|
||||
}
|
||||
}
|
||||
| REAL
|
||||
| REAL
|
||||
{
|
||||
if (!atomic_element.add_default_value($1)) {
|
||||
yyerror("Invalid default value: " + $<str>1);
|
||||
}
|
||||
}
|
||||
| INTEGER '*' INTEGER
|
||||
| INTEGER '*' INTEGER
|
||||
{
|
||||
for (int i = 0; i < $3; i++) {
|
||||
if (!atomic_element.add_default_value($1)) {
|
||||
|
|
@ -267,7 +267,7 @@ default_array_element:
|
|||
}
|
||||
}
|
||||
}
|
||||
| REAL '*' INTEGER
|
||||
| REAL '*' INTEGER
|
||||
{
|
||||
for (int i = 0; i < $3; i++) {
|
||||
if (!atomic_element.add_default_value($1)) {
|
||||
|
|
@ -276,109 +276,109 @@ default_array_element:
|
|||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
type_token:
|
||||
KW_INT8
|
||||
KW_INT8
|
||||
{
|
||||
$$ = ST_int8;
|
||||
}
|
||||
| KW_INT16
|
||||
| KW_INT16
|
||||
{
|
||||
$$ = ST_int16;
|
||||
}
|
||||
| KW_INT32
|
||||
| KW_INT32
|
||||
{
|
||||
$$ = ST_int32;
|
||||
}
|
||||
| KW_INT64
|
||||
| KW_INT64
|
||||
{
|
||||
$$ = ST_int64;
|
||||
}
|
||||
| KW_UINT8
|
||||
| KW_UINT8
|
||||
{
|
||||
$$ = ST_uint8;
|
||||
}
|
||||
| KW_UINT16
|
||||
| KW_UINT16
|
||||
{
|
||||
$$ = ST_uint16;
|
||||
}
|
||||
| KW_UINT32
|
||||
| KW_UINT32
|
||||
{
|
||||
$$ = ST_uint32;
|
||||
}
|
||||
| KW_UINT64
|
||||
| KW_UINT64
|
||||
{
|
||||
$$ = ST_uint64;
|
||||
}
|
||||
| KW_FLOAT64
|
||||
| KW_FLOAT64
|
||||
{
|
||||
$$ = ST_float64;
|
||||
}
|
||||
| KW_STRING
|
||||
| KW_STRING
|
||||
{
|
||||
$$ = ST_string;
|
||||
}
|
||||
| KW_BLOB
|
||||
| KW_BLOB
|
||||
{
|
||||
$$ = ST_blob;
|
||||
}
|
||||
| KW_INT16ARRAY
|
||||
| KW_INT16ARRAY
|
||||
{
|
||||
$$ = ST_int16array;
|
||||
}
|
||||
| KW_INT32ARRAY
|
||||
| KW_INT32ARRAY
|
||||
{
|
||||
$$ = ST_int32array;
|
||||
}
|
||||
| KW_UINT16ARRAY
|
||||
| KW_UINT16ARRAY
|
||||
{
|
||||
$$ = ST_uint16array;
|
||||
}
|
||||
| KW_UINT32ARRAY
|
||||
| KW_UINT32ARRAY
|
||||
{
|
||||
$$ = ST_uint32array;
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
atomic_flags:
|
||||
empty
|
||||
| atomic_flags KW_REQUIRED
|
||||
empty
|
||||
| atomic_flags KW_REQUIRED
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_required;
|
||||
}
|
||||
| atomic_flags KW_BROADCAST
|
||||
| atomic_flags KW_BROADCAST
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_broadcast;
|
||||
}
|
||||
| atomic_flags KW_P2P
|
||||
| atomic_flags KW_P2P
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_p2p;
|
||||
}
|
||||
| atomic_flags KW_RAM
|
||||
| atomic_flags KW_RAM
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_ram;
|
||||
}
|
||||
| atomic_flags KW_DB
|
||||
| atomic_flags KW_DB
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_db;
|
||||
}
|
||||
| atomic_flags KW_CLSEND
|
||||
| atomic_flags KW_CLSEND
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_clsend;
|
||||
}
|
||||
| atomic_flags KW_CLRECV
|
||||
| atomic_flags KW_CLRECV
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_clrecv;
|
||||
}
|
||||
| atomic_flags KW_OWNSEND
|
||||
| atomic_flags KW_OWNSEND
|
||||
{
|
||||
current_atomic->_flags |= DCAtomicField::F_ownsend;
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
molecular_field:
|
||||
IDENTIFIER ':'
|
||||
IDENTIFIER ':'
|
||||
{
|
||||
current_molecular = new DCMolecularField;
|
||||
current_molecular->_name = $1;
|
||||
|
|
@ -386,28 +386,28 @@ molecular_field:
|
|||
yyerror("Duplicate field name: " + current_molecular->_name);
|
||||
}
|
||||
}
|
||||
molecular_atom_list
|
||||
;
|
||||
molecular_atom_list
|
||||
;
|
||||
|
||||
molecular_atom_list:
|
||||
atomic_name
|
||||
atomic_name
|
||||
{
|
||||
if ($1 != (DCAtomicField *)NULL) {
|
||||
current_molecular->_fields.push_back($1);
|
||||
}
|
||||
}
|
||||
| molecular_atom_list ',' atomic_name
|
||||
| molecular_atom_list ',' atomic_name
|
||||
{
|
||||
if ($3 != (DCAtomicField *)NULL) {
|
||||
current_molecular->_fields.push_back($3);
|
||||
if (current_molecular->_fields[0]->_flags != $3->_flags) {
|
||||
yyerror("Mismatched flags in molecule between " +
|
||||
current_molecular->_fields[0]->_name + " and " +
|
||||
$3->_name);
|
||||
current_molecular->_fields[0]->_name + " and " +
|
||||
$3->_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
;
|
||||
|
||||
empty:
|
||||
;
|
||||
;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
BEGIN_PUBLISH
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Enum : DCSubatomicType
|
||||
// Enum : DCSubatomicType
|
||||
// Description : This defines the numeric type of each element of a
|
||||
// DCAtomicField; that is, the particular values that
|
||||
// will get added to the message when the atomic field
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "primeNumberGenerator.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : HashGenerator
|
||||
// Class : HashGenerator
|
||||
// Description : This class generates an arbitrary hash number from a
|
||||
// sequence of ints.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ operator [] (int n) {
|
|||
int j = 0;
|
||||
while (maybe_prime && _primes[j] * _primes[j] <= candidate) {
|
||||
if ((_primes[j] * (candidate / _primes[j])) == candidate) {
|
||||
// This one is not prime.
|
||||
maybe_prime = false;
|
||||
// This one is not prime.
|
||||
maybe_prime = false;
|
||||
}
|
||||
j++;
|
||||
nassertr(j < (int)_primes.size(), 0);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "dcbase.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : PrimeNumberGenerator
|
||||
// Class : PrimeNumberGenerator
|
||||
// Description : This class generates a table of prime numbers, up to
|
||||
// the limit of an int. For a given integer n, it will
|
||||
// return the nth prime number. This will involve a
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ NotifyCategoryDeclNoExport(correction);
|
|||
NotifyCategoryDef(correction, "");
|
||||
|
||||
Correction::Correction(LPoint3f& start, LVector3f& s_vel) : _curr_p(start),
|
||||
_curr_v(s_vel) {
|
||||
_curr_v(s_vel) {
|
||||
correction_cat->debug() << "construction with:" << endl << "start = "
|
||||
<< start << endl << "vel = " << s_vel << endl;
|
||||
<< start << endl << "vel = " << s_vel << endl;
|
||||
}
|
||||
|
||||
Correction::~Correction(void) {
|
||||
|
|
@ -131,7 +131,7 @@ void SplineCorrection::step(void) {
|
|||
correction_cat->spam() << "time >= dur, holding at current pos" << endl;
|
||||
} else
|
||||
correction_cat->spam() << "have_both is false, no point calculated"
|
||||
<< endl;
|
||||
<< endl;
|
||||
}
|
||||
|
||||
void SplineCorrection::new_target(LPoint3f& target, LVector3f& v_target) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ std::string chan_config = "single";
|
|||
std::string window_title = "Panda3D";
|
||||
|
||||
void render_frame(GraphicsPipe *pipe,
|
||||
NodeAttributes &initial_state) {
|
||||
NodeAttributes &initial_state) {
|
||||
int num_windows = pipe->get_num_windows();
|
||||
for (int w = 0; w < num_windows; w++) {
|
||||
GraphicsWindow *win = pipe->get_window(w);
|
||||
|
|
@ -66,7 +66,7 @@ void render_frame(GraphicsPipe *pipe,
|
|||
class WindowCallback : public GraphicsWindow::Callback {
|
||||
public:
|
||||
WindowCallback(GraphicsPipe *pipe, Node *render,
|
||||
NodeAttributes *initial_state) :
|
||||
NodeAttributes *initial_state) :
|
||||
_pipe(pipe),
|
||||
_render(render),
|
||||
_initial_state(initial_state),
|
||||
|
|
@ -112,9 +112,9 @@ PT(GraphicsPipe) make_graphics_pipe() {
|
|||
}
|
||||
|
||||
PT(GraphicsWindow) make_graphics_window(GraphicsPipe *pipe,
|
||||
NamedNode *render,
|
||||
NamedNode *camera,
|
||||
NodeAttributes &initial_state) {
|
||||
NamedNode *render,
|
||||
NamedNode *camera,
|
||||
NodeAttributes &initial_state) {
|
||||
PT(GraphicsWindow) main_win;
|
||||
ChanCfgOverrides override;
|
||||
|
||||
|
|
@ -128,7 +128,7 @@ PT(GraphicsWindow) make_graphics_window(GraphicsPipe *pipe,
|
|||
initial_state.set_attribute(DepthWriteTransition::get_class_type(), dwa);
|
||||
|
||||
override.setField(ChanCfgOverrides::Mask,
|
||||
((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
|
||||
((unsigned int)(W_DOUBLE|W_DEPTH|W_MULTISAMPLE)));
|
||||
|
||||
std::string title = config_showbase.GetString("window-title", window_title);
|
||||
override.setField(ChanCfgOverrides::Title, title);
|
||||
|
|
@ -278,7 +278,7 @@ void take_snapshot(GraphicsWindow *win, const string &name) {
|
|||
int height = dr->get_pixel_height();
|
||||
|
||||
PixelBuffer p(width, height, 3, 1, PixelBuffer::T_unsigned_byte,
|
||||
PixelBuffer::F_rgb);
|
||||
PixelBuffer::F_rgb);
|
||||
|
||||
p.copy(gsg, dr, rb);
|
||||
p.write(name);
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ EXPCL_DIRECT DSearchPath &get_particle_path();
|
|||
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
|
||||
EXPCL_DIRECT PT(GraphicsWindow)
|
||||
make_graphics_window(GraphicsPipe *pipe,
|
||||
NamedNode *render,
|
||||
NamedNode *camera,
|
||||
NodeAttributes &initial_state);
|
||||
NamedNode *render,
|
||||
NamedNode *camera,
|
||||
NodeAttributes &initial_state);
|
||||
|
||||
EXPCL_DIRECT NodePath setup_panda_2d(GraphicsWindow *win, const string &name);
|
||||
EXPCL_DIRECT void add_render_layer(GraphicsWindow *win, Node *render_top,
|
||||
Camera *camera);
|
||||
Camera *camera);
|
||||
|
||||
EXPCL_DIRECT void toggle_wireframe(NodeAttributes &initial_state);
|
||||
EXPCL_DIRECT void toggle_texture(NodeAttributes &initial_state);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ is_equivalent(const CPPType &other) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPArrayType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -145,8 +145,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPArrayType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
ostringstream brackets;
|
||||
brackets << "[";
|
||||
if (_bounds != NULL) {
|
||||
|
|
@ -156,7 +156,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
|
|||
string bracketsstr = brackets.str();
|
||||
|
||||
_element_type->output_instance(out, indent_level, scope, complete,
|
||||
prename, name + bracketsstr);
|
||||
prename, name + bracketsstr);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
class CPPExpression;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPArrayType
|
||||
// Class : CPPArrayType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPArrayType : public CPPType {
|
||||
|
|
@ -25,20 +25,20 @@ public:
|
|||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
virtual bool is_tbd() const;
|
||||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -37,11 +37,11 @@ class CPPIdentifier;
|
|||
|
||||
void parse_cpp(CPPParser *cp);
|
||||
CPPExpression *parse_const_expr(CPPPreprocessor *pp,
|
||||
CPPScope *new_current_scope,
|
||||
CPPScope *new_global_scope);
|
||||
CPPScope *new_current_scope,
|
||||
CPPScope *new_global_scope);
|
||||
CPPType *parse_type(CPPPreprocessor *pp,
|
||||
CPPScope *new_current_scope,
|
||||
CPPScope *new_global_scope);
|
||||
CPPScope *new_current_scope,
|
||||
CPPScope *new_global_scope);
|
||||
|
||||
extern CPPScope *current_scope;
|
||||
extern CPPScope *global_scope;
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
class CPPIdentifier;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPClassTemplateParameter
|
||||
// Class : CPPClassTemplateParameter
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPClassTemplateParameter : public CPPType {
|
||||
public:
|
||||
CPPClassTemplateParameter(CPPIdentifier *ident,
|
||||
CPPType *default_type = NULL);
|
||||
CPPType *default_type = NULL);
|
||||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPClassTemplateParameter *as_class_template_parameter();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <list>
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPCommentBlock
|
||||
// Class : CPPCommentBlock
|
||||
// Description : This represents a comment appearing in the source
|
||||
// code. The CPPPreprocessor collects these, and saves
|
||||
// the complete list of comments encountered; it also
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPConstType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -132,10 +132,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPConstType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
_wrapped_around->output_instance(out, indent_level, scope, complete,
|
||||
"const " + prename, name);
|
||||
"const " + prename, name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cppType.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPConstType
|
||||
// Class : CPPConstType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPConstType : public CPPType {
|
||||
|
|
@ -22,21 +22,21 @@ public:
|
|||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPDeclaration::
|
||||
instantiate(const CPPTemplateParameterList *,
|
||||
CPPScope *, CPPScope *,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *, CPPScope *,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Ignoring template parameters");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class CPPTemplateScope;
|
|||
class CPPPreprocessor;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPDeclaration
|
||||
// Class : CPPDeclaration
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPDeclaration {
|
||||
|
|
@ -89,19 +89,19 @@ public:
|
|||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
typedef map<CPPDeclaration *, CPPDeclaration *> SubstDecl;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
typedef set<CPPDeclaration *> Instantiations;
|
||||
Instantiations _instantiations;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const=0;
|
||||
bool complete) const=0;
|
||||
|
||||
virtual SubType get_subtype() const=0;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPEnumType::
|
||||
CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope,
|
||||
const CPPFile &file) :
|
||||
const CPPFile &file) :
|
||||
CPPExtensionType(T_enum, ident, current_scope, file)
|
||||
{
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ void CPPEnumType::
|
|||
add_element(const string &name, CPPScope *scope, CPPExpression *value) {
|
||||
CPPType *type =
|
||||
CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_int,
|
||||
CPPSimpleType::F_unsigned));
|
||||
CPPSimpleType::F_unsigned));
|
||||
CPPIdentifier *ident = new CPPIdentifier(name);
|
||||
CPPInstance *inst = new CPPInstance(type, ident);
|
||||
inst->_initializer = value;
|
||||
|
|
@ -59,7 +59,7 @@ is_incomplete() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPEnumType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -110,7 +110,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
for (ei = _elements.begin(); ei != _elements.end(); ++ei) {
|
||||
indent(out, indent_level + 2) << (*ei)->get_local_name();
|
||||
if ((*ei)->_initializer != NULL) {
|
||||
out << " = " << *(*ei)->_initializer;
|
||||
out << " = " << *(*ei)->_initializer;
|
||||
}
|
||||
out << ",\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,25 +18,25 @@ class CPPScope;
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPEnumType
|
||||
// Class : CPPEnumType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPEnumType : public CPPExtensionType {
|
||||
public:
|
||||
CPPEnumType(CPPIdentifier *ident, CPPScope *current_scope,
|
||||
const CPPFile &file);
|
||||
const CPPFile &file);
|
||||
|
||||
void add_element(const string &name, CPPScope *scope,
|
||||
CPPExpression *value = (CPPExpression *)NULL);
|
||||
CPPExpression *value = (CPPExpression *)NULL);
|
||||
|
||||
virtual bool is_incomplete() const;
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPEnumType *as_enum_type();
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ CPPExpression(const string &value) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPExpression::
|
||||
CPPExpression(CPPIdentifier *ident, CPPScope *current_scope,
|
||||
CPPScope *global_scope, CPPPreprocessor *error_sink) :
|
||||
CPPScope *global_scope, CPPPreprocessor *error_sink) :
|
||||
CPPDeclaration(CPPFile())
|
||||
{
|
||||
CPPDeclaration *decl =
|
||||
|
|
@ -275,7 +275,7 @@ CPPExpression(int binary_operator, CPPExpression *op1, CPPExpression *op2) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPExpression::
|
||||
CPPExpression(int trinary_operator, CPPExpression *op1, CPPExpression *op2,
|
||||
CPPExpression *op3) :
|
||||
CPPExpression *op3) :
|
||||
CPPDeclaration(CPPFile())
|
||||
{
|
||||
_type = T_trinary_operation;
|
||||
|
|
@ -401,15 +401,15 @@ evaluate() const {
|
|||
if (r1._type != RT_error) {
|
||||
CPPSimpleType *stype = _u._typecast._to->as_simple_type();
|
||||
if (stype != NULL) {
|
||||
if (stype->_type == CPPSimpleType::T_int) {
|
||||
return Result(r1.as_integer());
|
||||
} else if (stype->_type == CPPSimpleType::T_float ||
|
||||
stype->_type == CPPSimpleType::T_double) {
|
||||
return Result(r1.as_real());
|
||||
}
|
||||
if (stype->_type == CPPSimpleType::T_int) {
|
||||
return Result(r1.as_integer());
|
||||
} else if (stype->_type == CPPSimpleType::T_float ||
|
||||
stype->_type == CPPSimpleType::T_double) {
|
||||
return Result(r1.as_real());
|
||||
}
|
||||
}
|
||||
if (_u._typecast._to->as_pointer_type()) {
|
||||
return Result(r1.as_pointer());
|
||||
return Result(r1.as_pointer());
|
||||
}
|
||||
}
|
||||
return Result();
|
||||
|
|
@ -433,7 +433,7 @@ evaluate() const {
|
|||
// In all other cases, both operands must be valid in order for
|
||||
// the operation to be valid.
|
||||
if (r2._type == RT_error &&
|
||||
(_u._op._operator != OROR && _u._op._operator != ANDAND)) {
|
||||
(_u._op._operator != OROR && _u._op._operator != ANDAND)) {
|
||||
return r2;
|
||||
}
|
||||
// Fall through
|
||||
|
|
@ -469,16 +469,16 @@ evaluate() const {
|
|||
|
||||
case '*':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() * r2.as_real());
|
||||
return Result(r1.as_real() * r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() * r2.as_integer());
|
||||
return Result(r1.as_integer() * r2.as_integer());
|
||||
}
|
||||
|
||||
case '/':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() / r2.as_real());
|
||||
return Result(r1.as_real() / r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() / r2.as_integer());
|
||||
return Result(r1.as_integer() / r2.as_integer());
|
||||
}
|
||||
|
||||
case '%':
|
||||
|
|
@ -486,16 +486,16 @@ evaluate() const {
|
|||
|
||||
case '+':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() + r2.as_real());
|
||||
return Result(r1.as_real() + r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() + r2.as_integer());
|
||||
return Result(r1.as_integer() + r2.as_integer());
|
||||
}
|
||||
|
||||
case '-':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() - r2.as_real());
|
||||
return Result(r1.as_real() - r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() - r2.as_integer());
|
||||
return Result(r1.as_integer() - r2.as_integer());
|
||||
}
|
||||
|
||||
case '|':
|
||||
|
|
@ -506,58 +506,58 @@ evaluate() const {
|
|||
|
||||
case OROR:
|
||||
if (r1.as_integer()) {
|
||||
return r1;
|
||||
return r1;
|
||||
} else {
|
||||
return r2;
|
||||
return r2;
|
||||
}
|
||||
|
||||
case ANDAND:
|
||||
if (r1.as_integer()) {
|
||||
return r2;
|
||||
return r2;
|
||||
} else {
|
||||
return r1;
|
||||
return r1;
|
||||
}
|
||||
|
||||
case EQCOMPARE:
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() == r2.as_real());
|
||||
return Result(r1.as_real() == r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() == r2.as_integer());
|
||||
return Result(r1.as_integer() == r2.as_integer());
|
||||
}
|
||||
|
||||
case NECOMPARE:
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() != r2.as_real());
|
||||
return Result(r1.as_real() != r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() != r2.as_integer());
|
||||
return Result(r1.as_integer() != r2.as_integer());
|
||||
}
|
||||
|
||||
case LECOMPARE:
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() <= r2.as_real());
|
||||
return Result(r1.as_real() <= r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() <= r2.as_integer());
|
||||
return Result(r1.as_integer() <= r2.as_integer());
|
||||
}
|
||||
|
||||
case GECOMPARE:
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() >= r2.as_real());
|
||||
return Result(r1.as_real() >= r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() >= r2.as_integer());
|
||||
return Result(r1.as_integer() >= r2.as_integer());
|
||||
}
|
||||
|
||||
case '<':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() < r2.as_real());
|
||||
return Result(r1.as_real() < r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() < r2.as_integer());
|
||||
return Result(r1.as_integer() < r2.as_integer());
|
||||
}
|
||||
|
||||
case '>':
|
||||
if (r1._type == RT_real || r2._type == RT_real) {
|
||||
return Result(r1.as_real() > r2.as_real());
|
||||
return Result(r1.as_real() > r2.as_real());
|
||||
} else {
|
||||
return Result(r1.as_integer() > r2.as_integer());
|
||||
return Result(r1.as_integer() > r2.as_integer());
|
||||
}
|
||||
|
||||
case LSHIFT:
|
||||
|
|
@ -568,7 +568,7 @@ evaluate() const {
|
|||
|
||||
case '?':
|
||||
return r1.as_integer() ?
|
||||
_u._op._op2->evaluate() : _u._op._op3->evaluate();
|
||||
_u._op._op2->evaluate() : _u._op._op3->evaluate();
|
||||
|
||||
case '.':
|
||||
case POINTSAT:
|
||||
|
|
@ -633,10 +633,10 @@ determine_type() const {
|
|||
|
||||
case T_string:
|
||||
return char_star_type;
|
||||
|
||||
|
||||
case T_variable:
|
||||
return _u._variable->_type;
|
||||
|
||||
|
||||
case T_function:
|
||||
if (_u._fgroup->get_return_type() == (CPPType *)NULL) {
|
||||
// There are multiple functions by this name that have different
|
||||
|
|
@ -685,12 +685,12 @@ determine_type() const {
|
|||
case UNARY_STAR:
|
||||
case '[': // Array element reference
|
||||
if (t1 != NULL) {
|
||||
if (t1->as_pointer_type()) {
|
||||
return t1->as_pointer_type()->_pointing_at;
|
||||
}
|
||||
if (t1->as_array_type()) {
|
||||
return t1->as_array_type()->_element_type;
|
||||
}
|
||||
if (t1->as_pointer_type()) {
|
||||
return t1->as_pointer_type()->_pointing_at;
|
||||
}
|
||||
if (t1->as_array_type()) {
|
||||
return t1->as_array_type()->_element_type;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
|
@ -702,14 +702,14 @@ determine_type() const {
|
|||
case '+':
|
||||
case '-':
|
||||
if (t1 == NULL) {
|
||||
return t2;
|
||||
return t2;
|
||||
} else if (t2 == NULL) {
|
||||
return t1;
|
||||
return t1;
|
||||
} else if (t1->as_pointer_type()) {
|
||||
if (t2->as_pointer_type()) {
|
||||
return int_type;
|
||||
}
|
||||
return t1;
|
||||
if (t2->as_pointer_type()) {
|
||||
return int_type;
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
return elevate_type(t1, t2);
|
||||
|
||||
|
|
@ -739,10 +739,10 @@ determine_type() const {
|
|||
|
||||
case 'f': // Function evaluation
|
||||
if (t1 != NULL) {
|
||||
CPPFunctionType *ftype = t1->as_function_type();
|
||||
if (ftype != (CPPFunctionType *)NULL) {
|
||||
return ftype->_return_type;
|
||||
}
|
||||
CPPFunctionType *ftype = t1->as_function_type();
|
||||
if (ftype != (CPPFunctionType *)NULL) {
|
||||
return ftype->_return_type;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
|
|
@ -769,7 +769,7 @@ determine_type() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPExpression::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPDeclaration *top =
|
||||
CPPDeclaration::substitute_decl(subst, current_scope, global_scope);
|
||||
if (top != this) {
|
||||
|
|
@ -785,14 +785,14 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
|||
decl = _u._variable->substitute_decl(subst, current_scope, global_scope);
|
||||
if (decl != rep->_u._variable) {
|
||||
if (decl->as_instance()) {
|
||||
// Replacing the variable reference with another variable reference.
|
||||
rep->_u._variable = decl->as_instance();
|
||||
any_changed = true;
|
||||
// Replacing the variable reference with another variable reference.
|
||||
rep->_u._variable = decl->as_instance();
|
||||
any_changed = true;
|
||||
} else if (decl->as_expression()) {
|
||||
// Replacing the variable reference with an expression.
|
||||
delete rep;
|
||||
rep = decl->as_expression();
|
||||
any_changed = true;
|
||||
// Replacing the variable reference with an expression.
|
||||
delete rep;
|
||||
rep = decl->as_expression();
|
||||
any_changed = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -914,35 +914,35 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
|
|||
{
|
||||
string::const_iterator si;
|
||||
for (si = _str.begin(); si != _str.end(); ++si) {
|
||||
switch (*si) {
|
||||
case '\n':
|
||||
out << "\\n";
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
out << "\\t";
|
||||
break;
|
||||
|
||||
case '\r':
|
||||
out << "\\r";
|
||||
break;
|
||||
|
||||
case '\a':
|
||||
out << "\\a";
|
||||
break;
|
||||
|
||||
case '"':
|
||||
out << "\\\"";
|
||||
break;
|
||||
switch (*si) {
|
||||
case '\n':
|
||||
out << "\\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isprint(*si)) {
|
||||
out << *si;
|
||||
} else {
|
||||
out << '\\' << oct << setw(3) << setfill('0') << (int)(*si)
|
||||
<< dec << setw(0);
|
||||
}
|
||||
}
|
||||
case '\t':
|
||||
out << "\\t";
|
||||
break;
|
||||
|
||||
case '\r':
|
||||
out << "\\r";
|
||||
break;
|
||||
|
||||
case '\a':
|
||||
out << "\\a";
|
||||
break;
|
||||
|
||||
case '"':
|
||||
out << "\\\"";
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isprint(*si)) {
|
||||
out << *si;
|
||||
} else {
|
||||
out << '\\' << oct << setw(3) << setfill('0') << (int)(*si)
|
||||
<< dec << setw(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out << '"';
|
||||
|
|
@ -968,7 +968,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
|
|||
|
||||
case T_construct:
|
||||
out << "(" << _u._typecast._to->get_typedef_name(scope)
|
||||
<< "(" << *_u._typecast._op1 << "))";
|
||||
<< "(" << *_u._typecast._op1 << "))";
|
||||
break;
|
||||
|
||||
case T_default_construct:
|
||||
|
|
@ -977,7 +977,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
|
|||
|
||||
case T_new:
|
||||
out << "(new " << *_u._typecast._to
|
||||
<< "(" << *_u._typecast._op1 << "))";
|
||||
<< "(" << *_u._typecast._op1 << "))";
|
||||
break;
|
||||
|
||||
case T_default_new:
|
||||
|
|
@ -1078,13 +1078,13 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
|
|||
|
||||
default:
|
||||
out << "(" << *_u._op._op1 << " " << (char)_u._op._operator
|
||||
<< " " << *_u._op._op2 << ")";
|
||||
<< " " << *_u._op._op2 << ")";
|
||||
}
|
||||
break;
|
||||
|
||||
case T_trinary_operation:
|
||||
out << "(" << *_u._op._op1 << " ? " << *_u._op._op2
|
||||
<< " : " << *_u._op._op3 << ")";
|
||||
<< " : " << *_u._op._op3 << ")";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -1151,7 +1151,7 @@ elevate_type(CPPType *t1, CPPType *t2) {
|
|||
st1->_type == CPPSimpleType::T_double) {
|
||||
return st1;
|
||||
} else if (st2->_type == CPPSimpleType::T_float ||
|
||||
st2->_type == CPPSimpleType::T_double) {
|
||||
st2->_type == CPPSimpleType::T_double) {
|
||||
return st2;
|
||||
} else if (st1->_type == CPPSimpleType::T_int) {
|
||||
return st1;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class CPPPreprocessor;
|
|||
class CPPFunctionGroup;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPExpression
|
||||
// Class : CPPExpression
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPExpression : public CPPDeclaration {
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
CPPExpression(const string &value);
|
||||
CPPExpression(double value);
|
||||
CPPExpression(CPPIdentifier *ident, CPPScope *current_scope,
|
||||
CPPScope *global_scope, CPPPreprocessor *error_sink = NULL);
|
||||
CPPScope *global_scope, CPPPreprocessor *error_sink = NULL);
|
||||
CPPExpression(int unary_operator, CPPExpression *op1);
|
||||
CPPExpression(int binary_operator, CPPExpression *op1, CPPExpression *op2);
|
||||
CPPExpression(int trinary_operator, CPPExpression *op1, CPPExpression *op2, CPPExpression *op3);
|
||||
|
|
@ -70,11 +70,11 @@ public:
|
|||
bool is_tbd() const;
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPExpression *as_expression();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CPPExpression;
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPExpressionParser
|
||||
// Class : CPPExpressionParser
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPExpressionParser : public CPPPreprocessor {
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPExtensionType::
|
||||
CPPExtensionType(CPPExtensionType::Type type,
|
||||
CPPIdentifier *ident, CPPScope *current_scope,
|
||||
const CPPFile &file) :
|
||||
CPPIdentifier *ident, CPPScope *current_scope,
|
||||
const CPPFile &file) :
|
||||
CPPType(file),
|
||||
_type(type), _ident(ident)
|
||||
{
|
||||
|
|
@ -100,7 +100,7 @@ is_tbd() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPExtensionType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class CPPScope;
|
|||
class CPPIdentifier;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPExtensionType
|
||||
// Class : CPPExtensionType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPExtensionType : public CPPType {
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
};
|
||||
|
||||
CPPExtensionType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
|
||||
const CPPFile &file);
|
||||
const CPPFile &file);
|
||||
|
||||
virtual string get_simple_name() const;
|
||||
virtual string get_local_name(CPPScope *scope = NULL) const;
|
||||
|
|
@ -38,14 +38,14 @@ public:
|
|||
virtual bool is_tbd() const;
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPExtensionType *as_extension_type();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPFile::
|
||||
CPPFile(const Filename &filename, const Filename &filename_as_referenced,
|
||||
Source source) :
|
||||
Source source) :
|
||||
_filename(filename), _filename_as_referenced(filename_as_referenced),
|
||||
_source(source)
|
||||
{
|
||||
|
|
@ -90,8 +90,8 @@ is_c_or_i_file(const Filename &filename) {
|
|||
}
|
||||
|
||||
return (extension == "c" || extension == "cc" ||
|
||||
extension == "cpp" || extension == "c++" || extension == "cxx" ||
|
||||
extension == "i" || extension == "t");
|
||||
extension == "cpp" || extension == "c++" || extension == "cxx" ||
|
||||
extension == "i" || extension == "t");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -126,7 +126,7 @@ is_c_file(const Filename &filename) {
|
|||
}
|
||||
|
||||
return (extension == "c" || extension == "cc" ||
|
||||
extension == "cpp" || extension == "c++" || extension == "cxx");
|
||||
extension == "cpp" || extension == "c++" || extension == "cxx");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <filename.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPFile
|
||||
// Class : CPPFile
|
||||
// Description : This defines a source file (typically a C++ header
|
||||
// file) that is parsed by the CPPParser. Each
|
||||
// declaration indicates the source file where it
|
||||
|
|
@ -26,8 +26,8 @@ public:
|
|||
};
|
||||
|
||||
CPPFile(const Filename &filename = "",
|
||||
const Filename &filename_as_referenced = "",
|
||||
Source source = S_none);
|
||||
const Filename &filename_as_referenced = "",
|
||||
Source source = S_none);
|
||||
CPPFile(const CPPFile ©);
|
||||
void operator = (const CPPFile ©);
|
||||
~CPPFile();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ get_return_type() const {
|
|||
++ii;
|
||||
while (ii != _instances.end()) {
|
||||
if ((*ii)->_type->as_function_type()->_return_type != return_type) {
|
||||
return (CPPType *)NULL;
|
||||
return (CPPType *)NULL;
|
||||
}
|
||||
++ii;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
class CPPInstance;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPFunctionGroup
|
||||
// Class : CPPFunctionGroup
|
||||
// Description : This class is simply a container for one or more
|
||||
// CPPInstances for functions of the same name. It's
|
||||
// handy for storing in the CPPScope, so that
|
||||
|
|
@ -29,7 +29,7 @@ public:
|
|||
CPPType *get_return_type() const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPFunctionGroup *as_function_group();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPFunctionType::
|
||||
CPPFunctionType(CPPType *return_type, CPPParameterList *parameters,
|
||||
int flags) :
|
||||
int flags) :
|
||||
CPPType(CPPFile()),
|
||||
_return_type(return_type),
|
||||
_parameters(parameters),
|
||||
|
|
@ -86,7 +86,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPFunctionType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -192,8 +192,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPFunctionType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
output_instance(out, indent_level, scope, complete, prename, name, -1);
|
||||
}
|
||||
|
||||
|
|
@ -209,8 +209,8 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPFunctionType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name, int num_default_parameters) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name, int num_default_parameters) const {
|
||||
ostringstream parm_string;
|
||||
parm_string << "(";
|
||||
_parameters->output(parm_string, scope, true, num_default_parameters);
|
||||
|
|
@ -224,10 +224,10 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
|
|||
} else {
|
||||
if (prename.empty()) {
|
||||
_return_type->output_instance(out, indent_level, scope, complete,
|
||||
"", prename + name + str);
|
||||
"", prename + name + str);
|
||||
} else {
|
||||
_return_type->output_instance(out, indent_level, scope, complete,
|
||||
"", "(" + prename + name + ")" + str);
|
||||
"", "(" + prename + name + ")" + str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CPPParameterList;
|
|||
class CPPIdentifier;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPFunctionType
|
||||
// Class : CPPFunctionType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPFunctionType : public CPPType {
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
};
|
||||
|
||||
CPPFunctionType(CPPType *return_type, CPPParameterList *parameters,
|
||||
int flags);
|
||||
int flags);
|
||||
CPPFunctionType(const CPPFunctionType ©);
|
||||
void operator = (const CPPFunctionType ©);
|
||||
|
||||
|
|
@ -38,27 +38,27 @@ public:
|
|||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, int num_default_parameters) const;
|
||||
bool complete, int num_default_parameters) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name,
|
||||
int num_default_parameters) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name,
|
||||
int num_default_parameters) const;
|
||||
int get_num_default_parameters() const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ get_local_name(CPPScope *scope) const {
|
|||
} else {
|
||||
result = my_scope->get_local_name(scope);
|
||||
if (!result.empty()) {
|
||||
result += "::";
|
||||
result += "::";
|
||||
}
|
||||
result += _names.back().get_name_with_templ(scope);
|
||||
}
|
||||
|
|
@ -223,7 +223,7 @@ is_tbd() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPIdentifier::
|
||||
get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
assert(!_names.empty());
|
||||
|
||||
CPPScope *scope = _native_scope;
|
||||
|
|
@ -243,15 +243,15 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
CPPScope *next_scope = scope->find_scope(_names[i].get_name());
|
||||
if (next_scope == (CPPScope *)NULL) {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->error("Symbol " + _names[i].get_name() +
|
||||
" is not a known scope in " +
|
||||
scope->get_fully_scoped_name());
|
||||
error_sink->error("Symbol " + _names[i].get_name() +
|
||||
" is not a known scope in " +
|
||||
scope->get_fully_scoped_name());
|
||||
}
|
||||
return (CPPScope *)NULL;
|
||||
}
|
||||
if (_names[i].has_templ()) {
|
||||
next_scope = next_scope->instantiate(_names[i].get_templ(),
|
||||
current_scope, global_scope);
|
||||
current_scope, global_scope);
|
||||
}
|
||||
scope = next_scope;
|
||||
i++;
|
||||
|
|
@ -267,8 +267,8 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPIdentifier::
|
||||
get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
assert(!_names.empty());
|
||||
|
||||
CPPScope *scope = _native_scope;
|
||||
|
|
@ -286,18 +286,18 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
|
||||
while (i + 1 < (int)_names.size() && scope != NULL) {
|
||||
CPPScope *next_scope = scope->find_scope(_names[i].get_name(), subst,
|
||||
global_scope);
|
||||
global_scope);
|
||||
if (next_scope == (CPPScope *)NULL) {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->error("Symbol " + _names[i].get_name() +
|
||||
" is not a known scope in " +
|
||||
scope->get_fully_scoped_name());
|
||||
error_sink->error("Symbol " + _names[i].get_name() +
|
||||
" is not a known scope in " +
|
||||
scope->get_fully_scoped_name());
|
||||
}
|
||||
return (CPPScope *)NULL;
|
||||
}
|
||||
if (_names[i].has_templ()) {
|
||||
next_scope = next_scope->instantiate(_names[i].get_templ(),
|
||||
current_scope, global_scope);
|
||||
current_scope, global_scope);
|
||||
}
|
||||
scope = next_scope;
|
||||
i++;
|
||||
|
|
@ -321,8 +321,8 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPType *CPPIdentifier::
|
||||
find_type(CPPScope *current_scope, CPPScope *global_scope,
|
||||
bool force_instantiate,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
bool force_instantiate,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *scope = get_scope(current_scope, global_scope, error_sink);
|
||||
if (scope == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -338,18 +338,18 @@ find_type(CPPScope *current_scope, CPPScope *global_scope,
|
|||
/*
|
||||
if (type != NULL) {
|
||||
if (!type->is_incomplete() || force_instantiate) {
|
||||
type = type->instantiate(_names.back().get_templ(),
|
||||
current_scope, global_scope,
|
||||
error_sink)->as_type();
|
||||
|
||||
// If we ended up with another template, instantiate later.
|
||||
if (type->is_template() && !force_instantiate) {
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
}
|
||||
|
||||
type = type->instantiate(_names.back().get_templ(),
|
||||
current_scope, global_scope,
|
||||
error_sink)->as_type();
|
||||
|
||||
// If we ended up with another template, instantiate later.
|
||||
if (type->is_template() && !force_instantiate) {
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
}
|
||||
|
||||
} else {
|
||||
// Otherwise, we'll have to instantiate the type later.
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
// Otherwise, we'll have to instantiate the type later.
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
}
|
||||
// type->_file.replace_nearer(_file);
|
||||
}
|
||||
|
|
@ -367,8 +367,8 @@ find_type(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPType *CPPIdentifier::
|
||||
find_type(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *scope = get_scope(current_scope, global_scope, subst, error_sink);
|
||||
if (scope == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -381,17 +381,17 @@ find_type(CPPScope *current_scope, CPPScope *global_scope,
|
|||
// If our identifier fully specifies the instantiation, then
|
||||
// apply it.
|
||||
CPPDeclaration *decl =
|
||||
type->instantiate(_names.back().get_templ(),
|
||||
current_scope, global_scope,
|
||||
error_sink);
|
||||
type->instantiate(_names.back().get_templ(),
|
||||
current_scope, global_scope,
|
||||
error_sink);
|
||||
assert(decl != NULL);
|
||||
CPPType *new_type = decl->as_type();
|
||||
assert(new_type != NULL);
|
||||
if (new_type == type) {
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
// type = new_type;
|
||||
if (new_type == type) {
|
||||
type = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
// type = new_type;
|
||||
} else {
|
||||
type = new_type;
|
||||
type = new_type;
|
||||
}
|
||||
} else {
|
||||
// Otherwise, we'll have to instantiate the type later.
|
||||
|
|
@ -410,7 +410,7 @@ find_type(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPIdentifier::
|
||||
find_symbol(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *scope = get_scope(current_scope, global_scope, error_sink);
|
||||
if (scope == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -424,12 +424,12 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope,
|
|||
if (sym != NULL) {
|
||||
CPPType *type = sym->as_type();
|
||||
if (type != NULL && type->is_incomplete()) {
|
||||
// We can't instantiate an incomplete type.
|
||||
sym = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
// We can't instantiate an incomplete type.
|
||||
sym = CPPType::new_type(new CPPTBDType((CPPIdentifier *)this));
|
||||
} else {
|
||||
// Instantiate the symbol.
|
||||
sym = sym->instantiate(_names.back().get_templ(), current_scope,
|
||||
global_scope, error_sink);
|
||||
// Instantiate the symbol.
|
||||
sym = sym->instantiate(_names.back().get_templ(), current_scope,
|
||||
global_scope, error_sink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -444,7 +444,7 @@ find_symbol(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPIdentifier::
|
||||
find_template(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *scope = get_scope(current_scope, global_scope, error_sink);
|
||||
if (scope == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -459,7 +459,7 @@ find_template(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPIdentifier::
|
||||
find_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *scope = get_scope(current_scope, global_scope, error_sink);
|
||||
if (scope == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -475,16 +475,16 @@ find_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPIdentifier *CPPIdentifier::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPIdentifier *rep = new CPPIdentifier(*this);
|
||||
|
||||
bool anything_changed = false;
|
||||
for (int i = 0; i < (int)rep->_names.size(); i++) {
|
||||
if (_names[i].has_templ()) {
|
||||
rep->_names[i].set_templ
|
||||
(_names[i].get_templ()->substitute_decl(subst, current_scope, global_scope));
|
||||
(_names[i].get_templ()->substitute_decl(subst, current_scope, global_scope));
|
||||
if (rep->_names[i].get_templ() != _names[i].get_templ()) {
|
||||
anything_changed = true;
|
||||
anything_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CPPPreprocessor;
|
|||
class CPPTemplateParameterList;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPIdentifier
|
||||
// Class : CPPIdentifier
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPIdentifier {
|
||||
|
|
@ -46,30 +46,30 @@ public:
|
|||
|
||||
|
||||
CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
CPPType *find_type(CPPScope *current_scope, CPPScope *global_scope,
|
||||
bool force_instantiate = false,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
bool force_instantiate = false,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPType *find_type(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPDeclaration *find_symbol(CPPScope *current_scope,
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPDeclaration *find_template(CPPScope *current_scope,
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *find_scope(CPPScope *current_scope,
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
CPPIdentifier *substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
void output(ostream &out, CPPScope *scope) const;
|
||||
void output_local_name(ostream &out, CPPScope *scope) const;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ CPPInstance(CPPType *type, CPPIdentifier *ident, int storage_class) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPInstance::
|
||||
CPPInstance(CPPType *type, CPPInstanceIdentifier *ii, int storage_class,
|
||||
const CPPFile &file) :
|
||||
const CPPFile &file) :
|
||||
CPPDeclaration(file)
|
||||
{
|
||||
_type = ii->unroll_type(type);
|
||||
|
|
@ -107,7 +107,7 @@ CPPInstance::
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPInstance *CPPInstance::
|
||||
make_typecast_function(CPPInstance *inst, CPPIdentifier *ident,
|
||||
CPPParameterList *parameters, int function_flags) {
|
||||
CPPParameterList *parameters, int function_flags) {
|
||||
CPPType *type = CPPType::new_type(inst->_type);
|
||||
delete inst;
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ is_scoped() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPInstance::
|
||||
get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
if (_ident == NULL) {
|
||||
return current_scope;
|
||||
} else {
|
||||
|
|
@ -323,20 +323,20 @@ check_for_constructor(CPPScope *current_scope, CPPScope *global_scope) {
|
|||
|
||||
if (!method_name.empty() && !class_name.empty()) {
|
||||
if (method_name == class_name) {
|
||||
CPPType *void_type = CPPType::new_type
|
||||
(new CPPSimpleType(CPPSimpleType::T_void));
|
||||
CPPType *void_type = CPPType::new_type
|
||||
(new CPPSimpleType(CPPSimpleType::T_void));
|
||||
|
||||
_type = CPPType::new_type
|
||||
(new CPPFunctionType(void_type, func->_parameters,
|
||||
func->_flags | CPPFunctionType::F_constructor));
|
||||
_type = CPPType::new_type
|
||||
(new CPPFunctionType(void_type, func->_parameters,
|
||||
func->_flags | CPPFunctionType::F_constructor));
|
||||
|
||||
} else if (method_name == "~" + class_name) {
|
||||
CPPType *void_type = CPPType::new_type
|
||||
(new CPPSimpleType(CPPSimpleType::T_void));
|
||||
CPPType *void_type = CPPType::new_type
|
||||
(new CPPSimpleType(CPPSimpleType::T_void));
|
||||
|
||||
_type = CPPType::new_type
|
||||
(new CPPFunctionType(void_type, func->_parameters,
|
||||
func->_flags | CPPFunctionType::F_destructor));
|
||||
_type = CPPType::new_type
|
||||
(new CPPFunctionType(void_type, func->_parameters,
|
||||
func->_flags | CPPFunctionType::F_destructor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -349,12 +349,12 @@ check_for_constructor(CPPScope *current_scope, CPPScope *global_scope) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPInstance::
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
if (!is_template()) {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Ignoring template parameters for instance " +
|
||||
_ident->get_local_name());
|
||||
_ident->get_local_name());
|
||||
}
|
||||
return (CPPInstance *)this;
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
|
||||
CPPDeclaration::SubstDecl subst;
|
||||
actual_params->build_subst_decl(tscope->_parameters, subst,
|
||||
current_scope, global_scope);
|
||||
current_scope, global_scope);
|
||||
|
||||
CPPInstance *inst =
|
||||
((CPPInstance *)this)->substitute_decl(subst, current_scope, global_scope)
|
||||
|
|
@ -423,7 +423,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPInstance::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPDeclaration *top =
|
||||
CPPDeclaration::substitute_decl(subst, current_scope, global_scope);
|
||||
if (top != this) {
|
||||
|
|
@ -517,7 +517,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete,
|
|||
if (_type->as_function_type()) {
|
||||
_type->as_function_type()->
|
||||
output_instance(out, indent_level, scope, complete, "", name,
|
||||
num_default_parameters);
|
||||
num_default_parameters);
|
||||
} else {
|
||||
_type->output_instance(out, indent_level, scope, complete, "", name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class CPPScope;
|
|||
class CPPExpression;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPInstance
|
||||
// Class : CPPInstance
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPInstance : public CPPDeclaration {
|
||||
|
|
@ -46,13 +46,13 @@ public:
|
|||
CPPInstance(CPPType *type, const string &name, int storage_class = 0);
|
||||
CPPInstance(CPPType *type, CPPIdentifier *ident, int storage_class = 0);
|
||||
CPPInstance(CPPType *type, CPPInstanceIdentifier *ii,
|
||||
int storage_class, const CPPFile &file);
|
||||
int storage_class, const CPPFile &file);
|
||||
CPPInstance(const CPPInstance ©);
|
||||
~CPPInstance();
|
||||
|
||||
static CPPInstance *
|
||||
make_typecast_function(CPPInstance *inst, CPPIdentifier *ident,
|
||||
CPPParameterList *parameters, int function_flags);
|
||||
CPPParameterList *parameters, int function_flags);
|
||||
|
||||
bool operator == (const CPPInstance &other) const;
|
||||
bool operator != (const CPPInstance &other) const;
|
||||
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
bool is_scoped() const;
|
||||
CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
string get_simple_name() const;
|
||||
string get_local_name(CPPScope *scope = NULL) const;
|
||||
|
|
@ -72,18 +72,18 @@ public:
|
|||
|
||||
virtual CPPDeclaration *
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, int num_default_parameters) const;
|
||||
bool complete, int num_default_parameters) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPInstance *as_instance();
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ add_array_modifier(CPPExpression *expr) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPInstanceIdentifier::
|
||||
get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPPreprocessor *error_sink) const {
|
||||
if (_ident == NULL) {
|
||||
return current_scope;
|
||||
} else {
|
||||
|
|
@ -147,7 +147,7 @@ get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPType *CPPInstanceIdentifier::
|
||||
r_unroll_type(CPPType *start_type,
|
||||
CPPInstanceIdentifier::Modifiers::const_iterator mi) {
|
||||
CPPInstanceIdentifier::Modifiers::const_iterator mi) {
|
||||
start_type = CPPType::new_type(start_type);
|
||||
|
||||
if (mi == _modifiers.end()) {
|
||||
|
|
@ -173,10 +173,10 @@ r_unroll_type(CPPType *start_type,
|
|||
CPPType *type = r_unroll_type(start_type, mi);
|
||||
CPPFunctionType *ftype = type->as_function_type();
|
||||
if (ftype != NULL) {
|
||||
ftype = new CPPFunctionType(*ftype);
|
||||
ftype->_class_owner = mod._scoping;
|
||||
ftype->_flags |= CPPFunctionType::F_method_pointer;
|
||||
type = ftype;
|
||||
ftype = new CPPFunctionType(*ftype);
|
||||
ftype->_class_owner = mod._scoping;
|
||||
ftype->_flags |= CPPFunctionType::F_method_pointer;
|
||||
type = ftype;
|
||||
}
|
||||
result = new CPPPointerType(type);
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ r_unroll_type(CPPType *start_type,
|
|||
|
||||
case IIT_array:
|
||||
result = new CPPArrayType(r_unroll_type(start_type, mi),
|
||||
mod._expr);
|
||||
mod._expr);
|
||||
break;
|
||||
|
||||
case IIT_const:
|
||||
|
|
@ -199,7 +199,7 @@ r_unroll_type(CPPType *start_type,
|
|||
{
|
||||
CPPType *return_type = r_unroll_type(start_type, mi);
|
||||
result = new CPPFunctionType(return_type, mod._func_params,
|
||||
mod._func_flags);
|
||||
mod._func_flags);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ enum CPPInstanceIdentifierType {
|
|||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPInstanceIdentifier
|
||||
// Class : CPPInstanceIdentifier
|
||||
// Description : This class is used in parser.y to build up a variable
|
||||
// instance definition. An instance is something like
|
||||
// 'int *&a'; the InstanceIdentifier stores everything
|
||||
|
|
@ -50,7 +50,7 @@ public:
|
|||
void add_array_modifier(CPPExpression *expr);
|
||||
|
||||
CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
CPPIdentifier *_ident;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ expand(const vector_string &args) const {
|
|||
if ((*ei)._parm_number >= 0) {
|
||||
int i = (*ei)._parm_number;
|
||||
if (i < (int)args.size()) {
|
||||
result += " " + args[i] + " ";
|
||||
result += " " + args[i] + " ";
|
||||
} else {
|
||||
result += " ";
|
||||
result += " ";
|
||||
}
|
||||
}
|
||||
if (!(*ei)._str.empty()) {
|
||||
|
|
@ -144,7 +144,7 @@ output(ostream &out) const {
|
|||
if (_num_parameters > 0) {
|
||||
out << "$1";
|
||||
for (int i = 1; i < _num_parameters; i++) {
|
||||
out << ", $" << i + 1;
|
||||
out << ", $" << i + 1;
|
||||
}
|
||||
}
|
||||
out << ")";
|
||||
|
|
@ -172,7 +172,7 @@ output(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPManifest::
|
||||
parse_parameters(const string &args, size_t &p,
|
||||
vector_string ¶meter_names) {
|
||||
vector_string ¶meter_names) {
|
||||
assert(p < args.size());
|
||||
assert(args[p] == '(');
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ parse_parameters(const string &args, size_t &p,
|
|||
// Here's the beginning of a parm.
|
||||
size_t q = p;
|
||||
while (p < args.size() && !isspace(args[p]) &&
|
||||
args[p] != ')' && args[p] != ',') {
|
||||
args[p] != ')' && args[p] != ',') {
|
||||
p++;
|
||||
}
|
||||
parameter_names.push_back(args.substr(q, p - q));
|
||||
|
|
@ -199,7 +199,7 @@ parse_parameters(const string &args, size_t &p,
|
|||
p++;
|
||||
// Skip whitespace after a comma.
|
||||
while (p < args.size() && isspace(args[p])) {
|
||||
p++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ save_expansion(const string &exp, const vector_string ¶meter_names) {
|
|||
size_t q = p;
|
||||
p++;
|
||||
while (p < exp.size() && isalnum(exp[p]) || exp[p] == '_') {
|
||||
p++;
|
||||
p++;
|
||||
}
|
||||
|
||||
string ident = exp.substr(q, p - q);
|
||||
|
|
@ -236,18 +236,18 @@ save_expansion(const string &exp, const vector_string ¶meter_names) {
|
|||
// Is this identifier one of our parameters?
|
||||
int pnum = -1;
|
||||
for (int i = 0; pnum == -1 && i < (int)parameter_names.size(); i++) {
|
||||
if (parameter_names[i] == ident) {
|
||||
pnum = i;
|
||||
}
|
||||
if (parameter_names[i] == ident) {
|
||||
pnum = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (pnum != -1) {
|
||||
// Yep!
|
||||
if (last != q) {
|
||||
_expansion.push_back(ExpansionNode(exp.substr(last, q - last)));
|
||||
}
|
||||
_expansion.push_back(pnum);
|
||||
last = p;
|
||||
// Yep!
|
||||
if (last != q) {
|
||||
_expansion.push_back(ExpansionNode(exp.substr(last, q - last)));
|
||||
}
|
||||
_expansion.push_back(pnum);
|
||||
last = p;
|
||||
}
|
||||
} else {
|
||||
p++;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class CPPExpression;
|
|||
class CPPType;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPManifest
|
||||
// Class : CPPManifest
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPManifest {
|
||||
|
|
@ -44,9 +44,9 @@ public:
|
|||
|
||||
private:
|
||||
void parse_parameters(const string &args, size_t &p,
|
||||
vector_string ¶meter_names);
|
||||
vector_string ¶meter_names);
|
||||
void save_expansion(const string &exp,
|
||||
const vector_string ¶meter_names);
|
||||
const vector_string ¶meter_names);
|
||||
|
||||
class ExpansionNode {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ class CPPIdentifier;
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPNamespace
|
||||
// Class : CPPNamespace
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPNamespace : public CPPDeclaration {
|
||||
public:
|
||||
CPPNamespace(CPPIdentifier *ident, CPPScope *scope,
|
||||
const CPPFile &file);
|
||||
const CPPFile &file);
|
||||
|
||||
string get_simple_name() const;
|
||||
string get_local_name(CPPScope *scope = NULL) const;
|
||||
|
|
@ -28,7 +28,7 @@ public:
|
|||
CPPScope *get_scope() const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPNamespace *as_namespace();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPParameterList *CPPParameterList::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPParameterList *rep = new CPPParameterList;
|
||||
bool any_changed = false;
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
|
|
@ -212,7 +212,7 @@ output(ostream &out, CPPScope *scope, bool parameter_names,
|
|||
if (!_parameters.empty()) {
|
||||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
if (i != 0) {
|
||||
out << ", ";
|
||||
out << ", ";
|
||||
}
|
||||
|
||||
// Save the default value expression; we might be about to
|
||||
|
|
@ -220,15 +220,15 @@ output(ostream &out, CPPScope *scope, bool parameter_names,
|
|||
CPPExpression *expr = _parameters[i]->_initializer;
|
||||
|
||||
if (num_default_parameters >= 0 &&
|
||||
i < (int)_parameters.size() - num_default_parameters) {
|
||||
// Don't show the default value for this parameter.
|
||||
_parameters[i]->_initializer = (CPPExpression *)NULL;
|
||||
i < (int)_parameters.size() - num_default_parameters) {
|
||||
// Don't show the default value for this parameter.
|
||||
_parameters[i]->_initializer = (CPPExpression *)NULL;
|
||||
}
|
||||
|
||||
if (parameter_names) {
|
||||
_parameters[i]->output(out, 0, scope, false);
|
||||
_parameters[i]->output(out, 0, scope, false);
|
||||
} else {
|
||||
_parameters[i]->_type->output(out, 0, scope, false);
|
||||
_parameters[i]->_type->output(out, 0, scope, false);
|
||||
}
|
||||
|
||||
// Restore the default value expression.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class CPPInstance;
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPParameterList
|
||||
// Class : CPPParameterList
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPParameterList {
|
||||
|
|
@ -33,11 +33,11 @@ public:
|
|||
|
||||
bool is_fully_specified() const;
|
||||
CPPParameterList *substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
CPPParameterList *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
// This vector contains a list of formal parameters, in order. A
|
||||
// parameter may have an empty identifer name.
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
bool _includes_ellipsis;
|
||||
|
||||
void output(ostream &out, CPPScope *scope, bool parameter_names,
|
||||
int num_default_parameters = -1) const;
|
||||
int num_default_parameters = -1) const;
|
||||
};
|
||||
|
||||
inline ostream &
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <set>
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPParser
|
||||
// Class : CPPParser
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPParser : public CPPScope, public CPPPreprocessor {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPPointerType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -142,8 +142,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPointerType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
string star = "*";
|
||||
|
||||
CPPFunctionType *ftype = _pointing_at->as_function_type();
|
||||
|
|
@ -155,7 +155,7 @@ output_instance(ostream &out, int indent_level, CPPScope *scope,
|
|||
}
|
||||
|
||||
_pointing_at->output_instance(out, indent_level, scope, complete,
|
||||
star + prename, name);
|
||||
star + prename, name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "cppType.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPPointerType
|
||||
// Class : CPPPointerType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPPointerType : public CPPType {
|
||||
|
|
@ -31,21 +31,21 @@ public:
|
|||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -332,75 +332,75 @@ get_next_token0() {
|
|||
// parse the template parameters.
|
||||
CPPDeclaration *decl = ident->find_template(current_scope, global_scope);
|
||||
if (decl != NULL) {
|
||||
ident->_names.back().set_templ
|
||||
(nested_parse_template_instantiation(decl->get_template_scope()));
|
||||
token = internal_get_next_token();
|
||||
ident->_names.back().set_templ
|
||||
(nested_parse_template_instantiation(decl->get_template_scope()));
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
}
|
||||
|
||||
while (token._token == SCOPE || token._token == TOKENPASTE) {
|
||||
if (token._token == TOKENPASTE) {
|
||||
// The token-pasting operator creates one continuous
|
||||
// identifier across whitespace.
|
||||
token = internal_get_next_token();
|
||||
if (token._token == SIMPLE_IDENTIFIER) {
|
||||
name += token._lval.str;
|
||||
ident->_names.back().append_name(token._lval.str);
|
||||
// The token-pasting operator creates one continuous
|
||||
// identifier across whitespace.
|
||||
token = internal_get_next_token();
|
||||
if (token._token == SIMPLE_IDENTIFIER) {
|
||||
name += token._lval.str;
|
||||
ident->_names.back().append_name(token._lval.str);
|
||||
|
||||
token = internal_get_next_token();
|
||||
token = internal_get_next_token();
|
||||
|
||||
} else {
|
||||
// Token-paste with nothing.
|
||||
}
|
||||
} else {
|
||||
// Token-paste with nothing.
|
||||
}
|
||||
|
||||
} else { // token._token == SCOPE
|
||||
name += "::";
|
||||
token = internal_get_next_token();
|
||||
string token_prefix;
|
||||
name += "::";
|
||||
token = internal_get_next_token();
|
||||
string token_prefix;
|
||||
|
||||
if (token._token == '~') {
|
||||
// A scoping operator followed by a tilde can only be the
|
||||
// start of a scoped destructor name. Make the tilde be part
|
||||
// of the name.
|
||||
name += "~";
|
||||
token_prefix = "~";
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
|
||||
if (token._token != SIMPLE_IDENTIFIER) {
|
||||
// The last useful token was a SCOPE, thus this is a scoping
|
||||
// token.
|
||||
|
||||
if (token._token == KW_OPERATOR) {
|
||||
// Unless the last token we came across was the "operator"
|
||||
// keyword. We make a special case for this, because it's
|
||||
// occasionally scoped in normal use.
|
||||
token._lval = result;
|
||||
return token;
|
||||
}
|
||||
_saved_tokens.push_back(token);
|
||||
return CPPToken(SCOPING, first_line, first_col, first_file,
|
||||
name, result);
|
||||
}
|
||||
if (token._token == '~') {
|
||||
// A scoping operator followed by a tilde can only be the
|
||||
// start of a scoped destructor name. Make the tilde be part
|
||||
// of the name.
|
||||
name += "~";
|
||||
token_prefix = "~";
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
|
||||
name += token._lval.str;
|
||||
ident->_names.push_back(token_prefix + token._lval.str);
|
||||
if (token._token != SIMPLE_IDENTIFIER) {
|
||||
// The last useful token was a SCOPE, thus this is a scoping
|
||||
// token.
|
||||
|
||||
token = internal_get_next_token();
|
||||
if (token._token == KW_OPERATOR) {
|
||||
// Unless the last token we came across was the "operator"
|
||||
// keyword. We make a special case for this, because it's
|
||||
// occasionally scoped in normal use.
|
||||
token._lval = result;
|
||||
return token;
|
||||
}
|
||||
_saved_tokens.push_back(token);
|
||||
return CPPToken(SCOPING, first_line, first_col, first_file,
|
||||
name, result);
|
||||
}
|
||||
|
||||
name += token._lval.str;
|
||||
ident->_names.push_back(token_prefix + token._lval.str);
|
||||
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
|
||||
if (token._token == '<') {
|
||||
// If the next token is an angle bracket and the current
|
||||
// indentifier wants template instantiation, assume the angle
|
||||
// bracket begins the instantiation and call yacc recursively to
|
||||
// parse the template parameters.
|
||||
CPPDeclaration *decl =
|
||||
ident->find_template(current_scope, global_scope);
|
||||
if (decl != NULL) {
|
||||
ident->_names.back().set_templ
|
||||
(nested_parse_template_instantiation(decl->get_template_scope()));
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
// If the next token is an angle bracket and the current
|
||||
// indentifier wants template instantiation, assume the angle
|
||||
// bracket begins the instantiation and call yacc recursively to
|
||||
// parse the template parameters.
|
||||
CPPDeclaration *decl =
|
||||
ident->find_template(current_scope, global_scope);
|
||||
if (decl != NULL) {
|
||||
ident->_names.back().set_templ
|
||||
(nested_parse_template_instantiation(decl->get_template_scope()));
|
||||
token = internal_get_next_token();
|
||||
}
|
||||
}
|
||||
}
|
||||
// The last useful token was a SIMPLE_IDENTIFIER, thus this is a
|
||||
|
|
@ -410,12 +410,12 @@ get_next_token0() {
|
|||
int token_type = IDENTIFIER;
|
||||
CPPDeclaration *decl = ident->find_symbol(current_scope, global_scope);
|
||||
if (decl != NULL &&
|
||||
(decl->as_typedef() != NULL || decl->as_type() != NULL)) {
|
||||
(decl->as_typedef() != NULL || decl->as_type() != NULL)) {
|
||||
token_type = TYPENAME_IDENTIFIER;
|
||||
}
|
||||
|
||||
return CPPToken(token_type, first_line, first_col, first_file,
|
||||
name, result);
|
||||
name, result);
|
||||
}
|
||||
|
||||
// This is the normal case: just pass through whatever token we got.
|
||||
|
|
@ -438,8 +438,8 @@ warning(const string &message, int line, int col, CPPFile file) {
|
|||
file = get_file();
|
||||
}
|
||||
cerr << "\nWarning in " << file
|
||||
<< " near line " << line << ", column " << col << ":\n"
|
||||
<< message << "\n";
|
||||
<< " near line " << line << ", column " << col << ":\n"
|
||||
<< message << "\n";
|
||||
}
|
||||
_warning_count++;
|
||||
}
|
||||
|
|
@ -466,8 +466,8 @@ error(const string &message, int line, int col, CPPFile file) {
|
|||
file = get_file();
|
||||
}
|
||||
cerr << "\nError in " << file
|
||||
<< " near line " << line << ", column " << col << ":\n"
|
||||
<< message << "\n";
|
||||
<< " near line " << line << ", column " << col << ":\n"
|
||||
<< message << "\n";
|
||||
}
|
||||
_error_count++;
|
||||
}
|
||||
|
|
@ -510,16 +510,16 @@ get_comment_before(int line, CPPFile file) {
|
|||
if (comment->_file == file) {
|
||||
wrong_file_count = 0;
|
||||
if (comment->_last_line == line || comment->_last_line == line - 1) {
|
||||
return comment;
|
||||
return comment;
|
||||
}
|
||||
|
||||
if (comment->_last_line < line) {
|
||||
return (CPPCommentBlock *)NULL;
|
||||
return (CPPCommentBlock *)NULL;
|
||||
}
|
||||
} else {
|
||||
wrong_file_count++;
|
||||
if (wrong_file_count > 10) {
|
||||
return (CPPCommentBlock *)NULL;
|
||||
return (CPPCommentBlock *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ push_string(const string &input, bool lock_position) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPExpression *CPPPreprocessor::
|
||||
parse_expr(const string &input_expr, CPPScope *current_scope,
|
||||
CPPScope *global_scope) {
|
||||
CPPScope *global_scope) {
|
||||
// Get a copy of the expression string we can modify.
|
||||
string expr = input_expr;
|
||||
|
||||
|
|
@ -668,28 +668,28 @@ parse_expr(const string &input_expr, CPPScope *current_scope,
|
|||
size_t p = 0;
|
||||
while (p < expr.size()) {
|
||||
if (isalpha(expr[p]) || expr[p] == '_') {
|
||||
size_t q = p;
|
||||
while (p < expr.size() && (isalnum(expr[p]) || expr[p] == '_')) {
|
||||
p++;
|
||||
}
|
||||
string ident = expr.substr(q, p - q);
|
||||
|
||||
// Here's an identifier. Is it "defined"?
|
||||
if (ident == "defined") {
|
||||
expand_defined_function(expr, q, p);
|
||||
} else {
|
||||
// Is it a manifest?
|
||||
Manifests::const_iterator mi = _manifests.find(ident);
|
||||
if (mi != _manifests.end()) {
|
||||
const CPPManifest *manifest = (*mi).second;
|
||||
if (already_expanded.insert(manifest).second) {
|
||||
expand_manifest_inline(expr, q, p, (*mi).second);
|
||||
manifest_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t q = p;
|
||||
while (p < expr.size() && (isalnum(expr[p]) || expr[p] == '_')) {
|
||||
p++;
|
||||
}
|
||||
string ident = expr.substr(q, p - q);
|
||||
|
||||
// Here's an identifier. Is it "defined"?
|
||||
if (ident == "defined") {
|
||||
expand_defined_function(expr, q, p);
|
||||
} else {
|
||||
// Is it a manifest?
|
||||
Manifests::const_iterator mi = _manifests.find(ident);
|
||||
if (mi != _manifests.end()) {
|
||||
const CPPManifest *manifest = (*mi).second;
|
||||
if (already_expanded.insert(manifest).second) {
|
||||
expand_manifest_inline(expr, q, p, (*mi).second);
|
||||
manifest_found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p++;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -869,16 +869,16 @@ internal_get_next_token() {
|
|||
|
||||
case ',':
|
||||
if (_paren_nesting <= 0) {
|
||||
_state = S_end_nested;
|
||||
return CPPToken::eof();
|
||||
_state = S_end_nested;
|
||||
return CPPToken::eof();
|
||||
}
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (_paren_nesting <= 0) {
|
||||
_angle_bracket_found = true;
|
||||
_state = S_end_nested;
|
||||
return CPPToken::eof();
|
||||
_angle_bracket_found = true;
|
||||
_state = S_end_nested;
|
||||
return CPPToken::eof();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -958,22 +958,22 @@ skip_c_comment(int c) {
|
|||
|
||||
while (c != EOF) {
|
||||
if (c == '*') {
|
||||
comment->_comment += c;
|
||||
c = get();
|
||||
if (c == '/') {
|
||||
comment->_comment += c;
|
||||
comment->_last_line = get_line_number();
|
||||
return get();
|
||||
}
|
||||
comment->_comment += c;
|
||||
c = get();
|
||||
if (c == '/') {
|
||||
comment->_comment += c;
|
||||
comment->_last_line = get_line_number();
|
||||
return get();
|
||||
}
|
||||
} else {
|
||||
comment->_comment += c;
|
||||
c = get();
|
||||
comment->_comment += c;
|
||||
c = get();
|
||||
}
|
||||
}
|
||||
|
||||
warning("Comment is unterminated",
|
||||
comment->_line_number, comment->_col_number,
|
||||
comment->_file);
|
||||
comment->_line_number, comment->_col_number,
|
||||
comment->_file);
|
||||
|
||||
} else {
|
||||
CPPFile first_file = get_file();
|
||||
|
|
@ -982,18 +982,18 @@ skip_c_comment(int c) {
|
|||
|
||||
while (c != EOF) {
|
||||
if (c == '*') {
|
||||
c = get();
|
||||
if (c == '/') {
|
||||
return get();
|
||||
}
|
||||
c = get();
|
||||
if (c == '/') {
|
||||
return get();
|
||||
}
|
||||
} else {
|
||||
c = get();
|
||||
c = get();
|
||||
}
|
||||
}
|
||||
|
||||
warning("Comment is unterminated",
|
||||
first_line_number, first_col_number,
|
||||
first_file);
|
||||
first_line_number, first_col_number,
|
||||
first_file);
|
||||
}
|
||||
|
||||
return c;
|
||||
|
|
@ -1097,7 +1097,7 @@ process_directive(int c) {
|
|||
handle_error_directive(args, first_line, first_col, first_file);
|
||||
} else {
|
||||
warning("Ignoring unknown directive #" + command,
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
|
||||
_start_of_line = true;
|
||||
|
|
@ -1144,14 +1144,14 @@ get_preprocessor_args(int c, string &args) {
|
|||
if (c == '\\') {
|
||||
int next_c = get();
|
||||
if (next_c == '\n') {
|
||||
// Here we have an escaped newline: a continuation.
|
||||
args += '\n';
|
||||
// Here we have an escaped newline: a continuation.
|
||||
args += '\n';
|
||||
} else {
|
||||
// Just a backslash followed by some non-backslash, keep both.
|
||||
args += c;
|
||||
if (next_c != EOF) {
|
||||
args += next_c;
|
||||
}
|
||||
// Just a backslash followed by some non-backslash, keep both.
|
||||
args += c;
|
||||
if (next_c != EOF) {
|
||||
args += next_c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
args += c;
|
||||
|
|
@ -1172,17 +1172,17 @@ get_preprocessor_args(int c, string &args) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_define_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
int first_col, const CPPFile &first_file) {
|
||||
if (args.empty()) {
|
||||
warning("Ignoring empty #define directive",
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
} else {
|
||||
CPPManifest *manifest = new CPPManifest(args, first_file);
|
||||
manifest->_vis = preprocessor_vis;
|
||||
if (!manifest->_has_parameters) {
|
||||
string expr_string = manifest->expand();
|
||||
if (!expr_string.empty()) {
|
||||
manifest->_expr = parse_expr(expr_string, global_scope, global_scope);
|
||||
manifest->_expr = parse_expr(expr_string, global_scope, global_scope);
|
||||
}
|
||||
}
|
||||
_manifests[manifest->_name] = manifest;
|
||||
|
|
@ -1196,10 +1196,10 @@ handle_define_directive(const string &args, int first_line,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_undef_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
int first_col, const CPPFile &first_file) {
|
||||
if (args.empty()) {
|
||||
warning("Ignoring empty #undef directive",
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
} else {
|
||||
Manifests::iterator mi = _manifests.find(args);
|
||||
if (mi != _manifests.end()) {
|
||||
|
|
@ -1250,7 +1250,7 @@ handle_ifndef_directive(const string &args, int, int, const CPPFile &) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_if_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
int first_col, const CPPFile &first_file) {
|
||||
CPPExpression *expr = parse_expr(args, global_scope, global_scope);
|
||||
|
||||
int expression_result = 0;
|
||||
|
|
@ -1259,13 +1259,13 @@ handle_if_directive(const string &args, int first_line,
|
|||
CPPExpression::Result result = expr->evaluate();
|
||||
if (result._type == CPPExpression::RT_error) {
|
||||
warning("Ignoring invalid expression " + args,
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
} else {
|
||||
expression_result = result.as_integer();
|
||||
}
|
||||
} else {
|
||||
warning("Ignoring invalid expression " + args,
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
|
||||
if (expression_result) {
|
||||
|
|
@ -1284,7 +1284,7 @@ handle_if_directive(const string &args, int first_line,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_include_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
int first_col, const CPPFile &first_file) {
|
||||
bool okflag = false;
|
||||
Filename filename;
|
||||
Filename filename_as_referenced;
|
||||
|
|
@ -1296,10 +1296,10 @@ handle_include_directive(const string &args, int first_line,
|
|||
okflag = true;
|
||||
|
||||
if (_files.size() == 1) {
|
||||
// If we're currently processing a top-level file, record the
|
||||
// include directive. We don't need to record includes from
|
||||
// included files.
|
||||
_quote_includes.insert(filename);
|
||||
// If we're currently processing a top-level file, record the
|
||||
// include directive. We don't need to record includes from
|
||||
// included files.
|
||||
_quote_includes.insert(filename);
|
||||
}
|
||||
} else if (args[0] == '<' && args[args.size() - 1] == '>') {
|
||||
filename = args.substr(1, args.size() - 2);
|
||||
|
|
@ -1307,10 +1307,10 @@ handle_include_directive(const string &args, int first_line,
|
|||
okflag = true;
|
||||
|
||||
if (_files.size() == 1) {
|
||||
// If we're currently processing a top-level file, record the
|
||||
// include directive. We don't need to record includes from
|
||||
// included files.
|
||||
_angle_includes.insert(filename);
|
||||
// If we're currently processing a top-level file, record the
|
||||
// include directive. We don't need to record includes from
|
||||
// included files.
|
||||
_angle_includes.insert(filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1342,17 +1342,17 @@ handle_include_directive(const string &args, int first_line,
|
|||
|
||||
if (!found_file) {
|
||||
warning("Cannot find " + filename.get_fullpath(),
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
} else {
|
||||
_last_c = '\0';
|
||||
if (!push_file(CPPFile(filename, filename_as_referenced, source))) {
|
||||
warning("Unable to read " + filename.get_fullpath(),
|
||||
first_line, first_col, first_file);
|
||||
warning("Unable to read " + filename.get_fullpath(),
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warning("Ignoring invalid #include directive",
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1363,7 +1363,7 @@ handle_include_directive(const string &args, int first_line,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
handle_error_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file) {
|
||||
int first_col, const CPPFile &first_file) {
|
||||
error(args, first_line, first_col, first_file);
|
||||
}
|
||||
|
||||
|
|
@ -1391,30 +1391,30 @@ skip_false_if_block(bool consider_elifs) {
|
|||
string command;
|
||||
c = get_preprocessor_command(c, command);
|
||||
if (command == "if" || command == "ifdef" || command == "ifndef") {
|
||||
// Hmm, a nested if block. Even more to skip.
|
||||
level++;
|
||||
// Hmm, a nested if block. Even more to skip.
|
||||
level++;
|
||||
} else if (command == "else") {
|
||||
if (level == 0 && consider_elifs) {
|
||||
// This will do!
|
||||
_save_comments = true;
|
||||
return;
|
||||
}
|
||||
if (level == 0 && consider_elifs) {
|
||||
// This will do!
|
||||
_save_comments = true;
|
||||
return;
|
||||
}
|
||||
} else if (command == "elif") {
|
||||
if (level == 0 && consider_elifs) {
|
||||
// If we pass this test, we're in.
|
||||
_save_comments = true;
|
||||
string args;
|
||||
c = get_preprocessor_args(c, args);
|
||||
handle_if_directive(args, first_line, first_col, first_file);
|
||||
return;
|
||||
}
|
||||
if (level == 0 && consider_elifs) {
|
||||
// If we pass this test, we're in.
|
||||
_save_comments = true;
|
||||
string args;
|
||||
c = get_preprocessor_args(c, args);
|
||||
handle_if_directive(args, first_line, first_col, first_file);
|
||||
return;
|
||||
}
|
||||
} else if (command == "endif") {
|
||||
if (level == 0) {
|
||||
// Here's the end!
|
||||
_save_comments = true;
|
||||
return;
|
||||
}
|
||||
level--;
|
||||
if (level == 0) {
|
||||
// Here's the end!
|
||||
_save_comments = true;
|
||||
return;
|
||||
}
|
||||
level--;
|
||||
}
|
||||
} else {
|
||||
c = skip_comment(get());
|
||||
|
|
@ -1506,7 +1506,7 @@ get_identifier(int c) {
|
|||
}
|
||||
|
||||
return CPPToken(SIMPLE_IDENTIFIER, first_line, first_col, first_file,
|
||||
name);
|
||||
name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1546,7 +1546,7 @@ expand_manifest(const CPPManifest *manifest) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
extract_manifest_args(const string &name, int num_args,
|
||||
vector_string &args) {
|
||||
vector_string &args) {
|
||||
CPPFile first_file = get_file();
|
||||
int first_line = get_line_number();
|
||||
int first_col = get_col_number();
|
||||
|
|
@ -1572,27 +1572,27 @@ extract_manifest_args(const string &name, int num_args,
|
|||
string arg;
|
||||
while (c != EOF && c != ')') {
|
||||
if (c == ',') {
|
||||
args.push_back(arg);
|
||||
arg = "";
|
||||
args.push_back(arg);
|
||||
arg = "";
|
||||
|
||||
} else if (c == '(') {
|
||||
// Nested parens.
|
||||
int paren_level = 1;
|
||||
while (c != EOF && paren_level > 0) {
|
||||
arg += c;
|
||||
c = get();
|
||||
if (c == '(') {
|
||||
paren_level++;
|
||||
} else if (c == ')') {
|
||||
paren_level--;
|
||||
}
|
||||
}
|
||||
if (c != EOF) {
|
||||
arg += c;
|
||||
}
|
||||
|
||||
// Nested parens.
|
||||
int paren_level = 1;
|
||||
while (c != EOF && paren_level > 0) {
|
||||
arg += c;
|
||||
c = get();
|
||||
if (c == '(') {
|
||||
paren_level++;
|
||||
} else if (c == ')') {
|
||||
paren_level--;
|
||||
}
|
||||
}
|
||||
if (c != EOF) {
|
||||
arg += c;
|
||||
}
|
||||
|
||||
} else {
|
||||
arg += c;
|
||||
arg += c;
|
||||
}
|
||||
c = get();
|
||||
}
|
||||
|
|
@ -1603,7 +1603,7 @@ extract_manifest_args(const string &name, int num_args,
|
|||
|
||||
if ((int)args.size() != num_args) {
|
||||
warning("Wrong number of arguments for manifest " + name,
|
||||
first_line, first_col, first_file);
|
||||
first_line, first_col, first_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1641,11 +1641,11 @@ expand_defined_function(string &expr, size_t q, size_t &p) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
expand_manifest_inline(string &expr, size_t q, size_t &p,
|
||||
const CPPManifest *manifest) {
|
||||
const CPPManifest *manifest) {
|
||||
vector_string args;
|
||||
if (manifest->_has_parameters) {
|
||||
extract_manifest_args_inline(manifest->_name, manifest->_num_parameters,
|
||||
args, expr, p);
|
||||
args, expr, p);
|
||||
}
|
||||
string result = manifest->expand(args);
|
||||
|
||||
|
|
@ -1660,8 +1660,8 @@ expand_manifest_inline(string &expr, size_t q, size_t &p,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPPreprocessor::
|
||||
extract_manifest_args_inline(const string &name, int num_args,
|
||||
vector_string &args,
|
||||
const string &expr, size_t &p) {
|
||||
vector_string &args,
|
||||
const string &expr, size_t &p) {
|
||||
// Skip whitespace till paren.
|
||||
while (p < expr.size() && isspace(expr[p])) {
|
||||
p++;
|
||||
|
|
@ -1679,20 +1679,20 @@ extract_manifest_args_inline(const string &name, int num_args,
|
|||
size_t q = p;
|
||||
while (p < expr.size() && expr[p] != ')') {
|
||||
if (expr[p] == ',') {
|
||||
args.push_back(expr.substr(q, p - q));
|
||||
q = p+1;
|
||||
args.push_back(expr.substr(q, p - q));
|
||||
q = p+1;
|
||||
|
||||
} else if (expr[p] == '(') {
|
||||
// Nested parens.
|
||||
int paren_level = 1;
|
||||
while (p+1 < expr.size() && paren_level > 0) {
|
||||
p++;
|
||||
if (expr[p] == '(') {
|
||||
paren_level++;
|
||||
} else if (expr[p] == ')') {
|
||||
paren_level--;
|
||||
}
|
||||
}
|
||||
// Nested parens.
|
||||
int paren_level = 1;
|
||||
while (p+1 < expr.size() && paren_level > 0) {
|
||||
p++;
|
||||
if (expr[p] == '(') {
|
||||
paren_level++;
|
||||
} else if (expr[p] == ')') {
|
||||
paren_level--;
|
||||
}
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
|
@ -1773,12 +1773,12 @@ get_number(int c, int c2) {
|
|||
num += c;
|
||||
c = get();
|
||||
if (c == '-' || c == '+') {
|
||||
num += c;
|
||||
c = get();
|
||||
num += c;
|
||||
c = get();
|
||||
}
|
||||
while (c != EOF && isdigit(c)) {
|
||||
num += c;
|
||||
c = get();
|
||||
num += c;
|
||||
c = get();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1901,31 +1901,31 @@ scan_quoted(int c) {
|
|||
c = get();
|
||||
switch (c) {
|
||||
case 'n':
|
||||
c = '\n';
|
||||
break;
|
||||
c = '\n';
|
||||
break;
|
||||
|
||||
case 't':
|
||||
c = '\t';
|
||||
break;
|
||||
c = '\t';
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
c = '\r';
|
||||
break;
|
||||
c = '\r';
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
// hex character.
|
||||
c = get();
|
||||
if (isxdigit(c)) {
|
||||
int val = hex_val(c);
|
||||
c = get();
|
||||
if (isxdigit(c)) {
|
||||
val = (val << 4) | hex_val(c);
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
c = val;
|
||||
}
|
||||
break;
|
||||
// hex character.
|
||||
c = get();
|
||||
if (isxdigit(c)) {
|
||||
int val = hex_val(c);
|
||||
c = get();
|
||||
if (isxdigit(c)) {
|
||||
val = (val << 4) | hex_val(c);
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
c = val;
|
||||
}
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
|
|
@ -1935,24 +1935,24 @@ scan_quoted(int c) {
|
|||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
// Octal character.
|
||||
{
|
||||
int val = (c - '0');
|
||||
c = get();
|
||||
if (c >= '0' && c <= '7') {
|
||||
val = (val << 3) | (c - '0');
|
||||
c = get();
|
||||
if (c >= '0' && c <= '7') {
|
||||
val = (val << 3) | (c - '0');
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
c = val;
|
||||
}
|
||||
break;
|
||||
// Octal character.
|
||||
{
|
||||
int val = (c - '0');
|
||||
c = get();
|
||||
if (c >= '0' && c <= '7') {
|
||||
val = (val << 3) | (c - '0');
|
||||
c = get();
|
||||
if (c >= '0' && c <= '7') {
|
||||
val = (val << 3) | (c - '0');
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
} else {
|
||||
unget(c);
|
||||
}
|
||||
c = val;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2106,18 +2106,18 @@ nested_parse_template_instantiation(CPPTemplateScope *scope) {
|
|||
_saved_tokens.push_back(CPPToken(START_TYPE));
|
||||
CPPType *type = ::parse_type(this, current_scope, global_scope);
|
||||
if (type == NULL) {
|
||||
warning("Invalid type", first_line, first_col, first_file);
|
||||
skip_to_end_nested();
|
||||
type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown));
|
||||
warning("Invalid type", first_line, first_col, first_file);
|
||||
skip_to_end_nested();
|
||||
type = CPPType::new_type(new CPPSimpleType(CPPSimpleType::T_unknown));
|
||||
}
|
||||
actual_params->_parameters.push_back(type);
|
||||
} else {
|
||||
_saved_tokens.push_back(CPPToken(START_CONST_EXPR));
|
||||
CPPExpression *expr = parse_const_expr(this, current_scope, global_scope);
|
||||
if (expr == NULL) {
|
||||
warning("Invalid expression", first_line, first_col, first_file);
|
||||
skip_to_end_nested();
|
||||
expr = new CPPExpression(0);
|
||||
warning("Invalid expression", first_line, first_col, first_file);
|
||||
skip_to_end_nested();
|
||||
expr = new CPPExpression(0);
|
||||
}
|
||||
actual_params->_parameters.push_back(expr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class CPPExpression;
|
|||
//#define CPP_VERBOSE_LEX
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPPreprocessor
|
||||
// Class : CPPPreprocessor
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPPreprocessor {
|
||||
|
|
@ -50,9 +50,9 @@ public:
|
|||
#endif
|
||||
|
||||
void warning(const string &message, int line = 0, int col = 0,
|
||||
CPPFile file = CPPFile());
|
||||
CPPFile file = CPPFile());
|
||||
void error(const string &message, int line = 0, int col = 0,
|
||||
CPPFile file = CPPFile());
|
||||
CPPFile file = CPPFile());
|
||||
|
||||
CPPCommentBlock *get_comment_before(int line, CPPFile file);
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ protected:
|
|||
bool push_string(const string &input, bool lock_position);
|
||||
|
||||
CPPExpression *parse_expr(const string &expr, CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
private:
|
||||
CPPToken internal_get_next_token();
|
||||
|
|
@ -109,19 +109,19 @@ private:
|
|||
int get_preprocessor_args(int c, string &args);
|
||||
|
||||
void handle_define_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_undef_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_ifdef_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_ifndef_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_if_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_include_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
void handle_error_directive(const string &args, int first_line,
|
||||
int first_col, const CPPFile &first_file);
|
||||
int first_col, const CPPFile &first_file);
|
||||
|
||||
void skip_false_if_block(bool consider_elifs);
|
||||
|
||||
|
|
@ -130,13 +130,13 @@ private:
|
|||
CPPToken get_identifier(int c);
|
||||
CPPToken expand_manifest(const CPPManifest *manifest);
|
||||
void extract_manifest_args(const string &name, int num_args,
|
||||
vector_string &args);
|
||||
vector_string &args);
|
||||
void expand_defined_function(string &expr, size_t q, size_t &p);
|
||||
void expand_manifest_inline(string &expr, size_t q, size_t &p,
|
||||
const CPPManifest *manifest);
|
||||
const CPPManifest *manifest);
|
||||
void extract_manifest_args_inline(const string &name, int num_args,
|
||||
vector_string &args,
|
||||
const string &expr, size_t &p);
|
||||
vector_string &args,
|
||||
const string &expr, size_t &p);
|
||||
|
||||
CPPToken get_number(int c, int c2 = 0);
|
||||
static int check_keyword(const string &name);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPReferenceType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
return (*si).second;
|
||||
|
|
@ -132,10 +132,10 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPReferenceType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
_pointing_at->output_instance(out, indent_level, scope, complete,
|
||||
"&" + prename, name);
|
||||
"&" + prename, name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cppType.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPReferenceType
|
||||
// Class : CPPReferenceType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPReferenceType : public CPPType {
|
||||
|
|
@ -22,21 +22,21 @@ public:
|
|||
|
||||
virtual bool is_fully_specified() const;
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope::
|
||||
CPPScope(CPPScope *parent_scope,
|
||||
const CPPNameComponent &name, CPPVisibility starting_vis) :
|
||||
const CPPNameComponent &name, CPPVisibility starting_vis) :
|
||||
_name(name),
|
||||
_parent_scope(parent_scope),
|
||||
_current_vis(starting_vis)
|
||||
|
|
@ -113,7 +113,7 @@ get_current_vis() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPScope::
|
||||
add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *preprocessor, const cppyyltype &pos) {
|
||||
CPPPreprocessor *preprocessor, const cppyyltype &pos) {
|
||||
decl->_vis = _current_vis;
|
||||
|
||||
// Get the recent comments from the preprocessor. These are the
|
||||
|
|
@ -215,7 +215,7 @@ define_namespace(CPPNamespace *scope) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPScope::
|
||||
add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) {
|
||||
CPPPreprocessor *error_sink) {
|
||||
if (using_decl->_full_namespace) {
|
||||
CPPScope *scope =
|
||||
using_decl->_ident->find_scope(this, global_scope);
|
||||
|
|
@ -223,7 +223,7 @@ add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
|||
_using.insert(scope);
|
||||
} else {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Attempt to use undefined namespace: " + using_decl->_ident->get_fully_scoped_name());
|
||||
error_sink->warning("Attempt to use undefined namespace: " + using_decl->_ident->get_fully_scoped_name());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -232,7 +232,7 @@ add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
|||
handle_declaration(decl, global_scope);
|
||||
} else {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Attempt to use unknown symbol: " + using_decl->_ident->get_fully_scoped_name());
|
||||
error_sink->warning("Attempt to use unknown symbol: " + using_decl->_ident->get_fully_scoped_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -287,15 +287,15 @@ is_fully_specified() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPScope::
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *this_scope = (CPPScope *)this;
|
||||
|
||||
if (_parent_scope == NULL ||
|
||||
_parent_scope->as_template_scope() == NULL) {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Ignoring template parameters for scope " +
|
||||
get_local_name());
|
||||
get_local_name());
|
||||
}
|
||||
return this_scope;
|
||||
}
|
||||
|
|
@ -314,14 +314,14 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
|
||||
/*
|
||||
cerr << "Instantiating " << get_simple_name()
|
||||
<< "<" << *actual_params << ">\n";
|
||||
<< "<" << *actual_params << ">\n";
|
||||
*/
|
||||
|
||||
// Build the mapping of formal parameters to actual parameters.
|
||||
CPPTemplateScope *tscope = _parent_scope->as_template_scope();
|
||||
CPPDeclaration::SubstDecl subst;
|
||||
actual_params->build_subst_decl(tscope->_parameters, subst,
|
||||
current_scope, global_scope);
|
||||
current_scope, global_scope);
|
||||
|
||||
CPPScope *scope;
|
||||
if (subst.empty()) {
|
||||
|
|
@ -338,16 +338,16 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
// "instantiated" this scope with another template parameter.
|
||||
CPPTemplateParameterList::Parameters::const_iterator pi;
|
||||
for (pi = actual_params->_parameters.begin();
|
||||
pi != actual_params->_parameters.end();
|
||||
++pi) {
|
||||
pi != actual_params->_parameters.end();
|
||||
++pi) {
|
||||
CPPDeclaration *decl = (*pi);
|
||||
CPPClassTemplateParameter *ctp = decl->as_class_template_parameter();
|
||||
if (ctp != NULL) {
|
||||
CPPInstance *inst = new CPPInstance(ctp, ctp->_ident);
|
||||
CPPTypedef *td = new CPPTypedef(inst, true);
|
||||
scope->_typedefs.insert(Typedefs::value_type
|
||||
(ctp->_ident->get_local_name(),
|
||||
td));
|
||||
CPPInstance *inst = new CPPInstance(ctp, ctp->_ident);
|
||||
CPPTypedef *td = new CPPTypedef(inst, true);
|
||||
scope->_typedefs.insert(Typedefs::value_type
|
||||
(ctp->_ident->get_local_name(),
|
||||
td));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPScope::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) const {
|
||||
CPPScope *current_scope, CPPScope *global_scope) const {
|
||||
CPPScope *this_scope = (CPPScope *)this;
|
||||
|
||||
if (is_fully_specified()) {
|
||||
|
|
@ -434,14 +434,14 @@ find_type(const string &name, bool recurse) const {
|
|||
if (_struct_type != NULL) {
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType *st = (*di)._base->as_struct_type();
|
||||
if (st != NULL) {
|
||||
CPPType *type = st->_scope->find_type(name, false);
|
||||
if (type != NULL) {
|
||||
return type;
|
||||
}
|
||||
CPPType *type = st->_scope->find_type(name, false);
|
||||
if (type != NULL) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -460,7 +460,7 @@ find_type(const string &name, bool recurse) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPType *CPPScope::
|
||||
find_type(const string &name, CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope, bool recurse) const {
|
||||
CPPScope *global_scope, bool recurse) const {
|
||||
Typedefs::const_iterator ti;
|
||||
ti = _typedefs.find(name);
|
||||
if (ti != _typedefs.end()) {
|
||||
|
|
@ -480,15 +480,15 @@ find_type(const string &name, CPPDeclaration::SubstDecl &subst,
|
|||
if (_struct_type != NULL) {
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType *st = (*di)._base->as_struct_type();
|
||||
if (st != NULL) {
|
||||
CPPType *type = st->_scope->find_type(name, subst, global_scope,
|
||||
false);
|
||||
if (type != NULL) {
|
||||
return type;
|
||||
}
|
||||
CPPType *type = st->_scope->find_type(name, subst, global_scope,
|
||||
false);
|
||||
if (type != NULL) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -522,11 +522,11 @@ find_scope(const string &name, bool recurse) const {
|
|||
} else if (_struct_type != NULL) {
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType *st = (*di)._base->as_struct_type();
|
||||
if (st != NULL) {
|
||||
type = st->_scope->find_type(name, false);
|
||||
type = st->_scope->find_type(name, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -560,7 +560,7 @@ find_scope(const string &name, bool recurse) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPScope *CPPScope::
|
||||
find_scope(const string &name, CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope, bool recurse) const {
|
||||
CPPScope *global_scope, bool recurse) const {
|
||||
CPPType *type = find_type(name, subst, global_scope, recurse);
|
||||
if (type == NULL) {
|
||||
return NULL;
|
||||
|
|
@ -617,14 +617,14 @@ find_symbol(const string &name, bool recurse) const {
|
|||
if (_struct_type != NULL) {
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType *st = (*di)._base->as_struct_type();
|
||||
if (st != NULL) {
|
||||
CPPDeclaration *decl = st->_scope->find_symbol(name, false);
|
||||
if (decl != NULL) {
|
||||
return decl;
|
||||
}
|
||||
CPPDeclaration *decl = st->_scope->find_symbol(name, false);
|
||||
if (decl != NULL) {
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -660,14 +660,14 @@ find_template(const string &name, bool recurse) const {
|
|||
if (_struct_type != NULL) {
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType *st = (*di)._base->as_struct_type();
|
||||
if (st != NULL) {
|
||||
CPPDeclaration *decl = st->_scope->find_template(name, false);
|
||||
if (decl != NULL) {
|
||||
return decl;
|
||||
}
|
||||
CPPDeclaration *decl = st->_scope->find_template(name, false);
|
||||
if (decl != NULL) {
|
||||
return decl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -769,7 +769,7 @@ write(ostream &out, int indent_level, CPPScope *scope) const {
|
|||
bool complete = false;
|
||||
|
||||
if (cd->as_typedef() != NULL || cd->as_type() != NULL ||
|
||||
cd->as_namespace() != NULL) {
|
||||
cd->as_namespace() != NULL) {
|
||||
complete = true;
|
||||
}
|
||||
|
||||
|
|
@ -822,7 +822,7 @@ as_template_scope() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool CPPScope::
|
||||
copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope) const {
|
||||
CPPScope *global_scope) const {
|
||||
bool anything_changed = false;
|
||||
|
||||
if (_struct_type != NULL) {
|
||||
|
|
@ -832,21 +832,21 @@ copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst,
|
|||
}
|
||||
to_scope->_struct_type =
|
||||
new CPPStructType(_struct_type->_type,
|
||||
new CPPIdentifier(to_scope->_name),
|
||||
native_scope, to_scope, _struct_type->_file);
|
||||
new CPPIdentifier(to_scope->_name),
|
||||
native_scope, to_scope, _struct_type->_file);
|
||||
to_scope->_struct_type->_incomplete = false;
|
||||
|
||||
// Copy the derivation to the new type.
|
||||
CPPStructType::Derivation::const_iterator di;
|
||||
for (di = _struct_type->_derivation.begin();
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
di != _struct_type->_derivation.end();
|
||||
++di) {
|
||||
CPPStructType::Base b = (*di);
|
||||
b._base =
|
||||
(*di)._base->substitute_decl(subst, to_scope, global_scope)->as_type();
|
||||
(*di)._base->substitute_decl(subst, to_scope, global_scope)->as_type();
|
||||
to_scope->_struct_type->_derivation.push_back(b);
|
||||
if (b._base != (*di)._base) {
|
||||
anything_changed = true;
|
||||
anything_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -926,13 +926,13 @@ copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst,
|
|||
|
||||
CPPFunctionGroup::Instances::const_iterator ii;
|
||||
for (ii = fgroup->_instances.begin();
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
CPPInstance *inst =
|
||||
(*ii)->substitute_decl(subst, to_scope, global_scope)->as_instance();
|
||||
(*ii)->substitute_decl(subst, to_scope, global_scope)->as_instance();
|
||||
to_fgroup->_instances.push_back(inst);
|
||||
if (inst != (*ii)) {
|
||||
anything_changed = true;
|
||||
anything_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -994,7 +994,7 @@ handle_declaration(CPPDeclaration *decl, CPPScope *global_scope) {
|
|||
// by the same name in another scope.
|
||||
|
||||
if (find_template(name) == NULL) {
|
||||
_templates.insert(Templates::value_type(name, def));
|
||||
_templates.insert(Templates::value_type(name, def));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
@ -1016,42 +1016,42 @@ handle_declaration(CPPDeclaration *decl, CPPScope *global_scope) {
|
|||
string name = inst->get_simple_name();
|
||||
if (!name.empty() && inst->get_scope(this, global_scope) == this) {
|
||||
if (inst->_type->as_function_type()) {
|
||||
// This is a function declaration; hence it gets added to
|
||||
// the _functions member. But we must be careful to share
|
||||
// common-named functions.
|
||||
|
||||
CPPFunctionGroup *fgroup;
|
||||
Functions::const_iterator fi;
|
||||
fi = _functions.find(name);
|
||||
if (fi == _functions.end()) {
|
||||
fgroup = new CPPFunctionGroup(name);
|
||||
_functions.insert(Functions::value_type(name, fgroup));
|
||||
} else {
|
||||
fgroup = (*fi).second;
|
||||
}
|
||||
fgroup->_instances.push_back(inst);
|
||||
|
||||
// This is a function declaration; hence it gets added to
|
||||
// the _functions member. But we must be careful to share
|
||||
// common-named functions.
|
||||
|
||||
CPPFunctionGroup *fgroup;
|
||||
Functions::const_iterator fi;
|
||||
fi = _functions.find(name);
|
||||
if (fi == _functions.end()) {
|
||||
fgroup = new CPPFunctionGroup(name);
|
||||
_functions.insert(Functions::value_type(name, fgroup));
|
||||
} else {
|
||||
fgroup = (*fi).second;
|
||||
}
|
||||
fgroup->_instances.push_back(inst);
|
||||
|
||||
} else {
|
||||
// This is not a function declaration; hence it gets added
|
||||
// to the _variables member.
|
||||
_variables[name] = inst;
|
||||
// This is not a function declaration; hence it gets added
|
||||
// to the _variables member.
|
||||
_variables[name] = inst;
|
||||
}
|
||||
|
||||
if (inst->is_template()) {
|
||||
// Don't add a new template definition if we already had one
|
||||
// by the same name in another scope.
|
||||
// Don't add a new template definition if we already had one
|
||||
// by the same name in another scope.
|
||||
|
||||
if (find_template(name) == NULL) {
|
||||
_templates.insert(Templates::value_type(name, inst));
|
||||
}
|
||||
|
||||
/*
|
||||
if (inst->_type->as_function_type() == NULL ||
|
||||
(inst->_type->as_function_type()->_flags &
|
||||
CPPFunctionType::F_constructor) == 0) {
|
||||
_templates.insert(Templates::value_type(name, inst));
|
||||
}
|
||||
*/
|
||||
if (find_template(name) == NULL) {
|
||||
_templates.insert(Templates::value_type(name, inst));
|
||||
}
|
||||
|
||||
/*
|
||||
if (inst->_type->as_function_type() == NULL ||
|
||||
(inst->_type->as_function_type()->_flags &
|
||||
CPPFunctionType::F_constructor) == 0) {
|
||||
_templates.insert(Templates::value_type(name, inst));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ class CPPNameComponent;
|
|||
struct cppyyltype;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPScope
|
||||
// Class : CPPScope
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPScope {
|
||||
public:
|
||||
CPPScope(CPPScope *parent_scope,
|
||||
const CPPNameComponent &name, CPPVisibility starting_vis);
|
||||
const CPPNameComponent &name, CPPVisibility starting_vis);
|
||||
virtual ~CPPScope();
|
||||
|
||||
void set_current_vis(CPPVisibility current_vis);
|
||||
|
|
@ -52,40 +52,40 @@ public:
|
|||
CPPScope *get_parent_scope() const;
|
||||
|
||||
virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos);
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos);
|
||||
virtual void add_enum_value(CPPInstance *inst);
|
||||
virtual void define_extension_type(CPPExtensionType *type);
|
||||
virtual void define_namespace(CPPNamespace *scope);
|
||||
virtual void add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL);
|
||||
CPPPreprocessor *error_sink = NULL);
|
||||
|
||||
virtual bool is_fully_specified() const;
|
||||
|
||||
CPPScope *
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
CPPScope *
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope) const;
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope) const;
|
||||
|
||||
CPPType *find_type(const string &name, bool recurse = true) const;
|
||||
CPPType *find_type(const string &name,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope,
|
||||
bool recurse = true) const;
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope,
|
||||
bool recurse = true) const;
|
||||
CPPScope *find_scope(const string &name, bool recurse = true) const;
|
||||
CPPScope *find_scope(const string &name,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope,
|
||||
bool recurse = true) const;
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope,
|
||||
bool recurse = true) const;
|
||||
CPPDeclaration *find_symbol(const string &name,
|
||||
bool recurse = true) const;
|
||||
bool recurse = true) const;
|
||||
CPPDeclaration *find_template(const string &name,
|
||||
bool recurse = true) const;
|
||||
bool recurse = true) const;
|
||||
|
||||
virtual string get_simple_name() const;
|
||||
virtual string get_local_name(CPPScope *scope = NULL) const;
|
||||
|
|
@ -100,7 +100,7 @@ public:
|
|||
private:
|
||||
bool
|
||||
copy_substitute_decl(CPPScope *to_scope, CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *global_scope) const;
|
||||
CPPScope *global_scope) const;
|
||||
|
||||
void handle_declaration(CPPDeclaration *decl, CPPScope *global_scope);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cppType.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPSimpleType
|
||||
// Class : CPPSimpleType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPSimpleType : public CPPType {
|
||||
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual string get_preferred_name() const;
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPSimpleType *as_simple_type();
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ output(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPStructType::
|
||||
CPPStructType(CPPStructType::Type type, CPPIdentifier *ident,
|
||||
CPPScope *current_scope, CPPScope *scope,
|
||||
const CPPFile &file) :
|
||||
CPPScope *current_scope, CPPScope *scope,
|
||||
const CPPFile &file) :
|
||||
CPPExtensionType(type, ident, current_scope, file),
|
||||
_scope(scope)
|
||||
{
|
||||
|
|
@ -180,12 +180,12 @@ get_destructor() const {
|
|||
fi = _scope->_functions.lower_bound("~");
|
||||
|
||||
while (fi != _scope->_functions.end() &&
|
||||
(*fi).first[0] == '~') {
|
||||
(*fi).first[0] == '~') {
|
||||
CPPFunctionGroup *fgroup = (*fi).second;
|
||||
CPPFunctionGroup::Instances::const_iterator ii;
|
||||
for (ii = fgroup->_instances.begin();
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
CPPInstance *inst = (*ii);
|
||||
assert(inst->_type != (CPPType *)NULL);
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ get_destructor() const {
|
|||
assert(ftype != (CPPFunctionType *)NULL);
|
||||
|
||||
if ((ftype->_flags & CPPFunctionType::F_destructor) != 0) {
|
||||
return inst;
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
++fi;
|
||||
|
|
@ -209,8 +209,8 @@ get_destructor() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPStructType::
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) const {
|
||||
|
||||
// I *think* this assertion is no longer valid. Who knows.
|
||||
// assert(!_incomplete);
|
||||
|
|
@ -218,7 +218,7 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
if (_scope == NULL) {
|
||||
if (error_sink != NULL) {
|
||||
error_sink->warning("Ignoring template parameters for class " +
|
||||
get_local_name());
|
||||
get_local_name());
|
||||
}
|
||||
return (CPPDeclaration *)this;
|
||||
}
|
||||
|
|
@ -255,7 +255,7 @@ instantiate(const CPPTemplateParameterList *actual_params,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPStructType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
SubstDecl::const_iterator si = subst.find(this);
|
||||
if (si != subst.end()) {
|
||||
assert((*si).second != NULL);
|
||||
|
|
@ -295,18 +295,18 @@ substitute_decl(CPPDeclaration::SubstDecl &subst,
|
|||
CPPScope *pscope = rep->_scope->get_parent_scope();
|
||||
|
||||
if (pscope != (CPPScope *)NULL &&
|
||||
pscope->_name.has_templ()) {
|
||||
pscope->_name.has_templ()) {
|
||||
|
||||
// If the struct name didn't have an explicit template
|
||||
// reference before, now it does.
|
||||
if (!_ident->_names.empty() && !_ident->_names.back().has_templ()) {
|
||||
if (rep->is_template()) {
|
||||
rep->_template_scope = (CPPTemplateScope *)NULL;
|
||||
CPPNameComponent nc(get_simple_name());
|
||||
nc.set_templ(pscope->_name.get_templ());
|
||||
rep->_ident = new CPPIdentifier(nc);
|
||||
}
|
||||
}
|
||||
// If the struct name didn't have an explicit template
|
||||
// reference before, now it does.
|
||||
if (!_ident->_names.empty() && !_ident->_names.back().has_templ()) {
|
||||
if (rep->is_template()) {
|
||||
rep->_template_scope = (CPPTemplateScope *)NULL;
|
||||
CPPNameComponent nc(get_simple_name());
|
||||
nc.set_templ(pscope->_name.get_templ());
|
||||
rep->_ident = new CPPIdentifier(nc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -389,8 +389,8 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete) const {
|
|||
out << ": " << *di;
|
||||
++di;
|
||||
while (di != _derivation.end()) {
|
||||
out << ", " << *di;
|
||||
++di;
|
||||
out << ", " << *di;
|
||||
++di;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -464,10 +464,10 @@ get_virtual_funcs(VFunctions &funcs) const {
|
|||
// destructors up by name.
|
||||
CPPInstance *destructor = get_destructor();
|
||||
if (destructor != (CPPInstance *)NULL) {
|
||||
// It's a match! This destructor is virtual.
|
||||
funcs.erase(vfi);
|
||||
destructor->_storage_class |=
|
||||
(CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual);
|
||||
// It's a match! This destructor is virtual.
|
||||
funcs.erase(vfi);
|
||||
destructor->_storage_class |=
|
||||
(CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -477,34 +477,34 @@ get_virtual_funcs(VFunctions &funcs) const {
|
|||
fi = _scope->_functions.find(fname);
|
||||
|
||||
if (fi != _scope->_functions.end()) {
|
||||
CPPFunctionGroup *fgroup = (*fi).second;
|
||||
|
||||
// Look for a matching function amid this group.
|
||||
bool match_found = false;
|
||||
CPPFunctionGroup::Instances::const_iterator ii;
|
||||
for (ii = fgroup->_instances.begin();
|
||||
ii != fgroup->_instances.end() && !match_found;
|
||||
++ii) {
|
||||
CPPInstance *new_inst = (*ii);
|
||||
assert(new_inst->_type != (CPPType *)NULL);
|
||||
|
||||
CPPFunctionType *new_ftype = new_inst->_type->as_function_type();
|
||||
assert(new_ftype != (CPPFunctionType *)NULL);
|
||||
|
||||
if (new_ftype->is_equivalent_function(*base_ftype)) {
|
||||
// It's a match! We now know it's virtual. Erase this
|
||||
// function from the list, so we can add it back in below.
|
||||
funcs.erase(vfi);
|
||||
match_found = true;
|
||||
CPPFunctionGroup *fgroup = (*fi).second;
|
||||
|
||||
// In fact, it's not only definitely virtual, but it's
|
||||
// *inherited* virtual, which means only that the
|
||||
// interface is defined in some parent class. Sometimes
|
||||
// this is useful to know.
|
||||
new_inst->_storage_class |=
|
||||
(CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual);
|
||||
}
|
||||
}
|
||||
// Look for a matching function amid this group.
|
||||
bool match_found = false;
|
||||
CPPFunctionGroup::Instances::const_iterator ii;
|
||||
for (ii = fgroup->_instances.begin();
|
||||
ii != fgroup->_instances.end() && !match_found;
|
||||
++ii) {
|
||||
CPPInstance *new_inst = (*ii);
|
||||
assert(new_inst->_type != (CPPType *)NULL);
|
||||
|
||||
CPPFunctionType *new_ftype = new_inst->_type->as_function_type();
|
||||
assert(new_ftype != (CPPFunctionType *)NULL);
|
||||
|
||||
if (new_ftype->is_equivalent_function(*base_ftype)) {
|
||||
// It's a match! We now know it's virtual. Erase this
|
||||
// function from the list, so we can add it back in below.
|
||||
funcs.erase(vfi);
|
||||
match_found = true;
|
||||
|
||||
// In fact, it's not only definitely virtual, but it's
|
||||
// *inherited* virtual, which means only that the
|
||||
// interface is defined in some parent class. Sometimes
|
||||
// this is useful to know.
|
||||
new_inst->_storage_class |=
|
||||
(CPPInstance::SC_virtual | CPPInstance::SC_inherited_virtual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vfi = vfnext;
|
||||
|
|
@ -518,12 +518,12 @@ get_virtual_funcs(VFunctions &funcs) const {
|
|||
CPPFunctionGroup *fgroup = (*fi).second;
|
||||
CPPFunctionGroup::Instances::const_iterator ii;
|
||||
for (ii = fgroup->_instances.begin();
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
ii != fgroup->_instances.end();
|
||||
++ii) {
|
||||
CPPInstance *inst = (*ii);
|
||||
if ((inst->_storage_class & CPPInstance::SC_virtual) != 0) {
|
||||
// Here's a virtual function.
|
||||
funcs.push_back(inst);
|
||||
// Here's a virtual function.
|
||||
funcs.push_back(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,15 +18,15 @@ class CPPScope;
|
|||
class CPPTypeProxy;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPStructType
|
||||
// Class : CPPStructType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPStructType : public CPPExtensionType {
|
||||
public:
|
||||
CPPStructType(Type type, CPPIdentifier *ident,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *scope,
|
||||
const CPPFile &file);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *scope,
|
||||
const CPPFile &file);
|
||||
CPPStructType(const CPPStructType ©);
|
||||
void operator = (const CPPStructType ©);
|
||||
|
||||
|
|
@ -43,15 +43,15 @@ public:
|
|||
|
||||
virtual CPPDeclaration *
|
||||
instantiate(const CPPTemplateParameterList *actual_params,
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
CPPScope *current_scope, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL) const;
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPStructType *as_struct_type();
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ get_fully_scoped_name() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPTBDType::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPDeclaration *top =
|
||||
CPPDeclaration::substitute_decl(subst, current_scope, global_scope);
|
||||
if (top != this) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
class CPPIdentifier;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTBDType
|
||||
// Class : CPPTBDType
|
||||
// Description : This represents a type whose exact meaning is still
|
||||
// to-be-determined. It happens when a typename is
|
||||
// referenced in a template class (especially using the
|
||||
|
|
@ -25,7 +25,7 @@ public:
|
|||
CPPTBDType(CPPIdentifier *ident);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
|
||||
|
|
@ -34,11 +34,11 @@ public:
|
|||
virtual string get_fully_scoped_name() const;
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPTBDType *as_tbd_type();
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ get_string() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPTemplateParameterList::
|
||||
build_subst_decl(const CPPTemplateParameterList &formal_params,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) const {
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) const {
|
||||
Parameters::const_iterator pfi, pai;
|
||||
for (pfi = formal_params._parameters.begin(), pai = _parameters.begin();
|
||||
pfi != formal_params._parameters.end() && pai != _parameters.end();
|
||||
|
|
@ -66,25 +66,25 @@ build_subst_decl(const CPPTemplateParameterList &formal_params,
|
|||
// A value template parameter. Its default is an expression.
|
||||
CPPInstance *inst = decl->as_instance();
|
||||
if (inst->_initializer != NULL) {
|
||||
CPPDeclaration *decl =
|
||||
inst->_initializer->substitute_decl(subst, current_scope,
|
||||
global_scope);
|
||||
if (!(*decl == *inst)) {
|
||||
subst.insert(CPPDeclaration::SubstDecl::value_type
|
||||
(inst, decl));
|
||||
}
|
||||
CPPDeclaration *decl =
|
||||
inst->_initializer->substitute_decl(subst, current_scope,
|
||||
global_scope);
|
||||
if (!(*decl == *inst)) {
|
||||
subst.insert(CPPDeclaration::SubstDecl::value_type
|
||||
(inst, decl));
|
||||
}
|
||||
}
|
||||
} else if (decl->as_class_template_parameter()) {
|
||||
// A class template parameter.
|
||||
CPPClassTemplateParameter *cparam = decl->as_class_template_parameter();
|
||||
if (cparam->_default_type != NULL) {
|
||||
CPPDeclaration *decl =
|
||||
cparam->_default_type->substitute_decl(subst, current_scope,
|
||||
global_scope);
|
||||
if (!(*cparam == *decl)) {
|
||||
subst.insert(CPPDeclaration::SubstDecl::value_type
|
||||
(cparam, decl));
|
||||
}
|
||||
CPPDeclaration *decl =
|
||||
cparam->_default_type->substitute_decl(subst, current_scope,
|
||||
global_scope);
|
||||
if (!(*cparam == *decl)) {
|
||||
subst.insert(CPPDeclaration::SubstDecl::value_type
|
||||
(cparam, decl));
|
||||
}
|
||||
}
|
||||
}
|
||||
++pfi;
|
||||
|
|
@ -124,7 +124,7 @@ is_tbd() const {
|
|||
for (int i = 0; i < (int)_parameters.size(); i++) {
|
||||
CPPType *type = _parameters[i]->as_type();
|
||||
if (type != (CPPType *)NULL &&
|
||||
(type->is_tbd() || type->as_class_template_parameter() != NULL)) {
|
||||
(type->is_tbd() || type->as_class_template_parameter() != NULL)) {
|
||||
return true;
|
||||
}
|
||||
CPPExpression *expr = _parameters[i]->as_expression();
|
||||
|
|
@ -188,7 +188,7 @@ operator < (const CPPTemplateParameterList &other) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPTemplateParameterList *CPPTemplateParameterList::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPTemplateParameterList *rep = new CPPTemplateParameterList(*this);
|
||||
|
||||
bool anything_changed = false;
|
||||
|
|
@ -221,7 +221,7 @@ output(ostream &out, CPPScope *scope) const {
|
|||
|
||||
++pi;
|
||||
while (pi != _parameters.end()) {
|
||||
out << ", ";
|
||||
out << ", ";
|
||||
(*pi)->output(out, 0, scope, false);
|
||||
++pi;
|
||||
}
|
||||
|
|
@ -244,7 +244,7 @@ write_formal(ostream &out, CPPScope *scope) const {
|
|||
|
||||
++pi;
|
||||
while (pi != _parameters.end()) {
|
||||
out << ", ";
|
||||
out << ", ";
|
||||
(*pi)->output(out, 0, scope, true);
|
||||
++pi;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTemplateParameterList
|
||||
// Class : CPPTemplateParameterList
|
||||
// Description : This class serves to store the parameter list for a
|
||||
// template function or class, both for the formal
|
||||
// parameter list (given when the template is defined)
|
||||
|
|
@ -29,8 +29,8 @@ public:
|
|||
|
||||
string get_string() const;
|
||||
void build_subst_decl(const CPPTemplateParameterList &formal_params,
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) const;
|
||||
CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) const;
|
||||
|
||||
bool is_fully_specified() const;
|
||||
bool is_tbd() const;
|
||||
|
|
@ -40,8 +40,8 @@ public:
|
|||
bool operator < (const CPPTemplateParameterList &other) const;
|
||||
|
||||
CPPTemplateParameterList *substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
void output(ostream &out, CPPScope *scope) const;
|
||||
void write_formal(ostream &out, CPPScope *scope) const;
|
||||
|
|
@ -62,7 +62,7 @@ operator << (ostream &out, const CPPTemplateParameterList &plist) {
|
|||
class CPPTPLCompare {
|
||||
public:
|
||||
bool operator () (const CPPTemplateParameterList *a,
|
||||
const CPPTemplateParameterList *b) const {
|
||||
const CPPTemplateParameterList *b) const {
|
||||
return (*a) < (*b);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ CPPTemplateScope(CPPScope *parent_scope) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPTemplateScope::
|
||||
add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos) {
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos) {
|
||||
decl->_template_scope = this;
|
||||
assert(_parent_scope != NULL);
|
||||
_parent_scope->add_declaration(decl, global_scope, preprocessor, pos);
|
||||
|
|
@ -78,7 +78,7 @@ define_namespace(CPPNamespace *scope) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPTemplateScope::
|
||||
add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink) {
|
||||
CPPPreprocessor *error_sink) {
|
||||
assert(_parent_scope != NULL);
|
||||
_parent_scope->add_using(using_decl, global_scope, error_sink);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "cppTemplateParameterList.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTemplateScope
|
||||
// Class : CPPTemplateScope
|
||||
// Description : This is an implicit scope that is created following
|
||||
// the appearance of a "template<class x, class y>" or
|
||||
// some such line in a C++ file. It simply defines the
|
||||
|
|
@ -25,13 +25,13 @@ public:
|
|||
void add_template_parameter(CPPDeclaration *param);
|
||||
|
||||
virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos);
|
||||
CPPPreprocessor *preprocessor,
|
||||
const cppyyltype &pos);
|
||||
virtual void add_enum_value(CPPInstance *inst);
|
||||
virtual void define_extension_type(CPPExtensionType *type);
|
||||
virtual void define_namespace(CPPNamespace *scope);
|
||||
virtual void add_using(CPPUsing *using_decl, CPPScope *global_scope,
|
||||
CPPPreprocessor *error_sink = NULL);
|
||||
CPPPreprocessor *error_sink = NULL);
|
||||
|
||||
virtual bool is_fully_specified() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPToken::
|
||||
CPPToken(int token, int line_number, int col_number,
|
||||
const CPPFile &file, const string &str,
|
||||
const YYSTYPE &lval) :
|
||||
const CPPFile &file, const string &str,
|
||||
const YYSTYPE &lval) :
|
||||
_token(token), _lval(lval)
|
||||
{
|
||||
_lval.str = str;
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@
|
|||
#include "cppBisonDefs.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPToken
|
||||
// Class : CPPToken
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPToken {
|
||||
public:
|
||||
CPPToken(int token, int line_number = 0, int col_number = 0,
|
||||
const CPPFile &file = CPPFile(""),
|
||||
const string &str = string(),
|
||||
const YYSTYPE &lval = YYSTYPE());
|
||||
const CPPFile &file = CPPFile(""),
|
||||
const string &str = string(),
|
||||
const YYSTYPE &lval = YYSTYPE());
|
||||
CPPToken(const CPPToken ©);
|
||||
void operator = (const CPPToken ©);
|
||||
|
||||
|
|
|
|||
|
|
@ -192,8 +192,8 @@ output_instance(ostream &out, const string &name, CPPScope *scope) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPType::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
output(out, indent_level, scope, complete);
|
||||
out << " " << prename << name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public:
|
|||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPType
|
||||
// Class : CPPType
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPType : public CPPDeclaration {
|
||||
|
|
@ -36,7 +36,7 @@ public:
|
|||
CPPType(const CPPFile &file);
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
|
||||
|
|
@ -52,11 +52,11 @@ public:
|
|||
virtual bool is_equivalent(const CPPType &other) const;
|
||||
|
||||
void output_instance(ostream &out, const string &name,
|
||||
CPPScope *scope) const;
|
||||
CPPScope *scope) const;
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
|
||||
virtual CPPType *as_type();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ CPPTypeDeclaration(CPPType *type) :
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPTypeDeclaration::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPDeclaration *decl =
|
||||
CPPInstance::substitute_decl(subst, current_scope, global_scope);
|
||||
assert(decl != NULL);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cppInstance.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTypeDeclaration
|
||||
// Class : CPPTypeDeclaration
|
||||
// Description : A CPPTypeDeclaration is a special declaration that
|
||||
// represents the top-level declaration of a type in a
|
||||
// source file. Typically this is the first appearance
|
||||
|
|
@ -22,11 +22,11 @@ public:
|
|||
CPPTypeDeclaration(CPPType *type);
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPTypeDeclaration *as_type_declaration();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CPPType;
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTypeParser
|
||||
// Class : CPPTypeParser
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPTypeParser : public CPPPreprocessor {
|
||||
|
|
|
|||
|
|
@ -170,14 +170,14 @@ is_incomplete() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void CPPTypeProxy::
|
||||
output_instance(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
bool complete, const string &prename,
|
||||
const string &name) const {
|
||||
if (_actual_type == (CPPType *)NULL) {
|
||||
out << "unknown " << prename << name;
|
||||
return;
|
||||
}
|
||||
_actual_type->output_instance(out, indent_level, scope, complete,
|
||||
prename, name);
|
||||
prename, name);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTypeProxy
|
||||
// Class : CPPTypeProxy
|
||||
// Description : This is a special kind of type that is a placeholder
|
||||
// for some type, currently unknown, that will be filled
|
||||
// in later. It's used when a type that references
|
||||
|
|
@ -23,7 +23,7 @@ public:
|
|||
CPPTypeProxy();
|
||||
|
||||
virtual CPPType *resolve_type(CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual bool is_tbd() const;
|
||||
|
||||
|
|
@ -38,11 +38,11 @@ public:
|
|||
virtual bool is_incomplete() const;
|
||||
|
||||
virtual void output_instance(ostream &out, int indent_level,
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
CPPScope *scope,
|
||||
bool complete, const string &prename,
|
||||
const string &name) const;
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ CPPTypedef(CPPInstance *inst, bool global) : CPPInstance(*inst)
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CPPDeclaration *CPPTypedef::
|
||||
substitute_decl(CPPDeclaration::SubstDecl &subst,
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPScope *current_scope, CPPScope *global_scope) {
|
||||
CPPDeclaration *decl =
|
||||
CPPInstance::substitute_decl(subst, current_scope, global_scope);
|
||||
assert(decl != NULL);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
#include "cppInstance.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPTypedef
|
||||
// Class : CPPTypedef
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPTypedef : public CPPInstance {
|
||||
|
|
@ -19,11 +19,11 @@ public:
|
|||
CPPTypedef(CPPInstance *instance, bool global);
|
||||
|
||||
virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
CPPScope *current_scope,
|
||||
CPPScope *global_scope);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPTypedef *as_typedef();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CPPIdentifier;
|
|||
class CPPScope;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CPPUsing
|
||||
// Class : CPPUsing
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class CPPUsing : public CPPDeclaration {
|
||||
|
|
@ -22,7 +22,7 @@ public:
|
|||
CPPUsing(CPPIdentifier *ident, bool full_namespace, const CPPFile &file);
|
||||
|
||||
virtual void output(ostream &out, int indent_level, CPPScope *scope,
|
||||
bool complete) const;
|
||||
bool complete) const;
|
||||
virtual SubType get_subtype() const;
|
||||
|
||||
virtual CPPUsing *as_using();
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ bool ConfigTable::IsComment(const ConfigString& S)
|
|||
{
|
||||
if (!S.empty()) {
|
||||
for (ConfigString::iterator i=configcmt.begin();
|
||||
i!=configcmt.end(); ++i)
|
||||
i!=configcmt.end(); ++i)
|
||||
if (S[0] == (*i))
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -74,35 +74,35 @@ void ConfigTable::ParseConfigFile(istream& is, const ConfigString& Filename)
|
|||
while (!is.eof()) {
|
||||
std::getline(is, line);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "read from " << Filename << ": '" << line
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "read from " << Filename << ": '" << line
|
||||
<< "'" << endl;
|
||||
CropString(line);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "cropped line to: '" << line << "'"
|
||||
<< endl;
|
||||
microconfig_cat->spam() << "cropped line to: '" << line << "'"
|
||||
<< endl;
|
||||
if (!IsComment(line)) {
|
||||
ConfigString protosym(PopNextWord(line));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "protosym is '" << protosym
|
||||
<< "' with value of '" << line << "'"
|
||||
<< endl;
|
||||
size_t i(protosym.find("."));
|
||||
if (i == ConfigString::npos) {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "this is an unqualified symbol"
|
||||
<< endl;
|
||||
unqualified[protosym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename));
|
||||
} else {
|
||||
ConfigString scope(protosym.substr(0, i));
|
||||
ConfigString sym(protosym.substr(i+1, ConfigString::npos));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "this is a qualified symbol."
|
||||
<< " scope '" << scope
|
||||
<< "', symbol '" << sym << "'" << endl;
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename));
|
||||
}
|
||||
ConfigString protosym(PopNextWord(line));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "protosym is '" << protosym
|
||||
<< "' with value of '" << line << "'"
|
||||
<< endl;
|
||||
size_t i(protosym.find("."));
|
||||
if (i == ConfigString::npos) {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "this is an unqualified symbol"
|
||||
<< endl;
|
||||
unqualified[protosym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename));
|
||||
} else {
|
||||
ConfigString scope(protosym.substr(0, i));
|
||||
ConfigString sym(protosym.substr(i+1, ConfigString::npos));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "this is a qualified symbol."
|
||||
<< " scope '" << scope
|
||||
<< "', symbol '" << sym << "'" << endl;
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::ConfigFile, line, Filename));
|
||||
}
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "line is detected as a comment" << endl;
|
||||
microconfig_cat->spam() << "line is detected as a comment" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ void ConfigTable::ReadConfigFile(void) {
|
|||
int i = configpath.find_first_of(" ");
|
||||
ConfigString stmp = configpath.substr(0, i);
|
||||
if (ExecutionEnvironment::has_environment_variable(stmp)) {
|
||||
S += " ";
|
||||
S += " ";
|
||||
S += ExecutionEnvironment::get_environment_variable(stmp);
|
||||
}
|
||||
configpath.erase(0, i);
|
||||
|
|
@ -143,7 +143,7 @@ void ConfigTable::ReadConfigFile(void) {
|
|||
}
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "evaluated value of configpath '"
|
||||
<< configpath << "'" << endl;
|
||||
<< configpath << "'" << endl;
|
||||
|
||||
DSearchPath config_search(configpath);
|
||||
DSearchPath::Results config_files;
|
||||
|
|
@ -151,24 +151,24 @@ void ConfigTable::ReadConfigFile(void) {
|
|||
if (!configsuffix.empty()) {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "agregate config name is: "
|
||||
<< (configname + configsuffix) << endl;
|
||||
<< (configname + configsuffix) << endl;
|
||||
config_search.find_all_files(configname + configsuffix, config_files);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "found " << config_files.get_num_files()
|
||||
<< " files" << endl;
|
||||
<< " files" << endl;
|
||||
} else {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "searching for '" << configname << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
config_search.find_all_files(configname, config_files);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "found " << config_files.get_num_files()
|
||||
<< " files" << endl;
|
||||
<< " files" << endl;
|
||||
}
|
||||
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "configpath parsed and searched"
|
||||
<< endl;
|
||||
<< endl;
|
||||
|
||||
int num_config_files = config_files.get_num_files();
|
||||
for (int i = num_config_files - 1; i >= 0; i--) {
|
||||
|
|
@ -176,19 +176,19 @@ void ConfigTable::ReadConfigFile(void) {
|
|||
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "examining file '" << config_file << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
if (config_file.is_executable()) {
|
||||
ConfigString line = config_file.to_os_specific() + " "
|
||||
+ ExecutionEnvironment::get_binary_name();
|
||||
+ ExecutionEnvironment::get_binary_name();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "file is executable, running '"
|
||||
<< line << "'" << endl;
|
||||
microconfig_cat->spam() << "file is executable, running '"
|
||||
<< line << "'" << endl;
|
||||
IPipeStream ifs(line);
|
||||
ParseConfigFile(ifs, config_file);
|
||||
} else {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "file is not executable, reading normally" << endl;
|
||||
microconfig_cat->spam()
|
||||
<< "file is not executable, reading normally" << endl;
|
||||
|
||||
#ifdef PENV_PS2
|
||||
ConfigString line = PS2_FILE_PREFIX + convert_pathname(config_file);
|
||||
|
|
@ -202,8 +202,8 @@ void ConfigTable::ReadConfigFile(void) {
|
|||
|
||||
while (sceRead(fd, line_buffer, 2048) > 0)
|
||||
{
|
||||
file_buffer += line_buffer;
|
||||
memset(line_buffer, 0, 2048);
|
||||
file_buffer += line_buffer;
|
||||
memset(line_buffer, 0, 2048);
|
||||
}
|
||||
|
||||
sceClose(fd);
|
||||
|
|
@ -221,43 +221,43 @@ void ConfigTable::ParseCommandEnv(ConfigString& S, const ConfigString& sym)
|
|||
{
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "value of '" << sym << "' is '" << S << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
while (!S.empty()) {
|
||||
ConfigString protosym(PopNextWord(S));
|
||||
bool ok = false;
|
||||
bool state = false;
|
||||
if (protosym[0] == '-')
|
||||
ok = true;
|
||||
ok = true;
|
||||
else if (protosym[0] == '+') {
|
||||
ok = true;
|
||||
state = true;
|
||||
ok = true;
|
||||
state = true;
|
||||
}
|
||||
if (ok) {
|
||||
protosym.erase(0, 1);
|
||||
CropString(protosym);
|
||||
size_t i(protosym.find("."));
|
||||
if (i == ConfigString::npos) {
|
||||
unqualified[protosym].push_back(SymEnt(SymEnt::CommandEnv,
|
||||
NextWord(S), sym, state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "unqualified symbol '" << protosym
|
||||
<< "' with value '" << NextWord(S)
|
||||
<< "'" << endl;
|
||||
} else {
|
||||
ConfigString scope(protosym.substr(0, i));
|
||||
ConfigString sym(protosym.substr(i+1, ConfigString::npos));
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::CommandEnv,
|
||||
NextWord(S), sym, state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "qualified symbol '" << sym
|
||||
<< "' in scope '" << scope
|
||||
<< "' and value '" << NextWord(S)
|
||||
<< "'" << endl;
|
||||
}
|
||||
protosym.erase(0, 1);
|
||||
CropString(protosym);
|
||||
size_t i(protosym.find("."));
|
||||
if (i == ConfigString::npos) {
|
||||
unqualified[protosym].push_back(SymEnt(SymEnt::CommandEnv,
|
||||
NextWord(S), sym, state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "unqualified symbol '" << protosym
|
||||
<< "' with value '" << NextWord(S)
|
||||
<< "'" << endl;
|
||||
} else {
|
||||
ConfigString scope(protosym.substr(0, i));
|
||||
ConfigString sym(protosym.substr(i+1, ConfigString::npos));
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::CommandEnv,
|
||||
NextWord(S), sym, state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "qualified symbol '" << sym
|
||||
<< "' in scope '" << scope
|
||||
<< "' and value '" << NextWord(S)
|
||||
<< "'" << endl;
|
||||
}
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "'" << protosym
|
||||
<< "' was not recognized as an option"
|
||||
<< endl;
|
||||
microconfig_cat->spam() << "'" << protosym
|
||||
<< "' was not recognized as an option"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -283,31 +283,31 @@ void ConfigTable::ParseArgs(void)
|
|||
size_t i(line.find("."));
|
||||
ConfigString aparam;
|
||||
if (n + 1 < num_args) {
|
||||
aparam = ExecutionEnvironment::get_arg(n + 1);
|
||||
aparam = ExecutionEnvironment::get_arg(n + 1);
|
||||
}
|
||||
|
||||
if (i == ConfigString::npos) {
|
||||
unqualified[line].push_back(SymEnt(SymEnt::Commandline,
|
||||
aparam, "", state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "unqualified symbol '" << line
|
||||
<< "' with value '" << aparam
|
||||
<< "'" << endl;
|
||||
unqualified[line].push_back(SymEnt(SymEnt::Commandline,
|
||||
aparam, "", state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "unqualified symbol '" << line
|
||||
<< "' with value '" << aparam
|
||||
<< "'" << endl;
|
||||
} else {
|
||||
ConfigString scope(line.substr(0, i));
|
||||
ConfigString sym(line.substr(i+1, ConfigString::npos));
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::Commandline,
|
||||
aparam, "", state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "qualified symbol '" << sym
|
||||
<< "' with scope '" << scope
|
||||
<< "' and value '" << aparam
|
||||
<< "'" << endl;
|
||||
ConfigString scope(line.substr(0, i));
|
||||
ConfigString sym(line.substr(i+1, ConfigString::npos));
|
||||
(qualified[scope])[sym].push_back(SymEnt(SymEnt::Commandline,
|
||||
aparam, "", state));
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "qualified symbol '" << sym
|
||||
<< "' with scope '" << scope
|
||||
<< "' and value '" << aparam
|
||||
<< "'" << endl;
|
||||
}
|
||||
} else if (microconfig_cat->is_spam()) {
|
||||
microconfig_cat->spam() << "argument #" << n << " ('" << line
|
||||
<< "') is not recognized as an option"
|
||||
<< endl;
|
||||
<< "') is not recognized as an option"
|
||||
<< endl;
|
||||
}
|
||||
++n;
|
||||
}
|
||||
|
|
@ -349,149 +349,149 @@ void ConfigTable::MicroConfig(void)
|
|||
if (!cc.empty()) {
|
||||
ConfigString configconfig(cc);
|
||||
if (configconfig.length() > 1) {
|
||||
ConfigString assign = "=";
|
||||
ConfigString sep = configconfig.substr(0, 1);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "separator character is: '" << sep
|
||||
<< "'" << endl;
|
||||
typedef std::vector<ConfigString> strvec;
|
||||
typedef Serialize::Deserializer<strvec, Serialize::StdExt<ConfigString> > deser;
|
||||
configconfig.erase(0, 1);
|
||||
deser ds(configconfig, sep);
|
||||
strvec sv = ds;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "extracted vector of microconfig options" << endl;
|
||||
for (strvec::iterator i=sv.begin(); i!=sv.end(); ++i) {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "parsing microconfig option '"
|
||||
<< *i << "'" << endl;
|
||||
if ((*i).length() == 1) {
|
||||
// new assignment character
|
||||
assign += *i;
|
||||
continue;
|
||||
}
|
||||
size_t j = (*i).find_first_of(assign);
|
||||
if (j != ConfigString::npos) {
|
||||
ConfigString tok = (*i).substr(0, j);
|
||||
ConfigString rest = (*i).substr(j+1, ConfigString::npos);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "split microconfig option into '"
|
||||
<< tok << "' and '" << rest << "'"
|
||||
<< endl;
|
||||
if (tok == "pathsep") {
|
||||
pathsep = rest;
|
||||
psep = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig pathsep directive, "
|
||||
<< "setting the path separator to '" << pathsep << "'"
|
||||
<< endl;
|
||||
} else if (tok == "filesep") {
|
||||
filesep = rest;
|
||||
fsep = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig filesep directive, "
|
||||
<< "setting the file separator to '" << filesep << "'"
|
||||
<< endl;
|
||||
} else if (tok == "configname") {
|
||||
configname = rest;
|
||||
cname = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configname directive, "
|
||||
<< "setting the configfile name to '" << configname
|
||||
<< "'" << endl;
|
||||
} else if (tok == "configsuffix") {
|
||||
configsuffix = rest;
|
||||
csuff = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configsuffix directive, "
|
||||
<< "setting the config file suffix to '"
|
||||
<< configsuffix << "'"
|
||||
<< endl;
|
||||
} else if (tok == "configpath") {
|
||||
if (cpath) {
|
||||
configpath += " " + rest;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configpath directive, "
|
||||
<< "adding '" << rest << "' to the configpath"
|
||||
<< endl;
|
||||
} else {
|
||||
configpath = rest;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configpath directive, "
|
||||
<< "setting the configpath to '" << configpath << "'"
|
||||
<< endl;
|
||||
}
|
||||
cpath = true;
|
||||
} else if (tok == "configcmt") {
|
||||
configcmt = rest;
|
||||
ccmt = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configcmt directive, "
|
||||
<< "setting the config comment to '" << configcmt
|
||||
<< "'" << endl;
|
||||
} else if (tok == "argsuffix") {
|
||||
argsuffix = rest;
|
||||
asuff = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig argsuffix directive, "
|
||||
<< "setting the argument environment suffix to '"
|
||||
<< argsuffix << "'" << endl;
|
||||
} else if (tok == "commandstub") {
|
||||
commandstub = rest;
|
||||
cstub = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig commandstub directive, "
|
||||
<< "setting the command environment stub "
|
||||
<< "to '" << commandstub << "'" << endl;
|
||||
} else if (tok == "configdbg") {
|
||||
configdbg = TrueOrFalse(rest);
|
||||
cdbg = true;
|
||||
if (configdbg) {
|
||||
microconfig_cat->set_severity(NS_spam);
|
||||
dconfig_cat->set_severity(NS_spam);
|
||||
} else {
|
||||
microconfig_cat->set_severity(NS_info);
|
||||
dconfig_cat->set_severity(NS_info);
|
||||
}
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configdbg directive, "
|
||||
<< "setting the config spam state to " << configdbg
|
||||
<< endl;
|
||||
} else if (tok == "readargs") {
|
||||
readargs = TrueOrFalse(rest);
|
||||
rdarg = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig readargs directive, "
|
||||
<< (readargs?"will":"will not")
|
||||
<< " read from the commandline." << endl;
|
||||
} else if (tok == "readenv") {
|
||||
readenvs = TrueOrFalse(rest);
|
||||
rdenv = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig readenv directive, "
|
||||
<< (readargs?"will":"will not")
|
||||
<< " read the environment." << endl;
|
||||
}
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "no '=' in microconfig option, ignoring it" << endl;
|
||||
}
|
||||
ConfigString assign = "=";
|
||||
ConfigString sep = configconfig.substr(0, 1);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "separator character is: '" << sep
|
||||
<< "'" << endl;
|
||||
typedef std::vector<ConfigString> strvec;
|
||||
typedef Serialize::Deserializer<strvec, Serialize::StdExt<ConfigString> > deser;
|
||||
configconfig.erase(0, 1);
|
||||
deser ds(configconfig, sep);
|
||||
strvec sv = ds;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "extracted vector of microconfig options" << endl;
|
||||
for (strvec::iterator i=sv.begin(); i!=sv.end(); ++i) {
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "parsing microconfig option '"
|
||||
<< *i << "'" << endl;
|
||||
if ((*i).length() == 1) {
|
||||
// new assignment character
|
||||
assign += *i;
|
||||
continue;
|
||||
}
|
||||
size_t j = (*i).find_first_of(assign);
|
||||
if (j != ConfigString::npos) {
|
||||
ConfigString tok = (*i).substr(0, j);
|
||||
ConfigString rest = (*i).substr(j+1, ConfigString::npos);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "split microconfig option into '"
|
||||
<< tok << "' and '" << rest << "'"
|
||||
<< endl;
|
||||
if (tok == "pathsep") {
|
||||
pathsep = rest;
|
||||
psep = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig pathsep directive, "
|
||||
<< "setting the path separator to '" << pathsep << "'"
|
||||
<< endl;
|
||||
} else if (tok == "filesep") {
|
||||
filesep = rest;
|
||||
fsep = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig filesep directive, "
|
||||
<< "setting the file separator to '" << filesep << "'"
|
||||
<< endl;
|
||||
} else if (tok == "configname") {
|
||||
configname = rest;
|
||||
cname = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configname directive, "
|
||||
<< "setting the configfile name to '" << configname
|
||||
<< "'" << endl;
|
||||
} else if (tok == "configsuffix") {
|
||||
configsuffix = rest;
|
||||
csuff = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configsuffix directive, "
|
||||
<< "setting the config file suffix to '"
|
||||
<< configsuffix << "'"
|
||||
<< endl;
|
||||
} else if (tok == "configpath") {
|
||||
if (cpath) {
|
||||
configpath += " " + rest;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configpath directive, "
|
||||
<< "adding '" << rest << "' to the configpath"
|
||||
<< endl;
|
||||
} else {
|
||||
configpath = rest;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configpath directive, "
|
||||
<< "setting the configpath to '" << configpath << "'"
|
||||
<< endl;
|
||||
}
|
||||
cpath = true;
|
||||
} else if (tok == "configcmt") {
|
||||
configcmt = rest;
|
||||
ccmt = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configcmt directive, "
|
||||
<< "setting the config comment to '" << configcmt
|
||||
<< "'" << endl;
|
||||
} else if (tok == "argsuffix") {
|
||||
argsuffix = rest;
|
||||
asuff = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig argsuffix directive, "
|
||||
<< "setting the argument environment suffix to '"
|
||||
<< argsuffix << "'" << endl;
|
||||
} else if (tok == "commandstub") {
|
||||
commandstub = rest;
|
||||
cstub = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig commandstub directive, "
|
||||
<< "setting the command environment stub "
|
||||
<< "to '" << commandstub << "'" << endl;
|
||||
} else if (tok == "configdbg") {
|
||||
configdbg = TrueOrFalse(rest);
|
||||
cdbg = true;
|
||||
if (configdbg) {
|
||||
microconfig_cat->set_severity(NS_spam);
|
||||
dconfig_cat->set_severity(NS_spam);
|
||||
} else {
|
||||
microconfig_cat->set_severity(NS_info);
|
||||
dconfig_cat->set_severity(NS_info);
|
||||
}
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig configdbg directive, "
|
||||
<< "setting the config spam state to " << configdbg
|
||||
<< endl;
|
||||
} else if (tok == "readargs") {
|
||||
readargs = TrueOrFalse(rest);
|
||||
rdarg = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig readargs directive, "
|
||||
<< (readargs?"will":"will not")
|
||||
<< " read from the commandline." << endl;
|
||||
} else if (tok == "readenv") {
|
||||
readenvs = TrueOrFalse(rest);
|
||||
rdenv = true;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "got a microconfig readenv directive, "
|
||||
<< (readargs?"will":"will not")
|
||||
<< " read the environment." << endl;
|
||||
}
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "no '=' in microconfig option, ignoring it" << endl;
|
||||
}
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam()
|
||||
<< "CONFIG_CONFIG contains only a single character" << endl;
|
||||
microconfig_cat->spam()
|
||||
<< "CONFIG_CONFIG contains only a single character" << endl;
|
||||
} else if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "CONFIG_CONFIG is empty" << endl;
|
||||
if (!cdbg)
|
||||
|
|
@ -499,72 +499,72 @@ void ConfigTable::MicroConfig(void)
|
|||
if (!psep) {
|
||||
PathSepDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for pathsep, "
|
||||
<< "setting to default '" << pathsep << "'"
|
||||
<< endl;
|
||||
microconfig_cat->spam() << "no microconfig for pathsep, "
|
||||
<< "setting to default '" << pathsep << "'"
|
||||
<< endl;
|
||||
}
|
||||
if (!fsep) {
|
||||
FileSepDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for filesep, "
|
||||
<< "setting to default '" << filesep << "'"
|
||||
<< endl;
|
||||
microconfig_cat->spam() << "no microconfig for filesep, "
|
||||
<< "setting to default '" << filesep << "'"
|
||||
<< endl;
|
||||
}
|
||||
if (!cname) {
|
||||
ConfigNameDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for configname, "
|
||||
<< "setting to default '" << configname
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for configname, "
|
||||
<< "setting to default '" << configname
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!csuff) {
|
||||
ConfigSuffixDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for configsuffix, "
|
||||
<< "setting to default '" << configsuffix
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for configsuffix, "
|
||||
<< "setting to default '" << configsuffix
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!cpath) {
|
||||
ConfigPathDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for configpath, "
|
||||
<< "setting to default '" << configpath
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for configpath, "
|
||||
<< "setting to default '" << configpath
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!ccmt) {
|
||||
ConfigCmtDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for configcmt, "
|
||||
<< "setting to default '" << configcmt
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for configcmt, "
|
||||
<< "setting to default '" << configcmt
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!asuff) {
|
||||
ArgSuffixDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for argsuffix, "
|
||||
<< "setting to default '" << argsuffix
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for argsuffix, "
|
||||
<< "setting to default '" << argsuffix
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!cstub) {
|
||||
CommandStubDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for commandstub, "
|
||||
<< "setting to default '" << commandstub
|
||||
<< "'" << endl;
|
||||
microconfig_cat->spam() << "no microconfig for commandstub, "
|
||||
<< "setting to default '" << commandstub
|
||||
<< "'" << endl;
|
||||
}
|
||||
if (!rdarg) {
|
||||
ReadArgsDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for readargs, "
|
||||
<< "setting to default: "
|
||||
<< (readargs?"true":"false") << endl;
|
||||
microconfig_cat->spam() << "no microconfig for readargs, "
|
||||
<< "setting to default: "
|
||||
<< (readargs?"true":"false") << endl;
|
||||
}
|
||||
if (!rdenv) {
|
||||
ReadEnvsDefault();
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "no microconfig for readenv, "
|
||||
<< "setting to default: "
|
||||
<< (readargs?"true":"false") << endl;
|
||||
microconfig_cat->spam() << "no microconfig for readenv, "
|
||||
<< "setting to default: "
|
||||
<< (readargs?"true":"false") << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -576,7 +576,7 @@ void ConfigTable::GetData(void) {
|
|||
ConfigString comarg = commandstub + argsuffix;
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "comarg is '" << comarg << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
if (ExecutionEnvironment::has_environment_variable(comarg)) {
|
||||
ConfigString env = ExecutionEnvironment::get_environment_variable(comarg);
|
||||
ParseCommandEnv(env, comarg);
|
||||
|
|
@ -585,7 +585,7 @@ void ConfigTable::GetData(void) {
|
|||
UpCase(line);
|
||||
if (microconfig_cat->is_spam())
|
||||
microconfig_cat->spam() << "binarg is '" << line << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
if (ExecutionEnvironment::has_environment_variable(line)) {
|
||||
ConfigString env = ExecutionEnvironment::get_environment_variable(line);
|
||||
ParseCommandEnv(env, line);
|
||||
|
|
@ -632,13 +632,13 @@ bool ConfigTable::TrueOrFalse(const ConfigString& in, bool def) {
|
|||
}
|
||||
|
||||
bool ConfigTable::Defined(const ConfigString& sym,
|
||||
const ConfigString qual) {
|
||||
const ConfigString qual) {
|
||||
#ifdef DISABLE_CONFIG
|
||||
return false;
|
||||
#else
|
||||
if (qual.empty()) {
|
||||
return (unqualified.count(sym) != 0 ||
|
||||
ExecutionEnvironment::has_environment_variable(sym));
|
||||
ExecutionEnvironment::has_environment_variable(sym));
|
||||
|
||||
} else {
|
||||
TableMap::const_iterator ti;
|
||||
|
|
@ -646,7 +646,7 @@ bool ConfigTable::Defined(const ConfigString& sym,
|
|||
if (ti != qualified.end()) {
|
||||
const SymbolTable &table = (*ti).second;
|
||||
if (table.count(sym) != 0) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -656,7 +656,7 @@ bool ConfigTable::Defined(const ConfigString& sym,
|
|||
}
|
||||
|
||||
ConfigTable::SymEnt ConfigTable::Get(const ConfigString& sym,
|
||||
const ConfigString qual) {
|
||||
const ConfigString qual) {
|
||||
#ifndef DISABLE_CONFIG
|
||||
const ConfigTable::Symbol &symbol = GetSym(sym, qual);
|
||||
if (!symbol.empty()) {
|
||||
|
|
@ -680,7 +680,7 @@ ConfigTable::SymEnt ConfigTable::Get(const ConfigString& sym,
|
|||
}
|
||||
|
||||
const ConfigTable::Symbol& ConfigTable::GetSym(const ConfigString& sym,
|
||||
const ConfigString qual) {
|
||||
const ConfigString qual) {
|
||||
static ConfigTable::Symbol empty_symbol;
|
||||
|
||||
#ifndef DISABLE_CONFIG
|
||||
|
|
@ -700,7 +700,7 @@ const ConfigTable::Symbol& ConfigTable::GetSym(const ConfigString& sym,
|
|||
SymbolTable::const_iterator si;
|
||||
si = table.find(sym);
|
||||
if (si != table.end()) {
|
||||
return (*si).second;
|
||||
return (*si).second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class EXPCL_DTOOLCONFIG ConfigTable {
|
|||
bool Defined(const ConfigString& sym, const ConfigString qual="");
|
||||
SymEnt Get(const ConfigString& sym, const ConfigString qual = "");
|
||||
const Symbol& GetSym(const ConfigString& sym,
|
||||
const ConfigString qual = "");
|
||||
const ConfigString qual = "");
|
||||
INLINE ConfigString GetConfigPath(void) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ class Config {
|
|||
static bool Defined(const ConfigString& sym);
|
||||
static ConfigString Get(const ConfigString sym);
|
||||
static ConfigTable::Symbol& GetAll(const ConfigString,
|
||||
ConfigTable::Symbol&);
|
||||
ConfigTable::Symbol&);
|
||||
PUBLISHED:
|
||||
static bool GetBool(const ConfigString sym, bool def = false);
|
||||
static int GetInt(const ConfigString sym, int def = 0);
|
||||
static float GetFloat(const ConfigString sym, float def = 0.);
|
||||
static double GetDouble(const ConfigString sym, double def = 0.);
|
||||
static ConfigString GetString(const ConfigString sym,
|
||||
const ConfigString def = "");
|
||||
const ConfigString def = "");
|
||||
};
|
||||
|
||||
// Implementation follows
|
||||
|
|
@ -121,11 +121,11 @@ void Config<GetConfig>::Init(void)
|
|||
ConfigString s = Get("notify-level-config");
|
||||
NotifySeverity sev = Notify::string_severity(s);
|
||||
if (sev != NS_unspecified) {
|
||||
microconfig_cat->set_severity(sev);
|
||||
dconfig_cat->set_severity(sev);
|
||||
microconfig_cat->set_severity(sev);
|
||||
dconfig_cat->set_severity(sev);
|
||||
} else {
|
||||
microconfig_cat->set_severity(NS_info);
|
||||
dconfig_cat->set_severity(NS_info);
|
||||
microconfig_cat->set_severity(NS_info);
|
||||
dconfig_cat->set_severity(NS_info);
|
||||
}
|
||||
} else {
|
||||
microconfig_cat->set_severity(NS_info);
|
||||
|
|
@ -137,11 +137,11 @@ void Config<GetConfig>::Init(void)
|
|||
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "calling ConfigFunc for '" << Name() << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
ConfigFunc();
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "back from ConfigFunc for '" << Name() << "'"
|
||||
<< endl;
|
||||
<< endl;
|
||||
total_time_external_init += clock();
|
||||
}
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ ConfigString Config<GetConfig>::Get(ConfigString sym)
|
|||
|
||||
template<class GetConfig>
|
||||
ConfigTable::Symbol& Config<GetConfig>::GetAll(const ConfigString sym,
|
||||
ConfigTable::Symbol& s)
|
||||
ConfigTable::Symbol& s)
|
||||
{
|
||||
Init();
|
||||
ConfigTable* tab = ConfigTable::Instance();
|
||||
|
|
@ -214,15 +214,15 @@ bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
|
|||
ConfigString s = Get(sym);
|
||||
bool ret = ConfigTable::TrueOrFalse(s, def);
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< (ret?"true":"false") << endl;
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< (ret?"true":"false") << endl;
|
||||
return ret;
|
||||
} else {
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: "
|
||||
<< (def?"true":"false") << endl;
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: "
|
||||
<< (def?"true":"false") << endl;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
@ -237,14 +237,14 @@ int Config<GetConfig>::GetInt(const ConfigString sym, int def)
|
|||
int i;
|
||||
s >> i;
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< i << endl;
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< i << endl;
|
||||
return i;
|
||||
} else {
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
@ -259,14 +259,14 @@ float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
|
|||
float f;
|
||||
s >> f;
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< f << endl;
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< f << endl;
|
||||
return f;
|
||||
} else {
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
@ -281,35 +281,35 @@ double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
|
|||
double d;
|
||||
s >> d;
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< d << endl;
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: "
|
||||
<< d << endl;
|
||||
return d;
|
||||
} else {
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: " << def << endl;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
template<class GetConfig>
|
||||
ConfigString Config<GetConfig>::GetString(const ConfigString sym,
|
||||
const ConfigString def)
|
||||
const ConfigString def)
|
||||
{
|
||||
Init();
|
||||
if (Defined(sym)) {
|
||||
ConfigString ret = Get(sym);
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: '"
|
||||
<< ret << "'" << endl;
|
||||
dconfig_cat->spam() << "symbol '" << sym << "' defined, returning: '"
|
||||
<< ret << "'" << endl;
|
||||
return ret;
|
||||
} else {
|
||||
if (dconfig_cat->is_spam())
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: '" << def
|
||||
<< "'" << endl;
|
||||
dconfig_cat->spam()
|
||||
<< "symbol '" << sym
|
||||
<< "' is not defined, returning provided default: '" << def
|
||||
<< "'" << endl;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ ptr() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool Notify::
|
||||
assert_failure(const char *expression, int line,
|
||||
const char *source_file) {
|
||||
const char *source_file) {
|
||||
ostringstream message_str;
|
||||
message_str
|
||||
<< expression << " at line " << line << " of " << source_file;
|
||||
|
|
@ -471,23 +471,23 @@ config_initialized() {
|
|||
string notify_output = config_notify.GetString("notify-output", "");
|
||||
if (!notify_output.empty()) {
|
||||
if (notify_output == "stdout") {
|
||||
cout.setf(ios::unitbuf);
|
||||
set_ostream_ptr(&cout, false);
|
||||
cout.setf(ios::unitbuf);
|
||||
set_ostream_ptr(&cout, false);
|
||||
|
||||
} else if (notify_output == "stderr") {
|
||||
set_ostream_ptr(&cerr, false);
|
||||
set_ostream_ptr(&cerr, false);
|
||||
|
||||
} else {
|
||||
Filename filename = notify_output;
|
||||
filename.set_text();
|
||||
ofstream *out = new ofstream;
|
||||
if (!filename.open_write(*out)) {
|
||||
nout << "Unable to open file " << filename << " for output.\n";
|
||||
delete out;
|
||||
} else {
|
||||
out->setf(ios::unitbuf);
|
||||
set_ostream_ptr(out, true);
|
||||
}
|
||||
Filename filename = notify_output;
|
||||
filename.set_text();
|
||||
ofstream *out = new ofstream;
|
||||
if (!filename.open_write(*out)) {
|
||||
nout << "Unable to open file " << filename << " for output.\n";
|
||||
delete out;
|
||||
} else {
|
||||
out->setf(ios::unitbuf);
|
||||
set_ostream_ptr(out, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include <map>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : Notify
|
||||
// Class : Notify
|
||||
// Description : An object that handles general error reporting to the
|
||||
// user. It contains a pointer to an ostream, initially
|
||||
// cerr, which can be reset at will to point to
|
||||
|
|
@ -38,7 +38,7 @@ PUBLISHED:
|
|||
ostream *get_ostream_ptr() const;
|
||||
|
||||
typedef bool AssertHandler(const char *expression, int line,
|
||||
const char *source_file);
|
||||
const char *source_file);
|
||||
|
||||
void set_assert_handler(AssertHandler *assert_handler);
|
||||
void clear_assert_handler();
|
||||
|
|
@ -51,9 +51,9 @@ PUBLISHED:
|
|||
|
||||
NotifyCategory *get_top_category();
|
||||
NotifyCategory *get_category(const string &basename,
|
||||
NotifyCategory *parent_category);
|
||||
NotifyCategory *parent_category);
|
||||
NotifyCategory *get_category(const string &basename,
|
||||
const string &parent_fullname);
|
||||
const string &parent_fullname);
|
||||
NotifyCategory *get_category(const string &fullname);
|
||||
|
||||
static ostream &out();
|
||||
|
|
@ -65,7 +65,7 @@ public:
|
|||
static long get_literal_flag();
|
||||
|
||||
bool assert_failure(const char *expression, int line,
|
||||
const char *source_file);
|
||||
const char *source_file);
|
||||
|
||||
static NotifySeverity string_severity(const string &string);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
NotifyCategory::
|
||||
NotifyCategory(const string &fullname, const string &basename,
|
||||
NotifyCategory *parent) :
|
||||
NotifyCategory *parent) :
|
||||
_fullname(fullname),
|
||||
_basename(basename),
|
||||
_parent(parent)
|
||||
|
|
@ -49,8 +49,8 @@ NotifyCategory(const string &fullname, const string &basename,
|
|||
_severity = Notify::string_severity(severity_name);
|
||||
|
||||
if (_severity == NS_unspecified) {
|
||||
nout << "Invalid severity name for " << config_name << ": "
|
||||
<< severity_name << "\n";
|
||||
nout << "Invalid severity name for " << config_name << ": "
|
||||
<< severity_name << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -86,19 +86,19 @@ out(NotifySeverity severity, bool prefix) const {
|
|||
if (is_on(severity)) {
|
||||
if (prefix) {
|
||||
if (get_notify_timestamp()) {
|
||||
// Format a timestamp to include as a prefix as well.
|
||||
time_t now = time(NULL);
|
||||
struct tm *ptm = localtime(&now);
|
||||
|
||||
char buffer[128];
|
||||
strftime(buffer, 128, ":%m-%d-%Y %H:%M:%S ", ptm);
|
||||
nout << buffer;
|
||||
// Format a timestamp to include as a prefix as well.
|
||||
time_t now = time(NULL);
|
||||
struct tm *ptm = localtime(&now);
|
||||
|
||||
char buffer[128];
|
||||
strftime(buffer, 128, ":%m-%d-%Y %H:%M:%S ", ptm);
|
||||
nout << buffer;
|
||||
}
|
||||
|
||||
if (severity == NS_info) {
|
||||
return nout << *this << ": ";
|
||||
return nout << *this << ": ";
|
||||
} else {
|
||||
return nout << *this << "(" << severity << "): ";
|
||||
return nout << *this << "(" << severity << "): ";
|
||||
}
|
||||
} else {
|
||||
return nout;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <vector>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : NotifyCategory
|
||||
// Class : NotifyCategory
|
||||
// Description : A particular category of error messages. Typically
|
||||
// there will be one of these per package, so that we
|
||||
// can turn on or off error messages at least at a
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
class EXPCL_DTOOLCONFIG NotifyCategory {
|
||||
private:
|
||||
NotifyCategory(const string &fullname, const string &basename,
|
||||
NotifyCategory *parent);
|
||||
NotifyCategory *parent);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE string get_fullname() const;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "notify.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : NotifyCategoryProxy
|
||||
// Class : NotifyCategoryProxy
|
||||
// Description : A handy wrapper around a NotifyCategory pointer.
|
||||
// This wrapper pretends to be a NotifyCategory object
|
||||
// itself, except that it is capable of initializing its
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ template <class X>
|
|||
class StdIns {
|
||||
public:
|
||||
INLINE ConfigString operator()(const X& val) {
|
||||
ostringstream oss;
|
||||
oss << val;
|
||||
return oss.str();
|
||||
ostringstream oss;
|
||||
oss << val;
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -26,10 +26,10 @@ template <class X>
|
|||
class StdExt {
|
||||
public:
|
||||
INLINE X operator()(ConfigString S) {
|
||||
istringstream iss(S);
|
||||
X ret;
|
||||
iss >> ret;
|
||||
return ret;
|
||||
istringstream iss(S);
|
||||
X ret;
|
||||
iss >> ret;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -47,15 +47,15 @@ class Serializer {
|
|||
Serializer() {}
|
||||
public:
|
||||
Serializer(const Collection& C, ConfigString Delim = ":") :
|
||||
_result(Serializer::SerializeToString(C, Delim)) {}
|
||||
_result(Serializer::SerializeToString(C, Delim)) {}
|
||||
Serializer(const Serializer<Collection, Inserter>& c) :
|
||||
_result(c._result) {}
|
||||
~Serializer() {}
|
||||
INLINE ConfigString operator()() { return _result; }
|
||||
INLINE ConfigString operator()(const Collection& C,
|
||||
const ConfigString& Delim = ":") {
|
||||
_result = SerializeToString(C, Delim);
|
||||
return _result;
|
||||
const ConfigString& Delim = ":") {
|
||||
_result = SerializeToString(C, Delim);
|
||||
return _result;
|
||||
}
|
||||
INLINE operator ConfigString() { return _result; }
|
||||
};
|
||||
|
|
@ -63,14 +63,14 @@ class Serializer {
|
|||
template <class Collection, class Inserter>
|
||||
ConfigString
|
||||
Serializer<Collection, Inserter>::SerializeToString(const Collection& C,
|
||||
const ConfigString& Delim)
|
||||
const ConfigString& Delim)
|
||||
{
|
||||
ConfigString ret;
|
||||
Inserter in;
|
||||
|
||||
for (TYPENAME Collection::const_iterator i=C.begin(); i!=C.end(); ++i) {
|
||||
if (i != C.begin())
|
||||
ret += Delim;
|
||||
ret += Delim;
|
||||
ret += in(*i);
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -84,86 +84,86 @@ class Deserializer {
|
|||
INLINE void Clear() { _result.erase(_result.begin(), _result.end()); }
|
||||
template <class ForwardIterator>
|
||||
int FindFirstOfInString(ConfigString S, ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
int i = ConfigString::npos;
|
||||
ForwardIterator j = DelimBegin;
|
||||
ForwardIterator DelimEnd) {
|
||||
int i = ConfigString::npos;
|
||||
ForwardIterator j = DelimBegin;
|
||||
|
||||
while (j != DelimEnd) {
|
||||
int k = S.find(*j);
|
||||
if (k != ConfigString::npos)
|
||||
if ((i == ConfigString::npos) || (i > k))
|
||||
i = k;
|
||||
++j;
|
||||
}
|
||||
return i;
|
||||
while (j != DelimEnd) {
|
||||
int k = S.find(*j);
|
||||
if (k != ConfigString::npos)
|
||||
if ((i == ConfigString::npos) || (i > k))
|
||||
i = k;
|
||||
++j;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
template <class ForwardIterator>
|
||||
int FindFirstNotOfInString(ConfigString S, ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
int i = ConfigString::npos;
|
||||
ForwardIterator j = DelimBegin;
|
||||
ForwardIterator k = DelimBegin;
|
||||
ForwardIterator DelimEnd) {
|
||||
int i = ConfigString::npos;
|
||||
ForwardIterator j = DelimBegin;
|
||||
ForwardIterator k = DelimBegin;
|
||||
|
||||
while (j != DelimEnd) {
|
||||
int l = S.find(*j);
|
||||
if (l != ConfigString::npos)
|
||||
if ((i == ConfigString::npos) || (i > l)) {
|
||||
i = l;
|
||||
k = j;
|
||||
}
|
||||
++j;
|
||||
}
|
||||
if (i != ConfigString::npos) {
|
||||
i += Serialize::Length(*k);
|
||||
if (i >= S.length())
|
||||
i = ConfigString::npos;
|
||||
}
|
||||
return i;
|
||||
while (j != DelimEnd) {
|
||||
int l = S.find(*j);
|
||||
if (l != ConfigString::npos)
|
||||
if ((i == ConfigString::npos) || (i > l)) {
|
||||
i = l;
|
||||
k = j;
|
||||
}
|
||||
++j;
|
||||
}
|
||||
if (i != ConfigString::npos) {
|
||||
i += Serialize::Length(*k);
|
||||
if (i >= S.length())
|
||||
i = ConfigString::npos;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
template <class ForwardIterator>
|
||||
void DeserializeFromString(ConfigString S, ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
Clear();
|
||||
Extractor ex;
|
||||
ForwardIterator DelimEnd) {
|
||||
Clear();
|
||||
Extractor ex;
|
||||
|
||||
while (!S.empty()) {
|
||||
int i = FindFirstOfInString(S, DelimBegin, DelimEnd);
|
||||
_result.push_back(ex(S.substr(0, i)));
|
||||
S.erase(0, i);
|
||||
i = FindFirstNotOfInString(S, DelimBegin, DelimEnd);
|
||||
S.erase(0, i);
|
||||
}
|
||||
while (!S.empty()) {
|
||||
int i = FindFirstOfInString(S, DelimBegin, DelimEnd);
|
||||
_result.push_back(ex(S.substr(0, i)));
|
||||
S.erase(0, i);
|
||||
i = FindFirstNotOfInString(S, DelimBegin, DelimEnd);
|
||||
S.erase(0, i);
|
||||
}
|
||||
}
|
||||
void DeserializeFromString(ConfigString S, ConfigString Delim) {
|
||||
Clear();
|
||||
Extractor ex;
|
||||
Clear();
|
||||
Extractor ex;
|
||||
|
||||
while (!S.empty()) {
|
||||
size_t i = S.find_first_of(Delim);
|
||||
_result.push_back(ex(S.substr(0, i)));
|
||||
if (i == ConfigString::npos)
|
||||
S.erase(0, i);
|
||||
else
|
||||
S.erase(0, i+1);
|
||||
}
|
||||
while (!S.empty()) {
|
||||
size_t i = S.find_first_of(Delim);
|
||||
_result.push_back(ex(S.substr(0, i)));
|
||||
if (i == ConfigString::npos)
|
||||
S.erase(0, i);
|
||||
else
|
||||
S.erase(0, i+1);
|
||||
}
|
||||
}
|
||||
Deserializer() {}
|
||||
public:
|
||||
Deserializer(ConfigString S, ConfigString Delim = ":") {
|
||||
Deserializer::DeserializeFromString(S, Delim);
|
||||
Deserializer::DeserializeFromString(S, Delim);
|
||||
}
|
||||
template <class ForwardIterator>
|
||||
Deserializer(ConfigString S, ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
|
||||
ForwardIterator DelimEnd) {
|
||||
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
|
||||
}
|
||||
~Deserializer() {}
|
||||
INLINE const Collection& operator()() { return _result; }
|
||||
template <class ForwardIterator>
|
||||
INLINE const Collection& operator()(ConfigString S,
|
||||
ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
|
||||
ForwardIterator DelimBegin,
|
||||
ForwardIterator DelimEnd) {
|
||||
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
|
||||
}
|
||||
INLINE operator const Collection&() { return _result; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Config {
|
|||
class EXPCL_DTOOLCONFIG SymbolEnt {
|
||||
public:
|
||||
enum SymbolEntSrc { ConfigFile, Environment, CommandEnv, Commandline,
|
||||
Other, Invalid };
|
||||
Other, Invalid };
|
||||
private:
|
||||
ConfigString _src;
|
||||
ConfigString _val;
|
||||
|
|
@ -26,8 +26,8 @@ class EXPCL_DTOOLCONFIG SymbolEnt {
|
|||
public:
|
||||
SymbolEnt() : _srctok(Invalid) {}
|
||||
SymbolEnt(enum SymbolEntSrc tok, const ConfigString& val,
|
||||
const ConfigString& src = "", bool state = false)
|
||||
: _src(src), _val(val), _state(state), _srctok(tok) {}
|
||||
const ConfigString& src = "", bool state = false)
|
||||
: _src(src), _val(val), _state(state), _srctok(tok) {}
|
||||
SymbolEnt(const SymbolEnt& c) : _src(c._src), _val(c._val),
|
||||
_state(c._state), _srctok(c._srctok) {}
|
||||
INLINE SymbolEnt& operator=(const SymbolEnt&);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void ReadIt(istream& ifs) {
|
|||
while (!ifs.eof()) {
|
||||
std::getline(ifs, line);
|
||||
if (line.length() != 0)
|
||||
cout << line << endl;
|
||||
cout << line << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void TestFromString()
|
|||
intlist ides1 = intdes1;
|
||||
for (intlist::iterator i=ides1.begin(); i!=ides1.end(); ++i) {
|
||||
if (i != ides1.begin())
|
||||
cout << ", ";
|
||||
cout << ", ";
|
||||
cout << (*i);
|
||||
}
|
||||
cout << endl;
|
||||
|
|
@ -52,7 +52,7 @@ void TestFromString()
|
|||
floatvec fdes1 = floatdes1;
|
||||
for (floatvec::iterator j=fdes1.begin(); j!=fdes1.end(); ++j) {
|
||||
if (j != fdes1.begin())
|
||||
cout << ", ";
|
||||
cout << ", ";
|
||||
cout << (*j);
|
||||
}
|
||||
cout << endl;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#define PANDA_VERSION_MAJOR 0
|
||||
#define PANDA_VERSION_MINOR 0
|
||||
#define PANDA_VERSION_BUILDSUBVERSION 0
|
||||
#define PANDA_VERSION_BUILDSUBSUBVERSION 1
|
||||
|
||||
#define PANDA_VERSION_MAJOR_STR "0"
|
||||
#define PANDA_VERSION_MINOR_STR "0"
|
||||
#define PANDA_VERSION_BUILDSUBVERSION_STR "0"
|
||||
#define PANDA_VERSION_BUILDSUBSUBVERSION_STR "1"
|
||||
|
||||
#define PANDA_VERSION_MAJOR 0
|
||||
#define PANDA_VERSION_MINOR 0
|
||||
#define PANDA_VERSION_BUILDSUBVERSION 0
|
||||
#define PANDA_VERSION_BUILDSUBSUBVERSION 1
|
||||
|
||||
#define PANDA_VERSION_MAJOR_STR "0"
|
||||
#define PANDA_VERSION_MINOR_STR "0"
|
||||
#define PANDA_VERSION_BUILDSUBVERSION_STR "0"
|
||||
#define PANDA_VERSION_BUILDSUBSUBVERSION_STR "1"
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Filename DSearchPath::
|
||||
search_path(const Filename &filename, const string &path,
|
||||
const string &delimiters) {
|
||||
const string &delimiters) {
|
||||
DSearchPath search(path, delimiters);
|
||||
return search.find_file(filename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ prepend_path(const DSearchPath &path) {
|
|||
if (!path._directories.empty()) {
|
||||
Directories new_directories = path._directories;
|
||||
copy(_directories.begin(), _directories.end(),
|
||||
back_inserter(new_directories));
|
||||
back_inserter(new_directories));
|
||||
_directories.swap(new_directories);
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ find_file(const Filename &filename) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
int DSearchPath::
|
||||
find_all_files(const Filename &filename,
|
||||
DSearchPath::Results &results) const {
|
||||
DSearchPath::Results &results) const {
|
||||
results._files.clear();
|
||||
|
||||
Directories::const_iterator di;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <vector>
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : DSearchPath
|
||||
// Class : DSearchPath
|
||||
// Description : This class stores a list of directories that can be
|
||||
// searched, in order, to locate a particular file. It
|
||||
// is normally constructed by passing it a traditional
|
||||
|
|
@ -51,7 +51,7 @@ PUBLISHED:
|
|||
void append_directory(const Filename &directory);
|
||||
void prepend_directory(const Filename &directory);
|
||||
void append_path(const string &path,
|
||||
const string &delimiters = ": \t\n");
|
||||
const string &delimiters = ": \t\n");
|
||||
void append_path(const DSearchPath &path);
|
||||
void prepend_path(const DSearchPath &path);
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ PUBLISHED:
|
|||
|
||||
INLINE static Filename
|
||||
search_path(const Filename &filename, const string &path,
|
||||
const string &delimiters = ": \t\n");
|
||||
const string &delimiters = ": \t\n");
|
||||
|
||||
void output(ostream &out, const string &separator = ":") const;
|
||||
void write(ostream &out, int indent_level = 0) const;
|
||||
|
|
|
|||
|
|
@ -82,20 +82,20 @@ expand_string(const string &str) {
|
|||
size_t end = start;
|
||||
|
||||
if (str[start] == '{') {
|
||||
// Curly braces delimit the variable name explicitly.
|
||||
end = str.find('}', start + 1);
|
||||
if (end != string::npos) {
|
||||
varname = str.substr(start + 1, end - (start + 1));
|
||||
end++;
|
||||
}
|
||||
// Curly braces delimit the variable name explicitly.
|
||||
end = str.find('}', start + 1);
|
||||
if (end != string::npos) {
|
||||
varname = str.substr(start + 1, end - (start + 1));
|
||||
end++;
|
||||
}
|
||||
}
|
||||
|
||||
if (end == start) {
|
||||
// Scan for the end of the variable name.
|
||||
while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) {
|
||||
end++;
|
||||
}
|
||||
varname = str.substr(start, end - start);
|
||||
// Scan for the end of the variable name.
|
||||
while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) {
|
||||
end++;
|
||||
}
|
||||
varname = str.substr(start, end - start);
|
||||
}
|
||||
|
||||
string subst =
|
||||
|
|
@ -274,8 +274,8 @@ read_environment_variables() {
|
|||
if (ch == '=') {
|
||||
ch = proc.get();
|
||||
while (!proc.eof() && !proc.fail() && ch != '\0') {
|
||||
value += (char)ch;
|
||||
ch = proc.get();
|
||||
value += (char)ch;
|
||||
ch = proc.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include <map>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : ExecutionEnvironment
|
||||
// Class : ExecutionEnvironment
|
||||
// Description : Encapsulates access to the environment variables and
|
||||
// command-line arguments at the time of execution.
|
||||
// This is encapsulated to support accessing these
|
||||
|
|
|
|||
|
|
@ -117,8 +117,8 @@ convert_pathname(const string &unix_style_pathname) {
|
|||
windows_pathname = front_to_back_slash(unix_style_pathname);
|
||||
|
||||
} else if (unix_style_pathname.length() > 3 &&
|
||||
isalpha(unix_style_pathname[1]) &&
|
||||
unix_style_pathname[2] == '/') {
|
||||
isalpha(unix_style_pathname[1]) &&
|
||||
unix_style_pathname[2] == '/') {
|
||||
// This is a pathname that begins with a single letter. That must
|
||||
// be the drive letter.
|
||||
windows_pathname =
|
||||
|
|
@ -242,7 +242,7 @@ from_os_specific(const string &os_specific, Filename::Type type) {
|
|||
for (p = 0; p < panda_root.length() && matches; p++) {
|
||||
char c = tolower(panda_root[p]);
|
||||
if (c == '\\') {
|
||||
c = '/';
|
||||
c = '/';
|
||||
}
|
||||
matches = (c == tolower(result[p]));
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ from_os_specific(const string &os_specific, Filename::Type type) {
|
|||
result = result.substr(panda_root.length());
|
||||
assert(!result.empty());
|
||||
if (result[0] != '/') {
|
||||
result = '/' + result;
|
||||
result = '/' + result;
|
||||
}
|
||||
Filename filename(result);
|
||||
filename.set_type(type);
|
||||
|
|
@ -500,7 +500,7 @@ standardize() {
|
|||
if (component == ".") {
|
||||
// Ignore /./.
|
||||
} else if (component == ".." && !components.empty() &&
|
||||
!(components.back() == "..")) {
|
||||
!(components.back() == "..")) {
|
||||
// Back up.
|
||||
components.pop_back();
|
||||
} else {
|
||||
|
|
@ -808,8 +808,8 @@ is_executable() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
int Filename::
|
||||
compare_timestamps(const Filename &other,
|
||||
bool this_missing_is_old,
|
||||
bool other_missing_is_old) const {
|
||||
bool this_missing_is_old,
|
||||
bool other_missing_is_old) const {
|
||||
string os_specific = to_os_specific();
|
||||
string other_os_specific = other.to_os_specific();
|
||||
|
||||
|
|
@ -883,7 +883,7 @@ compare_timestamps(const Filename &other,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool Filename::
|
||||
resolve_filename(const DSearchPath &searchpath,
|
||||
const string &default_extension) {
|
||||
const string &default_extension) {
|
||||
string found;
|
||||
|
||||
if (is_local()) {
|
||||
|
|
@ -893,9 +893,9 @@ resolve_filename(const DSearchPath &searchpath,
|
|||
// We didn't find it with the given extension; can we try the
|
||||
// default extension?
|
||||
if (get_extension().empty() && !default_extension.empty()) {
|
||||
Filename try_ext = *this;
|
||||
try_ext.set_extension(default_extension);
|
||||
found = searchpath.find_file(try_ext.get_fullpath());
|
||||
Filename try_ext = *this;
|
||||
try_ext.set_extension(default_extension);
|
||||
found = searchpath.find_file(try_ext.get_fullpath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -908,11 +908,11 @@ resolve_filename(const DSearchPath &searchpath,
|
|||
// The full pathname doesn't exist with the given extension;
|
||||
// does it exist with the default extension?
|
||||
if (get_extension().empty() && !default_extension.empty()) {
|
||||
Filename try_ext = *this;
|
||||
try_ext.set_extension(default_extension);
|
||||
if (try_ext.exists()) {
|
||||
found = try_ext;
|
||||
}
|
||||
Filename try_ext = *this;
|
||||
try_ext.set_extension(default_extension);
|
||||
if (try_ext.exists()) {
|
||||
found = try_ext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1226,8 +1226,8 @@ touch() const {
|
|||
// So the file doesn't already exist; create it.
|
||||
int fd = creat(os_specific.c_str(), 0666);
|
||||
if (fd < 0) {
|
||||
perror(os_specific.c_str());
|
||||
return false;
|
||||
perror(os_specific.c_str());
|
||||
return false;
|
||||
}
|
||||
close(fd);
|
||||
return true;
|
||||
|
|
@ -1274,17 +1274,17 @@ rename_to(const Filename &other) const {
|
|||
string os_specific = to_os_specific();
|
||||
string other_os_specific = other.to_os_specific();
|
||||
return (rename(os_specific.c_str(),
|
||||
other_os_specific.c_str()) == 0);
|
||||
other_os_specific.c_str()) == 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Filename::make_dir
|
||||
// Access: Public
|
||||
// Description: Creates all the directories in the path to the file
|
||||
// specified in the filename, except for the basename
|
||||
// itself. This assumes that the Filename contains the
|
||||
// name of a file, not a directory name; it ensures that
|
||||
// the directory containing the file exists.
|
||||
// specified in the filename, except for the basename
|
||||
// itself. This assumes that the Filename contains the
|
||||
// name of a file, not a directory name; it ensures that
|
||||
// the directory containing the file exists.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool Filename::
|
||||
make_dir() const {
|
||||
|
|
@ -1343,14 +1343,14 @@ locate_basename() {
|
|||
// we want to treat them as a single slash. The directory
|
||||
// therefore actually ends at the first of these; back up a bit.
|
||||
while (_dirname_end > 0 && _filename[_dirname_end-1] == '/') {
|
||||
_dirname_end--;
|
||||
_dirname_end--;
|
||||
}
|
||||
|
||||
// Another exception: if the dirname was nothing but slashes, it
|
||||
// was the root directory, or / itself. In this case the dirname
|
||||
// does include the terminal slash (of course).
|
||||
if (_dirname_end == 0) {
|
||||
_dirname_end = 1;
|
||||
_dirname_end = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -1424,7 +1424,7 @@ get_common_prefix(const string &other) const {
|
|||
|
||||
// First, get the length of the common initial substring.
|
||||
while (len < length() && len < other.length() &&
|
||||
_filename[len] == other[len]) {
|
||||
_filename[len] == other[len]) {
|
||||
len++;
|
||||
}
|
||||
|
||||
|
|
@ -1455,11 +1455,11 @@ count_slashes(const string &str) {
|
|||
// Skip consecutive slashes.
|
||||
++si;
|
||||
while (*si == '/') {
|
||||
++si;
|
||||
++si;
|
||||
}
|
||||
if (si == str.end()) {
|
||||
// Oops, that was a terminal slash. Don't count it.
|
||||
count--;
|
||||
// Oops, that was a terminal slash. Don't count it.
|
||||
count--;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
class DSearchPath;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : Filename
|
||||
// Class : Filename
|
||||
// Description : The name of a file, such as a texture file or an Egg
|
||||
// file. Stores the full pathname, and includes
|
||||
// functions for extracting out the directory prefix
|
||||
|
|
@ -72,9 +72,9 @@ PUBLISHED:
|
|||
INLINE static Filename executable_filename(const string &filename);
|
||||
|
||||
static Filename from_os_specific(const string &os_specific,
|
||||
Type type = T_general);
|
||||
Type type = T_general);
|
||||
static Filename temporary(const string &dirname, const string &prefix,
|
||||
Type type = T_general);
|
||||
Type type = T_general);
|
||||
|
||||
// Assignment is via the = operator.
|
||||
INLINE Filename &operator = (const string &filename);
|
||||
|
|
@ -134,10 +134,10 @@ PUBLISHED:
|
|||
bool is_directory() const;
|
||||
bool is_executable() const;
|
||||
int compare_timestamps(const Filename &other,
|
||||
bool this_missing_is_old = true,
|
||||
bool other_missing_is_old = true) const;
|
||||
bool this_missing_is_old = true,
|
||||
bool other_missing_is_old = true) const;
|
||||
bool resolve_filename(const DSearchPath &searchpath,
|
||||
const string &default_extension = string());
|
||||
const string &default_extension = string());
|
||||
bool make_relative_to(Filename directory, bool allow_backups = true);
|
||||
int find_on_searchpath(const DSearchPath &searchpath);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#define getopt_long gnu_getopt_long
|
||||
#define getopt_long_only gnu_getopt_long_only
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
|
@ -66,9 +66,9 @@ extern int optopt;
|
|||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
|
|
@ -83,7 +83,7 @@ extern int optopt;
|
|||
|
||||
struct option
|
||||
{
|
||||
#if __STDC__
|
||||
#if __STDC__
|
||||
const char *name;
|
||||
#else
|
||||
char *name;
|
||||
|
|
@ -97,28 +97,28 @@ struct option
|
|||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
extern EXPCL_DTOOL int
|
||||
getopt (int argc, char *const *argv, const char *shortopts);
|
||||
extern EXPCL_DTOOL int
|
||||
getopt_long (int argc, char *const *argv, const char *shortopts,
|
||||
const struct option *long_options, int *opt_index);
|
||||
const struct option *long_options, int *opt_index);
|
||||
extern EXPCL_DTOOL int
|
||||
getopt_long_only (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *long_options,
|
||||
int *opt_index);
|
||||
const char *shortopts,
|
||||
const struct option *long_options,
|
||||
int *opt_index);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue