bpt/guile.git
13 years agoFix `hash' for pointer objects.
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'.

13 years agoInline `scm_is_string'.
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.

13 years agoAdd `compose', `negate', and `const'.
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.

13 years agoupdate web-response tests for http header parsing change
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.

13 years agoupdate NEWS
Andy Wingo [Thu, 16 Dec 2010 18:33:16 +0000 (19:33 +0100)]
update NEWS

* NEWS: Update for Web documentation.

13 years agomore web.texi work
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.

13 years agoadd section on format of parsed http headers
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.

13 years agohttp: lists of header names parse better
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.

13 years agobetter cache-control: private, no-cache parsing
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.

13 years agofix web.texi
Andy Wingo [Thu, 16 Dec 2010 15:44:44 +0000 (16:44 +0100)]
fix web.texi

* doc/ref/web.texi: Texinfo syntax fixen!

13 years agoupdate web.texi
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.

13 years agoadd web.texi to manual
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.

13 years ago(web server) docstrings
Andy Wingo [Thu, 16 Dec 2010 11:52:03 +0000 (12:52 +0100)]
(web server) docstrings

* module/web/server.scm: Docstrings in the house.

13 years agodocstrings in (web request) and (web response)
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.

13 years ago(web http) 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.

13 years agodocument (web uri), and simplify uri-encode
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.

13 years agoupdate NEWS
Andy Wingo [Mon, 13 Dec 2010 22:35:34 +0000 (23:35 +0100)]
update NEWS

* NEWS: Update.

13 years agofix bugs in primitive-poll
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.

13 years agofix testing code in web/server
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.

13 years agoforeign: c-struct parsing simplification
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.

13 years ago1.9.13 news to main body
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.

13 years agohttp-read robustness
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.

13 years ago(web uri) can uri-decode non-utf-8 payloads
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.

13 years agoadd return/values hack to compile-glil for lua
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.

13 years agornrs control only depends on (guile)
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).

13 years agofix self-tail-calls for lexical procs with optional, rest, or kwargs
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.

13 years agoclarify compile-glil error messages
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.

13 years agoGet rid of `define-macro' in the SRFI 26 implementation
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>
13 years agoUse `current-processor-count' to determine the number of future-workers.
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'.

13 years agoAdd `total-processor-count' and `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'.

13 years agoImprove doc of `getaffinity' and `setaffinity'.
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.

13 years agoTemporarily fix `unistr.in.h' to allow compilation with `-Wundef'.
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.

13 years agoUse Gnulib's `nproc'.
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'.

13 years agoBuild dlopenable modules with `-module'.
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'.

13 years agoAdd a record type printer for vlists/vhashes.
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.

13 years agolexical function binding for elisp
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>
13 years agouse unbound fluids instead of `void' sentinel value
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>
13 years agofunction's argument can be a symbol
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>
13 years agoallow `(setcar nil nil)' and `(setcdr nil nil)'
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>
13 years agosupport "#'" syntax for function expressions
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>
13 years agosetq can take any number of arguments
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>
13 years agouse correct names for quasiquotation operators
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.

13 years agostore special operators in the function slot
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.

13 years agoupdate elisp reader tests to handle EOF tokens
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*'.

13 years agomake user-defined macros available at runtime
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'.

13 years agoallow fluid macro bindings
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.

13 years agonew `load' subr
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'.

13 years agoIgnore #:warnings compiler option
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.

13 years agohandle EOF correctly in parser and lexer
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>
13 years agostore macro definitions in the function slot
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>
13 years agouse existing bindings record for defmacro
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.

13 years agouse tree-il's support for optional arguments
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>
13 years agomake `pass-if-equal' literal in `compile-test'
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>
13 years agoreindent
Brian Templeton [Mon, 7 Jun 2010 20:38:23 +0000 (16:38 -0400)]
reindent

* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/spec.scm: Reindent.

Signed-off-by: Andy Wingo <wingo@pobox.com>
13 years agoreformat comments
Brian Templeton [Mon, 7 Jun 2010 20:38:00 +0000 (16:38 -0400)]
reformat comments

* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/runtime/value-slot.scm: Reformat comments.

Signed-off-by: Andy Wingo <wingo@pobox.com>
13 years agowhitespace changes
Brian Templeton [Mon, 7 Jun 2010 20:37:24 +0000 (16:37 -0400)]
whitespace changes

* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm: Ensure that all
  top-level forms and comments are separated by exactly one newline.
  Remove blank lines in most procedure bodies. Delete trailing
  whitespace.

Signed-off-by: Andy Wingo <wingo@pobox.com>
13 years agoautoload compile-file in (guile-user)
Brian Templeton [Wed, 14 Jul 2010 21:47:37 +0000 (17:47 -0400)]
autoload compile-file in (guile-user)

* module/ice-9/boot-9.scm (guile-user): Autoload `compile-file'.

13 years agovariable-unset!
Brian Templeton [Sat, 14 Aug 2010 23:00:20 +0000 (19:00 -0400)]
variable-unset!

* libguile/variable.c (scm_variable_unset_x): New function.
* libguile/variable.h (scm_variable_unset_x): New prototype.

13 years agounbound fluids
Brian Templeton [Sat, 14 Aug 2010 22:35:17 +0000 (18:35 -0400)]
unbound fluids

* libguile/fluids.c (scm_make_undefined_fluid, scm_fluid_unset_x)
  (scm_fluid_bound_p): New functions.

  (fluid_ref): New function; like scm_fluid_ref, but will not throw an
  error for unbound fluids.
  (scm_fluid_ref, swap_fluid): Use `fluid_ref'.

* libguile/fluids.h (scm_make_undefined_fluid, scm_fluid_unset_x)
  (scm_fluid_bound_p): New prototypes.

* libguile/vm-i-system.c (fluid_ref): If fluid is unbound, jump to
  `vm_error_unbound_fluid'.
* libguile/vm-engine.c (VM_NAME)[vm_error_unbound_fluid]: New error
  message.

* test-suite/tests/fluids.test ("unbound fluids")["fluid-ref of unbound
  fluid", "fluid-bound? of bound fluid", "fluid-bound? of unbound
  fluid", "unbound fluids can be set", "bound fluids can be unset"]: New
  tests.

13 years agobetter unbound variable errors in the vm
Andy Wingo [Tue, 7 Dec 2010 11:26:07 +0000 (12:26 +0100)]
better unbound variable errors in the vm

* libguile/vm-i-system.c (variable-ref, toplevel-ref)
  (long-toplevel-ref): Fixup callers.

* libguile/vm-engine.c (vm_error_unbound): Don't use vm-error for
  unbound vars, use misc-error. Don't include VM: in the string. Take
  the name directly in finish_args, not as a list.

13 years agomake guile-test work without configuration
Brian Templeton [Wed, 14 Jul 2010 00:55:45 +0000 (20:55 -0400)]
make guile-test work without configuration

* test-suite/guile-test: Use "../meta/guile" as the interpreter instead
  of "../libguile/guile".
  (default-test-suite): New function, replacing the variable of the same
  name. Look for tests in the same directory as the guile-test script.
  Throw an error if not invoked as `guile-test'.
  (test-suite): The old default value of `default-test-suite' could now
  throw an error, and this already gets initialized in `main', so don't
  provide an initial value.

13 years agoPut `figures' into standard texinfo form
Neil Jerram [Mon, 6 Dec 2010 23:02:12 +0000 (23:02 +0000)]
Put `figures' into standard texinfo form

* doc/ref/goops.texi (Example, Inheritance): Remove unnecessary figure
  references.  Use @float and @ref.
  (Class precedence list): Ditto.

13 years agoMerge `tutorial' and `reference' treatments of the same basic GOOPS
Neil Jerram [Mon, 6 Dec 2010 22:28:39 +0000 (22:28 +0000)]
Merge `tutorial' and `reference' treatments of the same basic GOOPS
material

* doc/ref/goops.texi (GOOPS): Move use of (oop goops) here.

  (Class Definition): Merged with `Defining New Classes'

  (Instance Creation): Insert before covering slot options.  Merge in
  material from `Creating Instances'.

  (Slot Options): Merged some better wording and index entries from
  the tutorial version.

  (Slot Description Example): New node, containing the <my-complex>
  material from the tutorial.

  (Methods and Generic Functions, Inheritance): Tutorial sections
  moved into main line of the manual.

* doc/ref/goops-tutorial.texi: Nothing left here now.

13 years agoMinor textual markups
Neil Jerram [Mon, 6 Dec 2010 20:24:58 +0000 (20:24 +0000)]
Minor textual markups

* doc/ref/goops-tutorial.texi (Class definition): No reason to assume
  particular familiarity with CLOS.
  (Instance creation and slot access): Remove a couple of words.

13 years agoscm_setvbuf doesn't throw away current buffers
Andy Wingo [Mon, 6 Dec 2010 18:59:15 +0000 (19:59 +0100)]
scm_setvbuf doesn't throw away current buffers

* libguile/ports.c (scm_drain_input): Slight optimization.

* libguile/fports.c (scm_setvbuf): If there is buffered output, flush
  it.  If there is input, drain it, and then unread it after updating
  the buffers.  Much more sensible than dropping it silently...

13 years agohttp-read calls setvbuf only once
Andy Wingo [Mon, 6 Dec 2010 18:52:51 +0000 (19:52 +0100)]
http-read calls setvbuf only once

* module/web/server/http.scm (http-read): Don't play the setvbuf dance,
  it was throwing away buffered input. Instead just call setvbuf once
  before doing any reads or writes.

13 years agoice-9 poll handles buffered io too
Andy Wingo [Mon, 6 Dec 2010 18:27:22 +0000 (19:27 +0100)]
ice-9 poll handles buffered io too

* libguile/poll.c (scm_primitive_poll): Account for buffered I/O.

* module/ice-9/poll.scm (poll): Adapt to call primitive-poll with the
  port vector too.

13 years agofix name...
Andy Wingo [Mon, 6 Dec 2010 14:32:13 +0000 (15:32 +0100)]
fix name...

* module/web/request.scm (read-request-body/latin-1): Fix name...

13 years agofix read-{request,response}-body/latin-1
Andy Wingo [Mon, 6 Dec 2010 14:30:45 +0000 (15:30 +0100)]
fix read-{request,response}-body/latin-1

* module/web/request.scm (read-response-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Avoid the
  craziness of the read-delimited! interface and hand-roll our
  own. Fixes errors if read-delimited returns #f or EOF.

13 years agoupdate read-delimited! docs
Andy Wingo [Mon, 6 Dec 2010 14:19:40 +0000 (15:19 +0100)]
update read-delimited! docs

* doc/ref/api-io.texi (Line/Delimited): Update the read-delimited!
  docs.

13 years agoleniency regarding quality values in http.scm
Andy Wingo [Mon, 6 Dec 2010 12:52:56 +0000 (13:52 +0100)]
leniency regarding quality values in http.scm

* module/web/http.scm: Add commentary.
  (parse-quality): Allow .NNN to be interpreted as 0.NNN.

* test-suite/tests/web-http.test ("request headers"): Add a test.

13 years agofix entity tag writing
Andy Wingo [Mon, 6 Dec 2010 11:58:16 +0000 (12:58 +0100)]
fix entity tag writing

* module/web/http.scm (write-entity-tag): Fix writing of entity tags
  (strong versus weak).

13 years agomore robustness in http-read
Andy Wingo [Mon, 6 Dec 2010 10:24:48 +0000 (11:24 +0100)]
more robustness in http-read

* module/web/server/http.scm (http-read): If there was an error reading
  the request, be sure to close the request port.

13 years agohttp doesn't keep-alive requests for which there was an error
Andy Wingo [Sun, 5 Dec 2010 19:24:14 +0000 (20:24 +0100)]
http doesn't keep-alive requests for which there was an error

* module/web/server/http.scm (keep-alive?): Don't keep the client around
  if there is an error.

13 years ago(web server http) comment
Andy Wingo [Sat, 4 Dec 2010 18:45:51 +0000 (19:45 +0100)]
(web server http) comment

* module/web/server/http.scm: Add comment about charsets.

13 years agofix error handling in read-{request,response}-body/latin-1
Andy Wingo [Sat, 4 Dec 2010 18:45:09 +0000 (19:45 +0100)]
fix error handling in read-{request,response}-body/latin-1

* module/web/request.scm (read-request-body/latin-1):
* module/web/response.scm (read-response-body/latin-1): Detect short
  reads instead of returning a full buffer with the last bits zeroed
  out. (Before the make-string commit, they contained uninitialized
  memory, which was a fairly serious error.)

13 years agomake-string et al nulls memory if not given an initializer
Andy Wingo [Sat, 4 Dec 2010 18:31:20 +0000 (19:31 +0100)]
make-string et al nulls memory if not given an initializer

* libguile/gc-malloc.c: Add a note that the gc-malloc does not clear the
  memory block, so users need to make sure it is initialized.

* libguile/bitvectors.c (scm_c_make_bitvector):
* libguile/bytevectors.c (scm_make_bytevector):
* libguile/strings.c (scm_c_make_string): If no initializer is given,
  initialize the bytes to 0. Prevents information leakage if an app uses
  make-string et al without initializers.

* libguile/foreign.c (make_cif): Initialize this too, to prevent leakage
  in the struct holes. Paranoia...

13 years agoread-delimited is clearer and conses less
Andy Wingo [Fri, 3 Dec 2010 17:03:51 +0000 (18:03 +0100)]
read-delimited is clearer and conses less

* module/ice-9/rdelim.scm (read-delimited): Clarify and somewhat
  optimize implementation.

13 years agohttp server impl reads body as a bytevector by default
Andy Wingo [Fri, 3 Dec 2010 16:37:22 +0000 (17:37 +0100)]
http server impl reads body as a bytevector by default

* module/web/server/http.scm (http-read): Read body as a bytevector by
  default. That way we punt encoding issues to the app.

13 years agoremove redundant error-handling block
Andy Wingo [Fri, 3 Dec 2010 15:41:46 +0000 (16:41 +0100)]
remove redundant error-handling block

* module/web/server/http.scm (http-read): No need for a
  call-with-error-handling block here, as the read impl is itself within
  an error-handling block.

13 years agoweb server micro-tuning
Andy Wingo [Fri, 3 Dec 2010 15:30:52 +0000 (16:30 +0100)]
web server micro-tuning

* module/web/server/http.scm (http-open): Allow up to 128 pending
  connections -- the default value for somaxconn on a number of
  machines. This is from the HOP paper.
  (http-read): Set the send buffer to 12 KB, also from the HOP paper.

13 years agoreverse order of poll-set traversal in http-read
Andy Wingo [Fri, 3 Dec 2010 15:11:37 +0000 (16:11 +0100)]
reverse order of poll-set traversal in http-read

* module/web/server/http.scm (http-read): Rewrite to iterate down the
  pollset, so the vector shuffles touch less memory and the end
  condition of the loop is clearer.

13 years ago(web server) punts keep-alive to impls; http server uses (ice-9 poll)
Andy Wingo [Fri, 3 Dec 2010 14:31:57 +0000 (15:31 +0100)]
(web server) punts keep-alive to impls; http server uses (ice-9 poll)

* module/web/server.scm: Rewrite to remove the extra "keep-alive"
  parameter. Instead, since the server is an essentially stateful
  object, have clients that want to do keep-alive manage that set as
  part of the server state. Also avoids imposing a particular data
  structure on the server implementation.

* module/web/server/http.scm: Adapt to the new server interface. Also,
  use a poll set instead of select and lists. Makes handling 1000
  clients at a time much more possible.

13 years agoASYNC_TICK after catching EINTR in SCM_SYSCALL
Andy Wingo [Fri, 3 Dec 2010 14:17:35 +0000 (15:17 +0100)]
ASYNC_TICK after catching EINTR in SCM_SYSCALL

* libguile/_scm.h (SCM_SYSCALL): As in scm_syserror, do a SCM_ASYNC_TICK
  before resuming the syscall after an EINTR.

13 years agoadd (ice-9 poll), a poll wrapper
Andy Wingo [Fri, 3 Dec 2010 12:09:43 +0000 (13:09 +0100)]
add (ice-9 poll), a poll wrapper

* libguile/poll.c:
* libguile/poll.h:
* module/ice-9/poll.scm: New module, (ice-9 poll).

* module/Makefile.am:
* libguile/init.c:
* libguile/Makefile.am: Adapt.

* configure.ac: Check for poll.h and poll.

13 years agoAdd `(ice-9 futures)'.
Ludovic Courtès [Thu, 2 Dec 2010 23:35:15 +0000 (00:35 +0100)]
Add `(ice-9 futures)'.

* doc/ref/api-scheduling.texi (Threads): Add short introduction.
  Mention the `threads' feature.  Add cross-reference to futures.
  (Futures): New node.

* module/Makefile.am (ICE_9_SOURCES): Add `ice-9/futures.scm'.

* module/ice-9/futures.scm: New file.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/future.test'.

* test-suite/tests/future.test: New file.

13 years agoAdd bindings to GNU `sched_setaffinity' and `sched_getaffinity'.
Ludovic Courtès [Wed, 1 Dec 2010 22:58:39 +0000 (23:58 +0100)]
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.

13 years agono need for fport_fill_input to select() before read()
Andy Wingo [Thu, 2 Dec 2010 22:41:00 +0000 (23:41 +0100)]
no need for fport_fill_input to select() before read()

* libguile/fports.c (fport_fill_input): Likewise to the previous commit,
  no need to select() before read().

13 years agoscm_accept no longer leaves guile mode
Andy Wingo [Thu, 2 Dec 2010 22:24:39 +0000 (23:24 +0100)]
scm_accept no longer leaves guile mode

* libguile/socket.c (scm_accept): Revert
  7d1fc8721724ab64ccdc44d6f4f84abad43751b4. Now that we don't need to
  leave guile mode in order for GC to happen, don't do so, as we assume
  that anyone who cares has already done a select() beforehand.

13 years agosxml->xml fix
Andy Wingo [Thu, 2 Dec 2010 21:24:26 +0000 (22:24 +0100)]
sxml->xml fix

* module/sxml/simple.scm (attribute-value->xml): Whoops, fix null case.

13 years agosxml->xml writes directly to a port
Andy Wingo [Thu, 2 Dec 2010 16:25:46 +0000 (17:25 +0100)]
sxml->xml writes directly to a port

* module/sxml/simple.scm: Remove "universal-sxslt-rules" -- it was a bad
  interface, and I couldn't find any users of it.
  (sxml->xml): Rewrite so that instead of generating another tree of
  data, we write the data directly to a port.

13 years agoadd some debugging to (web server)
Andy Wingo [Thu, 2 Dec 2010 12:36:04 +0000 (13:36 +0100)]
add some debugging to (web server)

* module/web/server.scm: Add some basic elapsed-time debugging, but only
  if you flip a switch to turn it on at expand-time.

13 years agobetter socket buffering on http web server backend
Andy Wingo [Thu, 2 Dec 2010 12:33:49 +0000 (13:33 +0100)]
better socket buffering on http web server backend

* module/web/server/http.scm (http-read, http-write): Line-buffer the
  port while we're reading the request, and block-buffer it otherwise
  Use the default block size.

13 years agoindentation fix in ports.c
Andy Wingo [Thu, 2 Dec 2010 11:46:15 +0000 (12:46 +0100)]
indentation fix in ports.c

* libguile/ports.c (scm_i_get_conversion_strategy): Indentation fix.

13 years ago(web server) supports non-utf-8 charsets
Andy Wingo [Thu, 2 Dec 2010 11:28:35 +0000 (12:28 +0100)]
(web server) supports non-utf-8 charsets

* module/web/server.scm (sanitize-response): Support charsets other than
  utf-8. Oddly collecting a string and converting it to utf-8 appears to
  be faster than collecting a utf-8 bytevector directly.

13 years agoadd simple web app examples
Andy Wingo [Thu, 2 Dec 2010 10:47:19 +0000 (11:47 +0100)]
add simple web app examples

* examples/web/hello.scm:
* examples/web/debug-sxml.scm: New examples, for simple web
  applications.

* examples/README:
* examples/Makefile.am: Add new files.

13 years agohttp web server impl ignores SIGPIPE
Andy Wingo [Mon, 29 Nov 2010 12:00:43 +0000 (13:00 +0100)]
http web server impl ignores SIGPIPE

* module/web/server/http.scm (http-open): Ignore SIGPIPE. Keeps the
  server from dying in some circumstances.

13 years agostub fixes to http 1.0 support in the web server
Andy Wingo [Mon, 29 Nov 2010 11:05:57 +0000 (12:05 +0100)]
stub fixes to http 1.0 support in the web server

* module/web/server.scm (read-client): Fix number of returned values in
  the case in which there is an error reading the client.
  (sanitize-response): Add a case to adapt the reponse to the request
  version.
  (handle-request): Sanitize the response within an error-handling
  block.
  (serve-one-client): Move sanitation out of here.

* module/web/server/http.scm (keep-alive?): A more proper detection on
  whether we should support persistent connections.

* module/web/response.scm (adapt-response-version): New routine, to
  adapt a response to a given version. Currently a stub.

13 years agoSome tweaks to the R6RS support
Andreas Rottmann [Thu, 25 Nov 2010 22:03:12 +0000 (23:03 +0100)]
Some tweaks to the R6RS support

* module/rnrs/base.scm (error, assert): Define -- they were missing.
  (assertion-violation): Properly treat a #f `who' argument.

* module/rnrs/conditions.scm (condition): Use `assertion-violation'
  instead of the undefined `raise'.
  (define-condition-type): Fix for multiple fields.
* test-suite/tests/r6rs-conditions.test: Test accessors of a
  multiple-field condition.  Also import `(rnrs base)' to allow
  stand-alone running of the tests; apparently the `@' references
  scattered throughout the R6RS modules make the libraries sensitive to
  their load order -- for instance, trying to load `(rnrs conditions)'
  before `(rnrs base)' is loaded fails.

* module/rnrs/records/inspection.scm: Use `assertion-violation' instead
  of an explicit `raise'.
* module/rnrs/records/syntactic.scm (process-fields): Use
  `syntax-violation' instead of bogus invocations of `error'.

13 years agoFix `regexp.test' when the "en_US.utf8" locale isn't available.
Ludovic Courtès [Wed, 24 Nov 2010 22:38:01 +0000 (23:38 +0100)]
Fix `regexp.test' when the "en_US.utf8" locale isn't available.

* test-suite/tests/regexp.test ("nonascii locales"): Move `with-locale'
  within the body of `pass-if' so that `unresolved' is caught.