guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core NEWS RELEASE libguile/ChangeLo...


From: Dirk Herrmann
Subject: guile/guile-core NEWS RELEASE libguile/ChangeLo...
Date: Tue, 23 Jan 2001 16:02:43 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Dirk Herrmann <address@hidden>  01/01/23 16:02:43

Modified files:
        guile-core     : NEWS RELEASE 
        guile-core/libguile: ChangeLog filesys.c filesys.h validate.h 

Log message:
        * Separate the handling of OPEN flags between ports and directories.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/NEWS.diff?r1=1.240&r2=1.241
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/RELEASE.diff?r1=1.85&r2=1.86
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1240&r2=1.1241
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/filesys.c.diff?r1=1.88&r2=1.89
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/filesys.h.diff?r1=1.28&r2=1.29
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/validate.h.diff?r1=1.24&r2=1.25

Patches:
Index: guile/guile-core/NEWS
diff -u guile/guile-core/NEWS:1.240 guile/guile-core/NEWS:1.241
--- guile/guile-core/NEWS:1.240 Sun Jan 21 14:11:29 2001
+++ guile/guile-core/NEWS       Tue Jan 23 16:02:42 2001
@@ -393,6 +393,10 @@
 
 Use instead of SCM_COERCE_SUBSTR.
 
+** New macros:  SCM_DIR_OPEN_P, SCM_DIR_FLAG_OPEN
+
+For directory objects, use these instead of SCM_OPDIRP and SCM_OPN.
+
 ** Deprecated macros:  SCM_OUTOFRANGE, SCM_NALLOC, SCM_HUP_SIGNAL, 
 SCM_INT_SIGNAL, SCM_FPE_SIGNAL, SCM_BUS_SIGNAL, SCM_SEGV_SIGNAL, 
 SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD, 
@@ -403,7 +407,8 @@
 SCM_SUBSTRP, SCM_SUBSTR_STR, SCM_SUBSTR_OFFSET, SCM_COERCE_SUBSTR,
 SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING, SCM_ROCHARS,
 SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX, SCM_GC8MARKP,
-SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC
+SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR, SCM_SUBR_DOC,
+SCM_OPDIRP, SCM_VALIDATE_OPDIR
 
 Use SCM_ASSERT_RANGE or SCM_VALIDATE_XXX_RANGE instead of SCM_OUTOFRANGE.
 Use scm_memory_error instead of SCM_NALLOC.
@@ -427,6 +432,7 @@
 Use SCM_CLRGCMARK instead of SCM_CLRGC8MARK.
 Use SCM_TYP16 instead of SCM_GCTYP16.
 Use SCM_CDR instead of SCM_GCCDR.
+Use SCM_DIR_OPEN_P instead of SCM_OPDIRP.
 
 ** Removed function:  scm_struct_init
 
Index: guile/guile-core/RELEASE
diff -u guile/guile-core/RELEASE:1.85 guile/guile-core/RELEASE:1.86
--- guile/guile-core/RELEASE:1.85       Thu Dec 28 08:49:08 2000
+++ guile/guile-core/RELEASE    Tue Jan 23 16:02:42 2001
@@ -54,7 +54,7 @@
   SCM_COERCE_SUBSTR, SCM_ROSTRINGP, SCM_RWSTRINGP, SCM_VALIDATE_RWSTRING,
   SCM_ROCHARS, SCM_ROUCHARS, SCM_SETLENGTH, SCM_SETCHARS, SCM_LENGTH_MAX,
   SCM_GC8MARKP, SCM_SETGC8MARK, SCM_CLRGC8MARK, SCM_GCTYP16, SCM_GCCDR,
-  SCM_SUBR_DOC
+  SCM_SUBR_DOC, SCM_OPDIRP, SCM_VALIDATE_OPDIR
 - remove scm_vector_set_length_x
 - remove function scm_call_catching_errors
   (replaced by catch functions from throw.[ch])
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1240 
guile/guile-core/libguile/ChangeLog:1.1241
--- guile/guile-core/libguile/ChangeLog:1.1240  Mon Jan 22 05:32:07 2001
+++ guile/guile-core/libguile/ChangeLog Tue Jan 23 16:02:42 2001
@@ -1,3 +1,21 @@
+2001-01-24  Dirk Herrmann  <address@hidden>
+
+       * filesys.h (SCM_DIR_FLAG_OPEN, SCM_DIR_OPEN_P):  Added.
+
+       (SCM_OPDIRP):  Deprecated.
+
+       * filesys.c (scm_opendir):  Use SCM_DIR_FLAG_OPEN instead of
+       SCM_OPN.
+
+       (scm_readdir, scm_rewinddir):  Don't use SCM_VALIDATE_OPDIR.
+       Instead, give an explicit error message in case the directory is
+       closed.
+
+       (scm_closedir, scm_dir_print):  Rewritten to use SCM_DIR_OPEN_P
+       instead of SCM_OPENP and SCM_CLOSEDP.
+
+       * validate.h (SCM_VALIDATE_OPDIR):  Deprecated.
+
 2001-01-22  Dirk Herrmann  <address@hidden>
 
        * eval.c (inner_eval, scm_eval):  Move all real functionality into
Index: guile/guile-core/libguile/filesys.c
diff -u guile/guile-core/libguile/filesys.c:1.88 
guile/guile-core/libguile/filesys.c:1.89
--- guile/guile-core/libguile/filesys.c:1.88    Fri Dec  8 09:32:56 2000
+++ guile/guile-core/libguile/filesys.c Tue Jan 23 16:02:43 2001
@@ -673,21 +673,24 @@
 #endif
 
 
+
 /* {Examining Directories}
  */
 
 scm_bits_t scm_tc16_dir;
 
+
 SCM_DEFINE (scm_directory_stream_p, "directory-stream?", 1, 0, 0, 
             (SCM obj),
            "Returns a boolean indicating whether @var{object} is a directory 
stream\n"
            "as returned by @code{opendir}.")
 #define FUNC_NAME s_scm_directory_stream_p
 {
-  return SCM_BOOL(SCM_DIRP (obj));
+  return SCM_BOOL (SCM_DIRP (obj));
 }
 #undef FUNC_NAME
 
+
 SCM_DEFINE (scm_opendir, "opendir", 1, 0, 0, 
             (SCM dirname),
            "Open the directory specified by @var{path} and return a 
directory\n"
@@ -700,7 +703,7 @@
   SCM_SYSCALL (ds = opendir (SCM_STRING_CHARS (dirname)));
   if (ds == NULL)
     SCM_SYSERROR;
-  SCM_RETURN_NEWSMOB (scm_tc16_dir | SCM_OPN, ds);
+  SCM_RETURN_NEWSMOB (scm_tc16_dir | SCM_DIR_FLAG_OPEN, ds);
 }
 #undef FUNC_NAME
 
@@ -713,61 +716,68 @@
 #define FUNC_NAME s_scm_readdir
 {
   struct dirent *rdent;
-  SCM_VALIDATE_OPDIR (1,port);
+
+  SCM_VALIDATE_DIR (1, port);
+  if (!SCM_DIR_OPEN_P (port))
+    SCM_MISC_ERROR ("Directory ~S is not open.", SCM_LIST1 (port));
+
   errno = 0;
   SCM_SYSCALL (rdent = readdir ((DIR *) SCM_CELL_WORD_1 (port)));
   if (errno != 0)
     SCM_SYSERROR;
+
   return (rdent ? scm_makfromstr (rdent->d_name, NAMLEN (rdent), 0)
          : SCM_EOF_VAL);
 }
 #undef FUNC_NAME
 
 
-
 SCM_DEFINE (scm_rewinddir, "rewinddir", 1, 0, 0, 
             (SCM port),
            "Reset the directory port @var{stream} so that the next call to\n"
            "@code{readdir} will return the first directory entry.")
 #define FUNC_NAME s_scm_rewinddir
 {
-  SCM_VALIDATE_OPDIR (1,port);
+  SCM_VALIDATE_DIR (1, port);
+  if (!SCM_DIR_OPEN_P (port))
+    SCM_MISC_ERROR ("Directory ~S is not open.", SCM_LIST1 (port));
+
   rewinddir ((DIR *) SCM_CELL_WORD_1 (port));
+
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
 
 
-
 SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0, 
             (SCM port),
            "Close the directory stream @var{stream}.\n"
            "The return value is unspecified.")
 #define FUNC_NAME s_scm_closedir
 {
-  int sts;
+  SCM_VALIDATE_DIR (1, port);
 
-  SCM_VALIDATE_DIR (1,port);
-  if (SCM_CLOSEDP (port))
+  if (SCM_DIR_OPEN_P (port))
     {
-      return SCM_UNSPECIFIED;
+      int sts;
+
+      SCM_SYSCALL (sts = closedir ((DIR *) SCM_CELL_WORD_1 (port)));
+      if (sts != 0)
+       SCM_SYSERROR;
+
+      SCM_SET_CELL_WORD_0 (port, scm_tc16_dir);
     }
-  SCM_SYSCALL (sts = closedir ((DIR *) SCM_CELL_WORD_1 (port)));
-  if (sts != 0)
-    SCM_SYSERROR;
-  SCM_SET_CELL_WORD_0 (port, scm_tc16_dir);
+
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
 
 
-
-
 static int 
 scm_dir_print (SCM exp, SCM port, scm_print_state *pstate)
 {
   scm_puts ("#<", port);
-  if (SCM_CLOSEDP (exp))
+  if (!SCM_DIR_OPEN_P (exp))
     scm_puts ("closed: ", port);
   scm_puts ("directory stream ", port);
   scm_intprint (SCM_CELL_WORD_1 (exp), 16, port);
@@ -779,7 +789,7 @@
 static scm_sizet 
 scm_dir_free (SCM p)
 {
-  if (SCM_OPENP (p))
+  if (SCM_DIR_OPEN_P (p))
     closedir ((DIR *) SCM_CELL_WORD_1 (p));
   return 0;
 }
Index: guile/guile-core/libguile/filesys.h
diff -u guile/guile-core/libguile/filesys.h:1.28 
guile/guile-core/libguile/filesys.h:1.29
--- guile/guile-core/libguile/filesys.h:1.28    Fri Dec  8 09:32:56 2000
+++ guile/guile-core/libguile/filesys.h Tue Jan 23 16:02:43 2001
@@ -53,8 +53,11 @@
 
 
 extern scm_bits_t scm_tc16_dir;
+
+#define SCM_DIR_FLAG_OPEN (1L << 16)
+
 #define SCM_DIRP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_dir))
-#define SCM_OPDIRP(x) (!SCM_IMP (x) && (SCM_CELL_WORD_0 (x) == (scm_tc16_dir | 
SCM_OPN)))
+#define SCM_DIR_OPEN_P(x) (SCM_CELL_WORD_0 (x) & SCM_DIR_FLAG_OPEN)
 
 
 
@@ -89,6 +92,14 @@
 extern SCM scm_basename (SCM filename, SCM suffix);
 
 extern void scm_init_filesys (void);
+
+
+
+#if (SCM_DEBUG_DEPRECATED == 0)
+
+#define SCM_OPDIRP(x) (SCM_DIRP (x) && (SCM_DIR_OPEN_P (x)))
+
+#endif  /* SCM_DEBUG_DEPRECATED == 0 */
 
 #endif  /* FILESYSH */
 
Index: guile/guile-core/libguile/validate.h
diff -u guile/guile-core/libguile/validate.h:1.24 
guile/guile-core/libguile/validate.h:1.25
--- guile/guile-core/libguile/validate.h:1.24   Mon Jan  8 15:10:06 2001
+++ guile/guile-core/libguile/validate.h        Tue Jan 23 16:02:43 2001
@@ -1,4 +1,4 @@
-/* $Id: validate.h,v 1.24 2001/01/08 23:10:06 ghouston Exp $ */
+/* $Id: validate.h,v 1.25 2001/01/24 00:02:43 dirk Exp $ */
 /*     Copyright (C) 1999, 2000 Free Software Foundation, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -337,8 +337,6 @@
 
 #define SCM_VALIDATE_RGXP(pos, a) SCM_MAKE_VALIDATE (pos, a, RGXP)
 
-#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
-
 #define SCM_VALIDATE_DIR(pos, port) SCM_MAKE_VALIDATE (pos, port, DIRP)
 
 #define SCM_VALIDATE_PORT(pos, port) SCM_MAKE_VALIDATE (pos, port, PORTP)
@@ -436,6 +434,8 @@
     if (!SCM_RWSTRINGP (str)) \
       scm_misc_error (FUNC_NAME, "argument is a read-only string", str); \
   } while (0)
+
+#define SCM_VALIDATE_OPDIR(pos, port) SCM_MAKE_VALIDATE (pos, port, OPDIRP)
 
 #endif  /* SCM_DEBUG_DEPRECATED == 0 */
 



reply via email to

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