Package: doxygen
Version: 1.8.6-1
Severity: important
Tags: patch

Hi, 

Could you please see a patch for including generated doc as external ressource 
and not compiled inside doxygen.

It save a few byte, improve the jquery problem and so on.

Please said if it seems appropriate.

I will add every external ressource if you think it is good. 

It need more patch to be supported upstream but for a debian patch it is a good 
beginning.

Bastien
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 99dd0a6..70a2d2b 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -42,14 +42,56 @@
 #include "ftvhelp.h"
 #include "bufstr.h"
 
+#define EXTERNAL_RESSOURCE 1
+#define EXTERNAL_RESSOURCE_PATH "/usr/share/doxygen/"
+#define RELATIVE_HTML_RESSOURCE_PATH "html/"
+
+
+#ifdef EXTERNAL_RESSOURCE
+class external_ressource {
+    public:
+        external_ressource(QCString relp) : path(relp), buf() {}
+        operator const char * () {
+    	    QCString fullpath("");
+    	    if(buf.isEmpty()) {
+    		char * getenvpath = getenv("DOXYGEN_RESSOURCE");
+    		if(getenvpath) {
+    		    fullpath = QCString(getenvpath) + QCString("/") + path;
+    		}
+    		else {
+    		    fullpath = QCString(EXTERNAL_RESSOURCE_PATH) + path;
+    		}
+    		QFile file(fullpath);
+    		if (!file.open(IO_ReadOnly))
+    		    goto error;
+    		buf = file.readAll();
+    		if(buf.isEmpty())
+    		    goto error;
+    		}
+    	    return (const char*) buf.data();
+    	error:
+    	    err("Could not open ressource %s at %s\n",path.data(),fullpath.data());
+		    exit(1);
+        }
+    private:
+	QCString path;
+	QByteArray buf;
+};
+
+
+static external_ressource defaultHtmlHeader(QCString(RELATIVE_HTML_RESSOURCE_PATH)+QCString("header.html"));
+
+#endif
+
 
 //#define DBG_HTML(x) x;
 #define DBG_HTML(x) 
 
+#ifndef EXTERNAL_RESSOURCE
 static const char defaultHtmlHeader[] =
 #include "header.html.h"
 ;
-
+#endif
 static const char defaultHtmlFooter[] =
 #include "footer.html.h"
 ;

Reply via email to