bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] make suffix list of include file configurable


From: Hideki IWAMOTO
Subject: [PATCH] make suffix list of include file configurable
Date: Mon, 30 Aug 2004 22:33:56 +0900

This patch makes suffix list of include file configurable.
Any comment?

Index: htags/fileindex.c
===================================================================
RCS file: /cvsroot/global/global/htags/fileindex.c,v
retrieving revision 1.7
diff -u -r1.7 fileindex.c
--- htags/fileindex.c   5 Aug 2004 12:24:37 -0000       1.7
+++ htags/fileindex.c   30 Aug 2004 13:16:25 -0000
@@ -588,9 +588,23 @@
 
        if (w32)
                flags |= REG_ICASE;
-       pattern = "\\.(h|hxx|hpp|H|inc\\.php)$";
-       if (regcomp(&is_include_file, pattern, flags) != 0)
-               die("cannot compile regular expression '%s'.", pattern);
+       strbuf_reset(sb);
+       strbuf_puts(sb, "\\.(");
+       {
+               char *p = include_file_suffixes;
+               int c;
+
+               while ((c = (unsigned char)*p++) != '\0') {
+                       if (isregexchar(c))
+                               strbuf_putc(sb, '\\');
+                       else if (c == ',')
+                               c = '|';
+                       strbuf_putc(sb, c);
+               }
+       }
+       strbuf_puts(sb, ")$");
+       if (regcomp(&is_include_file, strbuf_value(sb), flags) != 0)
+               die("cannot compile regular expression '%s'.", 
strbuf_value(sb));
        pattern = "\\.(h|c|y|c\\+\\+|cc|cpp|cxx|hxx|hpp|C|H)$";
        if (regcomp(&is_c_file, pattern, flags) != 0)
                die("cannot compile regular expression '%s'.", pattern);
Index: htags/htags.c
===================================================================
RCS file: /cvsroot/global/global/htags/htags.c,v
retrieving revision 1.11
diff -u -r1.11 htags.c
--- htags/htags.c       13 Aug 2004 13:14:52 -0000      1.11
+++ htags/htags.c       30 Aug 2004 13:16:25 -0000
@@ -197,6 +197,7 @@
 int cgi = 1;                           /* 1: make cgi-bin/             */
 int definition_header=NO_HEADER;       /* (NO|BEFORE|RIGHT|AFTER)_HEADER */
 char *htags_options = NULL;
+char *include_file_suffixes = "h,hxx,hpp,H,inc.php";
 
 static struct option const long_options[] = {
         {"alphabet", no_argument, NULL, 'a'},
@@ -1186,6 +1187,13 @@
                        free(p);
                }
        }
+       strbuf_reset(sb);
+       if (getconfs("include_file_suffixes", sb)) {
+               p = strdup(strbuf_value(sb));
+               if (p == NULL)
+                       die("short of memory.");
+               include_file_suffixes = p;
+       }
        /* insert htags_options into the head of ARGSV array. */
        strbuf_reset(sb);
        if (getconfs("htags_options", sb)) {
Index: htags/htags.h
===================================================================
RCS file: /cvsroot/global/global/htags/htags.h,v
retrieving revision 1.4
diff -u -r1.4 htags.h
--- htags/htags.h       3 Aug 2004 21:51:33 -0000       1.4
+++ htags/htags.h       30 Aug 2004 13:16:25 -0000
@@ -151,5 +151,6 @@
 extern int cgi;
 extern int definition_header;
 extern char *htags_options;
+extern char *include_file_suffixes;
 
 #endif /* _HTAGS_H_ */
Index: htags/manual.in
===================================================================
RCS file: /cvsroot/global/global/htags/manual.in,v
retrieving revision 1.61
diff -u -r1.61 manual.in
--- htags/manual.in     12 Aug 2004 04:54:26 -0000      1.61
+++ htags/manual.in     30 Aug 2004 13:16:25 -0000
@@ -254,6 +254,8 @@
        @address@hidden(boolean)}
                Enable id-utils search using CGI program. The default is false.
                When this function is enabled, you cannot move hypertext from 
source directory.
+       @address@hidden(comma separated list)}
+               Suffixes of include file. The default is 'h,hxx,hpp,H,inc.php'.
        @end_itemize
 @DIAGNOSTICS
        @name{Htags} exits with a non 0 value if an error occurred, 0 otherwise.

----
Hideki IWAMOTO  address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]