workaround for windows crash

This commit is contained in:
David Rose 2001-10-02 22:56:56 +00:00
parent 238ad16150
commit 3fccb0f373
3 changed files with 22 additions and 21 deletions

View File

@ -1575,28 +1575,28 @@ get_function(CPPInstance *function, string description,
InterrogateDatabase::get_ptr()->get_next_index(); InterrogateDatabase::get_ptr()->get_next_index();
_functions_by_name[function_name] = index; _functions_by_name[function_name] = index;
InterrogateFunction ifunction; InterrogateFunction *ifunction = new InterrogateFunction;
ifunction._name = function->get_local_name(scope); ifunction->_name = function->get_local_name(scope);
ifunction._scoped_name = descope(function->get_local_name(&parser)); ifunction->_scoped_name = descope(function->get_local_name(&parser));
if (function->_leading_comment != (CPPCommentBlock *)NULL) { if (function->_leading_comment != (CPPCommentBlock *)NULL) {
ifunction._comment = trim_blanks(function->_leading_comment->_comment); ifunction->_comment = trim_blanks(function->_leading_comment->_comment);
} }
ostringstream prototype; ostringstream prototype;
function->output(prototype, 0, &parser, false); function->output(prototype, 0, &parser, false);
prototype << ";"; prototype << ";";
ifunction._prototype = prototype.str(); ifunction->_prototype = prototype.str();
if (struct_type != (CPPStructType *)NULL) { if (struct_type != (CPPStructType *)NULL) {
// The function is a method. // The function is a method.
ifunction._flags |= InterrogateFunction::F_method; ifunction->_flags |= InterrogateFunction::F_method;
ifunction._class = get_type(struct_type, false); ifunction->_class = get_type(struct_type, false);
} }
ifunction._flags |= flags; ifunction->_flags |= flags;
ifunction._instances.insert(InterrogateFunction::Instances::value_type(function_signature, function)); ifunction->_instances.insert(InterrogateFunction::Instances::value_type(function_signature, function));
ifunction._expression = expression; ifunction->_expression = expression;
InterrogateDatabase::get_ptr()->add_function(index, ifunction); InterrogateDatabase::get_ptr()->add_function(index, ifunction);

View File

@ -309,7 +309,7 @@ get_function(FunctionIndex function) {
if (fi == _function_map.end()) { if (fi == _function_map.end()) {
return bogus_function; return bogus_function;
} }
return (*fi).second; return *(*fi).second;
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -529,12 +529,12 @@ add_type(TypeIndex index, const InterrogateType &type) {
// the given index number. // the given index number.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void InterrogateDatabase:: void InterrogateDatabase::
add_function(FunctionIndex index, const InterrogateFunction &function) { add_function(FunctionIndex index, InterrogateFunction *function) {
bool inserted = bool inserted =
_function_map.insert(FunctionMap::value_type(index, function)).second; _function_map.insert(FunctionMap::value_type(index, function)).second;
assert(inserted); assert(inserted);
if (function.is_global()) { if (function->is_global()) {
_global_functions.push_back(index); _global_functions.push_back(index);
} }
_all_functions.push_back(index); _all_functions.push_back(index);
@ -608,7 +608,7 @@ update_type(TypeIndex type) {
InterrogateFunction &InterrogateDatabase:: InterrogateFunction &InterrogateDatabase::
update_function(FunctionIndex function) { update_function(FunctionIndex function) {
check_latest(); check_latest();
return _function_map[function]; return *_function_map[function];
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -734,7 +734,7 @@ remap_indices(int first_index, IndexRemapper &remap) {
(*wi).second.remap_indices(remap); (*wi).second.remap_indices(remap);
} }
for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) {
(*fi).second.remap_indices(remap); (*fi).second->remap_indices(remap);
} }
for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) {
(*ti).second.remap_indices(remap); (*ti).second.remap_indices(remap);
@ -794,7 +794,7 @@ write(ostream &out, InterrogateModuleDef *def) const {
out << _function_map.size() << "\n"; out << _function_map.size() << "\n";
FunctionMap::const_iterator fi; FunctionMap::const_iterator fi;
for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) {
out << (*fi).first << " " << (*fi).second << "\n"; out << (*fi).first << " " << *(*fi).second << "\n";
} }
out << _wrapper_map.size() << "\n"; out << _wrapper_map.size() << "\n";
@ -955,9 +955,10 @@ read_new(istream &in, InterrogateModuleDef *def) {
while (num_functions > 0) { while (num_functions > 0) {
FunctionIndex index; FunctionIndex index;
InterrogateFunction function(def); InterrogateFunction *function = new InterrogateFunction(def);
in >> index >> function; in >> index >> *function;
if (in.fail()) { if (in.fail()) {
delete function;
return false; return false;
} }
@ -1125,7 +1126,7 @@ merge_from(const InterrogateDatabase &other) {
fi != other._function_map.end(); fi != other._function_map.end();
++fi) { ++fi) {
FunctionIndex other_function_index = (*fi).first; FunctionIndex other_function_index = (*fi).first;
const InterrogateFunction &other_function = (*fi).second; InterrogateFunction *other_function = (*fi).second;
add_function(other_function_index, other_function); add_function(other_function_index, other_function);
update_function(other_function_index).remap_indices(remap); update_function(other_function_index).remap_indices(remap);
} }

View File

@ -89,7 +89,7 @@ public:
// Functions to build the database. // Functions to build the database.
int get_next_index(); int get_next_index();
void add_type(TypeIndex index, const InterrogateType &type); void add_type(TypeIndex index, const InterrogateType &type);
void add_function(FunctionIndex index, const InterrogateFunction &function); void add_function(FunctionIndex index, InterrogateFunction *function);
void add_wrapper(FunctionWrapperIndex index, void add_wrapper(FunctionWrapperIndex index,
const InterrogateFunctionWrapper &wrapper); const InterrogateFunctionWrapper &wrapper);
void add_manifest(ManifestIndex index, const InterrogateManifest &manifest); void add_manifest(ManifestIndex index, const InterrogateManifest &manifest);
@ -124,7 +124,7 @@ private:
// This data is loaded from the various database files. // This data is loaded from the various database files.
typedef map<TypeIndex, InterrogateType> TypeMap; typedef map<TypeIndex, InterrogateType> TypeMap;
TypeMap _type_map; TypeMap _type_map;
typedef map<FunctionIndex, InterrogateFunction> FunctionMap; typedef map<FunctionIndex, InterrogateFunction *> FunctionMap;
FunctionMap _function_map; FunctionMap _function_map;
typedef map<FunctionWrapperIndex, InterrogateFunctionWrapper> FunctionWrapperMap; typedef map<FunctionWrapperIndex, InterrogateFunctionWrapper> FunctionWrapperMap;
FunctionWrapperMap _wrapper_map; FunctionWrapperMap _wrapper_map;