OSSP CVS Repository

ossp - Check-in [178]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 178
Date: 2000-Nov-19 20:48:39 (local)
2000-Nov-19 19:48:39 (UTC)
User:rse
Branch:
Comment: *** empty log message ***
Tickets:
Inspections:
Files:
ossp-pkg/str/ChangeLog      1.26 -> 1.27     5 inserted, 2 deleted
ossp-pkg/str/shtool      1.4 -> 1.5     22 inserted, 4 deleted
ossp-pkg/str/str_pcre_mk.c      added-> 1.2
ossp-pkg/str/str_search.c      added-> 1.15

ossp-pkg/str/ChangeLog 1.26 -> 1.27

--- ChangeLog    2000/07/14 15:24:16     1.26
+++ ChangeLog    2000/11/20 19:48:39     1.27
@@ -9,9 +9,12 @@
 
  ChangeLog
 
- Changes between 0.9.4 and 0.9.5 (14-Jul-2000 to xx-Jul-2000):
+ Changes between 0.9.4 and 0.9.5 (14-Jul-2000 to xx-Nov-2000):
 
-   *) Updated str_version.c to new GNU shtool 1.5.0 format.
+   *) Fix unsigned vs. signed problem in str_span.c.
+      [Joseph Heenan <joseph@picsel.com>]
+
+   *) Updated str_version.c to new GNU shtool 1.5.1 format.
       [Ralf S. Engelschall]
 
  Changes between 0.9.3 and 0.9.4 (04-Feb-2000 to 14-Jul-2000):


ossp-pkg/str/shtool 1.4 -> 1.5

--- shtool       2000/07/14 11:09:10     1.4
+++ shtool       2000/11/20 19:48:39     1.5
@@ -6,7 +6,7 @@
 ##  See http://www.gnu.org/software/shtool/ for more information.
 ##  See ftp://ftp.gnu.org/gnu/shtool/ for latest version.
 ##
-##  Version:  1.5.0 (01-Jul-2000)
+##  Version:  1.5.1 (29-Jul-2000)
 ##  Contents: 6/17 available modules
 ##
 
@@ -65,7 +65,7 @@
     exit 1
 fi
 if [ ".$1" = ".-h" -o ".$1" = ".--help" ]; then
-    echo "This is GNU shtool, version 1.5.0 (01-Jul-2000)"
+    echo "This is GNU shtool, version 1.5.1 (29-Jul-2000)"
     echo "Copyright (c) 1994-2000 Ralf S. Engelschall <rse@engelschall.com>"
     echo "Report bugs to <bug-shtool@gnu.org>"
     echo ''
@@ -105,7 +105,7 @@
     exit 0
 fi
 if [ ".$1" = ".-v" -o ".$1" = ."--version" ]; then
-    echo "GNU shtool 1.5.0 (01-Jul-2000)"
+    echo "GNU shtool 1.5.1 (29-Jul-2000)"
     exit 0
 fi
 if [ ".$1" = ".-r" -o ".$1" = ."--recreate" ]; then
@@ -1084,7 +1084,8 @@
         s     ) typnum=15; levnum=255  ;; # snapshots are special
     esac
     hex=`echo "$ver:$rev:$typnum:$levnum" |\
-         awk -F: '{ printf("0x%X%02X%1X%02X", $1, $2, $3, $4); }'`
+         awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\
+         tr 'abcdef' 'ABCDEF'`
     ltv=`echo "$ver:$rev:$typnum:$levnum" |\
          awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'`
     
@@ -1250,6 +1251,23 @@
                 echo >>$file "1;"
                 echo >>$file ""
                 ;;
+            python )
+                echo >>$file "##"
+                echo >>$file "##  ${file} -- Version Information for ${name} (syntax: Python)"
+                echo >>$file "##  [automatically generated and maintained by GNU shtool]"
+                echo >>$file "##"
+                echo >>$file ""
+                echo >>$file "class ${prefix}version:"
+                echo >>$file "    v_hex       = ${vHex}"
+                echo >>$file "    v_short     = \"${vShort}\""
+                echo >>$file "    v_long      = \"${vLong}\""
+                echo >>$file "    v_tex       = \"${vTeX}\""
+                echo >>$file "    v_gnu       = \"${vGNU}\""
+                echo >>$file "    v_web       = \"${vWeb}\""
+                echo >>$file "    v_sccs      = \"${vSCCS}\""
+                echo >>$file "    v_rcs       = \"${vRCS}\""
+                echo >>$file ""
+                ;;
             * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2
                 exit 1
                 ;;


ossp-pkg/str/str_pcre_mk.c -> 1.2

*** /dev/null    Sat Nov 23 01:26:37 2024
--- -    Sat Nov 23 01:26:55 2024
***************
*** 0 ****
--- 1,206 ----
+ /*************************************************
+ *      Perl-Compatible Regular Expressions       *
+ *************************************************/
+ 
+ /*
+ PCRE is a library of functions to support regular expressions whose syntax
+ and semantics are as close as possible to those of the Perl 5 language.
+ 
+ Written by: Philip Hazel <ph10@cam.ac.uk>
+ 
+            Copyright (c) 1997-1999 University of Cambridge
+ 
+ -----------------------------------------------------------------------------
+ Permission is granted to anyone to use this software for any purpose on any
+ computer system, and to redistribute it freely, subject to the following
+ restrictions:
+ 
+ 1. This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ 
+ 2. The origin of this software must not be misrepresented, either by
+    explicit claim or by omission.
+ 
+ 3. Altered versions must be plainly marked as such, and must not be
+    misrepresented as being the original software.
+ 
+ 4. If PCRE is embedded in any software that is released under the GNU
+    General Purpose Licence (GPL), then the terms of that licence shall
+    supersede any condition above with which it is incompatible.
+ -----------------------------------------------------------------------------
+ 
+ See the file Tech.Notes for some information on the internals.
+ */
+ 
+ 
+ /* This is a support program to generate the file chartables.c, containing
+ character tables of various kinds. They are built according to the default C
+ locale and used as the default tables by PCRE. Now that pcre_maketables is
+ a function visible to the outside world, we make use of its code from here in
+ order to be consistent. */
+ 
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <string.h>
+ 
+ #include "str_pcre_p.h"
+ 
+ #define DFTABLES          /* maketables.c notices this */
+ 
+ /*************************************************
+ *           Create PCRE character tables         *
+ *************************************************/
+ 
+ /* This function builds a set of character tables for use by PCRE and returns
+ a pointer to them. They are build using the ctype functions, and consequently
+ their contents will depend upon the current locale setting. When compiled as
+ part of the library, the store is obtained via pcre_malloc(), but when compiled
+ inside dftables, use malloc().
+ 
+ Arguments:   none
+ Returns:     pointer to the contiguous block of data
+ */
+ 
+ unsigned const char *
+ pcre_maketables(void)
+ {
+ unsigned char *yield, *p;
+ int i;
+ 
+ #ifndef DFTABLES
+ yield = (unsigned char*)(pcre_malloc)(tables_length);
+ #else
+ yield = (unsigned char*)malloc(tables_length);
+ #endif
+ 
+ if (yield == NULL) return NULL;
+ p = yield;
+ 
+ /* First comes the lower casing table */
+ 
+ for (i = 0; i < 256; i++) *p++ = tolower(i);
+ 
+ /* Next the case-flipping table */
+ 
+ for (i = 0; i < 256; i++) *p++ = islower(i)? toupper(i) : tolower(i);
+ 
+ /* Then the character class tables */
+ 
+ memset(p, 0, cbit_length);
+ for (i = 0; i < 256; i++)
+   {
+   if (isdigit(i)) p[cbit_digit  + i/8] |= 1 << (i&7);
+   if (isalnum(i) || i == '_')
+                   p[cbit_word   + i/8] |= 1 << (i&7);
+   if (isspace(i)) p[cbit_space  + i/8] |= 1 << (i&7);
+   }
+ p += cbit_length;
+ 
+ /* Finally, the character type table */
+ 
+ for (i = 0; i < 256; i++)
+   {
+   int x = 0;
+   if (isspace(i)) x += ctype_space;
+   if (isalpha(i)) x += ctype_letter;
+   if (isdigit(i)) x += ctype_digit;
+   if (isxdigit(i)) x += ctype_xdigit;
+   if (isalnum(i) || i == '_') x += ctype_word;
+   if (strchr("*+?{^.$|()[", i) != 0) x += ctype_meta;
+   *p++ = x;
+   }
+ 
+ return yield;
+ }
+ 
+ /*
+  * MAIN PROCEDURE
+  */
+ 
+ int main(void)
+ {
+ int i;
+ unsigned const char *tables = pcre_maketables();
+ 
+ printf(
+   "\n"
+   "static unsigned char pcre_default_tables[] = {\n\n"
+   "/* This table is a lower casing table. */\n\n");
+ 
+ printf("  ");
+ for (i = 0; i < 256; i++)
+   {
+   if ((i & 7) == 0 && i != 0) printf("\n  ");
+   printf("%3d", *tables++);
+   if (i != 255) printf(",");
+   }
+ printf(",\n\n");
+ 
+ printf("/* This table is a case flipping table. */\n\n");
+ 
+ printf("  ");
+ for (i = 0; i < 256; i++)
+   {
+   if ((i & 7) == 0 && i != 0) printf("\n  ");
+   printf("%3d", *tables++);
+   if (i != 255) printf(",");
+   }
+ printf(",\n\n");
+ 
+ printf(
+   "/* This table contains bit maps for digits, 'word' chars, and white\n"
+   "space. Each map is 32 bytes long and the bits run from the least\n"
+   "significant end of each byte. */\n\n");
+ 
+ printf("  ");
+ for (i = 0; i < cbit_length; i++)
+   {
+   if ((i & 7) == 0 && i != 0)
+     {
+     if ((i & 31) == 0) printf("\n");
+     printf("\n  ");
+     }
+   printf("0x%02x", *tables++);
+   if (i != cbit_length - 1) printf(",");
+   }
+ printf(" ,\n\n");
+ 
+ printf(
+   "/* This table identifies various classes of character by individual bits:\n"
+   "  0x%02x   white space character\n"
+   "  0x%02x   letter\n"
+   "  0x%02x   decimal digit\n"
+   "  0x%02x   hexadecimal digit\n"
+   "  0x%02x   alphanumeric or '_'\n"
+   "  0x%02x   regular expression metacharacter or binary zero\n*/\n\n",
+   ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word,
+   ctype_meta);
+ 
+ printf("  ");
+ for (i = 0; i < 256; i++)
+   {
+   if ((i & 7) == 0 && i != 0)
+     {
+     printf(" /* ");
+     if (isprint(i-8)) printf(" %c -", i-8);
+       else printf("%3d-", i-8);
+     if (isprint(i-1)) printf(" %c ", i-1);
+       else printf("%3d", i-1);
+     printf(" */\n  ");
+     }
+   printf("0x%02x", *tables++);
+   if (i != 255) printf(",");
+   }
+ 
+ printf("};/* ");
+ if (isprint(i-8)) printf(" %c -", i-8);
+   else printf("%3d-", i-8);
+ if (isprint(i-1)) printf(" %c ", i-1);
+   else printf("%3d", i-1);
+ printf(" */\n\n/* End of chartables.c */\n");
+ 
+ return 0;
+ }
+ 
+ /* End of dftables.c */


ossp-pkg/str/str_search.c -> 1.15

*** /dev/null    Sat Nov 23 01:26:37 2024
--- -    Sat Nov 23 01:26:55 2024
***************
*** 0 ****
--- 1,190 ----
+ /*
+ **  Str - String Library
+ **  Copyright (c) 1999-2000 Ralf S. Engelschall <rse@engelschall.com>
+ **
+ **  This file is part of Str, a string handling and manipulation 
+ **  library which can be found at http://www.engelschall.com/sw/str/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  str_search.c: searching functions
+ */
+ 
+ #include "str_p.h"
+  
+ /*
+  * str_span -- span over a set of character in a string.
+  * This is a spanning function inspired by POSIX strchr(3) and
+  * strrchr(3). But it is more flexible, because it provides
+  * left-to-right and right-to-left spanning combined with either
+  * performing positive or negative charsets. Additionally it allows one
+  * to restrict the number of maximum spanned characters.
+  */
+ char *str_span(const char *s, str_size_t m, const char *charset, int mode)
+ {
+     register const char *sp;
+     register const char *cp;
+     register char sc, cc;
+     register int n;
+     char *rv;
+ 
+     if (s == NULL || charset == NULL)
+         return NULL;
+     n = m;
+     if (n == 0)
+         str_ilen(n, s);
+     rv = NULL;
+     if (!(mode & STR_RIGHT) && !(mode & STR_COMPLEMENT)) {
+         /* span from left to right while chars are in charset */
+         sp = s; 
+         l1:
+         sc = *sp++; n--;
+         if (sc != NUL && n >= 0) {
+             for (cp = charset; (cc = *cp++) != NUL; )
+                 if (sc == cc)
+                     goto l1;
+         }
+         rv = (char *)(sp - 1);
+     }
+     else if ((mode & STR_RIGHT) && !(mode & STR_COMPLEMENT)) {
+         /* span from right to left while chars are in charset */
+         sp = s;
+         while (*sp != NUL && n > 0)
+             sp++, n--;
+         if (sp > s)
+             sp--;
+         l2:
+         sc = *sp--;
+         if (sp >= s) {
+             for (cp = charset; (cc = *cp++) != NUL; )
+                 if (sc == cc)
+                     goto l2;
+         }
+         rv = (char *)(sp + 1);
+     }
+     else if (!(mode & STR_RIGHT) && (mode & STR_COMPLEMENT)) {
+         /* span from left to right while chars are NOT in charset */
+         sp = s; 
+         l3a:
+         sc = *sp++; n--;
+         if (sc != NUL && n >= 0) {
+             for (cp = charset; (cc = *cp++) != NUL; )
+                 if (sc == cc)
+                     goto l3;
+             goto l3a;
+         }
+         l3:
+         rv = (char *)(sp - 1);
+     }
+     else if ((mode & STR_RIGHT) && (mode & STR_COMPLEMENT)) {
+         /* span from right to left while chars are NOT in charset */
+         sp = s;
+         while (*sp != NUL && n > 0)
+             sp++, n--;
+         if (sp > s)
+             sp--;
+         l4a:
+         sc = *sp--;
+         if (sp >= s) {
+             for (cp = charset; (cc = *cp++) != NUL; )
+                 if (sc == cc)
+                     goto l4;
+             goto l4a;
+         }
+         l4:
+         rv = (char *)(sp + 1);
+     }
+     return rv;
+ }
+ 
+ /*
+  * str_locate - locate a string in another one.
+  * This is an optimized version of SUNDAY's Quick Search algorithm
+  * which it turn is a simplification of the Boyer-Moore text searching
+  * algorithm. It is very fast in practice for short patterns and long
+  * alphabets, because the bad-character shift used in the Boyer-Moore
+  * algorithm is not very efficient for small alphabets. But when the
+  * alphabet is large compared with the length of the pattern, as it is
+  * often the case with the ASCII table and ordinary searches made under
+  * a text editor or similar applications, it becomes very useful. Using
+  * it alone produces a very efficient algorithm in practice. It has a
+  * quadratic worst-case time complexity but a good practical behaviour.
+  * The implementation below was speed-optimized, too.
+  */
+ char *str_locate(const char *ay, str_size_t n, const char *ax)
+ {
+     int qs_bc[256 /* 2^8 */];
+     register const unsigned char *x = (const unsigned char *)ax;
+     register const unsigned char *y = (const unsigned char *)ay;
+     register int m;
+     register int i;
+     register const unsigned char *tx;
+     register const unsigned char *ty;
+     int tm;
+ 
+     /*
+      * Consistency checks
+      */
+     if (y == NULL || x == NULL)
+         return NULL;
+     if (*x == NUL)
+         return (char *)y;
+ 
+     /* 
+      * Preprocessing
+      */
+ 
+     /* determine length of strings */
+     str_ilen(m, x);
+     if (n == 0) 
+         str_ilen(n, y);
+ 
+     /* fill whole bad char skip array */
+     for (i = 0; i < (sizeof(qs_bc)/sizeof(int)); i++) 
+         qs_bc[(int)i] = m+1;
+ 
+     /* override positions related to pattern */
+     for (i = 0; i < m; i++) 
+         qs_bc[(int)*(x+i)] = m-i;
+                           
+     /* 
+      * Searching
+      */
+ 
+     /* search inside a len-terminated string */
+     while (n >= m) {
+         /* compare first char (speed-up) */
+         if (*y == *x) {
+             /* compare remaining chars */
+             ty = y+1;
+             tx = x+1;
+             tm = m-1;
+             do {
+                 if (tm-- == 0)
+                     return (char *)y; /* found pattern */
+             } while (*ty++ == *tx++);
+         }
+         i = qs_bc[(int)*(y+m)];  /* perform shift */
+         y += i;
+         n -= i;
+     }
+ 
+     return NULL;
+ }
+ 

CVSTrac 2.0.1