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

171 commits

Author SHA1 Message Date
Greg J. Badros
b6791b2e94 * error.h, error.c: Added `scm_wrong_type_arg_msg' to support
displaying the expected type.  Use SCM_LISTn in a couple places
instead of scm_cons-ing by hand.

* __scm.h: Added SCM_ASSERT_TYPE macro.

* validate.h, scm_validate.h: Added the former, as a renamed
version of the latter with SCM_ASSERT_TYPE used in
SCM_MAKE_VALIDATE (instead of just SCM_ASSERT)

* Makefile.am: Rename scm_validate.h to validate.h.

* *.c, *.h: Include validate.h, not scm_validate.h (old name's
prefix was superfluous).
2000-03-03 00:09:54 +00:00
Gary Houston
bd9e24b301 * strings.h: don't use SCM_P. don't include <string.h>.
* error.c, gh_data.c, ports.c, script.c, strop.c: include <string.h>.

	* strings.c (scm_string_ref): make the 2nd argument compulsory.
	previously it defaulted to zero for no good reason that I can see.
	use a local variable for SCM_INUM (k).  replace
	SCM_VALIDATE_INUM_DEF with SCM_VALIDATE_INUM_COPY.

	(scm_makfromstr): cosmetic changes.

	(scm_string): Accept only chars in the list, not strings, for
	conformance to R5RS (particularly for list->string, which is
	supposed to be the inverse of string->list.)  remove
	SCM_DEFER_INTS/SCM_ALLOW_INTS, which is unnecessary since
	scm_makstr handles the cell allocation.  when reporting wrong-type
	arg, don't report the position as 1.

	* posix.c (scm_init_posix): intern PIPE_BUF if it's defined.

	* boot-9.scm (find-and-link-dynamic-module): pass strings, not symbols,
	to string-append.
2000-01-31 18:29:56 +00:00
Gary Houston
ae1b098b07 * posix.c (scm_pipe): rewrote the docstring.
(and fixed a bug in the scm_select change)
2000-01-29 19:50:36 +00:00
Gary Houston
28d77376bc * filesys.c (scm_select, retrieve_select_type, get_element,
fill_select_type, set_element): modified so that Scheme
	"select" tests port buffers for the ability to provide input
	or accept output.  Previously only the underlying file descriptors
	were checked.  Rewrote the docstring.

	* expect.scm (expect): don't call char-ready? before expect-select,
	since select now checks port buffers itself.  don't bother to check
	the time first either, since expect-select does it.
2000-01-29 18:04:38 +00:00
Gary Houston
d831b03918 * filesys.c (scm_chown): omit port/fdes support if HAVE_FCHOWN is
not defined (thanks to Richard Y. Kim).
2000-01-23 20:25:27 +00:00
Mikael Djurfeldt
a3c8b9fce9 * strports.c (st_end_input): Inserted parenthesis to get operator
grouping correct.

* fports.c, list.c, numbers.c, ports.c, stime.c, symbols.c,
filesys.c, posix.c: Converted docstrings to ANSI C format and
escaped " occurring inside string literals.
2000-01-18 14:13:31 +00:00
Mikael Djurfeldt
d3818c2982 * alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
   keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
   objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
   ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
   stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
   symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
   weaks.c: Converted docstrings to ANSI C format.

* filesys.c (scm_chmod), simpos.c (s_scm_system), version
(scm_version), vports (scm_make_soft_port): Escape " occuring
inside docstring.
2000-01-18 11:24:37 +00:00
Greg J. Badros
c1bfcf602b * scm_validate.h: Added SCM_NUM2LONG_DEF macro. Make
SCM_OUT_OF_RANGE use SCM_MAKINUM, not scm_long2num.  Added
SCM_COERCE_ROSTRING macro.  Added SCM_VALIDATE_NONEMPTYLIST
macro.  Fix SCM_VALIDATE_STRINGORSUBSTR macro to not use SLOPPY
variants.

* ports.c (scm_port_closed_p): Validate that the arg is a PORT,
then return whether it's an open port (was validating that it was
an open port -- this was a bug I introduced back in December, but
my careful reading of diffs caught it).

* numbers.c: Recombine the two conditional-compilation paths for
all the log* primitives -- they were split based on #ifndef
scm_long2num;  factored out a SCM_LOGOP_RETURN macro, and fixed
some bugs and inconsistencies in the two sets of implementations.
(scm_lognot) Fixed *atrocious* re-use of a SCM as an integer!

* ioext.c: Use SCM_ASSERT_RANGE in a couple places, and
SCM_VALIDATE_INUM_COPY once where it should've been used.

* fluids.c (scm_internal_with_fluids): Use
SCM_VALIDATE_LIST_COPYLEN.

* filesys.c: Use SCM_NUM2LONG instead of SCM_VALIDATE_INUM_COPY;
this is questionable as it relaxes type safety, but other changes
were useful and all SCM_NUM2LONG's should probably be
revisited. Use SCM_OUT_OF_RANGE, SCM_WRONG_TYPE_ARG.

* evalext.c: line-break change on 1 line.

* eval.c (nconc2last): Takes a non-empty list as its first
argument, not just a list.

* dynl.c: Use new SCM_COERCE_ROSTRING macro.
2000-01-12 01:51:18 +00:00
Greg J. Badros
5d2d2ffca7 * dynl.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, sort.c, stacks.c, unif.c: Use SCM_WTA, SCM_MISC_ERROR
where possible.

* symbols.c (scm_sysintern0): Fixed the function name in a
scm_misc_error invocation.

* print.c (scm_simple_format): Do not need SCM_COERCE_SUBSTR, and
use scm_return_first to ward off latent GC bug that Mikael caught.

* async.c: Use SCM_VALIDATE_ASYNC_COPY one place where it wasn't
used before but should've been.
2000-01-11 23:56:47 +00:00
Greg J. Badros
70d6375376 * dynl.c, error.c, eval.c, feature.c, filesys.c, fports.c, list.c, load.c,
net_db.c, read.c, socket.c: Update error messages to use ~A for
%s, ~S for %S to work with new `simple-format' format and be
standardized better.

* print.h, print.c (scm_simple_format): Added `simple-format'
primitive.  It's the old scm_display_error, with ARGS now a rest
parameter, and the destination first instead of last (and a couple
new capabilities inspired by `format' -- #t as destination means
current-output-port, #f means return the formatted text as a
string.

* gh.h, gh_data.c, ports.h, ports.c: Added some missing const specifications.

* backtrace.c (scm_display_error_message): Rewrote to use
scm_simple_format() procedure.

* __scm.h: Added commented-out #define of GUILE_DEBUG_FREELIST
2000-01-11 18:48:57 +00:00
Gary Houston
f25f761dac * eval.c: define scm_unbound_variable_key ('unbound-variable).
scm_lookupcar1: throw an error with key 'unbound-variable instead
	of 'misc-error when an unbound variable is encountered.

	* filesys.c (scm_mkdir, scm_rmdir, scm_getcwd, scm_select,
	scm_symlink, scm_readlink, scm_lstat),
	posix.c (scm_setpgid, scm_setsid, scm_ctermid, scm_tcgetpgrp,
	scm_tcsetpgrp, scm_uname, scm_setlocale, scm_mknod, scm_nice,
	scm_sync),
	simpos.c (scm_system),
	stime.c (scm_times, scm_strptime):
	move the HAVE_XXX feature tests out of the procedure bodies.
	don't use SCM_SYSMISSING.
	scm_validate.h (SCM_SYSMISSING): removed.
	error.h, error.c (scm_sysmissing): comment that this is deprecated.
	see ChangeLog entry for 1999-12-28.
2000-01-09 13:41:53 +00:00
Greg J. Badros
3b3b36ddb7 * *.[ch]: Whitespace changes -- added space after SCM_VALIDATE_*
macros and SCM_DEFINE macros to match GNU coding standards.
2000-01-05 19:25:37 +00:00
Greg J. Badros
a1ec69163d *.[ch]: Replace GUILE_PROC w/ SCM_DEFINE. 2000-01-05 19:05:23 +00:00
Greg J. Badros
47c6b75ea9 * *.[ch]: Replace SCM_VALIDATE_INT w/ SCM_VALIDATE_INUM for
better consistency with the names of other SCM_VALIDATE_ macros
and better conformance to guile naming policy.
2000-01-05 19:00:03 +00:00
Greg J. Badros
0c95b57d77 * coop-threads.c: Remove K&R function headers.
* scm_validate.h: Added SCM_VALIDATE_THREAD.

* *.c: Remove SCM_NIMP(X) when it is an extraneous pre-test given
that SCM_FOOP macros all now include SCM_NIMP in their expansion.
This simplifies lots of code, making it far more readable.
1999-12-16 20:48:05 +00:00
Greg J. Badros
4079f87ed2 * Makefile.am: Fix ETAGS_ARGS to recognize GUILE_PROC,
GUILE_PROC1.  Build guile-procedures.txt, and add that file to
pkgdata_DATA.

* load.c: Added `pkgdata-dir', `site-dir', `library-dir'
primitives.

* guile-doc-snarf.awk: Drop trailing space when no arguments:
e.g., "(foo )" is now "(foo)".

* *.c: moved all the documentation for primitives from
guile-doc/ref/{appendices,posix,scheme}.texi into the source code.
This leaves about half of the primitives undocumented.  Also, all
the markup is currently still texinfo.  I don't have a problem
with texinfo per se, but the markup is not very descriptive or
accurate.
1999-12-13 03:40:23 +00:00
Greg J. Badros
6b5a304f6b * *.c, scm_validate.h: Use SCM_VALIDATE_NIM, not SCM_VALIDATE_NIMP
(none of the other validate macros have the trailing P).
1999-12-12 18:30:09 +00:00
Greg J. Badros
1bbd0b849f * *.c: Pervasive software-engineering-motivated rewrite of
function headers and argument checking.  Switched SCM_PROC,
SCM_PROC1 macros to be GUILE_PROC, GUILE_PROC1 (may change names
later, but was useful to keep old versions around while migrate)
that has docstrings and argument lists embedded in the GUILE_PROC
macro invocations that expand into a function header.  Use lots of
new SCM_VALIDATE_* macros to simplify error checking and reduce
tons of redundancy.  This is very similar to what I did for Scwm.

Note that none of the extraction of the docstrings, nor software
engineering checks of Scwm is yet added to Guile.  I'll work on
that tomorrow, I expect.

* Makefile.am: Added scm_validate.h to modinclude_HEADERS.

* chars.c: Added docstrings for the primitives defined in here.

* snarf.h:  Added GUILE_PROC, GUILE_PROC1.  Added
SCM_REGISTER_PROC to be like old SCM_PROC, though old SCM_PROC
still remains for now.  Changed naming convention for the s_foo
string name of the primitive to be s_scm_foo for ease of use with
the macro.

* scm_validate.h: Lots of new SCM_VALIDATE macros to simplify
argument checking through guile.  Maybe some of these should be
folded into the header file for the types they check, but for now
it was easiest to just stick them all in one place.
1999-12-12 02:36:16 +00:00
Gary Houston
52cfc69be6 support new configure options: --disable-posix, --disable-net
and --disable-regex.
1999-09-26 16:00:36 +00:00
Jim Blandy
0d03da62e3 Change the name of the objects returned by OPENDIR from
"directory" to "directory stream".  A predicate named "directory?"
would be confusing.
* filesys.c (scm_directory_stream_p): Renamed from scm_directory_p.
At the Scheme level, "directory?" -> "directory-stream?".
(scm_dir_print): Use the phrase "directory stream" in printed form.
* filesys.h (scm_directory_stream_p): Prototype renamed
accordingly.
1999-09-12 03:47:39 +00:00
Gary Houston
77242ff9cd 1999-09-11 Gary Houston <ghouston@easynet.co.uk>
* filesys.c (scm_directory_p): new procedure "directory?"  Returns
	a boolean indicating whether its argument is a directory
	port as returned by opendir (thanks to Dirk Herrmann for the
	suggestion.)
1999-09-11 14:12:14 +00:00
Mikael Djurfeldt
f326ecf386 * filesys.c (scm_stat2scm): Conditionally use S_ISLNK. 1999-08-29 18:03:39 +00:00
Gary Houston
affc96b533 1999-08-11 Gary Houston <ghouston@easynet.co.uk>
* fports.c (fport_input_waiting): if select is used, return 1
	instead of whatever FD_ISSET expands to.  maybe it will be useful
	to interpret the value from the input_waiting ptob procedure as a
	lower bound on the number of bytes available.

	* Mikael asked for a few names to be changed...

	* ports.c (scm_make_port_type): take the write procedure as the
	second argument instead of the flush procedure.
	* ports.h (scm_ptob_descriptor): rename the ptob procedures:
	fflush -> flush,  read_flush -> end_input,  fclose -> close,
	fill_buffer -> fill_input,  ftruncate -> truncate,
	input_waiting_p -> input_waiting.

	* ports.c (end_input_void_port): was read_flush_void_port.
	(scm_set_port_end_input): was scm_set_port_flush_input.
	(scm_set_port_flush): was scm_set_port_write.
	(scm_set_port_input_waiting): was scm_set_port_input_waiting_p
	(scm_end_input): was scm_read_flush.
	(scm_fill_input): was scm_fill_buffer.
	(scm_flush): was scm_fflush.
	* fports.c (fport_input_waiting): renamed from fport_input_waiting_p.
	(fport_end_input): was local_read_flush.
	(fport_flush): was local_fflush.
	(fport_close): was local_fclose.
	(fport_truncate): was local_ftruncate.
	(fport_seek): was local_seek.
	(fport_free): was local_free.
	(fport_fill_input): was fport_fill_buffer.
	* strports.c (st_end_input): was st_read_flush.
	(st_truncate): was st_ftruncate.
	* vports.c: (sf_flush): was sfflush.
	(sf_close): was sfclose.
	(sf_fill_input): was sf_fill_buffer.

	* ports.c, fports.c, strports, vports.c, ioext.c, unif.c, filesys.c:
	change callers.
1999-08-11 18:35:42 +00:00
Mikael Djurfeldt
f8b16091fc * filesys.c (scm_dir_print): Don't use the port printing code.
Instead provide specific directory printer.
1999-07-24 23:08:16 +00:00
Gary Houston
69bc9ff335 1999-07-24 Gary Houston <ghouston@easynet.co.uk>
* gdbint.c (gdb_print, gdb_read): call scm_truncate_file.

	* ports.c (scm_truncate_file): renamed from scm_ftruncate.
	allow the 1st argument to be a fdes or filename as well as a
	port (as in the filesys.c version).

	* filesys.c (scm_truncate_file): removed.
1999-07-24 19:52:13 +00:00
Jim Blandy
def804a381 * filesys.c: #include <io.h>, if we have it.
* scmconfig.h.in: Regenerated.
1999-07-19 07:49:58 +00:00
Mikael Djurfeldt
23a621512f Greg's smob patch 1999-07-07 09:44:01 +00:00
Jim Blandy
77a76b643d * filesys.c (scm_chown): use SCM_FPORT_FDES.
(scm_chmod, scm_stat, scm_truncate_file: likewise.
	* fports.c (scm_fdes_to_port), ports.c (scm_void_port),
	filesys.c (scm_opendir):
	restore defer interrupts while the port is constructed.
*	(scm_setvbuf): if mode is _IOFBF and size is not supplied,
	derive buffer size from fdes or use a default.
	(scm_fdes_to_port): use setvbuf instead of creating the buffers
	directly.
	* filesys.c (scm_fsync): use SCM_FDES.
	* filesys.c (scm_fcntl): get fdes from fport.
	(set_element, get_element): likewise.
	* filesys.c (scm_open): adjust port_mode for O_APPEND and O_CREAT.
	ports.c fports.c ioext.c posix.c socket.c net_db.c filesys.c:
	removed all uses of SCM_DEFER/ALLOW ints for now.  they were mainly
	just protecting errno.  some may need to be put back.
*	* ports.c (scm_drain_input): new procedure.
	ports.h: prototype.
	* fports.c (FPORT_READ_SAFE, FPORT_WRITE_SAFE, FPORT_ALL_OKAY,
	pre_read, pre_write): removed.
	(local_fputc, local_fputs, local_ffwrite): use write, not stdio.
	(scm_standard_stream_to_port): change first arg from FILE * to
	int fdes.
	(local_fflush): flush fdes, not FILE *.
	* fports.h (SCM_NOFTELL): removed.
	* genio.c, ports.c: don't include filesys.h.
	* genio.c (scm_getc): don't use scm_internal_select if FPORT.
	do it in fports.c:local_fgetc.
	* genio.c: don't use SCM_SYSCALL when calling ptob procedures.
	do it where it's needed in the port smobs.
	* filesys.c (scm_input_waiting_p): moved to fports.c, stdio
	  buffer support removed.  take SCM arg, not FILE *.
	* filesys.h: prototype moved too.
	* fports.c (scm_fdes_to_port): new procedure.
	(local_fgetc): use read not fgetc.
	(local_fclose): use close, not fclose.
	(local_fgets): use read, not fgets
	* fports.h: prototype for scm_fdes_to_port.
	* fports.h (scm_fport): new struct.
	* fports.c (scm_open_file): use open, not fopen.
	#include fcntl.h
	* ports.h (struct scm_port_table): change stream from SCM to void *.
	* ports.c (scm_add_to_port_table): check for memory allocation error.
	(scm_prinport): remove MSDOS hair.
	(scm_void_port): set stream to 0 instead of SCM_BOOL_F.
	(scm_close_port): don't throw errors: do it in fports.c.
1999-06-09 12:17:38 +00:00
Jim Blandy
3eeba8d4f5 * chars.c (scm_lowers, scm_uppers, scm_charnames, scm_charnums),
eval.c (s_expression, s_test, s_body, s_bindings, s_variable,
s_clauses, s_formals): Variables now const.
* eval.c (promsmob): Now const.
* macros.c (macrosmob): Now const.
* smob.c (scm_newsmob): Smobfuns argument now points to const.
(freecell, flob, bigob): Now const.
* dynl.c (scm_make_argv_from_stringlist, scm_coerce_rostring),
error.c (scm_error, scm_syserror, scm_syserror_msg,
scm_num_overflow, scm_out_of_range, scm_wrong_type_arg,
scm_memory_error, scm_misc_error, scm_wta), macros.c
(scm_make_synt), feature.c (scm_add_feature), filesys.c
(scm_input_waiting_p), gc.c (scm_gc_start, scm_igc,
scm_must_malloc, scm_must_realloc), gsubr.c (scm_make_gsubr),
numbers.c (scm_num2dbl, scm_two_doubles, scm_num2long,
scm_num2long_long, scm_num2ulong),
options.c (scm_options), posix.c (scm_convert_exec_args,
environ_list_to_c), procs.c (scm_make_subr_opt, scm_make_subr),
ramap.c (scm_ramapc), read.c (scm_flush_ws), socket.c
(scm_sock_fd_to_port, scm_fill_sockaddr, scm_addr_vector), stime.c
(setzone, restorezone, bdtime2c), strop.c (scm_i_index),
strports.c (scm_mkstrport), symbols.c (scm_intern_obarray_soft,
scm_intern_obarray, scm_intern, scm_intern0,
scm_sysintern0_no_module_lookup, scm_sysintern, scm_sysintern0,
scm_symbol_value0), unif.c (scm_aind, scm_shap2ra): Argument
indicating calling subr, error message text, reason for error,
symbol name or feature name are now pointer to const.
* snarf.h (SCM_PROC, SCM_PROC1): String variables are now const.
* procs.c (scm_init_iprocs): iproc argument now points to const.
* pairs.c (cxrs): Now const.
* chars.h, error.h, feature.h, filesys.h, gc.h, gsubr.h, macros.h,
numbers.h, options.h, procs.h, ramap.h, read.h, smob.h,
strports.h, symbols.h, unif.h: Update variable declarations and
function prototypes for above changes.
* dynl.c, dynl-dld.c, dynl-dl.c, dynl-shl.c (sysdep_dynl_link,
sysdep_dynl_unlink, sysdep_dynl_func): Arguments FNAME, SUBR, and
SYMB now point to const.
1999-02-06 12:31:04 +00:00
Jim Blandy
7dc6e7547a * __scm.h, alist.c, async.c, async.h, backtrace.h, chars.c,
continuations.c, debug.c, debug.h, dynl-dl.c, dynl.c, dynl.h,
dynwind.c, dynwind.h, eq.c, error.c, error.h, eval.c, eval.h,
feature.c, filesys.c, filesys.h, fports.c, fports.h, gc.c, gc.h,
genio.c, genio.h, gh.h, gh_data.c, gsubr.c, gsubr.h, hash.c,
hashtab.c, init.c, init.h, ioext.c, ioext.h, kw.c, libguile.h,
list.c, list.h, load.c, load.h, mallocs.c, markers.c,
mit-pthreads.c, net_db.c, numbers.c, numbers.h, options.c,
ports.c, ports.h, posix.c, posix.h, print.c, print.h, procprop.c,
procprop.h, procs.c, procs.h, ramap.c, ramap.h, regex-posix.c,
regex-posix.h, root.c, root.h, scmsigs.c, scmsigs.h, script.c,
script.h, simpos.c, simpos.h, smob.c, smob.h, snarf.h, socket.c,
srcprop.c, stackchk.c, stackchk.h, stacks.c, stime.c, stime.h,
strings.c, strings.h, strports.c, struct.c, struct.h, symbols.c,
symbols.h, tags.h, threads.c, throw.h, unif.c, variable.c,
vectors.c, vectors.h, version.h, vports.c, weaks.c: Update
copyright years.
1998-10-19 21:36:50 +00:00
Jim Blandy
6047d269f5 * filesys.c (set_element, get_element): Make sure that `element'
is a cell before applying SCM_FPORTP to it.  (Thanks to Jost
Boekemeier and Jorgen "forcer" Schaefer.)
1998-10-19 12:15:46 +00:00
Jim Blandy
5621be9997 Centralize the creation of port objects based on stdio FILE * in
fports.c; don't just throw them together anywhere.
* fports.c (scm_stdio_to_port): Make NAME a SCM value, which is
what the rest of Guile wants.  Don't set the revealed count;
that's only appropriate for stdin, stdout, stderr.
(scm_standard_stream_to_port): This function does set the revealed
count.
* init.c (scm_init_standard_ports): Use	scm_standard_stream_to_port,
not scm_stdio_to_port.
* filesys.c (scm_open): Call scm_stdio_to_port; don't write it out.
* fports.c (scm_open_file): Same.
* posix.c (scm_pipe): Same.
* socket.c (scm_sock_fd_to_port): Same.
* ioext.c (scm_fdopen): Same.
(scm_freopen): Moved from here to...
* fports.c (scm_freopen): ... here.  This is really something that
munges the internals of an fport, so it should go here.
* fports.h (scm_stdio_to_port): Adjust prototype.
(scm_standard_stream_to_port, scm_freopen): New protoypes.
* ioext.h (scm_freopen): Prototype removed.
* filesys.c (set_element, get_element): This can work on both pipe
and file ports, so use SCM_FPORTP to typecheck, instead of testing
for scm_tc16_fport.
1998-10-09 12:44:37 +00:00
Jim Blandy
6a738a2516 * filesys.c (scm_readlink): Make local vars rv and size ints, to
avoid signed/unsigned comparison warnings, and because the return
value of readlink may be -1.  Don't bother casting the third
argument to readlink.
* filesys.c (scm_dirname, scm_basename): Move these to their own
page, at the end of the file.
* filesys.h (scm_dirname, scm_basename): Add prototypes for these.
1998-07-30 14:44:09 +00:00
Jim Blandy
dc53f02690 Simplify smob and port marking; set the mark bit in the generic
marking code, and make marker routines only responsible for
turning up outgoing pointers.
* gc.c (scm_gc_mark): Set the mark bit on ports and smobs here,
before calling the marking function.  Don't call the marking
function if it's zero.
* markers.c (scm_mark0): Just return #f.  This function isn't
necessary at all now, but it's harmless to call it.  We'll leave
it in so other folks' code doesn't croak at link time.
(scm_markcdr): Don't call SCM_SETGC8MARK.
* async.c (mark_async): Don't call SCM_SETGC8MARK.
* dynl.c (mark_dynl_obj): Same.
* root.c (mark_root): Same.
* srcprop.c (marksrcprops): Same.
* unif.c (markra): Same.
* variable.c (scm_markvar): Same.
* ports.c (scm_markstream): Same.
(void_port_ptob): Specify zero for our marking function.
* debug.c (debugobjsmob): Same.
* dynwind.c (guardsmob): Same.
* filesys.c (dir_smob): Same.
* fluids.c (fluid_smob): Same.
* fports.c (scm_fptob, scm_pipob): Same.
* mallocs.c (mallocsmob): Same.
* regex-posix.c (regex_t_smob): Same.
* smob.c (freecell, flob, bigob): Same.
* threads.c (thread_smob, mutex_smob, condvar_smob): Same.
* throw.c (jbsmob, lazy_catch_funs): Same.
1998-07-23 04:47:56 +00:00
Mikael Djurfeldt
a8741caa54 * eval.c, filesys.c, fluids.c, gc.c, gh_data.c, init.c, kw.c,
net_db.c, posix.c, print.c, regex-posix.c, scmsigs.c, socket.c,
stime.c, symbols.c, unif.c, vectors.c, weaks.c: Removed third
argument in call to scm_make_vector.
1998-07-12 00:10:02 +00:00
Mikael Djurfeldt
a163dda9ef * filesys.c (dirname, basename): New procedures. 1998-06-18 21:53:16 +00:00
Mikael Djurfeldt
cafc12ffdd * filesys.c (set_element): Return file descriptor.
(fill_select_type): Return the highest file descriptor.
(scm_select): Tell select about the highest file descriptor.  On
some systems the SELECT_SET_SIZE can be as much as 128 bytes.
Therefore the extra overhead for calculating the maximum fd seems
to be more than compensated.  Is this correct?  In any case,
scm_internal_select will be much faster with this info.
(scm_select, fill_select_type, set_element): Don't accept any kind
of object in the file descriptor list or vector.
1997-12-08 18:15:44 +00:00
Mikael Djurfeldt
1ea4704837 * filesys.c (scm_stat): Slightly optimized. 1997-12-04 16:40:53 +00:00
Mikael Djurfeldt
380463881a * filesys.c (scm_stat): Coerce output port only if argument *is*
an output port!  (Thanks to Harald Meland.)
1997-12-04 16:03:58 +00:00
Mikael Djurfeldt
44e8413c73 * Makefile.am: Added iselect.c and iselect.h.
* coop.c (coop_qinit): Initialize fields used by
scm_internal_select.
(coop_qget, coop_qget, coop_tmp_queue): Made global.
(coop_next_runnable_thread): If GUILE_ISELECT enabled, use
replacement in iselect.c.
(coop_mutex_lock, coop_condition_variable_wait, coop_abort,
coop_join): If GUILE_ISELECT enabled, use
coop_wait_for_runnable_thread instead of
coop_next_runnable_thread.
(usleep, sleep): New replacements for system functions if
GUILE_ISELECT is enabled.

* coop-threads.h: Declare coop_wait_for_runnable_thread.

* coop-defs.h (coop_t): Added fields used by scm_internal_select.

* filesys.c: Added #include "iselect.h".  Moved FD-macros to
iselect.h.  Implement Scheme level `select' using
scm_internal_select.  (See NEWS.)

* genio.c (scm_getc): Block with scm_internal_select.  (See NEWS.)

* init.c: Call scm_init_iselect.
1997-11-27 18:04:56 +00:00
Marius Vollmer
7844682850 * filesys.c (scm_close, set_element, get_element, scm_chown,
scm_chmod, scm_stat, scm_truncate_file, scm_fcntl, scm_fsync): Use
SCM_COERCE_OUTPORT to cope with the printstate/port magic.
* ports.c (scm_port_revealed, scm_set_port_revealed_x,
scm_close_port, scm_port_line, scm_set_port_line_x,
scm_port_column, scm_set_port_column_x, scm_port_filename,
scm_set_port_filename_x, scm_port_mode,
scm_close_all_ports_except, scm_set_current_output_port,
scm_set_current_error_port): Likewise
* ioext.c (scm_redirect_port, scm_dup_to_fdes, scm_freopen,
scm_ftell, scm_fileno, scm_isatty_p, scm_primitive_move_to_fdes):
Likewise
* posix.c (scm_ttyname, scm_tcgetpgrp, scm_tcsetpgrp): Likewise
* backtrace.c (display_backtrace_body): Likewise
* fports (scm_setvbuf): Likewise
* socket.c (scm_getsockopt, scm_setsockopt, scm_shutdown,
scm_connect, scm_bind, scm_listen, scm_accept, scm_getsockname,
scm_getpeername, scm_send, scm_sendto): Likewise
* unif.c (scm_uniform_array_write): Likewise
1997-10-25 21:54:12 +00:00
Gary Houston
6afcd3b2b6 * stime.h: prototype for scm_times.
* stime.c (scm_times): new procedure.
* ioext.c (scm_fseek): if the first argument is a file descriptor
call lseek.
(scm_ftell): if the first argument is a file descriptor call lseek
(sic).
* filesys.h: prototypes for scm_open_fdes, scm_fsync.
* filesys.c (scm_chmod): if the first argument is a file descriptor,
call fchmod.
(scm_chown): if the first argument is a port or file descriptor,
call fchown.
(scm_truncate_file): new procedure.
Add DEFER/ALLOW INTS to a few other procedures.
(scm_fsync): new procedure.
(scm_open_fdes): new procedure.
(scm_open): use scm_open_fdes.  If mode isn't specified, 666 will
now be used.
(scm_fcntl): the first argument can now be a file descriptor.  The
third argument is now optional.

* posix.c (scm_execl, scm_execlp): make the filename argument
compulsory, since omitting it causes SEGV.
(scm_sync): return unspecified instead of #f.
(scm_execle): new procedure.
(environ_list_to_c): new procedure.
(scm_environ): use environ_list_to_c.  disable interrupts.
(scm_convert_exec_args): take pos and subr arguments and
improve error checking.

* boot-9.scm: define tms accessors: clock, utime, stime, cutime,
cstime.
1997-08-16 18:48:44 +00:00
Gary Houston
a9488d1218 * filesys.c (scm_close): oops, don't call SCM_INUM twice on the
argument.

* ioext.h: new prototypes.
* ioext.c (scm_primitive_dup, scm_primitive_dup2): new procedures.
1997-07-20 10:03:26 +00:00
Gary Houston
eadd48de2b * fluids.c (next_fluid_num): don't do
SCM_THREAD_CRITICAL_SECTION_START/END unless USE_THREADS is defined.

* ports.h: prototypes too.
* ports.c (scm_mode_bits, scm_port_mode): moved from fports.c.

* fports.h: prototype too.
* fports.c (scm_evict_ports): moved from ioext.c.

* ports.c (scm_close_port): return a boolean instead of unspecified.
throw an error if an error other than EBADF occurs.

* filesys.h: scm_close prototype.
* filesys.c (scm_close): new procedure, can close file descriptors
and ports (scsh compatible).

* ports.c (scm_flush_all_ports): SCM_PROC incorrectly allowed an
optional argument.
1997-07-20 05:49:39 +00:00
Jim Blandy
82892beda5 * Lots of files: New address for FSF. 1997-05-26 22:34:48 +00:00
Gary Houston
a48a89bc17 * posix.c: don't include <sys/select.h> or define macros for
select, since they were not used in this file.

*	* filesys.c (scm_select): make the fifth parameter microseconds,
	not milliseconds.  let the fourth parameter be either a real value
	or an integer or #f.  The first, second and third arguments can
	now be vectors: the type of the corresponding return set will be
	the same.
	(set_element, get_element): new static procedures.
1997-05-15 08:46:37 +00:00
Jim Blandy
89958ad0ef Ensure that shared substrings are handled properly when passed to
a system call or other foreign function.  Many thanks to Tim
Pierce!
* symbols.h (SCM_COERCE_SUBSTR): new macro.
* filesys.c (scm_chmod, scm_rename, scm_delete_file, scm_mkdir,
scm_rmdir, scm_opendir, scm_chdir, scm_symlink, scm_readlink,
scm_lstat), ports.c (scm_sys_make_void_port), posix.c (scm_utime,
scm_putenv, scm_setlocale, scm_mknod), stime.c (setzone,
scm_strftime), vports.c (scm_make_soft_port), backtrace.c
(scm_display_error_message): use RO macros when strings may be RO.
* error.c (scm_error_scm), filesys.c (scm_chown, scm_chmod,
scm_rename, scm_delete_file, scm_mkdir, scm_rmdir, scm_opendir,
scm_chdir, scm_symlink, scm_readlink, scm_lstat), ioext.c
(scm_freopen, scm_duplicate_port, scm_fdopen), net_db.c
(scm_gethost, scm_getnet, scm_getproto, scm_getserv), ports.c
(scm_sys_make_void_port), posix.c (scm_getgrgid, scm_utime,
scm_setlocale, scm_mknod), stime.c (setzone, scm_strptime,
scm_strftime), vports.c (scm_make_soft_port): use
SCM_COERCE_SUBSTR to make sure shared substrings are
null-terminated.
1997-05-12 22:43:10 +00:00
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