1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

224 commits

Author SHA1 Message Date
Gary Houston
4edc089ccb * filesys.c (scm_input_waiting_p): add missing third argument to
scm_misc_error.

* stime.c (scm_localtime): copy the result of localtime before
calling gmtime in case they share a buffer.
(scm_localtime, scm_mktime): throw an error if neither HAVE_TM_ZONE
nor HAVE_TZNAME.
1997-05-05 21:01:57 +00:00
Jim Blandy
4c1feaa596 * filesys.c (scm_fcntl): New function from Roland McGrath.
(scm_init_filesys): New symbols for use with fcntl.
* filesys.h: Added prototype.
1997-04-12 01:17:15 +00:00
Jim Blandy
d7b8a21a81 * filesys.c (S_ISSOCK): Define this if it's missing, but we do
have S_IFSOCK.  This is the case under Ultrix.
1997-04-12 00:39:44 +00:00
Gary Houston
67ec36676e * ioext.c (scm_setfileno): throw a runtime error if SET_FILE_FD_FIELD
wan't defined.  Don't include fd.h.

* Previously fd.h was regenerated whenever configure was run,
forcing a couple of files to be recompiled.

* fd.h.in: deleted, SET_FILE_FD_FIELD moved to ioext.c.
* configure.in: AC_DEFINE FD_SETTER instead of HAVE_FD_SETTER.
Check for _fileno as well as _file.
Don't output fd.h.
* ioext.c: don't fd.h.
* acconfig.h: remove duplicate HAVE_FD_SETTER and change the
other to FD_SETTER.

* Change the stratigy for getting information about errno
(and now signal number) values, e.g., ENOSYS, SIGKILL.  Instead of
generating lists of symbols during the build process, which will
not always work, include comprehensive lists in the distribution.
To help keep the lists up to date, the "check_signals" and
"check_errnos" make targets can be used.

* configure.in: don't check for a command to extract errno codes.
* Makefile.am: update file lists, remove errnos.list and errnos.c
targets, add cpp_err_symbols.c, cpp_sig_symbols.c, check_signals,
check_errnos targets.
(CLEANFILES): remove errnos.c and errnos.list, add
cpp_err_symbols_here cpp_err_symbols_diff cpp_err_symbols_new
cpp_sig_symbols_here cpp_sig_symbols_diff cpp_sig_symbols_new
* errnos.default: deleted.
* cpp_signal.c: new file.
* cpp_errno.c: renamed from errnos_get.c.
* cpp_err_symbols, cpp_sig_symbols: new files.
* cpp_cnvt.awk: renamed from errnos_cnvt_awk.
* error.c (scm_init_error): #include cpp_err_symbols instead of
errnos.c.
* posix.c (scm_init_posix): don't intern signal symbols.  #include
cpp_sig_symbols.c.
* strop.c (scm_i_index): allow the lower bound to be equal to the
length of the string, so a null string doesn't always give an error.

* posix.h: new prototypes.
* posix.c (scm_status_exit_val, scm_status_term_sig,
scm_status_stop_sig): new functions, as in scsh.  They break down
process status values as returned by waitpid.
1997-03-29 18:42:43 +00:00
Mikael Djurfeldt
c0ebd8c5a8 * filesys.c (scm_stat): stat now takes fport arguments too as
documented in the manual.
1997-03-04 18:54:52 +00:00
Gary Houston
3d8d56dfac * init.scm (index, rindex): replace versions in utilities.scm with
primitives.
	load errno.scm.

	* netconst.scm: undefine maybe-define and maybe-define-so after use.
	* errno.scm: new file.

	* fports.c (scm_open_file): pass errno to scm_syserror_msg.
	* filesys.h: update prototypes.  Remove macros: SCM_FD_P, SCM_FD_FLAGS,
	SCM_FD.
	* filesys.c (scm_sys_stat, scm_sys_lstat): pass errno to
	scm_syserror_msg.
*	(scm_sys_read_fd, scm_sys_write_fd, scm_sys_close, scm_sys_lseek,
	scm_sys_dup): deleted: FD capability will be added to other
	procedures.
*	Remove support for the FD object type: scm_tc16_fd, scm_fd_print,
	scm_fd_free, fd_smob, scm_intern_fd.
*	(scm_open): renamed from scm_sys_open.  Return a port instead of
	an FD object.  Make the mode argument optional.
*	(scm_sys_create): deleted, it's just a special case of open.
	(scm_init_filesys): move interning of constants O_CREAT etc.,
	here (were previously using SCM_CONST_LONG macro).
	Add missing constants: O_RDONLY, O_WRONLY, O_RDWR, O_CREAT.
	don't newsmob fd.
	(numerous _sys_ procedures): remove gratuitous _sys_ from names.
	include "fports.h" and <stdio.h>
	(scm_stat, scm_select): don't support FD objects.

	* error.h: adjust scm_syserror_msg prototype.
	* error.c (scm_syserror_msg): take an extra argument for errno.
	Using the global value didn't always work, since it could be
	reset by procedure calls in the message or args arguments.

	* fports.c (scm_setbuf0): call setbuf even if FIONREAD is not defined.
	I don't understand why the check was there (and what about the
	ultrix check?)

	* strop.c (scm_string_copy): allow shared substrings to be copied.

	* unif.h: corresponding change to prototypes.
	* unif.c (scm_uniform_array_read_x, scm_uniform_array_write_x):
	recognize two new optional arguments: offset and length.  Allow
	the port argument to be an integer (file descriptor, for scsh).
	Include <unistd.h> for "read" prototype.
1997-01-18 17:51:33 +00:00
Gary Houston
370312ae6e * filesys.c (scm_input_waiting_p): use select in preference to
FIONREAD, since the latter doesn't detect EOF.
Throw error if neither select nor FIONREAD available.

* socket.c (scm_connect): take a port, not a fd object.
(scm_fill_sockaddr): throw an error if fam is not recognised.
(scm_bind): use scm_fill_sockaddr.
(scm_listen): take a port, not a fd object.
(scm_accept): take and return a port.  return CDR in the car if
address can't be got
(scm_sock_fd_to_port): new procedure.
(scm_socket): use scm_sock_fd_to_port.
(scm_addr_vector): throw error if unrecognised address type.
take an extra argument with the calling procedure name.
(scm_getsockname): take a port.  return #f if address can't be got.
(scm_getpeername): take a port.  return #f if address can't be got.
(scm_recvfrom): take a port.  return #f for address component if can't
be got.
(scm_sendto, scm_socketpair, scm_getsockopt scm_shutdown,
scm_setsockopt, scm_recv, scm_send): take a port not a fd object.
* socket.h (SCM_P): update bind prototype.
* socket.c (scm_init_socket): intern PF_UNSPEC, PF_UNIX, PF_INET.
include "feature.h".
(scm_socket): return a port, not a file descriptor object.
include "fports.h" and <unistd.h>
(scm_bind): take a port, not a file descriptor object.
take an extra argument for address args.

* net_db.c (scm_init_net_db): intern INADDR_ANY, INADDR_BROADCAST,
INADDR_NONE, INADDR_LOOPBACK.
* init.c: include net_db.h and not fdsocket.h.
(scm_boot_guile_1): call scm_init_net_db and not scm_init_fdsocket.

* Makefile.am: corresponding changes.
* socket.h: renamed from fdsocket.h, fix names.
* net_db.h: renamed from socket.h, fix names.
* socket.c: renamed from fdsocket.c.
remove _sys from procedure names.
(scm_init_socket): rename from scm_init_fdsocket.  include socket.x.
add "socket" to features list.
* net_db.c: renamed from socket.c.
remove _sys from procedure names.
(scm_init_net_db): rename from scm_init_socket.  include net_db.x.
add "net-db" to features list.
include "net_db.h".  don't include <sys/socket.h> or
<sys/un.h>.
1996-12-21 04:13:54 +00:00
Jim Blandy
3594582bd1 On some systems <libc.h> conflicts with <unistd.h>, and should not
be #included at all.
* aclocal.m4 (GUILE_HEADER_LIBC_WITH_UNISTD): New autoconf macro.
* configure.in: Call it.
* acconfig.h (LIBC_H_WITH_UNISTD_H): New CPP symbol.
* posix.c, filesys.c: Use its results to decide whether or not to
#include <libc.h>.
* configure, scmconfig.h.in: Rebuilt with autoconf and
autoheader.
1996-11-10 00:14:45 +00:00
Mikael Djurfeldt
66b47b6c79 * filesys.c, filesys.h (scm_input_waiting_p): Moved from ports.c.
Motivation: This is system specific code which is related to file
 	I/O.  It also may use select.  Added code by Gary Houston to
 	detect presence of character in stdio buffers.
1996-10-30 23:31:11 +00:00
Gary Houston
ae5253c589 * filesys.c (scm_stat2scm): derive file type and permissions from
the stat mode and append them to the returned vector.
There isn't much overhead in doing this and it avoids the need to
work with S_IRUSR et al. in Scheme.
Define symbols scm_sym_regular etc.
(scm_init_filesys): don't intern S_IRUSR etc.
1996-10-27 23:25:47 +00:00
Mikael Djurfeldt
a6c64c3c6d * alist.c, arbiters.c, continuations.c, debug.c, debug.h, eval.c,
eval.h, feature.c, filesys.c, fports.c, gc.c, gsubr.c, init.c,
ioext.c, kw.c, list.c, load.c, mallocs.c, numbers.c, numbers.h,
pairs.c, pairs.h, ports.c, ports.h, posix.c, procprop.c, procs.c,
procs.h, ramap.c, read.c, root.c, srcprop.c, srcprop.h,
strports.c, symbols.c, tags.h, throw.c, unif.c, variable.c,
vports.c: Cleaned up use of pairs: Don't make any special
assumptions about the internal structure of selectors and
mutators: SCM_CXR (<e1>) = <e2> --> SCM_SETCXR (<e1>, <e2>),
SCM_CXR (<e1>) &= <e2> --> SCM_SETAND_CXR (<e1>, <e2>) etc.
(Among other things, this change makes it easier to build Guile
with certain compilers which have problems with casted lvalues.)
1996-10-20 03:31:08 +00:00
Jim Blandy
1cc91f1b29 * __scm.h, alist.c, alist.h, append.c, append.h, appinit.c,
arbiters.c, arbiters.h, async.c, async.h, boolean.c, boolean.h,
chars.c, chars.h, continuations.c, continuations.h, debug.c,
debug.h, dynwind.c, dynwind.h, eq.c, eq.h, error.c, eval.c,
eval.h, extchrs.c, extchrs.h, fdsocket.c, fdsocket.h, filesys.c,
filesys.h, fports.c, fports.h, gc.c, gdb_interface.h, gdbint.c,
gdbint.h, genio.c, genio.h, gscm.c, gscm.h, gsubr.c, gsubr.h,
hash.c, hash.h, hashtab.c, hashtab.h, init.c, ioext.c, ioext.h,
kw.c, kw.h, libguile.h, mallocs.c, mallocs.h, markers.c,
markers.h, mbstrings.c, mbstrings.h, numbers.c, numbers.h,
objprop.c, objprop.h, options.c, options.h, pairs.c, pairs.h,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, read.c, read.h,
root.c, scmsigs.c, scmsigs.h, sequences.c, sequences.h, simpos.c,
simpos.h, smob.c, socket.c, socket.h, srcprop.c, srcprop.h,
stackchk.c, stackchk.h, stime.c, stime.h, strings.c, strings.h,
strop.c, strop.h, strorder.c, strorder.h, strports.c, strports.h,
struct.c, struct.h, symbols.c, symbols.h, tag.c, tag.h, unif.c,
unif.h, variable.c, variable.h, vectors.c, vectors.h, version.c,
version.h, vports.c, vports.h, weaks.c, weaks.h: Use SCM_P to
declare functions with prototypes.  (Patch thanks to Marius
Vollmer.)
1996-10-14 01:33:50 +00:00
Gary Houston
52f4f4d6aa * filesys.c (scm_sys_select): move SCM_ALLOW_INTS past the sreturn
check.
(scm_init_filesys): set "i/o-extensions" feature.
include feature.h.
1996-10-06 06:31:43 +00:00
Gary Houston
dbece3a204 * strings.c, strings.h: (scm_makfrom0str, scm_makefrom0str_opt:
declare the char * to be const.  Avoids a warning in rgx.c.

* ports.h: spelling fix.

* filesys.c (scm_sys_stat, scm_sys,lstat): include file name in
error messages.

* load.c (scm_sys_try_load_path): throw an error if file not found
(like it says it in NEWS).
1996-09-28 19:40:54 +00:00
Mikael Djurfeldt
9882ea1991 * arbiters.c (prinarb),
async.c (print_async),
debug.c (prindebugobj, prinmemoized),
eval.c (prinprom, prinmacro),
filesys.c (scm_fd_print, scm_dir_print),
kw.c (print_kw),
mallocs.c (prinmalloc),
numbers.c, numbers.h (scm_floprint, scm_bigprint),
smob.h (scm_smobfuns),
srcprop.c (prinsrcprops),
throw.c (prinjb),
unif.c, unif.h (scm_raprin1, rapr1),
variable.c (prin_var): Changed argument `int writing' to
`scm_print_state *pstate'.
1996-09-22 22:41:40 +00:00
Gary Houston
f5bf2977c6 * filesys.c (scsm_sys_stat): don't SIGSEGV if argument is an
integer (assuming for now accepting an integer is a good thing).

	* error.c, fports.c: replace use of %S in lgh_error args with %s.
	%S will be used instead for write'ing arguments.

	* unif.c (scm_transpose_array): change arguments in the SCM_WNA
	asserts.  fix a few other asserts.
	(scm_aind, scm_enclose_array, scm_array_in_bounds_p,
	scm_uniform_vector_ref,	scm_array_set_x,
	scm_dimensions_to_unform_array): change args in
	SCM_WNA SCM_ASSERTS and change scm_wta's to scm_wrong_num_args.
	strop.c (scm_substring_move_left_x, scm_substring_move_right_x,
	scm_substring_fill_x): likewise.
	gsubr.c (scm_gsubr_apply): likewise.
	eval.c (SCM_APPLY): likewise.

	* eval.c (4 places): replace scm_everr with lgh_error or
	scm_wrong_num_args.

	* error.c, error.h (scm_wrong_num_args, scm_wrong_type_arg,
	scm_memory_error): new procedures.
*	scm_everr: deleted.  can use scm_wta, dropping first two args.
	scm_error: convert NULL subr to SCM_BOOL_F.

	* __scm.h: don't define SCM_STACK_OVFLOW, SCM_EXIT, SCM_ARG6, SCM_ARG7,
	SCM_ARGERR.

	* stackchk.c (scm_report_stack_overflow): use lgh_error instead
	of scm_wta.

	* error.c, error.h: new error keys: scm_arg_type_key,
	scm_args_number_key, scm_memory_alloc_key, scm_stack_overflow_key,
	scm_misc_error_key.
	scm_wta: reimplement using lgh_error instead of scm_everr.
1996-09-19 09:08:07 +00:00
Gary Houston
52859adfb9 * debug.c, unif.c: use scm_out_of_range instead of
wta for range errors (ASSERT still needs work).

* error.c, error.h (scm_out_of_range): new procedure.

* error.c, error.h (scm_out_of_range_key): new key.

* posix.c (scm_sync): #else was missing.

* error.c, error.h: append _key to names scm_num_overflow and
scm_system_error.

* __scm.h (SCM_SYSMISSING, SCM_NUM_OVERFLOW): use SCM_BOOL_F instead
of consing an empty list.
(SCM_SYSERROR etc.): move into error.c, make them procedures instead
of macros, saves code and string space.
error.c, fports.c, numbers.c, posix.c, ioext.c, filesys.c, socket.c,
fdsocket.c, simpos.c: change names of SCM_SYSERROR etc., to
lower case.  Rename scm_syserror_m to scm_syserror_msg.
error.h: prototypes for new procedures.
1996-09-15 06:41:31 +00:00
Jim Blandy
657c49b3f3 * filesys.c: Possibly uninitialized variable rv. 1996-09-11 20:26:10 +00:00
Jim Blandy
2f3ed1ba2c * files.c (scm_sys_delete_file): Moved to filesys.c.
File is now empty; deleted.
* files.h: Deleted.
* filesys.c: scm_sys_delete_file is now here.  Remove
#if's; they seem to rely on remnants of an old portability
regimen.  If the problems come up again, solve them properly,
using autoconf.  Specifically: Don't test M_SYSV, and #define
remove to be unlink if it's #defined; don't use remove just
because HAVE_STDC_HEADERS is #defined.
* filesys.h: Add declarations for scm_sys_delete_file.
* Makefile.in (libobjs, inner_h_files, c_files, gen_c_files): Omit
files.o, files.h, files.c, and files.x.
* init.c: Don't #include "files.h", and don't call scm_init_files.
1996-09-10 19:44:09 +00:00
Jim Blandy
20e6290e38 C files should #include only the header files they need, not
libguile.h (which #includes all the header files); the pointless
recompilation was wasting my time.
* Makefile.in (all .o dependency lists): Regenerated.
* libguile.h: Don't try to get a definition for size_t here...
* __scm.h: Do it here.
* _scm.h: Since this is the internal libguile header, put things
here that all (or a majority) of the libguile files will want.
Don't #include <libguile.h> here; that generates dependencies on
way too much.  Instead, get "__scm.h", "error.h", "pairs.h",
"list.h", "gc.h", "gsubr.h", "procs.h", "numbers.h", "symbols.h",
"boolean.h", "strings.h", "vectors.h", "root.h", "ports.h", and
"async.h".
* alist.c: Get "eq.h", "list.h", "alist.h".
* append.c: Get "append.h", "list.h".
* arbiters.c: Get "arbiters.h", "smob.h".
* async.c: Get "async.h", "smob.h", "throw.h", "eval.h".
* boolean.c: Get "boolean.h".
* chars.c: Get "chars.h".
* continuations.c: Get "continuations.h", "dynwind.h", "debug.h",
"stackchk.h".
* debug.c: Get "debug.h", "feature.h", "read.h", "strports.h",
"continuations.h", "alist.h", "srcprop.h", "procprop.h", "smob.h",
"genio.h", "throw.h", "eval.h".
* dynwind.c: Get "dynwind.h", "alist.h", "eval.h".
* eq.c: Get "eq.h", "unif.h", "smob.h", "strorder.h",
"stackchk.h".
* error.c: Get "error.h", "throw.h", "genio.h", "pairs.h".
* eval.c: Get "eval.h", "stackchk.h", "srcprop.h", "debug.h",
"hashtab.h", "procprop.h", "markers.h", "smob.h", "throw.h",
"continuations.h", "eq.h", "sequences.h", "alist.h", "append.h",
"debug.h".
* fdsocket.c: Get "fdsocket.h", "unif.h", "filesys.h".
* feature.c: Get "feature.h".
* files.c: Get "files.h".
* filesys.c: Get "filesys.h", "smob.h", "genio.h".
* fports.c: Get "fports.h", "markers.h".
* gc.c: Get "async.h", "unif.h", "smob.h", "weaks.h",
"genio.h", "struct.h", "stackchk.h", "stime.h".
* gdbint.c: Get "gdbint.h", "chars.h", "eval.h", "print.h",
"read.h", "strports.h", "tag.h".
* genio.c: Get "genio.h", "chars.h".
* gsubr.c: Get "gsubr.h", "genio.h".
* hash.c: Get "hash.h", "chars.h".
* hashtab.c: Get "hashtab.h", "eval.h", "hash.h", "alist.h".
* init.c: Get everyone who has an scm_init_mumble function:
"weaks.h", "vports.h", "version.h", "vectors.h", "variable.h",
"unif.h", "throw.h", "tag.h", "symbols.h", "struct.h",
"strports.h", "strorder.h", "strop.h", "strings.h", "stime.h",
"stackchk.h", "srcprop.h", "socket.h", "simpos.h", "sequences.h",
"scmsigs.h", "read.h", "ramap.h", "procs.h", "procprop.h",
"print.h", "posix.h", "ports.h", "pairs.h", "options.h",
"objprop.h", "numbers.h", "mbstrings.h", "mallocs.h", "load.h",
"list.h", "kw.h", "ioext.h", "hashtab.h", "hash.h", "gsubr.h",
"gdbint.h", "gc.h", "fports.h", "filesys.h", "files.h",
"feature.h", "fdsocket.h", "eval.h", "error.h", "eq.h",
"dynwind.h", "debug.h", "continuations.h", "chars.h", "boolean.h",
"async.h", "arbiters.h", "append.h", "alist.h".
* ioext.c: Get "ioext.h", "fports.h".
* kw.c: Get "kw.h", "smob.h", "mbstrings.h", "genio.h".
* list.c: Get "list.h", "eq.h".
* load.c: Get "load.h", "eval.h", "read.h", "fports.h".
* mallocs.c: Get "smob.h", "genio.h".
* markers.c: Get "markers.h".
* mbstrings.c: Get "mbstrings.h", "read.h", "genio.h", "unif.h",
"chars.h".
* numbers.c: Get "unif.h", "genio.h".
* objprop.c: Get "objprop.h", "weaks.h", "alist.h", "hashtab.h".
* options.c: Get "options.h".
* ports.c: Get "ports.h", "vports.h", "strports.h", "fports.h",
"markers.h", "chars.h", "genio.h".
* posix.c: Get "posix.h", "sequences.h", "feature.h", "unif.h",
"read.h", "scmsigs.h", "genio.h", "fports.h".
* print.c: Get "print.h",  "unif.h", "weaks.h", "read.h",
"procprop.h", "eval.h", "smob.h", "mbstrings.h", "genio.h",
"chars.h".
* procprop.c: Get "procprop.h", "eval.h", "alist.h".
* procs.c: Get "procs.h".
* ramap.c: Get "ramap.h", "feature.h", "eval.h", "eq.h",
"chars.h", "smob.h", "unif.h".
* read.c: Get "alist.h", "kw.h", "mbstrings.h", "unif.h",
"eval.h", "genio.h", "chars.h".
* root.c: Get "root.h", "stackchk.h".
* scmsigs.c: Get "scmsigs.h".
* sequences.c: Get "sequences.h".
* simpos.c: Get "simpos.h", "scmsigs.h".
* smob.c: Get "smob.h".
* socket.c: Get "socket.h", "feature.h".
* srcprop.c: Get "srcprop.h", "weaks.h", "hashtab.h", "debug.h",
"alist.h", "smob.h".
* stackchk.c: Get "stackchk.h", "genio.h".
* stime.c: Get "stime.h"."libguile/continuations.h".
* strings.c: Get "strings.h", "chars.h".
* strop.c: Get "strop.h", "chars.h".
* strorder.c: Get "strorder.h", "chars.h".
* strports.c: Get "strports.h", "print.h", "eval.h", "unif.h".
* struct.c: Get "struct.h", "chars.h".
* symbols.c: Get "symbols.h", "mbstrings.h", "alist.h",
"variable.h", "eval.h", "chars.h".
* tag.c: Get "tag.h", "struct.h", "chars.h".
* throw.c: Get "throw.h", "continuations.h", "debug.h",
"dynwind.h", "eval.h", "alist.h", "smob.h", "genio.h".
* unif.c: Get "unif.h", "feature.h", "strop.h", "sequences.h",
"smob.h", "genio.h", "eval.h", "chars.h".
* variable.c: Get "variable.h", "smob.h", "genio.h".
* vectors.c: Get "vectors.h", "eq.h".
* version.c: Get "version.h".
* vports.c: Get "vports.h", "fports.h", "chars.h", "eval.h".
* weaks.c: Get "weaks.h".
1996-09-10 02:26:07 +00:00
Jim Blandy
1f9e22264d Changes for NeXT, suggested by Robert Brown.
* configure.in: Call AC_TYPE_MODE_T.
(AC_CHECK_HEADERS): Add libc.h, to get more prototypes on the
NeXT.  Put header file list in alphabetical order.
* configure, scmconfig.h.in: Regenerated.
* filesys.c [HAVE_LIBC_H]: #include <libc.h>.

* filesys.c [HAVE_STRING_H]: #include <string.h>, to get prototype
for strerror.
1996-08-06 20:29:18 +00:00
Gary Houston
02b754d3a6 make C system primitives throw exceptions 1996-08-02 23:26:33 +00:00
Jim Blandy
8cc713820f * filesys.c, posix.c: #include <sys/types.h> before <sys/stat.h>.
This is necessary on Ultrix, and doesn't hurt portability.
1996-08-01 10:54:50 +00:00
Jim Blandy
0f2d19dd46 maintainer changed: was lord, now jimb; first import 1996-07-25 22:56:11 +00:00