2002-01-28 Stefan Jahn <stefan@lkcc.org>
[bpt/guile.git] / libguile / regex-posix.c
index df7fe06..3d1ef56 100644 (file)
@@ -40,8 +40,6 @@
  * If you do not wish that, delete this exception notice.
  */
 
-/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
-   gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
 
 \f
 
@@ -91,9 +89,9 @@
 #define REG_BASIC 0
 #endif
 
-scm_bits_t scm_tc16_regex;
+scm_t_bits scm_tc16_regex;
 
-static scm_sizet
+static size_t
 regex_free (SCM obj)
 {
   regfree (SCM_RGX (obj));
@@ -190,7 +188,6 @@ SCM_DEFINE (scm_make_regexp, "make-regexp", 1, 0, 1,
 
   SCM_VALIDATE_STRING (1, pat);
   SCM_VALIDATE_REST_ARGUMENT (flags);
-  SCM_STRING_COERCE_0TERMINATION_X (pat);
 
   /* Examine list of regexp flags.  If REG_BASIC is supplied, then
      turn off REG_EXTENDED flag (on by default). */
@@ -257,7 +254,6 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
   if (SCM_UNBNDP (flags))
     flags = SCM_INUM0;
   SCM_VALIDATE_INUM (4,flags);
-  SCM_STRING_COERCE_0TERMINATION_X (str);
 
   /* re_nsub doesn't account for the `subexpression' representing the
      whole regexp, so add 1 to nmatches. */
@@ -280,8 +276,8 @@ SCM_DEFINE (scm_regexp_exec, "regexp-exec", 2, 2, 0,
          SCM_VELTS(mvec)[i+1] = scm_cons (SCM_MAKINUM (-1), SCM_MAKINUM (-1));
        else
          SCM_VELTS(mvec)[i+1]
-           = scm_cons(SCM_MAKINUM(matches[i].rm_so + offset),
-                      SCM_MAKINUM(matches[i].rm_eo + offset));
+           = scm_cons (scm_long2num (matches[i].rm_so + offset),
+                       scm_long2num (matches[i].rm_eo + offset));
     }
   scm_must_free ((char *) matches);
   SCM_ALLOW_INTS;
@@ -303,14 +299,14 @@ scm_init_regex_posix ()
   scm_set_smob_free (scm_tc16_regex, regex_free);
 
   /* Compilation flags.  */
-  scm_sysintern ("regexp/basic", scm_long2num (REG_BASIC));
-  scm_sysintern ("regexp/extended", scm_long2num (REG_EXTENDED));
-  scm_sysintern ("regexp/icase", scm_long2num (REG_ICASE));
-  scm_sysintern ("regexp/newline", scm_long2num (REG_NEWLINE));
+  scm_c_define ("regexp/basic", scm_long2num (REG_BASIC));
+  scm_c_define ("regexp/extended", scm_long2num (REG_EXTENDED));
+  scm_c_define ("regexp/icase", scm_long2num (REG_ICASE));
+  scm_c_define ("regexp/newline", scm_long2num (REG_NEWLINE));
 
   /* Execution flags.  */
-  scm_sysintern ("regexp/notbol", scm_long2num (REG_NOTBOL));
-  scm_sysintern ("regexp/noteol", scm_long2num (REG_NOTEOL));
+  scm_c_define ("regexp/notbol", scm_long2num (REG_NOTBOL));
+  scm_c_define ("regexp/noteol", scm_long2num (REG_NOTEOL));
 
 #ifndef SCM_MAGIC_SNARFER
 #include "libguile/regex-posix.x"