Update of /cvsroot/mahogany/M/src/util
In directory usw-pr-cvs1:/tmp/cvs-serv5760/src/util

Modified Files:
        strutil.cpp 
Added Files:
        matchurl.cpp 
Log Message:
use Xavier's Aho-Cora code instead of the old awfully inefficient version for the URL 
matching

***** Error reading new file: [Errno 2] No such file or directory: 'matchurl.cpp'
Index: strutil.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/strutil.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -b -u -2 -r1.103 -r1.104
--- strutil.cpp 18 Apr 2002 23:25:46 -0000      1.103
+++ strutil.cpp 25 Apr 2002 18:25:41 -0000      1.104
@@ -255,81 +255,4 @@
 }
 
-static const char *urlnames[] =
-{
-   "http:",
-   "https:",
-   "ftp:",
-   "gopher:",
-   "wysiwyg:",
-   "telnet:",
-   "wais:",
-   "mailto:";,
-   "file:",
-   NULL
-};
-
-String
-strutil_matchurl(const char *string)
-{
-   int i;
-   String url = "";
-   const char * cptr;
-
-
-   for(i = 0; urlnames[i]; i++)
-      if(strcmp(string,urlnames[i]) >= 0)
-         {
-            cptr = string + strlen(urlnames[i]);
-            if(isspace(*cptr) || *cptr == '\0')
-               break;  // "file: " doesn't count!
-            cptr = string;
-            while(*cptr && ! isspace(*cptr))
-            {
-               url += *cptr;
-               cptr++;
-            }
-            return url;
-         }
-   return String("");
-}
-
-String
-strutil_findurl(String &str, String &url)
-{
-   String before;
-   before.reserve(str.length());
-
-   url.clear();
-
-   const char *cptr = str.c_str();
-   while(*cptr)
-   {
-      for(int i = 0; urlnames[i]; i++)
-      {
-         if(strncmp(cptr,urlnames[i],strlen(urlnames[i])) == 0
-            && strutil_isurlchar(cptr[strlen(urlnames[i])])
-            && ((cptr == str.c_str() || !strutil_isurlchar(*(cptr-1))))
-           )
-         {
-            // found the start of the URL, now find its end
-            while( *cptr && strutil_isurlchar(*cptr) )
-               url += *cptr++;
-
-            String tmp;
-            tmp = cptr; // cannot assign directly as cptr points into
-            str = tmp;  // str, so using a temporary string in between
-
-            return before;
-         }
-      }
-      before += *cptr++;
-   }
-
-   // no URLs found, return the copy of the whole string as "before URL" part
-   str.clear();
-   return before;
-}
-
-
 int
 strutil_countquotinglevels(const char *string, int max_white, int max_alpha)


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to