wingo pushed a commit to branch wip-whippet
in repository guile.

commit 65a265adeac54a51c5e92efe2ab6949106c30133
Author: Andy Wingo <wi...@pobox.com>
AuthorDate: Mon Jun 30 16:04:38 2025 +0200

    Add filesys-internal.h
    
    * libguile/Makefile.am: Add new file.
    * libguile/filesys-internal.h: New file.
    * libguile/filesys.c:
    * libguile/filesys.h:
    * libguile/fports.c:
    * libguile/finalizers.c:
    * libguile/init.c:
    * libguile/print.c: Adapt.
---
 libguile/Makefile.am        |  1 +
 libguile/filesys-internal.h | 68 +++++++++++++++++++++++++++++++++++++++++++++
 libguile/filesys.c          | 31 +--------------------
 libguile/filesys.h          |  6 ----
 libguile/finalizers.c       |  2 +-
 libguile/fports.c           |  2 +-
 libguile/init.c             |  2 +-
 libguile/print.c            |  2 +-
 8 files changed, 74 insertions(+), 40 deletions(-)

diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index a910d6a5d..16ca88ce1 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -520,6 +520,7 @@ noinst_HEADERS = atomic.h                                   
\
                  cache-internal.h                              \
                  continuations-internal.h                      \
                 dynstack.h                                     \
+                 filesys-internal.h                            \
                  fluids-internal.h                             \
                  gc-inline.h                                   \
                  gc-internal.h                                 \
diff --git a/libguile/filesys-internal.h b/libguile/filesys-internal.h
new file mode 100644
index 000000000..077fb7ed4
--- /dev/null
+++ b/libguile/filesys-internal.h
@@ -0,0 +1,68 @@
+#ifndef SCM_FILESYS_INTERNAL_H
+#define SCM_FILESYS_INTERNAL_H
+
+/* Copyright 1995,1997-2001,2006,2008-2011,2013,2018,2021,2025
+     Free Software Foundation, Inc.
+
+   This file is part of Guile.
+
+   Guile is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Lesser General Public License as published
+   by the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   Guile 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.  See the GNU Lesser General Public
+   License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with Guile.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+
+
+#include <dirent.h>
+
+#include <libguile/filesys.h>
+#include <libguile/threads-internal.h>
+
+
+
+#define SCM_DIR_FLAG_OPEN (1L << 16)
+
+struct scm_directory
+{
+  scm_t_bits tag_and_flags;
+  DIR *ds;
+  scm_i_pthread_mutex_t mutex;
+};
+
+static inline int
+scm_is_directory (SCM x)
+{
+  return SCM_HAS_TYP16 (x, scm_tc16_directory);
+}
+
+static inline struct scm_directory*
+scm_to_directory (SCM x)
+{
+  if (!scm_is_directory (x))
+    abort ();
+  return (struct scm_directory*) SCM_UNPACK_POINTER (x);
+}
+
+static inline SCM
+scm_from_directory (struct scm_directory *dir)
+{
+  return SCM_PACK_POINTER (dir);
+}
+
+SCM_INTERNAL SCM scm_copy_file2 (SCM oldfile, SCM newfile, SCM rest);
+SCM_INTERNAL SCM scm_i_relativize_path (SCM path, SCM in_path);
+SCM_INTERNAL int scm_i_print_directory (SCM exp, SCM port, scm_print_state 
*pstate);
+SCM_INTERNAL void scm_i_finalize_directory (struct scm_thread*, SCM);
+
+SCM_INTERNAL void scm_init_filesys (void);
+
+#endif  /* SCM_FILESYS_INTERNAL_H */
diff --git a/libguile/filesys.c b/libguile/filesys.c
index ce090b9d1..441708290 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -97,7 +97,7 @@
 #include "threads-internal.h"
 #include "vectors.h"
 
-#include "filesys.h"
+#include "filesys-internal.h"
 
 
 
@@ -2180,35 +2180,6 @@ scm_i_relativize_path (SCM path, SCM in_path)
 /* Examining directories.  These procedures are used by `check-guile'
    and thus compiled unconditionally.  */
 
-#define SCM_DIR_FLAG_OPEN (1L << 16)
-
-struct scm_directory
-{
-  scm_t_bits tag_and_flags;
-  DIR *ds;
-  scm_i_pthread_mutex_t mutex;
-};
-
-static inline int
-scm_is_directory (SCM x)
-{
-  return SCM_HAS_TYP16 (x, scm_tc16_directory);
-}
-
-static inline struct scm_directory*
-scm_to_directory (SCM x)
-{
-  if (!scm_is_directory (x))
-    abort ();
-  return (struct scm_directory*) SCM_UNPACK_POINTER (x);
-}
-
-static inline SCM
-scm_from_directory (struct scm_directory *dir)
-{
-  return SCM_PACK_POINTER (dir);
-}
-
 #define SCM_DIRP(x) scm_is_directory (x)
 
 static int
diff --git a/libguile/filesys.h b/libguile/filesys.h
index 82a830569..5db40eccf 100644
--- a/libguile/filesys.h
+++ b/libguile/filesys.h
@@ -62,17 +62,11 @@ SCM_API SCM scm_symlinkat (SCM dir, SCM oldpath, SCM 
newpath);
 SCM_API SCM scm_readlink (SCM path);
 SCM_API SCM scm_lstat (SCM str);
 SCM_API SCM scm_copy_file (SCM oldfile, SCM newfile);
-SCM_INTERNAL SCM scm_copy_file2 (SCM oldfile, SCM newfile, SCM rest);
 SCM_API SCM scm_mkstemp (SCM tmpl);
 SCM_API SCM scm_mkdtemp (SCM tmpl);
 SCM_API SCM scm_dirname (SCM filename);
 SCM_API SCM scm_basename (SCM filename, SCM suffix);
 SCM_API SCM scm_canonicalize_path (SCM path);
 SCM_API SCM scm_sendfile (SCM out, SCM in, SCM count, SCM offset);
-SCM_INTERNAL SCM scm_i_relativize_path (SCM path, SCM in_path);
-SCM_INTERNAL int scm_i_print_directory (SCM exp, SCM port, scm_print_state 
*pstate);
-SCM_INTERNAL void scm_i_finalize_directory (struct scm_thread*, SCM);
-
-SCM_INTERNAL void scm_init_filesys (void);
 
 #endif  /* SCM_FILESYS_H */
diff --git a/libguile/finalizers.c b/libguile/finalizers.c
index 36a8d1b44..ff882b2a2 100644
--- a/libguile/finalizers.c
+++ b/libguile/finalizers.c
@@ -36,7 +36,7 @@
 #include "continuations.h"
 #include "eval.h"
 #include "extensions.h"
-#include "filesys.h"
+#include "filesys-internal.h"
 #include "foreign.h"
 #include "gc-internal.h"
 #include "gsubr.h"
diff --git a/libguile/fports.c b/libguile/fports.c
index 51740faa6..9f11cce9a 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -48,7 +48,7 @@
 #include "dynwind.h"
 #include "extensions.h"
 #include "fdes-finalizers.h"
-#include "filesys.h"
+#include "filesys-internal.h"
 #include "fluids.h"
 #include "gc.h"
 #include "gsubr.h"
diff --git a/libguile/init.c b/libguile/init.c
index c8f6be527..76423cd92 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -67,7 +67,7 @@
 #include "extensions.h"
 #include "fdes-finalizers.h"
 #include "feature.h"
-#include "filesys.h"
+#include "filesys-internal.h"
 #include "finalizers.h"
 #include "fluids-internal.h"
 #include "foreign-object.h"
diff --git a/libguile/print.c b/libguile/print.c
index 889b31fcf..d45f18011 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -44,7 +44,7 @@
 #include "eval.h"
 #include "extensions.h"
 #include "finalizers.h"
-#include "filesys.h"
+#include "filesys-internal.h"
 #include "fluids-internal.h"
 #include "foreign.h"
 #include "frames.h"

Reply via email to