mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Fixes to get the C binding generator to work
This commit is contained in:
parent
41b44683b6
commit
7026854cc2
@ -217,11 +217,11 @@ is_equal(const CPPDeclaration *other) const {
|
|||||||
if (*_bounds != *ot->_bounds) {
|
if (*_bounds != *ot->_bounds) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (_bounds == NULL || ot->_bounds == NULL) {
|
} else if ((_bounds == NULL) != (ot->_bounds == NULL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _element_type == ot->_element_type;
|
return *_element_type == *ot->_element_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -241,10 +241,13 @@ is_less(const CPPDeclaration *other) const {
|
|||||||
if (*_bounds != *ot->_bounds) {
|
if (*_bounds != *ot->_bounds) {
|
||||||
return *_bounds < *ot->_bounds;
|
return *_bounds < *ot->_bounds;
|
||||||
}
|
}
|
||||||
} else if (_bounds == NULL || ot->_bounds == NULL) {
|
} else if ((_bounds == NULL) != (ot->_bounds == NULL)) {
|
||||||
return _bounds < ot->_bounds;
|
return _bounds < ot->_bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _element_type < ot->_element_type;
|
if (*_element_type != *ot->_element_type) {
|
||||||
|
return *_element_type < *ot->_element_type;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ typedef_declaration:
|
|||||||
inst->_storage_class |= (current_storage_class | $1);
|
inst->_storage_class |= (current_storage_class | $1);
|
||||||
current_scope->add_declaration(inst, global_scope, current_lexer, @2);
|
current_scope->add_declaration(inst, global_scope, current_lexer, @2);
|
||||||
CPPTypedefType *typedef_type = new CPPTypedefType(inst->_type, inst->_ident, current_scope);
|
CPPTypedefType *typedef_type = new CPPTypedefType(inst->_type, inst->_ident, current_scope);
|
||||||
current_scope->add_declaration(typedef_type, global_scope, current_lexer, @2);
|
current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -735,13 +735,13 @@ typedef_instance_identifiers:
|
|||||||
{
|
{
|
||||||
CPPType *target_type = current_type;
|
CPPType *target_type = current_type;
|
||||||
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
||||||
current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1);
|
current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1);
|
||||||
}
|
}
|
||||||
| instance_identifier maybe_initialize ',' typedef_instance_identifiers
|
| instance_identifier maybe_initialize ',' typedef_instance_identifiers
|
||||||
{
|
{
|
||||||
CPPType *target_type = current_type;
|
CPPType *target_type = current_type;
|
||||||
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
||||||
current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1);
|
current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -751,14 +751,14 @@ typedef_const_instance_identifiers:
|
|||||||
$1->add_modifier(IIT_const);
|
$1->add_modifier(IIT_const);
|
||||||
CPPType *target_type = current_type;
|
CPPType *target_type = current_type;
|
||||||
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
||||||
current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1);
|
current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1);
|
||||||
}
|
}
|
||||||
| instance_identifier maybe_initialize ',' typedef_const_instance_identifiers
|
| instance_identifier maybe_initialize ',' typedef_const_instance_identifiers
|
||||||
{
|
{
|
||||||
$1->add_modifier(IIT_const);
|
$1->add_modifier(IIT_const);
|
||||||
CPPType *target_type = current_type;
|
CPPType *target_type = current_type;
|
||||||
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
CPPTypedefType *typedef_type = new CPPTypedefType(target_type, $1, current_scope, @1.file);
|
||||||
current_scope->add_declaration(typedef_type, global_scope, current_lexer, @1);
|
current_scope->add_declaration(CPPType::new_type(typedef_type), global_scope, current_lexer, @1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -323,6 +323,12 @@ new_type(CPPType *type) {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this triggers, we probably messed up by defining is_less()
|
||||||
|
// incorrectly; they provide a relative ordering even though they
|
||||||
|
// are equal to each other. Or, we provided an is_equal() that
|
||||||
|
// gives false negatives.
|
||||||
|
assert(**result.first == *type);
|
||||||
|
|
||||||
// The insertion has not taken place; thus, there was previously
|
// The insertion has not taken place; thus, there was previously
|
||||||
// another equivalent type declared.
|
// another equivalent type declared.
|
||||||
if (*result.first != type) {
|
if (*result.first != type) {
|
||||||
|
@ -381,7 +381,7 @@ is_equal(const CPPDeclaration *other) const {
|
|||||||
const CPPTypedefType *ot = ((CPPDeclaration *)other)->as_typedef_type();
|
const CPPTypedefType *ot = ((CPPDeclaration *)other)->as_typedef_type();
|
||||||
assert(ot != NULL);
|
assert(ot != NULL);
|
||||||
|
|
||||||
return (_type == ot->_type) && (*_ident == *ot->_ident);
|
return (*_type == *ot->_type) && (*_ident == *ot->_ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -94,9 +94,29 @@ get_parameter_name(int n) const {
|
|||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Writes a sequence of commands to the given output
|
// Description: Writes a sequence of commands to the given output
|
||||||
// stream to call the wrapped function. The parameter
|
// stream to call the wrapped function. The parameter
|
||||||
// values are taken from pexprs, if it is nonempty, or
|
// values are assumed to be simply the names of the
|
||||||
// are assumed to be simply the names of the parameters,
|
// parameters.
|
||||||
// if it is empty.
|
//
|
||||||
|
// The return value is the expression to return, if we
|
||||||
|
// are returning a value, or the empty string if we
|
||||||
|
// return nothing.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
string FunctionRemap::
|
||||||
|
call_function(ostream &out, int indent_level, bool convert_result,
|
||||||
|
const string &container) const {
|
||||||
|
vector_string pexprs;
|
||||||
|
for (int i = 0; i < _parameters.size(); ++i) {
|
||||||
|
pexprs.push_back(get_parameter_name(i));
|
||||||
|
}
|
||||||
|
return call_function(out, indent_level, convert_result, container, pexprs);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: FunctionRemap::call_function
|
||||||
|
// Access: Public
|
||||||
|
// Description: Writes a sequence of commands to the given output
|
||||||
|
// stream to call the wrapped function. The parameter
|
||||||
|
// values are taken from pexprs.
|
||||||
//
|
//
|
||||||
// The return value is the expression to return, if we
|
// The return value is the expression to return, if we
|
||||||
// are returning a value, or the empty string if we
|
// are returning a value, or the empty string if we
|
||||||
@ -219,7 +239,7 @@ call_function(ostream &out, int indent_level, bool convert_result,
|
|||||||
string call = get_call_str(container, pexprs);
|
string call = get_call_str(container, pexprs);
|
||||||
|
|
||||||
if (!convert_result) {
|
if (!convert_result) {
|
||||||
return_expr = get_call_str(container, pexprs);
|
return_expr = call;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//if (_return_type->return_value_should_be_simple()) {
|
//if (_return_type->return_value_should_be_simple()) {
|
||||||
@ -371,23 +391,35 @@ get_call_str(const string &container, const vector_string &pexprs) const {
|
|||||||
|
|
||||||
// Getters and setters are a special case.
|
// Getters and setters are a special case.
|
||||||
if (_type == T_getter) {
|
if (_type == T_getter) {
|
||||||
if (!container.empty()) {
|
if (_has_this && !container.empty()) {
|
||||||
call << "(" << container << ")->" << _expression;
|
call << "(" << container << ")->" << _expression;
|
||||||
} else {
|
} else {
|
||||||
call << _expression;
|
call << _expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (_type == T_setter) {
|
} else if (_type == T_setter) {
|
||||||
if (!container.empty()) {
|
string expr;
|
||||||
call << "(" << container << ")->" << _expression;
|
if (_has_this && !container.empty()) {
|
||||||
|
expr = "(" + container + ")->" + _expression;
|
||||||
} else {
|
} else {
|
||||||
call << _expression;
|
expr = _expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's not possible to assign arrays in C++, we have to copy them.
|
||||||
|
CPPArrayType *array_type = _parameters[_first_true_parameter]._remap->get_orig_type()->as_array_type();
|
||||||
|
if (array_type != NULL) {
|
||||||
|
call << "std::copy(" << expr << ", " << expr << " + " << *array_type->_bounds << ", ";
|
||||||
|
} else {
|
||||||
|
call << expr << " = ";
|
||||||
}
|
}
|
||||||
|
|
||||||
call << " = ";
|
|
||||||
_parameters[_first_true_parameter]._remap->pass_parameter(call,
|
_parameters[_first_true_parameter]._remap->pass_parameter(call,
|
||||||
get_parameter_expr(_first_true_parameter, pexprs));
|
get_parameter_expr(_first_true_parameter, pexprs));
|
||||||
|
|
||||||
|
if (array_type != NULL) {
|
||||||
|
call << ')';
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const char *separator = "";
|
const char *separator = "";
|
||||||
|
|
||||||
|
@ -52,9 +52,11 @@ public:
|
|||||||
~FunctionRemap();
|
~FunctionRemap();
|
||||||
|
|
||||||
string get_parameter_name(int n) const;
|
string get_parameter_name(int n) const;
|
||||||
|
string call_function(ostream &out, int indent_level,
|
||||||
|
bool convert_result, const string &container) const;
|
||||||
string call_function(ostream &out, int indent_level,
|
string call_function(ostream &out, int indent_level,
|
||||||
bool convert_result, const string &container,
|
bool convert_result, const string &container,
|
||||||
const vector_string &pexprs = vector_string()) const;
|
const vector_string &pexprs) const;
|
||||||
|
|
||||||
void write_orig_prototype(ostream &out, int indent_level, bool local=false,
|
void write_orig_prototype(ostream &out, int indent_level, bool local=false,
|
||||||
int num_default_args=0) const;
|
int num_default_args=0) const;
|
||||||
|
@ -442,8 +442,8 @@ remap_parameter(CPPType *struct_type, CPPType *param_type) {
|
|||||||
return new ParameterRemapEnumToInt(param_type);
|
return new ParameterRemapEnumToInt(param_type);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} else if (TypeManager::is_const_simple(param_type)) {
|
//} else if (TypeManager::is_const_simple(param_type)) {
|
||||||
return new ParameterRemapConstToNonConst(param_type);
|
// return new ParameterRemapConstToNonConst(param_type);
|
||||||
|
|
||||||
} else if (TypeManager::is_const_ref_to_simple(param_type)) {
|
} else if (TypeManager::is_const_ref_to_simple(param_type)) {
|
||||||
return new ParameterRemapReferenceToConcrete(param_type);
|
return new ParameterRemapReferenceToConcrete(param_type);
|
||||||
@ -833,9 +833,9 @@ manage_return_value(ostream &out, int indent_level,
|
|||||||
|
|
||||||
indent(out, indent_level)
|
indent(out, indent_level)
|
||||||
<< "if (" << return_expr << " != ("
|
<< "if (" << return_expr << " != ("
|
||||||
<< remap->_return_type->get_new_type()->get_local_name(&parser) << ")0) {\n";
|
<< remap->_return_type->get_new_type()->get_local_name(&parser) << ")NULL) {\n";
|
||||||
indent(out, indent_level + 2)
|
indent(out, indent_level + 2)
|
||||||
<< return_expr << "->ref();\n";
|
<< "(" << return_expr << ")->ref();\n";
|
||||||
indent(out, indent_level)
|
indent(out, indent_level)
|
||||||
<< "}\n";
|
<< "}\n";
|
||||||
output_ref(out, indent_level, remap, "refcount");
|
output_ref(out, indent_level, remap, "refcount");
|
||||||
|
@ -173,13 +173,17 @@ write_function_for(ostream &out, InterfaceMaker::Function *func) {
|
|||||||
void InterfaceMakerC::
|
void InterfaceMakerC::
|
||||||
write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
||||||
FunctionRemap *remap) {
|
FunctionRemap *remap) {
|
||||||
|
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
out << "/*\n"
|
out << "/*\n"
|
||||||
<< " * C wrapper for\n"
|
<< " * C wrapper for\n"
|
||||||
<< " * ";
|
<< " * ";
|
||||||
remap->write_orig_prototype(out, 0);
|
remap->write_orig_prototype(out, 0);
|
||||||
out << "\n"
|
out << "\n"
|
||||||
<< " */\n";
|
<< " */\n";
|
||||||
|
|
||||||
if (!output_function_names) {
|
if (!output_function_names) {
|
||||||
// If we're not saving the function names, don't export it from
|
// If we're not saving the function names, don't export it from
|
||||||
// the library.
|
// the library.
|
||||||
@ -192,17 +196,17 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
|||||||
if (generate_spam) {
|
if (generate_spam) {
|
||||||
write_spam_message(out, remap);
|
write_spam_message(out, remap);
|
||||||
}
|
}
|
||||||
|
|
||||||
string return_expr =
|
string return_expr =
|
||||||
remap->call_function(out, 2, true, "param0");
|
remap->call_function(out, 2, true, "param0");
|
||||||
return_expr = manage_return_value(out, 2, remap, return_expr);
|
return_expr = manage_return_value(out, 2, remap, return_expr);
|
||||||
if (!return_expr.empty()) {
|
if (!return_expr.empty()) {
|
||||||
out << " return " << return_expr << ";\n";
|
out << " return " << return_expr << ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << "}\n\n";
|
out << "}\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: InterfaceMakerC::write_function_header
|
// Function: InterfaceMakerC::write_function_header
|
||||||
// Access: Private
|
// Access: Private
|
||||||
@ -212,6 +216,10 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
|||||||
void InterfaceMakerC::
|
void InterfaceMakerC::
|
||||||
write_function_header(ostream &out, InterfaceMaker::Function *func,
|
write_function_header(ostream &out, InterfaceMaker::Function *func,
|
||||||
FunctionRemap *remap, bool newline) {
|
FunctionRemap *remap, bool newline) {
|
||||||
|
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (remap->_void_return) {
|
if (remap->_void_return) {
|
||||||
out << "void";
|
out << "void";
|
||||||
} else {
|
} else {
|
||||||
|
@ -4748,8 +4748,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
<< "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n"
|
<< "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n"
|
||||||
<< "#endif\n";
|
<< "#endif\n";
|
||||||
|
|
||||||
pexpr_string = "std::wstring(" +
|
pexpr_string = param_name + "_str, " + param_name + "_len";
|
||||||
param_name + "_str, " + param_name + "_len)";
|
|
||||||
|
|
||||||
extra_cleanup
|
extra_cleanup
|
||||||
<< "#if PY_VERSION_HEX >= 0x03030000\n"
|
<< "#if PY_VERSION_HEX >= 0x03030000\n"
|
||||||
@ -4774,8 +4773,7 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
<< "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n"
|
<< "PyUnicode_AsWideChar(" << param_name << ", " << param_name << "_str, " << param_name << "_len);\n"
|
||||||
<< "#endif\n";
|
<< "#endif\n";
|
||||||
|
|
||||||
pexpr_string = "&std::wstring(" +
|
pexpr_string = param_name + "_str, " + param_name + "_len";
|
||||||
param_name + "_str, " + param_name + "_len)";
|
|
||||||
|
|
||||||
extra_cleanup
|
extra_cleanup
|
||||||
<< "#if PY_VERSION_HEX >= 0x03030000\n"
|
<< "#if PY_VERSION_HEX >= 0x03030000\n"
|
||||||
@ -4822,13 +4820,12 @@ write_function_instance(ostream &out, FunctionRemap *remap,
|
|||||||
+ "_str, &" + param_name + "_len";
|
+ "_str, &" + param_name + "_len";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TypeManager::is_const_ptr_to_basic_string_char(orig_type)) {
|
// if (TypeManager::is_const_ptr_to_basic_string_char(orig_type)) {
|
||||||
pexpr_string = "&std::string(" +
|
// pexpr_string = "&std::string(" +
|
||||||
param_name + "_str, " + param_name + "_len)";
|
// param_name + "_str, " + param_name + "_len)";
|
||||||
} else {
|
// } else {
|
||||||
pexpr_string = "std::string(" +
|
pexpr_string = param_name + "_str, " + param_name + "_len";
|
||||||
param_name + "_str, " + param_name + "_len)";
|
// }
|
||||||
}
|
|
||||||
expected_params += "str";
|
expected_params += "str";
|
||||||
}
|
}
|
||||||
// Remember to clear the TypeError that any of the above methods raise.
|
// Remember to clear the TypeError that any of the above methods raise.
|
||||||
|
@ -1537,6 +1537,12 @@ get_getter(CPPType *expr_type, string expression,
|
|||||||
assert(expr_type != (CPPType *)NULL);
|
assert(expr_type != (CPPType *)NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We can't return an array from a function, but we can decay it
|
||||||
|
// into a pointer.
|
||||||
|
while (expr_type->get_subtype() == CPPDeclaration::ST_array) {
|
||||||
|
expr_type = CPPType::new_type(new CPPPointerType(expr_type->as_array_type()->_element_type));
|
||||||
|
}
|
||||||
|
|
||||||
// Make up a CPPFunctionType.
|
// Make up a CPPFunctionType.
|
||||||
CPPParameterList *params = new CPPParameterList;
|
CPPParameterList *params = new CPPParameterList;
|
||||||
CPPFunctionType *ftype = new CPPFunctionType(expr_type, params, 0);
|
CPPFunctionType *ftype = new CPPFunctionType(expr_type, params, 0);
|
||||||
|
@ -23,6 +23,12 @@ ParameterRemapBasicStringPtrToString::
|
|||||||
ParameterRemapBasicStringPtrToString(CPPType *orig_type) :
|
ParameterRemapBasicStringPtrToString(CPPType *orig_type) :
|
||||||
ParameterRemapToString(orig_type)
|
ParameterRemapToString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_char_star_type = (CPPType *)NULL;
|
||||||
|
if (const_char_star_type == (CPPType *)NULL) {
|
||||||
|
const_char_star_type = parser.parse_type("const char *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_char_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -34,7 +40,7 @@ ParameterRemapBasicStringPtrToString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicStringPtrToString::
|
void ParameterRemapBasicStringPtrToString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << "&" << variable_name;
|
out << "&std::string(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -58,6 +64,12 @@ ParameterRemapBasicWStringPtrToWString::
|
|||||||
ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) :
|
ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) :
|
||||||
ParameterRemapToWString(orig_type)
|
ParameterRemapToWString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_wchar_star_type = (CPPType *)NULL;
|
||||||
|
if (const_wchar_star_type == (CPPType *)NULL) {
|
||||||
|
const_wchar_star_type = parser.parse_type("const wchar_t *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_wchar_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -69,7 +81,7 @@ ParameterRemapBasicWStringPtrToWString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicWStringPtrToWString::
|
void ParameterRemapBasicWStringPtrToWString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << "&" << variable_name;
|
out << "&std::wstring(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -23,6 +23,12 @@ ParameterRemapBasicStringRefToString::
|
|||||||
ParameterRemapBasicStringRefToString(CPPType *orig_type) :
|
ParameterRemapBasicStringRefToString(CPPType *orig_type) :
|
||||||
ParameterRemapToString(orig_type)
|
ParameterRemapToString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_char_star_type = (CPPType *)NULL;
|
||||||
|
if (const_char_star_type == (CPPType *)NULL) {
|
||||||
|
const_char_star_type = parser.parse_type("const char *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_char_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -34,7 +40,7 @@ ParameterRemapBasicStringRefToString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicStringRefToString::
|
void ParameterRemapBasicStringRefToString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << variable_name;
|
out << "std::string(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -58,6 +64,12 @@ ParameterRemapBasicWStringRefToWString::
|
|||||||
ParameterRemapBasicWStringRefToWString(CPPType *orig_type) :
|
ParameterRemapBasicWStringRefToWString(CPPType *orig_type) :
|
||||||
ParameterRemapToWString(orig_type)
|
ParameterRemapToWString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_wchar_star_type = (CPPType *)NULL;
|
||||||
|
if (const_wchar_star_type == (CPPType *)NULL) {
|
||||||
|
const_wchar_star_type = parser.parse_type("const wchar_t *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_wchar_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -69,7 +81,7 @@ ParameterRemapBasicWStringRefToWString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicWStringRefToWString::
|
void ParameterRemapBasicWStringRefToWString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << variable_name;
|
out << "std::wstring(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -24,6 +24,12 @@ ParameterRemapBasicStringToString::
|
|||||||
ParameterRemapBasicStringToString(CPPType *orig_type) :
|
ParameterRemapBasicStringToString(CPPType *orig_type) :
|
||||||
ParameterRemapToString(orig_type)
|
ParameterRemapToString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_char_star_type = (CPPType *)NULL;
|
||||||
|
if (const_char_star_type == (CPPType *)NULL) {
|
||||||
|
const_char_star_type = parser.parse_type("const char *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_char_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -35,7 +41,7 @@ ParameterRemapBasicStringToString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicStringToString::
|
void ParameterRemapBasicStringToString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << variable_name;
|
out << "std::string(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -73,8 +79,14 @@ get_return_expr(const string &expression) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ParameterRemapBasicWStringToWString::
|
ParameterRemapBasicWStringToWString::
|
||||||
ParameterRemapBasicWStringToWString(CPPType *orig_type) :
|
ParameterRemapBasicWStringToWString(CPPType *orig_type) :
|
||||||
ParameterRemapToString(orig_type)
|
ParameterRemapToWString(orig_type)
|
||||||
{
|
{
|
||||||
|
static CPPType *const_wchar_star_type = (CPPType *)NULL;
|
||||||
|
if (const_wchar_star_type == (CPPType *)NULL) {
|
||||||
|
const_wchar_star_type = parser.parse_type("const wchar_t *");
|
||||||
|
}
|
||||||
|
|
||||||
|
_new_type = const_wchar_star_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -86,7 +98,7 @@ ParameterRemapBasicWStringToWString(CPPType *orig_type) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParameterRemapBasicWStringToWString::
|
void ParameterRemapBasicWStringToWString::
|
||||||
pass_parameter(ostream &out, const string &variable_name) {
|
pass_parameter(ostream &out, const string &variable_name) {
|
||||||
out << variable_name;
|
out << "std::wstring(" << variable_name << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
// Description : Maps a concrete basic_string<wchar_t> to an atomic
|
// Description : Maps a concrete basic_string<wchar_t> to an atomic
|
||||||
// string.
|
// string.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class ParameterRemapBasicWStringToWString : public ParameterRemapToString {
|
class ParameterRemapBasicWStringToWString : public ParameterRemapToWString {
|
||||||
public:
|
public:
|
||||||
ParameterRemapBasicWStringToWString(CPPType *orig_type);
|
ParameterRemapBasicWStringToWString(CPPType *orig_type);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ ParameterRemapToString(CPPType *orig_type) :
|
|||||||
const_char_star_type = parser.parse_type("const char *");
|
const_char_star_type = parser.parse_type("const char *");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TypeManager::is_const(orig_type)) {
|
if (TypeManager::is_const_char_pointer(orig_type) || TypeManager::is_string(orig_type)) {
|
||||||
_new_type = const_char_star_type;
|
_new_type = const_char_star_type;
|
||||||
} else {
|
} else {
|
||||||
_new_type = char_star_type;
|
_new_type = char_star_type;
|
||||||
|
@ -59,6 +59,10 @@ __published:
|
|||||||
bool bad() const;
|
bool bad() const;
|
||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// We actually want to wrap streampos as streamoff.
|
||||||
|
#define streampos streamoff
|
||||||
|
|
||||||
class ostream : virtual public ios {
|
class ostream : virtual public ios {
|
||||||
__published:
|
__published:
|
||||||
void put(char c);
|
void put(char c);
|
||||||
@ -104,6 +108,6 @@ extern istream cin;
|
|||||||
extern ostream cout;
|
extern ostream cout;
|
||||||
extern ostream cerr;
|
extern ostream cerr;
|
||||||
|
|
||||||
typedef int streampos;
|
typedef long streamoff;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#ifndef _STDINT_H
|
#ifndef _STDINT_H
|
||||||
#define _STDINT_H
|
#define _STDINT_H
|
||||||
|
|
||||||
#ifdef _LP64
|
#if defined(_LP64) || defined(_WIN64)
|
||||||
#define __WORDSIZE 64
|
#define __WORDSIZE 64
|
||||||
#else
|
#else
|
||||||
#define __WORDSIZE 32
|
#define __WORDSIZE 32
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#ifndef STDTYPEDEFS_H
|
#ifndef STDTYPEDEFS_H
|
||||||
#define STDTYPEDEFS_H
|
#define STDTYPEDEFS_H
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
typedef unsigned int size_t;
|
typedef unsigned long size_t;
|
||||||
typedef int ssize_t;
|
typedef long ssize_t;
|
||||||
typedef int off_t;
|
typedef int off_t;
|
||||||
typedef unsigned int time_t;
|
typedef unsigned int time_t;
|
||||||
typedef int clock_t;
|
typedef int clock_t;
|
||||||
|
@ -77,7 +77,6 @@ PUBLISHED:
|
|||||||
void clear_direct_host();
|
void clear_direct_host();
|
||||||
void add_direct_host(const string &hostname);
|
void add_direct_host(const string &hostname);
|
||||||
|
|
||||||
void get_proxies_for_url(const URLSpec &url, pvector<URLSpec> &proxies) const;
|
|
||||||
string get_proxies_for_url(const URLSpec &url) const;
|
string get_proxies_for_url(const URLSpec &url) const;
|
||||||
|
|
||||||
void set_username(const string &server, const string &realm, const string &username);
|
void set_username(const string &server, const string &realm, const string &username);
|
||||||
@ -134,6 +133,8 @@ PUBLISHED:
|
|||||||
static HTTPClient *get_global_ptr();
|
static HTTPClient *get_global_ptr();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void get_proxies_for_url(const URLSpec &url, pvector<URLSpec> &proxies) const;
|
||||||
|
|
||||||
SSL_CTX *get_ssl_ctx();
|
SSL_CTX *get_ssl_ctx();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -34,6 +34,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE string get_data();
|
INLINE string get_data();
|
||||||
INLINE void set_data(const string &data);
|
INLINE void set_data(const string &data);
|
||||||
|
|
||||||
|
public:
|
||||||
INLINE void swap_data(pvector<unsigned char> &data);
|
INLINE void swap_data(pvector<unsigned char> &data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1018,7 +1018,7 @@ tag_end() const {
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: EggGroup::tag_size
|
// Function: EggGroup::tag_size
|
||||||
// Access: Published
|
// Access: Public
|
||||||
// Description: Returns the number of elements between tag_begin()
|
// Description: Returns the number of elements between tag_begin()
|
||||||
// and tag_end().
|
// and tag_end().
|
||||||
//
|
//
|
||||||
|
@ -36,7 +36,7 @@ class GraphicsStateGuardianBase;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDA_PGRAPH GeomNode : public PandaNode {
|
class EXPCL_PANDA_PGRAPH GeomNode : public PandaNode {
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
GeomNode(const string &name);
|
explicit GeomNode(const string &name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GeomNode(const GeomNode ©);
|
GeomNode(const GeomNode ©);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user