From 18a8721f4981e45129f726025577f4f54937bbe7 Mon Sep 17 00:00:00 2001
From: Andrey Kamaev <no@email>
Date: Mon, 28 May 2012 15:29:21 +0000
Subject: [PATCH] Small fixes for documentation checking script

---
 doc/check_docs2.py                        | 13 +++++++++++++
 modules/core/doc/old_basic_structures.rst |  2 +-
 modules/python/src2/hdr_parser.py         |  3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/check_docs2.py b/doc/check_docs2.py
index a66c564408..1ee2dd144b 100644
--- a/doc/check_docs2.py
+++ b/doc/check_docs2.py
@@ -37,6 +37,11 @@ doc_signatures_whitelist = [
 # these are even non-template
 "gpu::DeviceInfo", "gpu::GpuMat", "gpu::TargetArchs", "gpu::FeatureSet"]
 
+defines = ["cvGraphEdgeIdx", "cvFree", "CV_Assert", "cvSqrt", "cvGetGraphVtx", "cvGraphVtxIdx",
+# not a real function but behaves as function
+"Mat.size"
+]
+
 synonims = {
     "StarDetector" : ["StarFeatureDetector"],
     "MSER" : ["MserFeatureDetector"],
@@ -191,6 +196,8 @@ def process_module(module, path):
                         namespaces.append(namespace)
         else:
             funcs.append(decl)
+            # if "RNG" in decl[0]:
+            #     print decl
 
     clsnamespaces = []
     # process classes
@@ -391,6 +398,8 @@ def process_module(module, path):
         decls = doc.get("decls")
         if not decls:
             continue
+        # if "RNG" in name:
+        #     print name, decls
         for signature in decls:
             if signature[0] == "C" or signature[0] == "C++":
                 if "template" in (signature[2][1] or ""):
@@ -434,7 +443,11 @@ def process_module(module, path):
         for d in doc.get("decls", []):
             if d[-1] != DOCUMENTED_MARKER:
                 if d[0] == "C" or d[0] =="C++" or (do_python_crosscheck and d[0].startswith("Python")):
+                    if d[0][0] == 'C' and d[2][0][3:] in defines:
+                        #TODO: need to find a way to verify #define's
+                        continue
                     logerror(ERROR_011_UNKNOWNFUNC, d[0] + " function is documented but is not found in OpenCV headers. It is documented as:\n\t" + d[1], doc)
+                    #print d[2][0][3:]
     # end of process_module
 
 if __name__ == "__main__":
diff --git a/modules/core/doc/old_basic_structures.rst b/modules/core/doc/old_basic_structures.rst
index f1ce6e8fb2..2b0e6e0363 100644
--- a/modules/core/doc/old_basic_structures.rst
+++ b/modules/core/doc/old_basic_structures.rst
@@ -160,7 +160,7 @@ Sub-pixel accurate size of a rectangle.
 
         Height of the rectangle
 
-.. ocv:cfunction:: CvSize2D32f cvSize2D23f( float width, float height )
+.. ocv:cfunction:: CvSize2D32f cvSize2D32f( double width, double height )
 
     constructs ``CvSize2D32f`` structure.
 
diff --git a/modules/python/src2/hdr_parser.py b/modules/python/src2/hdr_parser.py
index 1dc9a5469b..b422c0c296 100755
--- a/modules/python/src2/hdr_parser.py
+++ b/modules/python/src2/hdr_parser.py
@@ -419,6 +419,9 @@ class CppHeaderParser(object):
                 print "Error at %d: no args in '%s'" % (self.lineno, decl_str)
                 sys.exit(-1)
             decl_start = decl_str[:args_begin].strip()
+            # TODO: normalize all type of operators
+            if decl_start.endswith("()"):
+                decl_start = decl_start[0:-2].rstrip() + " ()"
 
         # constructor/destructor case
         if bool(re.match(r'(\w+::)*(?P<x>\w+)::~?(?P=x)', decl_start)):
-- 
2.18.0