diff --git a/direct/src/directscripts/Doxyfile.python b/direct/src/directscripts/Doxyfile.python index 81b68dc6b2..4bcfb58727 100644 --- a/direct/src/directscripts/Doxyfile.python +++ b/direct/src/directscripts/Doxyfile.python @@ -760,13 +760,13 @@ STRIP_CODE_COMMENTS = YES # then for each documented function all documented # functions referencing it will be listed. -REFERENCED_BY_RELATION = YES +REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. -REFERENCES_RELATION = YES +REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from diff --git a/direct/src/directscripts/extract_docs.py b/direct/src/directscripts/extract_docs.py index 2f76ed4a53..b6bb06bfeb 100644 --- a/direct/src/directscripts/extract_docs.py +++ b/direct/src/directscripts/extract_docs.py @@ -30,6 +30,7 @@ def comment(code): if empty_line: # New paragraph. comment += '\n\n' + empty_line = False elif comment: comment += '\n' comment += '/// ' + line @@ -56,15 +57,29 @@ def block_comment(code): line = line.rstrip() strline = line.lstrip('/ \t') - if reading_desc: - newlines.append('/// ' + line[min(indent, len(line) - len(strline)):]) - else: - # A "Description:" text starts the description. - if strline.startswith("Description"): - strline = strline[11:].lstrip(': \t') - indent = len(line) - len(strline) - reading_desc = True - newlines.append('/// ' + strline) + + if ':' in strline: + pre, post = strline.split(':', 1) + pre = pre.rstrip() + if pre == "Description": + strline = post.lstrip() + elif pre in ("Class", "Access", "Function", "Created by", "Enum"): + continue + + if strline or len(newlines) > 0: + newlines.append('/// ' + strline) + + #if reading_desc: + # newlines.append('/// ' + line[min(indent, len(line) - len(strline)):]) + #else: + # # A "Description:" text starts the description. + # if strline.startswith("Description"): + # strline = strline[11:].lstrip(': \t') + # indent = len(line) - len(strline) + # reading_desc = True + # newlines.append('/// ' + strline) + # else: + # print line newcode = '\n'.join(newlines) if len(newcode) > 0: @@ -73,6 +88,9 @@ def block_comment(code): return "" def translateFunctionName(name): + if name.startswith("__"): + return name + new = "" for i in name.split("_"): if new == "": @@ -85,32 +103,58 @@ def translateFunctionName(name): new += i[0].upper() + i[1:] return new -def translated_type_name(type): +def translateTypeName(name, mangle=True): + # Equivalent to C++ classNameFromCppName + class_name = "" + bad_chars = "!@#$%^&*()<>,.-=+~{}? " + next_cap = False + first_char = mangle + + for chr in name: + if (chr == '_' or chr == ' ') and mangle: + next_cap = True + elif chr in bad_chars: + if not mangle: + class_name += '_' + elif next_cap or first_char: + class_name += chr.upper() + next_cap = False + first_char = False + else: + class_name += chr + + return class_name + +def translated_type_name(type, scoped=True): + while interrogate_type_is_wrapped(type): + if interrogate_type_is_const(type): + return 'const ' + translated_type_name(interrogate_type_wrapped_type(type)) + else: + type = interrogate_type_wrapped_type(type) + + typename = interrogate_type_name(type) + if typename in ("PyObject", "_object"): + return "object" + if interrogate_type_is_atomic(type): token = interrogate_type_atomic_token(type) if token == 7: return 'str' + else: + return typename - typename = interrogate_type_name(type) - typename = typename.replace("< ", "").replace(" >", "") - return typename + typename = translateTypeName(typename) -def translateTypeSpec(name): - name = name.strip("* ") - name = name.replace("BitMask< unsigned int, 32 >", "BitMask32") - name = name.replace("atomic ", "") - name = name.replace("< ", "").replace(" >", "") - if name == '_object': - name = 'object' - elif name == '_typeobject': - name = 'type' - return name + if scoped and interrogate_type_is_nested(type): + return translated_type_name(interrogate_type_outer_class(type)) + '::' + typename + else: + return typename def processElement(handle, element): if interrogate_element_has_comment(element): print >>handle, comment(interrogate_element_comment(element)) - print >>handle, translateTypeSpec(translated_type_name(interrogate_element_type(element))), + print >>handle, translated_type_name(interrogate_element_type(element)), print >>handle, interrogate_element_name(element) + ';' def processFunction(handle, function, isConstructor = False): @@ -120,11 +164,12 @@ def processFunction(handle, function, isConstructor = False): print >>handle, block_comment(interrogate_wrapper_comment(wrapper)) if not isConstructor: - if not interrogate_wrapper_number_of_parameters(wrapper) > 0 or not interrogate_wrapper_parameter_is_this(wrapper, 0): - print >>handle, "static", + if interrogate_function_is_method(function): + if not interrogate_wrapper_number_of_parameters(wrapper) > 0 or not interrogate_wrapper_parameter_is_this(wrapper, 0): + print >>handle, "static", if interrogate_wrapper_has_return_value(wrapper): - print >>handle, translateTypeSpec(translated_type_name(interrogate_wrapper_return_type(wrapper))), + print >>handle, translated_type_name(interrogate_wrapper_return_type(wrapper)), else: pass#print >>handle, "void", @@ -137,7 +182,7 @@ def processFunction(handle, function, isConstructor = False): if not interrogate_wrapper_parameter_is_this(wrapper, i_param): if not first: print >>handle, ",", - print >>handle, translateTypeSpec(translated_type_name(interrogate_wrapper_parameter_type(wrapper, i_param))), + print >>handle, translated_type_name(interrogate_wrapper_parameter_type(wrapper, i_param)), if interrogate_wrapper_parameter_has_name(wrapper, i_param): print >>handle, interrogate_wrapper_parameter_name(wrapper, i_param), first = False @@ -145,7 +190,7 @@ def processFunction(handle, function, isConstructor = False): print >>handle, ");" def processType(handle, type): - typename = translated_type_name(type) + typename = translated_type_name(type, scoped=False) derivations = [ translated_type_name(interrogate_type_get_derivation(type, n)) for n in range(interrogate_type_number_of_derivations(type)) ] if interrogate_type_has_comment(type): @@ -157,7 +202,7 @@ def processType(handle, type): docstring = comment(interrogate_type_enum_value_comment(type, i_value)) if docstring: print >>handle, docstring - print >>handle, translateFunctionName(interrogate_type_enum_value_name(type, i_value)), "=", interrogate_type_enum_value(type, i_value), "," + print >>handle, interrogate_type_enum_value_name(type, i_value), "=", interrogate_type_enum_value(type, i_value), "," else: if interrogate_type_is_struct(type): classtype = "struct" @@ -192,38 +237,54 @@ def processType(handle, type): print >>handle, "};" +def processModule(handle, package): + print >>handle, "namespace %s {" % package + + if package != "core": + print >>handle, "using namespace core;" + + for i_type in xrange(interrogate_number_of_global_types()): + type = interrogate_get_global_type(i_type) + + if interrogate_type_has_module_name(type): + module_name = interrogate_type_module_name(type) + if "panda3d." + package == module_name: + processType(handle, type) + else: + print "Type %s has no module name" % typename + + for i_func in xrange(interrogate_number_of_global_functions()): + func = interrogate_get_global_function(i_func) + + if interrogate_function_has_module_name(func): + module_name = interrogate_function_module_name(func) + if "panda3d." + package == module_name: + processFunction(handle, func) + else: + print "Type %s has no module name" % typename + + print >>handle, "}" + + if __name__ == "__main__": handle = open("pandadoc.hpp", "w") print >>handle, comment("Panda3D modules that are implemented in C++.") - print >>handle, "namespace panda3d {}" + print >>handle, "namespace panda3d {" # Determine the path to the interrogatedb files interrogate_add_search_directory(os.path.join(os.path.dirname(pandac.__file__), "..", "..", "etc")) interrogate_add_search_directory(os.path.join(os.path.dirname(pandac.__file__), "input")) import panda3d.core + processModule(handle, "core") for lib in os.listdir(os.path.dirname(panda3d.__file__)): if lib.endswith(('.pyd', '.so')) and not lib.startswith('core.'): - __import__('panda3d.' + os.path.splitext(lib)[0]) + module_name = os.path.splitext(lib)[0] + __import__("panda3d." + module_name) + processModule(handle, module_name) - lastpkg = None - for i_type in xrange(interrogate_number_of_global_types()): - type = interrogate_get_global_type(i_type) - if interrogate_type_has_module_name(type): - package = interrogate_type_module_name(type) - if lastpkg != package: - if lastpkg is not None: - print >>handle, "}" - print >>handle, "namespace %s {" % package - lastpkg = package - - processType(handle, type) - else: - print "Type %s has no module name" % typename - - if lastpkg is not None: - print >>handle, "}" + print >>handle, "}" handle.close() diff --git a/dtool/src/cppparser/cppBison.yxx b/dtool/src/cppparser/cppBison.yxx index 80d78fe184..6ca6e73980 100644 --- a/dtool/src/cppparser/cppBison.yxx +++ b/dtool/src/cppparser/cppBison.yxx @@ -1651,7 +1651,7 @@ type_decl: } | anonymous_enum { - $$ = CPPType::new_type($1); + $$ = new CPPTypeDeclaration(CPPType::new_type($1)); } | named_enum { diff --git a/dtool/src/cppparser/cppScope.cxx b/dtool/src/cppparser/cppScope.cxx index 8ca9babad4..d238d30fcd 100644 --- a/dtool/src/cppparser/cppScope.cxx +++ b/dtool/src/cppparser/cppScope.cxx @@ -200,6 +200,7 @@ define_extension_type(CPPExtensionType *type) { case CPPExtensionType::T_union: _unions[name] = type; + break; case CPPExtensionType::T_enum: _enums[name] = type; diff --git a/panda/src/distort/nonlinearImager.cxx b/panda/src/distort/nonlinearImager.cxx index 8a397c5183..fb44addff8 100644 --- a/panda/src/distort/nonlinearImager.cxx +++ b/panda/src/distort/nonlinearImager.cxx @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////// // Function: NonlinearImager::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// NonlinearImager:: NonlinearImager() { @@ -38,7 +38,7 @@ NonlinearImager() { //////////////////////////////////////////////////////////////////// // Function: NonlinearImager::Destructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// NonlinearImager:: ~NonlinearImager() { @@ -54,7 +54,7 @@ NonlinearImager:: //////////////////////////////////////////////////////////////////// // Function: NonlinearImager::add_screen // Access: Published -// This version of this method is deprecated and will +// Description: This version of this method is deprecated and will // soon be removed. Use the version that takes two // parameters instead. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/ode/odeRayGeom.I b/panda/src/ode/odeRayGeom.I index 314a7631e1..ef5ceb1760 100755 --- a/panda/src/ode/odeRayGeom.I +++ b/panda/src/ode/odeRayGeom.I @@ -11,6 +11,8 @@ // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// + + INLINE void OdeRayGeom:: set_length(dReal length) { dGeomRaySetLength(_id, length); diff --git a/panda/src/ode/odeTriMeshData.h b/panda/src/ode/odeTriMeshData.h index e126fcb8c5..4b9e6e03eb 100755 --- a/panda/src/ode/odeTriMeshData.h +++ b/panda/src/ode/odeTriMeshData.h @@ -62,6 +62,7 @@ PUBLISHED: // INLINE void get_buffer(unsigned char** buf, int* buf_len) const; // INLINE void set_buffer(unsigned char* buf); // INLINE void update(); + virtual void write(ostream &out = cout, unsigned int indent=0) const; void write_faces(ostream &out) const; @@ -90,6 +91,7 @@ public: const int* indices, int index_count, \ const int* normals); */ + INLINE void preprocess(); INLINE dTriMeshDataID get_id() const;