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

2077 commits

Author SHA1 Message Date
Mark H Weaver
6d9c6833e7
Fix a few typos in the manual.
Fixes <https://bugs.gnu.org/30276>.
Reported by Matt Wette <matt.wette@gmail.com>.

* doc/ref/api-macros.texi (Macro Expansion)
doc/ref/vm.texi (Procedure Call and Return Instructions): Fix typos.
2018-03-16 00:09:26 -04:00
Ludovic Courtès
9417fdb80f doc: Fix typo about SRFI-4 syntax.
Reported by Matt Wette <matt.wette@gmail.com>.
Fixes <https://bugs.gnu.org/29910>.

* doc/ref/api-data.texi (Array Syntax): Fix typo.
2018-02-16 15:29:35 +01:00
Ludovic Courtès
2c7d6031f3 doc: Update LALR URL.
Reported by Chris Vine <vine35792468@gmail.com>.

* doc/ref/api-lalr.texi (LALR(1) Parsing): Update URL.
2017-12-14 10:18:23 +01:00
Andy Wingo
bfe70b129c Merge until 8e2314c46d from stable-2.2 2017-11-29 21:13:40 +01:00
Andy Wingo
f85d3c0bd8 Merge until e0bcda4ad9 from stable-2.2 2017-11-29 21:04:59 +01:00
Matt Wette
bb5d316b16 foreign: Add 'uintptr_t' and 'intptr_t'.
* libguile/foreign.c (scm_uintptr_t, scm_intptr_t): New variables.
(scm_init_foreign): Define them.
* module/system/foreign.scm: Export 'intptr_t' and 'uintptr_t'.
* doc/ref/api-foreign.texi (Foreign Types): Document them.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-11-22 16:33:57 +01:00
Arun Isaac
1be85ca008 Mention (ice-9 peg) module path.
* doc/ref/api-peg.texi (PEG Parsing): Mention (ice-9 peg) module path.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-11-22 16:15:16 +01:00
Arun Isaac
c2817dc93b Convert `close' ref to xref.
* doc/ref/api-io.texi (Ports): Convert `close' ref to xref.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-11-22 16:15:04 +01:00
Daniel Llorens
3bfd4aaa6e Fix sort, sort! for arrays with nonzero lower bound
* module/ice-9/arrays.scm (array-copy): New function, export.
* module/Makefile.am: Install (ice-9 arrays).
* doc/ref/api-data.texi: Add documentation for (ice-9 arrays).
* libguile/quicksort.i.c: Use signed bounds throughout.
* libguile/sort.c (scm_restricted_vector_sort_x): Fix error calls. Fix
  calls to quicksort.
* test-suite/tests/sort.test: Actually test that the sorted results
  match the original data. Test cases for non-zero base index arrays for
  sort, sort!, and stable-sort!.
2017-10-31 13:23:17 +01:00
Daniel Llorens
ffcdb7bddf Remove documentation on uniform-vector-read!, uniform-vector-write
* NEWS: Add specific removal notice.
* doc/ref/api-data.texi: Remove documentation on uniform-vector-read!,
  uniform-vector-write.
2017-10-31 13:23:17 +01:00
Andy Wingo
84259f54e3 Merge 'stable-2.2'
Resolve conflicts by removing capability of struct-ref / struct-set! to
access unboxed slots.
2017-09-25 22:18:13 +02:00
Andy Wingo
a74d4ee4f6 Add struct-ref/unboxed, struct-set!/unboxed
* NEWS: Add news entry.
* doc/ref/api-data.texi (Vtables, Structure Basics): Update
  documentation.
* libguile/struct.c (scm_i_struct_equalp): Avoid using struct-ref on
  unboxed fields.
  (scm_struct_ref, scm_struct_set_x_unboxed): Issue deprecation warning
  when accessing unboxed fields.
  (scm_struct_ref_unboxed, scm_struct_set_x_unboxed): New functions.
* libguile/struct.h (scm_struct_ref_unboxed, scm_struct_set_x_unboxed):
  New functions.
* module/oop/goops.scm (class-add-flags!, class-clear-flags!):
  (class-has-flags?, <class>, %allocate-instance, <slot>):
  (compute-get-n-set, unboxed-get, unboxed-set, unboxed-slot?):
  (allocate-slots, %prep-layout!, make-standard-class, initialize):
  Adapt to access unboxed nfields and flags fields via the new
  accessors.
2017-09-25 21:54:36 +02:00
Andy Wingo
5870188eb4 Replace "pr" struct fields with "pw" fields
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Layout is a "pr" field.
* module/ice-9/boot-9.scm (record-type-vtable): Record vtable fields are
  writable.
  (<parameter>): "pw" fields.
* module/oop/goops.scm (<class>, %compute-layout): <read-only> fields
  are "pw" underneath.
* module/rnrs/records/procedural.scm (record-type-vtable)
  (record-constructor-vtable, make-record-type-descriptor): Use "pw"
  fields in vtables.
* module/srfi/srfi-35.scm (%condition-type-vtable)
  (struct-layout-for-condition): "pw" fields in vtables.
* test-suite/tests/goops.test:
* test-suite/tests/structs.test: Use "pw" fields only.
* benchmark-suite/benchmarks/structs.bm: Update for make-struct/no-tail,
  to use pw fields, and also to remove useless tests that the compiler
  would optimize away.
* doc/ref/api-data.texi (Vtables): Add a note about the now-vestigial
  permissions character and update documentation.
  (Structure Basics, Meta-Vtables): Update examples.
* libguile/hash.c (scm_i_struct_hash): Remove code that would handle
  opaque/self fields.
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use "pw" fields.
* libguile/struct.c (scm_struct_init): Simplify check for hidden
  fields.
* libguile/values.c (scm_init_values): Field is "pw".
2017-09-23 15:33:02 +02:00
Andy Wingo
e26652b7e1 Merge 'stable-2.2' 2017-09-23 11:17:35 +02:00
Andy Wingo
b0ecf83ef0 Deprecate opaque struct fields
* NEWS: Add entry.
* doc/ref/api-data.texi (Vtables, Structure Basics): Remove mention of
  opaque field protection.
* libguile/struct.c (scm_make_struct_layout, scm_make_struct_no_tail):
  Remove discussion of opaque fields.
  (set_vtable_layout_flags): Issue a deprecation warning when opaque
  fields are used.
2017-09-23 11:14:27 +02:00
Andy Wingo
2f9ad7d9bc Merge stable-2.2 into master
This commit resolves conflicts by removing the deprecated make-struct.
2017-09-22 12:02:25 +02:00
Andy Wingo
04f48e94b5 Deprecate struct "self" slots
* libguile/print.h (SCM_PRINT_STATE_LAYOUT): Use a normal slot instead
  of a self slot.
* libguile/print.c (make_print_state): Initialize "handle" slot
  manually.
* libguile/struct.c (issue_deprecation_warning_for_self_slots): New
  helper, called when making vtables to issue deprecation warnings for
  "self" slots.  Avoids warning for the "self" slot that's part of the
  fixed vtable slots.
  (scm_i_struct_inherit_vtable_magic): Call
  issue_deprecation_warning_for_self_slots.
* doc/ref/api-data.texi (Vtables, Structure Basics): Remove references
  to self slots.
* NEWS: Add entry.
2017-09-22 11:35:36 +02:00
Andy Wingo
53d4df80c9 Remove references to tail arrays in the documentation
* doc/ref/api-data.texi (Vtables, Structure Basics): Update to remove
  references to tail arrays, in preparation for deprecation.
2017-09-20 22:19:49 +02:00
Andy Wingo
ed549da230 Document class redefinition change
* doc/ref/goops.texi (Redefinable Classes): New subsection.
  (Default Class Redefinition Behaviour)
  (Changing the Class of an Instance): Update for class redefinition
  change.
* NEWS: Add 2.3.0 section.
2017-09-14 11:09:02 +02:00
Mark H Weaver
d3fcefc3d5
doc: Document 'short' and 'unsigned-short' foreign types.
This is a followup to commit 42f7c01e0a.
Reported by Adriano Peluso <catonano@gmail.com>.

* doc/ref/api-foreign.texi (Foreign Types): Add missing entries for
'short' and 'unsigned-short'.
2017-06-11 22:02:26 -04:00
Andy Wingo
67b35bba67 Update uri? documentation.
* doc/ref/web.texi (URIs): Update uri? documentation for deprecation
  removal.
2017-05-22 15:40:10 +02:00
Andy Wingo
1f560bc4b7 Remove support for legacy syntax objects.
* module/ice-9/psyntax.scm: Remove support for legacy syntax objects.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/deprecated.scm (allow-legacy-syntax-objects?): New
  deprecation.
* module/ice-9/boot-9.scm: Don't define allow-legacy-syntax-objects?.
* doc/ref/api-macros.texi: Remove documentation for
  allow-legacy-syntax-objects?.
2017-05-22 15:37:43 +02:00
Andy Wingo
b2c0e01bb4 Update effective version to 3.0
* GUILE-VERSION: Bump version to 2.3.0, and effective version to 3.0.
* .gitignore:
* README:
* doc/guile.1:
* doc/ref/api-evaluation.texi:
* doc/ref/api-options.texi:
* doc/ref/guile-invoke.texi:
* doc/ref/libguile-foreign-objects.texi:
* doc/ref/libguile-parallel.texi:
* doc/ref/srfi-modules.texi: Update to 3.0.
* libguile/_scm.h (SCM_OBJCODE_MAJOR_VERSION):
(SCM_OBJCODE_MINIMUM_MINOR_VERSION, SCM_OBJCODE_MINOR_VERSION): Bump
bytecode version for fallback path.
* libguile/loader.c: Update to avoid loading version 2.2 bytecode
files.
* meta/guile-3.0-uninstalled.pc.in:
* meta/guile-3.0.pc.in: Rename.
* module/system/vm/assembler.scm (*bytecode-major-version*):
(*bytecode-minor-version*): Write the new bytecode version.
2017-05-22 14:15:40 +02:00
Andy Wingo
7095a536f3 web: add support for URI-reference
Based on a patch by Daniel Hartwig <mandyke@gmail.com>.

* NEWS: Update.
* doc/ref/web.texi (URIs): Fragments are properly part of a URI, so
  remove the incorrect note.  Add documentation on URI subtypes.
* module/web/uri.scm (uri-reference?): New base type predicate.
  (uri?, relative-ref?): Specific predicates.
  (validate-uri-reference): Strict validation.
  (validate-uri, validate-relative-ref): Specific validators.
  (build-uri-reference, build-relative-ref): New constructors.
  (string->uri-reference): Rename from string->uri.
  (string->uri, string->relative-ref): Specific constructors.
  (uri->string): Add #:include-fragment? keyword argument.
* module/web/http.scm (parse-request-uri): Use `build-uri-reference',
  and result is a URI-reference, not URI, object.  No longer infer an
  absent `uri-scheme' is `http'.
  (write-uri): Just use `uri->string'.
  (declare-uri-header!): Remove unused function.
  (declare-uri-reference-header!): Update.  Rename from
  `declare-relative-uri-header!'.
* test-suite/tests/web-uri.test ("build-uri-reference"):
  ("string->uri-reference"): Add.
  ("uri->string"): Also tests for relative-refs.
* test-suite/tests/web-http.test ("read-request-line"):
  ("write-request-line"): Update for no scheme in some URIs.
  ("entity headers", "request headers"): Content-location, Referer, and
  Location should also parse relative-URIs.
* test-suite/tests/web-request.test ("example-1"): Expect URI-reference
  with no scheme.
2017-05-21 13:42:29 +02:00
Andy Wingo
96c9af4ab1 readline: Avoid interpreting control characters in pastes.
* NEWS: Update.
* doc/ref/repl-modules.texi (Readline Options): Update for
  bracketed-paste.
* guile-readline/readline.h (SCM_READLINE_BRACKETED_PASTE): Add
  bracketed-paste option.
* guile-readline/readline.c (scm_readline_opts): Add bracketed-paste.
  (scm_init_readline): Wire up the logic.
2017-05-17 22:29:08 +02:00
Zefram
fc84f4f13d Correct note about Gregorian reform in SRFI-19
* doc/ref/srfi-modules.texi (SRFI-19): SRFI-19 specifies proleptic use
of the Gregorian calendar, so it was incorrect of the documentation to
describe the code as erroneous in doing so.  Rewrite the caution more
neutrally, and move it to the section about the "date" structure, where
it seems most relevant.
2017-04-25 09:41:03 +02:00
Sergei Trofimovich
e0933b5636 api-procedures.texi: typo: 'an' -> 'on'
* doc/ref/api-procedures.texi: Fix typo.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-04-19 17:16:21 +02:00
Sergei Trofimovich
410bb56d23 Documentation typo tweak
* doc/ref/api-data.texi: Tweak 'u+0007' to 'U+0007' (as in the rest of
  the table).

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-04-19 17:15:56 +02:00
Andy Wingo
93b2bfd822 Document guile-2.2 cond-expand feature.
* doc/ref/srfi-modules.texi (SRFI-0): Mention guile-2.2 feature.
2017-04-19 16:23:14 +02:00
Andy Wingo
0aa0281979 Fix typo in fold-layout documentation
* doc/ref/sxml.texi (SXML Tree Fold): Fix minor typo.  Fixes
  https://bugs.gnu.org/26188.
2017-04-19 15:56:47 +02:00
Andy Wingo
7c71be0c7e Add sandboxed evaluation facility
* module/ice-9/sandbox.scm: New file.
* module/Makefile.am (SOURCES): Add new file.
* doc/ref/api-evaluation.texi (Sandboxed Evaluation): New section.
* NEWS: Update.
* test-suite/tests/sandbox.test: New file.
* test-suite/Makefile.am: Add new file.
2017-04-18 21:27:45 +02:00
Andy Wingo
ce934bcd43 Add allow-legacy-syntax-objects? parameter
* module/ice-9/psyntax.scm (syntax?): Only recognize legacy syntax
  objects if the new allow-legacy-syntax-objects? parameter is true.
* module/ice-9/boot-9.scm (allow-legacy-syntax-objects?): New
  parameter.
* doc/ref/api-macros.texi (Syntax Transformer Helpers): Document the
  horrible situation with legacy syntax objects.
* NEWS: Add entry.
2017-03-28 21:27:11 +02:00
Andy Wingo
6d0091d545 Revert "Fix "Scheme Syntax" info rendering"
This reverts commit 62f08b8f38, which was
causing failing texi2dvi runs.
2017-03-10 12:02:44 +01:00
Vladislav Ivanishin
ef4a2af803 Fix a couple of typos in the docs
* doc/ref/scheme-ideas.texi: the some way -> the same way
* doc/ref/scheme-intro.texi: Use @math inside a texinfo command (turns out
  $math$ is not processed in this context and thus is not rendered correctly).
2017-03-09 21:56:03 +01:00
Andy Wingo
c525aa6d95 VM support for string-set!; slimmer read-string
* doc/ref/vm.texi (Inlined Scheme Instructions): Add string-set!.
* libguile/vm-engine.c (string-set!): New opcode.
* module/ice-9/rdelim.scm (read-string): Reimplement in terms of a
  geometrically growing list of strings, to reduce total heap usage when
  reading big files.
* module/language/cps/compile-bytecode.scm (compile-function): Add
  string-set! support.
* module/language/cps/types.scm (string-set!): Update for &u64 index.
* module/language/tree-il/compile-cps.scm (convert): Unbox index to
  string-set!.
* module/system/vm/assembler.scm (system): Export string-set!.
2017-03-09 17:24:06 +01:00
Andy Wingo
1e51ffa634 Fix documentation build
* doc/ref/api-control.texi (Fluids and Dynamic States): Fix link.
2017-03-07 21:34:01 +01:00
Andy Wingo
fb8c91a35c Add thread local fluids
* libguile/fluids.h (struct scm_dynamic_state): Add thread_local_values
  table.  Thread locals are flushed to a separate thread-local table.
  The references are strong references since the table never escapes the
  thread.
  (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
  functions.
* libguile/fluids.c (FLUID_F_THREAD_LOCAL):
  (SCM_I_FLUID_THREAD_LOCAL_P): New macros.
  (restore_dynamic_state): Add comment about precondition.
  (save_dynamic_state): Flush thread locals.
  (scm_i_fluid_print): Print thread locals nicely.
  (new_fluid): Add flags arg.
  (scm_make_fluid, scm_make_fluid_with_default, scm_make_unbound_fluid):
  Adapt.
  (scm_make_thread_local_fluid, scm_fluid_thread_local_p): New
  functions.
  (fluid_set_x): Special flushing logic for thread-locals.
  (fluid_ref): Special cache miss logic for thread locals.
* libguile/stacks.c (scm_init_stacks):
* libguile/throw.c (scm_init_throw): %stacks and %exception-handler are
  thread-locals.
* libguile/threads.c (guilify_self_2): Init thread locals table.
* test-suite/tests/fluids.test ("dynamic states"): Add test.
* doc/ref/api-control.texi (Fluids and Dynamic States): Add link to
  Thread-Local Variables.
* doc/ref/api-scheduling.texi (Thread Local Variables): Update with real
  thread-locals.
* NEWS: Update.
2017-03-07 21:15:39 +01:00
Mike Gran
70cfabd7e8 Check for working profiling and virtual itimers
* configure.ac (HAVE_USABLE_GETITIMER_PROF, HAVE_USABLE_GETITIMER_VIRTUAL): new tests
* doc/ref/posix.texi (setitimer, getitimer): document provided? 'ITIMER_VIRTUAL and 'ITIMER_PROF
* doc/ref/statprof.texi (statprof): document ITIMER_PROF requirements
* libguile/scmsigs.c (scm_setitimer, scm_getitimer): document (provided? 'ITIMER_VIRTUAL) and (provided? 'ITIMER_PROF)
  (scm_init_scmsigs): add features ITIMER_VIRTUAL and ITIMER_PROF
* test-suite/tests/asyncs.test ("prevention via sigprof"): throw when unsupported
* test-suite/tests/signals.test: throw when not supported
* test-suite/tests/statprof.test: throw when not supported
2017-03-06 23:06:12 -08:00
Mike Gran
4ce31fd387 Can't recursively search DLLs with FFI on Cygwin
* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs.
* test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly
* test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly
* test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly
2017-03-05 12:45:54 -08:00
Andy Wingo
f2db8fc2f5 Fix makeinfo warnings
* doc/ref/api-languages.texi (Nil):
* doc/ref/statprof.texi (Statprof): Use headings instead of sections to
  avoid makeinfo warnings.
2017-03-01 21:49:47 +01:00
Andy Wingo
c896af55d4 Remove useless subsection from hooks documentation
* doc/ref/api-utility.texi (Hook Reference): Remove useless "handling
  hooks from C" section that was also generating warnings.
2017-03-01 21:45:14 +01:00
Andy Wingo
c2ab4a3b22 Fix scheme-scripts markup.
* doc/ref/scheme-scripts.texi (Scripting Examples): Fix $@ rendering in
  texinfo.
2017-03-01 21:44:53 +01:00
Arne Babenhauserheide
1026a76830 doc: Describe -e (module) on equal footing with (@ ...).
* doc/ref/guile-invoke.texi, doc/ref/scheme-scripts.texi:
describe the -e (module) shorthand as on equal footing with (@ ...)

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2017-03-01 21:17:44 +01:00
Ludovic Courtès
de5cf50aba i18n: 'number->locale-string' guesses the minimum number of decimals.
This feature was removed by 4aead68cdb.

* module/ice-9/i18n.scm (number-decimal-string): Rewrite the case where
DIGIT-COUNT is not an integer.
(number->locale-string): Always pass FRACTION-DIGITS to
'number-decimal-string'.
* test-suite/tests/format.test ("~h localized number")["1234.5"]
["padding", "padchar"]: Remove decimal specifier.
* test-suite/tests/i18n.test ("number->locale-string")
["fraction",
* test-suite/tests/i18n.test ("format ~h")["12 345,678"]: Remove decimal
specifier.  Remove one decimal.
* doc/ref/api-i18n.texi (Number Input and Output): Update
'number->locale-string' doc to mention the number of decimals.
2017-03-01 21:16:49 +01:00
Georgi Kirilov
7c5f38fe6d doc: Fix typo in site packages documentation.
* doc/ref/scheme-using.texi (Installing Site Packages): Fix typo

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-03-01 21:04:21 +01:00
Georgi Kirilov
a4fbc5b091 doc: Fix typo in keywords documentation.
* doc/ref/api-data.texi (Keyword Read Syntax): Fix typo

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2017-03-01 21:02:24 +01:00
Mark H Weaver
402162cfcf REPL Server: Guard against HTTP inter-protocol exploitation attacks.
Reported by Christopher Allan Webber <cwebber@dustycloud.org>
Co-authored-by: Ludovic Courtès <ludo@gnu.org>

This commit adds protection to Guile's REPL servers against HTTP
inter-protocol exploitation attacks, a scenario whereby an attacker can,
via an HTML page, cause a web browser to send data to TCP servers
listening on a loopback interface or private network.  See
<https://en.wikipedia.org/wiki/Inter-protocol_exploitation> and
<https://www.jochentopf.com/hfpa/hfpa.pdf>, The HTML Form Protocol
Attack (2001) by Tochen Topf <jochen@remote.org>.

Here we add a procedure to 'before-read-hook' that looks for a possible
HTTP request-line in the first line of input from the client socket.  If
present, the socket is drained and closed, and a loud warning is written
to stderr (POSIX file descriptor 2).

* module/system/repl/server.scm: Add 'maybe-check-for-http-request'
to 'before-read-hook' when this module is loaded.
(with-temporary-port-encoding, with-saved-port-line+column)
(drain-input-and-close, permissive-http-request-line?)
(check-for-http-request, guard-against-http-request)
(maybe-check-for-http-request): New procedures.
(serve-client): Use 'guard-against-http-request'.
* module/system/repl/coop-server.scm (start-repl-client): Use
'guard-against-http-request'.
* doc/ref/guile-invoke.texi (Command-line Options): In the description
of the --listen option, make the security warning more prominent.
Mention the new protection added here.  Recommend using UNIX domain
sockets for REPL servers.  "a path to" => "the file name of".
2017-03-01 20:13:13 +01:00
Ludovic Courtès
1107db3eb1 Document 'scm_to_uintptr_t' and 'scm_from_uintptr_t'.
* doc/ref/api-data.texi (Integers): Document them.
2017-03-01 19:56:55 +01:00
Ludovic Courtès
844b2cf758 Remove 'umask' calls from 'mkdir'.
Fixes <http://bugs.gnu.org/24659>.

* libguile/filesys.c (SCM_DEFINE): Remove calls to 'umask' when MODE is
unbound; instead, use 0777 as the mode.  Update docstring to clarify
this.
* doc/ref/posix.texi (File System): Adjust accordingly.
* NEWS: Mention it.
2017-03-01 19:54:31 +01:00
Andy Wingo
24eea1be08 "select" no longer throws exception on EINTR
* doc/ref/posix.texi (Ports and File Descriptors): Update.
* libguile/filesys.c (scm_select): Use scm_std_select so that pending
  interrupts can be delivered.  On EINTR or EAGAIN, just return directly
  so that calling Scheme code can run asyncs.
2017-03-01 17:27:56 +01:00