1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-11 00:00:49 +02:00
Commit graph

20154 commits

Author SHA1 Message Date
Andy Wingo
87c3ef2f95 peg: helper macro docstrings
* module/ice-9/peg.scm: Convert the helper macro comments into
  docstrings.
2013-01-16 10:11:37 +01:00
Andy Wingo
09a6a7a44a peg: module-ref cleanup
* module/ice-9/peg.scm (cg-generic-ret, cg-and-int, cg-body-test):
  Remove a few needless @ or @@ forms.
2013-01-16 10:11:37 +01:00
Andy Wingo
49db248111 peg: remove get-code debugging foo
* module/ice-9/peg.scm (define-nonterm): Don't stash the code in a
  symbol property.
  (get-code): Remove.
2013-01-16 10:11:37 +01:00
Andy Wingo
a907bce657 peg: more syntax helper cleanup
* module/ice-9/peg.scm (single-filter, push-not-null!): Use
  syntax-rules, and move outside the eval-when.
2013-01-16 10:11:36 +01:00
Andy Wingo
bb7ff21a77 peg: else for default cond clauses, not #t
* module/ice-9/peg.scm: Change default cases of `cond' to use `else'
  instead of #t.
2013-01-16 10:11:36 +01:00
Andy Wingo
b5ebb8abad peg; syntax helper cleanups
* module/ice-9/peg.scm (until, single?, push!): Move outside the
  eval-when.  Use syntax-rules, and single? is faster now.
2013-01-16 10:11:35 +01:00
Andy Wingo
3c8963de27 peg: cleanups
* module/ice-9/peg.scm (until): Rename from until-works, and be
  functional (and faster).
  (peg-match): Adapt.
2013-01-16 10:11:35 +01:00
Andy Wingo
0d2f21fc81 peg: define-module cleanup
* module/ice-9/peg.scm: Fix up define-module block.
2013-01-16 10:11:35 +01:00
Noah Lavine
9ca71e7b84 peg: let cleanups
* module/ice-9/peg.scm (cg-string, cg-peg-any, cg-range): Remove some
  unnecessary lets.
2013-01-16 10:11:34 +01:00
Noah Lavine
18905baf6e peg: remove unhygienic safe-bind, safe-bind-f
* module/ice-9/peg.scm (safe-bind, safe-bind-f): Remove.
2013-01-16 10:11:34 +01:00
Noah Lavine
ac8a071390 peg: remove unused nonhygienic expander helpers
* module/ice-9/peg.scm (cggl, cggr): Remove, and rename the cggl-syn and
  cggr-syn to take their place.
2013-01-16 10:11:33 +01:00
Noah Lavine
84cb143eb4 peg: more helpers returning syntax
* module/ice-9/peg.scm (cg-body, cg-body-success, cg-body-more)
  (cg-body-ret): Return syntax instead of s-expressions.
2013-01-16 10:11:33 +01:00
Noah Lavine
8e8de46ec6 peg: cg-or, cg-or-int return syntax
* module/ice-9/peg.scm (cg-or, cg-or-int): Return syntax instead of
  s-expressions.
  (peg-sexp-compile): Adapt.
2013-01-16 10:11:33 +01:00
Noah Lavine
00e227f779 peg: hygiene in cg-and, cg-and-int
* module/ice-9/peg.scm (cg-and, cg-and-int): Use cggr-syn instead of
  cggr, and also return syntax now instead of s-expressions.
2013-01-16 10:11:32 +01:00
Noah Lavine
8b52357e88 peg: hygiene in cg-range
* module/ice-9/peg.scm (cg-range): Use cggl-syn and cggr-syn.
2013-01-16 10:11:32 +01:00
Noah Lavine
febe6dadab peg: hygiene in cg-peg-any
* module/ice-9/peg.scm (cg-peg-any): Use cggl-syn and cggr-syn.
2013-01-16 10:11:31 +01:00
Noah Lavine
6f6c7d15a2 peg: more hygiene in cg-string
* module/ice-9/peg.scm (cggl-syn, cggr-syn): New functions, equivalent
  to cggl and cggr except that they operate on syntax instead of
  s-expressions.
  (cg-string): Use them here.
2013-01-16 10:11:31 +01:00
Noah Lavine
0b61da75fe peg: lower datum->syntax in cg-range case
* module/ice-9/peg.scm (cg-range): Datum->syntax here...
  (peg-sexp-compile): ...instead of here.
2013-01-16 10:11:31 +01:00
Noah Lavine
6a297af101 peg: lower datum->syntax in cg-peg-any case
* module/ice-9/peg.scm (cg-peg-any): Datum->syntax here...
  (peg-sexp-compile): ...instead of here.
2013-01-16 10:11:30 +01:00
Noah Lavine
b987677437 peg: lower datum->syntax in cg-string case
* module/ice-9/peg.scm (cg-string): Return syntax instead of
  s-expressions.
  (peg-sexp-compile): No need for datum->string in cg-string case.
2013-01-16 10:11:30 +01:00
Noah Lavine
2a88fe3046 peg: peg-sexp-compile datum->syntax refactor
* module/ice-9/peg.scm (peg-sexp-compile): Push datum->syntax call
  through cond expression in peg-sexp-compile. This is a preliminary
  move so that I can convert the code-generating functions into
  syntax-generating functions one by one.
2013-01-16 10:11:29 +01:00
Noah Lavine
fe50d7ee1a peg: compilers return syntax instead of s-expressions
* module/ice-9/peg.scm (peg-sexp-compile, peg-string-compile): Return
  syntax instead of s-expressions.
2013-01-16 10:11:29 +01:00
Noah Lavine
ccab173a5b peg: beginnings of hygiene
* module/ice-9/peg.scm: Pass for-syntax argument to all of the
  code-generating functions.
2013-01-16 10:11:29 +01:00
Noah Lavine
c9a6f4befa peg: more syntax-for-non-cache-case cleanups
* module/ice-9/peg.scm (syntax-for-non-cache-case): More cleanups.
2013-01-16 10:11:28 +01:00
Noah Lavine
8b38945119 peg: clean up syntax-for-non-cache-case
* module/ice-9/peg.scm (syntax-for-non-cache-case): Cleanups.
2013-01-16 10:11:28 +01:00
Noah Lavine
bce6e5d3f2 peg: use quasisyntax instead of safe-bind
* module/ice-9/peg.scm (syntax-for-non-cache-case): Use quasisyntax
  instead of safe-bind.
2013-01-16 10:11:27 +01:00
Noah Lavine
c011c0b6ef peg: define-nonterm returns syntax instead of s-expression
* module/ice-9/peg.scm (define-nonterm, syntax-for-non-cache-case):
  Returns syntax instead of an s-expression.
2013-01-16 10:11:27 +01:00
Noah Lavine
f4576d8161 peg: split define-nonterm into two functions for better readability.
* module/ice-9/peg.scm (define-nonterm): Split for readability.
2013-01-16 10:11:27 +01:00
Andy Wingo
add20d35be peg: add copyright header
* module/ice-9/peg.scm: Add copyright header.
2013-01-16 10:11:26 +01:00
Andy Wingo
eee0877c3e add PEG parser generator
* module/ice-9/peg.scm: New file.
* module/Makefile.am: Add to build.

* doc/ref/Makefile.am:
* doc/ref/api-peg.texi:
* doc/ref/guile.texi: Add documentation for PEG parser.

* test-suite/Makefile.am:
* test-suite/tests/peg.bench:
* test-suite/tests/peg.test: Add tests, and a benchmark.
2013-01-16 10:11:15 +01:00
Andy Wingo
58c4a39d98 an end to the generated-documentation experiment
* doc/ref/statprof.texi:
* doc/ref/sxml.texi:
* doc/ref/texinfo.texi: New files, containing the documentation that was
  previously generated from source and rendered into
  standard-library.texi.  The documentation is still horrible, but at
  least now it is user-editable.
2013-01-16 10:03:44 +01:00
Andy Wingo
2f0db5ee96 update make-struct docstring
* libguile/struct.c (scm_make_struct): Remove reference to deprecated
  make-vtable-vtable.
2013-01-16 09:17:35 +01:00
Greg Benison
5156f4d745 doc/ref/hierarchy.png: conform to hierarchy.txt and manual
hierarchy.png (and .pdf, .eps) were changed to add one node
to the graph, getting them in sync with hierarchy.txt
(and the GOOPS section of the manual).

Also added hierarchy.dot, a file to generate said figure
using graphviz.
2013-01-15 19:17:55 +01:00
Andy Wingo
e211d69d9d fix string->bytevector for utf-8 and non-error conversion strategies
* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Only call string->utf8 and
  utf8->string if the conversion strategy is `error'.
2013-01-15 16:41:20 +01:00
Andy Wingo
449ca87bdb ASCII is not ISO-8859-1
* libguile/ports.c (scm_i_set_default_port_encoding): An encoding of
  ASCII is not the same as ISO-8859-1, because it does not allow
  characters above 128.  Fix this.
2013-01-15 16:37:01 +01:00
Andy Wingo
e5cef86e9c fix string->bytevector for utf-8 and non-error conversion strategies
* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Only call string->utf8 and
  utf8->string if the conversion strategy is `error'.
2013-01-15 16:37:01 +01:00
Andy Wingo
686df5162d string->utf8 implementation uses scm_from_utf8_stringn
* libguile/bytevectors.c (UTF_TO_STRING): Use scm_from_utf8_stringn.
2013-01-15 16:36:55 +01:00
Andy Wingo
b39685c6da scm_from_stringn and scm_to_stringn encoding args are never NULL
* libguile/strings.c (scm_from_stringn, scm_to_stringn): Encoding
  argument cannot be NULL.  Instead check that the encoding was
  ISO-8859-1.
2013-01-15 16:32:52 +01:00
Andy Wingo
d1b9f8ace9 Port encodings cannot be NULL
* libguile/ports.c (scm_c_read_unlocked, scm_ungetc_unlocked):
* libguile/read.c (scm_read_character):
* libguile/vports.c (sf_fill_input): Port encodings cannot be NULL any
  more, now that encodings are canonicalized, so simplify these.
2013-01-15 16:32:52 +01:00
Andy Wingo
e2551947dd All r6rs ports are both textual and binary
* module/rnrs/io/ports.scm (binary-port?): All ports are binary _and_
  textual.  Bytevectors and strings may be written to or read from
  either.
  (port-transcoder): All textual ports (all ports) have transcoders of
  some sort.

* test-suite/tests/r6rs-ports.test ("8.2.6  Input and output ports"):
  Remove test that binary ports don't have transcoders, because binary
  ports are also textual.
2013-01-15 16:32:52 +01:00
Andy Wingo
93c4fa2174 Port encodings are case-insensitive, but normalized to upper-case.
* libguile/ports.c (ascii_toupper, encoding_matches)
  (canonicalize_encoding): New helpers.

  (scm_c_make_port_with_encoding):
  (scm_i_set_default_port_encoding):
  (scm_i_set_port_encoding_x): Use the new helpers to be
  case-insensitive and also to canonicalize the internal representation
  to upper-case ASCII names.

  (scm_i_default_port_encoding): Never return NULL.
  (scm_port_encoding): The encoding is always a string.

* libguile/read.c (scm_i_scan_for_encoding): Use a locale-independent
  check instead of isalnum.  Don't upcase the result: the port code will
  handle that.

* test-suite/tests/web-response.test ("example-1"): Adapt test to expect
  normalized (upper-case) encoding for the response port.
2013-01-15 16:32:17 +01:00
Andy Wingo
08467a7e61 add scm_from_port_string and friends
* doc/ref/api-data.texi (Conversion to/from C):
* libguile/strings.h:
* libguile/strings.c (scm_from_port_string, scm_from_port_stringn):
  (scm_to_port_string, scm_to_port_stringn): New functions.

* guile-readline/readline.c (internal_readline):
* libguile/strports.c (scm_strport_to_string):
* libguile/read.c (scm_read_number, scm_read_mixed_case_symbol):
  (scm_read_number_and_radix, scm_read_character): Use the new
  functions.
2013-01-15 16:32:17 +01:00
Andy Wingo
99d716b6f6 UTF-8 string ports in ecmascript test
* test-suite/tests/ecmascript.test (eread, eread/1): Make sure we can
  render the temporary string ports by specifying UTF-8.
2013-01-15 16:32:17 +01:00
Andy Wingo
8c76a8971b fix bug where scm_from_utf8_stringn would not detect bad utf-8
* libguile/strings.c (scm_from_utf8_stringn):
* libguile/symbols.c (utf8_string_equals_wide_string): The "bad UTF8"
  return from u8_mbtouc is a 0xfffd character, not a negative byte
  length.  Fixes a bug in which invalid UTF-8 would not be caught.

* libguile/bytevectors.c (scm_utf8_to_string): Use scm_from_utf8_stringn
  directly.  Just a little cleanup.

* test-suite/tests/iconv.test ("narrow non-ascii string"): Add test for
  parsing bad utf-8 with substitution.
2013-01-15 11:01:10 +01:00
Andy Wingo
b4fa6cc909 Merge remote-tracking branch 'origin/stable-2.0'
There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.

Conflicts:
	libguile/deprecated.h
	module/ice-9/deprecated.scm
2013-01-15 10:45:39 +01:00
pcpa
39afbe1c40 Correct off by one label/note name and add align argument to jit_data
2013-01-14 Paulo Andrade <pcpa@gnu.org>

	* include/lightning.h, lib/lightning.c: Add an extra align
	argument to the jit_data call (that should be made private),
	so that it should not align strings at 8 bytes.
	  Correct the jit_note call to include the null ending byte
	when adding label/note names to the "jit data section".
2013-01-14 14:43:54 -02:00
Andy Wingo
581f410fbd case-lambda* clauses fail to match if too many positionals
* doc/ref/api-procedures.texi (Case-lambda): Expand case-lambda*
  documentation.

* module/ice-9/eval.scm (primitive-eval):
* libguile/eval.c (prepare_boot_closure_env_for_apply): Dispatch to the
  next case-lambda clause if there are too many positionals.

* doc/ref/vm.texi (Function Prologue Instructions):
* libguile/vm-i-system.c (bind-optionals/shuffle-or-br): New
  instruction, like bind-optionals/shuffle but can dispatch to the next
  clause if there are too many positionals.

* module/language/assembly/disassemble.scm (code-annotation):
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
* module/language/assembly/compile-bytecode.scm (compile-bytecode): Add
  case for bind-optionals/shuffle-or-br.
* module/language/glil/compile-assembly.scm (glil->assembly): If there
  is an alternate, use bind-optionals/shuffle-or-br instead of
  bind-optionals/shuffle.

* test-suite/tests/optargs.test ("case-lambda*"): Add tests.
2013-01-14 11:38:09 +01:00
Andy Wingo
18c5bffe96 Docstrings in (ice-9 iconv)
* module/ice-9/iconv.scm: Add docstrings.
2013-01-11 21:28:51 +01:00
Andy Wingo
5ed4ea90a9 Change iconv procedures to take optional instead of keyword arg
* module/ice-9/iconv.scm (call-with-encoded-output-string):
  (string->bytevector, bytevector->string): Take an optional instead of
  a keyword argument.

* doc/ref/api-data.texi (Representing Strings as Bytes): Adapt docs to
  change, and fix a number of errors.  Thanks to Ludovic Courtès for the
  pointers.

* test-suite/tests/iconv.test ("wide non-ascii string"): Add a test for
  the 'substitute path.
2013-01-11 21:15:28 +01:00
pcpa
a34410eee2 Add filename and line number annotation abstraction.
* lib/jit_note.c: New file implementing a simple string+integer
	annotation, that should be used to map filename and line number
	to offsets in the generated jit.

	* include/lightning.h, lib/lightning.c: Update for the new
	note code.
	  Add an extra mandatory argument to init_jit, that is used
	as argument to bfd_openr.
	  Change from generic void* to char* the argument to jit_note
	and add an extra integer argument, to map to filename and
	line number.

	* check/ccall.c, check/lightning.c, include/lightning/jit_private.h,
	lib/jit_arm.c, lib/jit_disasm.c, lib/jit_mips.c, lib/jit_ppc.c,
	lib/jit_print.c, lib/jit_x86.c: lib/Makefile.am: Update for the
	new annotation code.

	* configure.ac, check/Makefile.am: Update to work with latest
	automake.
2013-01-11 15:29:35 -02:00