Andy Wingo [Sun, 2 Jan 2011 15:16:57 +0000 (10:16 -0500)]
update URI documentation
* doc/ref/web.texi (Types and the Web): Fix spacing.
(URIs): Give default values, and clarify a number of procedure docs.
Update "encoding" name, and string->uri name.
Andy Wingo [Sun, 2 Jan 2011 15:07:54 +0000 (10:07 -0500)]
uri-encode fast path
* module/web/uri.scm (uri-encode): Add a fast-path for the common case
in which the string does not contain any reserved characters.
Andy Wingo [Sun, 2 Jan 2011 14:41:14 +0000 (09:41 -0500)]
uri-decode #:encoding, not #:charset
* module/web/uri.scm (call-with-encoded-output-string, encode-string)
(decode-string, uri-decode, uri-encode): Change all instances of
"charset" to "encoding", as variables and arguments.
Andy Wingo [Fri, 31 Dec 2010 17:44:11 +0000 (12:44 -0500)]
rename string->uri and uri->string.
* module/web/uri.scm (string->uri, uri->string): Rename from parse-uri
and unparse-uri.
* test-suite/tests/web-uri.test:
* module/web/http.scm: All callers changed.
Andy Wingo [Fri, 31 Dec 2010 16:53:14 +0000 (11:53 -0500)]
clarify uri fragment discussion
* doc/ref/web.texi (URIs): Clarify the discussion of URI fragments.
Andy Wingo [Fri, 31 Dec 2010 16:12:07 +0000 (11:12 -0500)]
rewrite web.texi intro
* doc/ref/web.texi (Web): Rewrite the intro.
(Types and the Web): New subsection, a mini-rant.
Ludovic Courtès [Wed, 5 Jan 2011 21:22:15 +0000 (22:22 +0100)]
Tiny style improvement in the ECMAScript compiler.
Followup to
8891bd1b166b7210c241a0c1a730fc3af7f45b8a ("Fix ECMAScript
object creation.").
* module/language/ecmascript/compile-tree-il.scm (comp): Use `@implv'
for `new-object'. Suggested by Kan-Ru Chen <kanru@kanru.info>.
Ludovic Courtès [Wed, 5 Jan 2011 21:17:26 +0000 (22:17 +0100)]
Change `getaddrinfo' test to handle the GNU-specific `EAI_NODATA'.
* doc/ref/posix.texi (Network Databases): Mention `EAI_NODATA'.
* libguile/net_db.c (scm_getaddrinfo): Likewise for the docstring.
* test-suite/tests/net-db.test ("getaddrinfo")["no name"]: Handle
`EAI_NODATA'.
Noah Lavine [Mon, 3 Jan 2011 07:22:35 +0000 (02:22 -0500)]
Fix ECMAScript object creation.
* module/language/ecmascript/compile-tree-il.scm (compile-tree-il):
generate correct tree-il for construction of new objects.
* test-suite/tests/ecmascript.test (ecompile): Add pattern with EXPECTED
omitted.
("compiler"): test whether we generate new objects correctly.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Tue, 4 Jan 2011 17:29:55 +0000 (18:29 +0100)]
Document `scm_misc_error' (bug #31969).
* doc/ref/api-control.texi (Handling Errors): Add `scm_misc_error'.
Suggested by Bake Timmons <b3timmons@speedymail.org> (bug #31969).
Ludovic Courtès [Tue, 4 Jan 2011 17:08:58 +0000 (18:08 +0100)]
Improve doc of `string-index', `string-index-right', and `string-rindex'.
Suggested by Noah Lavine <noah.b.lavine@gmail.com>.
* doc/ref/api-data.texi (String Searching): Mention the return value of
`string-index', `string-index-right', and `string-rindex' when no
match is found.
* libguile/srfi-13.c (scm_string_index, scm_string_index_right,
scm_string_rindex): Adjust docstring accordingly.
Neil Jerram [Thu, 23 Dec 2010 12:10:52 +0000 (12:10 +0000)]
Manual typo fix
* doc/ref/api-overview.texi (API Overview): bot -> but
Ludovic Courtès [Mon, 20 Dec 2010 23:18:20 +0000 (00:18 +0100)]
Have `lookahead-u8' and `get-u8' actually do binary input.
* libguile/r6rs-ports.c (scm_lookahead_u8): Use `scm_get_byte_or_eof'
instead of `scm_peek_char'.
(scm_get_u8): Likewise.
* test-suite/tests/r6rs-ports.test ("7.2.8 Binary
Input")["lookahead-u8"]: Fix typo.
["lookahead-u8 non-ASCII"]: New test.
Ludovic Courtès [Tue, 7 Dec 2010 21:49:46 +0000 (22:49 +0100)]
Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'.
See <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24225> for details.
* lib/unistr.in.h: Change #if's into #ifdef's.
Ludovic Courtès [Mon, 20 Dec 2010 21:51:46 +0000 (22:51 +0100)]
Update Gnulib to
v0.0-4544-gce083ca.
Andy Wingo [Sat, 18 Dec 2010 12:13:16 +0000 (13:13 +0100)]
format handles ~@c better
* module/ice-9/format.scm (format): Fix ascii-ism in ~@c. Pull
flush-output? into the let*.
Andy Wingo [Sat, 18 Dec 2010 12:02:07 +0000 (13:02 +0100)]
more format tweaks
* module/ice-9/format.scm (format): Strip format: prefix from port and
output-col.
Andy Wingo [Sat, 18 Dec 2010 11:57:29 +0000 (12:57 +0100)]
more format tweaks
* module/ice-9/format.scm (format): Move the port and output-col to let*
vars, again removing a set!. We will probably move more state vars to
the let*, to let the procedures exist in a more fixed-point style.
Andy Wingo [Sat, 18 Dec 2010 11:50:00 +0000 (12:50 +0100)]
take advantage of letrec* in format
* module/ice-9/format.scm (format): Take advantage of letrec* internal
expansion, and so have fewer set! invocations.
Andy Wingo [Sat, 18 Dec 2010 11:42:50 +0000 (12:42 +0100)]
inline format:out into format
* module/ice-9/format.scm (format): Inline format:out into the body.
Andy Wingo [Sat, 18 Dec 2010 11:32:14 +0000 (12:32 +0100)]
more format cleanups
* module/ice-9/format.scm (format): Remove the need to save a copy of
the incoming arguments, because they are available as local
variables. Do the check early for the format-string actually being a
string.
Andy Wingo [Sat, 18 Dec 2010 11:20:26 +0000 (12:20 +0100)]
format's first arg is "destination"
* module/ice-9/format.scm: The argument to format is "destination", not
"port". Fix this newly reintroduced buglet.
Andy Wingo [Sat, 18 Dec 2010 11:15:12 +0000 (12:15 +0100)]
inline format:format into format
* module/ice-9/format.scm (format): Inline format:format body.
Andy Wingo [Sat, 18 Dec 2010 11:06:53 +0000 (12:06 +0100)]
deprecate omission of port to ice-9 format
* module/ice-9/format.scm (format): Add port and format-string as formal
arguments. Seems also to have triggered a reindent. Formally
deprecate omitting the port, as it's usually an error.
* test-suite/tests/format.test ("format basic output")
("format basic output", "~{ iteration"): Fix up tests that omitted the
destination port.
Andy Wingo [Sat, 18 Dec 2010 10:44:57 +0000 (11:44 +0100)]
letrec -> internal definitions in format.scm
* module/ice-9/format.scm (format): Change from letrec to internal
definitions, and use the define (foo ...) .. shorthand. No semantic
change.
Andy Wingo [Sat, 18 Dec 2010 10:27:19 +0000 (11:27 +0100)]
format.scm cleanups
* module/ice-9/format.scm (format:symbol-case-conv)
(format:iobj-case-conv): Remove these exports, they were not used.
(format:expch): Remove this one, though it was used.
(format:floats, format:complex-numbers, format:radix-pref): Inline
these "configuration variables" into the format body.
Andy Wingo [Sat, 18 Dec 2010 10:21:29 +0000 (11:21 +0100)]
ice-9 format license update
* module/ice-9/format.scm: A more standard copyright header, with
LGPLv3+ instead of public domain. Update define-module block.
Ludovic Courtès [Fri, 17 Dec 2010 20:57:19 +0000 (21:57 +0100)]
Bump version number for 1.9.14.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Fri, 17 Dec 2010 20:48:16 +0000 (21:48 +0100)]
Tweak `NEWS'.
* NEWS: Update.
Ludovic Courtès [Fri, 17 Dec 2010 20:23:23 +0000 (21:23 +0100)]
futures: Store pending futures in a queue.
* module/ice-9/futures.scm (%futures): Change from a list to a queue.
(register-future!, process-futures, touch): Adjust accordingly.
(unregister-future!): Remove.
Ludovic Courtès [Fri, 17 Dec 2010 20:17:42 +0000 (21:17 +0100)]
Clarify doc regarding threading of `par-map' and `par-for-each'.
* doc/ref/api-scheduling.texi (Parallel Forms): Refine wording for
`par-map' and `par-for-each'.
Andy Wingo [Fri, 17 Dec 2010 15:41:58 +0000 (16:41 +0100)]
add www-commit rule in doc/ref
* doc/ref/Makefile.am (www-commit): Add rule to update docs on web site.
Ludovic Courtès [Fri, 17 Dec 2010 13:34:22 +0000 (14:34 +0100)]
Remove conflicting `scm_is_string' declaration.
* libguile/strings.h: Move `scm_is_string' declaration...
* libguile/inline.h: ... here.
Reported by Noah Lavine <noah.b.lavine@gmail.com>.
Andy Wingo [Fri, 17 Dec 2010 12:53:29 +0000 (13:53 +0100)]
fix unbound fluid tests
* test-suite/tests/fluids.test: Fix tests.
Andy Wingo [Fri, 17 Dec 2010 12:33:29 +0000 (13:33 +0100)]
update NEWS
* NEWS: Update.
Andy Wingo [Fri, 17 Dec 2010 12:30:07 +0000 (13:30 +0100)]
guile-user has no filename
* module/ice-9/boot-9.scm (guile-user): Set #:filename to #f for
guile-user module, as guile-user isn't really associated with any
file.
Andy Wingo [Fri, 17 Dec 2010 12:27:43 +0000 (13:27 +0100)]
add ,reload meta-command and document it and reload-module
* module/ice-9/boot-9.scm (reload-module): Add docstring.
* module/system/repl/command.scm (reload): New meta-command.
* doc/ref/scheme-using.texi (Module Commands): Document the ,reload
meta-command.
* doc/ref/api-modules.texi (Module System Reflection): Document
reload-module.
Andy Wingo [Fri, 17 Dec 2010 12:16:36 +0000 (13:16 +0100)]
document variable-unset!
* doc/ref/api-modules.texi (Variables): Document variable-unset!.
* NEWS: Update.
Andy Wingo [Fri, 17 Dec 2010 12:14:13 +0000 (13:14 +0100)]
document make-unbound-fluid et al
* doc/ref/api-scheduling.texi (Fluids and Dynamic States): Document the
new fluid routines.
* NEWS: Update.
Andy Wingo [Fri, 17 Dec 2010 12:10:03 +0000 (13:10 +0100)]
rename make-undefined-fluid to make-unbound-fluid
* libguile/fluids.c (scm_make_unbound_fluid): Rename from
scm_make_undefined_fluid.
* libguile/fluids.h:
* module/language/elisp/runtime.scm: Update referrers.
Andy Wingo [Fri, 17 Dec 2010 12:04:23 +0000 (13:04 +0100)]
multicast manual updates
* doc/ref/posix.texi (Network Sockets and Communication): Add
IP_MULTICAST_TTL and IP_MULTICAST_IF docs, from the docstring.
* NEWS: Update.
Andy Wingo [Fri, 17 Dec 2010 11:54:21 +0000 (12:54 +0100)]
more web.texi "hacking"
* doc/ref/web.texi (Web Server, Web Examples): Finish these sections.
Andy Wingo [Fri, 17 Dec 2010 11:01:34 +0000 (12:01 +0100)]
build-response validates headers
* module/web/response.scm (build-response): Add some validation, like
for build-request.
Ludovic Courtès [Thu, 16 Dec 2010 22:44:55 +0000 (23:44 +0100)]
Implement `(ice-9 threads)' high-level constructs in terms of futures.
* module/ice-9/threads.scm (parallel, par-mapper): Rewrite in terms of
`future' and `touch'.
* test-suite/tests/threads.test ("par-map", "par-for-each"): New test
prefixes.
* doc/ref/api-scheduling.texi (Parallel Forms): Add cross-ref to
futures. Recommend against the `n-' variants.
Ludovic Courtès [Thu, 16 Dec 2010 16:38:32 +0000 (17:38 +0100)]
futures: Support multiple-value returns.
* module/ice-9/futures.scm (process-future!): Use `call-with-values'
when invoking `(future-thunk future)'.
* test-suite/tests/future.test ("futures")["multiple values"]: New test.
Ludovic Courtès [Thu, 16 Dec 2010 16:37:02 +0000 (17:37 +0100)]
futures: Fix potential deadlock.
* module/ice-9/futures.scm (process-futures): Fix potential deadlock,
whereby %FUTURES-MUTEX would be acquired *after* FUTURE's mutex.
Ludovic Courtès [Thu, 16 Dec 2010 16:07:50 +0000 (17:07 +0100)]
Rehash weak hash tables less frequently.
* libguile/hashtab.c (weak_bucket_assoc): Call `scm_i_rehash' only when
REMAINING is below `SCM_HASHTABLE_LOWER (table)'.
Ludovic Courtès [Thu, 16 Dec 2010 16:06:52 +0000 (17:06 +0100)]
Fix `hash' for pointer objects.
Previously all pointer objects would hash to the same value.
* libguile/hash.c (scm_hasher): Add case for `scm_tc7_pointer'.
Ludovic Courtès [Thu, 16 Dec 2010 14:20:10 +0000 (15:20 +0100)]
Inline `scm_is_string'.
* libguile/strings.c (scm_is_string): Move to...
* libguile/inline.h (scm_is_string): ... here. Inline.
Ludovic Courtès [Thu, 16 Dec 2010 14:14:33 +0000 (15:14 +0100)]
Add `compose', `negate', and `const'.
* module/ice-9/boot-9.scm (compose, negate, const): New procedures.
* doc/ref/api-procedures.texi (Higher-Order Functions): New node.
* test-suite/Makefile.am (SCM_TESTS): Add `tests/procs.test'.
* test-suite/tests/procs.test: New file.
Andy Wingo [Thu, 16 Dec 2010 18:38:48 +0000 (19:38 +0100)]
update web-response tests for http header parsing change
* test-suite/tests/web-response.test ("example-1"): Update for change in
parsing Vary header.
Andy Wingo [Thu, 16 Dec 2010 18:33:16 +0000 (19:33 +0100)]
update NEWS
* NEWS: Update for Web documentation.
Andy Wingo [Thu, 16 Dec 2010 18:31:50 +0000 (19:31 +0100)]
more web.texi work
* doc/ref/web.texi (Requests, Responses): Flesh out.
(Web Examples): New section, replacing "Web Handlers". The only one
that's not really written yet.
Andy Wingo [Thu, 16 Dec 2010 18:06:41 +0000 (19:06 +0100)]
add section on format of parsed http headers
* doc/ref/web.texi (HTTP Headers): New section. Needs some examples,
though.
Andy Wingo [Thu, 16 Dec 2010 17:12:08 +0000 (18:12 +0100)]
http: lists of header names parse better
* module/web/http.scm (list-of-strings?, write-list-of-strings): Move
definitions up.
(split-header-names, list-of-header-names?, write-header-list): New
helpers.
(declare-header-list-header): New helper.
(cache-control): Use split-header-names for private and no-cache.
(trailer): Use declare-header-list-header to parse known headers to
symbols.
(vary): Likewise, use split-header-names et al.
* test-suite/tests/web-http.test ("general headers"): Add a test.
Andy Wingo [Thu, 16 Dec 2010 16:56:03 +0000 (17:56 +0100)]
better cache-control: private, no-cache parsing
* module/web/http.scm (cache-control): Parse private and no-cache
better.
* test-suite/tests/web-http.test ("general headers"): Update.
Andy Wingo [Thu, 16 Dec 2010 15:44:44 +0000 (16:44 +0100)]
fix web.texi
* doc/ref/web.texi: Texinfo syntax fixen!
Andy Wingo [Thu, 16 Dec 2010 15:43:01 +0000 (16:43 +0100)]
update web.texi
* doc/ref/web.texi (URIs, HTTP): Update these sections.
Andy Wingo [Tue, 14 Dec 2010 22:26:41 +0000 (23:26 +0100)]
add web.texi to manual
* doc/ref/web.texi: New file, here to document the various (web ...)
modules. Quite a rough beginning, but it is a start...
* doc/ref/guile.texi:
* doc/ref/Makefile.am: Add to manual.
Andy Wingo [Thu, 16 Dec 2010 11:52:03 +0000 (12:52 +0100)]
(web server) docstrings
* module/web/server.scm: Docstrings in the house.
Andy Wingo [Thu, 16 Dec 2010 11:21:56 +0000 (12:21 +0100)]
docstrings in (web request) and (web response)
* module/web/request.scm:
* module/web/response.scm: Add docstrings.
Andy Wingo [Thu, 16 Dec 2010 11:02:53 +0000 (12:02 +0100)]
(web http) docstrings
* module/web/http.scm: Add docstrings all around.
Andy Wingo [Thu, 16 Dec 2010 10:35:02 +0000 (11:35 +0100)]
document (web uri), and simplify uri-encode
* module/web/uri.scm: Add docstrings.
(uri-encode): Simplify. Not sure what I was thinking before.
Andy Wingo [Mon, 13 Dec 2010 22:35:34 +0000 (23:35 +0100)]
update NEWS
* NEWS: Update.
Andy Wingo [Mon, 13 Dec 2010 19:25:36 +0000 (20:25 +0100)]
fix bugs in primitive-poll
* libguile/poll.c (scm_primitive_poll): Only mark POLLOUT for output
ports. Don't override results from the syscall, add to them.
Andy Wingo [Sun, 12 Dec 2010 22:33:33 +0000 (23:33 +0100)]
fix testing code in web/server
* module/web/server.scm (call-with-encoded-output-string): Fix some code
I accidentally left in while testing. Re-tested the difference in
speed; pleasantly surprised.
* module/web/uri.scm: Make the same change here.
Andy Wingo [Sun, 12 Dec 2010 22:13:08 +0000 (23:13 +0100)]
foreign: c-struct parsing simplification
* module/system/foreign.scm: Revert much of
fb636a1cce. Short et al are
not distinct types -- they are all aliases to e.g. int16. The only
case that was not covered before was the pointer case.
(bytevector-pointer-ref, bytevector-pointer-set!): Implement these,
and use them for pointers.
Andy Wingo [Sun, 12 Dec 2010 21:45:47 +0000 (22:45 +0100)]
1.9.13 news to main body
* NEWS: Fold 1.9.13 text into the main text.
Andy Wingo [Sun, 12 Dec 2010 20:59:29 +0000 (21:59 +0100)]
http-read robustness
* module/web/server/http.scm (http-read): Record the client index in
more cases in which code could throw an error.
Andy Wingo [Sat, 11 Dec 2010 18:14:58 +0000 (19:14 +0100)]
(web uri) can uri-decode non-utf-8 payloads
* module/web/uri.scm (call-with-encoded-output-string, encode-string):
Copy from server.scm
(decode-string): Copy from tekuti.
(uri-decode): The #:charset arg is a string, like
port-encoding. Support other charsets.
(uri-encode): Charset is a string. Other encodings still not nicely
supported. Hmm.
Andy Wingo [Fri, 10 Dec 2010 16:49:37 +0000 (17:49 +0100)]
add return/values hack to compile-glil for lua
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Add a hack
like 'return but for multiple values, for lua.
Andy Wingo [Fri, 10 Dec 2010 16:48:38 +0000 (17:48 +0100)]
rnrs control only depends on (guile)
* module/rnrs/control.scm: Depend only on (guile).
Andy Wingo [Fri, 10 Dec 2010 12:02:24 +0000 (13:02 +0100)]
fix self-tail-calls for lexical procs with optional, rest, or kwargs
* module/language/tree-il/compile-glil.scm (flatten-lambda): Don't emit
a self-label, because when we can't match the args for a lexical call,
we have no space to shuffle args and jump.
(flatten): Apply the self-tail-call optimization to optional args
too, but only if the procedure is fix-allocated. If we can't apply the
optimization, use the normal tail-call sequence.
* test-suite/tests/optargs.test ("lambda* inits"): Add tests.
Andy Wingo [Thu, 9 Dec 2010 20:53:46 +0000 (21:53 +0100)]
clarify compile-glil error messages
* module/language/tree-il/compile-glil.scm (vars->bind-list, flatten):
Make internal self-checking error messages more clear, for
implementors of other languages.
Andreas Rottmann [Tue, 7 Dec 2010 22:13:55 +0000 (23:13 +0100)]
Get rid of `define-macro' in the SRFI 26 implementation
* module/srfi/srfi-26.scm (cut, cute): Implement using `syntax-case'.
The new implementation is mostly just a transcription of the old code;
the reference implementation which relies only on `syntax-rules' may
(or may not) be considered more elegant :-).
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Ludovic Courtès [Tue, 7 Dec 2010 22:11:53 +0000 (23:11 +0100)]
Use `current-processor-count' to determine the number of future-workers.
* module/ice-9/futures.scm (%worker-count): Use
`current-processor-count'.
* doc/ref/api-scheduling.texi (Futures): Add note about side-effects and
I/O. Mention `current-processor-count'.
Ludovic Courtès [Tue, 7 Dec 2010 22:10:41 +0000 (23:10 +0100)]
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'.
Ludovic Courtès [Tue, 7 Dec 2010 21:56:07 +0000 (22:56 +0100)]
Improve doc of `getaffinity' and `setaffinity'.
* doc/ref/posix.texi (Processes): Add cross-reference from `setaffinity'
and `getaffinity' to the corresponding node in the glibc manual.
* libguile/posix.c (scm_getaffinity, scm_setaffinity): Likewise.
Ludovic Courtès [Tue, 7 Dec 2010 21:49:46 +0000 (22:49 +0100)]
Temporarily fix `unistr.in.h' to allow compilation with `-Wundef'.
See <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24225> for details.
* lib/unistr.in.h: Change #if's into #ifdef's.
Ludovic Courtès [Tue, 7 Dec 2010 20:43:04 +0000 (21:43 +0100)]
Use Gnulib's `nproc'.
This updates Gnulib to
v0.0-4496-g6491120.
* m4/gnulib-cache.m4: Add `nproc'.
Ludovic Courtès [Tue, 7 Dec 2010 19:45:29 +0000 (20:45 +0100)]
Build dlopenable modules with `-module'.
* test-suite/standalone/Makefile.am (libtest_asmobs_la_LDFLAGS,
libtest_ffi_la_LDFLAGS, libtest_extensions_la_LDFLAGS): Add `-module'.
Ludovic Courtès [Tue, 7 Dec 2010 19:43:49 +0000 (20:43 +0100)]
Add a record type printer for vlists/vhashes.
* module/ice-9/vlist.scm (<vlist>): Add a record type printer.
Brian Templeton [Mon, 16 Aug 2010 07:20:55 +0000 (03:20 -0400)]
lexical function binding for elisp
* module/language/elisp/compile-tree-il.scm (access-variable)
(reference-variable, set-variable!): Handle globally-bound non-special
variables.
(bind-lexically?): Create lexical bindings for flet and flet*.
* module/language/elisp/runtime.scm (reference-variable, set-variable!):
Handle globally-bound non-special variables.
(built-in-func): Set the variable directly instead of storing the
function in a fluid.
* module/language/elisp/runtime/subrs.scm (funcall): Call apply
directly.
* test-suite/tests/elisp-compiler.test ("Function Definitions")["flet
and flet*"]:
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Sat, 14 Aug 2010 23:28:56 +0000 (19:28 -0400)]
use unbound fluids instead of `void' sentinel value
* module/language/elisp/compile-tree-il.scm (reference-with-check)
(compile-without-void-checks, want-void-check?): Remove.
(compile-function, compile-pair): Use `reference-variable' instead of
`reference-with-check'.
(compile-defvar): Only set `sym' if `sym' is not bound to a bound
fluid, rather than requiring that its value be `void'.
(process-options!): Remove `#:disable-void-check' option handling.
* module/language/elisp/runtime.scm (void)
(reference-variable-with-check): Remove.
(ensure-fluid!): Use an undefined fluid as the initial value for
global variables.
* module/language/elisp/runtime/function-slot.scm (without-void-checks):
Don't import or re-export.
* module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist):
Don't use `without-void-checks'.
* module/language/elisp/runtime/subrs.scm (symbol-value)
(symbol-function, apply): Use `reference-variable' instead of
`reference-variable-with-check'.
(makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid
(or the variable itself, if it isn't bound to a fluid).
* test-suite/tests/elisp-compiler.test ("Variable
Setting/Referencing")["disabled void check (all)", "disabled void
check (symbol list)", "without-void-checks"]: Remove.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Thu, 22 Jul 2010 20:33:53 +0000 (16:33 -0400)]
function's argument can be a symbol
* module/language/elisp/compile-tree-il.scm (compile-function): the form
`(function SYMBOL)' evaluates to the functional value of SYMBOL
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Thu, 22 Jul 2010 20:25:29 +0000 (16:25 -0400)]
allow `(setcar nil nil)' and `(setcdr nil nil)'
* module/language/elisp/runtime/subrs.scm (setcar, setcdr): Allow
setting the car or cdr of `nil' to `nil'.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Thu, 22 Jul 2010 19:12:50 +0000 (15:12 -0400)]
support "#'" syntax for function expressions
* module/language/elisp/lexer.scm (lex):
* module/language/elisp/parser.scm (get-expression): Support sharpsign
single-quote syntax as an abbreviation for `function' expressions.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Sat, 10 Jul 2010 06:47:16 +0000 (02:47 -0400)]
setq can take any number of arguments
* module/language/elisp/compile-tree-il.scm (compile-setq): Return nil
if called with no arguments, and set the last variable to nil if its
value is omitted.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Sat, 10 Jul 2010 00:33:32 +0000 (20:33 -0400)]
use correct names for quasiquotation operators
Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and
unquote-splicing operators, respectively. Previously they were named
escaping.
* module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to
"#{,}#".
(unquote-splicing): Change "\,@" to "#{,@}#".
(#{compile-`}#): Rename from #{compile-\`}#.
* module/language/elisp/runtime/function-slot.scm: Import #{compile-`}#
instead of #{compile-\`}#, and re-export as #{`}# instead of as
#{\`}#.
* module/language/elisp/parser.scm (quotation-symbols):
* test-suite/tests/elisp-compiler.test ("Eval", "Quotation"):
* test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and
"\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively.
Brian Templeton [Fri, 9 Jul 2010 23:52:48 +0000 (19:52 -0400)]
store special operators in the function slot
If the function slot of a symbol contains a pair with `special-operator'
in the car and a procedure in the cdr, the procedure is called to
compile the form to Tree-IL. This is similar to other Emacs Lisp
implementations, in which special operators are subrs.
* module/language/elisp/compile-tree-il.scm: Restructured to store
special operator definitions in the function slot. Import `(language
elisp runtime)' for `defspecial'. Export special operators so that
`(language elisp runtime function-slot)' can re-export them.
(backquote?): Removed; the backquote symbol is defined as a special
operator, so it's no longer used in `compile-pair'.
(is-macro?, get-macro): Replaced by `find-operator'.
(find-operator): New procedure.
(compile-progn, compile-if, compile-defconst, compile-defvar,
compile-setq, compile-let, compile-lexical-let, compile-flet,
compile-let*, compile-lexical-let*, compile-flet*,
compile-without-void-checks, compile-with-always-lexical,
compile-guile-ref, compile-guile-primitive, compile-while,
compile-function, compile-defmacro, compile-defun, #{compile-`}#,
compile-quote): New special operators with definitions taken from the
pmatch form in `compile-pair'. There is no special operator `lambda';
it is now a macro, as in other Elisp implementations.
(compile-pair): Instead of directly compiling special forms, check for
a special operator object in the function slot.
* module/language/elisp/runtime.scm: Export `defspecial'.
(make-id): New function.
(built-in-macro): Prefix macros with `macro-'.
(defspecial): New syntax.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
special operators. Rename imported special operators and macros to
remove prefixes. Re-export new macro `lambda'.
* module/language/elisp/runtime/macros.scm (macro-lambda): New Elisp
macro.
Brian Templeton [Fri, 2 Jul 2010 02:38:23 +0000 (22:38 -0400)]
update elisp reader tests to handle EOF tokens
* test-suite/tests/elisp-reader.test (lex-all, "end-of-input",
"lexer/1"): Check for an EOF token instead of the symbol `*eoi*'.
Brian Templeton [Wed, 30 Jun 2010 20:54:45 +0000 (16:54 -0400)]
make user-defined macros available at runtime
* module/language/elisp/compile-tree-il.scm (ensuring-globals): New
procedure.
(define-macro!): Remove.
(compile-pair) <defmacro>: Make macro available at runtime, not only
during compilation.
(compile-tree-il): Use `ensuring-globals'.
Brian Templeton [Wed, 30 Jun 2010 20:48:19 +0000 (16:48 -0400)]
allow fluid macro bindings
* module/language/elisp/compile-tree-il.scm (define-macro!, get-macro):
Allow fluid macro bindings.
Brian Templeton [Wed, 30 Jun 2010 01:18:05 +0000 (21:18 -0400)]
new `load' subr
* module/language/elisp/runtime/subrs.scm: Define new subr `load'.
* module/language/elisp/runtime/function-slot.scm: Re-export `load'.
Brian Templeton [Wed, 30 Jun 2010 01:13:18 +0000 (21:13 -0400)]
Ignore #:warnings compiler option
* module/language/elisp/compile-tree-il.scm (process-options!): Ignore
#:warnings compiler option.
Brian Templeton [Fri, 25 Jun 2010 03:03:08 +0000 (23:03 -0400)]
handle EOF correctly in parser and lexer
* module/language/elisp/lexer.scm (lex, get-lexer/1): Return a valid
token at EOF.
* module/language/elisp/parser.scm (get-expression): Raise an error if
EOF is reached.
(read-elisp): If at EOF, return the EOF object instead of attempting
to read an expression.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Wed, 23 Jun 2010 23:31:33 +0000 (19:31 -0400)]
store macro definitions in the function slot
Guile Emacs Lisp previously kept macros in a separate macro slot; now
macros are stored as macro objects in the function slot for
compatibility with other implementations.
* module/language/elisp/compile-tree-il.scm (macro-slot): Remove.
(is-macro?): Check that the argument is a symbol. Now-unnecessary
check removed in `compile-tree-il'.
(macro?, define-macro!, get-macro): Store macro definitions in the
function slot, not in a separate macro slot.
* module/language/elisp/runtime.scm (built-in-macro): Wrap the macro
function in a macro object (i.e., cons the symbol `macro' onto it).
* module/language/elisp/runtime/function-slot.scm: Move contents to
"subrs.scm". Re-export function and macro definitions instead of
defining functions directly in this module.
* module/language/elisp/runtime/macro-slot.scm: Move contents to
"macros.scm" and remove.
* module/language/elisp/runtime/macros.scm: New file containing macro
definitions from "macro-slot.scm".
* module/language/elisp/runtime/subrs.scm: New file containing function
definitions from "function-slot.scm".
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Fri, 18 Jun 2010 00:25:42 +0000 (20:25 -0400)]
use existing bindings record for defmacro
* module/language/elisp/compile-tree-il.scm (compile-pair): Use existing
bindings record during macro definition.
Brian Templeton [Wed, 16 Jun 2010 21:18:30 +0000 (17:18 -0400)]
use tree-il's support for optional arguments
* module/language/elisp/compile-tree-il.scm (compile-lambda): Use
Tree-IL's support for optional arguments.
(process-optionals, process-rest): Remove.
Signed-off-by: Andy Wingo <wingo@pobox.com>
Brian Templeton [Wed, 23 Jun 2010 23:40:03 +0000 (19:40 -0400)]
make `pass-if-equal' literal in `compile-test'
* test-suite/tests/elisp-compiler.test (compile-test): Add
`pass-if-equal' to the list of literal identifiers
Signed-off-by: Andy Wingo <wingo@pobox.com>