From b9ef8e66eec1da83e0587c2d454c04ca5532817d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 8 Dec 2009 21:31:42 +0100 Subject: [PATCH] SCM_CELL in filesys.[ch] * libguile/filesys.h (SCM_DIR_FLAG_OPEN, SCM_DIR_OPEN_P) * libguile/filesys.c (scm_readdir, scm_rewinddir, scm_closedir) (scm_dir_print, scm_dir_free): Fix SCM_CELL macro usage. --- libguile/filesys.c | 16 ++++++++-------- libguile/filesys.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libguile/filesys.c b/libguile/filesys.c index e60efddcf..02f2da632 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -852,7 +852,7 @@ SCM_DEFINE (scm_opendir, "opendir", 1, 0, 0, STRING_SYSCALL (dirname, c_dirname, ds = opendir (c_dirname)); if (ds == NULL) SCM_SYSERROR; - SCM_RETURN_NEWSMOB (scm_tc16_dir | SCM_DIR_FLAG_OPEN, ds); + SCM_RETURN_NEWSMOB (scm_tc16_dir | (SCM_DIR_FLAG_OPEN<<16), ds); } #undef FUNC_NAME @@ -893,7 +893,7 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0, somewhere in the smob, or just the dirent size calculated once. */ { struct dirent_or_dirent64 de; /* just for sizeof */ - DIR *ds = (DIR *) SCM_CELL_WORD_1 (port); + DIR *ds = (DIR *) SCM_SMOB_DATA_1 (port); size_t namlen; #ifdef NAME_MAX char buf [SCM_MAX (sizeof (de), @@ -926,7 +926,7 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0, scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex); errno = 0; - SCM_SYSCALL (rdent = readdir_or_readdir64 ((DIR *) SCM_CELL_WORD_1 (port))); + SCM_SYSCALL (rdent = readdir_or_readdir64 ((DIR *) SCM_SMOB_DATA_1 (port))); if (errno != 0) SCM_SYSERROR; @@ -951,7 +951,7 @@ SCM_DEFINE (scm_rewinddir, "rewinddir", 1, 0, 0, if (!SCM_DIR_OPEN_P (port)) SCM_MISC_ERROR ("Directory ~S is not open.", scm_list_1 (port)); - rewinddir ((DIR *) SCM_CELL_WORD_1 (port)); + rewinddir ((DIR *) SCM_SMOB_DATA_1 (port)); return SCM_UNSPECIFIED; } @@ -970,11 +970,11 @@ SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0, { int sts; - SCM_SYSCALL (sts = closedir ((DIR *) SCM_CELL_WORD_1 (port))); + SCM_SYSCALL (sts = closedir ((DIR *) SCM_SMOB_DATA_1 (port))); if (sts != 0) SCM_SYSERROR; - SCM_SET_CELL_WORD_0 (port, scm_tc16_dir); + SCM_SET_SMOB_DATA_0 (port, scm_tc16_dir); } return SCM_UNSPECIFIED; @@ -989,7 +989,7 @@ scm_dir_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) if (!SCM_DIR_OPEN_P (exp)) scm_puts ("closed: ", port); scm_puts ("directory stream ", port); - scm_uintprint (SCM_CELL_WORD_1 (exp), 16, port); + scm_uintprint (SCM_SMOB_DATA_1 (exp), 16, port); scm_putc ('>', port); return 1; } @@ -999,7 +999,7 @@ static size_t scm_dir_free (SCM p) { if (SCM_DIR_OPEN_P (p)) - closedir ((DIR *) SCM_CELL_WORD_1 (p)); + closedir ((DIR *) SCM_SMOB_DATA_1 (p)); return 0; } diff --git a/libguile/filesys.h b/libguile/filesys.h index b9a6ca8a6..a07f20496 100644 --- a/libguile/filesys.h +++ b/libguile/filesys.h @@ -3,7 +3,7 @@ #ifndef SCM_FILESYS_H #define SCM_FILESYS_H -/* Copyright (C) 1995,1997,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1995,1997,1998,1999,2000,2001, 2006, 2008, 2009 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -29,10 +29,10 @@ SCM_API scm_t_bits scm_tc16_dir; -#define SCM_DIR_FLAG_OPEN (1L << 16) +#define SCM_DIR_FLAG_OPEN (1L << 0) #define SCM_DIRP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_dir)) -#define SCM_DIR_OPEN_P(x) (SCM_CELL_WORD_0 (x) & SCM_DIR_FLAG_OPEN) +#define SCM_DIR_OPEN_P(x) (SCM_SMOB_FLAGS (x) & SCM_DIR_FLAG_OPEN) -- 2.20.1