diff --git a/direct/src/dcparser/dcPacker.h b/direct/src/dcparser/dcPacker.h index 0c7cfb58ab..bbbcb3e2d3 100755 --- a/direct/src/dcparser/dcPacker.h +++ b/direct/src/dcparser/dcPacker.h @@ -220,7 +220,7 @@ private: const DCPackerCatalog *_catalog; const DCPackerCatalog::LiveCatalog *_live_catalog; - class StackElement { + class EXPCL_DIRECT StackElement { public: // As an optimization, we implement operator new and delete here // to minimize allocation overhead during push() and pop(). diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index bc4da08534..be91171c50 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -162,6 +162,20 @@ call_function(ostream &out, int indent_level, bool convert_result, string defconstruct = builder.in_defconstruct(_cpptype->get_local_name(&parser)); if (pexprs.empty() && !defconstruct.empty()) { return_expr = defconstruct; + } else if (_extension) { + // Extension constructors are a special case. We allocate memory, but + // the actual construction is done by an __init__ method, similar to how + // it works in Python. + InterfaceMaker::indent(out, indent_level); + _return_type->get_new_type()->output_instance(out, "result", &parser); + out << " = (" << _cpptype->get_local_name(&parser) + << " *) " << _cpptype->get_local_name(&parser) + << "::operator new(sizeof(" << _cpptype->get_local_name(&parser) << "));\n"; + + InterfaceMaker::indent(out, indent_level) + << get_call_str("result", pexprs) << ";\n"; + + return_expr = "result"; } else { return_expr = "new " + get_call_str(container, pexprs); } @@ -330,7 +344,7 @@ make_wrapper_entry(FunctionIndex function_index) { // understands that if the destructor function is zero, it // should use the regular class destructor. - // nout << "Warning! Destructor for " + // nout << "Warning! Destructor for " // << *_return_type->get_orig_type() // << " is unavailable.\n" // << " Cannot manage return value for:\n " @@ -386,11 +400,13 @@ get_call_str(const string &container, const vector_string &pexprs) const { call << "Extension<" << _cpptype->get_local_name(&parser) << ">::"; } - call << _cppfunc->get_local_name(); - call << "("; - + if (_type == T_constructor) { + // Constructor extensions are named __init__, by convention. + call << "__init__"; + } else { + call << _cppfunc->get_local_name(); + } } else { - if (_type == T_constructor) { // Constructors are called differently. call << _cpptype->get_local_name(&parser); @@ -403,9 +419,8 @@ get_call_str(const string &container, const vector_string &pexprs) const { } else { call << _cppfunc->get_local_name(&parser); } - - call << "("; } + call << "("; if (_flags & F_explicit_self) { // Pass on the PyObject * that we stripped off above. @@ -639,7 +654,7 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak } if (_has_this || _type == T_constructor) { - if (_parameters.size() > first_param && _parameters[first_param]._name == "self" && + if (_parameters.size() > (size_t)first_param && _parameters[first_param]._name == "self" && TypeManager::is_pointer_to_PyObject(_parameters[first_param]._remap->get_orig_type())) { // Here's a special case. If the first parameter of a nonstatic // method is a PyObject * called "self", then we will diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index b37c088bb0..5bb52227ca 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -3121,7 +3121,7 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, " wchar_t *" + param_name + "_str = (wchar_t *)alloca(sizeof(wchar_t) * " + param_name + "_len);" " PyUnicode_AsWideChar(" + param_name + ", " + param_name + "_str, " + param_name + "_len);"; - pexpr_string = "basic_string(" + + pexpr_string = "std::wstring(" + param_name + "_str, " + param_name + "_len)"; @@ -3140,7 +3140,7 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, " wchar_t *" + param_name + "_str = (wchar_t *)alloca(sizeof(wchar_t) * " + param_name + "_len);" " PyUnicode_AsWideChar(" + param_name + ", " + param_name + "_str, " + param_name + "_len);"; - pexpr_string = "&basic_string(" + + pexpr_string = "&std::wstring(" + param_name + "_str, " + param_name + "_len)"; @@ -3169,11 +3169,11 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, } if (TypeManager::is_const_ptr_to_basic_string_char(orig_type)) { - pexpr_string = "&basic_string(" + + pexpr_string = "&std::string(" + param_name + "_str, " + param_name + "_len)"; } else { - pexpr_string = "basic_string(" + + pexpr_string = "std::string(" + param_name + "_str, " + param_name + "_len)"; } diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index a752e2b67c..c46b9f9c1c 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -214,6 +214,22 @@ do_command(const string &command, const string ¶ms) { } else if (command == "noinclude") { insert_param_list(_noinclude, params); + } else if (command == "forceinclude") { + size_t nchars = params.size(); + if (nchars >= 2 && params[0] == '"' && params[nchars-1] == '"') { + string incfile = params.substr(1, nchars - 2); + _include_files[incfile] = '"'; + + } else if (nchars >= 2 && params[0] == '<' && params[nchars-1] == '>') { + string incfile = params.substr(1, nchars - 2); + _include_files[incfile] = '<'; + + } else { + nout << "Ignoring invalid forceinclude " << params << "\n" + "Expected to be in one of the following forms:\n" + " forceinclude \"file.h\"\n" + " forceinclude \n"; + } } else { nout << "Ignoring " << command << " " << params << "\n"; } diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ac0a134a42..f07093c740 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -981,6 +981,9 @@ def CompileCxx(obj,src,opts): else: cmd += " -D_HAS_EXCEPTIONS=0" + if 'RTTI' not in opts: + cmd += " /GR-" + if GetTargetArch() == 'x64': cmd += " /DWIN64_VC /DWIN64" @@ -1300,8 +1303,8 @@ def CompileIgate(woutd,wsrc,opts): if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val - building = GetValueOption(opts, "BUILDING:") - if (building): cmd += " -DBUILDING_"+building + #building = GetValueOption(opts, "BUILDING:") + #if (building): cmd += " -DBUILDING_"+building cmd += ' -module ' + module + ' -library ' + library for x in wsrc: if (x.startswith("/")): @@ -2947,6 +2950,7 @@ TargetAdd('libp3dtoolconfig.dll', input='libp3dtool.dll') TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER']) if not PkgSkip("PYTHON"): + OPTS=['DIR:dtool/metalibs/dtoolconfig'] TargetAdd('dtoolconfig_pydtool.obj', opts=OPTS, input="pydtool.cxx") TargetAdd('dtoolconfig.pyd', input='dtoolconfig_pydtool.obj') TargetAdd('dtoolconfig.pyd', input='libp3dtoolconfig.dll') @@ -3026,11 +3030,13 @@ TargetAdd('p3pandabase_pandabase.obj', opts=OPTS, input='pandabase.cxx') OPTS=['DIR:panda/src/express', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB'] TargetAdd('p3express_composite1.obj', opts=OPTS, input='p3express_composite1.cxx') TargetAdd('p3express_composite2.obj', opts=OPTS, input='p3express_composite2.cxx') -TargetAdd('p3express_ext_composite.obj', opts=OPTS, input='p3express_ext_composite.cxx') + +OPTS=['DIR:panda/src/express', 'OPENSSL', 'ZLIB'] IGATEFILES=GetDirectoryContents('panda/src/express', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3express.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3express.in', opts=['IMOD:panda3d.core', 'ILIB:libp3express', 'SRCDIR:panda/src/express']) TargetAdd('libp3express_igate.obj', input='libp3express.in', opts=["DEPENDENCYONLY"]) +TargetAdd('p3express_ext_composite.obj', opts=OPTS, input='p3express_ext_composite.cxx') # # DIRECTORY: panda/src/downloader/ @@ -3039,6 +3045,8 @@ TargetAdd('libp3express_igate.obj', input='libp3express.in', opts=["DEPENDENCYON OPTS=['DIR:panda/src/downloader', 'BUILDING:PANDAEXPRESS', 'OPENSSL', 'ZLIB'] TargetAdd('p3downloader_composite1.obj', opts=OPTS, input='p3downloader_composite1.cxx') TargetAdd('p3downloader_composite2.obj', opts=OPTS, input='p3downloader_composite2.cxx') + +OPTS=['DIR:panda/src/downloader', 'OPENSSL', 'ZLIB'] IGATEFILES=GetDirectoryContents('panda/src/downloader', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3downloader.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3downloader.in', opts=['IMOD:panda3d.core', 'ILIB:libp3downloader', 'SRCDIR:panda/src/downloader']) @@ -3053,11 +3061,8 @@ TargetAdd('pandaexpress_pandaexpress.obj', opts=OPTS, input='pandaexpress.cxx') TargetAdd('libpandaexpress.dll', input='pandaexpress_pandaexpress.obj') TargetAdd('libpandaexpress.dll', input='p3downloader_composite1.obj') TargetAdd('libpandaexpress.dll', input='p3downloader_composite2.obj') -TargetAdd('libpandaexpress.dll', input='libp3downloader_igate.obj') TargetAdd('libpandaexpress.dll', input='p3express_composite1.obj') TargetAdd('libpandaexpress.dll', input='p3express_composite2.obj') -TargetAdd('libpandaexpress.dll', input='p3express_ext_composite.obj') -TargetAdd('libpandaexpress.dll', input='libp3express_igate.obj') TargetAdd('libpandaexpress.dll', input='p3pandabase_pandabase.obj') TargetAdd('libpandaexpress.dll', input=COMMON_DTOOL_LIBS) TargetAdd('libpandaexpress.dll', opts=['ADVAPI', 'WINSOCK2', 'OPENSSL', 'ZLIB', 'WINGDI', 'WINUSER']) @@ -3071,6 +3076,8 @@ if (not RUNTIME): TargetAdd('p3pipeline_composite1.obj', opts=OPTS, input='p3pipeline_composite1.cxx') TargetAdd('p3pipeline_composite2.obj', opts=OPTS, input='p3pipeline_composite2.cxx') TargetAdd('p3pipeline_contextSwitch.obj', opts=OPTS, input='contextSwitch.c') + + OPTS=['DIR:panda/src/pipeline'] IGATEFILES=GetDirectoryContents('panda/src/pipeline', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pipeline.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pipeline.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pipeline', 'SRCDIR:panda/src/pipeline']) @@ -3084,6 +3091,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/linmath', 'BUILDING:PANDA'] TargetAdd('p3linmath_composite1.obj', opts=OPTS, input='p3linmath_composite1.cxx') TargetAdd('p3linmath_composite2.obj', opts=OPTS, input='p3linmath_composite2.cxx') + + OPTS=['DIR:panda/src/linmath'] IGATEFILES=GetDirectoryContents('panda/src/linmath', ["*.h", "*_composite*.cxx"]) for ifile in IGATEFILES[:]: if "_src." in ifile: @@ -3103,12 +3112,15 @@ if (not RUNTIME): OPTS=['DIR:panda/src/putil', 'BUILDING:PANDA', 'ZLIB'] TargetAdd('p3putil_composite1.obj', opts=OPTS, input='p3putil_composite1.cxx') TargetAdd('p3putil_composite2.obj', opts=OPTS, input='p3putil_composite2.cxx') + + OPTS=['DIR:panda/src/putil', 'ZLIB'] IGATEFILES=GetDirectoryContents('panda/src/putil', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("test_bam.h") TargetAdd('libp3putil.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3putil.in', opts=['IMOD:panda3d.core', 'ILIB:libp3putil', 'SRCDIR:panda/src/putil']) TargetAdd('libp3putil_igate.obj', input='libp3putil.in', opts=["DEPENDENCYONLY"]) TargetAdd('p3putil_typedWritable_ext.obj', opts=OPTS, input='typedWritable_ext.cxx') + TargetAdd('p3putil_pythonCallbackObject.obj', opts=OPTS, input='pythonCallbackObject.cxx') # # DIRECTORY: panda/src/audio/ @@ -3117,6 +3129,8 @@ if (not RUNTIME): if (not RUNTIME): OPTS=['DIR:panda/src/audio', 'BUILDING:PANDA'] TargetAdd('p3audio_composite1.obj', opts=OPTS, input='p3audio_composite1.cxx') + + OPTS=['DIR:panda/src/audio'] IGATEFILES=["audio.h"] TargetAdd('libp3audio.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3audio.in', opts=['IMOD:panda3d.core', 'ILIB:libp3audio', 'SRCDIR:panda/src/audio']) @@ -3130,6 +3144,9 @@ if (not RUNTIME): OPTS=['DIR:panda/src/event', 'BUILDING:PANDA'] TargetAdd('p3event_composite1.obj', opts=OPTS, input='p3event_composite1.cxx') TargetAdd('p3event_composite2.obj', opts=OPTS, input='p3event_composite2.cxx') + + OPTS=['DIR:panda/src/event'] + TargetAdd('p3event_pythonTask.obj', opts=OPTS, input='pythonTask.cxx') IGATEFILES=GetDirectoryContents('panda/src/event', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3event.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3event.in', opts=['IMOD:panda3d.core', 'ILIB:libp3event', 'SRCDIR:panda/src/event']) @@ -3143,6 +3160,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/mathutil', 'BUILDING:PANDA', 'FFTW'] TargetAdd('p3mathutil_composite1.obj', opts=OPTS, input='p3mathutil_composite1.cxx') TargetAdd('p3mathutil_composite2.obj', opts=OPTS, input='p3mathutil_composite2.cxx') + + OPTS=['DIR:panda/src/mathutil', 'FFTW'] IGATEFILES=GetDirectoryContents('panda/src/mathutil', ["*.h", "*_composite*.cxx"]) for ifile in IGATEFILES[:]: if "_src." in ifile: @@ -3158,6 +3177,8 @@ if (not RUNTIME): if (not RUNTIME): OPTS=['DIR:panda/src/gsgbase', 'BUILDING:PANDA'] TargetAdd('p3gsgbase_composite1.obj', opts=OPTS, input='p3gsgbase_composite1.cxx') + + OPTS=['DIR:panda/src/gsgbase'] IGATEFILES=GetDirectoryContents('panda/src/gsgbase', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3gsgbase.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3gsgbase.in', opts=['IMOD:panda3d.core', 'ILIB:libp3gsgbase', 'SRCDIR:panda/src/gsgbase']) @@ -3171,6 +3192,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/pnmimage', 'BUILDING:PANDA', 'ZLIB'] TargetAdd('p3pnmimage_composite1.obj', opts=OPTS, input='p3pnmimage_composite1.cxx') TargetAdd('p3pnmimage_composite2.obj', opts=OPTS, input='p3pnmimage_composite2.cxx') + + OPTS=['DIR:panda/src/pnmimage', 'ZLIB'] IGATEFILES=GetDirectoryContents('panda/src/pnmimage', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pnmimage.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pnmimage.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmimage', 'SRCDIR:panda/src/pnmimage']) @@ -3184,6 +3207,8 @@ if (not RUNTIME): if (not RUNTIME): OPTS=['DIR:panda/src/nativenet', 'OPENSSL', 'BUILDING:PANDA'] TargetAdd('p3nativenet_composite1.obj', opts=OPTS, input='p3nativenet_composite1.cxx') + + OPTS=['DIR:panda/src/nativenet', 'OPENSSL'] IGATEFILES=GetDirectoryContents('panda/src/nativenet', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3nativenet.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3nativenet.in', opts=['IMOD:panda3d.core', 'ILIB:libp3nativenet', 'SRCDIR:panda/src/nativenet']) @@ -3197,6 +3222,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/net', 'BUILDING:PANDA'] TargetAdd('p3net_composite1.obj', opts=OPTS, input='p3net_composite1.cxx') TargetAdd('p3net_composite2.obj', opts=OPTS, input='p3net_composite2.cxx') + + OPTS=['DIR:panda/src/net'] IGATEFILES=GetDirectoryContents('panda/src/net', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("datagram_ui.h") TargetAdd('libp3net.in', opts=OPTS, input=IGATEFILES) @@ -3211,6 +3238,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/pstatclient', 'BUILDING:PANDA'] TargetAdd('p3pstatclient_composite1.obj', opts=OPTS, input='p3pstatclient_composite1.cxx') TargetAdd('p3pstatclient_composite2.obj', opts=OPTS, input='p3pstatclient_composite2.cxx') + + OPTS=['DIR:panda/src/pstatclient'] IGATEFILES=GetDirectoryContents('panda/src/pstatclient', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pstatclient.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pstatclient.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pstatclient', 'SRCDIR:panda/src/pstatclient']) @@ -3221,9 +3250,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH', "BIGOBJ"] + OPTS=['DIR:panda/src/gobj', 'BUILDING:PANDA', 'NVIDIACG', 'ZLIB', 'SQUISH'] TargetAdd('p3gobj_composite1.obj', opts=OPTS, input='p3gobj_composite1.cxx') TargetAdd('p3gobj_composite2.obj', opts=OPTS, input='p3gobj_composite2.cxx') + + OPTS=['DIR:panda/src/gobj', 'NVIDIACG', 'ZLIB', 'SQUISH'] IGATEFILES=GetDirectoryContents('panda/src/gobj', ["*.h", "*_composite*.cxx"]) if ("cgfx_states.h" in IGATEFILES): IGATEFILES.remove("cgfx_states.h") TargetAdd('libp3gobj.in', opts=OPTS, input=IGATEFILES) @@ -3237,9 +3268,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA', "BIGOBJ"] + OPTS=['DIR:panda/src/pgraphnodes', 'BUILDING:PANDA'] TargetAdd('p3pgraphnodes_composite1.obj', opts=OPTS, input='p3pgraphnodes_composite1.cxx') TargetAdd('p3pgraphnodes_composite2.obj', opts=OPTS, input='p3pgraphnodes_composite2.cxx') + + OPTS=['DIR:panda/src/pgraphnodes'] IGATEFILES=GetDirectoryContents('panda/src/pgraphnodes', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pgraphnodes.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgraphnodes.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraphnodes', 'SRCDIR:panda/src/pgraphnodes']) @@ -3250,12 +3283,14 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA','BIGOBJ'] + OPTS=['DIR:panda/src/pgraph', 'BUILDING:PANDA'] TargetAdd('p3pgraph_nodePath.obj', opts=OPTS, input='nodePath.cxx') TargetAdd('p3pgraph_composite1.obj', opts=OPTS, input='p3pgraph_composite1.cxx') TargetAdd('p3pgraph_composite2.obj', opts=OPTS, input='p3pgraph_composite2.cxx') TargetAdd('p3pgraph_composite3.obj', opts=OPTS, input='p3pgraph_composite3.cxx') TargetAdd('p3pgraph_composite4.obj', opts=OPTS, input='p3pgraph_composite4.cxx') + + OPTS=['DIR:panda/src/pgraph'] IGATEFILES=GetDirectoryContents('panda/src/pgraph', ["*.h", "nodePath.cxx", "*_composite*.cxx"]) TargetAdd('libp3pgraph.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgraph', 'SRCDIR:panda/src/pgraph']) @@ -3267,9 +3302,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/cull', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/cull', 'BUILDING:PANDA'] TargetAdd('p3cull_composite1.obj', opts=OPTS, input='p3cull_composite1.cxx') TargetAdd('p3cull_composite2.obj', opts=OPTS, input='p3cull_composite2.cxx') + + OPTS=['DIR:panda/src/cull'] IGATEFILES=GetDirectoryContents('panda/src/cull', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3cull.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3cull.in', opts=['IMOD:panda3d.core', 'ILIB:libp3cull', 'SRCDIR:panda/src/cull']) @@ -3280,9 +3317,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/chan', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/chan', 'BUILDING:PANDA'] TargetAdd('p3chan_composite1.obj', opts=OPTS, input='p3chan_composite1.cxx') TargetAdd('p3chan_composite2.obj', opts=OPTS, input='p3chan_composite2.cxx') + + OPTS=['DIR:panda/src/chan'] IGATEFILES=GetDirectoryContents('panda/src/chan', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove('movingPart.h') IGATEFILES.remove('animChannelFixed.h') @@ -3295,9 +3334,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/char', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/char', 'BUILDING:PANDA'] TargetAdd('p3char_composite1.obj', opts=OPTS, input='p3char_composite1.cxx') TargetAdd('p3char_composite2.obj', opts=OPTS, input='p3char_composite2.cxx') + + OPTS=['DIR:panda/src/char'] IGATEFILES=GetDirectoryContents('panda/src/char', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3char.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3char.in', opts=['IMOD:panda3d.core', 'ILIB:libp3char', 'SRCDIR:panda/src/char']) @@ -3311,6 +3352,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/dgraph', 'BUILDING:PANDA'] TargetAdd('p3dgraph_composite1.obj', opts=OPTS, input='p3dgraph_composite1.cxx') TargetAdd('p3dgraph_composite2.obj', opts=OPTS, input='p3dgraph_composite2.cxx') + + OPTS=['DIR:panda/src/dgraph'] IGATEFILES=GetDirectoryContents('panda/src/dgraph', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3dgraph.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3dgraph.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dgraph', 'SRCDIR:panda/src/dgraph']) @@ -3321,9 +3364,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/display', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/display', 'BUILDING:PANDA'] TargetAdd('p3display_composite1.obj', opts=OPTS, input='p3display_composite1.cxx') TargetAdd('p3display_composite2.obj', opts=OPTS, input='p3display_composite2.cxx') + + OPTS=['DIR:panda/src/display'] IGATEFILES=GetDirectoryContents('panda/src/display', ["*.h", "*_composite*.cxx"]) IGATEFILES.remove("renderBuffer.h") TargetAdd('libp3display.in', opts=OPTS, input=IGATEFILES) @@ -3331,6 +3376,7 @@ if (not RUNTIME): TargetAdd('libp3display_igate.obj', input='libp3display.in', opts=["DEPENDENCYONLY"]) TargetAdd('p3display_graphicsStateGuardian_ext.obj', opts=OPTS, input='graphicsStateGuardian_ext.cxx') TargetAdd('p3display_graphicsWindow_ext.obj', opts=OPTS, input='graphicsWindow_ext.cxx') + TargetAdd('p3display_pythonGraphicsWindowProc.obj', opts=OPTS, input='pythonGraphicsWindowProc.cxx') if RTDIST and GetTarget() == 'darwin': OPTS=['DIR:panda/src/display'] @@ -3342,9 +3388,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/device', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/device', 'BUILDING:PANDA'] TargetAdd('p3device_composite1.obj', opts=OPTS, input='p3device_composite1.cxx') TargetAdd('p3device_composite2.obj', opts=OPTS, input='p3device_composite2.cxx') + + OPTS=['DIR:panda/src/device'] IGATEFILES=GetDirectoryContents('panda/src/device', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3device.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3device.in', opts=['IMOD:panda3d.core', 'ILIB:libp3device', 'SRCDIR:panda/src/device']) @@ -3357,6 +3405,8 @@ if (not RUNTIME): if (PkgSkip("FREETYPE")==0 and not RUNTIME): OPTS=['DIR:panda/src/pnmtext', 'BUILDING:PANDA', 'FREETYPE'] TargetAdd('p3pnmtext_composite1.obj', opts=OPTS, input='p3pnmtext_composite1.cxx') + + OPTS=['DIR:panda/src/pnmtext', 'FREETYPE'] IGATEFILES=GetDirectoryContents('panda/src/pnmtext', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pnmtext.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pnmtext.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pnmtext', 'SRCDIR:panda/src/pnmtext']) @@ -3367,9 +3417,11 @@ if (PkgSkip("FREETYPE")==0 and not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE', 'BIGOBJ'] + OPTS=['DIR:panda/src/text', 'BUILDING:PANDA', 'ZLIB', 'FREETYPE'] TargetAdd('p3text_composite1.obj', opts=OPTS, input='p3text_composite1.cxx') TargetAdd('p3text_composite2.obj', opts=OPTS, input='p3text_composite2.cxx') + + OPTS=['DIR:panda/src/text', 'ZLIB', 'FREETYPE'] IGATEFILES=GetDirectoryContents('panda/src/text', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3text.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3text.in', opts=['IMOD:panda3d.core', 'ILIB:libp3text', 'SRCDIR:panda/src/text']) @@ -3382,6 +3434,8 @@ if (not RUNTIME): if (not RUNTIME): OPTS=['DIR:panda/src/movies', 'BUILDING:PANDA', 'VORBIS'] TargetAdd('p3movies_composite1.obj', opts=OPTS, input='p3movies_composite1.cxx') + + OPTS=['DIR:panda/src/movies', 'VORBIS'] IGATEFILES=GetDirectoryContents('panda/src/movies', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3movies.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3movies.in', opts=['IMOD:panda3d.core', 'ILIB:libp3movies', 'SRCDIR:panda/src/movies']) @@ -3392,10 +3446,12 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/grutil', 'BUILDING:PANDA'] TargetAdd('p3grutil_multitexReducer.obj', opts=OPTS, input='multitexReducer.cxx') TargetAdd('p3grutil_composite1.obj', opts=OPTS, input='p3grutil_composite1.cxx') TargetAdd('p3grutil_composite2.obj', opts=OPTS, input='p3grutil_composite2.cxx') + + OPTS=['DIR:panda/src/grutil'] IGATEFILES=GetDirectoryContents('panda/src/grutil', ["*.h", "*_composite*.cxx"]) if 'convexHull.h' in IGATEFILES: IGATEFILES.remove('convexHull.h') TargetAdd('libp3grutil.in', opts=OPTS, input=IGATEFILES) @@ -3407,9 +3463,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/tform', 'BUILDING:PANDA'] TargetAdd('p3tform_composite1.obj', opts=OPTS, input='p3tform_composite1.cxx') TargetAdd('p3tform_composite2.obj', opts=OPTS, input='p3tform_composite2.cxx') + + OPTS=['DIR:panda/src/tform'] IGATEFILES=GetDirectoryContents('panda/src/tform', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3tform.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3tform.in', opts=['IMOD:panda3d.core', 'ILIB:libp3tform', 'SRCDIR:panda/src/tform']) @@ -3420,9 +3478,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/collide', 'BUILDING:PANDA'] TargetAdd('p3collide_composite1.obj', opts=OPTS, input='p3collide_composite1.cxx') TargetAdd('p3collide_composite2.obj', opts=OPTS, input='p3collide_composite2.cxx') + + OPTS=['DIR:panda/src/collide'] IGATEFILES=GetDirectoryContents('panda/src/collide', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3collide.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3collide.in', opts=['IMOD:panda3d.core', 'ILIB:libp3collide', 'SRCDIR:panda/src/collide']) @@ -3433,9 +3493,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/parametrics', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/parametrics', 'BUILDING:PANDA'] TargetAdd('p3parametrics_composite1.obj', opts=OPTS, input='p3parametrics_composite1.cxx') TargetAdd('p3parametrics_composite2.obj', opts=OPTS, input='p3parametrics_composite2.cxx') + + OPTS=['DIR:panda/src/parametrics'] IGATEFILES=GetDirectoryContents('panda/src/parametrics', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3parametrics.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3parametrics.in', opts=['IMOD:panda3d.core', 'ILIB:libp3parametrics', 'SRCDIR:panda/src/parametrics']) @@ -3446,9 +3508,11 @@ if (not RUNTIME): # if (not RUNTIME): - OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA', 'BIGOBJ'] + OPTS=['DIR:panda/src/pgui', 'BUILDING:PANDA'] TargetAdd('p3pgui_composite1.obj', opts=OPTS, input='p3pgui_composite1.cxx') TargetAdd('p3pgui_composite2.obj', opts=OPTS, input='p3pgui_composite2.cxx') + + OPTS=['DIR:panda/src/pgui'] IGATEFILES=GetDirectoryContents('panda/src/pgui', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3pgui.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3pgui.in', opts=['IMOD:panda3d.core', 'ILIB:libp3pgui', 'SRCDIR:panda/src/pgui']) @@ -3471,6 +3535,8 @@ if (not RUNTIME): OPTS=['DIR:panda/src/recorder', 'BUILDING:PANDA'] TargetAdd('p3recorder_composite1.obj', opts=OPTS, input='p3recorder_composite1.cxx') TargetAdd('p3recorder_composite2.obj', opts=OPTS, input='p3recorder_composite2.cxx') + + OPTS=['DIR:panda/src/recorder'] IGATEFILES=GetDirectoryContents('panda/src/recorder', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3recorder.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3recorder.in', opts=['IMOD:panda3d.core', 'ILIB:libp3recorder', 'SRCDIR:panda/src/recorder']) @@ -3490,6 +3556,8 @@ if (RUNTIME or RTDIST): if (not RUNTIME): OPTS=['DIR:panda/src/dxml', 'BUILDING:PANDA', 'TINYXML'] TargetAdd('p3dxml_composite1.obj', opts=OPTS, input='p3dxml_composite1.cxx') + + OPTS=['DIR:panda/src/dxml', 'TINYXML'] IGATEFILES=GetDirectoryContents('panda/src/dxml', ["*.h", "p3dxml_composite1.cxx"]) TargetAdd('libp3dxml.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3dxml.in', opts=['IMOD:panda3d.core', 'ILIB:libp3dxml', 'SRCDIR:panda/src/dxml']) @@ -3509,108 +3577,71 @@ if (not RUNTIME): TargetAdd('libpanda.dll', input='panda_panda.obj') TargetAdd('libpanda.dll', input='p3recorder_composite1.obj') TargetAdd('libpanda.dll', input='p3recorder_composite2.obj') - TargetAdd('libpanda.dll', input='libp3recorder_igate.obj') TargetAdd('libpanda.dll', input='p3pgraphnodes_composite1.obj') TargetAdd('libpanda.dll', input='p3pgraphnodes_composite2.obj') - TargetAdd('libpanda.dll', input='libp3pgraphnodes_igate.obj') TargetAdd('libpanda.dll', input='p3pgraph_nodePath.obj') TargetAdd('libpanda.dll', input='p3pgraph_composite1.obj') TargetAdd('libpanda.dll', input='p3pgraph_composite2.obj') TargetAdd('libpanda.dll', input='p3pgraph_composite3.obj') TargetAdd('libpanda.dll', input='p3pgraph_composite4.obj') - TargetAdd('libpanda.dll', input='libp3pgraph_igate.obj') TargetAdd('libpanda.dll', input='p3cull_composite1.obj') TargetAdd('libpanda.dll', input='p3cull_composite2.obj') TargetAdd('libpanda.dll', input='p3movies_composite1.obj') - TargetAdd('libpanda.dll', input='libp3movies_igate.obj') TargetAdd('libpanda.dll', input='p3grutil_multitexReducer.obj') TargetAdd('libpanda.dll', input='p3grutil_composite1.obj') TargetAdd('libpanda.dll', input='p3grutil_composite2.obj') - TargetAdd('libpanda.dll', input='libp3grutil_igate.obj') TargetAdd('libpanda.dll', input='p3chan_composite1.obj') TargetAdd('libpanda.dll', input='p3chan_composite2.obj') - TargetAdd('libpanda.dll', input='libp3chan_igate.obj') TargetAdd('libpanda.dll', input='p3pstatclient_composite1.obj') TargetAdd('libpanda.dll', input='p3pstatclient_composite2.obj') - TargetAdd('libpanda.dll', input='libp3pstatclient_igate.obj') TargetAdd('libpanda.dll', input='p3char_composite1.obj') TargetAdd('libpanda.dll', input='p3char_composite2.obj') - TargetAdd('libpanda.dll', input='libp3char_igate.obj') TargetAdd('libpanda.dll', input='p3collide_composite1.obj') TargetAdd('libpanda.dll', input='p3collide_composite2.obj') - TargetAdd('libpanda.dll', input='libp3collide_igate.obj') TargetAdd('libpanda.dll', input='p3device_composite1.obj') TargetAdd('libpanda.dll', input='p3device_composite2.obj') - TargetAdd('libpanda.dll', input='libp3device_igate.obj') TargetAdd('libpanda.dll', input='p3dgraph_composite1.obj') TargetAdd('libpanda.dll', input='p3dgraph_composite2.obj') - TargetAdd('libpanda.dll', input='libp3dgraph_igate.obj') TargetAdd('libpanda.dll', input='p3display_composite1.obj') TargetAdd('libpanda.dll', input='p3display_composite2.obj') - TargetAdd('libpanda.dll', input='libp3display_igate.obj') TargetAdd('libpanda.dll', input='p3pipeline_composite1.obj') TargetAdd('libpanda.dll', input='p3pipeline_composite2.obj') TargetAdd('libpanda.dll', input='p3pipeline_contextSwitch.obj') - TargetAdd('libpanda.dll', input='libp3pipeline_igate.obj') TargetAdd('libpanda.dll', input='p3event_composite1.obj') TargetAdd('libpanda.dll', input='p3event_composite2.obj') - TargetAdd('libpanda.dll', input='libp3event_igate.obj') TargetAdd('libpanda.dll', input='p3gobj_composite1.obj') TargetAdd('libpanda.dll', input='p3gobj_composite2.obj') - TargetAdd('libpanda.dll', input='libp3gobj_igate.obj') TargetAdd('libpanda.dll', input='p3gsgbase_composite1.obj') - TargetAdd('libpanda.dll', input='libp3gsgbase_igate.obj') TargetAdd('libpanda.dll', input='p3linmath_composite1.obj') TargetAdd('libpanda.dll', input='p3linmath_composite2.obj') - TargetAdd('libpanda.dll', input='libp3linmath_igate.obj') TargetAdd('libpanda.dll', input='p3mathutil_composite1.obj') TargetAdd('libpanda.dll', input='p3mathutil_composite2.obj') - TargetAdd('libpanda.dll', input='libp3mathutil_igate.obj') TargetAdd('libpanda.dll', input='p3parametrics_composite1.obj') TargetAdd('libpanda.dll', input='p3parametrics_composite2.obj') - TargetAdd('libpanda.dll', input='libp3parametrics_igate.obj') TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite1.obj') TargetAdd('libpanda.dll', input='p3pnmimagetypes_composite2.obj') TargetAdd('libpanda.dll', input='p3pnmimage_composite1.obj') TargetAdd('libpanda.dll', input='p3pnmimage_composite2.obj') - TargetAdd('libpanda.dll', input='libp3pnmimage_igate.obj') TargetAdd('libpanda.dll', input='p3text_composite1.obj') TargetAdd('libpanda.dll', input='p3text_composite2.obj') - TargetAdd('libpanda.dll', input='libp3text_igate.obj') TargetAdd('libpanda.dll', input='p3tform_composite1.obj') TargetAdd('libpanda.dll', input='p3tform_composite2.obj') - TargetAdd('libpanda.dll', input='libp3tform_igate.obj') TargetAdd('libpanda.dll', input='p3putil_composite1.obj') TargetAdd('libpanda.dll', input='p3putil_composite2.obj') - TargetAdd('libpanda.dll', input='libp3putil_igate.obj') TargetAdd('libpanda.dll', input='p3audio_composite1.obj') - TargetAdd('libpanda.dll', input='libp3audio_igate.obj') TargetAdd('libpanda.dll', input='p3pgui_composite1.obj') TargetAdd('libpanda.dll', input='p3pgui_composite2.obj') - TargetAdd('libpanda.dll', input='libp3pgui_igate.obj') TargetAdd('libpanda.dll', input='p3net_composite1.obj') TargetAdd('libpanda.dll', input='p3net_composite2.obj') - TargetAdd('libpanda.dll', input='libp3net_igate.obj') TargetAdd('libpanda.dll', input='p3nativenet_composite1.obj') - TargetAdd('libpanda.dll', input='libp3nativenet_igate.obj') TargetAdd('libpanda.dll', input='p3pandabase_pandabase.obj') TargetAdd('libpanda.dll', input='libpandaexpress.dll') TargetAdd('libpanda.dll', input='p3dxml_composite1.obj') - TargetAdd('libpanda.dll', input='libp3dxml_igate.obj') TargetAdd('libpanda.dll', input='libp3dtoolconfig.dll') TargetAdd('libpanda.dll', input='libp3dtool.dll') - TargetAdd('libpanda.dll', input='p3putil_typedWritable_ext.obj') - TargetAdd('libpanda.dll', input='p3pnmimage_pfmFile_ext.obj') - TargetAdd('libpanda.dll', input='p3gobj_geomVertexArrayData_ext.obj') - TargetAdd('libpanda.dll', input='p3gobj_internalName_ext.obj') - TargetAdd('libpanda.dll', input='p3pgraph_ext_composite.obj') - TargetAdd('libpanda.dll', input='p3display_graphicsStateGuardian_ext.obj') - TargetAdd('libpanda.dll', input='p3display_graphicsWindow_ext.obj') - if PkgSkip("FREETYPE")==0: TargetAdd('libpanda.dll', input="p3pnmtext_composite1.obj") - TargetAdd('libpanda.dll', input="libp3pnmtext_igate.obj") TargetAdd('libpanda.dll', dep='dtool_have_freetype.dat') TargetAdd('libpanda.dll', opts=OPTS) @@ -3653,9 +3684,57 @@ if (not RUNTIME): TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core']) + OPTS=['WINSOCK2'] + TargetAdd('core.pyd', input='libp3downloader_igate.obj') + TargetAdd('core.pyd', input='p3express_ext_composite.obj') + TargetAdd('core.pyd', input='libp3express_igate.obj') + + TargetAdd('core.pyd', input='libp3recorder_igate.obj') + TargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj') + TargetAdd('core.pyd', input='libp3pgraph_igate.obj') + TargetAdd('core.pyd', input='libp3movies_igate.obj') + TargetAdd('core.pyd', input='libp3grutil_igate.obj') + TargetAdd('core.pyd', input='libp3chan_igate.obj') + TargetAdd('core.pyd', input='libp3pstatclient_igate.obj') + TargetAdd('core.pyd', input='libp3char_igate.obj') + TargetAdd('core.pyd', input='libp3collide_igate.obj') + TargetAdd('core.pyd', input='libp3device_igate.obj') + TargetAdd('core.pyd', input='libp3dgraph_igate.obj') + TargetAdd('core.pyd', input='libp3display_igate.obj') + TargetAdd('core.pyd', input='libp3pipeline_igate.obj') + TargetAdd('core.pyd', input='libp3event_igate.obj') + TargetAdd('core.pyd', input='libp3gobj_igate.obj') + TargetAdd('core.pyd', input='libp3gsgbase_igate.obj') + TargetAdd('core.pyd', input='libp3linmath_igate.obj') + TargetAdd('core.pyd', input='libp3mathutil_igate.obj') + TargetAdd('core.pyd', input='libp3parametrics_igate.obj') + TargetAdd('core.pyd', input='libp3pnmimage_igate.obj') + TargetAdd('core.pyd', input='libp3text_igate.obj') + TargetAdd('core.pyd', input='libp3tform_igate.obj') + TargetAdd('core.pyd', input='libp3putil_igate.obj') + TargetAdd('core.pyd', input='libp3audio_igate.obj') + TargetAdd('core.pyd', input='libp3pgui_igate.obj') + TargetAdd('core.pyd', input='libp3net_igate.obj') + TargetAdd('core.pyd', input='libp3nativenet_igate.obj') + TargetAdd('core.pyd', input='libp3dxml_igate.obj') + + if PkgSkip("FREETYPE")==0: + TargetAdd('core.pyd', input="libp3pnmtext_igate.obj") + + TargetAdd('core.pyd', input='p3putil_typedWritable_ext.obj') + TargetAdd('core.pyd', input='p3putil_pythonCallbackObject.obj') + TargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj') + TargetAdd('core.pyd', input='p3event_pythonTask.obj') + TargetAdd('core.pyd', input='p3gobj_geomVertexArrayData_ext.obj') + TargetAdd('core.pyd', input='p3gobj_internalName_ext.obj') + TargetAdd('core.pyd', input='p3pgraph_ext_composite.obj') + TargetAdd('core.pyd', input='p3display_graphicsStateGuardian_ext.obj') + TargetAdd('core.pyd', input='p3display_graphicsWindow_ext.obj') + TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj') + TargetAdd('core.pyd', input='core_module.obj') TargetAdd('core.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('core.pyd', opts=['PYTHON']) + TargetAdd('core.pyd', opts=OPTS) # # DIRECTORY: panda/src/vision/ @@ -4536,6 +4615,8 @@ if (PkgSkip("DIRECT")==0): TargetAdd('p3dcparser_dcLexer.obj', opts=OPTS, input='dcLexer.lxx') TargetAdd('p3dcparser_composite1.obj', opts=OPTS, input='p3dcparser_composite1.cxx') TargetAdd('p3dcparser_composite2.obj', opts=OPTS, input='p3dcparser_composite2.cxx') + + OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA'] IGATEFILES=GetDirectoryContents('direct/src/dcparser', ["*.h", "*_composite*.cxx"]) if "dcParser.h" in IGATEFILES: IGATEFILES.remove("dcParser.h") if "dcmsgtypes.h" in IGATEFILES: IGATEFILES.remove('dcmsgtypes.h') @@ -4550,6 +4631,8 @@ if (PkgSkip("DIRECT")==0): if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/deadrec', 'BUILDING:DIRECT'] TargetAdd('p3deadrec_composite1.obj', opts=OPTS, input='p3deadrec_composite1.cxx') + + OPTS=['DIR:direct/src/deadrec'] IGATEFILES=GetDirectoryContents('direct/src/deadrec', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3deadrec.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3deadrec.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3deadrec', 'SRCDIR:direct/src/deadrec']) @@ -4564,6 +4647,8 @@ if (PkgSkip("DIRECT")==0): TargetAdd('p3distributed_config_distributed.obj', opts=OPTS, input='config_distributed.cxx') TargetAdd('p3distributed_cConnectionRepository.obj', opts=OPTS, input='cConnectionRepository.cxx') TargetAdd('p3distributed_cDistributedSmoothNodeBase.obj', opts=OPTS, input='cDistributedSmoothNodeBase.cxx') + + OPTS=['DIR:direct/src/distributed', 'WITHINPANDA', 'OPENSSL'] IGATEFILES=GetDirectoryContents('direct/src/distributed', ["*.h", "*.cxx"]) TargetAdd('libp3distributed.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3distributed.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3distributed', 'SRCDIR:direct/src/distributed']) @@ -4576,6 +4661,8 @@ if (PkgSkip("DIRECT")==0): if (PkgSkip("DIRECT")==0): OPTS=['DIR:direct/src/interval', 'BUILDING:DIRECT'] TargetAdd('p3interval_composite1.obj', opts=OPTS, input='p3interval_composite1.cxx') + + OPTS=['DIR:direct/src/interval'] IGATEFILES=GetDirectoryContents('direct/src/interval', ["*.h", "*_composite*.cxx"]) TargetAdd('libp3interval.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3interval.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3interval', 'SRCDIR:direct/src/interval']) @@ -4590,6 +4677,8 @@ if (PkgSkip("DIRECT")==0): TargetAdd('p3showbase_showBase.obj', opts=OPTS, input='showBase.cxx') if GetTarget() == 'darwin': TargetAdd('p3showbase_showBase_assist.obj', opts=OPTS, input='showBase_assist.mm') + + OPTS=['DIR:direct/src/showbase'] IGATEFILES=GetDirectoryContents('direct/src/showbase', ["*.h", "showBase.cxx"]) TargetAdd('libp3showbase.in', opts=OPTS, input=IGATEFILES) TargetAdd('libp3showbase.in', opts=['IMOD:panda3d.direct', 'ILIB:libp3showbase', 'SRCDIR:direct/src/showbase']) @@ -4609,19 +4698,14 @@ if (PkgSkip("DIRECT")==0): TargetAdd('libp3direct.dll', input='p3dcparser_composite2.obj') TargetAdd('libp3direct.dll', input='p3dcparser_dcParser.obj') TargetAdd('libp3direct.dll', input='p3dcparser_dcLexer.obj') - TargetAdd('libp3direct.dll', input='libp3dcparser_igate.obj') TargetAdd('libp3direct.dll', input='p3showbase_showBase.obj') if GetTarget() == 'darwin': TargetAdd('libp3direct.dll', input='p3showbase_showBase_assist.obj') - TargetAdd('libp3direct.dll', input='libp3showbase_igate.obj') TargetAdd('libp3direct.dll', input='p3deadrec_composite1.obj') - TargetAdd('libp3direct.dll', input='libp3deadrec_igate.obj') TargetAdd('libp3direct.dll', input='p3interval_composite1.obj') - TargetAdd('libp3direct.dll', input='libp3interval_igate.obj') TargetAdd('libp3direct.dll', input='p3distributed_config_distributed.obj') TargetAdd('libp3direct.dll', input='p3distributed_cConnectionRepository.obj') TargetAdd('libp3direct.dll', input='p3distributed_cDistributedSmoothNodeBase.obj') - TargetAdd('libp3direct.dll', input='libp3distributed_igate.obj') TargetAdd('libp3direct.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3direct.dll', opts=['ADVAPI', 'OPENSSL', 'WINUSER', 'WINGDI']) @@ -4634,6 +4718,12 @@ if (PkgSkip("DIRECT")==0): TargetAdd('direct_module.obj', opts=OPTS) TargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct']) + TargetAdd('direct.pyd', input='libp3dcparser_igate.obj') + TargetAdd('direct.pyd', input='libp3showbase_igate.obj') + TargetAdd('direct.pyd', input='libp3deadrec_igate.obj') + TargetAdd('direct.pyd', input='libp3interval_igate.obj') + TargetAdd('direct.pyd', input='libp3distributed_igate.obj') + TargetAdd('direct.pyd', input='direct_module.obj') TargetAdd('direct.pyd', input='libp3direct.dll') TargetAdd('direct.pyd', input='core.pyd') @@ -5255,9 +5345,8 @@ if (PkgSkip("PANDATOOL")==0): if (PkgSkip("PANDATOOL")==0): OPTS=['DIR:pandatool/src/flt', 'ZLIB'] - TargetAdd('p3flt_fltVectorRecord.obj', opts=OPTS, input='fltVectorRecord.cxx') TargetAdd('p3flt_composite1.obj', opts=OPTS, input='p3flt_composite1.cxx') - TargetAdd('libp3flt.lib', input=['p3flt_fltVectorRecord.obj', 'p3flt_composite1.obj']) + TargetAdd('libp3flt.lib', input=['p3flt_composite1.obj']) # # DIRECTORY: pandatool/src/fltegg/ diff --git a/panda/src/display/Sources.pp b/panda/src/display/Sources.pp index 98c9e3d24e..26aa3b5187 100644 --- a/panda/src/display/Sources.pp +++ b/panda/src/display/Sources.pp @@ -14,6 +14,7 @@ standardMunger.I standardMunger.h \ config_display.h \ $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.h] \ + $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.cxx] \ callbackGraphicsWindow.I callbackGraphicsWindow.h \ drawableRegion.I drawableRegion.h \ displayRegion.I displayRegion.h \ @@ -54,7 +55,6 @@ #define INCLUDED_SOURCES \ standardMunger.cxx \ config_display.cxx \ - $[if $[HAVE_PYTHON], pythonGraphicsWindowProc.cxx] \ callbackGraphicsWindow.cxx \ drawableRegion.cxx \ displayRegion.cxx \ diff --git a/panda/src/display/callbackGraphicsWindow.h b/panda/src/display/callbackGraphicsWindow.h index 484e87754f..7af1ddc33f 100644 --- a/panda/src/display/callbackGraphicsWindow.h +++ b/panda/src/display/callbackGraphicsWindow.h @@ -40,7 +40,7 @@ protected: PUBLISHED: virtual ~CallbackGraphicsWindow(); - class WindowCallbackData : public CallbackData { + class EXPCL_PANDA_DISPLAY WindowCallbackData : public CallbackData { public: INLINE WindowCallbackData(CallbackGraphicsWindow *window); @@ -68,8 +68,7 @@ PUBLISHED: static TypeHandle _type_handle; }; - - class EventsCallbackData : public WindowCallbackData { + class EXPCL_PANDA_DISPLAY EventsCallbackData : public WindowCallbackData { public: INLINE EventsCallbackData(CallbackGraphicsWindow *window); @@ -94,7 +93,7 @@ PUBLISHED: static TypeHandle _type_handle; }; - class PropertiesCallbackData : public WindowCallbackData { + class EXPCL_PANDA_DISPLAY PropertiesCallbackData : public WindowCallbackData { public: INLINE PropertiesCallbackData(CallbackGraphicsWindow *window, WindowProperties &properties); @@ -131,7 +130,7 @@ PUBLISHED: RCT_end_flip, }; - class RenderCallbackData : public WindowCallbackData { + class EXPCL_PANDA_DISPLAY RenderCallbackData : public WindowCallbackData { public: INLINE RenderCallbackData(CallbackGraphicsWindow *window, RenderCallbackType callback_type, FrameMode frame_mode); diff --git a/panda/src/display/graphicsStateGuardian_ext.cxx b/panda/src/display/graphicsStateGuardian_ext.cxx index 2f1c2d916e..53407f500f 100644 --- a/panda/src/display/graphicsStateGuardian_ext.cxx +++ b/panda/src/display/graphicsStateGuardian_ext.cxx @@ -18,7 +18,7 @@ #ifdef HAVE_PYTHON #ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject Dtool_Texture; +extern struct Dtool_PyTypedObject Dtool_Texture; #endif static bool traverse_callback(TextureContext *tc, void *data) { diff --git a/panda/src/display/graphicsWindowProc.h b/panda/src/display/graphicsWindowProc.h index a5458a0113..f8b8551d83 100644 --- a/panda/src/display/graphicsWindowProc.h +++ b/panda/src/display/graphicsWindowProc.h @@ -31,7 +31,7 @@ class GraphicsWindow; // Description : Defines an interface for storing platform-specific // window processor methods. //////////////////////////////////////////////////////////////////// -class GraphicsWindowProc{ +class EXPCL_PANDA_DISPLAY GraphicsWindowProc { public: GraphicsWindowProc(); #if defined(__WIN32__) || defined(_WIN32) diff --git a/panda/src/display/p3display_composite2.cxx b/panda/src/display/p3display_composite2.cxx index 4d613bb588..66abd308d0 100644 --- a/panda/src/display/p3display_composite2.cxx +++ b/panda/src/display/p3display_composite2.cxx @@ -4,9 +4,6 @@ #include "graphicsWindow.cxx" #include "graphicsWindowProc.cxx" #include "graphicsWindowProcCallbackData.cxx" -#ifdef HAVE_PYTHON -#include "pythonGraphicsWindowProc.cxx" -#endif #include "graphicsWindowInputDevice.cxx" #include "lru.cxx" #include "nativeWindowHandle.cxx" diff --git a/panda/src/downloader/httpAuthorization.h b/panda/src/downloader/httpAuthorization.h index 95461b0771..dd27c23c95 100644 --- a/panda/src/downloader/httpAuthorization.h +++ b/panda/src/downloader/httpAuthorization.h @@ -35,12 +35,8 @@ class URLSpec; // authorization requests in the past, which can // possibly be re-used for future requests to the same // server. -// -// This class does not need to be exported from the DLL -// because it has no public interface; it is simply a -// helper class for HTTPChannel. //////////////////////////////////////////////////////////////////// -class HTTPAuthorization : public ReferenceCount { +class EXPCL_PANDAEXPRESS HTTPAuthorization : public ReferenceCount { public: typedef pmap Tokens; typedef pmap AuthenticationSchemes; diff --git a/panda/src/dxml/config_dxml.h b/panda/src/dxml/config_dxml.h index 5e78df63a6..8a08d45ad4 100755 --- a/panda/src/dxml/config_dxml.h +++ b/panda/src/dxml/config_dxml.h @@ -36,10 +36,10 @@ extern EXPCL_PANDA void init_libdxml(); class TiXmlDocument; class TiXmlNode; BEGIN_PUBLISH -TiXmlDocument *read_xml_stream(istream &in); -void write_xml_stream(ostream &out, TiXmlDocument *doc); -void print_xml(TiXmlNode *xnode); -void print_xml_to_file(const Filename &filename, TiXmlNode *xnode); +EXPCL_PANDA TiXmlDocument *read_xml_stream(istream &in); +EXPCL_PANDA void write_xml_stream(ostream &out, TiXmlDocument *doc); +EXPCL_PANDA void print_xml(TiXmlNode *xnode); +EXPCL_PANDA void print_xml_to_file(const Filename &filename, TiXmlNode *xnode); END_PUBLISH #endif diff --git a/panda/src/dxml/tinyxml.h b/panda/src/dxml/tinyxml.h index d80c5c4e37..562a4efc84 100644 --- a/panda/src/dxml/tinyxml.h +++ b/panda/src/dxml/tinyxml.h @@ -96,7 +96,7 @@ const int TIXML_PATCH_VERSION = 1; /* Internal structure for tracking location of items in the XML file. */ -struct TiXmlCursor +struct EXPCL_PANDA TiXmlCursor { TiXmlCursor() { Clear(); } void Clear() { row = col = -1; } @@ -125,7 +125,7 @@ struct TiXmlCursor @sa TiXmlNode::Accept() */ -class TiXmlVisitor +class EXPCL_PANDA TiXmlVisitor { public: virtual ~TiXmlVisitor() {} @@ -191,7 +191,7 @@ const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; A Decleration contains: Attributes (not on tree) @endverbatim */ -class TiXmlBase +class EXPCL_PANDA TiXmlBase { friend class TiXmlNode; friend class TiXmlElement; @@ -420,7 +420,7 @@ private: in a document, or stand on its own. The type of a TiXmlNode can be queried, and it can be cast to its more defined type. */ -class TiXmlNode : public TiXmlBase +class EXPCL_PANDA TiXmlNode : public TiXmlBase { friend class TiXmlDocument; friend class TiXmlElement; @@ -776,7 +776,7 @@ private: part of the tinyXML document object model. There are other suggested ways to look at this problem. */ -class TiXmlAttribute : public TiXmlBase +class EXPCL_PANDA TiXmlAttribute : public TiXmlBase { friend class TiXmlAttributeSet; @@ -900,7 +900,7 @@ private: - I like circular lists - it demonstrates some independence from the (typical) doubly linked list. */ -class TiXmlAttributeSet +class EXPCL_PANDA TiXmlAttributeSet { public: TiXmlAttributeSet(); @@ -937,7 +937,7 @@ private: and can contain other elements, text, comments, and unknowns. Elements also contain an arbitrary number of attributes. */ -class TiXmlElement : public TiXmlNode +class EXPCL_PANDA TiXmlElement : public TiXmlNode { public: /// Construct an element. @@ -1152,7 +1152,7 @@ private: /** An XML comment. */ -class TiXmlComment : public TiXmlNode +class EXPCL_PANDA TiXmlComment : public TiXmlNode { public: /// Constructs an empty comment. @@ -1202,7 +1202,7 @@ private: you generally want to leave it alone, but you can change the output mode with SetCDATA() and query it with CDATA(). */ -class TiXmlText : public TiXmlNode +class EXPCL_PANDA TiXmlText : public TiXmlNode { friend class TiXmlElement; public: @@ -1275,7 +1275,7 @@ private: handled as special cases, not generic attributes, simply because there can only be at most 3 and they are always the same. */ -class TiXmlDeclaration : public TiXmlNode +class EXPCL_PANDA TiXmlDeclaration : public TiXmlNode { public: /// Construct an empty declaration. @@ -1344,7 +1344,7 @@ private: DTD tags get thrown into TiXmlUnknowns. */ -class TiXmlUnknown : public TiXmlNode +class EXPCL_PANDA TiXmlUnknown : public TiXmlNode { public: TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} @@ -1383,7 +1383,7 @@ private: XML pieces. It can be saved, loaded, and printed to the screen. The 'value' of a document node is the xml file name. */ -class TiXmlDocument : public TiXmlNode +class EXPCL_PANDA TiXmlDocument : public TiXmlNode { public: /// Create an empty document, that has no name. @@ -1628,7 +1628,7 @@ private: } @endverbatim */ -class TiXmlHandle +class EXPCL_PANDA TiXmlHandle { public: /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. @@ -1727,7 +1727,7 @@ private: fprintf( stdout, "%s", printer.CStr() ); @endverbatim */ -class TiXmlPrinter : public TiXmlVisitor +class EXPCL_PANDA TiXmlPrinter : public TiXmlVisitor { public: TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), diff --git a/panda/src/egg/eggGroupNode_ext.cxx b/panda/src/egg/eggGroupNode_ext.cxx index e554bb243c..92b343b972 100644 --- a/panda/src/egg/eggGroupNode_ext.cxx +++ b/panda/src/egg/eggGroupNode_ext.cxx @@ -17,7 +17,7 @@ #ifdef HAVE_PYTHON #ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject Dtool_EggNode; +extern struct Dtool_PyTypedObject Dtool_EggNode; #endif //////////////////////////////////////////////////////////////////// @@ -37,7 +37,7 @@ get_children() const { } // Fill in the list. - int i = 0; + size_t i = 0; for (it = _this->begin(); it != _this->end() && i < len; ++it) { EggNode *node = *it; node->ref(); diff --git a/panda/src/event/Sources.pp b/panda/src/event/Sources.pp index bd3e322d5d..22bf575414 100644 --- a/panda/src/event/Sources.pp +++ b/panda/src/event/Sources.pp @@ -20,7 +20,7 @@ genericAsyncTask.h genericAsyncTask.I \ pointerEvent.I pointerEvent.h \ pointerEventList.I pointerEventList.h \ - pythonTask.h pythonTask.I \ + pythonTask.h pythonTask.I pythonTask.cxx \ event.I event.h eventHandler.h eventHandler.I \ eventParameter.I eventParameter.h \ eventQueue.I eventQueue.h eventReceiver.h \ @@ -38,7 +38,6 @@ genericAsyncTask.cxx \ pointerEvent.cxx \ pointerEventList.cxx \ - pythonTask.cxx \ config_event.cxx event.cxx eventHandler.cxx \ eventParameter.cxx eventQueue.cxx eventReceiver.cxx \ pt_Event.cxx diff --git a/panda/src/event/config_event.cxx b/panda/src/event/config_event.cxx index 1ceaf7572a..aee490825a 100644 --- a/panda/src/event/config_event.cxx +++ b/panda/src/event/config_event.cxx @@ -24,7 +24,6 @@ #include "eventParameter.h" #include "genericAsyncTask.h" #include "pointerEventList.h" -#include "pythonTask.h" #include "dconfig.h" @@ -45,9 +44,6 @@ ConfigureFn(config_event) { EventStoreInt::init_type("EventStoreInt"); EventStoreDouble::init_type("EventStoreDouble"); GenericAsyncTask::init_type(); -#ifdef HAVE_PYTHON - PythonTask::init_type(); -#endif ButtonEventList::register_with_read_factory(); EventStoreInt::register_with_read_factory(); diff --git a/panda/src/event/p3event_composite1.cxx b/panda/src/event/p3event_composite1.cxx index 08165b1800..57cc83159c 100644 --- a/panda/src/event/p3event_composite1.cxx +++ b/panda/src/event/p3event_composite1.cxx @@ -9,4 +9,3 @@ #include "genericAsyncTask.cxx" #include "pointerEvent.cxx" #include "pointerEventList.cxx" -#include "pythonTask.cxx" diff --git a/panda/src/event/pythonTask.cxx b/panda/src/event/pythonTask.cxx index 4ae81b5a1a..53be111dfa 100644 --- a/panda/src/event/pythonTask.cxx +++ b/panda/src/event/pythonTask.cxx @@ -17,12 +17,17 @@ #include "config_event.h" #ifdef HAVE_PYTHON -#include "py_panda.h" +#include "py_panda.h" TypeHandle PythonTask::_type_handle; +Configure(config_pythonTask); +ConfigureFn(config_pythonTask) { + PythonTask::init_type(); +} + #ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject Dtool_TypedReferenceCount; +extern struct Dtool_PyTypedObject Dtool_TypedReferenceCount; #endif //////////////////////////////////////////////////////////////////// diff --git a/panda/src/event/pythonTask.h b/panda/src/event/pythonTask.h index 13874bc317..294af18387 100644 --- a/panda/src/event/pythonTask.h +++ b/panda/src/event/pythonTask.h @@ -25,7 +25,7 @@ // Description : This class exists to allow association of a Python // function with the AsyncTaskManager. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PIPELINE PythonTask : public AsyncTask { +class PythonTask : public AsyncTask { PUBLISHED: PythonTask(PyObject *function = Py_None, const string &name = string()); virtual ~PythonTask(); diff --git a/panda/src/express/multifile.I b/panda/src/express/multifile.I index 35de9b9cc6..f2ddf6b060 100644 --- a/panda/src/express/multifile.I +++ b/panda/src/express/multifile.I @@ -534,51 +534,3 @@ get_last_byte_pos() const { return max(_index_start + (streampos)_index_length, _data_start + (streampos)_data_length) - (streampos)1; } - -#ifdef HAVE_OPENSSL -//////////////////////////////////////////////////////////////////// -// Function: Multifile::CertRecord::Constructor -// Access: Public -// Description: Ownership of the X509 object is passed into the -// CertRecord; it will be freed when the CertRecord -// destructs. -//////////////////////////////////////////////////////////////////// -INLINE Multifile::CertRecord:: -CertRecord(X509 *cert) : - _cert(cert) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: Multifile::CertRecord::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Multifile::CertRecord:: -CertRecord(const Multifile::CertRecord ©) : - _cert(X509_dup(copy._cert)) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: Multifile::CertRecord::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Multifile::CertRecord:: -~CertRecord() { - X509_free(_cert); -} - -//////////////////////////////////////////////////////////////////// -// Function: Multifile::CertRecord::Copy Assignment -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void Multifile::CertRecord:: -operator = (const Multifile::CertRecord &other) { - X509_free(_cert); - _cert = X509_dup(other._cert); -} -#endif - diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 79ad6a4d16..b693e8e5c6 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -604,6 +604,53 @@ update_subfile(const string &subfile_name, const Filename &filename, return name; } +#ifdef HAVE_OPENSSL +//////////////////////////////////////////////////////////////////// +// Function: Multifile::CertRecord::Constructor +// Access: Public +// Description: Ownership of the X509 object is passed into the +// CertRecord; it will be freed when the CertRecord +// destructs. +//////////////////////////////////////////////////////////////////// +Multifile::CertRecord:: +CertRecord(X509 *cert) : + _cert(cert) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: Multifile::CertRecord::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +Multifile::CertRecord:: +CertRecord(const Multifile::CertRecord ©) : + _cert(X509_dup(copy._cert)) +{ +} + +//////////////////////////////////////////////////////////////////// +// Function: Multifile::CertRecord::Destructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +Multifile::CertRecord:: +~CertRecord() { + X509_free(_cert); +} + +//////////////////////////////////////////////////////////////////// +// Function: Multifile::CertRecord::Copy Assignment +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void Multifile::CertRecord:: +operator = (const Multifile::CertRecord &other) { + X509_free(_cert); + _cert = X509_dup(other._cert); +} +#endif // HAVE_OPENSSL + #ifdef HAVE_OPENSSL //////////////////////////////////////////////////////////////////// // Function: Multifile::add_signature diff --git a/panda/src/express/multifile.h b/panda/src/express/multifile.h index 5a90c17be6..b52fc6b825 100644 --- a/panda/src/express/multifile.h +++ b/panda/src/express/multifile.h @@ -84,12 +84,12 @@ PUBLISHED: int compression_level); #ifdef HAVE_OPENSSL - class CertRecord { + class EXPCL_PANDAEXPRESS CertRecord { public: - INLINE CertRecord(X509 *cert); - INLINE CertRecord(const CertRecord ©); - INLINE ~CertRecord(); - INLINE void operator = (const CertRecord &other); + CertRecord(X509 *cert); + CertRecord(const CertRecord ©); + ~CertRecord(); + void operator = (const CertRecord &other); X509 *_cert; }; typedef pvector CertChain; diff --git a/panda/src/express/password_hash.h b/panda/src/express/password_hash.h index 1b07bc93bb..dbaa39fe15 100644 --- a/panda/src/express/password_hash.h +++ b/panda/src/express/password_hash.h @@ -23,8 +23,9 @@ BEGIN_PUBLISH -string password_hash(const string &password, const string &salt, - int iters, int keylen); +EXPCL_PANDAEXPRESS string password_hash(const string &password, + const string &salt, + int iters, int keylen); END_PUBLISH diff --git a/panda/src/express/pointerToArray.I b/panda/src/express/pointerToArray.I index 152276d1ff..c833954570 100644 --- a/panda/src/express/pointerToArray.I +++ b/panda/src/express/pointerToArray.I @@ -39,7 +39,7 @@ PointerToArray(TypeHandle type_handle) : // Description: Return an empty array of size n //////////////////////////////////////////////////////////////////// template -INLINE PointerToArray +INLINE PointerToArray PointerToArray::empty_array(size_type n, TypeHandle type_handle) { PointerToArray temp(type_handle); temp.reassign(new ReferenceCountedVector(type_handle)); @@ -77,129 +77,6 @@ PointerToArray(const PointerToArray ©) : { } -#ifdef HAVE_PYTHON -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::Constructor -// Access: Published -// Description: This special constructor accepts a Python list of -// elements, or a Python string (or a bytes object, -// in Python 3), or any object that supports the -// Python buffer protocol. -//////////////////////////////////////////////////////////////////// -template -PointerToArray:: -PointerToArray(PyObject *self, PyObject *source) : - PointerToArrayBase((ReferenceCountedVector *)NULL), - _type_handle(get_type_handle(Element)) -{ - // We have to pre-initialize self's "this" pointer when we receive - // self in the constructor--the caller can't initialize this for us. - ((Dtool_PyInstDef *)self)->_ptr_to_object = this; - -#if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(source)) { - // User passed a buffer object. - Py_buffer view; - if (PyObject_GetBuffer(source, &view, PyBUF_CONTIG_RO) == -1) { - PyErr_SetString(PyExc_TypeError, "PointerToArray constructor requires a contiguous buffer"); - return; - } - - if (view.itemsize != 1 && view.itemsize != sizeof(Element)) { - PyErr_SetString(PyExc_TypeError, "buffer.itemsize does not match PointerToArray element size"); - return; - } - - int num_elements = view.len / sizeof(Element); - insert(begin(), num_elements, Element()); - - if (view.len > 0) { - memcpy(p(), view.buf, view.len); - } - - PyBuffer_Release(&view); - return; - } -#endif - - if (!PySequence_Check(source)) { - // If passed with a non-sequence, this isn't the right constructor. - PyErr_SetString(PyExc_TypeError, "PointerToArray constructor requires a sequence or buffer object"); - return; - } - - // If we were passed a Python string, then instead of storing it - // character-at-a-time, just load the whole string as a data - // buffer. -#if PY_MAJOR_VERSION >= 3 - if (PyBytes_Check(source)) { - int size = PyBytes_Size(source); - if (size % sizeof(Element) != 0) { - ostringstream stream; - stream << "Buffer not a multiple of " << sizeof(Element) << " bytes"; - string str = stream.str(); - PyErr_SetString(PyExc_ValueError, str.c_str()); - return; - } - - int num_elements = size / sizeof(Element); - insert(begin(), num_elements, Element()); - - // Hope there aren't any constructors or destructors involved - // here. - if (size != 0) { - const char *data = PyBytes_AsString(source); - memcpy(p(), data, size); - } - return; - } -#else - if (PyString_CheckExact(source)) { - int size = PyString_Size(source); - if (size % sizeof(Element) != 0) { - ostringstream stream; - stream << "Buffer not a multiple of " << sizeof(Element) << " bytes"; - string str = stream.str(); - PyErr_SetString(PyExc_ValueError, str.c_str()); - return; - } - - int num_elements = size / sizeof(Element); - insert(begin(), num_elements, Element()); - - // Hope there aren't any constructors or destructors involved - // here. - if (size != 0) { - const char *data = PyString_AsString(source); - memcpy(p(), data, size); - } - return; - } -#endif - - // Now construct the internal list by copying the elements - // one-at-a-time from Python. - int size = PySequence_Size(source); - for (int i = 0; i < size; ++i) { - PyObject *item = PySequence_GetItem(source, i); - if (item == NULL) { - return; - } - PyObject *result = PyObject_CallMethod(self, (char *)"pushBack", (char *)"O", item); - Py_DECREF(item); - if (result == NULL) { - // Unable to add item--probably it wasn't of the appropriate type. - ostringstream stream; - stream << "Element " << i << " in sequence passed to PointerToArray constructor could not be added"; - string str = stream.str(); - PyErr_SetString(PyExc_TypeError, str.c_str()); - return; - } - Py_DECREF(result); - } -} -#endif // HAVE_PYTHON - //////////////////////////////////////////////////////////////////// // Function: PointerToArray::begin // Access: Public @@ -593,31 +470,6 @@ set_element(size_type n, const Element &value) { (*this)[n] = value; } -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::__getitem__ -// Access: Published -// Description: Same as get_element(), this returns the nth element -// of the array. -//////////////////////////////////////////////////////////////////// -template -INLINE const Element &PointerToArray:: -__getitem__(size_type n) const { - return (*this)[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::__setitem__ -// Access: Published -// Description: Same as set_element(), this replaces the nth element -// of the array. -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerToArray:: -__setitem__(size_type n, const Element &value) { - nassertv(n < ((To *)(this->_void_ptr))->size()); - (*this)[n] = value; -} - //////////////////////////////////////////////////////////////////// // Function: PointerToArray::get_data // Access: Published @@ -884,23 +736,6 @@ ConstPointerToArray(const ConstPointerToArray ©) : { } -#ifdef HAVE_PYTHON -//////////////////////////////////////////////////////////////////// -// Function: ConstPointerToArray::Constructor -// Access: Public -// Description: This special constructor accepts a Python list of -// elements, or a Python string (or a bytes object, -// in Python 3). -//////////////////////////////////////////////////////////////////// -template -INLINE ConstPointerToArray:: -ConstPointerToArray(PyObject *self, PyObject *source) : - PointerToArrayBase(PointerToArray(self, source)), - _type_handle(get_type_handle(Element)) -{ -} -#endif // HAVE_PYTHON - //////////////////////////////////////////////////////////////////// // Function: ConstPointerToArray::begin // Access: Public @@ -1158,18 +993,6 @@ get_element(size_type n) const { return (*this)[n]; } -//////////////////////////////////////////////////////////////////// -// Function: ConstPointerToArray::__getitem__ -// Access: Published -// Description: Same as get_element(), this returns the nth element -// of the array. -//////////////////////////////////////////////////////////////////// -template -INLINE const Element &ConstPointerToArray:: -__getitem__(size_type n) const { - return (*this)[n]; -} - //////////////////////////////////////////////////////////////////// // Function: ConstPointerToArray::get_data // Access: Published @@ -1331,150 +1154,4 @@ clear() { ((ConstPointerToArray *)this)->reassign((ReferenceCountedVector *)NULL); } -#ifdef HAVE_PYTHON -#if PY_VERSION_HEX >= 0x02060000 -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::__getbuffer__ -// Access: Published -// Description: This is used to implement the buffer protocol, in -// order to allow efficient access to the array data -// through a Python multiview object. -//////////////////////////////////////////////////////////////////// -template -INLINE int PointerToArray:: -__getbuffer__(PyObject *self, Py_buffer *view, int flags) { - - const char *format = get_format_code(Element); - if (format == NULL) { - // Not supported. - return -1; - } - - if (self != NULL) { - Py_INCREF(self); - } - view->obj = self; - view->buf = (void*) p(); - view->len = size() * sizeof(Element); - view->readonly = 0; - view->itemsize = sizeof(Element); - view->format = NULL; - if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) { - view->format = (char*) format; - } - view->ndim = 1; - view->shape = NULL; - if ((flags & PyBUF_ND) == PyBUF_ND) { - // This leaks, which sucks, but __releasebuffer__ doesn't give us - // the same pointer, so we would need to store it elsewhere if we - // wanted to delete it there. Eh, it's just an int, who cares. - view->shape = new Py_ssize_t(size()); - } - view->strides = NULL; - if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES) { - view->strides = &(view->itemsize); - } - view->suboffsets = NULL; - - // Store a reference to ourselves on the Py_buffer object - // as a reminder that we have increased our refcount. - ref(); - view->internal = (void*) this; - - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerToArray::__releasebuffer__ -// Access: Published -// Description: Releases the buffer allocated by __getbuffer__. -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerToArray:: -__releasebuffer__(PyObject *self, Py_buffer *view) const { - // Note: PyBuffer_Release automatically decrements view->obj. - - if (view->internal != NULL) { - // Oh, right, let's not forget to unref this. - ((const PointerToArray *) view->internal)->unref(); - view->internal = NULL; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: ConstPointerToArray::__getbuffer__ -// Access: Published -// Description: This is used to implement the buffer protocol, in -// order to allow efficient access to the array data -// through a Python multiview object. -//////////////////////////////////////////////////////////////////// -template -INLINE int ConstPointerToArray:: -__getbuffer__(PyObject *self, Py_buffer *view, int flags) const { - - if ((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) { - PyErr_SetString(PyExc_BufferError, - "Object is not writable."); - return -1; - } - - const char *format = get_format_code(Element); - if (format == NULL) { - // Not supported. - return -1; - } - - if (self != NULL) { - Py_INCREF(self); - } - view->obj = self; - view->buf = (void*) p(); - view->len = size() * sizeof(Element); - view->readonly = 1; - view->itemsize = sizeof(Element); - view->format = NULL; - if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) { - view->format = (char*) format; - } - view->ndim = 1; - view->shape = NULL; - if ((flags & PyBUF_ND) == PyBUF_ND) { - // This leaks, which sucks, but __releasebuffer__ doesn't give us - // the same pointer, so we would need to store it elsewhere if we - // wanted to delete it there. Eh, it's just an int, who cares. - view->shape = new Py_ssize_t(size()); - } - view->strides = NULL; - if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES) { - view->strides = &(view->itemsize); - } - view->suboffsets = NULL; - - // Store a reference to ourselves on the Py_buffer object - // as a reminder that we have increased our refcount. - ref(); - view->internal = (void*) this; - - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: ConstPointerToArray::__releasebuffer__ -// Access: Published -// Description: Releases the buffer allocated by __getbuffer__. -//////////////////////////////////////////////////////////////////// -template -INLINE void ConstPointerToArray:: -__releasebuffer__(PyObject *self, Py_buffer *view) const { - // Note: PyBuffer_Release automatically decrements obj->view. - - if (view->internal != NULL) { - // Oh, right, let's not forget to unref this. - ((const PointerToArray *) view->internal)->unref(); - view->internal = NULL; - } -} -#endif // PY_VERSION_HEX -#endif // HAVE_PYTHON - #endif // CPPPARSER diff --git a/panda/src/express/pointerToArray.h b/panda/src/express/pointerToArray.h index c5f545fbd3..78b504d202 100644 --- a/panda/src/express/pointerToArray.h +++ b/panda/src/express/pointerToArray.h @@ -67,9 +67,6 @@ #include "pandabase.h" #include "pointerToArrayBase.h" -#ifdef HAVE_PYTHON -#include "py_panda.h" -#endif #if (defined(WIN32_VC) || defined(WIN64_VC)) && !defined(__INTEL_COMPILER) // disable mysterious MSVC warning for static inline PTA::empty_array method @@ -112,17 +109,15 @@ PUBLISHED: INLINE static PointerToArray empty_array(size_type n, TypeHandle type_handle = get_type_handle(Element)); INLINE PointerToArray(const PointerToArray ©); -#ifdef HAVE_PYTHON - PointerToArray(PyObject *self, PyObject *source); -#endif + EXTENSION(PointerToArray(PyObject *self, PyObject *source)); INLINE size_type size() const; INLINE void push_back(const Element &x); INLINE void pop_back(); INLINE const Element &get_element(size_type n) const; INLINE void set_element(size_type n, const Element &value); - INLINE const Element &__getitem__(size_type n) const; - INLINE void __setitem__(size_type n, const Element &value); + EXTENSION(const Element &__getitem__(size_type n) const); + EXTENSION(void __setitem__(size_type n, const Element &value)); INLINE string get_data() const; INLINE void set_data(const string &data); INLINE string get_subdata(size_type n, size_type count) const; @@ -132,8 +127,8 @@ PUBLISHED: #ifdef HAVE_PYTHON #if PY_VERSION_HEX >= 0x02060000 - int __getbuffer__(PyObject *self, Py_buffer *view, int flags); - void __releasebuffer__(PyObject *self, Py_buffer *view) const; + EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags)); + EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const); #endif #endif @@ -156,10 +151,6 @@ public: INLINE PointerToArray(size_type n, const Element &value, TypeHandle type_handle = get_type_handle(Element)); INLINE PointerToArray(const PointerToArray ©); -#ifdef HAVE_PYTHON - PointerToArray(PyObject *self, PyObject *source); -#endif - public: // Duplicating the interface of vector. The following member // functions are all const, because they do not reassign the @@ -213,8 +204,6 @@ public: // Methods to help out Python and other high-level languages. INLINE const Element &get_element(size_type n) const; INLINE void set_element(size_type n, const Element &value); - INLINE const Element &__getitem__(size_type n) const; - INLINE void __setitem__(size_type n, const Element &value); INLINE string get_data() const; INLINE void set_data(const string &data); INLINE string get_subdata(size_type n, size_type count) const; @@ -237,13 +226,6 @@ public: INLINE void node_ref() const; INLINE bool node_unref() const; -#ifdef HAVE_PYTHON -#if PY_VERSION_HEX >= 0x02060000 - int __getbuffer__(PyObject *self, Py_buffer *view, int flags); - void __releasebuffer__(PyObject *self, Py_buffer *view) const; -#endif -#endif - // Reassignment is by pointer, not memberwise as with a vector. INLINE PointerToArray & operator = (ReferenceCountedVector *ptr); @@ -283,14 +265,12 @@ PUBLISHED: INLINE ConstPointerToArray(const PointerToArray ©); INLINE ConstPointerToArray(const ConstPointerToArray ©); -#ifdef HAVE_PYTHON - INLINE ConstPointerToArray(PyObject *self, PyObject *source); -#endif + EXTENSION(ConstPointerToArray(PyObject *self, PyObject *source)); typedef TYPENAME pvector::size_type size_type; INLINE size_type size() const; INLINE const Element &get_element(size_type n) const; - INLINE const Element &__getitem__(size_type n) const; + EXTENSION(const Element &__getitem__(size_type n) const); INLINE string get_data() const; INLINE string get_subdata(size_type n, size_type count) const; INLINE int get_ref_count() const; @@ -298,8 +278,8 @@ PUBLISHED: #ifdef HAVE_PYTHON #if PY_VERSION_HEX >= 0x02060000 - int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; - void __releasebuffer__(PyObject *self, Py_buffer *view) const; + EXTENSION(int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const); + EXTENSION(void __releasebuffer__(PyObject *self, Py_buffer *view) const); #endif #endif @@ -325,10 +305,6 @@ PUBLISHED: INLINE ConstPointerToArray(const PointerToArray ©); INLINE ConstPointerToArray(const ConstPointerToArray ©); -#ifdef HAVE_PYTHON - INLINE ConstPointerToArray(PyObject *self, PyObject *source); -#endif - // Duplicating the interface of vector. INLINE iterator begin() const; @@ -361,7 +337,6 @@ PUBLISHED: // Methods to help out Python and other high-level languages. INLINE const Element &get_element(size_type n) const; - INLINE const Element &__getitem__(size_type n) const; INLINE string get_data() const; INLINE string get_subdata(size_type n, size_type count) const; @@ -373,13 +348,6 @@ PUBLISHED: INLINE void node_ref() const; INLINE bool node_unref() const; -#ifdef HAVE_PYTHON -#if PY_VERSION_HEX >= 0x02060000 - int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; - void __releasebuffer__(PyObject *self, Py_buffer *view) const; -#endif -#endif - // Reassignment is by pointer, not memberwise as with a vector. INLINE ConstPointerToArray & operator = (ReferenceCountedVector *ptr); @@ -408,36 +376,6 @@ private: #define PTA(type) PointerToArray< type > #define CPTA(type) ConstPointerToArray< type > -#ifdef HAVE_PYTHON -// This macro is used to map a data type to a format code -// as used in the Python 'struct' and 'array' modules. -#define get_format_code(type) _get_format_code((const type *)0) -#define define_format_code(code, type) template<> \ - INLINE const char *_get_format_code(const type *) { \ - return code; \ - } - -template -INLINE const char *_get_format_code(const T *) { - return NULL; -} - -define_format_code("c", char); -define_format_code("b", signed char); -define_format_code("B", unsigned char); -define_format_code("h", short); -define_format_code("H", unsigned short); -define_format_code("i", int); -define_format_code("I", unsigned int); -define_format_code("l", long); -define_format_code("L", unsigned long); -define_format_code("q", long long); -define_format_code("Q", unsigned long long); -define_format_code("f", float); -define_format_code("d", double); - -#endif // HAVE_PYTHON - #include "pointerToArray.I" #endif // HAVE_POINTERTOARRAY_H diff --git a/panda/src/express/pointerToArray_ext.I b/panda/src/express/pointerToArray_ext.I new file mode 100644 index 0000000000..da1f897300 --- /dev/null +++ b/panda/src/express/pointerToArray_ext.I @@ -0,0 +1,326 @@ +// Filename: pointerToArray_ext.I +// Created by: rdb (08Feb15) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__init__ +// Access: Published +// Description: This special constructor accepts a Python list of +// elements, or a Python string (or a bytes object, +// in Python 3), or any object that supports the +// Python buffer protocol. +//////////////////////////////////////////////////////////////////// +template +void Extension >:: +__init__(PyObject *self, PyObject *source) { + // We have to pre-initialize self's "this" pointer when we receive + // self in the constructor--the caller can't initialize this for us. + new (this->_this) PointerToArray(get_type_handle(Element)); + ((Dtool_PyInstDef *)self)->_ptr_to_object = this->_this; + +#if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(source)) { + // User passed a buffer object. + Py_buffer view; + if (PyObject_GetBuffer(source, &view, PyBUF_CONTIG_RO) == -1) { + PyErr_SetString(PyExc_TypeError, "PointerToArray constructor requires a contiguous buffer"); + return; + } + + if (view.itemsize != 1 && view.itemsize != sizeof(Element)) { + PyErr_SetString(PyExc_TypeError, "buffer.itemsize does not match PointerToArray element size"); + return; + } + + int num_elements = view.len / sizeof(Element); + this->_this->insert(this->_this->begin(), num_elements, Element()); + + if (view.len > 0) { + memcpy(this->_this->p(), view.buf, view.len); + } + + PyBuffer_Release(&view); + return; + } +#endif + + if (!PySequence_Check(source)) { + // If passed with a non-sequence, this isn't the right constructor. + PyErr_SetString(PyExc_TypeError, "PointerToArray constructor requires a sequence or buffer object"); + return; + } + + // If we were passed a Python string, then instead of storing it + // character-at-a-time, just load the whole string as a data + // buffer. +#if PY_MAJOR_VERSION >= 3 + if (PyBytes_Check(source)) { + int size = PyBytes_Size(source); + if (size % sizeof(Element) != 0) { + ostringstream stream; + stream << "Buffer not a multiple of " << sizeof(Element) << " bytes"; + string str = stream.str(); + PyErr_SetString(PyExc_ValueError, str.c_str()); + return; + } + + int num_elements = size / sizeof(Element); + this->_this->insert(this->_this->begin(), num_elements, Element()); + + // Hope there aren't any constructors or destructors involved + // here. + if (size != 0) { + const char *data = PyBytes_AsString(source); + memcpy(this->_this->p(), data, size); + } + return; + } +#else + if (PyString_CheckExact(source)) { + int size = PyString_Size(source); + if (size % sizeof(Element) != 0) { + ostringstream stream; + stream << "Buffer not a multiple of " << sizeof(Element) << " bytes"; + string str = stream.str(); + PyErr_SetString(PyExc_ValueError, str.c_str()); + return; + } + + int num_elements = size / sizeof(Element); + this->_this->insert(this->_this->begin(), num_elements, Element()); + + // Hope there aren't any constructors or destructors involved + // here. + if (size != 0) { + const char *data = PyString_AsString(source); + memcpy(this->_this->p(), data, size); + } + return; + } +#endif + + // Now construct the internal list by copying the elements + // one-at-a-time from Python. + int size = PySequence_Size(source); + for (int i = 0; i < size; ++i) { + PyObject *item = PySequence_GetItem(source, i); + if (item == NULL) { + return; + } + PyObject *result = PyObject_CallMethod(self, (char *)"push_back", (char *)"O", item); + Py_DECREF(item); + if (result == NULL) { + // Unable to add item--probably it wasn't of the appropriate type. + ostringstream stream; + stream << "Element " << i << " in sequence passed to PointerToArray constructor could not be added"; + string str = stream.str(); + PyErr_SetString(PyExc_TypeError, str.c_str()); + return; + } + Py_DECREF(result); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__getitem__ +// Access: Published +// Description: Same as get_element(), this returns the nth element +// of the array. +//////////////////////////////////////////////////////////////////// +template +INLINE const Element &Extension >:: +__getitem__(size_t n) const { + return this->_this->get_element(n); +} + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__setitem__ +// Access: Published +// Description: Same as set_element(), this replaces the nth element +// of the array. +//////////////////////////////////////////////////////////////////// +template +INLINE void Extension >:: +__setitem__(size_t n, const Element &value) { + this->_this->set_element(n, value); +} + +//////////////////////////////////////////////////////////////////// +// Function: ConstPointerToArray::__init__ +// Access: Public +// Description: This special constructor accepts a Python list of +// elements, or a Python string (or a bytes object, +// in Python 3). +//////////////////////////////////////////////////////////////////// +template +INLINE void Extension >:: +__init__(PyObject *self, PyObject *source) { + new (this->_this) ConstPointerToArray(get_type_handle(Element)); +} + +//////////////////////////////////////////////////////////////////// +// Function: ConstPointerToArray::__getitem__ +// Access: Published +// Description: Same as get_element(), this returns the nth element +// of the array. +//////////////////////////////////////////////////////////////////// +template +INLINE const Element &Extension >:: +__getitem__(size_t n) const { + return (*this->_this)[n]; +} + +#if PY_VERSION_HEX >= 0x02060000 +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__getbuffer__ +// Access: Published +// Description: This is used to implement the buffer protocol, in +// order to allow efficient access to the array data +// through a Python multiview object. +//////////////////////////////////////////////////////////////////// +template +INLINE int Extension >:: +__getbuffer__(PyObject *self, Py_buffer *view, int flags) { + + const char *format = get_format_code(Element); + if (format == NULL) { + // Not supported. + return -1; + } + + if (self != NULL) { + Py_INCREF(self); + } + view->obj = self; + view->buf = (void*) this->_this->p(); + view->len = this->_this->size() * sizeof(Element); + view->readonly = 0; + view->itemsize = sizeof(Element); + view->format = NULL; + if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) { + view->format = (char*) format; + } + view->ndim = 1; + view->shape = NULL; + if ((flags & PyBUF_ND) == PyBUF_ND) { + // This leaks, which sucks, but __releasebuffer__ doesn't give us + // the same pointer, so we would need to store it elsewhere if we + // wanted to delete it there. Eh, it's just an int, who cares. + view->shape = new Py_ssize_t(this->_this->size()); + } + view->strides = NULL; + if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES) { + view->strides = &(view->itemsize); + } + view->suboffsets = NULL; + + // Store a reference to ourselves on the Py_buffer object + // as a reminder that we have increased our refcount. + this->_this->ref(); + view->internal = (void*) this->_this; + + return 0; +} + +//////////////////////////////////////////////////////////////////// +// Function: PointerToArray::__releasebuffer__ +// Access: Published +// Description: Releases the buffer allocated by __getbuffer__. +//////////////////////////////////////////////////////////////////// +template +INLINE void Extension >:: +__releasebuffer__(PyObject *self, Py_buffer *view) const { + // Note: PyBuffer_Release automatically decrements view->obj. + + if (view->internal != NULL) { + // Oh, right, let's not forget to unref this. + ((const PointerToArray *) view->internal)->unref(); + view->internal = NULL; + } +} + +//////////////////////////////////////////////////////////////////// +// Function: ConstPointerToArray::__getbuffer__ +// Access: Published +// Description: This is used to implement the buffer protocol, in +// order to allow efficient access to the array data +// through a Python multiview object. +//////////////////////////////////////////////////////////////////// +template +INLINE int Extension >:: +__getbuffer__(PyObject *self, Py_buffer *view, int flags) const { + + if ((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) { + PyErr_SetString(PyExc_BufferError, + "Object is not writable."); + return -1; + } + + const char *format = get_format_code(Element); + if (format == NULL) { + // Not supported. + return -1; + } + + if (self != NULL) { + Py_INCREF(self); + } + view->obj = self; + view->buf = (void*) this->_this->p(); + view->len = this->_this->size() * sizeof(Element); + view->readonly = 1; + view->itemsize = sizeof(Element); + view->format = NULL; + if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) { + view->format = (char*) format; + } + view->ndim = 1; + view->shape = NULL; + if ((flags & PyBUF_ND) == PyBUF_ND) { + // This leaks, which sucks, but __releasebuffer__ doesn't give us + // the same pointer, so we would need to store it elsewhere if we + // wanted to delete it there. Eh, it's just an int, who cares. + view->shape = new Py_ssize_t(this->_this->size()); + } + view->strides = NULL; + if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES) { + view->strides = &(view->itemsize); + } + view->suboffsets = NULL; + + // Store a reference to ourselves on the Py_buffer object + // as a reminder that we have increased our refcount. + this->_this->ref(); + view->internal = (void*) this->_this; + + return 0; +} + +//////////////////////////////////////////////////////////////////// +// Function: ConstPointerToArray::__releasebuffer__ +// Access: Published +// Description: Releases the buffer allocated by __getbuffer__. +//////////////////////////////////////////////////////////////////// +template +INLINE void Extension >:: +__releasebuffer__(PyObject *self, Py_buffer *view) const { + // Note: PyBuffer_Release automatically decrements obj->view. + + if (view->internal != NULL) { + // Oh, right, let's not forget to unref this. + ((const PointerToArray *) view->internal)->unref(); + view->internal = NULL; + } +} +#endif // PY_VERSION_HEX diff --git a/panda/src/express/pointerToArray_ext.h b/panda/src/express/pointerToArray_ext.h new file mode 100644 index 0000000000..b403ed4dc6 --- /dev/null +++ b/panda/src/express/pointerToArray_ext.h @@ -0,0 +1,100 @@ +// Filename: pointerToArray_ext.h +// Created by: rdb (08Feb15) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#ifndef POINTERTOARRAY_EXT_H +#define POINTERTOARRAY_EXT_H + +#ifndef CPPPARSER + +#include "extension.h" +#include "py_panda.h" +#include "pointerToArray.h" + +//////////////////////////////////////////////////////////////////// +// Class : Extension +// Description : This class defines the extension methods for +// PointerToArray, which are called instead of +// any C++ methods with the same prototype. +// +// This is a little bit awkward because of the nested +// templating, but it does the job. +//////////////////////////////////////////////////////////////////// +template +class Extension > : public ExtensionBase > { +public: + INLINE void __init__(PyObject *self, PyObject *source); + + INLINE const Element &__getitem__(size_t n) const; + INLINE void __setitem__(size_t n, const Element &value); + +#if PY_VERSION_HEX >= 0x02060000 + INLINE int __getbuffer__(PyObject *self, Py_buffer *view, int flags); + INLINE void __releasebuffer__(PyObject *self, Py_buffer *view) const; +#endif +}; + +//////////////////////////////////////////////////////////////////// +// Class : Extension +// Description : This class defines the extension methods for +// ConstPointerToArray, which are called instead of +// any C++ methods with the same prototype. +// +// This is a little bit awkward because of the nested +// templating, but it does the job. +//////////////////////////////////////////////////////////////////// +template +class Extension > : public ExtensionBase > { +public: + INLINE void __init__(PyObject *self, PyObject *source); + + INLINE const Element &__getitem__(size_t n) const; + +#if PY_VERSION_HEX >= 0x02060000 + INLINE int __getbuffer__(PyObject *self, Py_buffer *view, int flags) const; + INLINE void __releasebuffer__(PyObject *self, Py_buffer *view) const; +#endif +}; + +// This macro is used to map a data type to a format code +// as used in the Python 'struct' and 'array' modules. +#define get_format_code(type) _get_format_code((const type *)0) +#define define_format_code(code, type) template<> \ + INLINE const char *_get_format_code(const type *) { \ + return code; \ + } + +template +INLINE const char *_get_format_code(const T *) { + return NULL; +} + +define_format_code("c", char); +define_format_code("b", signed char); +define_format_code("B", unsigned char); +define_format_code("h", short); +define_format_code("H", unsigned short); +define_format_code("i", int); +define_format_code("I", unsigned int); +define_format_code("l", long); +define_format_code("L", unsigned long); +define_format_code("q", long long); +define_format_code("Q", unsigned long long); +define_format_code("f", float); +define_format_code("d", double); + +#include "pointerToArray_ext.I" + +#endif // CPPPARSER + +#endif // HAVE_POINTERTOARRAY_EXT_H diff --git a/panda/src/express/virtualFileSystem_ext.cxx b/panda/src/express/virtualFileSystem_ext.cxx index 3f1c3f40f8..9de1786987 100644 --- a/panda/src/express/virtualFileSystem_ext.cxx +++ b/panda/src/express/virtualFileSystem_ext.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "virtualFileSystem_ext.h" +#include "vector_uchar.h" #ifdef HAVE_PYTHON @@ -30,7 +31,7 @@ //////////////////////////////////////////////////////////////////// PyObject *Extension:: read_file(const Filename &filename, bool auto_unwrap) const { - pvector pv; + vector_uchar pv; bool okflag = _this->read_file(filename, pv, auto_unwrap); nassertr(okflag, NULL); diff --git a/panda/src/gobj/vertexDataPage.h b/panda/src/gobj/vertexDataPage.h index a6a6e4eafb..7553cdd9f1 100644 --- a/panda/src/gobj/vertexDataPage.h +++ b/panda/src/gobj/vertexDataPage.h @@ -114,7 +114,7 @@ private: typedef pdeque PendingPages; class PageThreadManager; - class PageThread : public Thread { + class EXPCL_PANDA_GOBJ PageThread : public Thread { public: PageThread(PageThreadManager *manager, const string &name); @@ -132,7 +132,7 @@ private: }; typedef pvector PageThreads; - class PageThreadManager : public ReferenceCount { + class EXPCL_PANDA_GOBJ PageThreadManager : public ReferenceCount { public: PageThreadManager(int num_threads); void add_page(VertexDataPage *page, RamClass ram_class); @@ -176,7 +176,7 @@ private: // We build up a temporary linked list of these while deflating // (compressing) the vertex data in-memory. - class DeflatePage { + class EXPCL_PANDA_GOBJ DeflatePage { public: DeflatePage() { _used_size = 0; diff --git a/panda/src/linmath/lpoint2_ext_src.I b/panda/src/linmath/lpoint2_ext_src.I index d6deaa3a8b..3b66477d6d 100644 --- a/panda/src/linmath/lpoint2_ext_src.I +++ b/panda/src/linmath/lpoint2_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -47,6 +41,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { diff --git a/panda/src/linmath/lpoint3_ext_src.I b/panda/src/linmath/lpoint3_ext_src.I index 583c4ff55a..2eaca34737 100644 --- a/panda/src/linmath/lpoint3_ext_src.I +++ b/panda/src/linmath/lpoint3_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -48,6 +42,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { diff --git a/panda/src/linmath/lpoint4_ext_src.I b/panda/src/linmath/lpoint4_ext_src.I index c34af5986e..9a89e56a0a 100644 --- a/panda/src/linmath/lpoint4_ext_src.I +++ b/panda/src/linmath/lpoint4_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -49,6 +43,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { diff --git a/panda/src/linmath/lvecBase2_ext_src.I b/panda/src/linmath/lvecBase2_ext_src.I index 7910b6aec3..2d771a9d0a 100644 --- a/panda/src/linmath/lvecBase2_ext_src.I +++ b/panda/src/linmath/lvecBase2_ext_src.I @@ -12,13 +12,6 @@ // //////////////////////////////////////////////////////////////////// - -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PYNUMBER_FLOATTYPE PyNumber_Long @@ -97,6 +90,12 @@ __reduce__(PyObject *self) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { diff --git a/panda/src/linmath/lvecBase3_ext_src.I b/panda/src/linmath/lvecBase3_ext_src.I index 3e99e9e3e7..438e8ca4ec 100644 --- a/panda/src/linmath/lvecBase3_ext_src.I +++ b/panda/src/linmath/lvecBase3_ext_src.I @@ -12,13 +12,6 @@ // //////////////////////////////////////////////////////////////////// - -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PYNUMBER_FLOATTYPE PyNumber_Long @@ -98,6 +91,12 @@ __reduce__(PyObject *self) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { diff --git a/panda/src/linmath/lvecBase4_ext_src.I b/panda/src/linmath/lvecBase4_ext_src.I index ddb1f71e1d..444ce5f7a2 100644 --- a/panda/src/linmath/lvecBase4_ext_src.I +++ b/panda/src/linmath/lvecBase4_ext_src.I @@ -12,13 +12,6 @@ // //////////////////////////////////////////////////////////////////// - -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PYNUMBER_FLOATTYPE PyNumber_Long @@ -99,6 +92,12 @@ __reduce__(PyObject *self) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVecBase4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { diff --git a/panda/src/linmath/lvector2_ext_src.I b/panda/src/linmath/lvector2_ext_src.I index 3fb1284ddd..42db030bce 100644 --- a/panda/src/linmath/lvector2_ext_src.I +++ b/panda/src/linmath/lvector2_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -47,6 +41,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { diff --git a/panda/src/linmath/lvector3_ext_src.I b/panda/src/linmath/lvector3_ext_src.I index 183e633a76..6aa0897546 100644 --- a/panda/src/linmath/lvector3_ext_src.I +++ b/panda/src/linmath/lvector3_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -48,6 +42,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { diff --git a/panda/src/linmath/lvector4_ext_src.I b/panda/src/linmath/lvector4_ext_src.I index f22510fc49..fa96998001 100644 --- a/panda/src/linmath/lvector4_ext_src.I +++ b/panda/src/linmath/lvector4_ext_src.I @@ -12,12 +12,6 @@ // //////////////////////////////////////////////////////////////////// -#ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); -IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); -#endif - #ifdef FLOATTYPE_IS_INT #if PY_MAJOR_VERSION >= 3 #define PY_FROM_FLOATTYPE PyLong_FromLong @@ -49,6 +43,12 @@ python_repr(ostream &out, const string &class_name) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH PyObject *Extension:: __getattr__(const string &attr_name) const { +#ifndef CPPPARSER + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); + extern struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); +#endif + // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { diff --git a/panda/src/mathutil/config_mathutil.N b/panda/src/mathutil/config_mathutil.N index 491a404161..1c3ec9e9a6 100644 --- a/panda/src/mathutil/config_mathutil.N +++ b/panda/src/mathutil/config_mathutil.N @@ -66,3 +66,5 @@ forcetype PointerToBase > forcetype PointerToArrayBase forcetype PTA_LVecBase2i forcetype CPTA_LVecBase2i + +forceinclude "pointerToArray_ext.h" diff --git a/panda/src/net/connectionManager.h b/panda/src/net/connectionManager.h index 7021842e9e..8a9878a335 100644 --- a/panda/src/net/connectionManager.h +++ b/panda/src/net/connectionManager.h @@ -67,7 +67,7 @@ PUBLISHED: static string get_host_name(); - class Interface { + class EXPCL_PANDA_NET Interface { PUBLISHED: const string &get_name() const { return _name; } const string &get_mac_address() const { return _mac_address; } diff --git a/panda/src/ode/odeGeom_ext.cxx b/panda/src/ode/odeGeom_ext.cxx index c9b2cd5320..6e248f6404 100644 --- a/panda/src/ode/odeGeom_ext.cxx +++ b/panda/src/ode/odeGeom_ext.cxx @@ -31,19 +31,19 @@ #ifdef HAVE_PYTHON #ifndef CPPPARSER -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeBoxGeom; -//extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeConvexGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeHashSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeCappedCylinderGeom; -//extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeHeightfieldGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdePlaneGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeQuadTreeSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeRayGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSimpleSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSphereGeom; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeTriMeshGeom; +extern Dtool_PyTypedObject Dtool_OdeBoxGeom; +//extern Dtool_PyTypedObject Dtool_OdeConvexGeom; +extern Dtool_PyTypedObject Dtool_OdeGeom; +extern Dtool_PyTypedObject Dtool_OdeHashSpace; +extern Dtool_PyTypedObject Dtool_OdeCappedCylinderGeom; +//extern Dtool_PyTypedObject Dtool_OdeHeightfieldGeom; +extern Dtool_PyTypedObject Dtool_OdePlaneGeom; +extern Dtool_PyTypedObject Dtool_OdeQuadTreeSpace; +extern Dtool_PyTypedObject Dtool_OdeRayGeom; +extern Dtool_PyTypedObject Dtool_OdeSimpleSpace; +extern Dtool_PyTypedObject Dtool_OdeSpace; +extern Dtool_PyTypedObject Dtool_OdeSphereGeom; +extern Dtool_PyTypedObject Dtool_OdeTriMeshGeom; #endif //////////////////////////////////////////////////////////////////// diff --git a/panda/src/ode/odeJoint_ext.cxx b/panda/src/ode/odeJoint_ext.cxx index 871eb09c78..93253fec3e 100644 --- a/panda/src/ode/odeJoint_ext.cxx +++ b/panda/src/ode/odeJoint_ext.cxx @@ -30,18 +30,18 @@ #include "odePlane2dJoint.h" #ifndef CPPPARSER -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeBallJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeHingeJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSliderJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeContactJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeUniversalJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeHinge2Joint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeFixedJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeNullJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeAMotorJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeLMotorJoint; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdePlane2dJoint; +extern Dtool_PyTypedObject Dtool_OdeJoint; +extern Dtool_PyTypedObject Dtool_OdeBallJoint; +extern Dtool_PyTypedObject Dtool_OdeHingeJoint; +extern Dtool_PyTypedObject Dtool_OdeSliderJoint; +extern Dtool_PyTypedObject Dtool_OdeContactJoint; +extern Dtool_PyTypedObject Dtool_OdeUniversalJoint; +extern Dtool_PyTypedObject Dtool_OdeHinge2Joint; +extern Dtool_PyTypedObject Dtool_OdeFixedJoint; +extern Dtool_PyTypedObject Dtool_OdeNullJoint; +extern Dtool_PyTypedObject Dtool_OdeAMotorJoint; +extern Dtool_PyTypedObject Dtool_OdeLMotorJoint; +extern Dtool_PyTypedObject Dtool_OdePlane2dJoint; #endif //////////////////////////////////////////////////////////////////// diff --git a/panda/src/ode/odeSpace_ext.cxx b/panda/src/ode/odeSpace_ext.cxx index 8baa7aabb1..78c52a06bf 100644 --- a/panda/src/ode/odeSpace_ext.cxx +++ b/panda/src/ode/odeSpace_ext.cxx @@ -24,10 +24,10 @@ #include "odeQuadTreeSpace.h" #ifndef CPPPARSER -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeHashSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSimpleSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeSpace; -extern EXPCL_PANDAODE Dtool_PyTypedObject Dtool_OdeQuadTreeSpace; +extern Dtool_PyTypedObject Dtool_OdeHashSpace; +extern Dtool_PyTypedObject Dtool_OdeSimpleSpace; +extern Dtool_PyTypedObject Dtool_OdeSpace; +extern Dtool_PyTypedObject Dtool_OdeQuadTreeSpace; #endif PyObject *Extension::_python_callback = NULL; diff --git a/panda/src/parametrics/curveFitter.h b/panda/src/parametrics/curveFitter.h index c5c67138f3..bf6a21c43d 100644 --- a/panda/src/parametrics/curveFitter.h +++ b/panda/src/parametrics/curveFitter.h @@ -32,7 +32,7 @@ class NurbsCurve; // Class : CurveFitter // Description : //////////////////////////////////////////////////////////////////// -class CurveFitter { +class EXPCL_PANDA_GOBJ CurveFitter { PUBLISHED: CurveFitter(); ~CurveFitter(); diff --git a/panda/src/parametrics/hermiteCurve.h b/panda/src/parametrics/hermiteCurve.h index 124913fb23..ea45316f87 100644 --- a/panda/src/parametrics/hermiteCurve.h +++ b/panda/src/parametrics/hermiteCurve.h @@ -49,7 +49,7 @@ END_PUBLISH //] // Description : A single CV of a Hermite curve. Hermite curve CV's // include an in and out tangent, as well as a position. //////////////////////////////////////////////////////////////////// -class HermiteCurveCV { +class EXPCL_PANDA_PARAMETRICS HermiteCurveCV { public: HermiteCurveCV(); HermiteCurveCV(const HermiteCurveCV &c); @@ -85,7 +85,7 @@ public: // list of the CV's that are used to define the curve // (since the CubicCurveseg class doesn't retain these). //////////////////////////////////////////////////////////////////// -class HermiteCurve : public PiecewiseCurve { +class EXPCL_PANDA_PARAMETRICS HermiteCurve : public PiecewiseCurve { PUBLISHED: HermiteCurve(); HermiteCurve(const ParametricCurve &pc); diff --git a/panda/src/pgraph/Sources.pp b/panda/src/pgraph/Sources.pp index 55e210ea99..51e0bdb0fa 100644 --- a/panda/src/pgraph/Sources.pp +++ b/panda/src/pgraph/Sources.pp @@ -73,7 +73,7 @@ nodePath.I nodePath.h nodePath.cxx \ nodePath_ext.I nodePath_ext.h \ nodePathCollection.I nodePathCollection.h \ - nodePathCollection_ext.I nodePathCollection_ext.h \ + nodePathCollection_ext.h \ nodePathComponent.I nodePathComponent.h \ occluderEffect.I occluderEffect.h \ occluderNode.I occluderNode.h \ @@ -112,7 +112,7 @@ weakNodePath.I weakNodePath.h \ workingNodePath.I workingNodePath.h \ nodePath_ext.h nodePath_ext.I \ - nodePathCollection_ext.h nodePathCollection_ext.I \ + nodePathCollection_ext.h \ pandaNode_ext.h \ renderState_ext.h \ transformState_ext.h diff --git a/panda/src/pgraph/nodePathCollection_ext.I b/panda/src/pgraph/nodePathCollection_ext.I deleted file mode 100644 index d88ba08295..0000000000 --- a/panda/src/pgraph/nodePathCollection_ext.I +++ /dev/null @@ -1,51 +0,0 @@ -// Filename: nodePathCollection_ext.I -// Created by: rdb (09Dec13) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef CPPPARSER -#ifdef STDFLOAT_DOUBLE -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint3d; -#else -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint3f; -#endif -#endif - -//////////////////////////////////////////////////////////////////// -// Function: Extension::get_tight_bounds -// Access: Published -// Description: Returns the tight bounds as a 2-tuple of LPoint3 -// objects. This is a convenience function for Python -// users, among which the use of calc_tight_bounds -// may be confusing. -// Returns None if calc_tight_bounds returned false. -//////////////////////////////////////////////////////////////////// -INLINE PyObject *Extension:: -get_tight_bounds() const { - LPoint3 *min_point = new LPoint3; - LPoint3 *max_point = new LPoint3; - - if (_this->calc_tight_bounds(*min_point, *max_point)) { -#ifdef STDFLOAT_DOUBLE - PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3d, true, false); - PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3d, true, false); -#else - PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3f, true, false); - PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3f, true, false); -#endif - return Py_BuildValue("NN", min_inst, max_inst); - - } else { - Py_INCREF(Py_None); - return Py_None; - } -} diff --git a/panda/src/pgraph/nodePathCollection_ext.cxx b/panda/src/pgraph/nodePathCollection_ext.cxx index 324e746d47..7499381320 100644 --- a/panda/src/pgraph/nodePathCollection_ext.cxx +++ b/panda/src/pgraph/nodePathCollection_ext.cxx @@ -16,6 +16,14 @@ #ifdef HAVE_PYTHON +#ifndef CPPPARSER +#ifdef STDFLOAT_DOUBLE +extern struct Dtool_PyTypedObject Dtool_LPoint3d; +#else +extern struct Dtool_PyTypedObject Dtool_LPoint3f; +#endif +#endif + //////////////////////////////////////////////////////////////////// // Function: NodePathCollection::__reduce__ // Access: Published @@ -45,4 +53,34 @@ __reduce__(PyObject *self) const { return result; } +//////////////////////////////////////////////////////////////////// +// Function: Extension::get_tight_bounds +// Access: Published +// Description: Returns the tight bounds as a 2-tuple of LPoint3 +// objects. This is a convenience function for Python +// users, among which the use of calc_tight_bounds +// may be confusing. +// Returns None if calc_tight_bounds returned false. +//////////////////////////////////////////////////////////////////// +PyObject *Extension:: +get_tight_bounds() const { + LPoint3 *min_point = new LPoint3; + LPoint3 *max_point = new LPoint3; + + if (_this->calc_tight_bounds(*min_point, *max_point)) { +#ifdef STDFLOAT_DOUBLE + PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3d, true, false); + PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3d, true, false); +#else + PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3f, true, false); + PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3f, true, false); +#endif + return Py_BuildValue("NN", min_inst, max_inst); + + } else { + Py_INCREF(Py_None); + return Py_None; + } +} + #endif diff --git a/panda/src/pgraph/nodePathCollection_ext.h b/panda/src/pgraph/nodePathCollection_ext.h index 96dc6f9e19..62cee4cc94 100644 --- a/panda/src/pgraph/nodePathCollection_ext.h +++ b/panda/src/pgraph/nodePathCollection_ext.h @@ -34,11 +34,9 @@ class Extension : public ExtensionBase { public: PyObject *__reduce__(PyObject *self) const; - INLINE PyObject *get_tight_bounds() const; + PyObject *get_tight_bounds() const; }; -#include "nodePathCollection_ext.I" - #endif // HAVE_PYTHON #endif // NODEPATHCOLLECTION_EXT_H diff --git a/panda/src/pgraph/nodePath_ext.I b/panda/src/pgraph/nodePath_ext.I index 3888d6f8f2..f40acd26d8 100644 --- a/panda/src/pgraph/nodePath_ext.I +++ b/panda/src/pgraph/nodePath_ext.I @@ -14,14 +14,6 @@ #include "pandaNode_ext.h" -#ifndef CPPPARSER -#ifdef STDFLOAT_DOUBLE -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint3d; -#else -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint3f; -#endif -#endif - //////////////////////////////////////////////////////////////////// // Function: Extension::get_python_tag_keys // Access: Published @@ -167,33 +159,3 @@ INLINE bool Extension:: has_net_python_tag(const string &key) const { return !find_net_python_tag(key).is_empty(); } - -//////////////////////////////////////////////////////////////////// -// Function: Extension::get_tight_bounds -// Access: Published -// Description: Returns the tight bounds as a 2-tuple of LPoint3 -// objects. This is a convenience function for Python -// users, among which the use of calc_tight_bounds -// may be confusing. -// Returns None if calc_tight_bounds returned false. -//////////////////////////////////////////////////////////////////// -INLINE PyObject *Extension:: -get_tight_bounds() const { - LPoint3 *min_point = new LPoint3; - LPoint3 *max_point = new LPoint3; - - if (_this->calc_tight_bounds(*min_point, *max_point)) { -#ifdef STDFLOAT_DOUBLE - PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3d, true, false); - PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3d, true, false); -#else - PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3f, true, false); - PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3f, true, false); -#endif - return Py_BuildValue("NN", min_inst, max_inst); - - } else { - Py_INCREF(Py_None); - return Py_None; - } -} diff --git a/panda/src/pgraph/nodePath_ext.cxx b/panda/src/pgraph/nodePath_ext.cxx index 4192675f1b..b5cc7dbd51 100644 --- a/panda/src/pgraph/nodePath_ext.cxx +++ b/panda/src/pgraph/nodePath_ext.cxx @@ -18,8 +18,13 @@ #ifdef HAVE_PYTHON #ifndef CPPPARSER -extern EXPCL_PANDA_PUTIL Dtool_PyTypedObject Dtool_BamWriter; -extern EXPCL_PANDA_PUTIL Dtool_PyTypedObject Dtool_BamReader; +extern struct Dtool_PyTypedObject Dtool_BamWriter; +extern struct Dtool_PyTypedObject Dtool_BamReader; +#ifdef STDFLOAT_DOUBLE +extern struct Dtool_PyTypedObject Dtool_LPoint3d; +#else +extern struct Dtool_PyTypedObject Dtool_LPoint3f; +#endif #endif // CPPPARSER //////////////////////////////////////////////////////////////////// @@ -53,7 +58,7 @@ __copy__() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: __deepcopy__(PyObject *self, PyObject *memo) const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_NodePath; + extern struct Dtool_PyTypedObject Dtool_NodePath; // Borrowed reference. PyObject *dupe = PyDict_GetItem(memo, self); @@ -228,5 +233,34 @@ py_decode_NodePath_from_bam_stream_persist(PyObject *unpickler, const string &da return NodePath::decode_from_bam_stream(data, reader); } -#endif // HAVE_PYTHON +//////////////////////////////////////////////////////////////////// +// Function: Extension::get_tight_bounds +// Access: Published +// Description: Returns the tight bounds as a 2-tuple of LPoint3 +// objects. This is a convenience function for Python +// users, among which the use of calc_tight_bounds +// may be confusing. +// Returns None if calc_tight_bounds returned false. +//////////////////////////////////////////////////////////////////// +PyObject *Extension:: +get_tight_bounds() const { + LPoint3 *min_point = new LPoint3; + LPoint3 *max_point = new LPoint3; + if (_this->calc_tight_bounds(*min_point, *max_point)) { +#ifdef STDFLOAT_DOUBLE + PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3d, true, false); + PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3d, true, false); +#else + PyObject *min_inst = DTool_CreatePyInstance((void*) min_point, Dtool_LPoint3f, true, false); + PyObject *max_inst = DTool_CreatePyInstance((void*) max_point, Dtool_LPoint3f, true, false); +#endif + return Py_BuildValue("NN", min_inst, max_inst); + + } else { + Py_INCREF(Py_None); + return Py_None; + } +} + +#endif // HAVE_PYTHON diff --git a/panda/src/pgraph/nodePath_ext.h b/panda/src/pgraph/nodePath_ext.h index c91a462bff..00983a9de1 100644 --- a/panda/src/pgraph/nodePath_ext.h +++ b/panda/src/pgraph/nodePath_ext.h @@ -48,7 +48,7 @@ public: INLINE bool has_net_python_tag(const string &key) const; NodePath find_net_python_tag(const string &key) const; - INLINE PyObject *get_tight_bounds() const; + PyObject *get_tight_bounds() const; }; BEGIN_PUBLISH diff --git a/panda/src/pgraph/pandaNode_ext.cxx b/panda/src/pgraph/pandaNode_ext.cxx index 515b704574..df251cba44 100644 --- a/panda/src/pgraph/pandaNode_ext.cxx +++ b/panda/src/pgraph/pandaNode_ext.cxx @@ -53,7 +53,7 @@ __copy__() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: __deepcopy__(PyObject *self, PyObject *memo) const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_PandaNode; + extern struct Dtool_PyTypedObject Dtool_PandaNode; // Borrowed reference. PyObject *dupe = PyDict_GetItem(memo, self); diff --git a/panda/src/pgraph/renderState_ext.cxx b/panda/src/pgraph/renderState_ext.cxx index 70b214fbb3..3238677bd0 100644 --- a/panda/src/pgraph/renderState_ext.cxx +++ b/panda/src/pgraph/renderState_ext.cxx @@ -32,7 +32,7 @@ //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_composition_cache() const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_RenderState; + extern struct Dtool_PyTypedObject Dtool_RenderState; LightReMutexHolder holder(*RenderState::_states_lock); size_t cache_size = _this->_composition_cache.get_size(); PyObject *list = PyList_New(cache_size); @@ -90,7 +90,7 @@ get_composition_cache() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_invert_composition_cache() const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_RenderState; + extern struct Dtool_PyTypedObject Dtool_RenderState; LightReMutexHolder holder(*RenderState::_states_lock); size_t cache_size = _this->_invert_composition_cache.get_size(); PyObject *list = PyList_New(cache_size); @@ -141,7 +141,7 @@ get_invert_composition_cache() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_states() { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_RenderState; + extern struct Dtool_PyTypedObject Dtool_RenderState; if (RenderState::_states == (RenderState::States *)NULL) { return PyList_New(0); } diff --git a/panda/src/pgraph/transformState_ext.cxx b/panda/src/pgraph/transformState_ext.cxx index c66fd87943..a657df7fae 100644 --- a/panda/src/pgraph/transformState_ext.cxx +++ b/panda/src/pgraph/transformState_ext.cxx @@ -32,7 +32,7 @@ //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_composition_cache() const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_TransformState; + extern struct Dtool_PyTypedObject Dtool_TransformState; LightReMutexHolder holder(*_this->_states_lock); size_t num_states = _this->_composition_cache.get_num_entries(); @@ -94,7 +94,7 @@ get_composition_cache() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_invert_composition_cache() const { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_TransformState; + extern struct Dtool_PyTypedObject Dtool_TransformState; LightReMutexHolder holder(*_this->_states_lock); size_t num_states = _this->_invert_composition_cache.get_num_entries(); @@ -149,7 +149,7 @@ get_invert_composition_cache() const { //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_states() { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_TransformState; + extern struct Dtool_PyTypedObject Dtool_TransformState; if (TransformState::_states == (TransformState::States *)NULL) { return PyList_New(0); } @@ -186,7 +186,7 @@ get_states() { //////////////////////////////////////////////////////////////////// PyObject *Extension:: get_unused_states() { - IMPORT_THIS struct Dtool_PyTypedObject Dtool_TransformState; + extern struct Dtool_PyTypedObject Dtool_TransformState; if (TransformState::_states == (TransformState::States *)NULL) { return PyList_New(0); } diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index 2e49eb0f01..9e76063177 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -86,35 +86,35 @@ reset_register_allocator() { // Access: Protected // Description: Allocate a vreg. //////////////////////////////////////////////////////////////////// -INLINE char *ShaderGenerator:: +const char *ShaderGenerator:: alloc_vreg() { switch (_vtregs_used) { - case 0: _vtregs_used += 1; return (char*)"TEXCOORD0"; - case 1: _vtregs_used += 1; return (char*)"TEXCOORD1"; - case 2: _vtregs_used += 1; return (char*)"TEXCOORD2"; - case 3: _vtregs_used += 1; return (char*)"TEXCOORD3"; - case 4: _vtregs_used += 1; return (char*)"TEXCOORD4"; - case 5: _vtregs_used += 1; return (char*)"TEXCOORD5"; - case 6: _vtregs_used += 1; return (char*)"TEXCOORD6"; - case 7: _vtregs_used += 1; return (char*)"TEXCOORD7"; + case 0: _vtregs_used += 1; return "TEXCOORD0"; + case 1: _vtregs_used += 1; return "TEXCOORD1"; + case 2: _vtregs_used += 1; return "TEXCOORD2"; + case 3: _vtregs_used += 1; return "TEXCOORD3"; + case 4: _vtregs_used += 1; return "TEXCOORD4"; + case 5: _vtregs_used += 1; return "TEXCOORD5"; + case 6: _vtregs_used += 1; return "TEXCOORD6"; + case 7: _vtregs_used += 1; return "TEXCOORD7"; } switch (_vcregs_used) { - case 0: _vcregs_used += 1; return (char*)"COLOR0"; - case 1: _vcregs_used += 1; return (char*)"COLOR1"; + case 0: _vcregs_used += 1; return "COLOR0"; + case 1: _vcregs_used += 1; return "COLOR1"; } // These don't exist in arbvp1, though they're reportedly // supported by other profiles. switch (_vtregs_used) { - case 8: _vtregs_used += 1; return (char*)"TEXCOORD8"; - case 9: _vtregs_used += 1; return (char*)"TEXCOORD9"; - case 10: _vtregs_used += 1; return (char*)"TEXCOORD10"; - case 11: _vtregs_used += 1; return (char*)"TEXCOORD11"; - case 12: _vtregs_used += 1; return (char*)"TEXCOORD12"; - case 13: _vtregs_used += 1; return (char*)"TEXCOORD13"; - case 14: _vtregs_used += 1; return (char*)"TEXCOORD14"; - case 15: _vtregs_used += 1; return (char*)"TEXCOORD15"; + case 8: _vtregs_used += 1; return "TEXCOORD8"; + case 9: _vtregs_used += 1; return "TEXCOORD9"; + case 10: _vtregs_used += 1; return "TEXCOORD10"; + case 11: _vtregs_used += 1; return "TEXCOORD11"; + case 12: _vtregs_used += 1; return "TEXCOORD12"; + case 13: _vtregs_used += 1; return "TEXCOORD13"; + case 14: _vtregs_used += 1; return "TEXCOORD14"; + case 15: _vtregs_used += 1; return "TEXCOORD15"; } - return (char*)"UNKNOWN"; + return "UNKNOWN"; } //////////////////////////////////////////////////////////////////// @@ -122,37 +122,37 @@ alloc_vreg() { // Access: Protected // Description: Allocate a freg. //////////////////////////////////////////////////////////////////// -INLINE char *ShaderGenerator:: +const char *ShaderGenerator:: alloc_freg() { switch (_ftregs_used) { - case 0: _ftregs_used += 1; return (char*)"TEXCOORD0"; - case 1: _ftregs_used += 1; return (char*)"TEXCOORD1"; - case 2: _ftregs_used += 1; return (char*)"TEXCOORD2"; - case 3: _ftregs_used += 1; return (char*)"TEXCOORD3"; - case 4: _ftregs_used += 1; return (char*)"TEXCOORD4"; - case 5: _ftregs_used += 1; return (char*)"TEXCOORD5"; - case 6: _ftregs_used += 1; return (char*)"TEXCOORD6"; - case 7: _ftregs_used += 1; return (char*)"TEXCOORD7"; + case 0: _ftregs_used += 1; return "TEXCOORD0"; + case 1: _ftregs_used += 1; return "TEXCOORD1"; + case 2: _ftregs_used += 1; return "TEXCOORD2"; + case 3: _ftregs_used += 1; return "TEXCOORD3"; + case 4: _ftregs_used += 1; return "TEXCOORD4"; + case 5: _ftregs_used += 1; return "TEXCOORD5"; + case 6: _ftregs_used += 1; return "TEXCOORD6"; + case 7: _ftregs_used += 1; return "TEXCOORD7"; } // We really shouldn't rely on COLOR fregs, // since the clamping can have unexpected side-effects. //switch (_fcregs_used) { - //case 0: _fcregs_used += 1; return (char*)"COLOR0"; - //case 1: _fcregs_used += 1; return (char*)"COLOR1"; + //case 0: _fcregs_used += 1; return "COLOR0"; + //case 1: _fcregs_used += 1; return "COLOR1"; //} // These don't exist in arbvp1/arbfp1, though they're // reportedly supported by other profiles. switch (_ftregs_used) { - case 8: _ftregs_used += 1; return (char*)"TEXCOORD8"; - case 9: _ftregs_used += 1; return (char*)"TEXCOORD9"; - case 10: _ftregs_used += 1; return (char*)"TEXCOORD10"; - case 11: _ftregs_used += 1; return (char*)"TEXCOORD11"; - case 12: _ftregs_used += 1; return (char*)"TEXCOORD12"; - case 13: _ftregs_used += 1; return (char*)"TEXCOORD13"; - case 14: _ftregs_used += 1; return (char*)"TEXCOORD14"; - case 15: _ftregs_used += 1; return (char*)"TEXCOORD15"; + case 8: _ftregs_used += 1; return "TEXCOORD8"; + case 9: _ftregs_used += 1; return "TEXCOORD9"; + case 10: _ftregs_used += 1; return "TEXCOORD10"; + case 11: _ftregs_used += 1; return "TEXCOORD11"; + case 12: _ftregs_used += 1; return "TEXCOORD12"; + case 13: _ftregs_used += 1; return "TEXCOORD13"; + case 14: _ftregs_used += 1; return "TEXCOORD14"; + case 15: _ftregs_used += 1; return "TEXCOORD15"; } - return (char*)"UNKNOWN"; + return "UNKNOWN"; } //////////////////////////////////////////////////////////////////// @@ -624,18 +624,18 @@ synthesize_shader(const RenderState *rs) { // These variables will hold the results of register allocation. - char *tangent_freg = 0; - char *binormal_freg = 0; + const char *tangent_freg = 0; + const char *binormal_freg = 0; string tangent_input; string binormal_input; - pmap texcoord_fregs; - pvector dlightcoord_fregs; - pvector slightcoord_fregs; - char *world_position_freg = 0; - char *world_normal_freg = 0; - char *eye_position_freg = 0; - char *eye_normal_freg = 0; - char *hpos_freg = 0; + pmap texcoord_fregs; + pvector dlightcoord_fregs; + pvector slightcoord_fregs; + const char *world_position_freg = 0; + const char *world_normal_freg = 0; + const char *eye_position_freg = 0; + const char *eye_normal_freg = 0; + const char *hpos_freg = 0; if (_vertex_colors) { // Reserve COLOR0 @@ -662,7 +662,7 @@ synthesize_shader(const RenderState *rs) { const InternalName *texcoord_name = stage->get_texcoord_name(); if (texcoord_fregs.count(texcoord_name) == 0) { - char *freg = alloc_freg(); + const char *freg = alloc_freg(); string tcname = texcoord_name->join("_"); texcoord_fregs[texcoord_name] = freg; @@ -774,7 +774,7 @@ synthesize_shader(const RenderState *rs) { text << "\t l_eye_normal.xyz = mul((float3x3)tpose_view_to_model, vtx_normal);\n"; text << "\t l_eye_normal.w = 0;\n"; } - pmap::const_iterator it; + pmap::const_iterator it; for (it = texcoord_fregs.begin(); it != texcoord_fregs.end(); ++it) { // Pass through all texcoord inputs as-is. string tcname = it->first->join("_"); diff --git a/panda/src/pgraphnodes/shaderGenerator.h b/panda/src/pgraphnodes/shaderGenerator.h index 9028149e92..9a4aa05857 100644 --- a/panda/src/pgraphnodes/shaderGenerator.h +++ b/panda/src/pgraphnodes/shaderGenerator.h @@ -85,8 +85,8 @@ protected: int _vtregs_used; int _ftregs_used; void reset_register_allocator(); - char *alloc_vreg(); - char *alloc_freg(); + const char *alloc_vreg(); + const char *alloc_freg(); // RenderState analysis information. Created by analyze_renderstate: diff --git a/panda/src/pnmimage/pfmFile_ext.cxx b/panda/src/pnmimage/pfmFile_ext.cxx index c28ed79b57..29b5949f75 100644 --- a/panda/src/pnmimage/pfmFile_ext.cxx +++ b/panda/src/pnmimage/pfmFile_ext.cxx @@ -17,9 +17,9 @@ #ifdef HAVE_PYTHON #ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint2f; -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint3f; -IMPORT_THIS struct Dtool_PyTypedObject Dtool_LPoint4f; +extern struct Dtool_PyTypedObject Dtool_LPoint2f; +extern struct Dtool_PyTypedObject Dtool_LPoint3f; +extern struct Dtool_PyTypedObject Dtool_LPoint4f; #endif //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimage/pnmImageHeader.h b/panda/src/pnmimage/pnmImageHeader.h index 7ae5920a82..d5e6db3b9c 100644 --- a/panda/src/pnmimage/pnmImageHeader.h +++ b/panda/src/pnmimage/pnmImageHeader.h @@ -106,7 +106,7 @@ PUBLISHED: // Contains a single pixel specification used in compute_histogram() // and make_histogram(). Note that pixels are stored by integer // value, not by floating-point scaled value. - class PixelSpec { + class EXPCL_PANDA_PNMIMAGE PixelSpec { PUBLISHED: INLINE PixelSpec(xelval gray_value); INLINE PixelSpec(xelval gray_value, xelval alpha); @@ -143,7 +143,7 @@ PUBLISHED: // Associates a pixel specification with an appearance count, for // use in Histogram, below. - class PixelSpecCount { + class EXPCL_PANDA_PNMIMAGE PixelSpecCount { public: INLINE PixelSpecCount(const PixelSpec &pixel, int count); INLINE bool operator < (const PixelSpecCount &other) const; @@ -157,7 +157,7 @@ PUBLISHED: typedef pvector Palette; // Used to return a pixel histogram in PNMImage::get_histogram(). - class Histogram { + class EXPCL_PANDA_PNMIMAGE Histogram { PUBLISHED: INLINE Histogram(); diff --git a/panda/src/putil/Sources.pp b/panda/src/putil/Sources.pp index e36adb2670..7dc82eb5f4 100644 --- a/panda/src/putil/Sources.pp +++ b/panda/src/putil/Sources.pp @@ -61,6 +61,7 @@ pbitops.I pbitops.h \ portalMask.h \ pta_ushort.h \ + pythonCallbackObject.cxx \ pythonCallbackObject.h pythonCallbackObject.I \ simpleHashMap.I simpleHashMap.h \ sparseArray.I sparseArray.h \ @@ -111,7 +112,6 @@ paramValue.cxx \ pbitops.cxx \ pta_ushort.cxx \ - pythonCallbackObject.cxx \ simpleHashMap.cxx \ sparseArray.cxx \ timedCycle.cxx typedWritable.cxx \ diff --git a/panda/src/putil/bitMask.h b/panda/src/putil/bitMask.h index 1c9d27cf2c..95c8ea0a6e 100644 --- a/panda/src/putil/bitMask.h +++ b/panda/src/putil/bitMask.h @@ -159,8 +159,12 @@ INLINE ostream &operator << (ostream &out, const BitMask &bitmask) // We need to define this temporary macro so we can pass a parameter // containing a comma through the macro. +#define BITMASK16_DEF BitMask #define BITMASK32_DEF BitMask +#define BITMASK64_DEF BitMask +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, BITMASK16_DEF); EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, BITMASK32_DEF); +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, BITMASK64_DEF); typedef BitMask BitMask16; typedef BitMask BitMask32; diff --git a/panda/src/putil/config_util.N b/panda/src/putil/config_util.N index 18bd636362..eb48a5c511 100644 --- a/panda/src/putil/config_util.N +++ b/panda/src/putil/config_util.N @@ -14,3 +14,6 @@ forcetype PointerToBase > forcetype PointerToArrayBase forcetype PTA_ushort forcetype CPTA_ushort + +# This is so the extensions for PTA_ushort are made available. +forceinclude "pointerToArray_ext.h" diff --git a/panda/src/putil/config_util.cxx b/panda/src/putil/config_util.cxx index a6ef2bcb70..ea690e423b 100644 --- a/panda/src/putil/config_util.cxx +++ b/panda/src/putil/config_util.cxx @@ -35,7 +35,6 @@ #include "namable.h" #include "nodeCachedReferenceCount.h" #include "paramValue.h" -#include "pythonCallbackObject.h" #include "referenceCount.h" #include "sparseArray.h" #include "typedObject.h" @@ -216,9 +215,6 @@ init_libputil() { ParamVecBase4d::init_type("ParamVecBase4d"); ParamVecBase4i::init_type("ParamVecBase4i"); ParamWstring::init_type("ParamWstring"); -#ifdef HAVE_PYTHON - PythonCallbackObject::init_type(); -#endif QuadBitMaskNative::init_type(); ReferenceCount::init_type(); SparseArray::init_type(); diff --git a/panda/src/putil/doubleBitMask.h b/panda/src/putil/doubleBitMask.h index bed4fa19ef..2e9b768428 100644 --- a/panda/src/putil/doubleBitMask.h +++ b/panda/src/putil/doubleBitMask.h @@ -34,7 +34,7 @@ public: typedef BMType BitMaskType; typedef TYPENAME BMType::WordType WordType; #ifndef CPPPARSER // interrogate has a problem with these lines. - enum { + enum { half_bits = BitMaskType::num_bits, num_bits = BitMaskType::num_bits * 2, }; @@ -142,7 +142,10 @@ INLINE ostream &operator << (ostream &out, const DoubleBitMask &doubleBi return out; } +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, DoubleBitMask); typedef DoubleBitMask DoubleBitMaskNative; + +EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, DoubleBitMask); typedef DoubleBitMask QuadBitMaskNative; // Tell GCC that we'll take care of the instantiation explicitly here. diff --git a/panda/src/putil/p3putil_composite2.cxx b/panda/src/putil/p3putil_composite2.cxx index bb0b5fea5a..36c9062c16 100644 --- a/panda/src/putil/p3putil_composite2.cxx +++ b/panda/src/putil/p3putil_composite2.cxx @@ -15,7 +15,6 @@ #include "paramValue.cxx" #include "pbitops.cxx" #include "pta_ushort.cxx" -#include "pythonCallbackObject.cxx" #include "simpleHashMap.cxx" #include "sparseArray.cxx" #include "timedCycle.cxx" diff --git a/panda/src/putil/pythonCallbackObject.cxx b/panda/src/putil/pythonCallbackObject.cxx index 1160877901..48b0bbbbe3 100644 --- a/panda/src/putil/pythonCallbackObject.cxx +++ b/panda/src/putil/pythonCallbackObject.cxx @@ -15,15 +15,21 @@ #include "pythonCallbackObject.h" #ifdef HAVE_PYTHON -#include "py_panda.h" + +#include "py_panda.h" #include "thread.h" #include "callbackData.h" #include "config_util.h" TypeHandle PythonCallbackObject::_type_handle; +Configure(config_pythonCallbackObject); +ConfigureFn(config_pythonCallbackObject) { + PythonCallbackObject::init_type(); +} + #ifndef CPPPARSER -IMPORT_THIS struct Dtool_PyTypedObject Dtool_TypedObject; +extern struct Dtool_PyTypedObject Dtool_TypedObject; #endif //////////////////////////////////////////////////////////////////// @@ -126,13 +132,13 @@ do_python_callback(CallbackData *cbdata) { // Wrap the cbdata up in a Python object, then put it in a tuple, // for the argument list. - PyObject *pycbdata = + PyObject *pycbdata = DTool_CreatePyInstanceTyped(cbdata, Dtool_TypedObject, false, false, cbdata->get_type_index()); PyObject *args = Py_BuildValue("(O)", pycbdata); Py_DECREF(pycbdata); - PyObject *result = + PyObject *result = Thread::get_current_thread()->call_python_func(_function, args); Py_DECREF(args); diff --git a/panda/src/putil/pythonCallbackObject.h b/panda/src/putil/pythonCallbackObject.h index 4e1c03889f..44e45ab19d 100644 --- a/panda/src/putil/pythonCallbackObject.h +++ b/panda/src/putil/pythonCallbackObject.h @@ -28,7 +28,7 @@ // a callback to directly call an arbitarary Python // function. Powerful! But use with caution. //////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_PUTIL PythonCallbackObject : public CallbackObject { +class PythonCallbackObject : public CallbackObject { PUBLISHED: PythonCallbackObject(PyObject *function = Py_None); virtual ~PythonCallbackObject(); diff --git a/panda/src/text/config_text.h b/panda/src/text/config_text.h index fb0a0f674c..279f05d083 100644 --- a/panda/src/text/config_text.h +++ b/panda/src/text/config_text.h @@ -36,9 +36,9 @@ extern ConfigVariableInt text_texture_margin; extern ConfigVariableDouble text_poly_margin; extern ConfigVariableInt text_page_size; extern ConfigVariableBool text_small_caps; -extern ConfigVariableDouble text_small_caps_scale; +extern EXPCL_PANDA_TEXT ConfigVariableDouble text_small_caps_scale; extern ConfigVariableFilename text_default_font; -extern ConfigVariableDouble text_tab_width; +extern EXPCL_PANDA_TEXT ConfigVariableDouble text_tab_width; extern ConfigVariableInt text_push_properties_key; extern ConfigVariableInt text_pop_properties_key; extern ConfigVariableInt text_soft_hyphen_key; @@ -48,7 +48,7 @@ extern wstring get_text_soft_hyphen_output(); extern ConfigVariableDouble text_hyphen_ratio; extern wstring get_text_never_break_before(); extern ConfigVariableInt text_max_never_break; -extern ConfigVariableDouble text_default_underscore_height; +extern EXPCL_PANDA_TEXT ConfigVariableDouble text_default_underscore_height; extern ConfigVariableEnum text_minfilter; extern ConfigVariableEnum text_magfilter;