tests: Use shell constructs that /bin/sh on Solaris 10 can understand.

Partly fixes <http://bugs.gnu.org/14042>.
Reported by Marc Girod <marc.girod@gmail.com>

* test-suite/standalone/test-language: Use a shell construct that
  /bin/sh on Solaris 10 can understand.
Manual: fix 'my-or' examples to use let-bound variable.

Fixes <http://bugs.gnu.org/14203> reported by Nikita Karetnikov.

* doc/ref/api-macros.texi (Defining Macros, Syntax Rules): Fix
  definition of 'my-or' example macro to use the let-bound variable.
web: uri-encode hexadecimal percent-encoding is now uppercase

* module/web/uri.scm (uri-encode): the hexadecimal percent-encoding %HH
  is now uppercased as suggested by RFC3986:

      "For consistency, URI producers and normalizers should use
       uppercase hexadecimal digits for all percent-encodings."

* test-suite/tests/web-uri.test ("encode"): update tests.
Print the faulty object upon invalid-keyword errors.

* libguile/vm.c (vm_error_kwargs_invalid_keyword,
  vm_error_kwargs_unrecognized_keyword): Add parameter.  Pass it
  enclosed in a list as the last argument to `scm_error_scm'.
* libguile/vm-i-system.c (bind_kwargs): Adjust accordingly.
* libguile/eval.c (error_invalid_keyword, error_unrecognized_keyword):
  Add parameter.
  (prepare_boot_closure_env_for_apply): Adjust accordingly.
* module/ice-9/eval.scm (primitive-eval): Likewise.
* libguile/error.c (scm_error_scm): Mention `keyword-argument-error' in
  docstring.
* module/ice-9/boot-9.scm (keyword-error-printer): New procedure; use it.
* test-suite/tests/optargs.test (c&e, with-test-prefix/c&e): Remove.
  ("define*")["unrecognized keyword"]: Test the value passed along the
  `keyword-argument-error' exception.
  ["invalid keyword"]: New test.
* doc/ref/api-control.texi (Error Reporting): Update `scm-error'
  description.
Report the faulty keyword in errors raised by `scm_c_bind_keyword_arguments'.

Reported by Mark H. Weaver.

* libguile/keywords.c (scm_c_bind_keyword_arguments): Use
  `scm_error_scm' instead of `scm_error'.  Pass the faulty keyword
  enclosed in a list as the last argument.
* test-suite/tests/optargs.test ("scm_c_bind_keyword_arguments"): New
  test prefix.
Fix tests for 'scm_c_bind_keyword_arguments'.

* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (error_handler):
  Remove function.
  (unrecognized_keyword_error_handler, invalid_keyword_error_handler,
  odd_length_error_handler): New functions.
  (test_scm_c_bind_keyword_arguments): Use new error handler functions.
Allow #f as timeout argument to unlock-mutex and SRFI-18 mutex-unlock!

Reported by Chaos Eternal <chaoseternal@shlug.org>
Based on a patch by Nala Ginrut <nalaginrut@gmail.com>

* libguile/threads.c (scm_unlock_mutex_timed): If 'timeout' argument
  is false, interpret that as no timeout.

* doc/ref/api-scheduling.texi (Mutexes and Condition Variables):
  Update documentation.
Define `AF_UNIX' only when Unix-domain sockets are supported.

* libguile/socket.c (scm_init_socket): Defined `AF_UNIX' only when
  `HAVE_UNIX_DOMAIN_SOCKETS' is defined.
  Reported by Eli Zaretskii <eliz@gnu.org>.
tests: Use double quotes around shell arguments, for Windows.

* test-suite/standalone/test-system-cmds (test-system-cmd): Use double
  quotes around shell arguments.
  Reported by Eli Zaretskii <eliz@gnu.org>.
tests: Don't rely on $TMPDIR and /tmp on Windows.

* test-suite/standalone/test-unwind.c (check_ports)[__MINGW32__]: Use
  $TEMP, $TMP, or / as the value for TMPDIR.
  Patch by Eli Zaretskii <eliz@gnu.org>.
tests: Skip FFI tests that use `qsort' when it's not accessible.

* test-suite/tests/foreign.test ("procedure->pointer")[qsort]: Wrap in
  `false-if-exception'.
  ["qsort", "qsort, wrong return type", "qsort, wrong arity"]: Throw
  'unresolved when QSORT if #f.
  Reported by Eli Zaretskii <eliz@gnu.org>.
tests: Remove symlink only when it exists.

* test-suite/tests/filesys.test: Delete (test-symlink) only if it
  exists---i.e., not on Windows.
  Reported by Eli Zaretskii <eliz@gnu.org>.
Augment `.dir-locals.el'.
tests: Don't rely on `scm_call_2' being visible.

* test-suite/tests/coverage.test ("procedure-execution-count")["called
  from C"]: Throw 'unresolved when `scm_call_2' cannot be resolved.
  Reported by Eli Zaretskii <eliz@gnu.org>.
Fix #ifdefery for `setegid'.

* libguile/posix.c (scm_setegid): Change to #ifdef HAVE_SETEGID.
Fix bug in remqueue in threads.c when removing last element.

Reported and debugged by Andrew Gaylard <ag@computer.org>.

* libguile/threads.c (remqueue): When removing the last element from a
  queue with more than one element, set (car q) to the previous element.

* THANKS: Thank Andrew Gaylard.
psyntax: ((@@ primitive NAME) ARG ...) in (guile) module is a primcall

* ice-9/psyntax.scm (@@): Recognize new form, (@@ primitive NAME), which
  in operator position expands to a primcall.  This expansion is only
  available for forms in the (guile) module.  Added an argument to @@
  and @ procedures, the module, for use by expanded syntax objects;
  adapted callers.
  (analyze-variable): Error when accessing a primitive for value.
  (get-global-definition-hook): Primitives are not macros.
  (syntax-type): A form with a primitive in the car is a
  primitive-call.
  (expand-expr): Residualize primitive calls as primcalls.
  (syntax-local-binding): Return 'primitive as the type for primitives.
abort-to-prompt* instead of @abort

* libguile/control.h:
* libguile/control.c (scm_abort_to_prompt_star): Rename from
  scm_at_abort.

* module/ice-9/boot-9.scm (abort-to-prompt): Use abort-to-prompt*.

* module/language/tree-il/primitives.scm: Handle abort-to-prompt*
  instead of @abort.
Remove @prompt memoizer

* libguile/memoize.h:
* libguile/memoize.c (MAKMEMO_CALL_WITH_PROMPT, memoize, unmemoize):
  Remove the @prompt memoizer in favor of recognizing call-with-prompt
  primcalls.  Rename SCM_M_PROMPT to SCM_M_CALL_WITH_PROMPT, and pass a
  thunk instead of an expression so that it has normal applicative
  order.

* libguile/expand.c (PRIMITIVE_REF, PRIMCALL, expand): Produce primcalls
  from forms whose car is a primitive.
  (expand_atat): Recognize (@@ primitive FOO) as being a primitive-ref.

* module/ice-9/boot-9.scm (call-with-prompt): Instead of dispatching to
  the wonky @prompt memoizer, residualize a primcall to
  call-with-prompt.  The memoizer will DTRT to allow call-with-prompt to
  be interpreted correctly without needing an additional binding.

* module/ice-9/eval.scm (primitive-eval): Change the 'prompt clause to a
  call to call-with-prompt.

* module/language/tree-il/primitives.scm: No more need to recognize
  @prompt.

* libguile/eval.c (eval): Adapt to SCM_M_PROMPT renaming to
  SCM_M_CALL_WITH_PROMPT, and apply the thunk.

* libguile/throw.c (pre_init_throw): Adapt to scm_abort_to_prompt_star
  rename.
remove @apply memoizer

* libguile/memoize.c (memoize): Recognize a primcall to 'apply as
  SCM_M_APPLY.
  (@apply): Remove @apply memoizer.
  (unmemoize): Unmemoize using "apply", not "@apply".

* libguile/memoize.h:
* libguile/expand.c (scm_sym_atapply): Remove.

* module/ice-9/boot-9.scm (apply): Re-implement using apply primcall.
  Use case-lambda, so as to give an appropriate minimum arity.

* module/language/tree-il/compile-glil.scm (flatten-lambda-case):
  Compile a primcall of "apply" specially, not "@apply".

* module/language/tree-il/peval.scm (peval): Match primcalls to "apply",
  not "@apply".  Residualize "apply" primcalls.

* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
  (*multiply-valued-primitives*): Remove @apply, and apply primitive
  expander.

* test-suite/tests/peval.test:
* test-suite/tests/tree-il.test: Update tests to expect residualized
  "apply".

* test-suite/tests/procprop.test ("procedure-arity"): Update test for
  better apply arity.

* test-suite/tests/strings.test ("string"): Update expected error.