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

51 commits

Author SHA1 Message Date
Josselin Poiret
551929e4fb Add 'spawn'.
* libguile/posix.c: Include spawn.h from Gnulib.
(do_spawn, scm_spawn_process): New functions.
(kw_environment, hw_input, kw_output, kw_error, kw_search_path): New
variables.
* doc/ref/posix.texi (Processes): Document it.
* test-suite/tests/posix.test ("spawn"): New test prefix.
* NEWS: Update.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13 16:05:30 +01:00
Maxime Devos
9ffd297249 Allow file ports in ‘utime’.
Ports representing symbolic links are currently unsupported.

* configure.ac: Detect 'futimens'.
* doc/ref/posix.texi (utime): Update documentation.
* libguile/posix.c (scm_utime): Support ports.
* libguile/posix.h (scm_utime): Rename argument.
* test-suite/tests/posix.test ("utime"): Add more tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21 17:40:30 +02:00
Ludovic Courtès
1d313bf5f0 'pipe' now takes an optional 'flags' parameter.
This is the same strategy as used for the 'accept4' bindings introduced
in 6e0965104c.

* libguile/posix.c (scm_pipe): Rename to...
(scm_pipe2): ... this.  Add an optional 'flags' parameter and honor it.
(scm_pipe): Rewrite as a call to 'scm_pipe2'.
* libguile/posix.h (scm_pipe2): New declaration.
* test-suite/tests/posix.test ("pipe"): New tests.
* configure.ac: Look for 'pipe2'.
* NEWS: Update.
2022-09-19 22:30:16 +02:00
Michael Gran
d60ff39105 Move declaration for scm_mkstemp to filesys.h
The underlying function was moved to filesys.c in
073167ef7b but the declaration didn't follow

* libguile/filesys.h: add declaration for scm_mkstemp
* libguile/posix.h: remove declaration for scm_mkstemp
2021-01-18 08:40:27 -08:00
Andy Wingo
1234bb1850 Update license notices in all C files
Update to newest recommended license notices from the FSF.  Everything
stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20 20:07:34 +02:00
Andy Wingo
791eb0c01a Remove (C) from copyright statements
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.'  It does take up
space though!  For that reason, we remove it here from our C files.
2018-06-20 19:17:06 +02:00
Andy Wingo
97cc65fee4 Rename __scm.h to scm.h
* libguile/scm.h: Rename.  Update all includers.
2018-06-20 16:33:33 +02:00
Andy Wingo
c495b44714 Remove Emacs local variables comments in Guile source
The .dir-locals.el file in the repository is sufficient for Emacs
users.

* libguile/__scm.h:
* libguile/alist.c:
* libguile/alist.h:
* libguile/array-handle.c:
* libguile/array-handle.h:
* libguile/array-map.c:
* libguile/array-map.h:
* libguile/arrays.c:
* libguile/arrays.h:
* libguile/async.c:
* libguile/async.h:
* libguile/backtrace.c:
* libguile/backtrace.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/boolean.c:
* libguile/boolean.h:
* libguile/chars.c:
* libguile/chars.h:
* libguile/chooks.c:
* libguile/chooks.h:
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/debug-malloc.h:
* libguile/debug.c:
* libguile/debug.h:
* libguile/deprecation.c:
* libguile/deprecation.h:
* libguile/dynl.c:
* libguile/dynl.h:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/dynwind.h:
* libguile/eq.c:
* libguile/eq.h:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/eval.h:
* libguile/evalext.c:
* libguile/evalext.h:
* libguile/expand.c:
* libguile/expand.h:
* libguile/extensions.c:
* libguile/extensions.h:
* libguile/feature.c:
* libguile/feature.h:
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.c:
* libguile/gc.h:
* libguile/generalized-arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/gettext.c:
* libguile/gettext.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/guardians.c:
* libguile/guardians.h:
* libguile/guile.c:
* libguile/hash.c:
* libguile/hash.h:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/hooks.h:
* libguile/i18n.c:
* libguile/i18n.h:
* libguile/init.c:
* libguile/init.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/ioext.c:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.c:
* libguile/keywords.h:
* libguile/list.c:
* libguile/list.h:
* libguile/load.c:
* libguile/load.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/macros.c:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memmove.c:
* libguile/memoize.c:
* libguile/memoize.h:
* libguile/modules.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/net_db.h:
* libguile/null-threads.c:
* libguile/null-threads.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/objprop.c:
* libguile/objprop.h:
* libguile/options.c:
* libguile/options.h:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/poll.c:
* libguile/poll.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/posix.h:
* libguile/print.c:
* libguile/print.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/procs.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/promises.c:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.c:
* libguile/random.h:
* libguile/rdelim.c:
* libguile/rdelim.h:
* libguile/read.c:
* libguile/read.h:
* libguile/regex-posix.c:
* libguile/regex-posix.h:
* libguile/rw.c:
* libguile/rw.h:
* libguile/scmsigs.c:
* libguile/scmsigs.h:
* libguile/script.c:
* libguile/script.h:
* libguile/simpos.c:
* libguile/simpos.h:
* libguile/smob.c:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.c:
* libguile/socket.h:
* libguile/sort.c:
* libguile/sort.h:
* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/stackchk.c:
* libguile/stackchk.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/stime.c:
* libguile/stime.h:
* libguile/strerror.c:
* libguile/strings.c:
* libguile/strings.h:
* libguile/strorder.c:
* libguile/strorder.h:
* libguile/strports.c:
* libguile/strports.h:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/symbols.h:
* libguile/syntax.c:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.c:
* libguile/unicode.h:
* libguile/uniform.c:
* libguile/uniform.h:
* libguile/values.c:
* libguile/values.h:
* libguile/variable.c:
* libguile/variable.h:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/version.c:
* libguile/vm-engine.c:
* libguile/vm-expand.h:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove needless trailing comments.
2018-06-20 14:32:28 +02:00
Andy Wingo
5534c2817e Remove useless "classes: h_files" from Guile headers.
* libguile/__scm.h:
* libguile/alist.h:
* libguile/array-handle.h:
* libguile/array-map.h:
* libguile/arrays.h:
* libguile/async.h:
* libguile/backtrace.h:
* libguile/bitvectors.h:
* libguile/boolean.h:
* libguile/chars.h:
* libguile/chooks.h:
* libguile/continuations.h:
* libguile/debug-malloc.h:
* libguile/debug.h:
* libguile/deprecation.h:
* libguile/dynl.h:
* libguile/dynstack.h:
* libguile/dynwind.h:
* libguile/eq.h:
* libguile/error.h:
* libguile/eval.h:
* libguile/evalext.h:
* libguile/expand.h:
* libguile/extensions.h:
* libguile/feature.h:
* libguile/filesys.h:
* libguile/fluids.h:
* libguile/fports.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.h:
* libguile/gettext.h:
* libguile/goops.h:
* libguile/gsubr.h:
* libguile/guardians.h:
* libguile/hash.h:
* libguile/hashtab.h:
* libguile/hooks.h:
* libguile/i18n.h:
* libguile/init.h:
* libguile/inline.h:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.h:
* libguile/list.h:
* libguile/load.h:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memoize.h:
* libguile/modules.h:
* libguile/net_db.h:
* libguile/null-threads.h:
* libguile/numbers.h:
* libguile/objprop.h:
* libguile/options.h:
* libguile/pairs.h:
* libguile/poll.h:
* libguile/ports.h:
* libguile/posix-w32.h:
* libguile/posix.h:
* libguile/print.h:
* libguile/procprop.h:
* libguile/procs.h:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.h:
* libguile/rdelim.h:
* libguile/read.h:
* libguile/regex-posix.h:
* libguile/rw.h:
* libguile/scmsigs.h:
* libguile/script.h:
* libguile/simpos.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.h:
* libguile/sort.h:
* libguile/srcprop.h:
* libguile/stackchk.h:
* libguile/stacks.h:
* libguile/stime.h:
* libguile/strings.h:
* libguile/strorder.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.h:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.h:
* libguile/uniform.h:
* libguile/values.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.h:
* libguile/weak-table.h:
* libguile/weak-vector.h: Remove "classes: h_files".  Reformat
  copyrights if needed.
2018-06-20 14:26:16 +02:00
Andy Wingo
ad4fe88ffb Move system* to posix.c, impl on open-process
* libguile/simpos.c: Trim includes.
  (scm_system_star): Move to posix.c.
* libguile/simpos.h (scm_system_star): Remove.
* libguile/posix.h (scm_system_star): Add.
* libguile/posix.c (scm_system_star): Move here and implement in terms
  of open-process.  This lets system* work on Windows.  Inspired by a
  patch by Eli Zaretskii.
  (start_child): Exit with 127 if the command isn't found.
2016-08-31 10:42:21 +02:00
Ludovic Courtès
d20912e67d Move {total,current}-processor-count' outside of posix.c'.
* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): Move to...
* libguile/threads.c: ... here.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): Move declarations to...
* libguile/threads.h: ... here.

* test-suite/tests/posix.test ("nproc"): Move tests to...
* test-suite/tests/threads.test: ... here.
2011-04-25 22:41:58 +02:00
Ludovic Courtès
f0c0141fe4 Add total-processor-count' and current-processor-count'.
* libguile/posix.c (scm_total_processor_count,
  scm_current_processor_count): New functions.

* libguile/posix.h (scm_total_processor_count,
  scm_current_processor_count): New declarations.

* test-suite/tests/posix.test ("nproc"): New test prefix.

* doc/ref/posix.texi (Processes): Document `total-processor-count' and
  `current-processor-count'.
2010-12-07 23:13:20 +01:00
Ludovic Courtès
fe613fe25d Add bindings to GNU sched_setaffinity' and sched_getaffinity'.
* configure.ac: Add checks for `sched_setaffinity' and
  `sched_getaffinity'.

* doc/ref/posix.texi (Processes): Document `getaffinity' and
  `setaffinity'.

* libguile/posix.c (cpu_set_to_bitvector,
  scm_getaffinity)[HAVE_SCHED_GETAFFINITY]: New functions.
  (scm_setaffinity)[HAVE_SCHED_SETAFFINITY]: New function.

* libguile/posix.h (scm_getaffinity, scm_setaffinity): New declarations.

* test-suite/tests/posix.test ("affinity"): New test prefix.
2010-12-03 00:38:29 +01:00
Andy Wingo
cd28785f79 deprecate cuserid
* libguile/posix.c:
* libguile/posix.h:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_cuserid): Deprecate cuserid, as it only
  returns 8 bytes of a user's login.

* doc/ref/posix.texi: Remove cuserid from docs.
2010-11-18 11:15:16 +01:00
Thien-Thi Nguyen
cd53bd3668 Add tmpfile(3) to libguile.
* libguile/posix.c (scm_tmpfile): New primitive.
* libguile/posix.h (scm_tmpfile): New func decl.

* doc/ref/posix.texi (File System): Document `tmpfile'.
2010-06-15 23:06:00 +02:00
Ludovic Courtès
8c93b597b3 Fix the visibility of a few of internal symbols.
* libguile/gc.h (scm_i_gc): Make internal.
* libguile/posix.h (scm_i_locale_mutex): Likewise.
* libguile/arrays.h (scm_i_tc16_array): Likewise.
* libguile/numbers.c (scm_i_num_less_p): Likewise.
* libguile/discouraged.h (scm_i_init_discouraged): Likewise.
* libguile/continuations.c (scm_i_dummy): Made static.
* libguile/gc.c (scm_i_cell_validation_already_running): Likewise.
* libguile/discouraged.h (scm_i_init_discouraged): Likewise.
2010-05-28 17:02:13 +02:00
Andy Wingo
06bfe276c8 nanosecond timestamp support in stat and utime
* libguile/posix.h:
* libguile/posix.c (scm_utime): Add optional nanosecond arguments. This
  is an incompatible change on the C level, but it's unlikely people are
  using this POSIX wrapper function, because they would just use the
  POSIX function directly. Hopefully, anyway.

* module/system/base/compile.scm (call-with-output-file/atomic):
  Propagate source timestamps to targets with nanosecond precision, if
  available. Fixes build on systems with ext4 filesystems.

* libguile/filesys.c (scm_stat2scm):
* module/ice-9/posix.scm (stat:atimensec, stat:mtimensec)
  (stat:ctimensec): Add three new elements to Scheme stat structures,
  for nanosecond-level timestamps.

* configure.ac: Add checks for utimensat, and for nanosecond fields in
  struct stat. We should switch to using Gnulib things for these,
  though.

* doc/ref/posix.texi (File System): Add documentation for utime's
  additional arguments, and nanosecond stat timestamp accessors.
2010-01-17 16:56:34 +01:00
Neil Jerram
3e5aed1c3b Add support for getsid
* configure.ac: Check availability of getsid() C library call.

* libguile/posix.c (scm_getsid): New primitive.

* libguile/posix.h: Declaration for new primitive.
2009-12-27 16:59:54 +00:00
Ludovic Courtès
d6a6989e08 Replace setbinary' by a public %default-port-encoding' fluid.
* doc/ref/api-evaluation.texi (Character Encoding of Source Files): Add
  reference to the "Ports" node.

* doc/ref/api-io.texi (Ports): Document `%default-port-encoding'.

* libguile/ports.c (scm_port_encoding_var): Rename to...
  (default_port_encoding_var): ... this; update callers.  Make `static'.

* libguile/posix.c (scm_setbinary): Remove.

* libguile/posix.h: Adjust accordingly.

* test-suite/tests/numbers.test: Remove unneeded `setbinary' call.

* test-suite/tests/ports.test: Replace `setbinary' call by equivalent
  `%default-port-encoding' mutation and `set-port-encoding!' calls.

* test-suite/tests/r6rs-ports.test: Replace `setbinary' call by
  equivalent `%default-port-encoding' mutation.
2009-11-14 16:59:25 +01:00
Michael Gran
889975e51a Add full Unicode capability to ports and the default reader
Ports are given two additional properties: a character encoding and
a conversion failure strategy.  These properties have getters and setters.
The new properties are used to convert any locale text to/from the
internal representation of strings.

If unspecified, ports use a default value. The default value of these
properties is held in a fluid.  The default character encoding can be
modified by calling setlocale.

ISO-8859-1 is treated specially.  Since it is a native encoding of
strings, it can be processed more quickly.  Source code is assumed to be
ISO-8859-1 unless otherwise specified.  The encoding of a source code
file can be given as 'coding: XXXXX' in a magic comment at the top of a
file.

The C functions that deal with encoding often use a null pointer
as shorthand for the native Latin-1 encoding, for efficiency's sake.

* test-suite/tests/encoding-iso88591.test: new tests
* test-suite/tests/encoding-iso88597.test: new tests
* test-suite/tests/encoding-utf8.test: new tests
* test-suite/tests/encoding-escapes.test: new tests
* test-suite/tests/numbers.test: declare 'binary' encoding
* test-suite/tests/ports.test: declare 'binary' encoding
* test-suite/tests/r6rs-ports.test: declare 'binary' encoding

* module/system/base/compile.scm (compile-file): use source-code
  file's self-declared encoding when compiling files

* libguile/strports.c: store string ports in locale encoding
  (scm_strport_to_locale_u8vector, scm_call_with_output_locale_u8vector)
  (scm_open_input_locale_u8vector, scm_get_output_locale_u8vector):
  new functions

* libguile/strings.h: new declaration for scm_i_string_contains_char

* libguile/strings.c (scm_i_string_contains_char): new function
  (scm_from_stringn, scm_to_stringn):  use NULL for Latin-1
  (scm_from_locale_stringn, scm_to_locale_stringn): respect character
  encoding of input and output ports

* libguile/read.h: declaration for scm_scan_for_encoding

* libguile/read.c:
  (read_token): now takes scheme string instead of C string/length
  (read_complete_token): new function
  (scm_read_sexp, scm_read_number, scm_read_mixed_case_symbol)
  (scm_read_number_and_radix, scm_read_quote, scm_read_semicolon_comment)
  (scm_read_srfi4_vector, scm_read_bytevector, scm_read_guile_bit_vector)
  (scm_read_scsh_block_comment, scm_read_commented_expression)
  (scm_read_extended_symbol, scm_read_sharp_extension, scm_read_shart)
  (scm_read_expression): use scm_t_wchar for char type, use read_complete_token
  (scm_scan_for_encoding): new function to find a file's character encoding
  (scm_file_encoding): new function to find a port's character encoding

* libguile/rdelim.c: don't unpack strings

* libguile/print.h: declaration for modified function
  scm_i_charprint

* libguile/print.c: use locale when printing characters and
  strings
  (scm_i_charprint): input parameter is now scm_t_wchar
  (scm_simple_format): don't unpack strings

* libguile/posix.h: new declaration for scm_setbinary.

* libguile/posix.c (scm_setlocale): set default and stdio port
  encodings based on the locale's character encoding
  (scm_setbinary): new function

* libguile/ports.h (scm_t_port): add encoding and failed
  conversion handler to port type.  Declarations for new or modified
  functions scm_getc, scm_unget_byte, scm_ungetc,
  scm_i_get_port_encoding, scm_i_set_port_encoding_x,
  scm_port_encoding, scm_set_port_encoding_x,
  scm_i_get_conversion_strategy, scm_i_set_conversion_strategy_x,
  scm_port_conversion_strategy, scm_set_port_conversion_strategy_x.

* libguile/ports.c: assign the current ports to zero on startup so
  we can see if they've been set.
  (scm_current_input_port, scm_current_output_port,
  scm_current_error_port): return #f if the port is not yet
  initialized
  (scm_new_port_table_entry): set up a new port's encoding and
  illegal sequence handler based on the thread's current defaults
  (scm_i_remove_port): free port encoding name when port is removed
  (scm_i_mode_bits_n): now takes a scheme string instead of a c
  string and length.  All callers changed.
  (SCM_MBCHAR_BUF_SIZE): new const
  (scm_getc): new function, since the scm_getc in inline.h is now
  scm_get_byte_or_eof.  This pulls one codepoint from a port.
  (scm_lfwrite_substr, scm_lfwrite_str): now uses port's encoding
  (scm_unget_byte): new function, incorportaing the low-level functionality
  of scm_ungetc
  (scm_ungetc): uses scm_unget_byte

* libguile/numbers.h (scm_t_wchar): compilation order problem with
  scm_t_wchar being use in functions in multiple headers.  Forward
  declare scm_t_wchar.

* libguile/load.c (scm_primitive_load): scan for file encoding at
  top of file and use it to set the load port's encoding

* libguile/inline.h (scm_get_byte_or_eof): new function
  incorporating most of the functionality of scm_getc.

* libguile/fports.c (fport_fill_input): now returns scm_t_wchar

* libguile/chars.h (scm_t_wchar): avoid compilation order problem
  with declaration of scm_t_wchar
2009-08-25 07:54:37 -07:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Andy Wingo
4ea9429edc add getrlimit and setrlimit wrappers
* README: Some rewording.

* configure.in: Check for getrlimit and setrlimit.

* libguile/posix.h:
* libguile/posix.c: Add some getrlimit and setrlimit wrappers. They're
  documented, but I suspect something else has to be done to get them
  into the manual.
2009-03-27 15:06:41 -07:00
Ludovic Courtès
b6137ed741 Don't declare scm_i_locale_mutex' as SCM_INTERNAL'. 2008-07-04 22:22:06 +02:00
Ludovic Courtès
102dbb6f6c Add `SCM_INTERNAL' macro, use it. 2008-05-31 23:21:02 +02:00
Ludovic Courtès
b89c494395 Changes from arch/CVS synchronization 2006-11-18 18:14:55 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
f360a962d4 * posix.h (scm_setgroups): New prototype.
* posix.c (scm_setgroups): New.  Thanks to Paul Jarc!
(scm_getgroups): Handle groups ids that don't fit into a fixnum.
Don't use SCM_WRITABLE_VELTS.
2003-07-27 16:20:21 +00:00
Rob Browning
4adf1363a7 * posix.h: change occurences of "id" to something else so we don't
cause trouble when included via objective-c (can't hurt, might
help).  Still have usage in debug.h, though.
2003-04-07 01:50:16 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Marius Vollmer
33b001fd89 Prefixed each each exported symbol with SCM_API. 2001-11-02 00:19:12 +00:00
Dirk Herrmann
b29058ffee * Remove deprecated macros and typenames.
* Rename header macros to SCM_<filename>_H.
* Prefer !SCM_<foo> over SCM_N<foo>.
2001-08-31 11:17:06 +00:00
Gary Houston
6d163216bd * posix.c (scm_tmpnam): check that return value from tmpnam is not
NULL.  rewrote the docstring.
	(scm_mkstemp): new procedure implementing "mkstemp!".
	* posix.h: declare scm_mkstemp.

	* net_db.c: declare h_errno if configure didn't define HAVE_H_ERRNO.
	normally it would be found in netdb.h.
2001-03-18 20:29:58 +00:00
Martin Grabmüller
94e6d79391 Added some new posix functions:
(scm_crypt, scm_chroot, scm_getlogin, scm_cuserid),
	(scm_getpriority, scm_setpriority, scm_getpass, scm_flock),
	(scm_sethostname, scm_gethostname): New procedures.
2001-03-09 10:03:47 +00:00
Mikael Djurfeldt
f2c9fcb07e Updated copyrights 2000-06-12 12:28:24 +00:00
Michael Livshin
89e00824a0 * *.[hc]: add Emacs magic at the end of file, to ensure GNU
indentation style.
2000-03-19 19:01:16 +00:00
Greg J. Badros
7866a09b5b * list.c: Moved append docs to append! Thanks Dirk Hermann. Also,
added append docs from R4RS.

* strings.c: Docstring typo fix, + eliminate unneeded IMP tests.
Thanks Dirk Hermann!

* chars.h: Provide SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR and
deprecate SCM_ICHRP, SCM_ICHR, SCM_MAKICHR.  Thanks Dirk Hermann!

* *.h, *.c: Use SCM_CHARP, SCM_CHAR, SCM_MAKE_CHAR throughout.
Drop use of SCM_P for function prototypes... assume an ANSI C
compiler.  Thanks Dirk Hermann!
2000-03-02 20:54:43 +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
522158de92 * posix.h (scm_tmpnam): Added prototype. 1998-09-06 18:57:07 +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
Jim Blandy
82892beda5 * Lots of files: New address for FSF. 1997-05-26 22:34:48 +00:00
Gary Houston
b9525b92bb * stime.c (scm_mktime): take an optional zone argument.
(scm_localtime): check putenv return value.
	(scm_strftime, scm_strptime): moved from posix.c.  move #include
	sequences.h too.
	stime.h, posix.h: update prototypes.
	(bdtime2c, setzone, restorezone): new static procedures.
	(scm_mktime, scm_strftime): use them.
	(scm_strftime): don't call mktime before strftime.  Use
	filltime for return value.
	(filltime): convert NULL zname to #f.
*	(scm_strptime): return a count of characters consumed, not
	the remaining string.

	* stime.c (scm_localtime): check HAVE_TM_ZONE and HAVE_TZNAME.
	(scm_mktime): likewise.
	Declare *tzname[].
	Uncomment localtime and mktime.

	* configure.in: add AC_STRUCT_TIMEZONE.
1997-04-12 20:18:12 +00:00
Gary Houston
19468effd0 * posix.c (scm_putenv): don't check HAVE_PUTENV.
* Makefile.am (EXTRA_libguile_la_SOURCES): add putenv.c.
* configure.in: move putenv from AC_CHECK_FUNCS to AC_REPLACE_FUNCS.
* putenv.c: new file, from sh-utils 1.12.

* posix.c (scm_environ): use malloc in place of scm_must_malloc
since allocation isn't for Scheme objects.
(scm_putenv): copy strings before placing in the environment.

* stime.c (scm_current_time): throw an error if time returns -1,
instead of returning #f.
(scm_get_internal_real_time, scm_get_internal_real_time): use
scm_long2num for return value instead of SCM_MAKINUM.

* stime.h: prototypes updated.

* stime.c (scm_time_in_msec): apparently unused, deleted.

	* configure.in: check for gettimeofday.

	* stime.c (scm_time_plus_ticks): new procedure, an scsh interface
	which may be more usefully portable than a gettimeofday interface.

	* stime.c (filltime): recovered static procedure.
	(scm_localtime, scm_gmtime, scm_mktime, scm_tzset): recovered from
	an earlier Guile.

	* posix.h: add prototype for scm_close_pipe, remove prototypes for
	scm_open_input_pipe, scm_open_output_pipe, change scm_mknod prototype.

*	* posix.c (scm_mknod): split the mode argument into type and perms
	arguments, like the extra fields returned by stat.

	* fports.c (scm_pipob): set the close, free and print procedures.
	(scm_close_pipe): new procedure.

	* posix.c (scm_open_input_pipe, scm_open_output_pipe): deleted,
	define them in boot-9.scm
1997-04-05 21:50:31 +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
Gary Houston
1146b6cda2 * ports.c: add SCM_PROC declarations for pt-size and pt-member.
* Makefile.am: remove AWK=@AWK@.
	Add a rule for generating errnos.list.
	(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.

	* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
	don't extract errnos, just set a variable (avoids the
	need to recompile error.c just because configure is run.)

	* unif.h: update prototypes.
	* unif.c (scm_uniform_array_read,write): change the offset and
	length arguments to start and end, for consistency.

	* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.

	* ioext.h: update prototypes.
*	* ioext.c (scm_read_delimited_x): replaces scm_read_line and
	scm_read_line_x, it's a more general procedure using an
	interface from scsh.  read-line and read-line! are now defined
	in boot-9.scm.
*  	Note that the new read-line trims the terminator
	by default, previously it was appended to the returned string.  An
	optional argument specifies how to process the terminator (scsh
	compatible).  For the old behaviour: (read-line port 'concat).
	scm_read_line, scm_read_line_x: deleted.  (read-line port 'split)
	returns a pair, but is converted to multiple values if the scsh
	module is loaded.

	socket.h: update prototypes.
	* socket.c (scm_recvfrom): for consistency with other procedures,
	take start and end as separate optional arguments.
*	(scm_recv, scm_recvfrom): don't allow the second argument
	to be a size, only a buffer.  Change the scheme names to
	recv! and recvfrom!.  Don't return the buffer.

	* ioext.h, posix.h: move prototypes too.
	* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
	moved back from posix.c to ioext.c.  Also move #includes of "genio.h"
	"read.h" and "unif.h".
	* ioext.c: include "chars.h"
1997-01-25 18:23:49 +00:00
Gary Houston
f93ddd3985 * configure.in: add tests for figuring out whether buffered data
is available in a FILE structure, which is needed by char-ready.

* acconfig.h: define FILE_CNT_FIELD, FILE_CNT_GPTR and
FILE_CNT_READPTR.

* simpos.c (scm_getenv): renamed from scm_sys_getenv.  Throw
exceptions using misc_error instead of syserror.  It seems a bit
odd to throw an exception if a string can't be found in the
environment, but it's consistent with open-file, stat etc.
(simpos.h): remove sys_ from getenv.

* posix.c (scm_putenv): renamed from scm_sys_putenv.  If an error
occurs, throw an error instead of returning errno.  Return value
is now unspecified.
(numerous in posix.c and posix.h): removed superfluous sys_ from names.
1996-10-28 09:44:07 +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
Jim Blandy
5e840c2e1a * numbers.h: Repeated declarations removed.
* ports.h (scm_close_all_ports_except): Declaration for the
function defined in ports.c added.

* posix.h: Missing declarations added.

* procs.h (scm_make_subr_opt): Missing declaration added.

* socket.h (scm_sys_gethost): Missing declaration added.

* socket.h: Redundant declarations removed (they are in fdsocket.h).

* srcprop.h (scm_set_source_property_x, scm_finish_srcprop):
Missing declarations added.

* stime.h (scm_get_internal_real_time): Repeated declarations removed.

* struct.c: Uninitialized variable `SCM answer' may be used.

* unif.c (l2ra): Declaration prototype.

* unif.c (scm_array_equal_p): Dummy definition removed (it is
defined in ramap.c).

* unif.h (scm_raprin1, scm_istr2bve, scm_array_equal_p):
Redundant declarations removed (they are in ramap.h).

* variable.h (scm_make_udvariable,
scm_make_undefined_variable): Declaration corrected to
correspond variable.c.

* vectors.h (scm_vector_move_left_x, scm_vector_move_right_x):
Missing declarations added.
1996-09-11 20:29:44 +00:00
Jim Blandy
b4309c3c5a * alist.h, append.h, arbiters.h, async.h, boolean.h, chars.h,
continuations.h, debug.h, dynwind.h, error.h, eval.h, fdsocket.h,
feature.h, filesys.h, fports.h, gc.h, gdbint.h, genio.h, gsubr.h,
hash.h, init.h, ioext.h, kw.h, list.h, markers.h, marksweep.h,
mbstrings.h, numbers.h, objprop.h, options.h, pairs.h, ports.h,
posix.h, print.h, procprop.h, procs.h, ramap.h, read.h, root.h,
sequences.h, smob.h, socket.h, srcprop.h, stackchk.h, stime.h,
strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h,
tag.h, throw.h, unif.h, variable.h, vectors.h, version.h,
vports.h, weaks.h: #include "libguile/__scm.h", not
<libguile/__scm.h>.  This allows 'gcc -MM' to determine which
dependencies are within libguile properly.
1996-09-05 21:19:08 +00:00
Jim Blandy
cd4f61de2f Don't install the unwashed masses of Guile header files in the
main #include path; put most of them in a subdirectory called
'libguile'.  This avoids naming conflicts between Guile header
files and system header files (of which there were a few).
* Makefile.in (pkgincludedir): Deleted.
(innerincludedir): New variable; this and $(includedir) are enough.
(INCLUDE_CFLAGS): Search for headers in "-I$(srcdir)/..".
(installed_h_files): Divide this up.  Now this variable lists
those header files which should go into $(includedir) (i.e. appear
directly in the #include path), and ...
(inner_h_files): ... this new variable says which files appear in
a subdirectory, and are referred to as <libguile/mumble.h>.
(h_files): List them both.
(install): Create innerincludedir, not pkgincludedir.  Put
the installed_h_files and inner_h_files in their proper places.
(uninstall): Corresponding changes.
* alist.h, append.h, arbiters.h, async.h, boolean.h, chars.h,
continuations.h, debug.h, dynwind.h, error.h, eval.h, fdsocket.h,
feature.h, fports.h, gc.h, genio.h, gsubr.h, hash.h, init.h,
ioext.h, kw.h, libguile.h, list.h, markers.h, marksweep.h,
mbstrings.h, numbers.h, options.h, pairs.h, ports.h, posix.h,
print.h, procprop.h, procs.h, ramap.h, read.h, root.h,
sequences.h, smob.h, socket.h, srcprop.h, stackchk.h, stime.h,
strings.h, strop.h, strorder.h, strports.h, struct.h, symbols.h,
tag.h, throw.h, unif.h, variable.h, vectors.h, version.h,
vports.h, weaks.h: Find __scm.h in its new location.
* __scm.h: Find scmconfig.h and tags.h in their new locations
(they're both "inner" files).
1996-09-04 06:21:08 +00:00