From MAILER-DAEMON Mon Apr 04 04:14:09 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Q6evI-0002SH-S7
	for mharc-help-source-highlight@gnu.org; Mon, 04 Apr 2011 04:14:09 -0400
Received: from [140.186.70.92] (port=33611 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Q6evD-0001kB-M2
	for help-source-highlight@gnu.org; Mon, 04 Apr 2011 04:14:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1Q6eev-0003DL-S9
	for help-source-highlight@gnu.org; Mon, 04 Apr 2011 03:57:19 -0400
Received: from mx1.redhat.com ([209.132.183.28]:2875)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1Q6eev-0003D3-AP
	for help-source-highlight@gnu.org; Mon, 04 Apr 2011 03:57:13 -0400
Received: from int-mx09.intmail.prod.int.phx2.redhat.com
	(int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p347v04j002547
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 4 Apr 2011 03:57:01 -0400
Received: from localhost (beach.nrt.redhat.com [10.64.200.71])
	by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id p347uvHg011371; Mon, 4 Apr 2011 03:56:58 -0400
Date: Mon, 04 Apr 2011 16:56:57 +0900 (JST)
Message-Id: <20110404.165657.585655079956906940.yamato@redhat.com>
To: help-source-highlight@gnu.org, bettini@dsi.unifi.it
Subject: Re: [Help-source-highlight] Embedding inputlang as information
From: Masatake YAMATO <yamato@redhat.com>
In-Reply-To: <20110331.095206.831016316776045422.yamato@redhat.com>
References: <20110330.235145.1046066719585364096.yamato@redhat.com>
	<4D93446A.6050508@dsi.unifi.it>
	<20110331.095206.831016316776045422.yamato@redhat.com>
Organization: Red Hat Japan, Inc.
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Cc: 
X-BeenThere: help-source-highlight@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: discussion list for source-highlight <help-source-highlight@gnu.org>
List-Id: discussion list for source-highlight <help-source-highlight.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-source-highlight>
List-Post: <mailto:help-source-highlight@gnu.org>
List-Help: <mailto:help-source-highlight-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 04 Apr 2011 08:14:06 -0000

> Hi,
> 
> thank you for replying.
> 
>> Hi there
>> 
>> I still haven't had time to work on this.  However, your patch looks
>> OK.  As I said in my previous email I think I will not add that
>> additional argument in the constructor, but make it settable in a set
>> method in order not to break compatibility, or probably add an
>> overloaded constructor with the additional parameter.
> 
> Implementing with the overloaded constructor aproach is much easier for 
> me. I'll submit the patch.

Instread of overloading, I've written a patch which uses default value for
parameter.

Masatake YAMATO


diff --git a/lib/srchilite/docgenerator.cc b/lib/srchilite/docgenerator.cc
index 1e1ae73..6494e6f 100644
--- a/lib/srchilite/docgenerator.cc
+++ b/lib/srchilite/docgenerator.cc
@@ -31,6 +31,7 @@ void
 DocGenerator::generate_start_doc(std::ostream *sout)
 {
     bool docTitle = (title.size () > 0);
+    bool docInputLang = (input_lang.size () > 0);
     bool inputFileName = (input_file_name.size () > 0);
 
     *sout <<
@@ -42,7 +43,8 @@ DocGenerator::generate_start_doc(std::ostream *sout)
             "\nby Lorenzo Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
             doc_header,
             doc_footer,
-            doc_background
+            doc_background,
+	    docInputLang ? input_lang: "unknown"
         );
 }
 
@@ -56,7 +58,8 @@ DocGenerator::generate_end_doc(std::ostream *sout)
             "\nby Lorenzo Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
             doc_header,
             doc_footer,
-            doc_background
+            doc_background,
+	    ""
         );
 }
 
diff --git a/lib/srchilite/docgenerator.h b/lib/srchilite/docgenerator.h
index 16a2804..3a6282d 100644
--- a/lib/srchilite/docgenerator.h
+++ b/lib/srchilite/docgenerator.h
@@ -47,16 +47,18 @@ protected:
     string css_url;
     string doc_background;
     bool entire_doc;
+    string input_lang;
 
     DocTemplate docTemplate;
 
 public:
     DocGenerator(const string &s, const string &i, const string &h,
-            const string &f, const string &c, const string &back, bool entire,
+            const string &f, const string &c, const string &back, bool entire, 
+	    const string &l,
             const string &start_tmpl, const string &end_tmpl) :
         title(s), gen_source_highlight_version(true), input_file_name(i),
                 doc_header(h), doc_footer(f), css_url(c), doc_background(back),
-                entire_doc(entire), docTemplate(DocTemplate(start_tmpl,
+	  entire_doc(entire), input_lang(l), docTemplate(DocTemplate(start_tmpl,
                         end_tmpl)) {
     }
     DocGenerator(const string &start_tmpl, const string &end_tmpl) :
@@ -97,6 +99,10 @@ public:
         title = _title;
     }
 
+    void setInputLang(const std::string &_input_lang) {
+      input_lang = _input_lang;
+    }
+
     void setBackgroundColor(const std::string &bg) {
         doc_background = bg;
     }
diff --git a/lib/srchilite/doctemplate.cpp b/lib/srchilite/doctemplate.cpp
index 32b4e2f..63309c5 100644
--- a/lib/srchilite/doctemplate.cpp
+++ b/lib/srchilite/doctemplate.cpp
@@ -14,12 +14,14 @@
 namespace srchilite {
 
 #define TITLE_VAR_TEXT "$title" // the text of the title variable
+#define INPUT_LANG_VAR_TEXT "$inputlang" // the text of the input lang variable
 #define CSS_VAR_TEXT "$css" // the text of the css variable
 #define ADDITIONAL_VAR_TEXT "$additional" // the text of the additional text variable
 #define HEADER_VAR_TEXT "$header" // the text of the header variable
 #define FOOTER_VAR_TEXT "$footer" // the text of the footer variable
 #define BACKGROUND_VAR_TEXT "$docbgcolor" // the text of the background variable
 #define TITLE_VAR "\\" TITLE_VAR_TEXT // the name of the title variable as regexp
+#define INPUT_LANG_VAR "\\" INPUT_LANG_VAR_TEXT // the name of the input lang variable as regexp
 #define CSS_VAR "\\" CSS_VAR_TEXT // the name of the css variable as regexp
 #define ADDITIONAL_VAR "\\" ADDITIONAL_VAR_TEXT // the text of the additional text variable as regexp
 #define HEADER_VAR "\\" HEADER_VAR_TEXT // the text of the header variable as regexp
@@ -35,7 +37,8 @@ DocTemplate::DocTemplate(const string &begin, const string &end) :
 
 string
 DocTemplate::output_begin(const string &title, const string &cs, const string &add,
-    const string &header, const string &footer, const std::string &background)
+    const string &header, const string &footer, const std::string &background,
+    const string &input_lang)
 {
     boost::regex title_exp(TITLE_VAR);
     boost::regex css_exp(CSS_VAR);
@@ -43,6 +46,7 @@ DocTemplate::output_begin(const string &title, const string &cs, const string &a
     boost::regex header_exp(HEADER_VAR);
     boost::regex footer_exp(FOOTER_VAR);
     boost::regex background_exp(BACKGROUND_VAR);
+    boost::regex input_lang_exp(INPUT_LANG_VAR);
 
     string ret = subst(title_exp, begin_repr, title);
     ret = subst(css_exp, ret, cs);
@@ -50,13 +54,15 @@ DocTemplate::output_begin(const string &title, const string &cs, const string &a
     ret = subst(header_exp, ret, header);
     ret = subst(footer_exp, ret, footer);
     ret = subst(background_exp, ret, background);
+    ret = subst(input_lang_exp, ret, input_lang);
 
     return ret;
 }
 
 string
 DocTemplate::output_end(const string &title, const string &cs, const string &add,
-    const string &header, const string &footer, const std::string &background)
+    const string &header, const string &footer, const std::string &background, 
+    const string &input_lang)
 {
     boost::regex title_exp(TITLE_VAR);
     boost::regex css_exp(CSS_VAR);
@@ -64,6 +70,7 @@ DocTemplate::output_end(const string &title, const string &cs, const string &add
     boost::regex header_exp(HEADER_VAR);
     boost::regex footer_exp(FOOTER_VAR);
     boost::regex background_exp(BACKGROUND_VAR);
+    boost::regex input_lang_exp(INPUT_LANG_VAR);
 
     string ret = subst(title_exp, end_repr, title);
     ret = subst(css_exp, ret, cs);
@@ -71,6 +78,7 @@ DocTemplate::output_end(const string &title, const string &cs, const string &add
     ret = subst(header_exp, ret, header);
     ret = subst(footer_exp, ret, footer);
     ret = subst(background_exp, ret, background);
+    ret = subst(input_lang_exp, ret, input_lang);
 
     return ret;
 }
diff --git a/lib/srchilite/doctemplate.h b/lib/srchilite/doctemplate.h
index 7ee0e1a..6df986e 100644
--- a/lib/srchilite/doctemplate.h
+++ b/lib/srchilite/doctemplate.h
@@ -22,10 +22,12 @@ public:
 
     std::string output_begin(const std::string &title, const std::string &cs,
             const std::string &add, const std::string &header,
-            const std::string &footer, const std::string &background);
+            const std::string &footer, const std::string &background,
+	    const std::string &input_lang = "");
     std::string output_end(const std::string &title, const std::string &cs,
             const std::string &add, const std::string &header,
-            const std::string &footer, const std::string &background);
+            const std::string &footer, const std::string &background,
+	    const std::string &input_lang = "unknown");
 
     const std::string &toStringBegin() const {
         return begin_repr;
diff --git a/lib/srchilite/sourcehighlight.cpp b/lib/srchilite/sourcehighlight.cpp
index 9c0a55b..3abaed7 100644
--- a/lib/srchilite/sourcehighlight.cpp
+++ b/lib/srchilite/sourcehighlight.cpp
@@ -257,6 +257,9 @@ void SourceHighlight::highlight(const std::string &input,
         noDocGenerator->setTitle(input);
     }
 
+    docGenerator->setInputLang(inputLang);
+    noDocGenerator->setInputLang(inputLang);      
+
     if (ctagsFormatter) {
         // if we need to generate references, then set the file info
         ctagsFormatter->setFileInfo(input, output);
@@ -334,6 +337,8 @@ void SourceHighlight::highlight(std::istream &input, std::ostream &output,
         documentGenerator->setTitle(title);
     }
 
+    documentGenerator->setInputLang(inputLang);
+
     // first generate the start of the output file
     documentGenerator->generate_start_doc(&output);
 
diff --git a/lib/srchilite/sourcehighlight.h b/lib/srchilite/sourcehighlight.h
index 7d61972..4cef31e 100644
--- a/lib/srchilite/sourcehighlight.h
+++ b/lib/srchilite/sourcehighlight.h
@@ -64,6 +64,9 @@ class SourceHighlight {
     /// the title for the output document (defaults to the source file name)
     std::string title;
 
+    /// the input lang for the output document
+    std::string inputLang;
+
     /// the value for the css
     std::string css;
 
@@ -272,6 +275,10 @@ public:
     void setTitle(const std::string &_title) {
         title = _title;
     }
+    
+    void setInputLang(const std::string &_inputLang) {
+        inputLang = _inputLang;
+    }
 
     void setCss(const std::string &_css) {
         css = _css;
diff --git a/lib/tests/test_outlangparser_main.cpp b/lib/tests/test_outlangparser_main.cpp
index 467604b..db3f783 100644
--- a/lib/tests/test_outlangparser_main.cpp
+++ b/lib/tests/test_outlangparser_main.cpp
@@ -45,7 +45,7 @@ this is simply the footer: $footer",
             textstyles->docTemplate.toStringEnd());
 
     string start = textstyles->docTemplate.output_begin("title", "css",
-            "additional", "header", "footer", "");
+            "additional", "header", "footer", "", "inputlang");
     cout << "DocTemplate start:\n" << start << endl;
 
     assertEquals(
@@ -59,7 +59,7 @@ and this is some additional stuff: additional",
             start);
 
     string end = textstyles->docTemplate.output_end("title", "css",
-            "additional", "header", "footer", "");
+            "additional", "header", "footer", "", "inputlang");
     cout << "DocTemplate end:\n" << end << endl;
 
     assertEquals(
diff --git a/lib/tests/test_textgenerator_main.cpp b/lib/tests/test_textgenerator_main.cpp
index aeaef3b..ed58660 100644
--- a/lib/tests/test_textgenerator_main.cpp
+++ b/lib/tests/test_textgenerator_main.cpp
@@ -74,9 +74,9 @@ int main() {
     DocTemplate docTemplate(start, end);
 
     string transformed_start = docTemplate.output_begin("TITLE", "CSS",
-            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
+            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
     string transformed_end = docTemplate.output_end("TITLE", "CSS",
-            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
+            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
 
     cout << "orig start : " << start << endl;
     cout << "transformed: " << transformed_start << endl;
diff --git a/src/xhtml.outlang b/src/xhtml.outlang
index ecc1a27..cd5d02c 100644
--- a/src/xhtml.outlang
+++ b/src/xhtml.outlang
@@ -7,6 +7,7 @@ doctemplate
 <head>
 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
 <meta name=\"GENERATOR\" content=\"$additional\" />
+<meta name=\"INPUTLANG\" content=\"$inputlang\" />
 <title>$title</title>
 </head>
 <body style=\"background-color: $docbgcolor\">
diff --git a/src/xhtmlcss.outlang b/src/xhtmlcss.outlang
index 215800f..1b1387f 100644
--- a/src/xhtmlcss.outlang
+++ b/src/xhtmlcss.outlang
@@ -7,6 +7,7 @@ doctemplate
 <head>
 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
 <meta name=\"GENERATOR\" content=\"$additional\" />
+<meta name=\"INPUTLANG\" content=\"$inputlang\" />
 <title>$title</title>
 <link rel=\"stylesheet\" href=\"$css\" type=\"text/css\" />
 </head>
diff --git a/tests/test_ref.xhtml b/tests/test_ref.xhtml
index 05f27ec..280895d 100644
--- a/tests/test_ref.xhtml
+++ b/tests/test_ref.xhtml
@@ -7,6 +7,7 @@
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite" />
+<meta name="INPUTLANG" content="cpp.lang" />
 <title>XHTML with refs</title>
 <link rel="stylesheet" href="../src/default.css" type="text/css" />
 </head>
diff --git a/tests/test_xhtml_css_doc.html b/tests/test_xhtml_css_doc.html
index 5b85a1f..96d9b4a 100644
--- a/tests/test_xhtml_css_doc.html
+++ b/tests/test_xhtml_css_doc.html
@@ -7,6 +7,7 @@
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite" />
+<meta name="INPUTLANG" content="./../src/java.lang" />
 <title>source file</title>
 <link rel="stylesheet" href="../doc/mono.css" type="text/css" />
 </head>
diff --git a/tests/test_xhtml_doc.html b/tests/test_xhtml_doc.html
index fcdd6cd..34b195c 100644
--- a/tests/test_xhtml_doc.html
+++ b/tests/test_xhtml_doc.html
@@ -7,6 +7,7 @@
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite" />
+<meta name="INPUTLANG" content="./../src/java.lang" />
 <title>source file</title>
 </head>
 <body style="background-color: white">


From MAILER-DAEMON Sat Apr 09 15:38:35 2011
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Q8dzP-0004TW-6x
	for mharc-help-source-highlight@gnu.org; Sat, 09 Apr 2011 15:38:35 -0400
Received: from [140.186.70.92] (port=60115 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Q8dzM-0004T4-D9
	for help-source-highlight@gnu.org; Sat, 09 Apr 2011 15:38:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bettini@dsi.unifi.it>) id 1Q8dzH-0007CE-8U
	for help-source-highlight@gnu.org; Sat, 09 Apr 2011 15:38:32 -0400
Received: from pianeta.di.unito.it ([130.192.156.1]:50037)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bettini@dsi.unifi.it>) id 1Q8dzG-00078J-Un
	for help-source-highlight@gnu.org; Sat, 09 Apr 2011 15:38:27 -0400
X-MailScanner-From: bettini@dsi.unifi.it
X-SpamCheck: not spam, SpamAssassin (not cached, score=-3.492, required 3,
	AWL -3.59, RDNS_NONE 0.10)
X-AntiVirus: Email Clean
X-dipinfo-MailScanner-ID: p39Jc1Po018433
X-dipinfo-MailScanner-Information: Please contact Department of Computer
	Science technical staff for more information
Received: from pianeta.di.unito.it ([130.192.156.1])
	by pianeta.di.unito.it (INFO-DIP) with ESMTP id p39Jc1Po018433
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO
	AuthenticatedUser=bettini ) for <help-source-highlight@gnu.org>;
	Sat, 9 Apr 2011 21:38:07 +0200 (CEST)
Message-ID: <4DA0B599.5020007@dsi.unifi.it>
Date: Sat, 09 Apr 2011 21:38:01 +0200
From: Lorenzo Bettini <bettini@dsi.unifi.it>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8
MIME-Version: 1.0
To: discussion list for source-highlight <help-source-highlight@gnu.org>
Subject: Re: [Help-source-highlight] Embedding inputlang as information
References: <20110330.235145.1046066719585364096.yamato@redhat.com>	<4D93446A.6050508@dsi.unifi.it>	<20110331.095206.831016316776045422.yamato@redhat.com>
	<20110404.165657.585655079956906940.yamato@redhat.com>
In-Reply-To: <20110404.165657.585655079956906940.yamato@redhat.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Received-From: 130.192.156.1
X-BeenThere: help-source-highlight@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: discussion list for source-highlight <help-source-highlight@gnu.org>
List-Id: discussion list for source-highlight <help-source-highlight.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-source-highlight>
List-Post: <mailto:help-source-highlight@gnu.org>
List-Help: <mailto:help-source-highlight-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 09 Apr 2011 19:38:33 -0000

On 04/04/2011 09:56 AM, Masatake YAMATO wrote:
>> Hi,
>>
>> thank you for replying.
>>
>>> Hi there
>>>
>>> I still haven't had time to work on this.  However, your patch looks
>>> OK.  As I said in my previous email I think I will not add that
>>> additional argument in the constructor, but make it settable in a set
>>> method in order not to break compatibility, or probably add an
>>> overloaded constructor with the additional parameter.
>>
>> Implementing with the overloaded constructor aproach is much easier for
>> me. I'll submit the patch.
>
> Instread of overloading, I've written a patch which uses default value for
> parameter.

thanks

however the signature of constructor and method have changed thus it is 
not backward-compatible.  I'll deal with this when I apply the patch.

cheers
	Lorenzo

-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


From MAILER-DAEMON Sat Apr 23 12:04:26 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1QDfJq-0002wz-TH
	for mharc-help-source-highlight@gnu.org; Sat, 23 Apr 2011 12:04:26 -0400
Received: from eggs.gnu.org ([140.186.70.92]:33107)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bettini@dsi.unifi.it>) id 1QDfJn-0002vV-2F
	for help-source-highlight@gnu.org; Sat, 23 Apr 2011 12:04:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bettini@dsi.unifi.it>) id 1QDfJl-0001ig-6D
	for help-source-highlight@gnu.org; Sat, 23 Apr 2011 12:04:23 -0400
Received: from pianeta.di.unito.it ([130.192.156.1]:34575)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bettini@dsi.unifi.it>) id 1QDfJk-0001iK-Tv
	for help-source-highlight@gnu.org; Sat, 23 Apr 2011 12:04:21 -0400
X-MailScanner-From: bettini@dsi.unifi.it
X-SpamCheck: not spam, SpamAssassin (not cached, score=-101.957, required 3,
	autolearn=not spam, AUTHENTICATEDUSER -100.00, AWL 0.54,
	BAYES_00 -2.60, RDNS_NONE 0.10)
X-AntiVirus: Email Clean
X-dipinfo-MailScanner-ID: p3NG3qvD010165
X-dipinfo-MailScanner-Information: Please contact Department of Computer
	Science technical staff for more information
Received: from pianeta.di.unito.it ([130.192.156.1])
	by pianeta.di.unito.it (INFO-DIP) with ESMTP id p3NG3qvD010165
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO
	AuthenticatedUser=bettini ) for <help-source-highlight@gnu.org>;
	Sat, 23 Apr 2011 18:03:55 +0200 (CEST)
Message-ID: <4DB2F869.9010505@dsi.unifi.it>
Date: Sat, 23 Apr 2011 18:03:53 +0200
From: Lorenzo Bettini <bettini@dsi.unifi.it>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US;
	rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8
MIME-Version: 1.0
To: discussion list for source-highlight <help-source-highlight@gnu.org>
References: <20110303.044952.913335889866294442.yamato@redhat.com>
In-Reply-To: <20110303.044952.913335889866294442.yamato@redhat.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta)
X-Received-From: 130.192.156.1
Subject: Re: [Help-source-highlight] Embedding inputlang as information
X-BeenThere: help-source-highlight@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: discussion list for source-highlight <help-source-highlight@gnu.org>
List-Id: discussion list for source-highlight <help-source-highlight.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-source-highlight>
List-Post: <mailto:help-source-highlight@gnu.org>
List-Help: <mailto:help-source-highlight-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 23 Apr 2011 16:04:24 -0000

Hi

your patch (the original one, which is in this email) is not in the git 
repository.

this patch breaks binary compatibility so I increased the version number 
(which will also change the soname).

it will be part of the next release

many thanks
	Lorenzo

On 03/02/2011 08:49 PM, Masatake YAMATO wrote:
> Hi,
>
> I'd like you to review my patch.
> The patch embeds input lang used in highlighting into the output xhtml
> file.
>
> Background
> -----------
> I'm developing web based source code viewer using source highlight.
>
> With javascript I'd like to provide some interactive commands working
> on the generated html file. The behavior of commands will be changed
> according to the ``input lang'' of the original source code.
>
> e.g.:
>
> JUMP command works on
>
>       #include<bar.h>
>
> in C,
>
>       import foo.bar.Class;
>
> in Java, and
>
>       import foo.bar.Class
>
> in python...
>
>
> If source highlight embeds the name of input lang to the converted html file,
> I don't have to write lang detector in javascript.  Adding this feature is a
> bit private request but similar type of software may want such
> input lang(file type) information. So I submitted the patch here.
>
>
> I don't know how I have to be careful about API and ABI compatibility.
> In the patch I may do something bad about the compatibility.
>
>
> Masatake YAMATO
>
>
> diff --git a/lib/srchilite/docgenerator.cc b/lib/srchilite/docgenerator.cc
> index 1e1ae73..6494e6f 100644
> --- a/lib/srchilite/docgenerator.cc
> +++ b/lib/srchilite/docgenerator.cc
> @@ -31,6 +31,7 @@ void
>   DocGenerator::generate_start_doc(std::ostream *sout)
>   {
>       bool docTitle = (title.size ()>  0);
> +    bool docInputLang = (input_lang.size ()>  0);
>       bool inputFileName = (input_file_name.size ()>  0);
>
>       *sout<<
> @@ -42,7 +43,8 @@ DocGenerator::generate_start_doc(std::ostream *sout)
>               "\nby Lorenzo Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
>               doc_header,
>               doc_footer,
> -            doc_background
> +            doc_background,
> +	    docInputLang ? input_lang: "unknown"
>           );
>   }
>
> @@ -56,7 +58,8 @@ DocGenerator::generate_end_doc(std::ostream *sout)
>               "\nby Lorenzo Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
>               doc_header,
>               doc_footer,
> -            doc_background
> +            doc_background,
> +	    ""
>           );
>   }
>
> diff --git a/lib/srchilite/docgenerator.h b/lib/srchilite/docgenerator.h
> index 16a2804..3a6282d 100644
> --- a/lib/srchilite/docgenerator.h
> +++ b/lib/srchilite/docgenerator.h
> @@ -47,16 +47,18 @@ protected:
>       string css_url;
>       string doc_background;
>       bool entire_doc;
> +    string input_lang;
>
>       DocTemplate docTemplate;
>
>   public:
>       DocGenerator(const string&s, const string&i, const string&h,
> -            const string&f, const string&c, const string&back, bool entire,
> +            const string&f, const string&c, const string&back, bool entire,
> +	    const string&l,
>               const string&start_tmpl, const string&end_tmpl) :
>           title(s), gen_source_highlight_version(true), input_file_name(i),
>                   doc_header(h), doc_footer(f), css_url(c), doc_background(back),
> -                entire_doc(entire), docTemplate(DocTemplate(start_tmpl,
> +	  entire_doc(entire), input_lang(l), docTemplate(DocTemplate(start_tmpl,
>                           end_tmpl)) {
>       }
>       DocGenerator(const string&start_tmpl, const string&end_tmpl) :
> @@ -97,6 +99,10 @@ public:
>           title = _title;
>       }
>
> +    void setInputLang(const std::string&_input_lang) {
> +      input_lang = _input_lang;
> +    }
> +
>       void setBackgroundColor(const std::string&bg) {
>           doc_background = bg;
>       }
> diff --git a/lib/srchilite/doctemplate.cpp b/lib/srchilite/doctemplate.cpp
> index 32b4e2f..63309c5 100644
> --- a/lib/srchilite/doctemplate.cpp
> +++ b/lib/srchilite/doctemplate.cpp
> @@ -14,12 +14,14 @@
>   namespace srchilite {
>
>   #define TITLE_VAR_TEXT "$title" // the text of the title variable
> +#define INPUT_LANG_VAR_TEXT "$inputlang" // the text of the input lang variable
>   #define CSS_VAR_TEXT "$css" // the text of the css variable
>   #define ADDITIONAL_VAR_TEXT "$additional" // the text of the additional text variable
>   #define HEADER_VAR_TEXT "$header" // the text of the header variable
>   #define FOOTER_VAR_TEXT "$footer" // the text of the footer variable
>   #define BACKGROUND_VAR_TEXT "$docbgcolor" // the text of the background variable
>   #define TITLE_VAR "\\" TITLE_VAR_TEXT // the name of the title variable as regexp
> +#define INPUT_LANG_VAR "\\" INPUT_LANG_VAR_TEXT // the name of the input lang variable as regexp
>   #define CSS_VAR "\\" CSS_VAR_TEXT // the name of the css variable as regexp
>   #define ADDITIONAL_VAR "\\" ADDITIONAL_VAR_TEXT // the text of the additional text variable as regexp
>   #define HEADER_VAR "\\" HEADER_VAR_TEXT // the text of the header variable as regexp
> @@ -35,7 +37,8 @@ DocTemplate::DocTemplate(const string&begin, const string&end) :
>
>   string
>   DocTemplate::output_begin(const string&title, const string&cs, const string&add,
> -    const string&header, const string&footer, const std::string&background)
> +    const string&header, const string&footer, const std::string&background,
> +    const string&input_lang)
>   {
>       boost::regex title_exp(TITLE_VAR);
>       boost::regex css_exp(CSS_VAR);
> @@ -43,6 +46,7 @@ DocTemplate::output_begin(const string&title, const string&cs, const string&a
>       boost::regex header_exp(HEADER_VAR);
>       boost::regex footer_exp(FOOTER_VAR);
>       boost::regex background_exp(BACKGROUND_VAR);
> +    boost::regex input_lang_exp(INPUT_LANG_VAR);
>
>       string ret = subst(title_exp, begin_repr, title);
>       ret = subst(css_exp, ret, cs);
> @@ -50,13 +54,15 @@ DocTemplate::output_begin(const string&title, const string&cs, const string&a
>       ret = subst(header_exp, ret, header);
>       ret = subst(footer_exp, ret, footer);
>       ret = subst(background_exp, ret, background);
> +    ret = subst(input_lang_exp, ret, input_lang);
>
>       return ret;
>   }
>
>   string
>   DocTemplate::output_end(const string&title, const string&cs, const string&add,
> -    const string&header, const string&footer, const std::string&background)
> +    const string&header, const string&footer, const std::string&background,
> +    const string&input_lang)
>   {
>       boost::regex title_exp(TITLE_VAR);
>       boost::regex css_exp(CSS_VAR);
> @@ -64,6 +70,7 @@ DocTemplate::output_end(const string&title, const string&cs, const string&add
>       boost::regex header_exp(HEADER_VAR);
>       boost::regex footer_exp(FOOTER_VAR);
>       boost::regex background_exp(BACKGROUND_VAR);
> +    boost::regex input_lang_exp(INPUT_LANG_VAR);
>
>       string ret = subst(title_exp, end_repr, title);
>       ret = subst(css_exp, ret, cs);
> @@ -71,6 +78,7 @@ DocTemplate::output_end(const string&title, const string&cs, const string&add
>       ret = subst(header_exp, ret, header);
>       ret = subst(footer_exp, ret, footer);
>       ret = subst(background_exp, ret, background);
> +    ret = subst(input_lang_exp, ret, input_lang);
>
>       return ret;
>   }
> diff --git a/lib/srchilite/doctemplate.h b/lib/srchilite/doctemplate.h
> index 7ee0e1a..17340e6 100644
> --- a/lib/srchilite/doctemplate.h
> +++ b/lib/srchilite/doctemplate.h
> @@ -22,10 +22,12 @@ public:
>
>       std::string output_begin(const std::string&title, const std::string&cs,
>               const std::string&add, const std::string&header,
> -            const std::string&footer, const std::string&background);
> +            const std::string&footer, const std::string&background,
> +	    const std::string&input_lang);
>       std::string output_end(const std::string&title, const std::string&cs,
>               const std::string&add, const std::string&header,
> -            const std::string&footer, const std::string&background);
> +            const std::string&footer, const std::string&background,
> +	    const std::string&input_lang);
>
>       const std::string&toStringBegin() const {
>           return begin_repr;
> diff --git a/lib/srchilite/sourcehighlight.cpp b/lib/srchilite/sourcehighlight.cpp
> index 9c0a55b..3abaed7 100644
> --- a/lib/srchilite/sourcehighlight.cpp
> +++ b/lib/srchilite/sourcehighlight.cpp
> @@ -257,6 +257,9 @@ void SourceHighlight::highlight(const std::string&input,
>           noDocGenerator->setTitle(input);
>       }
>
> +    docGenerator->setInputLang(inputLang);
> +    noDocGenerator->setInputLang(inputLang);
> +
>       if (ctagsFormatter) {
>           // if we need to generate references, then set the file info
>           ctagsFormatter->setFileInfo(input, output);
> @@ -334,6 +337,8 @@ void SourceHighlight::highlight(std::istream&input, std::ostream&output,
>           documentGenerator->setTitle(title);
>       }
>
> +    documentGenerator->setInputLang(inputLang);
> +
>       // first generate the start of the output file
>       documentGenerator->generate_start_doc(&output);
>
> diff --git a/lib/srchilite/sourcehighlight.h b/lib/srchilite/sourcehighlight.h
> index 7d61972..4cef31e 100644
> --- a/lib/srchilite/sourcehighlight.h
> +++ b/lib/srchilite/sourcehighlight.h
> @@ -64,6 +64,9 @@ class SourceHighlight {
>       /// the title for the output document (defaults to the source file name)
>       std::string title;
>
> +    /// the input lang for the output document
> +    std::string inputLang;
> +
>       /// the value for the css
>       std::string css;
>
> @@ -272,6 +275,10 @@ public:
>       void setTitle(const std::string&_title) {
>           title = _title;
>       }
> +
> +    void setInputLang(const std::string&_inputLang) {
> +        inputLang = _inputLang;
> +    }
>
>       void setCss(const std::string&_css) {
>           css = _css;
> diff --git a/lib/tests/test_outlangparser_main.cpp b/lib/tests/test_outlangparser_main.cpp
> index 467604b..d7f51cf 100644
> --- a/lib/tests/test_outlangparser_main.cpp
> +++ b/lib/tests/test_outlangparser_main.cpp
> @@ -45,7 +45,7 @@ this is simply the footer: $footer",
>               textstyles->docTemplate.toStringEnd());
>
>       string start = textstyles->docTemplate.output_begin("title", "css",
> -            "additional", "header", "footer", "");
> +            "additional", "header", "footer", "", "INPUTLANG");
>       cout<<  "DocTemplate start:\n"<<  start<<  endl;
>
>       assertEquals(
> @@ -59,7 +59,7 @@ and this is some additional stuff: additional",
>               start);
>
>       string end = textstyles->docTemplate.output_end("title", "css",
> -            "additional", "header", "footer", "");
> +            "additional", "header", "footer", "", "INPUTLANG");
>       cout<<  "DocTemplate end:\n"<<  end<<  endl;
>
>       assertEquals(
> diff --git a/lib/tests/test_textgenerator_main.cpp b/lib/tests/test_textgenerator_main.cpp
> index aeaef3b..ed58660 100644
> --- a/lib/tests/test_textgenerator_main.cpp
> +++ b/lib/tests/test_textgenerator_main.cpp
> @@ -74,9 +74,9 @@ int main() {
>       DocTemplate docTemplate(start, end);
>
>       string transformed_start = docTemplate.output_begin("TITLE", "CSS",
> -            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
> +            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
>       string transformed_end = docTemplate.output_end("TITLE", "CSS",
> -            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
> +            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
>
>       cout<<  "orig start : "<<  start<<  endl;
>       cout<<  "transformed: "<<  transformed_start<<  endl;
> diff --git a/src/xhtml.outlang b/src/xhtml.outlang
> index ecc1a27..cd5d02c 100644
> --- a/src/xhtml.outlang
> +++ b/src/xhtml.outlang
> @@ -7,6 +7,7 @@ doctemplate
>   <head>
>   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
>   <meta name=\"GENERATOR\" content=\"$additional\" />
> +<meta name=\"INPUTLANG\" content=\"$inputlang\" />
>   <title>$title</title>
>   </head>
>   <body style=\"background-color: $docbgcolor\">
> diff --git a/src/xhtmlcss.outlang b/src/xhtmlcss.outlang
> index 215800f..1b1387f 100644
> --- a/src/xhtmlcss.outlang
> +++ b/src/xhtmlcss.outlang
> @@ -7,6 +7,7 @@ doctemplate
>   <head>
>   <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
>   <meta name=\"GENERATOR\" content=\"$additional\" />
> +<meta name=\"INPUTLANG\" content=\"$inputlang\" />
>   <title>$title</title>
>   <link rel=\"stylesheet\" href=\"$css\" type=\"text/css\" />
>   </head>
>
> _______________________________________________
> Help-source-highlight mailing list
> Help-source-highlight@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-source-highlight


-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


From MAILER-DAEMON Sun Apr 24 23:11:42 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1QECD8-0003Mu-K7
	for mharc-help-source-highlight@gnu.org; Sun, 24 Apr 2011 23:11:42 -0400
Received: from eggs.gnu.org ([140.186.70.92]:39896)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QECD5-0003Mn-D0
	for help-source-highlight@gnu.org; Sun, 24 Apr 2011 23:11:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QECD3-0008Lv-6L
	for help-source-highlight@gnu.org; Sun, 24 Apr 2011 23:11:39 -0400
Received: from mx1.redhat.com ([209.132.183.28]:27173)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QECD2-0008Lr-IZ
	for help-source-highlight@gnu.org; Sun, 24 Apr 2011 23:11:37 -0400
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
	(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3P3BPW7005741
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Sun, 24 Apr 2011 23:11:25 -0400
Received: from localhost (beach.nrt.redhat.com [10.64.200.71])
	by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id p3P3BMmE018086; Sun, 24 Apr 2011 23:11:23 -0400
Date: Mon, 25 Apr 2011 12:11:21 +0900 (JST)
Message-Id: <20110425.121121.647245652532223696.yamato@redhat.com>
To: help-source-highlight@gnu.org, bettini@dsi.unifi.it
From: Masatake YAMATO <yamato@redhat.com>
In-Reply-To: <4DB2F869.9010505@dsi.unifi.it>
References: <20110303.044952.913335889866294442.yamato@redhat.com>
	<4DB2F869.9010505@dsi.unifi.it>
Organization: Red Hat Japan, Inc.
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Subject: Re: [Help-source-highlight] Embedding inputlang as information
X-BeenThere: help-source-highlight@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: discussion list for source-highlight <help-source-highlight@gnu.org>
List-Id: discussion list for source-highlight <help-source-highlight.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-source-highlight>
List-Post: <mailto:help-source-highlight@gnu.org>
List-Help: <mailto:help-source-highlight-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 25 Apr 2011 03:11:41 -0000

Thank you.

Masatake YAMATO

> Hi
> 
> your patch (the original one, which is in this email) is not in the
> git repository.
> 
> this patch breaks binary compatibility so I increased the version
> number (which will also change the soname).
> 
> it will be part of the next release
> 
> many thanks
> 	Lorenzo
> 
> On 03/02/2011 08:49 PM, Masatake YAMATO wrote:
>> Hi,
>>
>> I'd like you to review my patch.
>> The patch embeds input lang used in highlighting into the output xhtml
>> file.
>>
>> Background
>> -----------
>> I'm developing web based source code viewer using source highlight.
>>
>> With javascript I'd like to provide some interactive commands working
>> on the generated html file. The behavior of commands will be changed
>> according to the ``input lang'' of the original source code.
>>
>> e.g.:
>>
>> JUMP command works on
>>
>>       #include<bar.h>
>>
>> in C,
>>
>>       import foo.bar.Class;
>>
>> in Java, and
>>
>>       import foo.bar.Class
>>
>> in python...
>>
>>
>> If source highlight embeds the name of input lang to the converted
>> html file,
>> I don't have to write lang detector in javascript.  Adding this
>> feature is a
>> bit private request but similar type of software may want such
>> input lang(file type) information. So I submitted the patch here.
>>
>>
>> I don't know how I have to be careful about API and ABI compatibility.
>> In the patch I may do something bad about the compatibility.
>>
>>
>> Masatake YAMATO
>>
>>
>> diff --git a/lib/srchilite/docgenerator.cc
>> b/lib/srchilite/docgenerator.cc
>> index 1e1ae73..6494e6f 100644
>> --- a/lib/srchilite/docgenerator.cc
>> +++ b/lib/srchilite/docgenerator.cc
>> @@ -31,6 +31,7 @@ void
>>   DocGenerator::generate_start_doc(std::ostream *sout)
>>   {
>>       bool docTitle = (title.size ()>  0);
>> +    bool docInputLang = (input_lang.size ()>  0);
>>       bool inputFileName = (input_file_name.size ()>  0);
>>
>>       *sout<<
>> @@ -42,7 +43,8 @@ DocGenerator::generate_start_doc(std::ostream *sout)
>>               "\nby Lorenzo
>>               Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
>>               doc_header,
>>               doc_footer,
>> -            doc_background
>> +            doc_background,
>> +	    docInputLang ? input_lang: "unknown"
>>           );
>>   }
>>
>> @@ -56,7 +58,8 @@ DocGenerator::generate_end_doc(std::ostream *sout)
>>               "\nby Lorenzo
>>               Bettini\nhttp://www.lorenzobettini.it\nhttp://www.gnu.org/software/src-highlite",
>>               doc_header,
>>               doc_footer,
>> -            doc_background
>> +            doc_background,
>> +	    ""
>>           );
>>   }
>>
>> diff --git a/lib/srchilite/docgenerator.h
>> b/lib/srchilite/docgenerator.h
>> index 16a2804..3a6282d 100644
>> --- a/lib/srchilite/docgenerator.h
>> +++ b/lib/srchilite/docgenerator.h
>> @@ -47,16 +47,18 @@ protected:
>>       string css_url;
>>       string doc_background;
>>       bool entire_doc;
>> +    string input_lang;
>>
>>       DocTemplate docTemplate;
>>
>>   public:
>>       DocGenerator(const string&s, const string&i, const string&h,
>> -            const string&f, const string&c, const string&back, bool entire,
>> + const string&f, const string&c, const string&back, bool entire,
>> +	    const string&l,
>>               const string&start_tmpl, const string&end_tmpl) :
>>           title(s), gen_source_highlight_version(true), input_file_name(i),
>>                   doc_header(h), doc_footer(f), css_url(c), doc_background(back),
>> -                entire_doc(entire), docTemplate(DocTemplate(start_tmpl,
>> + entire_doc(entire), input_lang(l),
>> docTemplate(DocTemplate(start_tmpl,
>>                           end_tmpl)) {
>>       }
>>       DocGenerator(const string&start_tmpl, const string&end_tmpl) :
>> @@ -97,6 +99,10 @@ public:
>>           title = _title;
>>       }
>>
>> +    void setInputLang(const std::string&_input_lang) {
>> +      input_lang = _input_lang;
>> +    }
>> +
>>       void setBackgroundColor(const std::string&bg) {
>>           doc_background = bg;
>>       }
>> diff --git a/lib/srchilite/doctemplate.cpp
>> b/lib/srchilite/doctemplate.cpp
>> index 32b4e2f..63309c5 100644
>> --- a/lib/srchilite/doctemplate.cpp
>> +++ b/lib/srchilite/doctemplate.cpp
>> @@ -14,12 +14,14 @@
>>   namespace srchilite {
>>
>>   #define TITLE_VAR_TEXT "$title" // the text of the title variable
>> +#define INPUT_LANG_VAR_TEXT "$inputlang" // the text of the input
>> lang variable
>>   #define CSS_VAR_TEXT "$css" // the text of the css variable
>>   #define ADDITIONAL_VAR_TEXT "$additional" // the text of the additional
>>   #text variable
>>   #define HEADER_VAR_TEXT "$header" // the text of the header variable
>>   #define FOOTER_VAR_TEXT "$footer" // the text of the footer variable
>>   #define BACKGROUND_VAR_TEXT "$docbgcolor" // the text of the background
>>   #variable
>>   #define TITLE_VAR "\\" TITLE_VAR_TEXT // the name of the title variable
>>   #as regexp
>> +#define INPUT_LANG_VAR "\\" INPUT_LANG_VAR_TEXT // the name of the
>> input lang variable as regexp
>>   #define CSS_VAR "\\" CSS_VAR_TEXT // the name of the css variable as
>>   #regexp
>>   #define ADDITIONAL_VAR "\\" ADDITIONAL_VAR_TEXT // the text of the
>>   #additional text variable as regexp
>>   #define HEADER_VAR "\\" HEADER_VAR_TEXT // the text of the header
>>   #variable as regexp
>> @@ -35,7 +37,8 @@ DocTemplate::DocTemplate(const string&begin, const
>> string&end) :
>>
>>   string
>>   DocTemplate::output_begin(const string&title, const string&cs, const
>>   string&add,
>> -    const string&header, const string&footer, const
>> -    std::string&background)
>> + const string&header, const string&footer, const
>> std::string&background,
>> +    const string&input_lang)
>>   {
>>       boost::regex title_exp(TITLE_VAR);
>>       boost::regex css_exp(CSS_VAR);
>> @@ -43,6 +46,7 @@ DocTemplate::output_begin(const string&title, const
>> string&cs, const string&a
>>       boost::regex header_exp(HEADER_VAR);
>>       boost::regex footer_exp(FOOTER_VAR);
>>       boost::regex background_exp(BACKGROUND_VAR);
>> +    boost::regex input_lang_exp(INPUT_LANG_VAR);
>>
>>       string ret = subst(title_exp, begin_repr, title);
>>       ret = subst(css_exp, ret, cs);
>> @@ -50,13 +54,15 @@ DocTemplate::output_begin(const string&title,
>> const string&cs, const string&a
>>       ret = subst(header_exp, ret, header);
>>       ret = subst(footer_exp, ret, footer);
>>       ret = subst(background_exp, ret, background);
>> +    ret = subst(input_lang_exp, ret, input_lang);
>>
>>       return ret;
>>   }
>>
>>   string
>>   DocTemplate::output_end(const string&title, const string&cs, const
>>   string&add,
>> -    const string&header, const string&footer, const
>> -    std::string&background)
>> + const string&header, const string&footer, const
>> std::string&background,
>> +    const string&input_lang)
>>   {
>>       boost::regex title_exp(TITLE_VAR);
>>       boost::regex css_exp(CSS_VAR);
>> @@ -64,6 +70,7 @@ DocTemplate::output_end(const string&title, const
>> string&cs, const string&add
>>       boost::regex header_exp(HEADER_VAR);
>>       boost::regex footer_exp(FOOTER_VAR);
>>       boost::regex background_exp(BACKGROUND_VAR);
>> +    boost::regex input_lang_exp(INPUT_LANG_VAR);
>>
>>       string ret = subst(title_exp, end_repr, title);
>>       ret = subst(css_exp, ret, cs);
>> @@ -71,6 +78,7 @@ DocTemplate::output_end(const string&title, const
>> string&cs, const string&add
>>       ret = subst(header_exp, ret, header);
>>       ret = subst(footer_exp, ret, footer);
>>       ret = subst(background_exp, ret, background);
>> +    ret = subst(input_lang_exp, ret, input_lang);
>>
>>       return ret;
>>   }
>> diff --git a/lib/srchilite/doctemplate.h b/lib/srchilite/doctemplate.h
>> index 7ee0e1a..17340e6 100644
>> --- a/lib/srchilite/doctemplate.h
>> +++ b/lib/srchilite/doctemplate.h
>> @@ -22,10 +22,12 @@ public:
>>
>>       std::string output_begin(const std::string&title, const
>>       std::string&cs,
>>               const std::string&add, const std::string&header,
>> -            const std::string&footer, const std::string&background);
>> +            const std::string&footer, const std::string&background,
>> +	    const std::string&input_lang);
>>       std::string output_end(const std::string&title, const std::string&cs,
>>               const std::string&add, const std::string&header,
>> -            const std::string&footer, const std::string&background);
>> +            const std::string&footer, const std::string&background,
>> +	    const std::string&input_lang);
>>
>>       const std::string&toStringBegin() const {
>>           return begin_repr;
>> diff --git a/lib/srchilite/sourcehighlight.cpp
>> b/lib/srchilite/sourcehighlight.cpp
>> index 9c0a55b..3abaed7 100644
>> --- a/lib/srchilite/sourcehighlight.cpp
>> +++ b/lib/srchilite/sourcehighlight.cpp
>> @@ -257,6 +257,9 @@ void SourceHighlight::highlight(const
>> std::string&input,
>>           noDocGenerator->setTitle(input);
>>       }
>>
>> +    docGenerator->setInputLang(inputLang);
>> +    noDocGenerator->setInputLang(inputLang);
>> +
>>       if (ctagsFormatter) {
>>           // if we need to generate references, then set the file info
>>           ctagsFormatter->setFileInfo(input, output);
>> @@ -334,6 +337,8 @@ void
>> SourceHighlight::highlight(std::istream&input, std::ostream&output,
>>           documentGenerator->setTitle(title);
>>       }
>>
>> +    documentGenerator->setInputLang(inputLang);
>> +
>>       // first generate the start of the output file
>>       documentGenerator->generate_start_doc(&output);
>>
>> diff --git a/lib/srchilite/sourcehighlight.h
>> b/lib/srchilite/sourcehighlight.h
>> index 7d61972..4cef31e 100644
>> --- a/lib/srchilite/sourcehighlight.h
>> +++ b/lib/srchilite/sourcehighlight.h
>> @@ -64,6 +64,9 @@ class SourceHighlight {
>>       /// the title for the output document (defaults to the source file
>>       name)
>>       std::string title;
>>
>> +    /// the input lang for the output document
>> +    std::string inputLang;
>> +
>>       /// the value for the css
>>       std::string css;
>>
>> @@ -272,6 +275,10 @@ public:
>>       void setTitle(const std::string&_title) {
>>           title = _title;
>>       }
>> +
>> +    void setInputLang(const std::string&_inputLang) {
>> +        inputLang = _inputLang;
>> +    }
>>
>>       void setCss(const std::string&_css) {
>>           css = _css;
>> diff --git a/lib/tests/test_outlangparser_main.cpp
>> b/lib/tests/test_outlangparser_main.cpp
>> index 467604b..d7f51cf 100644
>> --- a/lib/tests/test_outlangparser_main.cpp
>> +++ b/lib/tests/test_outlangparser_main.cpp
>> @@ -45,7 +45,7 @@ this is simply the footer: $footer",
>>               textstyles->docTemplate.toStringEnd());
>>
>>       string start = textstyles->docTemplate.output_begin("title", "css",
>> -            "additional", "header", "footer", "");
>> +            "additional", "header", "footer", "", "INPUTLANG");
>>       cout<<  "DocTemplate start:\n"<<  start<<  endl;
>>
>>       assertEquals(
>> @@ -59,7 +59,7 @@ and this is some additional stuff: additional",
>>               start);
>>
>>       string end = textstyles->docTemplate.output_end("title", "css",
>> -            "additional", "header", "footer", "");
>> +            "additional", "header", "footer", "", "INPUTLANG");
>>       cout<<  "DocTemplate end:\n"<<  end<<  endl;
>>
>>       assertEquals(
>> diff --git a/lib/tests/test_textgenerator_main.cpp
>> b/lib/tests/test_textgenerator_main.cpp
>> index aeaef3b..ed58660 100644
>> --- a/lib/tests/test_textgenerator_main.cpp
>> +++ b/lib/tests/test_textgenerator_main.cpp
>> @@ -74,9 +74,9 @@ int main() {
>>       DocTemplate docTemplate(start, end);
>>
>>       string transformed_start = docTemplate.output_begin("TITLE", "CSS",
>> -            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
>> +            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
>>       string transformed_end = docTemplate.output_end("TITLE", "CSS",
>> -            "ADDITIONAL", "HEADER\n", "\nFOOTER", "");
>> +            "ADDITIONAL", "HEADER\n", "\nFOOTER", "", "INPUTLANG");
>>
>>       cout<<  "orig start : "<<  start<<  endl;
>>       cout<<  "transformed: "<<  transformed_start<<  endl;
>> diff --git a/src/xhtml.outlang b/src/xhtml.outlang
>> index ecc1a27..cd5d02c 100644
>> --- a/src/xhtml.outlang
>> +++ b/src/xhtml.outlang
>> @@ -7,6 +7,7 @@ doctemplate
>>   <head>
>>   <meta http-equiv=\"Content-Type\" content=\"text/html;
>>   charset=iso-8859-1\" />
>>   <meta name=\"GENERATOR\" content=\"$additional\" />
>> +<meta name=\"INPUTLANG\" content=\"$inputlang\" />
>>   <title>$title</title>
>>   </head>
>>   <body style=\"background-color: $docbgcolor\">
>> diff --git a/src/xhtmlcss.outlang b/src/xhtmlcss.outlang
>> index 215800f..1b1387f 100644
>> --- a/src/xhtmlcss.outlang
>> +++ b/src/xhtmlcss.outlang
>> @@ -7,6 +7,7 @@ doctemplate
>>   <head>
>>   <meta http-equiv=\"Content-Type\" content=\"text/html;
>>   charset=iso-8859-1\" />
>>   <meta name=\"GENERATOR\" content=\"$additional\" />
>> +<meta name=\"INPUTLANG\" content=\"$inputlang\" />
>>   <title>$title</title>
>>   <link rel=\"stylesheet\" href=\"$css\" type=\"text/css\" />
>>   </head>
>>
>> _______________________________________________
>> Help-source-highlight mailing list
>> Help-source-highlight@gnu.org
>> http://lists.gnu.org/mailman/listinfo/help-source-highlight
> 
> 
> -- 
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
> HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
> http://www.myspace.com/supertrouperabba
> BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
> http://www.gnu.org/software/src-highlite
> http://www.gnu.org/software/gengetopt
> http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
> 
> _______________________________________________
> Help-source-highlight mailing list
> Help-source-highlight@gnu.org
> https://lists.gnu.org/mailman/listinfo/help-source-highlight


From MAILER-DAEMON Sat Apr 30 22:06:09 2011
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1QGM2z-0007xd-15
	for mharc-help-source-highlight@gnu.org; Sat, 30 Apr 2011 22:06:09 -0400
Received: from eggs.gnu.org ([140.186.70.92]:33597)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QGM2w-0007xQ-P0
	for help-source-highlight@gnu.org; Sat, 30 Apr 2011 22:06:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QGM2v-0003eU-Nl
	for help-source-highlight@gnu.org; Sat, 30 Apr 2011 22:06:06 -0400
Received: from mx1.redhat.com ([209.132.183.28]:40293)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <yamato@redhat.com>) id 1QGM2v-0003eQ-90
	for help-source-highlight@gnu.org; Sat, 30 Apr 2011 22:06:05 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
	(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p41262Rl023902
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <help-source-highlight@gnu.org>; Sat, 30 Apr 2011 22:06:03 -0400
Received: from localhost (beach.nrt.redhat.com [10.64.200.71])
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id p412616f020673
	for <help-source-highlight@gnu.org>; Sat, 30 Apr 2011 22:06:02 -0400
Date: Sun, 01 May 2011 11:06:00 +0900 (JST)
Message-Id: <20110501.110600.265688718228280988.yamato@redhat.com>
To: help-source-highlight@gnu.org
From: Masatake YAMATO <yamato@redhat.com>
Organization: Red Hat Japan, Inc.
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 209.132.183.28
Subject: [Help-source-highlight] [patch] highlighting usertypes started with
	`_'
X-BeenThere: help-source-highlight@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: discussion list for source-highlight <help-source-highlight@gnu.org>
List-Id: discussion list for source-highlight <help-source-highlight.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-source-highlight>
List-Post: <mailto:help-source-highlight@gnu.org>
List-Help: <mailto:help-source-highlight-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-source-highlight>, 
	<mailto:help-source-highlight-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 01 May 2011 02:06:07 -0000

Hi,

In C program usertypes started with `_' are not highlighted expectedly.
e.g.

    typedef i __i;
    __i j = 1;

here __i is not recognized as usertype.
Usetype started with _ is popular in linux kernel.

2011-05-01  Masatake YAMATO  <yamato@redhat.com>

	* src/clike_vardeclaration.lang: Accept a usertype started with _.

diff --git a/src/clike_vardeclaration.lang b/src/clike_vardeclaration.lang
index 620c45f..bbee078 100644
--- a/src/clike_vardeclaration.lang
+++ b/src/clike_vardeclaration.lang
@@ -1,4 +1,4 @@
 (usertype,usertype,normal) = 
-`([[:alpha:]](?:[^[:punct:][:space:]]|[_])*)
+`([[:alpha:]_](?:[^[:punct:][:space:]]|[_])*)
 ((?:<.*>)?)
 (\s+(?=[*&]*[[:alpha:]][^[:punct:][:space:]]*\s*[[:punct:]\[\]]+))`


