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

188 commits

Author SHA1 Message Date
Andy Wingo
86a9f9a271 Optionally allow duplicate field names in core records
* NEWS: Update.
* doc/ref/api-data.texi (Records): Update docs.
* module/ice-9/boot-9.scm (make-record-type): Add
  #:allow-duplicate-field-names? keyword argument.
  (record-accessor, record-modifier): Allow passing indexes to identify
  fields.
* module/rnrs/records/procedural.scm (make-record-type-descriptor):
  Allow duplicate field names.  Fixes #38611.
2020-01-12 21:51:22 +01:00
Daniel Llorens
6cfee36543 New function string-replace-substring in (ice-9 string-fun)
By A. Wingo in
https://lists.gnu.org/archive/html/guile-devel/2014-03/msg00058.html.

* module/ice-9/string-fun.scm (string-replace-substring): As stated.
* doc/ref/api-data.texi: Document the new function.
* test-suite/tests/strings.test: Test.
2020-01-06 09:44:01 +01:00
Andy Wingo
4b2c512b94 Update NEWS for records and exceptions work
* NEWS: Update.
* doc/ref/api-data.texi (Records): Fix a typo.
2019-11-14 21:37:00 +01:00
Andy Wingo
315fabdfe7 Add support for immutable fields in core records
* module/ice-9/boot-9.scm (make-record-type): Allow (mutable NAME)
  or (immutable NAME) as a field name, and record field mutability in a
  bitfield.
  (record-modifier): Throw an error if the field isn't mutable.
* test-suite/tests/records.test ("records"): Add tests.
* doc/ref/api-data.texi (Records): Update.
2019-10-28 16:59:58 +01:00
Andy Wingo
f963bdf02d Rename final? record type flag; add support for opaque?
* module/ice-9/boot-9.scm (record-type-extensible?): Rename from
  record-type-final?, with the opposite sense.
  (record-type-opaque?): New accessor.
  (make-record-type): Change #:final? to #:extensible?, with the
  opposite meaning.  Add #:opaque? arg.
* test-suite/tests/records.test ("records"): Add opaque tests; update
  extensible tests.
* doc/ref/api-data.texi (Records): Update.
* module/srfi/srfi-35.scm (&condition, make-condition-type): Update for
  make-record-type API change.
2019-10-27 21:31:18 +01:00
Andy Wingo
7a8e314d31 Guile `make-record-type' supports non-generative definition
* module/ice-9/boot-9.scm (prefab-record-types): New definition.
  (make-record-type): Add #:uid keyword.
* test-suite/tests/records.test ("records"): Add tests.
* doc/ref/api-data.texi (Records): Document #:uid
2019-10-27 20:55:01 +01:00
Andy Wingo
f060f1a4e6 Record accessors respect subtyping
* module/ice-9/boot-9.scm (make-record-type): Don't allow subtyping of
  final types.
  (%record-type-error): Remove helper.
  (record-accessor, record-modifier): Use computed record type
  predicate, to allow for subtyping.
  (define-record-type): Adapt to %record-type-error going away; these
  types are final so no accessor adaptation is needed.
* test-suite/tests/records.test: Add tests.
* doc/ref/api-data.texi (Records): Update.
2019-10-22 16:22:48 +02:00
Ludovic Courtès
4024a5beb3 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-08-07 11:40:22 +02:00
Andy Wingo
f85d3c0bd8 Merge until e0bcda4ad9 from stable-2.2 2017-11-29 21:04:59 +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
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
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
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
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
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
Diogo F. S. Ramos
f8dd4f67b5 Explain why no native accessors for s8' and u8' exist
* doc/ref/api-data.texi: Instead of saying it is obvious, explain why
  no native endianness accessors exist for the `s8' and `u8' variants.
2017-02-27 21:32:59 +01:00
Daniel Llorens
7e93950552 Final names for new array functions
Globally rename (array-from* -> array-slice), (array-from ->
array-cell-ref), (array-amend! -> array-cell-set!), (array-for-each-cell
-> array-slice-for-each).
2017-01-09 09:02:04 +01:00
Daniel Llorens
0bd7562c96 Document new array functions, with provisional names
* doc/ref/api-data.texi: New section 'Arrays as arrays of
  arrays'. Document array-from, array-from*, array-amend!,
  array-for-each-cell, array-for-each-cell-in-order.
2016-11-23 13:05:18 +01:00
Andy Wingo
8b5f323330 Merge api-{data,compound}.texi
* doc/ref/api-compound.texi: Remove.
* doc/ref/api-data.texi: Fold "Compound Data Types" and "Simple Data
  Types" into just "Data Types".  The distinction didn't work.
* doc/ref/guile.texi:
* doc/ref/Makefile.am:
* doc/ref/srfi-modules.texi: Adapt.
2016-11-22 23:11:37 +01:00
Ethan Stefan Day
96d3cb3fcf Documentation fixes
* doc/ref/api-compound.texi:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi: Fix typos and clarify.
2016-08-07 23:40:16 +02:00
Andy Wingo
cab7167849 Fix typo about `keywords' read option
* doc/ref/api-data.texi (Keyword Read Syntax): Fix typo.  Thanks to
  Glenn Michaels for the report and fix.
2016-06-24 09:55:28 +02:00
Andy Wingo
a21f6467ac Big ports documentation update
* doc/ref/api-io.texi: Update to document ports more thoroughly.  Still
  some work needed.

* doc/ref/r6rs.texi: Move ports documentation back to r6rs.texi, now
  that Guile has a more thorough binary/textual I/O story, heavily based
  on R6RS.

* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-options.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/srfi-modules.texi: Update references.
2016-06-08 10:19:27 +02:00
Mark H Weaver
e390e5760b Implement 'string-utf8-length' and 'scm_c_string_utf8_length'.
* libguile/strings.c (utf8_length, scm_c_string_utf8_length)
  (scm_string_utf8_length): New functions.
* libguile/strings.h (scm_c_string_utf8_length, scm_string_utf8_length):
  New prototypes.
* doc/ref/api-data.texi (Bytevectors as Strings): Add docs.
* doc/ref/guile.texi: Update manual copyright date to 2015.
* test-suite/tests/strings.test (string-utf8-length): Add tests.
2016-05-22 19:03:37 +02:00
Andy Wingo
678995ff79 Merge commit '5af307de43'
Conflicts:
	test-suite/tests/reader.test
2015-01-22 12:50:18 +01:00
Mark H Weaver
5af307de43 read: Accept "\(" in string literals.
Suggested by David Kastrup <dak@gnu.org> in <http://bugs.gnu.org/13644>.

* libguile/read.c (scm_read_string_like_syntax): Accept "\(" as
  equivalent to "(".
* doc/ref/api-data.texi (String Syntax): Document it.
* test-suite/tests/reader.test ("reading"): Add test.
2014-10-01 21:00:23 -04:00
Andy Wingo
3157d45503 Add (ice-9 unicode) module
* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

* doc/ref/api-data.texi: Add docs.
2014-09-29 21:54:14 -04:00
Andy Wingo
c5ea75534c Add (ice-9 unicode) module
* libguile/unicode.c:
* libguile/unicode.h:
* test-suite/tests/unicode.test:
* module/ice-9/unicode.scm: New files.

* module/Makefile.am:
* libguile/Makefile.am:
* test-suite/Makefile.am:
* libguile/init.c: Wire new files into the build.

* doc/ref/api-data.texi: Add docs.
2014-09-12 17:00:59 +02:00
Mark H Weaver
475772ea57 Merge branch 'stable-2.0'
Conflicts:
	GUILE-VERSION
	NEWS
	guile-readline/ice-9/readline.scm
	libguile/async.c
	libguile/backtrace.c
	libguile/deprecated.h
	libguile/gc-malloc.c
	libguile/gdbint.c
	libguile/init.c
	libguile/ioext.c
	libguile/mallocs.c
	libguile/print.c
	libguile/rw.c
	libguile/scmsigs.c
	libguile/script.c
	libguile/simpos.c
	libguile/snarf.h
	libguile/strports.c
	libguile/threads.c
	libguile/vm-i-scheme.c
	libguile/vm-i-system.c
	module/srfi/srfi-18.scm
	test-suite/Makefile.am
	test-suite/standalone/test-num2integral.c
2014-04-25 02:06:01 -04:00
Mark H Weaver
580ef7fcf4 Documentation tweaks for the 'r7rs-symbols' read/print options.
* doc/ref/api-data.texi (Symbol Read Syntax): Mention the 'r7rs-symbols'
  print option, and provide example code to enable both the read and
  print options.  Add 'r7rs-symbols' to the concept index.
2014-03-17 02:40:23 -04:00
Andy Wingo
c2379a5b45 Doc and NEWS updates
* NEWS: Update section on dynamic stacks.  Add link for intptr
  interfaces.
* doc/ref/api-data.texi (Integers): Add intptr interfaces.
2014-03-16 16:28:28 +01:00
Mark H Weaver
c92ee2b38c Merge branch 'stable-2.0'
Conflicts:
	libguile/print.c
	libguile/read.c
	test-suite/tests/print.test
2014-01-14 22:23:39 -05:00
Mark H Weaver
dc59631d30 read: Support R7RS |...| symbol notation.
* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro.
  (SCM_N_READ_OPTIONS): Increment.

* libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'.
  (t_read_opts): Add field for 'r7rs_symbols_p'.
  (scm_read_string_like_syntax): New function based on earlier
  'scm_read_string' that handles either string literals or R7RS quoted
  symbols (delimited by vertical bars), depending on the value of 'chr'.
  (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'.
  (scm_read_r7rs_symbol): New static function.

* doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS
  symbol syntax, mention the 'r7rs-symbols' read option, and give some
  examples.

* doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols'
  read option.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 20:23:21 -05:00
Mark H Weaver
cb8aaef4d0 Merge branch 'stable-2.0'
Conflicts:
	libguile/chars.c
	libguile/read.c
	test-suite/tests/reader.test
2014-01-14 03:18:34 -05:00
Mark H Weaver
394449d5d3 Recognize 'escape' character name, per R7RS.
* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums):
  New static constants.
  (SCM_N_R7RS_CHARNAMES): New macro.
  (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS
  char names.

* doc/ref/api-data.texi (Characters): Document #\escape.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:44 -05:00
Mark H Weaver
6579c3308d read: Accept "\|" in string literals.
* libguile/read.c (scm_read_string): Accept "\|" in string literals.

* doc/ref/api-data.texi (String Syntax): Add "\|" to the list of
  supported backslash escapes.

* test-suite/tests/reader.test ("reading"): Add test.
2014-01-14 02:24:37 -05:00
Mark H Weaver
7a329029cf read: Support R7RS '#true' and '#false' syntax for booleans.
* libguile/read.c (try_read_ci_chars): New static function.
  (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'.

* doc/ref/api-data.texi (Booleans): Update docs.

* test-suite/tests/reader.test ("reading"): Add tests.
2014-01-14 02:24:24 -05:00
Mark H Weaver
1df515a077 Merge branch 'stable-2.0'
Conflicts:
	module/system/vm/traps.scm
	test-suite/tests/peval.test
2014-01-09 02:52:34 -05:00
Mark H Weaver
900a897cd3 Implement 'exact-integer?' and 'scm_is_exact_integer'.
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
  New procedures.
  (scm_integer_p): Improve docstring.

* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
  New prototypes.

* doc/ref/api-data.texi (Integers): Add docs.

* test-suite/tests/numbers.test ("exact-integer?"): Add tests.
2014-01-08 21:42:16 -05:00
Mark H Weaver
f659df4495 Fix doc that incorrectly claimed (integer? +inf.0) => #t.
Fixes <http://bugs.gnu.org/16356>.
Reported by Zefram <zefram@fysh.org>.

* doc/ref/api-data.texi (Integers): Add docs.  Fix outdated example
  that incorrectly showed (integer? +inf.0) => #t.
2014-01-08 21:41:37 -05:00
Mark H Weaver
f6f4feb0a2 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	GUILE-VERSION
	libguile/array-map.c
	libguile/fports.h
	libguile/gc.h
	libguile/inline.h
	libguile/ports.c
	libguile/ports.h
	libguile/print.c
	libguile/r6rs-ports.c
	libguile/read.c
	test-suite/tests/00-socket.test
2013-04-14 02:48:33 -04:00
Mark H Weaver
a71e79c3e5 Fix the recommendations for conversion of C string constants.
* doc/ref/api-data.texi (Conversion to/from C, Symbol Primitives,
  Keyword Procedures): Fix the recommendations for conversion of C
  string constants.  The encoding of the source code is irrelevant in
  modern compilers.  What is relevant is the execution character set.
  Both GCC and clang use UTF-8 by default, so recommend the
  'scm_from_utf8_*' functions when the argument is a C string constant.

  Also fix the broken texinfo markup for 'scm_from_*_symbol' that
  prevented them from being listed in the index.
2013-04-06 18:37:29 -04:00
Mark H Weaver
a16d4e82e9 Implement 'scm_c_bind_keyword_arguments'.
* libguile/keywords.c (scm_keyword_argument_error): New variable.
  (scm_c_bind_keyword_arguments): New API function.

* libguile/keywords.h (enum scm_keyword_arguments_flags): New enum.
  (scm_t_keyword_arguments_flags): New typedef.
  (scm_c_bind_keyword_arguments): New prototype.

* doc/ref/api-data.texi (Coding With Keywords, Keyword Procedures): Add
  documentation.

* test-suite/standalone/test-scm-c-bind-keyword-arguments.c: New file.

* test-suite/standalone/Makefile.am: Add
  test-scm-c-bind-keyword-arguments test.
2013-04-06 18:09:45 -04:00
Mark H Weaver
369294866d Fix broken texinfo markup in (ice-9 iconv) docs.
* doc/ref/api-data.texi (Representing Strings as Bytes): Fix broken
  @deffn syntax.
2013-04-01 12:35:24 -04:00
Mark H Weaver
1e05106562 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/r6rs-ports.c
2013-04-01 05:42:31 -04:00
Mark H Weaver
3b80c35852 Fix typos in 'string-join' docs: 'string-infix' -> 'strict-infix'.
* doc/ref/api-data.texi (String Constructors): In definition of
  'string-join', change 'string-infix' -> 'strict-infix'.

* libguile/srfi-13.c (scm_string_join): In docstring, change
  'string-infix' -> 'strict-infix'.
2013-04-01 01:21:30 -04:00