guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, wip-manual-2, updated. release_1-9-9-8


From: Neil Jerram
Subject: [Guile-commits] GNU Guile branch, wip-manual-2, updated. release_1-9-9-84-g26b9f90
Date: Sat, 10 Apr 2010 12:34:47 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=26b9f9090073c896762af3125af54958e153f8f2

The branch, wip-manual-2 has been updated
       via  26b9f9090073c896762af3125af54958e153f8f2 (commit)
       via  96ec2c9c65468b1404865371d19342d6badb0be9 (commit)
       via  2860ff4675cf1a47c28e1defe094894622d046b9 (commit)
       via  92a61010bd04dfa81ac94b32e40d0e7a6c932845 (commit)
       via  474060a23ccd7db9784a99912ec505f796ac12e5 (commit)
       via  cd038da5467d6e4cc2f04a4ebd0f915b62359781 (commit)
       via  54e53aa4301bcb8aaff0a5dfd4af044ee693f235 (commit)
       via  7c4aad9cc7143ea7c1a7ce3c143ca0581cace5b5 (commit)
       via  c1b7c940eca528d8875bc9bd00fba1a885b4dddb (commit)
       via  92e19ec06d490a95e9550c634c922f67e42140d6 (commit)
       via  0becb8f316137e6823b2652a33b7212e02722782 (commit)
       via  01ad5a7ba9edb5d8c96567ed80ea1a34019c5338 (commit)
       via  4551e860f02244ffb3858c941319f1613bac40e4 (commit)
       via  b577bc90bbaadfac508acc809e59b983db33b7aa (commit)
       via  1606312f9a1200950336d485bd29866c0f8e3942 (commit)
       via  6c76da4c32dd8a2c1f38d51df6e58dcc0b7cee11 (commit)
       via  e39d0b76684ae8e6f2bffa511e28ff2c2d44a106 (commit)
       via  1a461493a33d44f41a7d5245df142ef000c09db3 (commit)
       via  9225df3c551c9b28cf16f5c4aab8cf1183f44577 (commit)
       via  8f44138ac6c91d9e20c3557ee6e5389900a7730e (commit)
       via  de9df04a0ce8b87e5843b0fcdfcf105437618492 (commit)
       via  e48a2f8705623e23c21dca5bb38ab437d82b39e4 (commit)
       via  f5318d8b188c6636d1f593bb1d2690ba1b0a42e4 (commit)
       via  4d75554d0a2ed446c1fd7a75f5b69355c5109bcc (commit)
       via  d53e5a7edb091255c5026d6e194f4885a32e769d (commit)
       via  fb53c347a6794b2b8fd7419269633b1f28e31b25 (commit)
       via  a34a2022c8a1e363faaeef2f0d3fb9c1eb9a6f12 (commit)
       via  b9264dc5f3c2c9341852b898bd3eb8587dbd20f3 (commit)
       via  71725997c756e11e434983a8a19b4b205dc4265a (commit)
       via  dcc69bab8c410a15529f9b7bcaf05cc138b23438 (commit)
       via  119682690ff5f6f5eb25272f1a1b34ac3a7d6746 (commit)
       via  897bf7b0f756e7a5e8c016f7cf77ca84d135a1db (commit)
       via  6d30df5dbd4080c08d606c9f2b21672d47f04203 (commit)
       via  43cd9cec2320b0fad4e04410226b319918a57f35 (commit)
       via  726b8ba3fd5de26d5eb8c6567cc0b15bc1a7193e (commit)
       via  7b702b5391fb54114307636934e4d28101655093 (commit)
       via  a587d6a97338a0fd62173e60581ff07f55ec2042 (commit)
       via  92d33877d9f8523eaebab75373a30f161e6cc1e8 (commit)
       via  8ecd1943ef7bbef67b83b0502da1527e3b7a7133 (commit)
       via  e275b8a220f39b5a1ff9644ac21796a12e4d0c9a (commit)
       via  28828f40eb8ea7e10e35aa1e83ebf37449350c08 (commit)
       via  cedf24d8bda2439fa0b6de74a6fa4b8105d96004 (commit)
       via  0ecd70a2714c184b57aa92c6c061c0ee7b51df79 (commit)
       via  bd7131d3adf60b98837bd8bc3711ec7cf9069569 (commit)
       via  2115b8eb408d8f965d3c0d28cb087e55f0eb5daf (commit)
       via  1b10152215db2ed381bd63c8c234eb44eb7ed414 (commit)
       via  3ffd1ba96e986581d97079308fc15ef1fc933cdb (commit)
       via  d26383f427245e088401f53af64b44062750925e (commit)
       via  9d031d4d575ac8f343a5d984cb02cd374577c5a9 (commit)
       via  6128f34c4b6ae713c4dddc38093aafe7260ccab6 (commit)
       via  2533f10b40cdab357140347fe05e291f02bb5cb5 (commit)
       via  d38b431ace4b01e5da9cb09bb6341277f2974160 (commit)
       via  655aadf4b09c40f4c7854e4325e8809fcb7cb36b (commit)
       via  0eedfa5cab71cef05e2b9f06d6286d3b8f04ca59 (commit)
       via  4e974a1a6d2c0d749bc87bf1b77a519da3e1fe85 (commit)
       via  4f08d0b50fffd3d35ea5be430e6ae4251ea53baa (commit)
       via  a5e95abe9b502e4c08d6762b1f4754fa9cdf2371 (commit)
       via  f60c2c4e100b36e5ec2616ba7940280b57d952b9 (commit)
       via  98dcf051e00bb0b36b932b60e5bdce584f2acde4 (commit)
       via  83a7b43bf2bf445af9d2611252deaacb4de7095e (commit)
       via  1f51e2757c0c6fc4a963c6f46578241e84be871e (commit)
       via  3785c5b27645c5b0c5124b1bfc31533f80764856 (commit)
       via  dca9a4d68556479a25d0e26fb8ac45c0f872efcd (commit)
       via  1ea8aa7d8e980ce0dc17938058d4665b0c1193b9 (commit)
       via  df0f529585e55007e2a2226f624b55e986722d37 (commit)
       via  165a8643ae1c9e8d8eceba2e33a9586e9863ea8c (commit)
       via  a2c6904911577b51c2486ad7115a4311524d4a96 (commit)
       via  7f10a113c5f370071647c23b21b912ecceef3a50 (commit)
       via  8a73a6d2943ee081fa0497cd37abcc2f72ca9164 (commit)
       via  6ffd4131ffa11d0a91cc555641f40457fd2ba7d0 (commit)
       via  1fc8dcc7ac6a83ae6586e02491784954e3be94ef (commit)
       via  a6e60a9571711cf90ec9cf547125cb1495e58bca (commit)
       via  fbda9ef1b24d70edd3ebab0f9e8a29b8fdfba852 (commit)
       via  d6ed9b92c5a9bcc6d7a5203034a78c15553d1b0c (commit)
       via  e4955559c6f541c32811c5caaa9b0224abb2c85a (commit)
       via  ef7e4ba373fbd68ea87c4ba1541a58b38bec12b3 (commit)
       via  f4c79b3c08b4b16f504a049b2ef14a238e94508f (commit)
       via  54eb59cf4948482461e41f73c0a5b1f9c7081326 (commit)
       via  5595bd76414e50834b293ead7fd67a54fe56c563 (commit)
       via  d12f974b4389f11a2f5fe47f6ca786514cb3bbc9 (commit)
       via  dd1464bf38c5e2dc71652b62f63e4bcf93179a14 (commit)
       via  3023e7b0c90081f0060cb78a4a534ed7cd77c9bf (commit)
       via  087aa6aa312a8d0af51fa9b2f7bfc1332ad97338 (commit)
       via  b0abbaa74a036242a8d727432c82ee95a6bf5a8b (commit)
       via  71fada0b6d6106b173bc06b2de5959b039c909e8 (commit)
       via  17ed90df4896a0648d5b6f0171a45ba181cbd68f (commit)
       via  718815d7618fe7766f3620538917849ccc93f36f (commit)
       via  44602b08680ad6422dd88780c23540c0632bcc68 (commit)
       via  89607fab50ed88dff3b6fb5310a6753da8dbaa97 (commit)
       via  462bcfd03847a568b34074ba6fcf4f7f4de3c0fc (commit)
       via  dbf499823f29dcb3329eec8e00ff22762f6b5d49 (commit)
       via  f7cea64566407151de4ff665ec787fca927b908f (commit)
       via  db5034ab89426edacf5229e7e6b37cb0495cd287 (commit)
       via  9823fd399c4addd852409c20e3112e62dca0a937 (commit)
       via  deec8986ff889724a6fa3fdd9d5e7221473956fe (commit)
       via  d3b5628c6de88ee08787aab5b1af96f913b77ed4 (commit)
       via  f11871d6c557e706b80e7fa6c0c1f1da854fe1c4 (commit)
       via  7e08f8a6c16ef88ecca8895e81219b040593c212 (commit)
       via  42ee0d00ba61e51a5b4a9f2d59e6f95b52e49dbf (commit)
       via  42cb9b03111ccddb4abcf25004c4bd8bd069390f (commit)
       via  5c43d9c78388a3545bbd841f6ab37f6c3adfb4a7 (commit)
       via  8137c9d5e7c176d04c5bd81afa00186268df16bc (commit)
       via  9d832dda456c84551034a3624470281222a72099 (commit)
       via  0f7e6c56cd3d1a070ea4b469368d9c2f6f492538 (commit)
       via  06dcb9dfb663169ce612bca241e5438c73bfa5c6 (commit)
       via  01c0082fae4ce3b0c09f003a2141c38cfc062d74 (commit)
       via  32ce4058db1adc319dabf6f93143cb367f7456fc (commit)
       via  9f0745183605c4f2997b95c421637678ca5e5e2a (commit)
       via  c6a32a2cd59190dcf17c7fb3022588f56079a03e (commit)
       via  8fc43b12c71789030d9058fea8b6eff5490dec27 (commit)
       via  a6cd35551023d72703cf05a98e42e9dd6a75d48f (commit)
       via  5c606217a4bdd2e918d224b12fe576eff4e561c7 (commit)
       via  5af3378aab5b32bd82bd93d9a789c97e553a1356 (commit)
       via  ba7e7139b3adbf4cf7683edc31097535d3cd7e56 (commit)
       via  1caa6341b0832ebe2173ba16d6132fa79b042d9e (commit)
       via  bd5a75dcd8436ebe077c9ce52300d013e9519d94 (commit)
       via  c02924d02b4b78998b380deb20a4fd2d5fc3cfbb (commit)
       via  e2cf8eb921a4dd12af5024861e2b2bfc0b90a1ed (commit)
       via  b7ecadca7b84a5c9229001354f7b902ef94b5ac5 (commit)
       via  83a7171bf369d67a5cbb48568ba9727600e72a11 (commit)
       via  eddd16d782343fbc10818e4f2ee706774921f051 (commit)
       via  2150e9a84a9e0e9f83fa7af2c08c274ebcd9b1c2 (commit)
       via  2b2746a831b5f74773d6eec91d2c30d43831e826 (commit)
       via  bbb2ecd1d1966766aa5f3fed7d5084b46cf1e8a7 (commit)
       via  dec84a0a6e164d7c92982ea78c27e85df56ed477 (commit)
       via  87bc7c81650fef2ee8bc83bceab6ea565a47f2b5 (commit)
       via  d332d84610f1ae8dacd546d974287c9279a64428 (commit)
       via  1c242b37f0dda6e82e3cafecd6f28a7df1841d77 (commit)
       via  c45de346fd40a296b6c2519af1c807df968b9e05 (commit)
       via  f5147c84a2228b5f23608aba4319b3fa4b7a432c (commit)
       via  54096be7528be999a5eb1b393922c331880128ae (commit)
       via  05c51bcff5604d520c9335cfbf91eb4bf84003ed (commit)
       via  a5c96cb99dc060a254887e2182f01911a4a19d77 (commit)
       via  da7497e0fd5d8a95f3918ec820eab3feeb75237d (commit)
       via  dc327575a8564257d8b84d835d72bc4fe098ba46 (commit)
       via  3278efd3fa3fc106da5c5b704b26f35e5ec16ac4 (commit)
       via  b8ed3de36e56bff0ffab2000b9ba55c585a4bc0e (commit)
       via  d900a8557db21641413db8995a7cdc1453adbe1f (commit)
       via  69c9600678e67a51b258f2e3cfe1b5e0f842b45d (commit)
       via  d524964774508a2cf3ad6ad1cd7b08bec6c7eeb0 (commit)
       via  a2f7536db02edeb7edb66c2deba83bf22eb9e2ca (commit)
       via  adbdfd6d2418b1404af48d480c2273f501517d6e (commit)
       via  416f26c7534a018c59f1c8d888dc9153f42d86d1 (commit)
       via  e10cf6b9c7e54c79db4de74584f1b0b65847d4fc (commit)
       via  d296431516dbf14535fc6eaba551fede19c09772 (commit)
       via  b8af64db76bc602517be300128be0dfb67fac89f (commit)
       via  da7fa082e80b2c3989c90031ee5356e5b65bd00b (commit)
       via  1371fe9b149da699320567e5160160169ecdb0be (commit)
       via  b3950ad6d88c5675dadb74c8ce5668daaa1b8692 (commit)
       via  35ac785286a527449b9866b4b9adb78a41e545a7 (commit)
       via  ce4c9a6d00a647892e25d24d703f328afb4be9c3 (commit)
       via  0404c97dc904272ec8a55cacbe639dc52de2830e (commit)
       via  c8df99730a6d2eaaaa6bd1216c4c7394a691ee7f (commit)
       via  211fcbc8cdfb0834a6675dc8454994472ed7ce3f (commit)
       via  3ccee39194a2ae967eb12dd9c0adceeddb305646 (commit)
       via  29366989cf19c844c8d46e456da03466db534ddf (commit)
       via  9a1c6f1f0c6b07725a240160b79acc54303d7891 (commit)
       via  078014374c066f03975bd0ef008877c5236c75ec (commit)
       via  6d804376e94d17cf013a415c4bd98d632f7a91b9 (commit)
       via  ac644098bf1573cfbb4ee032e6cd32a23ca168b6 (commit)
       via  cee1d22c3c10b1892c82a5758ef69cd6fc9aba31 (commit)
       via  76e3816281cf6c406ef6f01907ce29401c8ff455 (commit)
       via  2d026f04cc581915f62b1f2f3be2f27026ee383e (commit)
       via  f828ab4f30b974c0f839fb6df9590c16907b7a0a (commit)
       via  47ae4ac8f478b09bc33ab05d896826bc8f6dd2f1 (commit)
       via  747022e4cb5faef6e0a2c73f046bacd93bb99ab8 (commit)
       via  0bc8874c0461d532ca0251cf20af9bc5193b3cfa (commit)
       via  eaefabee34506324ecb1470ac5a4ba774381d038 (commit)
       via  ea6b18e82f3ac2122d07c80bc0f320ea839a25b6 (commit)
       via  f5b1f76af492f3c398527ee040e8bf09fc438a9a (commit)
       via  706a705eca032f84562ec84ac439b3d4a7ca8c66 (commit)
       via  1e7a0337f1180343ca2f81557bfdeb78e23cd532 (commit)
       via  5ef71027e49ba870556be194e177fa09b2ff306a (commit)
       via  26e6f99fc3543cd4aa24d2d96126ae025f61ab28 (commit)
       via  6e84cb95b18d81ef7a8490cccdfb08d3f88116ea (commit)
       via  07a0c7d5d9523936d5fe4cac595bd75859416c9e (commit)
       via  bcbbba866b56460d097dba17e0dbb0c53d9f9211 (commit)
       via  67a78ddd8381ccf098b52659897a4d40806a0928 (commit)
       via  6360c1d4c1f7d3bb43afa4f71d1d92bbf37fd845 (commit)
       via  b50511b4753240ddeb9f0823c9401d8ad32ae055 (commit)
       via  e084b27e7913acf6e9414d1ff46f0bd9442e71fd (commit)
       via  d7c53a86954e16f1d6c76cab2c41889ba9133488 (commit)
       via  bb0229b51d53c10164f58cebbeeed85cd9dfe0b8 (commit)
       via  27bd1deced05d096915d47c6ea46d3b22d692e19 (commit)
       via  8da6ab34bd23f27eb257936925cf81e89c26ff4e (commit)
       via  c08899ff24932b96573093d490160591e446b8a0 (commit)
       via  f3a8d1b745285a9667041c09f4ac6d5ff738570f (commit)
       via  2ac16429ab5a3e894f242a50a84526e8bd7d2391 (commit)
       via  b5e9f3f97ebad910b932736f7b65bbf98083dd49 (commit)
       via  21ec0bd9077b2fc109f1f425462eca37ef4a34e1 (commit)
       via  d69531e21326dbec935da6ead29335f2cccf1a3f (commit)
       via  ac1ef09bfee23177052aa157f8cb049ae8dbd64e (commit)
       via  dde9c5a431c67a16febf000d011172c65883f49b (commit)
       via  44d70904a6ae93e0a844dedf65b2f84dc93a5048 (commit)
       via  691b9ec196203fa5d6da3530d5355b2f73e707d1 (commit)
       via  dbd9532e89d8aaed76fbaaa3a11388f6a4e9aefe (commit)
       via  127f5c624d16f33da72a56e75a38912e06346113 (commit)
       via  f353687c688d20c9e8f42383d7f2e820a8834159 (commit)
       via  d2add8ae1164e2bd482a5c419e3c90211a8a312a (commit)
       via  a104b81cc40b5ff321605ca3731103bbd0e98894 (commit)
       via  f75c5849cdc6c863616facbb22b28d08da3fc09f (commit)
       via  3ef9fa53f9e2b5fc1d0419a94432318e9ca9d650 (commit)
       via  04af4c4c5221c082905d52eb5ad3829ed681d097 (commit)
       via  2bfa4d5ccd3294988c0e64ec464493a4e9facd1d (commit)
       via  56d288b8445be2d3b2e23a95d4943a11b291e724 (commit)
       via  2b386ab09f8b583ba0547bf06ebc57c78c3bea51 (commit)
       via  8a8da78d97ffe779a1baa1098ed9497c5021759e (commit)
       via  44d3d1114447ee619bc9a900afb410273b56aae2 (commit)
       via  3ea159afc5c476e06148cf5fc2a1fb77267326f6 (commit)
       via  3474222a65b7d4cc02b43bcd8abcadbc7ec5258f (commit)
       via  25bc75c4316497c95b1c3fc17f1678ac47d32041 (commit)
       via  2fe5eb561c02ceda6e9244e14c68b2072fb94eb5 (commit)
       via  40ff484d80ef3bf3706262e6fcc5178e8239f60d (commit)
       via  55ae00ea73e5698d64c31118717c15e6dd9cafe7 (commit)
       via  61cd9dc907b8a09990b14e9aeac7e20fe77cecc6 (commit)
       via  60b6a84f0f2d8d43491835a518463f4a8273bf87 (commit)
       via  4adf9a7e2750593e444a2c7d950e194294242896 (commit)
       via  acbccb0c834e3d28d14c60c98c730969edcdfbcc (commit)
       via  524aa8ae6830d0f471f0c86431d5da87c8a0a534 (commit)
       via  dad6817f7d9581264891c6ad8954369d01f3d0b7 (commit)
       via  bde92e6b3bbd15c7abaf29bc0557041b88df8d74 (commit)
       via  0c368d2b2811fb856c9551e7ad217f8e5636024f (commit)
       via  d8873dfe4754daf031a6709738bd31afa8edb443 (commit)
       via  269479e31f70d40a82b75be87c1b2a7363c85696 (commit)
       via  997659f898d94abccdcba3c444b84e3c6f6e963e (commit)
       via  babfc7b2c3fce452aa12fed8d89cd3fbc81e8cc8 (commit)
       via  1d1cae0e2e063d9a36e7d600f87cf3d6eaf940f3 (commit)
       via  217167c6b2e6e400306c8cb4a0bff86c17eef28c (commit)
       via  adaf86ec49959f6df55947cf69ac98d6bf1074f7 (commit)
       via  69f90b0b051e77257a753f1ee7ae6a18a1147c78 (commit)
       via  a670e672119ac2fb2f6a5b09e0908c07fd7864eb (commit)
       via  df685ee46b672c9fe1c3fa813e9406a8dcde9b81 (commit)
       via  04ea6fb504b7339f0432b88b8137e5ac455d2309 (commit)
       via  5cbf2e1d7b3d744d92e279801f07aa05d1799da3 (commit)
       via  22ec6a31eda1f06270fbba4b6aae45bb81de0631 (commit)
       via  30a700c8c12aeaefe3cd5fb85ea3c1b7059705bf (commit)
       via  61cbfff50979136f03ab161711edc5eb21145609 (commit)
       via  9b2a2a391a96070af3e69335f069302f3a08d44a (commit)
       via  b9c100d008bbaa19406fdee3058a5c35dba07499 (commit)
       via  9b7ca73cfe4d6f82811d5dac8706237690834287 (commit)
       via  c6601f1077b079d04a377164dbe1fb70bb2b0979 (commit)
       via  2d9260d12c5b2ecfa29f86c94eeec9ae21cd908e (commit)
       via  88fed05d033263aafd119133aee47cd8028128ae (commit)
       via  282d128cb4553cd7541bbbd3b0cf6f3b3f223ef7 (commit)
       via  1bf78495e90d65911c9e012764deab589640f883 (commit)
       via  1c297a3850b0b4466e5b986168c02f455c49cb1b (commit)
       via  4f66bcdeff1f5e3d1dd44d745188b91942b04d33 (commit)
       via  17d819d4c43701e0e0e92f6c2001343d4730db83 (commit)
       via  3435f3c07c27c62fcd0a6112243a27ea4ae7b462 (commit)
       via  663212bbc66b616cca9ba55d9992e2fb339d8250 (commit)
       via  d27a7811db7947bb9bba536303702c8906219165 (commit)
       via  0515661235e3c17935b918565c70145d7895d37e (commit)
       via  80e22004bd01a719578997f333aa09d907a450e4 (commit)
       via  c612ed59ab3ba92a0b778d30f21c493341160df2 (commit)
       via  75383ddbd77d5981e5ab4ac72818b96d391c9e22 (commit)
       via  70ea39f70f54e82fc38204ac5f7768505cc37dff (commit)
       via  9a396cbdbea984f8265e760f64414e8e712e49ab (commit)
       via  37371ea1ba160e2eb61fb3415024ef8e79b2e502 (commit)
       via  4d9130a5b733e844e42f27f209e148fa64f731be (commit)
       via  d8b04f04e90882f3903092ea85038a9e3cd10d39 (commit)
       via  827dc8dcb61dcbdd62ad1ae41b98d65ecd8d5b66 (commit)
       via  20aafae22a4f11289b65dba685495a808ebd6b07 (commit)
       via  ab4779ffcfb463201d46459e06b9188dd5f1cbda (commit)
       via  52fd9639fdeee068434342e1bdb8693b05ecac5c (commit)
       via  75c242a256c273ab0690397df4277d44f01946e6 (commit)
       via  e03b7f73e2927178f2d9485320435edb6260c311 (commit)
       via  bb190ddbba216251f2a8490adf9feadf0dbb7104 (commit)
       via  227eff6a77dd58d64775fe91ae0f1596bfe3371b (commit)
       via  d31b95195168ded0d3300159403adb2c4917e291 (commit)
       via  2ff9bf8522c5f8981af5fd524769733ac1e3e8de (commit)
       via  a752c0dc2798fb1af93d56f6f73bea964df12633 (commit)
       via  696ac4dfcc4e48c95df8935fc3640377c5df18fb (commit)
       via  01e74380f6170b5cb1105e5df9a368ab257420ef (commit)
       via  aa42c03669df8acf997d3108f08ce94d5d7611c2 (commit)
       via  0e64cbea3d22411564af302a63b670fe0617ccf3 (commit)
       via  73d1aaafb226b5e386b6b2eeacc40b836ff85940 (commit)
       via  a70c0ff578712ab8170aea0d2fb0d9b53cee8c5c (commit)
       via  6bf927ab6ea9232b4678bb6b99ef9dfa23a62941 (commit)
       via  788cf402394a4bedc1c4e6bb97b22a2e33226450 (commit)
       via  baedef98eeee0357983ce9730b102be6b2158029 (commit)
       via  d532c41b91a53a5559de42bf15a3980b8f041677 (commit)
       via  912a8702466f07ca3f4c673a895361e5d7775b7b (commit)
       via  adfb42846617f6ed11cbe6ca9f0256e48a0cbb49 (commit)
       via  5b6b22e8ead58068d9085bc72d2a719f7cbfd3b7 (commit)
       via  67af975c0be6e0e00e19967acdbc1c69497398f9 (commit)
       via  d85ae24dfb96997ce50ece2eb06a33a997313640 (commit)
       via  7beae9f15ac49f144a15d3ebfe80c2f29e43b3ff (commit)
       via  870d7a2b4f397a4619553b0f9798b6e8b3ed173e (commit)
       via  445f31fc06d338f0cafda188d0287f935c2edc3c (commit)
       via  06bfe276c8bfd71cf601761659d6b20acebc23b8 (commit)
       via  f826a8864a4ec7bfffac0f67d45f8ce0085e9d23 (commit)
       via  5afa815c9cd4550bf93181bc0ed0134aa83dfc5d (commit)
       via  e1138ba1995f970083ad752f1ff8f71876483194 (commit)
       via  7055591c2e9ba97b9a5d1c15a3b7e1ce409966f5 (commit)
       via  f207859b0be606ea77d488262e2b8d114c9ae370 (commit)
       via  7ea3e4ff28fb02b0c82a2e304ba8d958528bc2ae (commit)
       via  45cc48673a75c8318d2e6ca3651d94e64a08ad47 (commit)
       via  7e9f96021ac200f2fe5b25f4e02bd11b3331fb34 (commit)
       via  a8fc38526a3e8fb9fef00042e1acc5b4a80b3f3f (commit)
       via  bd4b6c1a83a857f48e63fd64c276c77457c41bca (commit)
       via  e744e076fae41492fb990bc32594d9daf2908094 (commit)
       via  6ea3048785915947a24305f0cff88f7b903182a0 (commit)
       via  898a0b5a2ec6141fc408bef3d93e040870386de8 (commit)
       via  2e85d145fc44b49bceaec3ab95da43688f8db0f4 (commit)
       via  dea901d66e46041f96d3d3a0f95bf0ab209387c9 (commit)
       via  8470b3f45b48bf627642e8f41938492be4eacf2c (commit)
       via  7aec4ce019555b0c7113c585fda4a7ef18b84b5a (commit)
       via  0d782201bf5c23725db77c3d3d0e9bd959b1268d (commit)
       via  e30f5b7d4032f79eb3ecdb0a11de37486221845c (commit)
       via  e106eca674288661ca6a2b7352ed082cbcda1b12 (commit)
       via  f3a1fc5a9ec0cea5dcd6e505bf9a440ee3651891 (commit)
       via  136b5494d13fdc4a7b3b59d4bd451beb2c075e25 (commit)
       via  3b12702faf0fa42890e4c857aabda3e6d5eb5c83 (commit)
       via  dfe13aa2c82371dad3b455e79e295a21b50d4992 (commit)
       via  c6a4432bf184bf13a1fd97407103f0c37010b5a1 (commit)
       via  64fa96ef28f98b087bc5844c5d9944145a06e3c0 (commit)
       via  73788ca8bedcb4dd9578a1a992223e51a7d99a0d (commit)
       via  5a9c6dcbb3bdda159cc45edb9d8b34e7b5043b9e (commit)
       via  411313403cac04d1b1b1c7f579da32eaaaf4d80d (commit)
       via  628ddb80aa5b33185e7eff81e72d158936079d91 (commit)
       via  c5661d2860da05b4666c9f4764509034aa7da693 (commit)
       via  e63dda67d70eb4cb92cbc406510a0f21337374a4 (commit)
       via  0ea72faa4e448356665bab3d679d71e0958963aa (commit)
       via  7385dc1243aa9862239c2551d523b1df3fdc63c3 (commit)
       via  bf943698b6f37f35c22e245d6b56df9d19411ebf (commit)
       via  6734191c6822d41920c322d83fa0e17221d95dc3 (commit)
       via  e6251e7bd98fbc64e9dbf489c8afaf426af46919 (commit)
       via  bce5cb56413da437c29628c529cec47649d12eb9 (commit)
       via  bcae9a98b0dd82b7be93e90134a01a03b44b4af7 (commit)
       via  7cd554943b455248f8488f7b70b6dc31fc4cc67c (commit)
       via  67a4a16d8e4418f0525b580c157c1295ca1563fc (commit)
       via  085a61df2ebe26f9555188c452501ecbf349f887 (commit)
       via  15b6a6b284f00fa790ef003a9df8c8ae5a4d7d6a (commit)
       via  f39ede00675f0d7dcdb864e91653c4dacb98e694 (commit)
       via  ecdf15573b4734488893a03500312f18575819ce (commit)
       via  cf8ec359cc0e4a02e11c71f194fc076c6f9168c1 (commit)
       via  4a45769178ee91469c414ccc7a64f529b6ee221a (commit)
       via  2051e2bdbbafd32716e0098a71cb1f5b657a5075 (commit)
       via  4168aa4675174ec74816ed6b7e23518c2b64c96a (commit)
       via  fdcb2b82d7a6fe917f236bdc95a7a231169fe21a (commit)
       via  7c4a6456982254440d4e145fe0b250693a11975e (commit)
       via  913ddf05745a691c71291aba47fc901fc7ead1de (commit)
       via  fc7648637b356078988ca1ed598e74c394beeaaa (commit)
       via  37e9bc8ae48ae2c014fd4f63fc37b18348d05513 (commit)
       via  391d29029d69704bc6bd541d80209532e582c3c0 (commit)
       via  8217c9251acef6f09fa04e1ead5eaa69b6909284 (commit)
       via  0af34a3f833a3e90edc18223b91fcafebc786275 (commit)
       via  6f16379e9a8d1f2d10c648793582a10772f29e32 (commit)
       via  75c3ed282029f4d2a80adf75f52ec1b9b34edcb7 (commit)
       via  9174596d5bfc456d06f4cf74a7a67e9b2b09aac3 (commit)
       via  a589525d4e1d0e4ce385a01820a7fa6fa9a5030e (commit)
       via  795ab688ee994181d92c2a106fc2408d86dbbbf8 (commit)
       via  c5e05a1c70d7a3db2456677524872a590624285f (commit)
       via  cc7005bc371ee104c368dbb894eb4f8b7a86d64a (commit)
       via  6c2961a01142c7ba9fc03a410004dd696e9208cd (commit)
       via  fd12a19a5e59afbd78ca67b1305c70bb1ecb724b (commit)
       via  97812f4d38b1077c87e8fde02b1d62da6a1a6a06 (commit)
       via  f1d19308ade7f7d115be243650270e8a2a38fc38 (commit)
       via  2be89ca129e078f7e558d07b93ce89bf9ed13a9d (commit)
       via  6f3b0cc29eb1c1dcb2e02058e3db9ab04ca36b42 (commit)
       via  a6029b97ea84d9e9a13d71b21213b6fd0be41e87 (commit)
       via  f3056b42cf2ddb52cdd7de013ada33e4aa953ada (commit)
       via  6c498233a1c6a75fbfc81471b94bdc89306879c3 (commit)
       via  27219b32c740ba55d88697829e05bf58120b86d9 (commit)
       via  a2689737679cf2553c118a1d96de7c9ddfec62b0 (commit)
       via  3dc2afe2b85eb5c7ec784b6ed8b19242e45f6e34 (commit)
       via  5c39373f48f9694a16d1486ab073f4ab229e9c55 (commit)
       via  cf9a806dbd8fc58caafefbb4a5328fac2d322cee (commit)
       via  8ffcf6e725f97a4f3480ef6583743d7786e42997 (commit)
       via  e29dcaf3b7dde40b960455587142e7a79c53bfab (commit)
       via  daa4a3f1ff34840f83705011780d62a5f4a56508 (commit)
       via  a3d7d5d50806fdfb80f44f53c7d990cf79a8d566 (commit)
       via  7b0419128bce68f48a158292430ed4a7202aa1b1 (commit)
       via  29bcdbb05948a5f12d2d8cb36a0c3c582e738be3 (commit)
       via  9fdee5b40b190585f3fac949a366dfcf06ad202a (commit)
       via  fd629322442e3a7131d779a266745ffd05e83c56 (commit)
       via  f318aa1e386a941df1d2cb2f4d82f8337578baa5 (commit)
       via  31a26df2cc91427f0a4281d6ac5a1c0b53a8c0f1 (commit)
       via  d8164b046c71c3f313fa4f7e239d50823b619297 (commit)
       via  9c246c03838c1cc844d15a7c4817029df1994e96 (commit)
       via  9fdf9fd3ea7130fd85eaf0a333a965ac4d2b07c3 (commit)
       via  e809758a7e0f3f63162a0a9064b95bd1c1d10628 (commit)
       via  bab980466108c6c22d2c820213d07b3d1b18c48e (commit)
       via  9f09b127d447991bd749235f78516700a20c7dff (commit)
       via  ea7d717b1ed5ae84812c53dbbc3f399c6ff0b65e (commit)
       via  54cd715022acc06bcf59038d863b1a3ab7e4bba1 (commit)
       via  e773b1e6ce2af1753034cb1065518c2341228008 (commit)
       via  e2c2a6994d05124760ea7f18caf5d28fb47e453c (commit)
       via  208fae8a0ebaa56b69105c89d69e337aef6a3e62 (commit)
       via  2bc8d9eff694d2160a005edecc95cdc088d546f1 (commit)
       via  e3eefae0e596a587e91693ed37a61699ac66560a (commit)
       via  a5bbb22e83fc724650973dab5eb6f3eccbc1f65c (commit)
       via  87a6a23669dc534df5d3de146e77efd3a2bafb22 (commit)
       via  09834e439b685ca3bb4404e40e046b11772fe50d (commit)
       via  edb7bb4766773cffa8262b4cd8bb980888913d65 (commit)
       via  441891f376221d7bcd1f6fc8927595fe25417255 (commit)
       via  0c2a05c3213da8b1269af37d65af3f8bffdb01c2 (commit)
       via  7abb7efd319526bb2260fdcc35440a31dfd5cf51 (commit)
       via  9274c3dd4058b3f63ba97570fc2f1598debbc03d (commit)
       via  2d8c757cf10a22ba708b44e6305f4dbae29b7297 (commit)
       via  1c5e812258da4b002d309f969d722c86004ecf94 (commit)
       via  b8596c08ac2ef2201c1e8559ac5f4d62ebde3d91 (commit)
       via  8c6eea2f1a6fab2d2be4d0de6a6826273eb2c3c9 (commit)
       via  c5f171027d9b237630a71dc43d4b1b3dc391c591 (commit)
       via  a1dcb961a6d819c154cfa5767ce4193f31cf29b3 (commit)
       via  c1ff4aa7866aa7189c770136d19578b1295a6229 (commit)
       via  9a9d82c28caf37278375912d33441e4318d55349 (commit)
       via  b597129782e4e65cbb9b2317b116d83daea0820c (commit)
       via  b521d265b1d02771500527f00704e6c9371a3c37 (commit)
       via  aac006ddec98c96ac5d9e19bd28496f8ff95f0ae (commit)
       via  a927454d25f17a3cfb5c130f26933a76a9a9060b (commit)
       via  b349875146af814dbeac07e96b043a3a3996b7cd (commit)
       via  3323ec063ccc87b210e6da04c57c625af270b230 (commit)
       via  211a5b04251424f17f659257718329af7a3cdc0c (commit)
       via  3e5aed1c3be296b92f3a21e0dfde315deaef9daa (commit)
       via  0ca3a342d19ec89b8ae6bba0a74f0f9ecc5cf7c2 (commit)
       via  d7a4096d251933a21325739fcd32129b073c33ce (commit)
       via  f6fe5fe26b7b64c2d194b1dd27b1bd038e8fa70c (commit)
       via  f6a8e7919755ce15cd75ad01326e02151fa99445 (commit)
       via  1ad7fef5249f409317c20d5242bc3c4c2b8d9d18 (commit)
       via  0dfe0e758890379d625e08d4deffbbbd5822e99f (commit)
       via  dca14012bd9c62178890ff82d29c655ae71d2977 (commit)
       via  78c22f5edc3c74bc50e52d5291ddc5c80c20ba8a (commit)
       via  820f33aaed18b37f68bc4abfeea52df2df3bd374 (commit)
       via  9b5a0d84600b3c86425bba5ea2324334a7ba873d (commit)
       via  737caee88dae8d442950efeee98ea83c1e7db7a4 (commit)
       via  9eaa8fef80b3bf2ece73936fc3c9e5c136df8e78 (commit)
       via  8b0d7b9d94b9f142dc4f08ce12b345321359b3cd (commit)
       via  7656f194465ed50901c9cf3e31a68c3014b576ba (commit)
       via  86fd6dff2a77150148ed7b3d9152e0a431070666 (commit)
       via  700908288cdafd7d68dc2861e2348f38aeb38782 (commit)
       via  a6dc56a71e0085f9e0f889ecbb8b085f6c92da7b (commit)
       via  500f6a47e2609f936d43f47bcce4e429eb57997d (commit)
       via  c55cb58ac15b61eac574d8adafb08bc32f2bc8c1 (commit)
       via  05c29c5abc79bc1ceb7999176252debf0a6811e4 (commit)
       via  c165c50d072105c82c9b15059e756a2cba353dbb (commit)
       via  47f3ce525efcf2aa30abbae0374c19c9f8960789 (commit)
       via  c66fe8a9a0a6b5106c94a4ce6eeda551275dc2bc (commit)
       via  7d94e4af9840c1f273ded31c3a39a6bb6a0496a5 (commit)
       via  d5f9864ffc30701af0e393b692fb0bded8c6a95a (commit)
       via  31c944228ca3694bed59d024283ba236be630f0f (commit)
       via  3c98a49cbdbb36065b23f5a03c695d720d30556f (commit)
       via  fd5985271fee3bcb6a290b6ad10525980a97ef8d (commit)
       via  ef73663576c54d04bd9f1dfe1cdf587515e5cc71 (commit)
      from  3ce5e1304bd77eb167f856a2a163038f01f452c8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 26b9f9090073c896762af3125af54958e153f8f2
Merge: 3ce5e1304bd77eb167f856a2a163038f01f452c8 
96ec2c9c65468b1404865371d19342d6badb0be9
Author: Neil Jerram <address@hidden>
Date:   Sat Apr 10 13:32:42 2010 +0100

    Merge branch 'master' into wip-manual-2
    
    Conflicts:
    
        doc/ref/api-procedures.texi
        doc/ref/misc-modules.texi
    
    (Caused by me removing address@hidden' from a couple of sections that have 
been modified
    by others.)

-----------------------------------------------------------------------

Summary of changes:
 .dir-locals.el                                  |    8 +
 .gitignore                                      |    8 +
 GNUmakefile                                     |    2 +-
 GUILE-VERSION                                   |    6 +-
 HACKING                                         |    5 +-
 Makefile.am                                     |   11 +-
 NEWS                                            |  669 +-
 README                                          |   38 +-
 THANKS                                          |    7 +
 benchmark-suite/Makefile.am                     |    3 +-
 benchmark-suite/benchmarks/vlists.bm            |  103 +
 build-aux/announce-gen                          |    2 +-
 build-aux/arg-nonnull.h                         |    2 +-
 build-aux/c++defs.h                             |  233 +
 build-aux/config.rpath                          |    2 +-
 build-aux/gendocs.sh                            |   20 +-
 build-aux/gitlog-to-changelog                   |    2 +-
 build-aux/gnu-web-doc-update                    |    2 +-
 build-aux/gnupload                              |   17 +-
 build-aux/link-warning.h                        |   45 -
 build-aux/unused-parameter.h                    |   36 +
 build-aux/useless-if-before-free                |    2 +-
 build-aux/vc-list-files                         |    6 +-
 build-aux/warn-on-use.h                         |   92 +
 configure.ac                                    |   65 +-
 doc/Makefile.am                                 |    4 +-
 doc/maint/guile.texi                            |  109 +-
 doc/mbapi.texi                                  |  987 --
 doc/mltext.texi                                 |  146 -
 doc/ref/Makefile.am                             |   34 +-
 doc/ref/api-compound.texi                       |  828 +-
 doc/ref/api-control.texi                        |  361 +-
 doc/ref/api-data.texi                           |  461 +-
 doc/ref/api-debug.texi                          |  322 +-
 doc/ref/api-evaluation.texi                     |   61 +-
 doc/ref/api-foreign.texi                        |  831 ++
 doc/ref/api-i18n.texi                           |   12 +
 doc/ref/api-io.texi                             |   32 +-
 doc/ref/api-lalr.texi                           |   36 +
 doc/ref/api-macros.texi                         |  878 ++
 doc/ref/api-modules.texi                        |  857 +-
 doc/ref/api-options.texi                        |    6 +-
 doc/ref/api-procedures.texi                     |  300 +-
 doc/ref/api-undocumented.texi                   |    4 +-
 doc/ref/data-rep.texi                           |  789 +-
 doc/ref/guile.texi                              |   40 +-
 doc/ref/history.texi                            |   47 +-
 doc/ref/intro.texi                              |    5 +-
 doc/ref/libguile-concepts.texi                  |   35 +-
 doc/ref/libguile-linking.texi                   |    6 +-
 doc/ref/libguile-smobs.texi                     |    7 +-
 doc/ref/make-texinfo.scm                        |   28 +
 doc/ref/misc-modules.texi                       |   84 +-
 doc/ref/new-docstrings.texi                     |  271 +
 doc/ref/posix.texi                              |  194 +-
 doc/ref/srfi-modules.texi                       |  537 +-
 doc/ref/standard-library.am                     |    2 +
 doc/ref/standard-library.scm                    |   48 +
 doc/ref/vm.texi                                 |  164 +-
 doc/tutorial/ChangeLog-2008                     |   54 -
 doc/tutorial/ChangeLog-guile-doc-tutorial       |   16 -
 doc/tutorial/Makefile.am                        |   26 -
 doc/tutorial/guile-tut.texi                     | 1373 --
 guile-readline/Makefile.am                      |    7 +-
 lib/Makefile.am                                 |  256 +-
 lib/alignof.h                                   |    2 +-
 lib/alloca.in.h                                 |    4 +-
 lib/arpa_inet.in.h                              |   29 +-
 lib/asnprintf.c                                 |    2 +-
 lib/byteswap.in.h                               |    2 +-
 lib/c-ctype.c                                   |    2 +-
 lib/c-ctype.h                                   |    2 +-
 lib/c-strcase.h                                 |    3 +-
 lib/c-strcasecmp.c                              |    2 +-
 lib/c-strcaseeq.h                               |    2 +-
 lib/c-strncasecmp.c                             |    2 +-
 lib/canonicalize-lgpl.c                         |    2 +-
 lib/config.charset                              |    2 +-
 lib/duplocale.c                                 |    2 +-
 lib/errno.in.h                                  |    2 +-
 lib/float+.h                                    |    2 +-
 lib/float.in.h                                  |    2 +-
 lib/flock.c                                     |    2 +-
 lib/full-read.c                                 |    2 +-
 lib/full-read.h                                 |    2 +-
 lib/full-write.c                                |    3 +-
 lib/full-write.h                                |    2 +-
 lib/gai_strerror.c                              |   76 +
 lib/getaddrinfo.c                               |  438 +
 lib/gettext.h                                   |    3 +-
 lib/iconv.c                                     |    2 +-
 lib/iconv.in.h                                  |   59 +-
 lib/iconv_close.c                               |    2 +-
 lib/iconv_open.c                                |    2 +-
 lib/iconveh.h                                   |    2 +-
 lib/inet_ntop.c                                 |    2 +-
 lib/inet_pton.c                                 |    2 +-
 lib/localcharset.c                              |    2 +-
 lib/localcharset.h                              |    2 +-
 lib/locale.in.h                                 |   28 +-
 lib/lstat.c                                     |    3 +-
 lib/malloc.c                                    |    2 +-
 lib/malloca.c                                   |    2 +-
 lib/malloca.h                                   |    2 +-
 lib/mbrlen.c                                    |    2 +-
 lib/mbrtowc.c                                   |    2 +-
 lib/mbsinit.c                                   |    2 +-
 lib/memchr.c                                    |    2 +-
 lib/netdb.in.h                                  |  192 +
 lib/netinet_in.in.h                             |    2 +-
 lib/pathmax.h                                   |    3 +-
 lib/printf-args.c                               |    2 +-
 lib/printf-args.h                               |    3 +-
 lib/printf-parse.c                              |    2 +-
 lib/printf-parse.h                              |    3 +-
 lib/putenv.c                                    |    4 +-
 lib/readlink.c                                  |    6 +-
 lib/ref-add.sin                                 |    2 +-
 lib/ref-del.sin                                 |    2 +-
 lib/safe-read.c                                 |    4 +-
 lib/safe-read.h                                 |    2 +-
 lib/safe-write.c                                |    2 +-
 lib/safe-write.h                                |    2 +-
 lib/size_max.h                                  |    2 +-
 lib/snprintf.c                                  |   72 +
 lib/stat.c                                      |    2 +-
 lib/stdarg.in.h                                 |    2 +-
 lib/stdbool.in.h                                |    2 +-
 lib/stddef.in.h                                 |    2 +-
 lib/stdint.in.h                                 |    2 +-
 lib/stdio-write.c                               |    2 +-
 lib/stdio.in.h                                  | 1142 +-
 lib/stdlib.in.h                                 |  503 +-
 lib/strcasecmp.c                                |    2 +-
 lib/streq.h                                     |    2 +-
 lib/strftime.c                                  |    3 +-
 lib/strftime.h                                  |    2 +-
 lib/striconveh.c                                |    2 +-
 lib/striconveh.h                                |    2 +-
 lib/string.in.h                                 |  662 +-
 lib/strings.in.h                                |   37 +-
 lib/strncasecmp.c                               |    2 +-
 lib/sys_file.in.h                               |   30 +-
 lib/sys_socket.in.h                             |  663 +-
 lib/sys_stat.in.h                               |  309 +-
 lib/time.in.h                                   |  131 +-
 lib/time_r.c                                    |    2 +-
 lib/unistd.in.h                                 | 1002 +-
 lib/unistr.h                                    |   14 +-
 lib/unistr/u8-mbtouc-aux.c                      |    2 +-
 lib/unistr/u8-mbtouc-unsafe-aux.c               |    2 +-
 lib/unistr/u8-mbtouc-unsafe.c                   |    2 +-
 lib/unistr/u8-mbtouc.c                          |    2 +-
 lib/unistr/u8-mbtoucr.c                         |    2 +-
 lib/unistr/u8-prev.c                            |    2 +-
 lib/unistr/u8-uctomb-aux.c                      |    2 +-
 lib/unistr/u8-uctomb.c                          |    2 +-
 lib/unitypes.h                                  |    2 +-
 lib/vasnprintf.c                                |   22 +-
 lib/vasnprintf.h                                |   17 +-
 lib/verify.h                                    |    2 +-
 lib/version-etc-fsf.c                           |    2 +-
 lib/version-etc.c                               |    4 +-
 lib/version-etc.h                               |    2 +-
 lib/vsnprintf.c                                 |    2 +-
 lib/wchar.in.h                                  |  342 +-
 lib/write.c                                     |    2 +-
 lib/xsize.h                                     |    2 +-
 libguile.h                                      |    3 +-
 libguile/Makefile.am                            |   50 +-
 libguile/_scm.h                                 |    6 +-
 libguile/alist.c                                |    3 +-
 libguile/array-map.c                            |  151 +-
 libguile/array-map.h                            |    3 +-
 libguile/arrays.c                               |  181 +-
 libguile/arrays.h                               |   10 +-
 libguile/async.c                                |    3 +-
 libguile/backtrace.c                            |    3 +-
 libguile/boolean.c                              |   28 +-
 libguile/boolean.h                              |   40 +-
 libguile/bytevectors.c                          |   41 +-
 libguile/bytevectors.h                          |    4 +
 libguile/c-tokenize.lex                         |   14 -
 libguile/chars.c                                |   89 +-
 libguile/chars.h                                |    3 +
 libguile/continuations.c                        |  245 +-
 libguile/continuations.h                        |   31 +-
 libguile/control.c                              |  282 +
 libguile/control.h                              |   60 +
 libguile/debug.c                                |   31 +-
 libguile/debug.h                                |    3 +-
 libguile/deprecated.c                           |  423 +-
 libguile/deprecated.h                           |   47 +-
 libguile/dynl.c                                 |  151 +-
 libguile/dynl.h                                 |    4 +-
 libguile/dynwind.c                              |  109 +-
 libguile/eq.c                                   |    8 +-
 libguile/eval.c                                 |  120 +-
 libguile/eval.h                                 |    1 +
 libguile/evalext.c                              |   10 +-
 libguile/filesys.c                              |   20 +-
 libguile/fluids.c                               |  309 +-
 libguile/fluids.h                               |   30 +-
 libguile/foreign.c                              | 1115 ++
 libguile/foreign.h                              |  131 +
 libguile/fports.c                               |   37 +-
 libguile/frames.c                               |   45 +-
 libguile/frames.h                               |   11 +-
 libguile/gc-malloc.c                            |   29 +-
 libguile/gc.c                                   |   30 +-
 libguile/gc.h                                   |    3 +-
 libguile/gen-scmconfig.c                        |   13 -
 libguile/gen-scmconfig.h.in                     |    2 -
 libguile/generalized-arrays.c                   |   28 +-
 libguile/generalized-vectors.c                  |    7 +-
 libguile/goops.c                                |   79 +-
 libguile/goops.h                                |    1 -
 libguile/gsubr.c                                | 1010 +-
 libguile/gsubr.h                                |   38 +-
 libguile/hash.c                                 |    5 +-
 libguile/hooks.c                                |   11 +
 libguile/hooks.h                                |    3 +-
 libguile/i18n.c                                 |  262 +-
 libguile/i18n.h                                 |    2 +
 libguile/init.c                                 |   37 +-
 libguile/inline.h                               |   41 +-
 libguile/instructions.c                         |    8 +-
 libguile/lang.c                                 |   55 -
 libguile/lang.h                                 |   50 -
 libguile/list.c                                 |    3 +-
 libguile/load.c                                 |   27 +-
 libguile/load.h                                 |    1 +
 libguile/macros.c                               |  297 +-
 libguile/macros.h                               |   40 +-
 libguile/memoize.c                              |  186 +-
 libguile/memoize.h                              |   10 +-
 libguile/modules.c                              |   27 +-
 libguile/net_db.c                               |  297 +-
 libguile/net_db.h                               |    4 +-
 libguile/objcodes.c                             |   63 +-
 libguile/objcodes.h                             |   24 +-
 libguile/options.c                              |    3 +-
 libguile/pairs.h                                |   23 +-
 libguile/ports.c                                |    4 +-
 libguile/posix.c                                |   99 +-
 libguile/posix.h                                |    4 +-
 libguile/print.c                                |  147 +-
 libguile/private-options.h                      |   11 +-
 libguile/procprop.c                             |   52 +-
 libguile/procs.c                                |   72 +-
 libguile/procs.h                                |   28 -
 libguile/programs.c                             |   93 +-
 libguile/programs.h                             |   19 +-
 libguile/promises.c                             |    3 +-
 libguile/read.c                                 |  436 +-
 libguile/script.c                               |   35 +-
 libguile/smob.c                                 |  515 +-
 libguile/smob.h                                 |   18 +-
 libguile/snarf.h                                |  118 +-
 libguile/sort.c                                 |    3 +-
 libguile/srfi-13.c                              |    2 +-
 libguile/srfi-14.i.c                            |  922 +-
 libguile/srfi-4.c                               | 1032 +--
 libguile/srfi-4.h                               |    3 +
 libguile/srfi-4.i.c                             |  207 -
 libguile/stackchk.h                             |    8 +-
 libguile/stacks.c                               |  215 +-
 libguile/strings.c                              |  246 +-
 libguile/strings.h                              |    5 +
 libguile/strorder.c                             |   12 +-
 libguile/strports.c                             |   84 +-
 libguile/strports.h                             |    4 +-
 libguile/struct.c                               |  400 +-
 libguile/struct.h                               |   42 +-
 libguile/tags.h                                 |   35 +-
 libguile/throw.c                                |  687 +-
 libguile/throw.h                                |    7 -
 libguile/trees.c                                |    3 +-
 libguile/unidata_to_charset.pl                  |   13 +-
 libguile/vectors.c                              |   14 +-
 libguile/vectors.h                              |    2 +-
 libguile/version.c                              |   11 +-
 libguile/version.h.in                           |    3 +-
 libguile/vm-bootstrap.h                         |   30 -
 libguile/vm-engine.c                            |   50 +-
 libguile/vm-engine.h                            |   57 +-
 libguile/vm-i-loader.c                          |   18 +-
 libguile/vm-i-scheme.c                          |  506 +-
 libguile/vm-i-system.c                          |  700 +-
 libguile/vm.c                                   |  389 +-
 libguile/vm.h                                   |   40 +-
 libguile/weaks.c                                |    3 +-
 m4/00gnulib.m4                                  |    2 +-
 m4/alloca.m4                                    |    3 +-
 m4/arpa_inet_h.m4                               |   23 +-
 m4/autobuild.m4                                 |    3 +-
 m4/byteswap.m4                                  |    2 +-
 m4/canonicalize.m4                              |    2 +-
 m4/codeset.m4                                   |    2 +-
 m4/dos.m4                                       |    2 +-
 m4/double-slash-root.m4                         |    2 +-
 m4/duplocale.m4                                 |    6 +-
 m4/eealloc.m4                                   |    2 +-
 m4/environ.m4                                   |    2 +-
 m4/errno_h.m4                                   |    2 +-
 m4/extensions.m4                                |   18 +-
 m4/fcntl-o.m4                                   |   81 +
 m4/fcntl_h.m4                                   |  108 -
 m4/float_h.m4                                   |    2 +-
 m4/flock.m4                                     |    2 +-
 m4/fpieee.m4                                    |    2 +-
 m4/func.m4                                      |   20 +
 m4/getaddrinfo.m4                               |  173 +
 m4/glibc21.m4                                   |    2 +-
 m4/gnulib-cache.m4                              |    6 +-
 m4/gnulib-common.m4                             |   38 +-
 m4/gnulib-comp.m4                               |  245 +-
 m4/gnulib-tool.m4                               |    2 +-
 m4/hostent.m4                                   |   45 +
 m4/iconv.m4                                     |   25 +-
 m4/iconv_h.m4                                   |    2 +-
 m4/iconv_open.m4                                |    6 +-
 m4/include_next.m4                              |    2 +-
 m4/inet_ntop.m4                                 |    2 +-
 m4/inet_pton.m4                                 |    2 +-
 m4/inline.m4                                    |    2 +-
 m4/intmax_t.m4                                  |    3 +-
 m4/inttypes_h.m4                                |    2 +-
 m4/ld-version-script.m4                         |    2 +-
 m4/lib-ld.m4                                    |    2 +-
 m4/lib-link.m4                                  |    2 +-
 m4/lib-prefix.m4                                |    2 +-
 m4/libunistring.m4                              |    2 +-
 m4/localcharset.m4                              |    2 +-
 m4/locale-fr.m4                                 |    2 +-
 m4/locale-ja.m4                                 |    2 +-
 m4/locale-zh.m4                                 |    2 +-
 m4/locale_h.m4                                  |   24 +-
 m4/longlong.m4                                  |    2 +-
 m4/lstat.m4                                     |    2 +-
 m4/malloc.m4                                    |    2 +-
 m4/malloca.m4                                   |    3 +-
 m4/mbrlen.m4                                    |    2 +-
 m4/mbrtowc.m4                                   |    3 +-
 m4/mbsinit.m4                                   |    2 +-
 m4/mbstate_t.m4                                 |    2 +-
 m4/memchr.m4                                    |    2 +-
 m4/mmap-anon.m4                                 |    2 +-
 m4/multiarch.m4                                 |    2 +-
 m4/netdb_h.m4                                   |   46 +
 m4/netinet_in_h.m4                              |    2 +-
 m4/pathmax.m4                                   |    3 +-
 m4/printf.m4                                    |    2 +-
 m4/putenv.m4                                    |    2 +-
 m4/readlink.m4                                  |    6 +-
 m4/safe-read.m4                                 |    3 +-
 m4/safe-write.m4                                |    2 +-
 m4/servent.m4                                   |   47 +
 m4/size_max.m4                                  |    2 +-
 m4/snprintf.m4                                  |   40 +
 m4/socklen.m4                                   |    2 +-
 m4/sockpfaf.m4                                  |    2 +-
 m4/ssize_t.m4                                   |    2 +-
 m4/stat.m4                                      |    6 +-
 m4/stdarg.m4                                    |    2 +-
 m4/stdbool.m4                                   |    2 +-
 m4/stddef_h.m4                                  |    2 +-
 m4/stdint.m4                                    |    2 +-
 m4/stdint_h.m4                                  |    2 +-
 m4/stdio_h.m4                                   |   17 +-
 m4/stdlib_h.m4                                  |   20 +-
 m4/strcase.m4                                   |    2 +-
 m4/strftime.m4                                  |    3 +-
 m4/string_h.m4                                  |   16 +-
 m4/strings_h.m4                                 |    8 +-
 m4/sys_file_h.m4                                |   15 +-
 m4/sys_socket_h.m4                              |   28 +-
 m4/sys_stat_h.m4                                |   11 +-
 m4/time_h.m4                                    |   40 +-
 m4/time_r.m4                                    |    3 +-
 m4/tm_gmtoff.m4                                 |    2 +-
 m4/unistd_h.m4                                  |   27 +-
 m4/vasnprintf.m4                                |    2 +-
 m4/version-etc.m4                               |    2 +-
 m4/visibility.m4                                |    2 +-
 m4/vsnprintf.m4                                 |    2 +-
 m4/warn-on-use.m4                               |   45 +
 m4/warnings.m4                                  |   12 +-
 m4/wchar.m4                                     |  105 -
 m4/wchar_h.m4                                   |  152 +
 m4/wchar_t.m4                                   |    2 +-
 m4/wint_t.m4                                    |    2 +-
 m4/write.m4                                     |    2 +-
 m4/xsize.m4                                     |    2 +-
 maint.mk                                        |  133 +-
 meta/Makefile.am                                |    2 +-
 meta/guile-2.0-uninstalled.pc.in                |    2 +-
 meta/guile-2.0.pc.in                            |    5 +-
 meta/guile-tools.in                             |    3 +-
 module/Makefile.am                              |   88 +-
 module/ice-9/boot-9.scm                         | 2076 ++--
 module/ice-9/compile-psyntax.scm                |    2 +-
 module/ice-9/control.scm                        |   56 +
 module/ice-9/curried-definitions.scm            |   41 +
 module/ice-9/debugging/traps.scm                |    7 +-
 module/ice-9/deprecated.scm                     |   38 +-
 module/ice-9/eval.scm                           |  137 +-
 module/ice-9/format.scm                         |   33 +-
 module/ice-9/i18n.scm                           |   18 +-
 module/ice-9/networking.scm                     |    9 +-
 module/ice-9/optargs.scm                        |   33 +-
 module/ice-9/posix.scm                          |    3 +
 module/ice-9/pretty-print.scm                   |  187 +-
 module/ice-9/psyntax-pp.scm                     |17530 ++++++++++++-----------
 module/ice-9/psyntax.scm                        |  279 +-
 module/ice-9/r4rs.scm                           |   68 +-
 module/ice-9/runq.scm                           |    3 +-
 module/ice-9/session.scm                        |    4 +-
 module/ice-9/syncase.scm                        |   10 +-
 module/ice-9/vlist.scm                          |  489 +
 module/language/assembly.scm                    |    8 +-
 module/language/assembly/compile-bytecode.scm   |  125 +-
 module/language/assembly/decompile-bytecode.scm |    4 +-
 module/language/assembly/disassemble.scm        |   23 +-
 module/language/ecmascript/array.scm            |    8 +-
 module/language/ecmascript/parse-lalr.scm       | 1731 ---
 module/language/ecmascript/parse.scm            |  522 +-
 module/language/ecmascript/tokenize.scm         |   60 +-
 module/language/elisp/README                    |    2 +-
 module/language/elisp/compile-tree-il.scm       |    4 +-
 module/language/elisp/runtime.scm               |    7 +-
 module/language/elisp/runtime/macro-slot.scm    |   45 +-
 module/language/glil.scm                        |   13 +-
 module/language/glil/compile-assembly.scm       |   46 +-
 module/language/glil/decompile-assembly.scm     |    8 +-
 module/language/objcode/spec.scm                |    7 +-
 module/language/scheme/compile-tree-il.scm      |    4 +-
 module/language/tree-il.scm                     |  179 +-
 module/language/tree-il/analyze.scm             |  515 +-
 module/language/tree-il/compile-glil.scm        |  276 +-
 module/language/tree-il/inline.scm              |   52 +-
 module/language/tree-il/primitives.scm          |  202 +-
 module/rnrs/bytevector.scm                      |   13 +-
 module/rnrs/io/ports.scm                        |   13 +-
 module/scripts/compile.scm                      |    8 +-
 module/scripts/snarf-check-and-output-texi.scm  |   11 +
 module/srfi/srfi-18.scm                         |    3 +-
 module/srfi/srfi-19.scm                         |   20 +-
 module/srfi/srfi-35.scm                         |   11 +-
 module/srfi/srfi-4.scm                          |  149 +-
 module/srfi/srfi-4/gnu.scm                      |   66 +-
 module/srfi/srfi-88.scm                         |    6 +-
 module/srfi/srfi-9.scm                          |    5 +-
 module/statprof.scm                             |  704 +
 module/sxml/apply-templates.scm                 |  102 +
 module/sxml/fold.scm                            |  250 +
 module/sxml/simple.scm                          |  169 +
 module/sxml/ssax.scm                            |  246 +
 module/sxml/ssax/input-parse.scm                |  180 +
 module/sxml/transform.scm                       |  298 +
 module/sxml/upstream/COPYING.SSAX               |    2 +
 module/sxml/upstream/SSAX.scm                   | 3212 +++++
 module/sxml/upstream/SXML-tree-trans.scm        |  249 +
 module/sxml/upstream/SXPath-old.scm             | 1216 ++
 module/sxml/upstream/assert.scm                 |   35 +
 module/sxml/upstream/input-parse.scm            |  326 +
 module/sxml/xpath.scm                           |  493 +
 module/system/base/compile.scm                  |   13 +-
 module/system/base/lalr.scm                     |   45 +
 module/system/base/lalr.upstream.scm            | 2077 +++
 module/system/base/message.scm                  |    8 +-
 module/system/base/pmatch.scm                   |   45 +-
 module/system/foreign.scm                       |  106 +
 module/system/repl/command.scm                  |  122 +-
 module/system/repl/common.scm                   |   97 +-
 module/system/repl/repl.scm                     |    2 +-
 module/system/vm/debug.scm                      |  436 +-
 module/system/vm/frame.scm                      |  276 +-
 module/system/vm/inspect.scm                    |  190 +
 module/system/vm/instruction.scm                |    5 +-
 module/system/vm/objcode.scm                    |    5 +-
 module/system/vm/program.scm                    |   48 +-
 module/system/vm/trace.scm                      |  135 +-
 module/system/vm/vm.scm                         |   11 +-
 module/texinfo.scm                              | 1215 ++
 module/texinfo/docbook.scm                      |  233 +
 module/texinfo/html.scm                         |  257 +
 module/texinfo/indexing.scm                     |   75 +
 module/texinfo/plain-text.scm                   |  316 +
 module/texinfo/reflection.scm                   |  581 +
 module/texinfo/serialize.scm                    |  263 +
 module/texinfo/string-utils.scm                 |  400 +
 srfi/Makefile.am                                |   13 +-
 srfi/srfi-1.c                                   |    3 +-
 test-suite/Makefile.am                          |   67 +-
 test-suite/guile-test                           |    9 +-
 test-suite/lalr/common-test.scm                 |   63 +
 test-suite/lalr/glr-test.scm                    |   88 +
 test-suite/lalr/run-guile-test.sh               |   30 +
 test-suite/lalr/test-glr-associativity.scm      |  102 +
 test-suite/lalr/test-glr-basics-01.scm          |   35 +
 test-suite/lalr/test-glr-basics-02.scm          |   30 +
 test-suite/lalr/test-glr-basics-03.scm          |   37 +
 test-suite/lalr/test-glr-basics-04.scm          |   43 +
 test-suite/lalr/test-glr-basics-05.scm          |   40 +
 test-suite/lalr/test-glr-script-expression.scm  |  125 +
 test-suite/lalr/test-glr-single-expressions.scm |   60 +
 test-suite/lalr/test-lr-associativity-01.scm    |   91 +
 test-suite/lalr/test-lr-associativity-02.scm    |   91 +
 test-suite/lalr/test-lr-associativity-03.scm    |   85 +
 test-suite/lalr/test-lr-associativity-04.scm    |   83 +
 test-suite/lalr/test-lr-basics-01.scm           |   38 +
 test-suite/lalr/test-lr-basics-02.scm           |   33 +
 test-suite/lalr/test-lr-basics-03.scm           |   36 +
 test-suite/lalr/test-lr-basics-04.scm           |   31 +
 test-suite/lalr/test-lr-basics-05.scm           |   36 +
 test-suite/lalr/test-lr-error-recovery-01.scm   |  145 +
 test-suite/lalr/test-lr-error-recovery-02.scm   |   51 +
 test-suite/lalr/test-lr-no-clause.scm           |   40 +
 test-suite/lalr/test-lr-script-expression.scm   |  119 +
 test-suite/lalr/test-lr-single-expressions.scm  |   59 +
 test-suite/lib.scm                              |   78 +-
 test-suite/standalone/Makefile.am               |   38 +-
 test-suite/standalone/test-ffi                  |  199 +
 test-suite/standalone/test-ffi-lib.c            |  215 +
 test-suite/standalone/test-unwind.c             |   10 +-
 test-suite/tests/00-initial-env.test            |   48 +
 test-suite/tests/arrays.test                    |  608 +
 test-suite/tests/asm-to-bytecode.test           |   36 +-
 test-suite/tests/bit-operations.test            |    6 +-
 test-suite/tests/bytevectors.test               |   76 +-
 test-suite/tests/c-api/Makefile                 |   16 -
 test-suite/tests/c-api/README                   |   11 -
 test-suite/tests/c-api/strings.c                |   74 -
 test-suite/tests/c-api/testlib.c                |  121 -
 test-suite/tests/c-api/testlib.h                |   28 -
 test-suite/tests/chars.test                     |   31 +-
 test-suite/tests/control.test                   |  227 +
 test-suite/tests/curried-definitions.test       |   84 +
 test-suite/tests/ecmascript.test                |   74 +
 test-suite/tests/elisp-compiler.test            |    4 +-
 test-suite/tests/elisp.test                     |  600 +-
 test-suite/tests/encoding-escapes.test          |    9 +-
 test-suite/tests/encoding-iso88591.test         |    7 +-
 test-suite/tests/encoding-iso88597.test         |    7 +-
 test-suite/tests/encoding-utf8.test             |    5 +-
 test-suite/tests/eval.test                      |   34 +-
 test-suite/tests/exceptions.test                |  153 +-
 test-suite/tests/fluids.test                    |   93 +
 test-suite/tests/foreign.test                   |   57 +
 test-suite/tests/hooks.test                     |    5 +-
 test-suite/tests/i18n.test                      |   13 +
 test-suite/tests/keywords.test                  |    8 +-
 test-suite/tests/load.test                      |   18 +-
 test-suite/tests/modules.test                   |   12 +-
 test-suite/tests/net-db.test                    |   98 +
 test-suite/tests/numbers.test                   |   13 +-
 test-suite/tests/optargs.test                   |   42 +-
 test-suite/tests/ports.test                     |   47 +-
 test-suite/tests/posix.test                     |   21 +-
 test-suite/tests/print.test                     |   54 +
 test-suite/tests/procprop.test                  |   11 +-
 test-suite/tests/r6rs-ports.test                |   31 +-
 test-suite/tests/reader.test                    |  143 +-
 test-suite/tests/regexp.test                    |   87 +-
 test-suite/tests/socket.test                    |   12 +-
 test-suite/tests/srfi-13.test                   |   19 +
 test-suite/tests/srfi-14.test                   |   18 +-
 test-suite/tests/srfi-31.test                   |    6 +-
 test-suite/tests/srfi-35.test                   |   11 +-
 test-suite/tests/srfi-4.test                    |  102 +-
 test-suite/tests/srfi-88.test                   |   11 +-
 test-suite/tests/srfi-9.test                    |   18 +-
 test-suite/tests/statprof.test                  |  111 +
 test-suite/tests/strings.test                   |   48 +-
 test-suite/tests/structs.test                   |   37 +-
 test-suite/tests/sxml.fold.test                 |  210 +
 test-suite/tests/sxml.ssax.test                 |  140 +
 test-suite/tests/sxml.transform.test            |   99 +
 test-suite/tests/sxml.xpath.test                |  698 +
 test-suite/tests/syncase.test                   |   41 +-
 test-suite/tests/texinfo.docbook.test           |   32 +
 test-suite/tests/texinfo.serialize.test         |  185 +
 test-suite/tests/texinfo.string-utils.test      |  118 +
 test-suite/tests/texinfo.test                   |  404 +
 test-suite/tests/tree-il.test                   |  127 +-
 test-suite/tests/unif.test                      |  563 -
 test-suite/tests/version.test                   |    7 +-
 test-suite/tests/vlist.test                     |  303 +
 testsuite/t-records.scm                         |    3 +-
 590 files changed, 53944 insertions(+), 27646 deletions(-)
 create mode 100644 .dir-locals.el
 create mode 100644 benchmark-suite/benchmarks/vlists.bm
 create mode 100644 build-aux/c++defs.h
 mode change 100644 => 100755 build-aux/gendocs.sh
 delete mode 100644 build-aux/link-warning.h
 create mode 100644 build-aux/unused-parameter.h
 create mode 100644 build-aux/warn-on-use.h
 delete mode 100644 doc/mbapi.texi
 delete mode 100644 doc/mltext.texi
 create mode 100644 doc/ref/api-foreign.texi
 create mode 100644 doc/ref/api-lalr.texi
 create mode 100644 doc/ref/api-macros.texi
 create mode 100644 doc/ref/make-texinfo.scm
 create mode 100644 doc/ref/standard-library.am
 create mode 100644 doc/ref/standard-library.scm
 delete mode 100644 doc/tutorial/ChangeLog-2008
 delete mode 100644 doc/tutorial/ChangeLog-guile-doc-tutorial
 delete mode 100644 doc/tutorial/Makefile.am
 delete mode 100644 doc/tutorial/guile-tut.texi
 create mode 100644 lib/gai_strerror.c
 create mode 100644 lib/getaddrinfo.c
 create mode 100644 lib/netdb.in.h
 create mode 100644 lib/snprintf.c
 create mode 100644 libguile/control.c
 create mode 100644 libguile/control.h
 create mode 100644 libguile/foreign.c
 create mode 100644 libguile/foreign.h
 delete mode 100644 libguile/lang.c
 delete mode 100644 libguile/lang.h
 delete mode 100644 libguile/srfi-4.i.c
 delete mode 100644 libguile/vm-bootstrap.h
 create mode 100644 m4/fcntl-o.m4
 delete mode 100644 m4/fcntl_h.m4
 create mode 100644 m4/func.m4
 create mode 100644 m4/getaddrinfo.m4
 create mode 100644 m4/hostent.m4
 create mode 100644 m4/netdb_h.m4
 create mode 100644 m4/servent.m4
 create mode 100644 m4/snprintf.m4
 create mode 100644 m4/warn-on-use.m4
 delete mode 100644 m4/wchar.m4
 create mode 100644 m4/wchar_h.m4
 create mode 100644 module/ice-9/control.scm
 create mode 100644 module/ice-9/curried-definitions.scm
 create mode 100644 module/ice-9/vlist.scm
 delete mode 100644 module/language/ecmascript/parse-lalr.scm
 create mode 100644 module/statprof.scm
 create mode 100644 module/sxml/apply-templates.scm
 create mode 100644 module/sxml/fold.scm
 create mode 100644 module/sxml/simple.scm
 create mode 100644 module/sxml/ssax.scm
 create mode 100644 module/sxml/ssax/input-parse.scm
 create mode 100644 module/sxml/transform.scm
 create mode 100644 module/sxml/upstream/COPYING.SSAX
 create mode 100644 module/sxml/upstream/SSAX.scm
 create mode 100644 module/sxml/upstream/SXML-tree-trans.scm
 create mode 100644 module/sxml/upstream/SXPath-old.scm
 create mode 100644 module/sxml/upstream/assert.scm
 create mode 100644 module/sxml/upstream/input-parse.scm
 create mode 100644 module/sxml/xpath.scm
 create mode 100644 module/system/base/lalr.scm
 create mode 100755 module/system/base/lalr.upstream.scm
 create mode 100644 module/system/foreign.scm
 create mode 100644 module/system/vm/inspect.scm
 create mode 100644 module/texinfo.scm
 create mode 100644 module/texinfo/docbook.scm
 create mode 100644 module/texinfo/html.scm
 create mode 100644 module/texinfo/indexing.scm
 create mode 100644 module/texinfo/plain-text.scm
 create mode 100644 module/texinfo/reflection.scm
 create mode 100644 module/texinfo/serialize.scm
 create mode 100644 module/texinfo/string-utils.scm
 create mode 100644 test-suite/lalr/common-test.scm
 create mode 100644 test-suite/lalr/glr-test.scm
 create mode 100644 test-suite/lalr/run-guile-test.sh
 create mode 100644 test-suite/lalr/test-glr-associativity.scm
 create mode 100644 test-suite/lalr/test-glr-basics-01.scm
 create mode 100644 test-suite/lalr/test-glr-basics-02.scm
 create mode 100644 test-suite/lalr/test-glr-basics-03.scm
 create mode 100644 test-suite/lalr/test-glr-basics-04.scm
 create mode 100644 test-suite/lalr/test-glr-basics-05.scm
 create mode 100644 test-suite/lalr/test-glr-script-expression.scm
 create mode 100644 test-suite/lalr/test-glr-single-expressions.scm
 create mode 100644 test-suite/lalr/test-lr-associativity-01.scm
 create mode 100644 test-suite/lalr/test-lr-associativity-02.scm
 create mode 100644 test-suite/lalr/test-lr-associativity-03.scm
 create mode 100644 test-suite/lalr/test-lr-associativity-04.scm
 create mode 100644 test-suite/lalr/test-lr-basics-01.scm
 create mode 100644 test-suite/lalr/test-lr-basics-02.scm
 create mode 100644 test-suite/lalr/test-lr-basics-03.scm
 create mode 100644 test-suite/lalr/test-lr-basics-04.scm
 create mode 100644 test-suite/lalr/test-lr-basics-05.scm
 create mode 100644 test-suite/lalr/test-lr-error-recovery-01.scm
 create mode 100644 test-suite/lalr/test-lr-error-recovery-02.scm
 create mode 100644 test-suite/lalr/test-lr-no-clause.scm
 create mode 100644 test-suite/lalr/test-lr-script-expression.scm
 create mode 100644 test-suite/lalr/test-lr-single-expressions.scm
 create mode 100755 test-suite/standalone/test-ffi
 create mode 100644 test-suite/standalone/test-ffi-lib.c
 create mode 100644 test-suite/tests/00-initial-env.test
 create mode 100644 test-suite/tests/arrays.test
 delete mode 100644 test-suite/tests/c-api/Makefile
 delete mode 100644 test-suite/tests/c-api/README
 delete mode 100644 test-suite/tests/c-api/strings.c
 delete mode 100644 test-suite/tests/c-api/testlib.c
 delete mode 100644 test-suite/tests/c-api/testlib.h
 create mode 100644 test-suite/tests/control.test
 create mode 100644 test-suite/tests/curried-definitions.test
 create mode 100644 test-suite/tests/ecmascript.test
 create mode 100644 test-suite/tests/fluids.test
 create mode 100644 test-suite/tests/foreign.test
 create mode 100644 test-suite/tests/net-db.test
 create mode 100644 test-suite/tests/print.test
 create mode 100644 test-suite/tests/statprof.test
 create mode 100644 test-suite/tests/sxml.fold.test
 create mode 100644 test-suite/tests/sxml.ssax.test
 create mode 100644 test-suite/tests/sxml.transform.test
 create mode 100644 test-suite/tests/sxml.xpath.test
 create mode 100644 test-suite/tests/texinfo.docbook.test
 create mode 100644 test-suite/tests/texinfo.serialize.test
 create mode 100644 test-suite/tests/texinfo.string-utils.test
 create mode 100644 test-suite/tests/texinfo.test
 delete mode 100644 test-suite/tests/unif.test
 create mode 100644 test-suite/tests/vlist.test

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..ca0c337
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,8 @@
+;; Per-directory local variables for GNU Emacs 23 and later.
+
+((nil             . ((fill-column . 80)
+                     (tab-width   .  8)))
+ (c-mode          . ((c-file-style . "gnu")))
+ (scheme-mode     . ((indent-tabs-mode . nil)))
+ (emacs-lisp-mode . ((indent-tabs-mode . nil)))
+ (texinfo-mode    . ((indent-tabs-mode . nil))))
diff --git a/.gitignore b/.gitignore
index 3db7382..b07b196 100644
--- a/.gitignore
+++ b/.gitignore
@@ -111,6 +111,8 @@ INSTALL
 /lib/arpa/inet.h
 /lib/stdio.h
 /lib/sys/stat.h
+/lib/arg-nonnull.h
+/lib/link-warning.h
 /GPATH
 /GRTAGS
 /GSYMS
@@ -119,3 +121,9 @@ INSTALL
 /meta/guile-config
 /lib/locale.h
 /module/ice-9/eval.go.stamp
+/doc/ref/standard-library.texi
+/doc/ref/standard-libraryscmfiles
+/lib/wchar.h
+/lib/sys/socket.h
+/lib/warn-on-use.h
+/lib/unused-parameter.h
diff --git a/GNUmakefile b/GNUmakefile
index 33eb3aa..40ccc06 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -5,7 +5,7 @@
 # It is necessary if you want to build targets usually of interest
 # only to the maintainer.
 
-# Copyright (C) 2001, 2003, 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2006-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/GUILE-VERSION b/GUILE-VERSION
index 4a4e201..53c1c05 100644
--- a/GUILE-VERSION
+++ b/GUILE-VERSION
@@ -2,10 +2,10 @@
 
 GUILE_MAJOR_VERSION=1
 GUILE_MINOR_VERSION=9
-GUILE_MICRO_VERSION=6
+GUILE_MICRO_VERSION=9
 
-GUILE_EFFECTIVE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}
-GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION}
+GUILE_EFFECTIVE_VERSION=2.0
+GUILE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}.${GUILE_MICRO_VERSION}
 
 # All of the shared lib versioning info.  Right now, for this to work
 # properly, you'll also need to add AC_SUBST calls to the right place
diff --git a/HACKING b/HACKING
index ffe04a8..7463fe5 100644
--- a/HACKING
+++ b/HACKING
@@ -230,7 +230,7 @@ When deprecating a definition, always follow this procedure:
 
 - Write commit messages for functions written in C using the
 functions' C names, and write entries for functions written in Scheme
-using the functions' Scheme names.  For example, 
+using the functions' Scheme names.  For example,
 
   * foo.c: Moved scm_procedure_documentation from eval.c.
 
@@ -278,6 +278,9 @@ the list of years in the copyright notice at the top of the 
file.
 - When you get bug reports or patches from people, be sure to list
 them in THANKS.
 
+- Do not introduce trailing whitespace (and feel free to clean it up
+opportunistically, that is, if doing so is part of some other change).
+The goal is to reduce (and over time, eliminate) spurious diffs.
 
 Naming conventions =================================================
 
diff --git a/Makefile.am b/Makefile.am
index c51a61b..3705762 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in.
 ##
-##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007, 2008, 2009 Free 
Software Foundation, Inc.
+##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007, 2008, 2009, 
2010 Free Software Foundation, Inc.
 ##
 ##   This file is part of GUILE.
 ##
@@ -25,10 +25,11 @@
 AUTOMAKE_OPTIONS = 1.10
 
 SUBDIRS = lib meta libguile guile-readline emacs \
-         srfi doc examples test-suite benchmark-suite am \
-         module testsuite
+         srfi examples test-suite benchmark-suite am \
+         module doc testsuite
 
-include_HEADERS = libguile.h
+libguileincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)
+libguileinclude_HEADERS = libguile.h
 
 EXTRA_DIST = LICENSE HACKING GUILE-VERSION             \
             m4/ChangeLog-2008 \
@@ -47,6 +48,8 @@ dist-hook: gen-ChangeLog
 clean-local:
        rm -rf cache/
 
+CONFIG_STATUS_DEPENDENCIES = GUILE-VERSION
+
 gen_start_rev = 61db429e251bfd2f75cb4632972e0238056eb24b
 .PHONY: gen-ChangeLog
 gen-ChangeLog:
diff --git a/NEWS b/NEWS
index 662b3a9..efa8e1a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
 Guile NEWS --- history of user-visible changes.
-Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send Guile bug reports to address@hidden
@@ -8,214 +8,85 @@ Please send Guile bug reports to address@hidden
 (During the 1.9 series, we will keep an incremental NEWS for the latest
 prerelease, and a full NEWS corresponding to 1.8 -> 2.0.)
 
-Changes in 1.9.6 (since the 1.9.5 prerelease):
+Changes in 1.9.10 (since the 1.9.9 prerelease):
 
-** New implementation of `primitive-eval'
-
-Guile's `primitive-eval' is now implemented in Scheme. Actually there is
-still a C evaluator, used when building a fresh Guile to interpret the
-compiler, so we can compile eval.scm. Thereafter all calls to
-primitive-eval are implemented by VM-compiled code.
-
-This allows all of Guile's procedures, be they interpreted or compiled,
-to execute on the same stack, unifying multiple-value return semantics,
-providing for proper tail recursion between interpreted and compiled
-code, and simplifying debugging.
-
-As part of this change, the evaluator no longer mutates the internal
-representation of the code being evaluated in a thread-unsafe manner.
-
-There are two negative aspects of this change, however. First, Guile
-takes a lot longer to compile now. Also, there is less debugging
-information available for debugging interpreted code. We hope to improve
-both of these situations.
-
-There are many changes to the internal C evalator interface, but all
-public interfaces should be the same. See the ChangeLog for details. If
-we have inadvertantly changed an interface that you were using, please
-contact address@hidden
-
-** Elisp compiler
-
-The derelict Guile maintainers finally got around to merging Daniel
-Kraft's excellent Emacs Lisp compiler. You can now switch to Elisp at
-the repl: `,language elisp'. All kudos to Daniel, and all bugs to
address@hidden
-
-** Faster SRFI-9 record access
-
-SRFI-9 records are now implemented directly on top of Guile's structs,
-and their accessors are defined in such a way that normal call-sites
-inline to special VM opcodes, while still allowing for the general case
-(e.g. passing a record accessor to `apply').
-
-** Some VM metadata removed
-
-It used to be that the standard virtual machine counted the number of
-instructions it executed. This capability has been removed, as it was
-not very useful, and had some overhead. Also it used to try to record
-the time spent in the VM, but these calculations were borked, so we
-removed them too.
-
-** Inline memq/memv of a key in a constant list
-
-The impoverished Guile inliner is slightly less lame now that it does
-`(memv k '(foo))' => `(eq? k 'foo)'. 
-
-** Rename "else" fields of <conditional> and <lambda-case>
-
-Having a field named "else" just didn't sit right with "cond", and
-everything else. So now Tree-IL's <conditional> has "consequent" and
-"alternate", and <lambda-case> has "alternate".
-
-** Allow interrupts in tail loops
-
-Tail-recursive loops that compile to tight, procedure-less jumps
-previously were uninterruptible. Now the VM handle interrupts whenever
-it jumps backwards.
-
-** Tail patterns in syntax-case
-
-Guile has pulled in some more recent changes from the psyntax portable
-syntax expander, to implement support for "tail patterns". Such patterns
-are supported by syntax-rules and syntax-case. This allows a syntax-case
-match clause to have ellipses, then a pattern at the end. For example:
-
-  (define-syntax case
-    (syntax-rules (else)
-      ((_ val match-clause ... (else e e* ...))
-       [...])))
-
-Note how there is MATCH-CLAUSE, which is ellipsized, then there is a
-tail pattern for the else clause. Thanks to Andreas Rottmann for the
-patch, and Kent Dybvig for the code.
-
-** New struct constructors that don't involve making lists
-
-`scm_c_make_struct' and `scm_c_make_structv' are new varargs and array
-constructors, respectively, for structs. You might find them useful.
-
-** Applicable struct support
-
-One may now make structs from Scheme that may be applied as procedures.
-To do so, make a struct whose vtable is `<applicable-struct-vtable>'.
-That struct will be the vtable of your applicable structs; instances of
-that new struct are assumed to have the procedure in their first slot.
-`<applicable-struct-vtable>' is like Common Lisp's
-`funcallable-standard-class'. Likewise there is
-`<applicable-struct-with-setter-vtable>', which looks for the setter in
-the second slot. This needs to be better documented.
-
-** GOOPS dispatch in scheme
-
-As an implementation detail, GOOPS dispatch is no longer implemented by
-special evaluator bytecodes, but rather directly via a Scheme function
-associated with an applicable struct. There is some VM support for the
-underlying primitives, like `class-of'.
-
-This change will in the future allow users to customize generic function
-dispatch without incurring a performance penalty, and allow us to
-implement method combinations.
-
-** Procedures-with-setters are now implemented using applicable structs
-
-From a user's perspective this doesn't mean very much. But if, for some
-odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or
-SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws
-is gone.
-
-** No more `local-eval'
-
-`local-eval' used to exist so that one could evaluate code in the
-lexical context of a function. Since there is no way to get the lexical
-environment any more, as that concept has no meaning for the compiler,
-and a different meaning for the interpreter, we have removed the
-function.
-
-If you think you need `local-eval', you should probably implement your
-own metacircular evaluator. It will probably be as fast as Guile's
-anyway.
-
-** Bit twiddlings
-
-*** Remove old evaluator closures
-
-There used to be ranges of typecodes allocated to interpreted data
-structures, but that it no longer the case, given that interpreted
-procedure are now just regular VM closures. As a result, there is a
-newly free tc3, and a number of removed macros. See the ChangeLog for
-details.
-
-*** Simplify representation of primitive procedures
-
-It used to be that there were something like 12 different typecodes
-allocated to primitive procedures, each with its own calling convention.
-Now there is only one, the gsubr. This may affect user code if you were
-defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The
-solution is to switch to use scm_c_make_gsubr. This solution works well
-both with the old 1.8 and and with the current 1.9 branch.
-
-*** Some SMOB types changed to have static typecodes
+** Hygienic macros documented as the primary syntactic extension mechanism.
 
-Fluids, dynamic states, and hash tables used to be SMOB objects, but now
-they have statically allocated tc7 typecodes.
-
-*** Preparations for changing SMOB representation
-
-If things go right, we'll be changing the SMOB representation soon. To
-that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when
-the code meant SCM_SMOB_DATA_2(x); user code will need similar changes
-in the future. Code accessing SMOBs using SCM_CELL macros was never
-correct, but until now things still worked. Users should be aware of
-such changes.
-
-** Stack refactor
+The macro documentation was finally fleshed out with some documentation
+on `syntax-case' macros, and other parts of the macro expansion process.
+See "Macros" in the manual, for details.
 
-It used to be that Guile had debugging frames on the C stack and on the
-VM stack. Now Guile's procedures only run on the VM stack, simplifying
-much of the C API. See the ChangeLog for details. The Scheme API has not
-been changed significantly.
+** Interactive Guile follows GNU conventions
 
-** New procedure, `define!'
-
-`define!' is a procedure that takes two arguments, a symbol and a value,
-and binds the value to the symbol in the current module. It's useful to
-programmatically make definitions in the current module, and is slightly
-less verbose than `module-define!'.
+As recommended by the GPL, Guile now shows a brief copyright and
+warranty disclaimer on startup, along with pointers to more information.
+On the other hand, changing languages is more concise.
 
-** eqv? not a generic
+** Support for arbitrary procedure metadata
 
-One used to be able to extend `eqv?' as a primitive-generic, but no
-more. Because `eqv?' is in the expansion of `case' (via `memv'), which
-should be able to compile to static dispatch tables, it doesn't make
-sense to allow extensions that would subvert this optimization.
+Building on its support for docstrings, Guile now supports multiple
+docstrings, adding them to the tail of a compiled procedure's
+properties. For example:
 
-** Deprecate trampolines
+  (define (foo)
+    "one"
+    "two"
+    3)
+  (use-modules (system vm program))
+  (program-properties foo)
+  => ((name . foo) (documentation . "one") (documentation . "two"))
+
+Also, vectors of pairs are now treated as additional metadata entries:
+
+  (define (bar)
+    #((quz . #f) (docstring . "xyzzy"))
+    3)
+  (use-modules (system vm program))
+  (program-properties bar)
+  => ((name . bar) (quz . #f) (docstring . "xyzzy"))
+
+This allows arbitrary literals to be embedded as metadata in a compiled
+procedure.
+
+** Better documentation infrastructure for macros
+
+It is now possible to introspect on the type of a macro, e.g.
+syntax-rules, identifier-syntax, etc, and extract information about that
+macro, such as the syntax-rules patterns or the defmacro arguments.
+`(texinfo reflection)' takes advantage of this to give better macro
+documentation.
+
+** Autocompilation for applications that use Guile as an extension language
+
+It used to be that only applications that ran Guile through the
+`scm_shell' function got the advantages of autocompilation. This has
+been changed so that all applications have autocompilation on by
+default.
 
-There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and
-so on. The point was to do some precomputation on the type of the
-procedure, then return a specialized "call" procedure. However this
-optimization wasn't actually an optimization, so it is now deprecated.
-Just use `scm_call_0', etc instead.
+** Better integration of Lisp nil
 
-** Undeprecate `scm_the_root_module ()'
+`scm_is_boolean', `scm_is_false', and `scm_is_null' all return true now
+for Lisp's `nil'. This shouldn't affect any Scheme code at this point,
+but when we start to integrate more with Emacs, it is possible that we
+break code that assumes that, for example, `(not x)' implies that `x' is
+`eq?' to `#f'. This is not a common assumption. Refactoring affected
+code to rely on properties instead of identities will improve code
+correctness.
 
-It's useful to be able to get the root module from C without doing a
-full module lookup.
+That is to say, user code should test falsity with `if', not with `eq?'.
 
-** New struct slot allocation: "hidden"
+** Integration of lalr-scm, a parser generator
 
-A hidden slot is readable and writable, but will not be initialized by a
-call to make-struct. For example in your layout you would say "ph"
-instead of "pw". Hidden slots are useful for adding new slots to a
-vtable without breaking existing invocations to make-struct.
+Guile has included Dominique Boucher's fine `lalr-scm' parser generator
+as `(system base lalr)'. See "LALR(1) Parsing" in the manual, for more
+information.
 
-** New type definitions for `scm_t_intptr' and friends.
+** Documentation for the dynamic foreign function interface (FFI).
 
-`SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX',
-`SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now
-available to C. Have fun!
+See "Foreign Function Interface" in the manual, for more information.
 
+** Unicode character set update to Unicode 5.2.
+    
 ** And of course, the usual collection of bugfixes
  
 Interested users should see the ChangeLog for more information.
@@ -231,6 +102,14 @@ Changes in 1.9.x (since the 1.8.x series):
 ** `(rnrs bytevector)', the R6RS bytevector API
 ** `(rnrs io ports)', a subset of the R6RS I/O port API
 ** `(system xref)', a cross-referencing facility (FIXME undocumented)
+** `(ice-9 vlist)', lists with constant-time random access; hash lists
+** `(system foreign)', foreign function interface
+
+** Imported statprof, SSAX, and texinfo modules from Guile-Lib
+    
+The statprof statistical profiler, the SSAX XML toolkit, and the texinfo
+toolkit from Guile-Lib have been imported into Guile proper. See
+"Standard Library" in the manual for more details.
 
 * Changes to the stand-alone interpreter
 
@@ -259,6 +138,31 @@ Running Guile with no arguments drops the user into the 
new REPL. While
 it is self-documenting to an extent, the new REPL has not yet been
 documented in the manual. This will be fixed before 2.0.
 
+** New reader options: `square-brackets' and `r6rs-hex-escapes'
+
+The reader supports a new option (changeable via `read-options'),
+`square-brackets', which instructs it to interpret square brackets as
+parenthesis.  This option is on by default.
+
+When the new `r6rs-hex-escapes' reader option is enabled, the reader
+will recognize string escape sequences as defined in R6RS.
+
+** Function profiling and tracing at the REPL
+    
+The `,profile FORM' REPL meta-command can now be used to statistically
+profile execution of a form, to see which functions are taking the most
+time. See `,help profile' for more information.
+
+Similarly, `,trace FORM' traces all function applications that occur
+during the execution of `FORM'. See `,help trace' for more information.
+
+** New debugger
+
+By default, if an exception is raised at the REPL and not caught by user
+code, Guile will drop the user into a debugger. The user may request a
+backtrace, inspect frames, or continue raising the exception. Full
+documentation is available from within the debugger.
+
 ** New `guile-tools' commands: `compile', `disassemble'
 
 Pass the `--help' command-line option to these commands for more
@@ -275,13 +179,59 @@ include `/path/to/lib'.
 Backtraces may now be disclosed with the keyboard in addition to the
 mouse.
 
+** Load path change: search in version-specific paths before site paths
+    
+When looking for a module, Guile now searches first in Guile's
+version-specific path (the library path), *then* in the site dir. This
+allows Guile's copy of SSAX to override any Guile-Lib copy the user has
+installed. Also it should cut the number of `stat' system calls by half,
+in the common case.
+
+
 * Changes to Scheme functions and syntax
 
+** New implementation of `primitive-eval'
+
+Guile's `primitive-eval' is now implemented in Scheme. Actually there is
+still a C evaluator, used when building a fresh Guile to interpret the
+compiler, so we can compile eval.scm. Thereafter all calls to
+primitive-eval are implemented by VM-compiled code.
+
+This allows all of Guile's procedures, be they interpreted or compiled,
+to execute on the same stack, unifying multiple-value return semantics,
+providing for proper tail recursion between interpreted and compiled
+code, and simplifying debugging.
+
+As part of this change, the evaluator no longer mutates the internal
+representation of the code being evaluated in a thread-unsafe manner.
+
+There are two negative aspects of this change, however. First, Guile
+takes a lot longer to compile now. Also, there is less debugging
+information available for debugging interpreted code. We hope to improve
+both of these situations.
+
+There are many changes to the internal C evalator interface, but all
+public interfaces should be the same. See the ChangeLog for details. If
+we have inadvertantly changed an interface that you were using, please
+contact address@hidden
+
 ** Procedure removed: `the-environment'
 
 This procedure was part of the interpreter's execution model, and does
 not apply to the compiler.
 
+** No more `local-eval'
+
+`local-eval' used to exist so that one could evaluate code in the
+lexical context of a function. Since there is no way to get the lexical
+environment any more, as that concept has no meaning for the compiler,
+and a different meaning for the interpreter, we have removed the
+function.
+
+If you think you need `local-eval', you should probably implement your
+own metacircular evaluator. It will probably be as fast as Guile's
+anyway.
+
 ** Files loaded with `primitive-load-path' will now be compiled
    automatically.
 
@@ -301,13 +251,6 @@ will be created if needed.
 To inhibit autocompilation, set the GUILE_AUTO_COMPILE environment
 variable to 0, or pass --no-autocompile on the Guile command line.
 
-Note that there is currently a bug here: automatic compilation will
-sometimes be attempted when it shouldn't.
-
-For example, the old (lang elisp) modules are meant to be interpreted,
-not compiled. This bug will be fixed before 2.0. FIXME 2.0: Should say
-something here about module-transformer called for compile.
-
 ** Files loaded with `load' will now be compiled automatically.
 
 As with files loaded via `primitive-load-path', `load' will also compile
@@ -327,12 +270,15 @@ the first time they run a Guile script, as the script is 
autocompiled.
 Note however that the interface of these functions is likely to change
 in the next prerelease.
 
-** New procedure in `(oops goops)': `method-formals'
+** New POSIX procedure: `getsid'
+
+Scheme binding for the `getsid' C library call.
+
+** New POSIX procedure: `getaddrinfo'
 
-** BUG: (procedure-property func 'arity) does not work on compiled
-   procedures
+Scheme binding for the `getaddrinfo' C library function.
 
-This will be fixed one way or another before 2.0.
+** New procedure in `(oops goops)': `method-formals'
 
 ** New procedures in (ice-9 session): `add-value-help-handler!',
    `remove-value-help-handler!', `add-name-help-handler!'
@@ -352,11 +298,12 @@ combining arity and formals. For example:
 Additionally, `module-commentary' is now publically exported from
 `(ice-9 session).
 
-** Deprecated: `procedure->memoizing-macro', `procedure->syntax'
+** Removed: `procedure->memoizing-macro', `procedure->syntax'
 
-These procedures will not work with syncase expansion, and indeed are
-not used in the normal course of Guile. They are still used by the old
-Emacs Lisp support, however.
+These procedures created primitive fexprs for the old evaluator, and are
+no longer supported. If you feel that you need these functions, you
+probably need to write your own metacircular evaluator (which will
+probably be as fast as Guile's, anyway).
 
 ** New language: ECMAScript
 
@@ -373,6 +320,12 @@ languages. See the manual for details, or
 http://en.wikipedia.org/wiki/Brainfuck for more information about the
 Brainfuck language itself.
 
+** New language: Elisp
+
+Guile now has an experimental Emacs Lisp compiler and runtime. You can
+now switch to Elisp at the repl: `,language elisp'. All kudos to Daniel
+Kraft, and all bugs to address@hidden
+
 ** Defmacros may now have docstrings.
 
 Indeed, any macro may have a docstring. `object-documentation' from
@@ -400,11 +353,19 @@ like this works now:
 It used to be you had to export `helper' from `(foo)' as well.
 Thankfully, this has been fixed.
 
-** New function, `procedure-module'
+** Complete support for version information in Guile's `module' form
+    
+Guile modules now have a `#:version' field. They may be loaded by
+version as well. See "R6RS Version References", "General Information
+about Modules", "Using Guile Modules", and "Creating Guile Modules" in
+the manual for more information.
 
-While useful on its own, `procedure-module' is used by psyntax on syntax
-transformers to determine the module in which to scope introduced
-identifiers.
+** Support for renaming bindings on module export
+    
+Wherever Guile accepts a symbol as an argument to specify a binding to
+export, it now also accepts a pair of symbols, indicating that a binding
+should be renamed on export. See "Creating Guile Modules" in the manual
+for more information.
 
 ** `eval-case' has been deprecated, and replaced by `eval-when'.
 
@@ -527,6 +488,14 @@ actually used this, this behavior may be reinstated via the
 #; comments out an entire expression.  See SRFI-62 or the R6RS for more
 information.
 
+** Prompts: Delimited, composable continuations
+
+Guile now has prompts as part of its primitive language. See "Prompts"
+in the manual, for more information.
+
+Expressions entered in at the REPL, or from the command line, are
+surrounded by a prompt with the default prompt tag.
+
 ** `make-stack' with a tail-called procedural narrowing argument no longer
    works (with compiled procedures)
 
@@ -564,6 +533,13 @@ Now a syntax error is signaled, as this syntax is not 
supported by
 default. If there is sufficient demand, this syntax can be supported
 again by default.
 
+** New procedure, `define!'
+
+`define!' is a procedure that takes two arguments, a symbol and a value,
+and binds the value to the symbol in the current module. It's useful to
+programmatically make definitions in the current module, and is slightly
+less verbose than `module-define!'.
+
 ** All modules have names now
 
 Before, you could have anonymous modules: modules without names. Now,
@@ -652,6 +628,27 @@ environment as well: `syntax->datum', `datum->syntax',
 `bound-identifier=?', `free-identifier=?', `generate-temporaries',
 `identifier?', and `syntax-violation'. See the R6RS for documentation.
 
+** Documentation of `syntax-rules' and `syntax-case' macros
+
+The documentation of macros in the manual is now separate from that of
+procedures.  A new section on hygienic macros has been added.
+
+** Tail patterns in syntax-case
+
+Guile has pulled in some more recent changes from the psyntax portable
+syntax expander, to implement support for "tail patterns". Such patterns
+are supported by syntax-rules and syntax-case. This allows a syntax-case
+match clause to have ellipses, then a pattern at the end. For example:
+
+  (define-syntax case
+    (syntax-rules (else)
+      ((_ val match-clause ... (else e e* ...))
+       [...])))
+
+Note how there is MATCH-CLAUSE, which is ellipsized, then there is a
+tail pattern for the else clause. Thanks to Andreas Rottmann for the
+patch, and Kent Dybvig for the code.
+
 ** Lexical bindings introduced by hygienic macros may not be referenced
    by nonhygienic macros.
 
@@ -714,6 +711,55 @@ compatibility purposes. No semantic change has been made 
(we hope).
 Optional and keyword arguments now dispatch via special VM operations,
 without the need to cons rest arguments, making them very fast.
 
+** New function, `truncated-print', with `format' support
+
+`(ice-9 pretty-print)' now exports `truncated-print', a printer that
+will ensure that the output stays within a certain width, truncating the
+output in what is hopefully an intelligent manner. See the manual for
+more details.
+
+There is a new `format' specifier, address@hidden', for doing a truncated
+print (as opposed to `~y', which does a pretty-print). See the `format'
+documentation for more details.
+
+** SRFI-4 vectors reimplemented in terms of R6RS bytevectors
+
+Guile now implements SRFI-4 vectors using bytevectors. Often when you
+have a numeric vector, you end up wanting to write its bytes somewhere,
+or have access to the underlying bytes, or read in bytes from somewhere
+else. Bytevectors are very good at this sort of thing. But the SRFI-4
+APIs are nicer to use when doing number-crunching, because they are
+addressed by element and not by byte.
+
+So as a compromise, Guile allows all bytevector functions to operate on
+numeric vectors. They address the underlying bytes in the native
+endianness, as one would expect.
+
+Following the same reasoning, that it's just bytes underneath, Guile
+also allows uniform vectors of a given type to be accessed as if they
+were of any type. One can fill a u32vector, and access its elements with
+u8vector-ref. One can use f64vector-ref on bytevectors. It's all the
+same to Guile.
+
+In this way, uniform numeric vectors may be written to and read from
+input/output ports using the procedures that operate on bytevectors.
+
+Calls to SRFI-4 accessors (ref and set functions) from Scheme are now
+inlined to the VM instructions for bytevector access.
+
+See "SRFI-4" in the manual, for more information.
+
+** Nonstandard SRFI-4 procedures now available from `(srfi srfi-4 gnu)'
+
+Guile's `(srfi srfi-4)' now only exports those srfi-4 procedures that
+are part of the standard. Complex uniform vectors and the
+`any->FOOvector' family are now available only from `(srfi srfi-4 gnu)'.
+
+Guile's default environment imports `(srfi srfi-4)', and probably should
+import `(srfi srfi-4 gnu)' as well.
+
+See "SRFI-4 Extensions" in the manual, for more information.
+
 ** New syntax: include-from-path.
 
 `include-from-path' is like `include', except it looks for its file in
@@ -797,7 +843,7 @@ There was an EBCDIC compile flag that altered some of the 
character
 processing.  It appeared that full EBCDIC support was never completed
 and was unmaintained.
 
-** Compile-time warnings: -Wunbound-variable, -Warity-mismatch. 
+** Compile-time warnings
 
 Guile can warn about potentially unbound free variables. Pass the
 -Wunbound-variable on the `guile-tools compile' command line, or add
@@ -808,11 +854,8 @@ Guile can also warn when you pass the wrong number of 
arguments to a
 procedure, with -Warity-mismatch, or `arity-mismatch' in the
 `#:warnings' as above.
 
-** New macro type: syncase-macro
-
-XXX Need to decide whether to document this for 2.0, probably should:
-make-syncase-macro, make-extended-syncase-macro, macro-type,
-syncase-macro-type, syncase-macro-binding
+Other warnings include `-Wunused-variable' and `-Wunused-toplevel', to
+warn about unused local or global (top-level) variables.
 
 ** A new `memoize-symbol' evaluator trap has been added.
 
@@ -827,6 +870,17 @@ This slightly improves program startup times.
 
 See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
 
+** GOOPS dispatch in scheme
+
+As an implementation detail, GOOPS dispatch is no longer implemented by
+special evaluator bytecodes, but rather directly via a Scheme function
+associated with an applicable struct. There is some VM support for the
+underlying primitives, like `class-of'.
+
+This change will in the future allow users to customize generic function
+dispatch without incurring a performance penalty, and allow us to
+implement method combinations.
+
 ** GOOPS cleanups.
 
 GOOPS had a number of concepts that were relevant to the days of Tcl,
@@ -836,6 +890,31 @@ were a kind of generic specific to the Tcl support. 
Entities were
 applicable structures, but were unusable; entities will come back in the
 next alpha release, but with a less stupid name.
 
+** Applicable struct support
+
+One may now make structs from Scheme that may be applied as procedures.
+To do so, make a struct whose vtable is `<applicable-struct-vtable>'.
+That struct will be the vtable of your applicable structs; instances of
+that new struct are assumed to have the procedure in their first slot.
+`<applicable-struct-vtable>' is like Common Lisp's
+`funcallable-standard-class'. Likewise there is
+`<applicable-struct-with-setter-vtable>', which looks for the setter in
+the second slot. This needs to be better documented.
+
+** New struct slot allocation: "hidden"
+
+A hidden slot is readable and writable, but will not be initialized by a
+call to make-struct. For example in your layout you would say "ph"
+instead of "pw". Hidden slots are useful for adding new slots to a
+vtable without breaking existing invocations to make-struct.
+
+** eqv? not a generic
+
+One used to be able to extend `eqv?' as a primitive-generic, but no
+more. Because `eqv?' is in the expansion of `case' (via `memv'), which
+should be able to compile to static dispatch tables, it doesn't make
+sense to allow extensions that would subvert this optimization.
+
 ** `inet-ntop' and `inet-pton' are always available.
 
 Guile now use a portable implementation of `inet_pton'/`inet_ntop', so
@@ -848,6 +927,13 @@ The bit-twiddling operations `ash', `logand', `logior', 
and `logxor' now
 have dedicated bytecodes. Guile is not just for symbolic computation,
 it's for number crunching too.
 
+** Faster SRFI-9 record access
+
+SRFI-9 records are now implemented directly on top of Guile's structs,
+and their accessors are defined in such a way that normal call-sites
+inline to special VM opcodes, while still allowing for the general case
+(e.g. passing a record accessor to `apply').
+
 ** R6RS block comment support
 
 Guile now supports R6RS nested block comments. The start of a comment is
@@ -909,6 +995,13 @@ History library functions.
 Instead, use make-typed-array, list->typed-array, or array-type,
 respectively.
 
+** Deprecated: `lazy-catch'
+
+`lazy-catch' was a form that captured the stack at the point of a
+`throw', but the dynamic state at the point of the `catch'. It was a bit
+crazy. Please change to use `catch', possibly with a throw-handler, or
+`with-throw-handler'.
+
 ** Last but not least, the `λ' macro can be used in lieu of `lambda'
 
 * Changes to the C interface
@@ -922,6 +1015,12 @@ backward-compatible way.  A new allocation routine,
 Libgc is a conservative GC, which we hope will make interaction with C
 code easier and less error-prone.
 
+** New type definitions for `scm_t_intptr' and friends.
+
+`SCM_T_UINTPTR_MAX', `SCM_T_INTPTR_MIN', `SCM_T_INTPTR_MAX',
+`SIZEOF_SCM_T_BITS', `scm_t_intptr' and `scm_t_uintptr' are now
+available to C. Have fun!
+
 ** The GH interface (deprecated in version 1.6, 2001) was removed.
 
 ** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF
@@ -932,12 +1031,120 @@ application code.
 ** Functions for handling `scm_option' now no longer require an argument
 indicating length of the `scm_t_option' array.
 
-** scm_primitive_load_path has additional argument, exception_on_error
+** Procedures-with-setters are now implemented using applicable structs
+
+From a user's perspective this doesn't mean very much. But if, for some
+odd reason, you used the SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE, or
+SCM_SETTER macros, know that they're deprecated now. Also, scm_tc7_pws
+is gone.
+
+** Remove old evaluator closures
+
+There used to be ranges of typecodes allocated to interpreted data
+structures, but that it no longer the case, given that interpreted
+procedure are now just regular VM closures. As a result, there is a
+newly free tc3, and a number of removed macros. See the ChangeLog for
+details.
+
+** Primitive procedures are now VM trampoline procedures
+
+It used to be that there were something like 12 different typecodes
+allocated to primitive procedures, each with its own calling convention.
+Now there is only one, the gsubr. This may affect user code if you were
+defining a procedure using scm_c_make_subr rather scm_c_make_gsubr. The
+solution is to switch to use scm_c_make_gsubr. This solution works well
+both with the old 1.8 and and with the current 1.9 branch.
+
+Guile's old evaluator used to have special cases for applying "gsubrs",
+primitive procedures with specified numbers of required, optional, and
+rest arguments. Now, however, Guile represents gsubrs as normal VM
+procedures, with appropriate bytecode to parse out the correct number of
+arguments, including optional and rest arguments, and then with a
+special bytecode to apply the gsubr.
+
+This allows primitive procedures to appear on the VM stack, allowing
+them to be accurately counted in profiles. Also they now have more
+debugging information attached to them -- their number of arguments, for
+example. In addition, the VM can completely inline the application
+mechanics, allowing for faster primitive calls.
+
+However there are some changes on the C level. There is no more
+`scm_tc7_gsubr' or `scm_tcs_subrs' typecode for primitive procedures, as
+they are just VM procedures. Likewise the macros `SCM_GSUBR_TYPE',
+`SCM_GSUBR_MAKTYPE', `SCM_GSUBR_REQ', `SCM_GSUBR_OPT', and
+`SCM_GSUBR_REST' are gone, as are `SCM_SUBR_META_INFO', `SCM_SUBR_PROPS'
+`SCM_SET_SUBR_GENERIC_LOC', and `SCM_SUBR_ARITY_TO_TYPE'.
+
+Perhaps more significantly, `scm_c_make_subr',
+`scm_c_make_subr_with_generic', `scm_c_define_subr', and
+`scm_c_define_subr_with_generic'. They all operated on subr typecodes,
+and there are no more subr typecodes. Use the scm_c_make_gsubr family
+instead.
+
+Normal users of gsubrs should not be affected, though, as the
+scm_c_make_gsubr family still is the correct way to create primitive
+procedures.
+
+** Remove deprecated array C interfaces
+
+Removed the deprecated array functions `scm_i_arrayp',
+`scm_i_array_ndim', `scm_i_array_mem', `scm_i_array_v',
+`scm_i_array_base', `scm_i_array_dims', and the deprecated macros
+`SCM_ARRAYP', `SCM_ARRAY_NDIM', `SCM_ARRAY_CONTP', `SCM_ARRAY_MEM',
+`SCM_ARRAY_V', `SCM_ARRAY_BASE', and `SCM_ARRAY_DIMS'.
+
+** Remove unused snarf macros
+    
+`SCM_DEFINE1', `SCM_PRIMITIVE_GENERIC_1', `SCM_PROC1, and `SCM_GPROC1'
+are no more. Use SCM_DEFINE or SCM_PRIMITIVE_GENERIC instead.
+
+** Add foreign value wrapper
+    
+Guile now has a datatype for aliasing "foreign" values, such as native
+long values. This should be useful for making a proper foreign function
+interface. Interested hackers should see libguile/foreign.h.
+
+** New functions: `scm_call_n', `scm_c_run_hookn'
+    
+`scm_call_n' applies to apply a function to an array of arguments.
+`scm_c_run_hookn' runs a hook with an array of arguments.
+
+** Some SMOB types changed to have static typecodes
+
+Fluids, dynamic states, and hash tables used to be SMOB objects, but now
+they have statically allocated tc7 typecodes.
+
+** Preparations for changing SMOB representation
+
+If things go right, we'll be changing the SMOB representation soon. To
+that end, we did a lot of cleanups to calls to e.g. SCM_CELL_WORD_2(x) when
+the code meant SCM_SMOB_DATA_2(x); user code will need similar changes
+in the future. Code accessing SMOBs using SCM_CELL macros was never
+correct, but until now things still worked. Users should be aware of
+such changes.
+
+** Changed invocation mechanics of applicable SMOBs
+
+Guile's old evaluator used to have special cases for applying SMOB
+objects. Now, with the VM, when Guile sees a SMOB, it looks up a VM
+trampoline procedure for it, and use the normal mechanics to apply the
+trampoline. This simplifies procedure application in the normal,
+non-SMOB case.
+
+The upshot is that the mechanics used to apply a SMOB are different from
+1.8. Descriptors no longer have `apply_0', `apply_1', `apply_2', and
+`apply_3' functions, and the macros SCM_SMOB_APPLY_0 and friends are now
+deprecated. Just use the scm_call_0 family of procedures.
 
 ** New C function: scm_module_public_interface
 
 This procedure corresponds to Scheme's `module-public-interface'.
 
+** Undeprecate `scm_the_root_module ()'
+
+It's useful to be able to get the root module from C without doing a
+full module lookup.
+
 ** Inline vector allocation
 
 Instead of having vectors point out into the heap for their data, their
@@ -946,6 +1153,19 @@ true for bytevectors, by default, though there is an 
indirection
 available which should allow for making a bytevector from an existing
 memory region.
 
+** New struct constructors that don't involve making lists
+
+`scm_c_make_struct' and `scm_c_make_structv' are new varargs and array
+constructors, respectively, for structs. You might find them useful.
+
+** Stack refactor
+
+In Guile 1.8, there were debugging frames on the C stack. Now there is
+no more need to explicitly mark the stack in this way, because Guile has
+a VM stack that it knows how to walk, which simplifies the C API
+considerably. See the ChangeLog for details; the relevant interface is
+in libguile/stacks.h. The Scheme API has not been changed significantly.
+
 ** Removal of Guile's primitive object system.
 
 There were a number of pieces in `objects.[ch]' that tried to be a
@@ -962,6 +1182,14 @@ shall be, Amen, except that `futures.c' and `futures.h' 
are no longer a
 part of it. These files were experimental, never compiled, and would be
 better implemented in Scheme anyway. In the future, that is.
 
+** Deprecate trampolines
+
+There used to be C functions `scm_trampoline_0', `scm_trampoline_1', and
+so on. The point was to do some precomputation on the type of the
+procedure, then return a specialized "call" procedure. However this
+optimization wasn't actually an optimization, so it is now deprecated.
+Just use `scm_call_0', etc instead.
+
 ** Better support for Lisp `nil'.
 
 The bit representation of `nil' has been tweaked so that it is now very
@@ -1023,6 +1251,17 @@ macros should now require `guile-2.0' instead of 
`guile-1.8'.
 If $(libdir) is /usr/lib, for example, Guile will install its .go files
 to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
 
+** Parallel installability fixes
+
+Guile now installs its header files to a effective-version-specific
+directory, and includes the effective version (e.g. 2.0) in the library
+name (e.g. libguile-2.0.so).
+
+This change should be transparent to users, who should detect Guile via
+the guile.m4 macro, or the guile-2.0.pc pkg-config file. It will allow
+parallel installs for multiple versions of Guile development
+environments.
+
 ** Dynamically loadable extensions may be placed in a Guile-specific path
 
 Before, Guile only searched the system library paths for extensions
@@ -1040,6 +1279,10 @@ See http://www.hpl.hp.com/personal/Hans_Boehm/gc/, for 
more information.
 See http://www.gnu.org/software/libunistring/, for more information. Our
 Unicode support uses routines from libunistring.
 
+** New dependency: libffi
+
+See http://sourceware.org/libffi/, for more information.
+
 
 
 Changes in 1.8.8 (since 1.8.7)
diff --git a/README b/README
index c4f24f8..90914e1 100644
--- a/README
+++ b/README
@@ -34,6 +34,7 @@ Guile depends on the following external libraries.
 - libltdl
 - libunistring
 - libgc
+- libffi
 It will also use the libreadline library if it is available.  For each
 of these there is a corresponding --with-XXX-prefix option that you
 can use when invoking ./configure, if you have these libraries
@@ -50,16 +51,19 @@ names (where that is supported), makes it impossible to 
later move the
 built executables and libraries to an installation location other than
 the one that was specified at build time.
 
-Another possible approach is to set CPPFLAGS and LDFLAGS before
-running configure, so that they include -I options for all the
+Another possible approach is to set CPPFLAGS and LDFLAGS on the
+configure command-line, so that they include -I options for all the
 non-standard places where you have installed header files and -L
 options for all the non-standard places where you have installed
 libraries.  This will allow configure and make to find those headers
-and libraries during the build.  The locations found will not be
-hardcoded into the build executables and libraries, so with this
-approach you will probably also need to set LD_LIBRARY_PATH
-correspondingly, to allow Guile to find the necessary libraries again
-at runtime.
+and libraries during the build.  E.g.:
+
+  ../configure [...] CPPFLAGS='-I/my/include' LDFLAGS='-L/my/lib'
+
+The locations found will not be hardcoded into the build executables and
+libraries, so with this approach you will probably also need to set
+LD_LIBRARY_PATH correspondingly, to allow Guile to find the necessary
+libraries again at runtime.
 
 
 Required External Packages ================================================
@@ -88,6 +92,26 @@ Guile requires the following external packages:
     conservative garbage collector used by Guile.  It is available
     from http://www.hpl.hp.com/personal/Hans_Boehm/gc/ .
 
+  - libffi
+
+    libffi provides a "foreign function interface", used by the
+    `(system foreign)' module.  It is available from
+    http://sourceware.org/libffi/ .
+
+  - pkg-config
+
+    Guile's ./configure script uses pkg-config to discover the correct
+    compile and link options for libgc.  If you don't have pkg-config
+    installed, or you have a version of libgc that doesn't provide a
+    .pc file, you can work around this by setting some variables as
+    part of the configure command-line:
+
+    - PKG_CONFIG=true
+
+    - BDW_GC_CFLAGS=<compile flags for picking up libgc headers>
+
+    - BDW_GC_LIBS=<linker flags for picking up the libgc library>
+
 
 Special Instructions For Some Systems =====================================
 
diff --git a/THANKS b/THANKS
index e507d73..2649a2a 100644
--- a/THANKS
+++ b/THANKS
@@ -31,6 +31,7 @@ For fixes or providing information which led to a fix:
          Adrian Bunk
         Michael Carmack
               R Clayton
+        Tristan Colgate
         Stephen Compall
           Brian Crowder
     Christopher Cramer
@@ -49,6 +50,7 @@ For fixes or providing information which led to a fix:
   Panicz Maciej Godek
            John Goerzen
            Mike Gran
+         Raimon Grau
          Szavai Gyula
          Roland Haeder
           Sven Hartrumpf
@@ -69,14 +71,17 @@ For fixes or providing information which led to a fix:
            Matt Kraai
          Daniel Kraft
        Miroslav Lichvar
+         Daniel Llorens del Río
            Jeff Long
          Marco Maggi
         Gregory Marton
       Kjetil S. Matheussen
         Antoine Mathys
+        Patrick McCarty
             Dan McMahill
           Roger Mc Murtrie
           Scott McPeak
+         Andrew Milkowski
             Tim Mooney
         Han-Wen Nienhuys
             Jan Nieuwenhuizen
@@ -91,6 +96,7 @@ For fixes or providing information which led to a fix:
            Ron Peterson
           David Pirotte
          Carlos Pita
+         Sergey Poznyakoff
             Ken Raeburn
          Juhani Rantanen
         Andreas Rottmann
@@ -100,6 +106,7 @@ For fixes or providing information which led to a fix:
          Frank Schwidom
     John Steele Scott
          Thiemo Seufer
+           Ivan Shcherbakov
           Scott Shedden
            Alex Shinn
          Daniel Skarda
diff --git a/benchmark-suite/Makefile.am b/benchmark-suite/Makefile.am
index a9da00e..583519a 100644
--- a/benchmark-suite/Makefile.am
+++ b/benchmark-suite/Makefile.am
@@ -7,7 +7,8 @@ SCM_BENCHMARKS = benchmarks/0-reference.bm              \
                 benchmarks/structs.bm                  \
                 benchmarks/subr.bm                     \
                 benchmarks/uniform-vector-read.bm      \
-                benchmarks/vectors.bm
+                benchmarks/vectors.bm                  \
+                benchmarks/vlists.bm
 
 EXTRA_DIST = guile-benchmark lib.scm $(SCM_BENCHMARKS) \
             ChangeLog-2008
diff --git a/benchmark-suite/benchmarks/vlists.bm 
b/benchmark-suite/benchmarks/vlists.bm
new file mode 100644
index 0000000..329c786
--- /dev/null
+++ b/benchmark-suite/benchmarks/vlists.bm
@@ -0,0 +1,103 @@
+;;; -*- mode: scheme; coding: iso-8859-1; -*-
+;;; VLists.
+;;;
+;;; Copyright 2009 Free Software Foundation, Inc.
+;;;
+;;; This program is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public License
+;;; as published by the Free Software Foundation; either version 3, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this software; see the file COPYING.LESSER.  If
+;;; not, write to the Free Software Foundation, Inc., 51 Franklin
+;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+(define-module (benchmarks vlists)
+  :use-module (srfi srfi-1)
+  :use-module (ice-9 vlist)
+  :use-module (benchmark-suite lib))
+
+;; Note: Use `--iteration-factor' to change this.
+(define iterations 2000000)
+
+;; The size of large lists.
+(define %list-size 700000)
+
+(define %big-list (make-list %list-size))
+(define %big-vlist (list->vlist %big-list))
+
+(define-syntax comparative-benchmark
+  (syntax-rules ()
+    ((_ benchmark-name iterations
+        ((api ((name value) ...)))
+        body ...)
+     (benchmark (format #f "~A (~A)" benchmark-name 'api)
+                iterations
+                (let ((name value) ...)
+                  body ...)))
+    ((_ benchmark-name iterations
+        ((api bindings) apis ...)
+        body ...)
+     (begin
+       (comparative-benchmark benchmark-name iterations
+                              ((api bindings))
+                              body ...)
+       (comparative-benchmark benchmark-name iterations
+                              (apis ...)
+                              body ...)))))
+
+
+(with-benchmark-prefix "constructors"
+
+  (comparative-benchmark "cons" 2
+    ((srfi-1 ((cons cons)       (null '())))
+     (vlist  ((cons vlist-cons) (null vlist-null))))
+    (let loop ((i %list-size)
+               (r null))
+         (and (> i 0)
+              (loop (1- i) (cons #t r)))))
+
+
+  (comparative-benchmark "acons" 2
+    ((srfi-1 ((acons alist-cons) (null '())))
+     (vlist  ((acons vhash-cons) (null vlist-null))))
+    (let loop ((i %list-size)
+               (r null))
+      (if (zero? i)
+          r
+          (loop (1- i) (acons i i r))))))
+
+
+(define %big-alist
+  (let loop ((i %list-size) (res '()))
+    (if (zero? i)
+        res
+        (loop (1- i) (alist-cons i i res)))))
+(define %big-vhash
+  (let loop ((i %list-size) (res vlist-null))
+    (if (zero? i)
+        res
+        (loop (1- i) (vhash-cons i i res)))))
+
+
+(with-benchmark-prefix "iteration"
+
+  (comparative-benchmark "fold" 2
+    ((srfi-1 ((fold fold)       (lst %big-list)))
+     (vlist  ((fold vlist-fold) (lst %big-vlist))))
+    (fold (lambda (x y) y) #t lst))
+
+  (comparative-benchmark "assoc" 70
+    ((srfi-1 ((assoc assoc)       (alst %big-alist)))
+     (vhash  ((assoc vhash-assoc) (alst %big-vhash))))
+    (let loop ((i (quotient %list-size 3)))
+      (and (> i 0)
+           (begin
+             (assoc i alst)
+             (loop (- i 5000)))))))
diff --git a/build-aux/announce-gen b/build-aux/announce-gen
index 5fbb9cd..7d70fd4 100755
--- a/build-aux/announce-gen
+++ b/build-aux/announce-gen
@@ -9,7 +9,7 @@ my $VERSION = '2009-11-20 13:36'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/arg-nonnull.h b/build-aux/arg-nonnull.h
index 24ad6b5..7e3e2db 100644
--- a/build-aux/arg-nonnull.h
+++ b/build-aux/arg-nonnull.h
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
diff --git a/build-aux/c++defs.h b/build-aux/c++defs.h
new file mode 100644
index 0000000..31b29c2
--- /dev/null
+++ b/build-aux/c++defs.h
@@ -0,0 +1,233 @@
+/* C++ compatible function declaration macros.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_CXXDEFS_H
+#define _GL_CXXDEFS_H
+
+/* The three most frequent use cases of these macros are:
+
+   * For providing a substitute for a function that is missing on some
+     platforms, but is declared and works fine on the platforms on which
+     it exists:
+
+       #if @GNULIB_FOO@
+       # if address@hidden@
+       _GL_FUNCDECL_SYS (foo, ...);
+       # endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on all platforms,
+     but is broken/insufficient and needs to be replaced on some platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+
+   * For providing a replacement for a function that exists on some platforms
+     but is broken/insufficient and needs to be replaced on some of them and
+     is additionally either missing or undeclared on some other platforms:
+
+       #if @GNULIB_FOO@
+       # if @REPLACE_FOO@
+       #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+       #   undef foo
+       #   define foo rpl_foo
+       #  endif
+       _GL_FUNCDECL_RPL (foo, ...);
+       _GL_CXXALIAS_RPL (foo, ...);
+       # else
+       #  if address@hidden@   or   if address@hidden@
+       _GL_FUNCDECL_SYS (foo, ...);
+       #  endif
+       _GL_CXXALIAS_SYS (foo, ...);
+       # endif
+       _GL_CXXALIASWARN (foo);
+       #elif defined GNULIB_POSIXCHECK
+       ...
+       #endif
+*/
+
+/* _GL_EXTERN_C declaration;
+   performs the declaration with C linkage.  */
+#if defined __cplusplus
+# define _GL_EXTERN_C extern "C"
+#else
+# define _GL_EXTERN_C extern
+#endif
+
+/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
+   declares a replacement function, named rpl_func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
+  _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
+#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype rpl_func parameters_and_attributes
+
+/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
+   declares the system function, named func, with the given prototype,
+   consisting of return type, parameters, and attributes.
+   Example:
+     _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
+                                  _GL_ARG_NONNULL ((1)));
+ */
+#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
+  _GL_EXTERN_C rettype func parameters_and_attributes
+
+/* _GL_CXXALIAS_RPL (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
+   Example:
+     _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
+ */
+#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
+  _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                                \
+    {                                                         \
+      rettype (*const func) parameters = ::rpl_func;          \
+    }                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS (func, rettype, parameters);
+   declares a C++ alias called GNULIB_NAMESPACE::func
+   that redirects to the system provided function func, if GNULIB_NAMESPACE
+   is defined.
+   Example:
+     _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
+ */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* If we were to write
+       rettype (*const func) parameters = ::func;
+     like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
+     better (remove an indirection through a 'static' pointer variable),
+     but then the _GL_CXXALIASWARN macro below would cause a warning not only
+     for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                     \
+    {                                              \
+      static rettype (*func) parameters = ::func;  \
+    }                                              \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function func may have a slightly different declaration.
+   A cast is used to silence the "invalid conversion" error that would
+   otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    namespace GNULIB_NAMESPACE                          \
+    {                                                   \
+      static rettype (*func) parameters =               \
+        reinterpret_cast<rettype(*)parameters>(::func); \
+    }                                                   \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
+   is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
+   except that the C function is picked among a set of overloaded functions,
+   namely the one with rettype2 and parameters2.  Two consecutive casts
+   are used to silence the "cannot find a match" and "invalid conversion"
+   errors that would otherwise occur.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+  /* The outer cast must be a reinterpret_cast.
+     The inner cast: When the function is defined as a set of overloaded
+     functions, it works as a static_cast<>, choosing the designated variant.
+     When the function is defined as a single variant, it works as a
+     reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    namespace GNULIB_NAMESPACE                                                \
+    {                                                                         \
+      static rettype (*func) parameters =                                     \
+        reinterpret_cast<rettype(*)parameters>(                               \
+          (rettype2(*)parameters2)(::func));                                  \
+    }                                                                         \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#else
+# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN (func);
+   causes a warning to be emitted when ::func is used but not when
+   GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
+   variants.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN(func) \
+   _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN_1(func,namespace) \
+   _GL_CXXALIASWARN_2 (func, namespace)
+# define _GL_CXXALIASWARN_2(func,namespace) \
+   _GL_WARN_ON_USE (func, \
+                    "The symbol ::" #func " refers to the system function. " \
+                    "Use " #namespace "::" #func " instead.")
+#else
+# define _GL_CXXALIASWARN(func) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
+   causes a warning to be emitted when the given overloaded variant of ::func
+   is used but not when GNULIB_NAMESPACE::func is used.  */
+#if defined __cplusplus && defined GNULIB_NAMESPACE
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+   _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
+                        GNULIB_NAMESPACE)
+# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) 
\
+   _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
+# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) 
\
+   _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
+                        "The symbol ::" #func " refers to the system function. 
" \
+                        "Use " #namespace "::" #func " instead.")
+#else
+# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
+    _GL_EXTERN_C int _gl_cxxalias_dummy
+#endif
+
+#endif /* _GL_CXXDEFS_H */
diff --git a/build-aux/config.rpath b/build-aux/config.rpath
index 85c2f20..17298f2 100755
--- a/build-aux/config.rpath
+++ b/build-aux/config.rpath
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2008 Free Software Foundation, Inc.
+#   Copyright 1996-2010 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <address@hidden>, 1996
 #
diff --git a/build-aux/gendocs.sh b/build-aux/gendocs.sh
old mode 100644
new mode 100755
index 992d9fc..67d5b52
--- a/build-aux/gendocs.sh
+++ b/build-aux/gendocs.sh
@@ -1,10 +1,10 @@
-#!/bin/sh
+#!/bin/sh -e
 # gendocs.sh -- generate a GNU manual in many formats.  This script is
 #   mentioned in maintain.texi.  See the help message below for usage details.
 
-scriptversion=2009-09-09.22
+scriptversion=2010-02-13.20
 
-# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 # Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
@@ -56,6 +56,7 @@ See the GNU Maintainers document for a more extensive 
discussion:
   http://www.gnu.org/prep/maintain_toc.html
 
 Options:
+  -s SRCFILE  read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
   -o OUTDIR   write files into OUTDIR, instead of manual/.
   --email ADR use ADR as contact in generated web pages.
   --docbook   convert to DocBook too (xml, txt, html, pdf and ps).
@@ -119,12 +120,14 @@ PACKAGE=
 address@hidden  # please override with --email
 htmlarg=
 outdir=manual
+srcfile=
 
 while test $# -gt 0; do
   case $1 in
     --email) shift; EMAIL=$1;;
     --help) echo "$usage"; exit 0;;
     --version) echo "$version"; exit 0;;
+    -s) shift; srcfile=$1;;
     -o) shift; outdir=$1;;
     --docbook) docbook=yes;;
     --html) shift; htmlarg=$1;;
@@ -146,7 +149,9 @@ while test $# -gt 0; do
   shift
 done
 
-if test -s "$srcdir/$PACKAGE.texinfo"; then
+if test -n "$srcfile"; then
+  :
+elif test -s "$srcdir/$PACKAGE.texinfo"; then
   srcfile=$srcdir/$PACKAGE.texinfo
 elif test -s "$srcdir/$PACKAGE.texi"; then
   srcfile=$srcdir/$PACKAGE.texi
@@ -268,13 +273,14 @@ else
 fi
 
 echo Making .tar.gz for sources...
-srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null`
+d=`dirname $srcfile`
+srcfiles=`ls $d/*.texinfo $d/*.texi $d/*.txi $d/*.eps 2>/dev/null` || true
 tar cvzfh $outdir/$PACKAGE.texi.tar.gz $srcfiles
 texi_tgz_size=`calcsize $outdir/$PACKAGE.texi.tar.gz`
 
 if test -n "$docbook"; then
   cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > 
${srcdir}/$PACKAGE-db.xml"
-  echo "Generating docbook XML... $(cmd)"
+  echo "Generating docbook XML... ($cmd)"
   eval "$cmd"
   docbook_xml_size=`calcsize $PACKAGE-db.xml`
   gzip -f -9 -c $PACKAGE-db.xml >$outdir/$PACKAGE-db.xml.gz
@@ -302,7 +308,7 @@ if test -n "$docbook"; then
   mv $PACKAGE-db.txt $outdir/
 
   cmd="${DOCBOOK2PS} ${outdir}/$PACKAGE-db.xml"
-  echo "Generating docbook PS... $(cmd)"
+  echo "Generating docbook PS... ($cmd)"
   eval "$cmd"
   gzip -f -9 -c $PACKAGE-db.ps >$outdir/$PACKAGE-db.ps.gz
   docbook_ps_gz_size=`calcsize $outdir/$PACKAGE-db.ps.gz`
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 32f76e8..7660af5 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -9,7 +9,7 @@ my $VERSION = '2009-10-30 13:46'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/gnu-web-doc-update b/build-aux/gnu-web-doc-update
index 91902c5..2c1a0cc 100755
--- a/build-aux/gnu-web-doc-update
+++ b/build-aux/gnu-web-doc-update
@@ -9,7 +9,7 @@
 
 VERSION=2009-07-21.16; # UTC
 
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/gnupload b/build-aux/gnupload
index 5ebacdb..c28a5cc 100755
--- a/build-aux/gnupload
+++ b/build-aux/gnupload
@@ -1,9 +1,10 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2009-11-29.20; # UTC
+scriptversion=2010-02-08.07; # UTC
 
-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,10 +33,11 @@ delete_symlinks=
 collect_var=
 dbg=
 
-usage="Usage: $0 [OPTIONS]... [COMMAND] FILES... [[COMMAND] FILES...]
+usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
 
-Sign all FILES, and upload them to selected destinations, according to
-<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>.
+Sign all FILES, and process them at selected destinations according to CMD.
+<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
+explains further.
 
 Commands:
   --delete                 delete FILES from destination
@@ -96,6 +98,11 @@ Examples:
            --delete oopsbar-0.9.91.tar.gz \\
            -- foobar-0.9.91.tar.gz
 
+gnupload uses the ncftpput program to do the transfers; if you don't
+happen to have an ncftp package installed, the ncftpput-ftp script in
+the build-aux/ directory of the gnulib package
+(http://savannah.gnu.org/projects/gnulib) may serve as a replacement.
+
 Report bugs to <address@hidden>.
 Send patches to <address@hidden>."
 
diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h
deleted file mode 100644
index 7fefab7..0000000
--- a/build-aux/link-warning.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* A C macro for emitting link time warnings.
-   Copyright (C) 1995, 1997, 2000, 2002-2003, 2007, 2009 Free Software
-   Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published
-   by the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
-   a linker warning on most glibc systems.
-   We use a linker warning rather than a preprocessor warning, because
-   #warning cannot be used inside macros.  */
-#ifndef GL_LINK_WARNING
-  /* This works on platforms with GNU ld and ELF object format.
-     Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
-     Testing __ELF__ guarantees the ELF object format.
-     Testing __GNUC__ is necessary for the compound expression syntax.  */
-# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
-#  define GL_LINK_WARNING(message) \
-     GL_LINK_WARNING1 (__FILE__, __LINE__, message)
-#  define GL_LINK_WARNING1(file, line, message) \
-     GL_LINK_WARNING2 (file, line, message)  /* macroexpand file and line */
-#  define GL_LINK_WARNING2(file, line, message) \
-     GL_LINK_WARNING3 (file ":" #line ": warning: " message)
-#  define GL_LINK_WARNING3(message) \
-     ({ static const char warning[sizeof (message)]             \
-          __attribute__ ((__unused__,                           \
-                          __section__ (".gnu.warning"),         \
-                          __aligned__ (1)))                     \
-          = message "\n";                                       \
-        (void)0;                                                \
-     })
-# else
-#  define GL_LINK_WARNING(message) ((void) 0)
-# endif
-#endif
diff --git a/build-aux/unused-parameter.h b/build-aux/unused-parameter.h
new file mode 100644
index 0000000..b6fa325
--- /dev/null
+++ b/build-aux/unused-parameter.h
@@ -0,0 +1,36 @@
+/* A C macro for declaring that specific function parameters are not used.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* _GL_UNUSED_PARAMETER is a marker that can be appended to function parameter
+   declarations for parameters that are not used.  This helps to reduce
+   warnings, such as from GCC -Wunused-parameter.  The syntax is as follows:
+       type param _GL_UNUSED_PARAMETER
+   or more generally
+       param_decl _GL_UNUSED_PARAMETER
+   For example:
+       int param _GL_UNUSED_PARAMETER
+       int *(*param)(void) _GL_UNUSED_PARAMETER
+   Other possible, but obscure and discouraged syntaxes:
+       int _GL_UNUSED_PARAMETER *(*param)(void)
+       _GL_UNUSED_PARAMETER int *(*param)(void)
+ */
+#ifndef _GL_UNUSED_PARAMETER
+# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+#  define _GL_UNUSED_PARAMETER __attribute__ ((__unused__))
+# else
+#  define _GL_UNUSED_PARAMETER
+# endif
+#endif
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index 793c975..6aa7d39 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -12,7 +12,7 @@ my $VERSION = '2009-04-16 15:57'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/vc-list-files b/build-aux/vc-list-files
index cc716e9..b9f2fbd 100755
--- a/build-aux/vc-list-files
+++ b/build-aux/vc-list-files
@@ -2,9 +2,9 @@
 # List version-controlled file names.
 
 # Print a version string.
-scriptversion=2009-07-21.16; # UTC
+scriptversion=2010-02-21.13; # UTC
 
-# Copyright (C) 2006-2009 Free Software Foundation, Inc.
+# Copyright (C) 2006-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -85,7 +85,7 @@ elif test -d .hg; then
   eval exec hg locate '"$dir/*"' $postprocess
 elif test -d .bzr; then
   test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
-  eval exec bzr ls --versioned '"$dir"' $postprocess
+  eval exec bzr ls -R --versioned '"$dir"' $postprocess
 elif test -d CVS; then
   test "$postprocess" = '' && postprocess="| sed 's|^\./||'"
   if test -x build-aux/cvsu; then
diff --git a/build-aux/warn-on-use.h b/build-aux/warn-on-use.h
new file mode 100644
index 0000000..03ae871
--- /dev/null
+++ b/build-aux/warn-on-use.h
@@ -0,0 +1,92 @@
+/* A C macro for emitting warnings if a function is used.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
+   for FUNCTION which will then trigger a compiler warning containing
+   the text of "literal string" anywhere that function is called, if
+   supported by the compiler.  If the compiler does not support this
+   feature, the macro expands to an unused extern declaration.
+
+   This macro is useful for marking a function as a potential
+   portability trap, with the intent that "literal string" include
+   instructions on the replacement function that should be used
+   instead.  However, one of the reasons that a function is a
+   portability trap is if it has the wrong signature.  Declaring
+   FUNCTION with a different signature in C is a compilation error, so
+   this macro must use the same type as any existing declaration so
+   that programs that avoid the problematic FUNCTION do not fail to
+   compile merely because they included a header that poisoned the
+   function.  But this implies that _GL_WARN_ON_USE is only safe to
+   use if FUNCTION is known to already have a declaration.  Use of
+   this macro implies that there must not be any other macro hiding
+   the declaration of FUNCTION; but undefining FUNCTION first is part
+   of the poisoning process anyway (although for symbols that are
+   provided only via a macro, the result is a compilation error rather
+   than a warning containing "literal string").  Also note that in
+   C++, it is only safe to use if FUNCTION has no overloads.
+
+   For an example, it is possible to poison 'getline' by:
+   - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
+     [getline]) in configure.ac, which potentially defines
+     HAVE_RAW_DECL_GETLINE
+   - adding this code to a header that wraps the system <stdio.h>:
+     #undef getline
+     #if HAVE_RAW_DECL_GETLINE
+     _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
+       "not universally present; use the gnulib module getline");
+     #endif
+
+   It is not possible to directly poison global variables.  But it is
+   possible to write a wrapper accessor function, and poison that
+   (less common usage, like &environ, will cause a compilation error
+   rather than issue the nice warning, but the end result of informing
+   the developer about their portability problem is still achieved):
+   #if HAVE_RAW_DECL_ENVIRON
+   static inline char ***rpl_environ (void) { return &environ; }
+   _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
+   # undef environ
+   # define environ (*rpl_environ ())
+   #endif
+   */
+#ifndef _GL_WARN_ON_USE
+
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+/* A compiler attribute is available in gcc versions 4.3.0 and later.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
+
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE(function, message) \
+extern int _gl_warn_on_use
+# endif
+#endif
+
+/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
+   is like _GL_WARN_ON_USE (function, "string"), except that the function is
+   declared with the given prototype, consisting of return type, parameters,
+   and attributes.
+   This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
+   not work in this case.  */
+#ifndef _GL_WARN_ON_USE_CXX
+# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
+#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+extern rettype function parameters_and_attributes \
+     __attribute__ ((__warning__ (msg)))
+# else /* Unsupported.  */
+#  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
+extern int _gl_warn_on_use
+# endif
+#endif
diff --git a/configure.ac b/configure.ac
index 35c2ed9..73a4bd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl
 
 define(GUILE_CONFIGURE_COPYRIGHT,[[
 
-Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 
2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 
2008, 2009, 2010 Free Software Foundation, Inc.
 
 This file is part of GUILE
 
@@ -105,14 +105,6 @@ AC_ARG_ENABLE(error-on-warning,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;;
    esac])
 
-SCM_I_GSC_GUILE_DEBUG_FREELIST=0
-AC_ARG_ENABLE(debug-freelist,
-  [  --enable-debug-freelist include garbage collector freelist debugging 
code],
-  if test "$enable_debug_freelist" = y \
-     || test "$enable_debug_freelist" = yes; then
-    SCM_I_GSC_GUILE_DEBUG_FREELIST=1
-  fi)
-
 AC_ARG_ENABLE(debug-malloc,
   [  --enable-debug-malloc   include malloc debugging code],
   if test "$enable_debug_malloc" = y || test "$enable_debug_malloc" = yes; then
@@ -168,10 +160,6 @@ fi
 AC_DEFINE_UNQUOTED([SCM_WARN_DEPRECATED_DEFAULT], "$warn_default",
 [Define this to control the default warning level for deprecated features.])
 
-AC_ARG_ENABLE(elisp,
-  [  --disable-elisp         omit Emacs Lisp support],,
-  enable_elisp=yes)
-
 dnl  Added the following configure option in January 2008 following
 dnl  investigation of problems with "64" system and library calls on
 dnl  Darwin (MacOS X).  The libguile code (_scm.h) assumes that if a
@@ -262,11 +250,6 @@ if test "$enable_debug_malloc" = yes; then
    AC_LIBOBJ([debug-malloc])
 fi
 
-if test "$enable_elisp" = yes; then
-  SCM_I_GSC_ENABLE_ELISP=1
-else
-  SCM_I_GSC_ENABLE_ELISP=0
-fi
 AC_CHECK_LIB(uca, __uc_get_ar_bsp)
 
 AC_C_CONST
@@ -671,6 +654,16 @@ sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h 
sys/types.h \
 sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
 direct.h langinfo.h nl_types.h machine/fpu.h])
 
+# Reasons for testing:
+#   nl_item - lacking on Cygwin
+AC_CHECK_TYPES([nl_item], [], [],
+  [[#ifdef HAVE_LANGINFO_H
+    # include <langinfo.h>
+    #endif
+    #ifdef HAVE_NL_TYPES_H
+    # include <nl_types.h>
+    #endif]])
+
 # "complex double" is new in C99, and "complex" is only a keyword if
 # <complex.h> is included
 AC_CHECK_TYPES(complex double,,,
@@ -764,8 +757,9 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
 #   _NSGetEnviron - Darwin specific
 #   strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
 #   nl_langinfo - X/Open, not available on Windows.
+#   utimensat: posix.1-2008
 #
-AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround 
ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir 
mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select 
setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime 
strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup 
system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill 
getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy 
rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale 
nl_langinfo])
+AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround 
ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat 
mkdir mknod nice pipe _pipe readdir_r readdir64_r readlink rename rmdir select 
setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime 
strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup 
system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill 
getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy 
rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale 
nl_langinfo utimensat])
 
 # Reasons for testing:
 #   netdb.h - not in mingw
@@ -865,11 +859,14 @@ fi
 
 
 dnl GMP tests
-AC_LIB_HAVE_LINKFLAGS(gmp,
+AC_LIB_HAVE_LINKFLAGS([gmp],
   [],
   [#include <gmp.h>],
-  [mpz_import (0, 0, 0, 0, 0, 0, 0);],
-  AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README]))
+  [mpz_import (0, 0, 0, 0, 0, 0, 0);])
+
+if test "x$HAVE_LIBGMP" != "xyes"; then
+  AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README])
+fi
 
 dnl GNU libunistring is checked for by Gnulib's `libunistring' module.
 if test "x$LTLIBUNISTRING" != "x"; then
@@ -878,6 +875,22 @@ else
   AC_MSG_ERROR([GNU libunistring is required, please install it.])
 fi
 
+dnl Libffi is needed to compile Guile's foreign function interface, but its
+dnl interface isn't exposed in Guile's API.
+PKG_CHECK_MODULES(LIBFFI, libffi)
+AC_SUBST(LIBFFI_CFLAGS)
+AC_SUBST(LIBFFI_LIBS)
+
+dnl figure out approriate ffi type for size_t
+AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(ssize_t)
+ffi_size_type=uint$(($ac_cv_sizeof_size_t*8))
+ffi_ssize_type=sint$(($ac_cv_sizeof_ssize_t*8))
+AC_DEFINE_UNQUOTED(ffi_type_size_t, ffi_type_${ffi_size_type}, 
+                  [ffi type for size_t])
+AC_DEFINE_UNQUOTED(ffi_type_ssize_t, ffi_type_${ffi_ssize_type}, 
+                  [ffi type for ssize_t])
+
 dnl i18n tests
 #AC_CHECK_HEADERS([libintl.h])
 #AC_CHECK_FUNCS(gettext)
@@ -1157,7 +1170,10 @@ int main () { return (isnan(x) != 0); }]]),
 # Note AC_STRUCT_ST_BLOCKS is not used here because we don't want the
 # AC_LIBOBJ(fileblocks) replacement which that macro gives.
 #
-AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct 
stat.st_blocks])
+AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize, struct 
stat.st_blocks, struct stat.st_atim, struct stat.st_mtim, struct 
stat.st_ctim],,,
+                 [#define _GNU_SOURCE
+AC_INCLUDES_DEFAULT
+])
 
 AC_STRUCT_TIMEZONE
 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,
@@ -1595,10 +1611,8 @@ AC_SUBST([sitedir])
 
 # Additional SCM_I_GSC definitions are above.
 AC_SUBST([SCM_I_GSC_GUILE_DEBUG])
-AC_SUBST([SCM_I_GSC_GUILE_DEBUG_FREELIST])
 AC_SUBST([SCM_I_GSC_ENABLE_DISCOURAGED])
 AC_SUBST([SCM_I_GSC_ENABLE_DEPRECATED])
-AC_SUBST([SCM_I_GSC_ENABLE_ELISP])
 AC_SUBST([SCM_I_GSC_STACK_GROWS_UP])
 AC_SUBST([SCM_I_GSC_C_INLINE])
 AC_CONFIG_FILES([libguile/gen-scmconfig.h])
@@ -1611,7 +1625,6 @@ AC_CONFIG_FILES([
   doc/Makefile
   doc/r5rs/Makefile
   doc/ref/Makefile
-  doc/tutorial/Makefile
   emacs/Makefile
   examples/Makefile
   libguile/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 06f55a7..c296045 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with Automake to create Makefile.in
 ##
-##     Copyright (C) 1998, 2002, 2006, 2008, 2009 Free Software Foundation, 
Inc.
+##     Copyright (C) 1998, 2002, 2006, 2008, 2009, 2010 Free Software 
Foundation, Inc.
 ##
 ##   This file is part of GUILE.
 ##
@@ -21,7 +21,7 @@
 
 AUTOMAKE_OPTIONS = gnu
 
-SUBDIRS = ref tutorial r5rs
+SUBDIRS = ref r5rs
 
 dist_man1_MANS = guile.1
 
diff --git a/doc/maint/guile.texi b/doc/maint/guile.texi
index 127f0bb..d521f98 100644
--- a/doc/maint/guile.texi
+++ b/doc/maint/guile.texi
@@ -2130,7 +2130,7 @@ all necessary initialization information.
 @c snarfed from goops.c:2318
 @deffn {Scheme Procedure} %method-more-specific? m1 m2 targs
 @deffnx {C Function} scm_sys_method_more_specific_p (m1, m2, targs)
-
+Return true if method @var{m1} is more specific than @var{m2} given the 
argument types (classes) listed in @var{targs}.
 @end deffn
 
 %goops-loaded
@@ -3220,19 +3220,19 @@ environment.  For example:
 @c snarfed from macros.c:165
 @deffn {Scheme Procedure} macro? obj
 @deffnx {C Function} scm_macro_p (obj)
-Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a
-syntax transformer.
+Return @code{#t} if @var{obj} is a regular macro, a memoizing macro, a
+syntax transformer, or a syntax-case macro.
 @end deffn
 
 macro-type
 @c snarfed from macros.c:186
 @deffn {Scheme Procedure} macro-type m
 @deffnx {C Function} scm_macro_type (m)
-Return one of the symbols @code{syntax}, @code{macro} or
address@hidden, depending on whether @var{m} is a syntax
-transformer, a regular macro, or a memoizing macro,
-respectively.  If @var{m} is not a macro, @code{#f} is
-returned.
+Return one of the symbols @code{syntax}, @code{macro},
address@hidden, or @code{syntax-case}, depending on whether
address@hidden is a syntax transformer, a regular macro, a memoizing
+macro, or a syntax-case macro, respectively.  If @var{m} is
+not a macro, @code{#f} is returned.
 @end deffn
 
 macro-name
@@ -3300,7 +3300,7 @@ Return a interface eval closure for the module 
@var{module}. Such a closure does
 @c snarfed from modules.c:399
 @deffn {Scheme Procedure} module-import-interface module sym
 @deffnx {C Function} scm_module_import_interface (module, sym)
-
+Return the module or interface from which @var{sym} is imported in 
@var{module}.  If @var{sym} is not imported (i.e., it is not defined in 
@var{module} or it is a module-local binding instead of an imported one), then 
@code{#f} is returned.
 @end deffn
 
 %get-pre-modules-obarray
@@ -3689,10 +3689,9 @@ procedure does not accept complex arguments.
 
 make-rectangular
 @c snarfed from numbers.c:5286
address@hidden {Scheme Procedure} make-rectangular real imaginary
address@hidden {C Function} scm_make_rectangular (real, imaginary)
-Return a complex number constructed of the given @var{real} and
address@hidden parts.
address@hidden {Scheme Procedure} make-rectangular real_part imaginary_part
address@hidden {C Function} scm_make_rectangular (real_part, imaginary_part)
+Return a complex number constructed of the given @var{real-part} and 
@var{imaginary-part} parts.
 @end deffn
 
 make-polar
@@ -4361,8 +4360,8 @@ with the associated setter @var{setter}.
 @c snarfed from procs.c:308
 @deffn {Scheme Procedure} procedure proc
 @deffnx {C Function} scm_procedure (proc)
-Return the procedure of @var{proc}, which must be either a
-procedure with setter, or an operator struct.
+Return the procedure of @var{proc}, which must be an
+applicable struct.
 @end deffn
 
 primitive-make-property
@@ -4566,7 +4565,9 @@ Install the procedure @var{proc} for reading expressions
 starting with the character sequence @code{#} and @var{chr}.
 @var{proc} will be called with two arguments:  the character
 @var{chr} and the port to read further data from. The object
-returned will be the return value of @code{read}.
+returned will be the return value of @code{read}. 
+Passing @code{#f} for @var{proc} will remove a previous setting. 
+
 @end deffn
 
 call-with-dynamic-root
@@ -5438,30 +5439,23 @@ Return the number of elements in the uniform vector 
@var{v}.
 
 uniform-vector-read!
 @c snarfed from srfi-4.c:845
address@hidden {Scheme Procedure} uniform-vector-read! uvec [port_or_fd [start 
[end]]]
address@hidden {C Function} scm_uniform_vector_read_x (uvec, port_or_fd, start, 
end)
-Fill the elements of @var{uvec} by reading
-raw bytes from @var{port-or-fdes}, using host byte order.
address@hidden {Scheme Procedure} uniform-array-read! ura [port_or_fd [start 
[end]]]
address@hidden {Scheme Procedure} uniform-vector-read! uve [port-or-fdes] 
[start] [end]
address@hidden {C Function} scm_uniform_array_read_x (ura, port_or_fd, start, 
end)
+Attempt to read all elements of @var{ura}, in lexicographic order, as
+binary objects from @var{port-or-fdes}.
+If an end of file is encountered,
+the objects up to that point are put into @var{ura}
+(starting at the beginning) and the remainder of the array is
+unchanged.
 
-The optional arguments @var{start} (inclusive) and @var{end}
-(exclusive) allow a specified region to be read,
+The optional arguments @var{start} and @var{end} allow
+a specified region of a vector (or linearized array) to be read,
 leaving the remainder of the vector unchanged.
 
-When @var{port-or-fdes} is a port, all specified elements
-of @var{uvec} are attempted to be read, potentially blocking
-while waiting formore input or end-of-file.
-When @var{port-or-fd} is an integer, a single call to
-read(2) is made.
-
-An error is signalled when the last element has only
-been partially filled before reaching end-of-file or in
-the single call to read(2).
-
address@hidden returns the number of elements
-read.
-
address@hidden may be omitted, in which case it defaults
-to the value returned by @code{(current-input-port)}.
address@hidden returns the number of objects read.
address@hidden may be omitted, in which case it defaults to the value
+returned by @code{(current-input-port)}.
 @end deffn
 
 uniform-vector-write
@@ -6671,8 +6665,9 @@ mismatch index, depending upon whether @var{s1} is less 
than,
 equal to, or greater than @var{s2}.  The mismatch index is the
 largest index @var{i} such that for every 0 <= @var{j} <
 @var{i}, @address@hidden = @address@hidden -- that is,
address@hidden is the first position that does not match.  The
-character comparison is done case-insensitively.
address@hidden is the first position where the lowercased letters 
+do not match.
+
 @end deffn
 
 string=
@@ -7090,8 +7085,8 @@ operate on.  The return value is unspecified.
 
 string-append/shared
 @c snarfed from srfi-13.c:2635
address@hidden {Scheme Procedure} string-append/shared . ls
address@hidden {C Function} scm_string_append_shared (ls)
address@hidden {Scheme Procedure} string-append/shared . rest
address@hidden {C Function} scm_string_append_shared (rest)
 Like @code{string-append}, but the result may share memory
 with the argument strings.
 @end deffn
@@ -7749,7 +7744,8 @@ character sets.
 
 string=?
 @c snarfed from strorder.c:50
address@hidden {Scheme Procedure} string=? s1 s2
address@hidden {Scheme Procedure} string=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_equal_p (s1, s2, rest)
 Lexicographic equality predicate; return @code{#t} if the two
 strings are the same length and contain the same characters in
 the same positions, otherwise return @code{#f}.
@@ -7762,7 +7758,8 @@ characters.
 
 string-ci=?
 @c snarfed from strorder.c:62
address@hidden {Scheme Procedure} string-ci=? s1 s2
address@hidden {Scheme Procedure} string-ci=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_equal_p (s1, s2, rest)
 Case-insensitive string equality predicate; return @code{#t} if
 the two strings are the same length and their component
 characters match (ignoring case) at each position; otherwise
@@ -7771,35 +7768,40 @@ return @code{#f}.
 
 string<?
 @c snarfed from strorder.c:72
address@hidden {Scheme Procedure} string<? s1 s2
address@hidden {Scheme Procedure} string<? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_less_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically less than @var{s2}.
 @end deffn
 
 string<=?
 @c snarfed from strorder.c:82
address@hidden {Scheme Procedure} string<=? s1 s2
address@hidden {Scheme Procedure} string<=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_leq_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically less than or equal to @var{s2}.
 @end deffn
 
 string>?
 @c snarfed from strorder.c:92
address@hidden {Scheme Procedure} string>? s1 s2
address@hidden {Scheme Procedure} string>? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_gr_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically greater than @var{s2}.
 @end deffn
 
 string>=?
 @c snarfed from strorder.c:102
address@hidden {Scheme Procedure} string>=? s1 s2
address@hidden {Scheme Procedure} string>=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_geq_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically greater than or equal to @var{s2}.
 @end deffn
 
 string-ci<?
 @c snarfed from strorder.c:113
address@hidden {Scheme Procedure} string-ci<? s1 s2
address@hidden {Scheme Procedure} string-ci<? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_less_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically less than @var{s2}
 regardless of case.
@@ -7807,7 +7809,8 @@ regardless of case.
 
 string-ci<=?
 @c snarfed from strorder.c:124
address@hidden {Scheme Procedure} string-ci<=? s1 s2
address@hidden {Scheme Procedure} string-ci<=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_leq_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically less than or equal
 to @var{s2} regardless of case.
@@ -7815,7 +7818,8 @@ to @var{s2} regardless of case.
 
 string-ci>?
 @c snarfed from strorder.c:135
address@hidden {Scheme Procedure} string-ci>? s1 s2
address@hidden {Scheme Procedure} string-ci>? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_gr_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically greater than
 @var{s2} regardless of case.
@@ -7823,7 +7827,8 @@ Case insensitive lexicographic ordering predicate; return
 
 string-ci>=?
 @c snarfed from strorder.c:146
address@hidden {Scheme Procedure} string-ci>=? s1 s2
address@hidden {Scheme Procedure} string-ci>=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_geq_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically greater than or
 equal to @var{s2} regardless of case.
diff --git a/doc/mbapi.texi b/doc/mbapi.texi
deleted file mode 100644
index 3f53ccd..0000000
--- a/doc/mbapi.texi
+++ /dev/null
@@ -1,987 +0,0 @@
-\input texinfo
address@hidden mbapi.info
address@hidden Multibyte API
address@hidden off
-
address@hidden Open issues:
-
address@hidden What's the best way to report errors?  Should functions return a
address@hidden magic value, according to C tradition, or should they signal a
address@hidden Guile exception?
-
address@hidden 
-
-
address@hidden Working With Multibyte Strings in C
address@hidden Working With Multibyte Strings in C
-
-Guile allows strings to contain characters drawn from a wide variety of
-languages, including many Asian, Eastern European, and Middle Eastern
-languages, in a uniform and unrestricted way.  The string representation
-normally used in C code --- an array of @sc{ASCII} characters --- is not
-sufficient for Guile strings, since they may contain characters not
-present in @sc{ASCII}.
-
-Instead, Guile uses a very large character set, and encodes each
-character as a sequence of one or more bytes.  We call this
-variable-width encoding a @dfn{multibyte} encoding.  Guile uses this
-single encoding internally for all strings, symbol names, error
-messages, etc., and performs appropriate conversions upon input and
-output.
-
-The use of this variable-width encoding is almost invisible to Scheme
-code.  Strings are still indexed by character number, not by byte
-offset; @code{string-length} still returns the length of a string in
-characters, not in bytes.  @code{string-ref} and @code{string-set!} are
-no longer guaranteed to be constant-time operations, but Guile uses
-various strategies to reduce the impact of this change.
-
-However, the encoding is visible via Guile's C interface, which gives
-the user direct access to a string's bytes.  This chapter explains how
-to work with Guile multibyte text in C code.  Since variable-width
-encodings are clumsier to work with than simple fixed-width encodings,
-Guile provides a set of standard macros and functions for manipulating
-multibyte text to make the job easier.  Furthermore, Guile makes some
-promises about the encoding which you can use in writing your own text
-processing code.
-
-While we discuss guaranteed properties of Guile's encoding, and provide
-functions to operate on its character set, we do not actually specify
-either the character set or encoding here.  This is because we expect
-both of them to change in the future: currently, Guile uses the same
-encoding as GNU Emacs 20.4, but we hope to change Guile (and GNU Emacs
-as well) to use Unicode and UTF-8, with some extensions.  This will make
-it more comfortable to use Guile with other systems which use UTF-8,
-like the GTk user interface toolkit.
-
address@hidden
-* Multibyte String Terminology::  
-* Promised Properties of the Guile Multibyte Encoding::  
-* Functions for Operating on Multibyte Text::  
-* Multibyte Text Processing Errors::  
-* Why Guile Does Not Use a Fixed-Width Encoding::  
address@hidden menu
-
-
address@hidden Multibyte String Terminology, Promised Properties of the Guile 
Multibyte Encoding, Working With Multibyte Strings in C, Working With Multibyte 
Strings in C
address@hidden Multibyte String Terminology 
-
-In the descriptions which follow, we make the following definitions:
address@hidden @dfn
-
address@hidden byte
-A @dfn{byte} is a number between 0 and 255.  It has no inherent textual
-interpretation.  So 65 is a byte, not a character.
-
address@hidden character
-A @dfn{character} is a unit of text.  It has no inherent numeric value.
address@hidden and @samp{.} are characters, not bytes.  (This is different
-from the C language's definition of @dfn{character}; in this chapter, we
-will always use a phrase like ``the C language's @code{char} type'' when
-that's what we mean.)
-
address@hidden character set
-A @dfn{character set} is an invertible mapping between numbers and a
-given set of characters.  @sc{ASCII} is a character set assigning
-characters to the numbers 0 through 127.  It maps @samp{A} onto the
-number 65, and @samp{.} onto 46.
-
-Note that a character set maps characters onto numbers, @emph{not
-necessarily} onto bytes.  For example, the Unicode character set maps
-the Greek lower-case @samp{alpha} character onto the number 945, which
-is not a byte.
-
-(This is what Internet standards would call a "coding character set".)
-
address@hidden encoding
-An encoding maps numbers onto sequences of bytes.  For example, the
-UTF-8 encoding, defined in the Unicode Standard, would map the number
-945 onto the sequence of bytes @samp{206 177}.  When using the
address@hidden character set, every number assigned also happens to be a
-byte, so there is an obvious trivial encoding for @sc{ASCII} in bytes.
-
-(This is what Internet standards would call a "character encoding
-scheme".)
-
address@hidden table
-
-Thus, to turn a character into a sequence of bytes, you need a character
-set to assign a number to that character, and then an encoding to turn
-that number into a sequence of bytes.
-
-Likewise, to interpret a sequence of bytes as a sequence of characters,
-you use an encoding to extract a sequence of numbers from the bytes, and
-then a character set to turn the numbers into characters.
-
-Errors can occur while carrying out either of these processes.  For
-example, under a particular encoding, a given string of bytes might not
-correspond to any number.  For example, the byte sequence @samp{128 128}
-is not a valid encoding of any number under UTF-8.
-
-Having carefully defined our terminology, we will now abuse it.
-
-We will sometimes use the word @dfn{character} to refer to the number
-assigned to a character by a character set, in contexts where it's
-obvious we mean a number.
-
-Sometimes there is a close association between a particular encoding and
-a particular character set.  Thus, we may sometimes refer to the
-character set and encoding together as an @dfn{encoding}.
-
-
address@hidden Promised Properties of the Guile Multibyte Encoding, Functions 
for Operating on Multibyte Text, Multibyte String Terminology, Working With 
Multibyte Strings in C
address@hidden Promised Properties of the Guile Multibyte Encoding
-
-Internally, Guile uses a single encoding for all text --- symbols,
-strings, error messages, etc.  Here we list a number of helpful
-properties of Guile's encoding.  It is correct to write code which
-assumes these properties; code which uses these assumptions will be
-portable to all future versions of Guile, as far as we know.
-
address@hidden @sc{ASCII} character is encoded as a single byte from 0 to 127, 
in
-the obvious way.}  This means that a standard C string containing only
address@hidden characters is a valid Guile string (except for the terminator;
-Guile strings store the length explicitly, so they can contain null
-characters).
-
address@hidden encodings of address@hidden characters use only bytes between 128
-and 255.}  That is, when we turn a address@hidden character into a
-series of bytes, none of those bytes can ever be mistaken for the
-encoding of an @sc{ASCII} character.  This means that you can search a
-Guile string for an @sc{ASCII} character using the standard
address@hidden library function.  By extension, you can search for an
address@hidden substring in a Guile string using a traditional substring
-search algorithm --- you needn't add special checks to verify encoding
-boundaries, etc.
-
address@hidden character encoding is a subsequence of any other character
-encoding.}  (This is just a stronger version of the previous promise.)
-This means that you can search for occurrences of one Guile string
-within another Guile string just as if they were raw byte strings.  You
-can use the stock @code{memmem} function (provided on GNU systems, at
-least) for such searches.  If you don't need the ability to represent
-null characters in your text, you can still use null-termination for
-strings, and use the traditional string-handling functions like
address@hidden, @code{strstr}, and @code{strcat}.
-
address@hidden can always determine the full length of a character's encoding
-from its first byte.}  Guile provides the macro @code{scm_mb_len} which
-computes the encoding's length from its first byte.  Given the first
-rule, you can see that @code{scm_mb_len (@var{b})}, for any @code{0 <=
address@hidden <= 127}, returns 1.
-
address@hidden an arbitrary byte position in a Guile string, you can always
-find the beginning and end of the character containing that byte without
-scanning too far in either direction.}  This means that, if you are sure
-a byte sequence is a valid encoding of a character sequence, you can
-find character boundaries without keeping track of the beginning and
-ending of the overall string.  This promise relies on the fact that, in
-addition to storing the string's length explicitly, Guile always either
-terminates the string's storage with a zero byte, or shares it with
-another string which is terminated this way.
-
-
address@hidden Functions for Operating on Multibyte Text, Multibyte Text 
Processing Errors, Promised Properties of the Guile Multibyte Encoding, Working 
With Multibyte Strings in C
address@hidden Functions for Operating on Multibyte Text
-
-Guile provides a variety of functions, variables, and types for working
-with multibyte text.
-
address@hidden
-* Basic Multibyte Character Processing::  
-* Finding Character Encoding Boundaries::  
-* Multibyte String Functions::  
-* Exchanging Guile Text With the Outside World in C::  
-* Implementing Your Own Text Conversions::  
address@hidden menu
-
-
address@hidden Basic Multibyte Character Processing, Finding Character Encoding 
Boundaries, Functions for Operating on Multibyte Text, Functions for Operating 
on Multibyte Text
address@hidden Basic Multibyte Character Processing
-
-Here are the essential types and functions for working with Guile text.
-Guile uses the C type @code{unsigned char *} to refer to text encoded
-with Guile's encoding.
-
-Note that any operation marked here as a ``Libguile Macro'' might
-evaluate its argument multiple times.
-
address@hidden {Libguile Type} scm_char_t
-This is a signed integral type large enough to hold any character in
-Guile's character set.  All character numbers are positive.
address@hidden deftp
-
address@hidden {Libguile Macro} scm_char_t scm_mb_get (const unsigned char 
address@hidden)
-Return the character whose encoding starts at @var{p}.  If @var{p} does
-not point at a valid character encoding, the behavior is undefined.
address@hidden deftypefn
-
address@hidden {Libguile Macro} int scm_mb_put (unsigned char address@hidden, 
scm_char_t @var{c})
-Place the encoded form of the Guile character @var{c} at @var{p}, and
-return its length in bytes.  If @var{c} is not a Guile character, the
-behavior is undefined.
address@hidden deftypefn
-
address@hidden {Libguile Constant} int scm_mb_max_len
-The maximum length of any character's encoding, in bytes.  You may
-assume this is relatively small --- less than a dozen or so.
address@hidden deftypevr
-
address@hidden {Libguile Macro} int scm_mb_len (unsigned char @var{b})
-If @var{b} is the first byte of a character's encoding, return the full
-length of the character's encoding, in bytes.  If @var{b} is not a valid
-leading byte, the behavior is undefined.
address@hidden deftypefn
-
address@hidden {Libguile Macro} int scm_mb_char_len (scm_char_t @var{c})
-Return the length of the encoding of the character @var{c}, in bytes.
-If @var{c} is not a valid Guile character, the behavior is undefined.
address@hidden deftypefn
-
address@hidden {Libguile Function} scm_char_t scm_mb_get_func (const unsigned 
char address@hidden)
address@hidden {Libguile Function} int scm_mb_put_func (unsigned char 
address@hidden, scm_char_t @var{c})
address@hidden {Libguile Function} int scm_mb_len_func (unsigned char @var{b})
address@hidden {Libguile Function} int scm_mb_char_len_func (scm_char_t @var{c})
-These are functions identical to the corresponding macros.  You can use
-them in situations where the overhead of a function call is acceptable,
-and the cleaner semantics of function application are desireable.
address@hidden deftypefn
-
-
address@hidden Finding Character Encoding Boundaries, Multibyte String 
Functions, Basic Multibyte Character Processing, Functions for Operating on 
Multibyte Text
address@hidden Finding Character Encoding Boundaries
-
-These are functions for finding the boundaries between characters in
-multibyte text.
-
-Note that any operation marked here as a ``Libguile Macro'' might
-evaluate its argument multiple times, unless the definition promises
-otherwise.
-
address@hidden {Libguile Macro} int scm_mb_boundary_p (const unsigned char 
address@hidden)
-Return non-zero iff @var{p} points to the start of a character in
-multibyte text.
-
-This macro will evaluate its argument only once.
address@hidden deftypefn
-
address@hidden {Libguile Function} {const unsigned char *} scm_mb_floor (const 
unsigned char address@hidden)
-``Round'' @var{p} to the previous character boundary.  That is, if
address@hidden points to the middle of the encoding of a Guile character,
-return a pointer to the first byte of the encoding.  If @var{p} points
-to the start of the encoding of a Guile character, return @var{p}
-unchanged.
address@hidden deftypefn
-
address@hidden {libguile Function} {const unsigned char *} scm_mb_ceiling 
(const unsigned char address@hidden)
-``Round'' @var{p} to the next character boundary.  That is, if @var{p}
-points to the middle of the encoding of a Guile character, return a
-pointer to the first byte of the encoding of the next character.  If
address@hidden points to the start of the encoding of a Guile character, return
address@hidden unchanged.
address@hidden deftypefn
-
-Note that it is usually not friendly for functions to silently correct
-byte offsets that point into the middle of a character's encoding.  Such
-offsets almost always indicate a programming error, and they should be
-reported as early as possible.  So, when you write code which operates
-on multibyte text, you should not use functions like these to ``clean
-up'' byte offsets which the originator believes to be correct; instead,
-your code should signal a @code{text:not-char-boundary} error as soon as
-it detects an invalid offset.  @xref{Multibyte Text Processing Errors}.
-
-
address@hidden Multibyte String Functions, Exchanging Guile Text With the 
Outside World in C, Finding Character Encoding Boundaries, Functions for 
Operating on Multibyte Text
address@hidden Multibyte String Functions
-
-These functions allow you to operate on multibyte strings: sequences of
-character encodings.
-
address@hidden {Libguile Function} int scm_mb_count (const unsigned char 
address@hidden, int @var{len})
-Return the number of Guile characters encoded by the @var{len} bytes at
address@hidden
-
-If the sequence contains any invalid character encodings, or ends with
-an incomplete character encoding, signal a @code{text:bad-encoding}
-error.
address@hidden deftypefn
-
address@hidden {Libguile Macro} scm_char_t scm_mb_walk (unsigned char 
address@hidden)
-Return the character whose encoding starts at @address@hidden, and
-advance @address@hidden to the start of the next character.  Return -1
-if @address@hidden does not point to a valid character encoding.
address@hidden deftypefn
-
address@hidden {Libguile Function} {const unsigned char *} scm_mb_prev (const 
unsigned char address@hidden)
-If @var{p} points to the middle of the encoding of a Guile character,
-return a pointer to the first byte of the encoding.  If @var{p} points
-to the start of the encoding of a Guile character, return the start of
-the previous character's encoding.
-
-This is like @code{scm_mb_floor}, but the returned pointer will always
-be before @var{p}.  If you use this function to drive an iteration, it
-guarantees backward progress.
address@hidden deftypefn
-
address@hidden {Libguile Function} {const unsigned char *} scm_mb_next (const 
unsigned char address@hidden)
-If @var{p} points to the encoding of a Guile character, return a pointer
-to the first byte of the encoding of the next character.
-
-This is like @code{scm_mb_ceiling}, but the returned pointer will always
-be after @var{p}.  If you use this function to drive an iteration, it
-guarantees forward progress.
address@hidden deftypefn
-
address@hidden {Libguile Function} {const unsigned char *} scm_mb_index (const 
unsigned char address@hidden, int @var{len}, int @var{i})
-Assuming that the @var{len} bytes starting at @var{p} are a
-concatenation of valid character encodings, return a pointer to the
-start of the @var{i}'th character encoding in the sequence.
-
-This function scans the sequence from the beginning to find the
address@hidden'th character, and will generally require time proportional to
-the distance from @var{p} to the returned address.
-
-If the sequence contains any invalid character encodings, or ends with
-an incomplete character encoding, signal a @code{text:bad-encoding}
-error.
address@hidden deftypefn
-
-It is common to process the characters in a string from left to right.
-However, if you fetch each character using @code{scm_mb_index}, each
-call will scan the text from the beginning, so your loop will require
-time proportional to at least the square of the length of the text.  To
-avoid this poor performance, you can use an @code{scm_mb_cache}
-structure and the @code{scm_mb_index_cached} macro.
-
address@hidden {Libguile Type} {struct scm_mb_cache}
-This structure holds information that allows a string scanning operation
-to use the results from a previous scan of the string.  It has the
-following members:
address@hidden @code
-
address@hidden character
-An index, in characters, into the string.
-
address@hidden byte
-The index, in bytes, of the start of that character.
-
address@hidden table
-
-In other words, @code{byte} is the byte offset of the
address@hidden'th character of the string.  Note that if @code{byte}
-and @code{character} are equal, then all characters before that point
-must have encodings exactly one byte long, and the string can be indexed
-normally.
-
-All elements of a @code{struct scm_mb_cache} structure should be
-initialized to zero before its first use, and whenever the string's text
-changes.
address@hidden deftp
-
address@hidden {Libguile Macro} const unsigned char *scm_mb_index_cached (const 
unsigned char address@hidden, int @var{len}, int @var{i}, struct scm_mb_cache 
address@hidden)
address@hidden {Libguile Function} const unsigned char 
*scm_mb_index_cached_func (const unsigned char address@hidden, int @var{len}, 
int @var{i}, struct scm_mb_cache address@hidden)
-This macro and this function are identical to @code{scm_mb_index},
-except that they may consult and update address@hidden in order to avoid
-scanning the string from the beginning.  @code{scm_mb_index_cached} is a
-macro, so it may have less overhead than
address@hidden, but it may evaluate its arguments more
-than once.
-
-Using @code{scm_mb_index_cached} or @code{scm_mb_index_cached_func}, you
-can scan a string from left to right, or from right to left, in time
-proportional to the length of the string.  As long as each character
-fetched is less than some constant distance before or after the previous
-character fetched with @var{cache}, each access will require constant
-time.
address@hidden deftypefn
-
-Guile also provides functions to convert between an encoded sequence of
-characters, and an array of @code{scm_char_t} objects.
-
address@hidden {Libguile Function} scm_char_t *scm_mb_multibyte_to_fixed (const 
unsigned char address@hidden, int @var{len}, int address@hidden)
-Convert the variable-width text in the @var{len} bytes at @var{p}
-to an array of @code{scm_char_t} values.  Return a pointer to the array,
-and set @address@hidden to the number of elements it contains.
-The returned array is allocated with @code{malloc}, and it is the
-caller's responsibility to free it.
-
-If the text is not a sequence of valid character encodings, this
-function will signal a @code{text:bad-encoding} error.
address@hidden deftypefn
-
address@hidden {Libguile Function} unsigned char *scm_mb_fixed_to_multibyte 
(const scm_char_t address@hidden, int @var{len}, int address@hidden)
-Convert the array of @code{scm_char_t} values to a sequence of
-variable-width character encodings.  Return a pointer to the array of
-bytes, and set @address@hidden to its length, in bytes.
-
-The returned byte sequence is terminated with a zero byte, which is not
-counted in the length returned in @address@hidden
-
-The returned byte sequence is allocated with @code{malloc}; it is the
-caller's responsibility to free it.
-
-If the text is not a sequence of valid character encodings, this
-function will signal a @code{text:bad-encoding} error.
address@hidden deftypefn
-
-
address@hidden Exchanging Guile Text With the Outside World in C, Implementing 
Your Own Text Conversions, Multibyte String Functions, Functions for Operating 
on Multibyte Text
address@hidden Exchanging Guile Text With the Outside World in C
-
-[[This is kind of a heavy-weight model, given that one end of the
-conversion is always going to be the Guile encoding.  Any way to shorten
-things a bit?]]
-
-Guile provides functions for converting between Guile's internal text
-representation and encodings popular in the outside world.  These
-functions are closely modeled after the @code{iconv} functions available
-on some systems.
-
-To convert text between two encodings, you should first call
address@hidden to indicate the source and destination
-encodings; this function returns a context object which records the
-conversion to perform.
-
-Then, you should call @code{scm_mb_iconv} to actually convert the text.
-This function expects input and output buffers, and a pointer to the
-context you got from @var{scm_mb_iconv_open}.  You don't need to pass
-all your input to @code{scm_mb_iconv} at once; you can invoke it on
-successive blocks of input (as you read it from a file, say), and it
-will convert as much as it can each time, indicating when you should
-grow your output buffer.
-
-An encoding may be @dfn{stateless}, or @dfn{stateful}.  In most
-encodings, a contiguous group of bytes from the sequence completely
-specifies a particular character; these are stateless encodings.
-However, some encodings require you to look back an unbounded number of
-bytes in the stream to assign a meaning to a particular byte sequence;
-such encodings are stateful.
-
-For example, in the @samp{ISO-2022-JP} encoding for Japanese text, the
-byte sequence @samp{27 36 66} indicates that subsequent bytes should be
-taken in pairs and interpreted as characters from the JIS-0208 character
-set.  An arbitrary number of byte pairs may follow this sequence.  The
-byte sequence @samp{27 40 66} indicates that subsequent bytes should be
-interpreted as @sc{ASCII}.  In this encoding, you cannot tell whether a
-given byte is an @sc{ASCII} character without looking back an arbitrary
-distance for the most recent escape sequence, so it is a stateful
-encoding.
-
-In Guile, if a conversion involves a stateful encoding, the context
-object carries any necessary state.  Thus, you can have many independent
-conversions to or from stateful encodings taking place simultaneously,
-as long as each data stream uses its own context object for the
-conversion.
-
address@hidden {Libguile Type} {struct scm_mb_iconv}
-This is the type for context objects, which represent the encodings and
-current state of an ongoing text conversion.  A @code{struct
-scm_mb_iconv} records the source and destination encodings, and keeps
-track of any information needed to handle stateful encodings.
address@hidden deftp
-
address@hidden {Libguile Function} {struct scm_mb_iconv *} scm_mb_iconv_open 
(const char address@hidden, const char address@hidden)
-Return a pointer to a new @code{struct scm_mb_iconv} context object,
-ready to convert from the encoding named @var{fromcode} to the encoding
-named @var{tocode}.  For stateful encodings, the context object is in
-some appropriate initial state, ready for use with the
address@hidden function.
-
-When you are done using a context object, you may call
address@hidden to free it.
-
-If either @var{tocode} or @var{fromcode} is not the name of a known
-encoding, this function will signal the @code{text:unknown-conversion}
-error, described below.
-
address@hidden Try to use names here from the IANA list: 
address@hidden see ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets
-Guile supports at least these encodings:
address@hidden @samp 
-
address@hidden US-ASCII
address@hidden, in the standard one-character-per-byte encoding.
-
address@hidden ISO-8859-1
-The usual character set for Western European languages, in its usual
-one-character-per-byte encoding.
-
address@hidden Guile-MB
-Guile's current internal multibyte encoding.  The actual encoding this
-name refers to will change from one version of Guile to the next.  You
-should use this when converting data between external sources and the
-encoding used by Guile objects.
-
-You should @emph{not} use this as the encoding for data presented to the
-outside world, for two reasons.  1) Its meaning will change over time,
-so data written using the @samp{guile} encoding with one version of
-Guile might not be readable with the @samp{guile} encoding in another
-version of Guile.  2) It currently corresponds to @samp{Emacs-Mule},
-which invented for Emacs's internal use, and was never intended to serve
-as an exchange medium.
-
address@hidden Guile-Wide
-Guile's character set, as an array of @code{scm_char_t} values.
-
-Note that this encoding is even less suitable for public use than
address@hidden, since the exact sequence of bytes depends heavily on the
-size and endianness the host system uses for @code{scm_char_t}.  Using
-this encoding is very much like calling the
address@hidden or @code{scm_mb_fixed_to_multibyte}
-functions, except that @code{scm_mb_iconv} gives you more control over
-buffer allocation and management.
-
address@hidden Emacs-Mule
-This is the variable-length encoding for multi-lingual text by GNU
-Emacs, at least through version 20.4.  You probably should not use this
-encoding, as it is designed only for Emacs's internal use.  However, we
-provide it here because it's trivial to support, and some people
-probably do have @samp{emacs-mule}-format files lying around.
-
address@hidden table
-
-(At the moment, this list doesn't include any character sets suitable for
-external use that can actually handle multilingual data; this is
-unfortunate, as it encourages users to write data in Emacs-Mule format,
-which nobody but Emacs and Guile understands.  We hope to add support
-for Unicode in UTF-8 soon, which should solve this problem.)
-
-Case is not significant in encoding names.
-
-You can define your own conversions; see @ref{Implementing Your Own Text
-Conversions}.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_have_encoding (const char 
address@hidden)
-Return a non-zero value if Guile supports the encoding named @var{encoding}[[]]
address@hidden deftypefn
-
address@hidden {Libguile Function} size_t scm_mb_iconv (struct scm_mb_iconv 
address@hidden, const char address@hidden, size_t address@hidden, char 
address@hidden, size_t address@hidden)
-Convert a sequence of characters from one encoding to another.  The
-argument @var{context} specifies the encodings to use for the input and
-output, and carries state for stateful encodings; use
address@hidden to create a @var{context} object for a
-particular conversion.
-
-Upon entry to the function, @address@hidden should point to the
-input buffer, and @address@hidden should hold the number of
-input bytes present in the buffer; @address@hidden should point to
-the output buffer, and @address@hidden should hold the number
-of bytes available to hold the conversion results in that buffer.
-
-Upon exit from the function, @address@hidden points to the first
-unconsumed byte of input, and @address@hidden holds the number
-of unconsumed input bytes; @address@hidden points to the byte after
-the last output byte, and @address@hidden holds the number of
-bytes left unused in the output buffer.
-
-For stateful encodings, @var{context} carries encoding state from one
-call to @code{scm_mb_iconv} to the next.  Thus, successive calls to
address@hidden which use the same context object can convert a
-stream of data one chunk at a time.  
-
-If @var{inbuf} is zero or @address@hidden is zero, then the call is
-taken as a request to reset the states of the input and the output
-encodings.  If @var{outbuf} is non-zero and @address@hidden is
-non-zero, then @code{scm_mb_iconv} stores a byte sequence in the output
-buffer to put the output encoding in its initial state.  If the output
-buffer is not large enough to hold this byte sequence,
address@hidden returns @code{scm_mb_iconv_too_big}, and leaves
-the shift states of @var{context}'s input and output encodings
-unchanged.
-
-The @code{scm_mb_iconv} function always consumes only complete
-characters or shift sequences from the input buffer, and the output
-buffer always contains a sequence of complete characters or escape
-sequences.
-
-If the input sequence contains characters which are not expressible in
-the output encoding, @code{scm_mb_iconv} converts it in an
-implementation-defined way.  It may simply delete the character.
-
-Some encodings use byte sequences which do not correspond to any textual
-character.  For example, the escape sequence of a stateful encoding has
-no textual meaning.  When converting from such an encoding, a call to
address@hidden might consume input but produce no output, since the
-input sequence might contain only escape sequences.
-
-Normally, @code{scm_mb_iconv} returns the number of input characters it
-could not convert perfectly to the ouput encoding.  However, it may
-return one of the @code{scm_mb_iconv_} codes described below, to
-indicate an error.  All of these codes are negative values.
-
-If the input sequence contains an invalid character encoding, conversion
-stops before the invalid input character, and @code{scm_mb_iconv}
-returns the constant value @code{scm_mb_iconv_bad_encoding}.
-
-If the input sequence ends with an incomplete character encoding,
address@hidden will leave it in the input buffer, unconsumed, and
-return the constant value @code{scm_mb_iconv_incomplete_encoding}.  This
-is not necessarily an error, if you expect to call @code{scm_mb_iconv}
-again with more data which might contain the rest of the encoding
-fragment.
-
-If the output buffer does not contain enough room to hold the converted
-form of the complete input text, @code{scm_mb_iconv} converts as much as
-it can, changes the input and output pointers to reflect the amount of
-text successfully converted, and then returns
address@hidden
address@hidden deftypefn
-
-Here are the status codes that might be returned by @code{scm_mb_iconv}.
-They are all negative integers.
address@hidden @code
-
address@hidden scm_mb_iconv_too_big
-The conversion needs more room in the output buffer.  Some characters
-may have been consumed from the input buffer, and some characters may
-have been placed in the available space in the output buffer.
-
address@hidden scm_mb_iconv_bad_encoding
address@hidden encountered an invalid character encoding in the
-input buffer.  Conversion stopped before the invalid character, so there
-may be some characters consumed from the input buffer, and some
-converted text in the output buffer.
-
address@hidden scm_mb_iconv_incomplete_encoding
-The input buffer ends with an incomplete character encoding.  The
-incomplete encoding is left in the input buffer, unconsumed.  This is
-not necessarily an error, if you expect to call @code{scm_mb_iconv}
-again with more data which might contain the rest of the incomplete
-encoding.
-
address@hidden table
-
-
-Finally, Guile provides a function for destroying conversion contexts.
-
address@hidden {Libguile Function} void scm_mb_iconv_close (struct scm_mb_iconv 
address@hidden)
-Deallocate the conversion context object @var{context}, and all other
-resources allocated by the call to @code{scm_mb_iconv_open} which
-returned @var{context}.
address@hidden deftypefn
-
-
address@hidden Implementing Your Own Text Conversions,  , Exchanging Guile Text 
With the Outside World in C, Functions for Operating on Multibyte Text
address@hidden Implementing Your Own Text Conversions
-
-[[note that conversions to and from Guile must produce streams
-containing only valid character encodings, or else Guile will crash]]
-
-This section describes the interface for adding your own encoding
-conversions for use with @code{scm_mb_iconv}.  The interface here is
-borrowed from the GNOME Project's @file{libunicode} library.
-
-Guile's @code{scm_mb_iconv} function works by converting the input text
-to a stream of @code{scm_char_t} characters, and then converting
-those characters to the desired output encoding.  This makes it easy
-for Guile to choose the appropriate conversion back ends for an
-arbitrary pair of input and output encodings, but it also means that the
-accuracy and quality of the conversions depends on the fidelity of
-Guile's internal character set to the source and destination encodings.
-Since @code{scm_mb_iconv} will be used almost exclusively for converting
-to and from Guile's internal character set, this shouldn't be a problem.
-
-To add support for a particular encoding to Guile, you must provide one
-function (called the @dfn{read} function) which converts from your
-encoding to an array of @code{scm_char_t}'s, and another function
-(called the @dfn{write} function) to convert from an array of
address@hidden's back into your encoding.  To convert from some
-encoding @var{a} to some other encoding @var{b}, Guile pairs up
address@hidden's read function with @var{b}'s write function.  Each call to
address@hidden passes text in encoding @var{a} through the read
-function, to produce an array of @code{scm_char_t}'s, and then passes
-that array to the write function, to produce text in encoding @var{b}.
-
-For stateful encodings, a read or write function can hang its own data
-structures off the conversion object, and provide its own functions to
-allocate and destroy them; this allows read and write functions to
-maintain whatever state they like.
-
-The Guile conversion back end represents each available encoding with a
address@hidden scm_mb_encoding} object.
-
address@hidden {Libguile Type} {struct scm_mb_encoding}
-This data structure describes an encoding.  It has the following
-members:
-
address@hidden @code
-
address@hidden char **names
-An array of strings, giving the various names for this encoding.  The
-array should be terminated by a zero pointer.  Case is not significant
-in encoding names.
-
-The @code{scm_mb_iconv_open} function searches the list of registered
-encodings for an encoding whose @code{names} array matches its
address@hidden or @var{fromcode} argument.
-
address@hidden int (*init) (void address@hidden)
-An initialization function for the encoding's private data.
address@hidden will call this function, passing it the address
-of the cookie for this encoding in this context.  (We explain cookies
-below.)  There is no way for the @code{init} function to tell whether
-the encoding will be used for reading or writing.
-
-Note that @code{init} receives a @emph{pointer} to the cookie, not the
-cookie itself.  Because the type of @var{cookie} is @code{void **}, the
-C compiler will not check it as carefully as it would other types.
-
-The @code{init} member may be zero, indicating that no initialization is
-necessary for this encoding.
-
address@hidden int (*destroy) (void address@hidden)
-A deallocation function for the encoding's private data.
address@hidden calls this function, passing it the address of
-the cookie for this encoding in this context.  The @code{destroy}
-function should free any data the @code{init} function allocated.
-
-Note that @code{destroy} receives a @emph{pointer} to the cookie, not the
-cookie itself.  Because the type of @var{cookie} is @code{void **}, the
-C compiler will not check it as carefully as it would other types.
-
-The @code{destroy} member may be zero, indicating that this encoding
-doesn't need to perform any special action to destroy its local data.
-
address@hidden int (*reset) (void address@hidden, char address@hidden, size_t 
address@hidden)
-Put the encoding into its initial shift state.  Guile calls this
-function whether the encoding is being used for input or output, so this
-should take appropriate steps for both directions.  If @var{outbuf} and
address@hidden are valid, the reset function should emit an escape
-sequence to reset the output stream to its initial state; @var{outbuf}
-and @var{outbytesleft} should be handled just as for
address@hidden
-
-This function can return an @code{scm_mb_iconv_} error code
-(@pxref{Exchanging Guile Text With the Outside World in C}).  If it
-returns @code{scm_mb_iconv_too_big}, then the output buffer's shift
-state must be left unchanged.
-
-Note that @code{reset} receives the cookie's value itself, not a pointer
-to the cookie, as the @code{init} and @code{destroy} functions do.
-
-The @code{reset} member may be zero, indicating that this encoding
-doesn't use a shift state.
-
address@hidden enum scm_mb_read_result (*read) (void address@hidden, const char 
address@hidden,  size_t address@hidden, scm_char_t address@hidden, size_t 
address@hidden)
-Read some bytes and convert into an array of Guile characters.  This is
-the encoding's read function.
-
-On entry, there are address@hidden bytes of text at address@hidden to
-be converted, and address@hidden characters available at
address@hidden to hold the results.
-
-On exit, address@hidden and address@hidden indicate the input bytes
-still not consumed.  address@hidden and address@hidden indicate the
-output buffer space still not filled.  (By exclusion, these indicate
-which input bytes were consumed, and which output characters were
-produced.)
-
-Return one of the @code{enum scm_mb_read_result} values, described below.
-
-Note that @code{read} receives the cookie's value itself, not a pointer
-to the cookie, as the @code{init} and @code{destroy} functions do.
-
address@hidden enum scm_mb_write_result (*write) (void address@hidden, 
scm_char_t address@hidden, size_t address@hidden, address@hidden, size_t 
address@hidden)
-Convert an array of Guile characters to output bytes.  This is
-the encoding's write function.
-
-On entry, there are address@hidden Guile characters available at
address@hidden, and address@hidden bytes available to store output at
address@hidden
-
-On exit, address@hidden and address@hidden indicate the number of
-Guile characters left unconverted (because there was insufficient room
-in the output buffer to hold their converted forms), and
address@hidden and address@hidden indicate the unused portion of the
-output buffer.
-
-Return one of the @code{scm_mb_write_result} values, described below.
-
-Note that @code{write} receives the cookie's value itself, not a pointer
-to the cookie, as the @code{init} and @code{destroy} functions do.
-
address@hidden struct scm_mb_encoding *next
-This is used by Guile to maintain a linked list of encodings.  It is
-filled in when you call @code{scm_mb_register_encoding} to add your
-encoding to the list.
-
address@hidden table
address@hidden deftp
-
-Here is the enumerated type for the values an encoding's read function
-can return:
-
address@hidden {Libguile Type} {enum scm_mb_read_result}
-This type represents the result of a call to an encoding's read
-function.  It has the following values:
-
address@hidden @code
-
address@hidden scm_mb_read_ok
-The read function consumed at least one byte of input.
-
address@hidden scm_mb_read_incomplete
-The data present in the input buffer does not contain a complete
-character encoding.  No input was consumed, and no characters were
-produced as output.  This is not necessarily an error status, if there
-is more data to pass through.
-
address@hidden scm_mb_read_error
-The input contains an invalid character encoding.
-
address@hidden table
address@hidden deftp
-
-Here is the enumerated type for the values an encoding's write function
-can return:
-
address@hidden {Libguile Type} {enum scm_mb_write_result}
-This type represents the result of a call to an encoding's write
-function.  It has the following values:
-
address@hidden @code
-
address@hidden scm_mb_write_ok
-The write function was able to convert all the characters in @var{inbuf}
-successfully.
-
address@hidden scm_mb_write_too_big
-The write function filled the output buffer, but there are still
-characters in @var{inbuf} left unconsumed; @var{inbuf} and
address@hidden indicate the unconsumed portion of the input buffer.
-
address@hidden table
address@hidden deftp
-
-
-Conversions to or from stateful encodings need to keep track of each
-encoding's current state.  Each conversion context contains two
address@hidden *} variables called @dfn{cookies}, one for the input
-encoding, and one for the output encoding.  These cookies are passed to
-the encodings' functions, for them to use however they please.  A
-stateful encoding can use its cookie to hold a pointer to some object
-which maintains the context's current shift state.  Stateless encodings
-will probably not use their cookies.
-
-The cookies' lifetime is the same as that of the context object.  When
-the user calls @code{scm_mb_iconv_close} to destroy a context object,
address@hidden calls the input and output encodings'
address@hidden functions, passing them their respective cookies, so each
-encoding can free any data it allocated for that context.
-
-Note that, if a read or write function returns a successful result code
-like @code{scm_mb_read_ok} or @code{scm_mb_write_ok}, then the remaining
-input, together with the output, must together represent the complete
-input text; the encoding may not store any text temporarily in its
-cookie.  This is because, if @code{scm_mb_iconv} returns a successful
-result to the user, it is correct for the user to assume that all the
-consumed input has been converted and placed in the output buffer.
-There is no ``flush'' operation to push any final results out of the
-encodings' buffers.
-
-Here is the function you call to register a new encoding with the
-conversion system:
-
address@hidden {Libguile Function} void scm_mb_register_encoding (struct 
scm_mb_encoding address@hidden)
-Add the encoding described by @address@hidden to the set
-understood by @code{scm_mb_iconv_open}.  Once you have registered your
-encoding, you can use it by calling @code{scm_mb_iconv_open} with one of
-the names in @address@hidden>names}.
address@hidden deftypefn
-
-
address@hidden Multibyte Text Processing Errors, Why Guile Does Not Use a 
Fixed-Width Encoding, Functions for Operating on Multibyte Text, Working With 
Multibyte Strings in C
address@hidden Multibyte Text Processing Errors
-
-This section describes error conditions which code can signal to
-indicate problems encountered while processing multibyte text.  In each
-case, the arguments @var{message} and @var{args} are an error format
-string and arguments to be substituted into the string, as accepted by
-the @code{display-error} function.
-
address@hidden Condition text:not-char-boundary func message args object offset
-By calling @var{func}, the program attempted to access a character at
-byte offset @var{offset} in the Guile object @var{object}, but
address@hidden is not the start of a character's encoding in @var{object}.
-
-Typically, @var{object} is a string or symbol.  If the function signalling
-the error cannot find the Guile object that contains the text it is
-inspecting, it should use @code{#f} for @var{object}.
address@hidden deffn
-
address@hidden Condition text:bad-encoding func message args object
-By calling @var{func}, the program attempted to interpret the text in
address@hidden, but @var{object} contains a byte sequence which is not a
-valid encoding for any character.
address@hidden deffn
-
address@hidden Condition text:not-guile-char func message args number
-By calling @var{func}, the program attempted to treat @var{number} as the
-number of a character in the Guile character set, but @var{number} does
-not correspond to any character in the Guile character set.
address@hidden deffn
-
address@hidden Condition text:unknown-conversion func message args from to
-By calling @var{func}, the program attempted to convert from an encoding
-named @var{from} to an encoding named @var{to}, but Guile does not
-support such a conversion.
address@hidden deffn
-
address@hidden {Libguile Variable} SCM scm_text_not_char_boundary
address@hidden {Libguile Variable} SCM scm_text_bad_encoding
address@hidden {Libguile Variable} SCM scm_text_not_guile_char
-These variables hold the scheme symbol objects whose names are the
-condition symbols above.  You can use these when signalling these
-errors, instead of looking them up yourself.
address@hidden deftypevr
-
-
address@hidden Why Guile Does Not Use a Fixed-Width Encoding,  , Multibyte Text 
Processing Errors, Working With Multibyte Strings in C
address@hidden Why Guile Does Not Use a Fixed-Width Encoding
-
-Multibyte encodings are clumsier to work with than encodings which use a
-fixed number of bytes for every character.  For example, using a
-fixed-width encoding, we can extract the @var{i}th character of a string
-in constant time, and we can always substitute the @var{i}th character
-of a string with any other character without reallocating or copying the
-string.
-
-However, there are no fixed-width encodings which include the characters
-we wish to include, and also fit in a reasonable amount of space.
-Despite the Unicode standard's claims to the contrary, Unicode is not
-really a fixed-width encoding.  Unicode uses surrogate pairs to
-represent characters outside the 16-bit range; a surrogate pair must be
-treated as a single character, but occupies two 16-bit spaces.  As of
-this writing, there are already plans to assign characters to the
-surrogate character codes.  Three- and four-byte encodings are
-too wasteful for a majority of Guile's users, who only need @sc{ASCII}
-and a few accented characters.
-
-Another alternative would be to have several different fixed-width
-string representations, each with a different element size.  For each
-string, Guile would use the smallest element size capable of
-accomodating the string's text.  This would allow users of English and
-the Western European languages to use the traditional memory-efficient
-encodings.  However, if Guile has @var{n} string representations, then
-users must write @var{n} versions of any code which manipulates text
-directly --- one for each element size.  And if a user wants to operate
-on two strings simultaneously, and wants to avoid testing the string
-sizes within the loop, she must make @address@hidden copies of the loop.
-Most users will simply not bother.  Instead, they will write code which
-supports only one string size, leaving us back where we started.  By
-using a single internal representation, Guile makes it easier for users
-to write multilingual code.
-
-[[What about tagging each string with its encoding?
-"Every extension must be written to deal with every encoding"]]
-
-[[You don't really want to index strings anyway.]]
-
-Finally, Guile's multibyte encoding is not so bad.  Unlike a two- or
-four-byte encoding, it is efficient in space for American and European
-users.  Furthermore, the properties described above mean that many
-functions can be coded just as they would for a single-byte encoding;
-see @ref{Promised Properties of the Guile Multibyte Encoding}.
-
address@hidden
diff --git a/doc/mltext.texi b/doc/mltext.texi
deleted file mode 100644
index 73071f5..0000000
--- a/doc/mltext.texi
+++ /dev/null
@@ -1,146 +0,0 @@
address@hidden Working with Multilingual Text
address@hidden Working with Multilingual Text
-
address@hidden Guile Character Properties, Exchanging Text With The Outside 
World, Multibyte String Functions, Functions for Operating on Multibyte Text
address@hidden Guile Character Properties
-
-These functions give information about the nature of a given Guile
-character.  These are defined for any @code{scm_mb_char_t} value.
-
address@hidden {Libguile Function} int scm_mb_isalnum (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is an alphabetic or numeric character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_is_alpha (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is an alphabetic character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_iscntrl (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a control character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isdigit (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a digit.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isgraph (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a visible character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isupper (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is an upper-case character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_islower (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a lower-case character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_istitle (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a title-case character.  See the Unicode
-standard for an explanation of title case.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isprint (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a printable character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_ispunct (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a punctuation character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isspace (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a whitespace character.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isxdigit (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a hexadecimal digit.
address@hidden deftypefn
-
address@hidden {Libguile Function} int scm_mb_isdefined (scm_mb_char_t @var{c})
-Return non-zero iff @var{c} is a valid character.
address@hidden deftypefn
-
address@hidden {Libguile Function} scm_mb_char_t scm_mb_char_toupper 
(scm_mb_char_t @var{c})
address@hidden {Libguile Function} scm_mb_char_t scm_mb_char_tolower 
(scm_mb_char_t @var{c})
address@hidden {Libguile Function} scm_mb_char_t scm_mb_char_totitle 
(scm_mb_char_t @var{c})
-Convert @var{c} to upper, lower, or title case.  If @var{c} has no
-equivalent in the requested case, or is already in that case, return it
-unchanged.
address@hidden deftypefn
-
address@hidden {Libguile Function} in scm_mb_digit_value (scm_mb_char_t @var{c})
-If @var{c} is a hexadecimal digit (according to
address@hidden), then return its numeric value.  Otherwise
-return -1.
address@hidden deftypefn
-
address@hidden {Libguile Function} in scm_mb_digit_value (scm_mb_char_t @var{c})
-If @var{c} is a digit (according to @code{scm_mb_isdigit}), then
-return its numeric value.  Otherwise return -1.
address@hidden deftypefn
-
-
address@hidden Multibyte Character Tables, Multibyte Character Categories, 
Exchanging Text With The Outside World, Functions for Operating on Multibyte 
Text
address@hidden Multibyte Character Tables
-
-A @dfn{character table} is a table mapping @code{scm_mb_char_t} values
-onto Guile objects.  Guile provides functions for creating character
-tables, setting entries, and looking up characters.  Character tables
-are Guile objects, so they are managed by Guile's garbage collector.
-
-A character table can have a ``parent'' table, from which it inherits
-values for characters.  If a character table @var{child}, with a parent
-table @var{parent} maps some character @var{c} to the value
address@hidden, then @code{scm_c_char_table_ref (@var{child},
address@hidden)} will look up @var{c} in @var{parent}, and return the value it
-finds there.
-
-This section describes only the C API for working with character tables.
-For the Scheme-level API, see @ref{some other section}.
-
address@hidden {Libguile Function} scm_make_char_table (SCM @var{init}, SCM 
@var{parent})
-Return a new character table object which maps every character to
address@hidden  If @var{parent} is a character table, then @var{parent} is
-the new table's parent.  If @var{parent} table is @code{SCM_UNDEFINED},
-then the new table has no parent.  Otherwise, signal a type error.
address@hidden deffn
-
address@hidden {Libguile Function} SCM scm_c_char_table_ref (SCM @var{table}, 
scm_mb_char_t @var{c})
-Look up the character @var{c} in the character table @var{table}, and
-return the value found there.  If @var{table} maps @var{c} to
address@hidden, and @var{table} has a parent, then look up @var{c}
-in the parent.
-
-If @var{table} is not a character table, signal an error.
address@hidden deftypefn
-
address@hidden {Libguile Function} SCM scm_c_char_table_set_x (SCM @var{table}, 
scm_mb_char_t @var{c}, SCM @var{value})
-Set @var{table}'s value for the character @var{c} to @var{value}.
-If @var{value} is @code{SCM_UNDEFINED}, then @var{table}'s parent's
-value will show through for @var{c}.
-
-If @var{table} is not a character table, signal an error.
-
-This function changes only @var{table} itself, never @var{table}'s
-parent.
address@hidden deftypefn
-
-[[this is all wrong.  what about default values?]]
-
-
-
-
-
address@hidden Multibyte Character Categories,  , Multibyte Character Tables, 
Functions for Operating on Multibyte Text
address@hidden Multibyte Character Categories
-
-[[This will describe an ADT representing subsets of the Guile character
-set.]]
-
-
-
-
address@hidden Exchanging Guile Text With the Outside World
address@hidden Exchanging Guile Text With the Outside World
-
-[[Scheme-level functions for converting between encodings]]
diff --git a/doc/ref/Makefile.am b/doc/ref/Makefile.am
index e201198..16cf7a2 100644
--- a/doc/ref/Makefile.am
+++ b/doc/ref/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with Automake to create Makefile.in
 ##
-##     Copyright (C) 1998, 2004, 2006, 2008 Free Software Foundation, Inc.
+##     Copyright (C) 1998, 2004, 2006, 2008, 2009, 2010 Free Software 
Foundation, Inc.
 ##
 ##   This file is part of GUILE.
 ##
@@ -21,7 +21,7 @@
 
 AUTOMAKE_OPTIONS = gnu
 
-BUILT_SOURCES = lib-version.texi
+BUILT_SOURCES = lib-version.texi standard-library.texi
 
 info_TEXINFOS = guile.texi
 
@@ -35,10 +35,13 @@ guile_TEXINFOS = preface.texi                       \
                 scheme-ideas.texi              \
                 api-data.texi                  \
                 api-procedures.texi            \
+                api-macros.texi                \
                 api-utility.texi               \
                 api-binding.texi               \
                 api-control.texi               \
                 api-io.texi                    \
+                api-foreign.texi               \
+                api-lalr.texi                  \
                 api-evaluation.texi            \
                 api-memory.texi                \
                 api-modules.texi               \
@@ -128,3 +131,30 @@ EXTRA_DIST += lib-version.texi
 # But when we want to get back to a clean tree, lib-version.texi
 # should be cleaned.
 CLEANFILES = lib-version.texi
+
+# Support for snarfing docs out of Scheme modules.
+snarf_doc = standard-library
+
+$(snarf_doc).am: $(snarf_doc).scm
+       GUILE_AUTO_COMPILE=0 ;                                                  
\
+       variable="`echo $(snarf_doc) | tr - _`_scm_files" ;                     
\
+       "$(preinstguile)" -l "$(srcdir)/$(snarf_doc).scm" -c "                  
\
+        (format #t \"# Automatically generated, do not edit.~%\")              
\
+        (format #t \"$$variable = \")                                          
\
+        (for-each (lambda (m)                                                  
\
+                    (format #t \"$$""(top_srcdir)/module/~a.scm \"             
\
+                            (string-join (map symbol->string m) \"/\")))       
\
+                  (map car *modules*))" > "address@hidden"
+       mv "address@hidden" "$@"
+
+# The following line leads to the definition of $(standard_library_scm_files).
+include standard-library.am
+
+$(snarf_doc).texi: $(standard_library_scm_files)
+       GUILE_AUTO_COMPILE=0                            \
+       "$(preinstguile)" "$(srcdir)/make-texinfo.scm"  \
+         "$(abs_srcdir)/$(snarf_doc).scm" > "address@hidden"
+       mv "address@hidden" "$@"
+
+CLEANFILES += $(snarf_doc).texi
+EXTRA_DIST += $(snarf_doc).scm make-texinfo.scm $(snarf_doc).texi 
$(snarf_doc).am
diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi
index 7709184..93d930f 100644
--- a/doc/ref/api-compound.texi
+++ b/doc/ref/api-compound.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2007, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2007, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -21,14 +21,15 @@ values can be looked up within them.
 * Pairs::                       Scheme's basic building block.
 * Lists::                       Special list functions supported by Guile.
 * Vectors::                     One-dimensional arrays of Scheme objects.
-* Uniform Numeric Vectors::     Vectors with elements of a single numeric type.
 * Bit Vectors::                 Vectors of bits.
 * Generalized Vectors::         Treating all vector-like things uniformly.
 * Arrays::                      Matrices, etc.
+* VLists::                      Vector-like lists.
 * Records::                     
 * Structures::                  
 * Dictionary Types::            About dictionary types in general.
 * Association Lists::           List-based dictionaries.
+* VHashes::                     VList-based dictionaries.   
 * Hash Tables::                 Table-based dictionaries.
 @end menu
 
@@ -670,6 +671,7 @@ and that most array procedures operate happily on vectors
 * Vector Creation::             Dynamic vector creation and validation.
 * Vector Accessors::            Accessing and modifying vector contents.
 * Vector Accessing from C::     Ways to work with vectors from C.
+* Uniform Numeric Vectors::     Vectors of unboxed numeric values.
 @end menu
 
 
@@ -958,508 +960,17 @@ scm_array_handle_release (&handle);
 @end deftypefn
 
 @node Uniform Numeric Vectors
address@hidden Uniform Numeric Vectors
address@hidden Uniform Numeric Vectors
 
 A uniform numeric vector is a vector whose elements are all of a single
 numeric type.  Guile offers uniform numeric vectors for signed and
 unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers, two sizes of
 floating point values, and complex floating-point numbers of these two
-sizes.
-
-Strings could be regarded as uniform vectors of characters,
address@hidden  Likewise, bit vectors could be regarded as uniform
-vectors of bits, @xref{Bit Vectors}.  Both are sufficiently different
-from uniform numeric vectors that the procedures described here do not
-apply to these two data types.  However, both strings and bit vectors
-are generalized vectors, @xref{Generalized Vectors}, and arrays,
address@hidden
-
-Uniform numeric vectors are the special case of one dimensional uniform
-numeric arrays.
-
-Uniform numeric vectors can be useful since they consume less memory
-than the non-uniform, general vectors.  Also, since the types they can
-store correspond directly to C types, it is easier to work with them
-efficiently on a low level.  Consider image processing as an example,
-where you want to apply a filter to some image.  While you could store
-the pixels of an image in a general vector and write a general
-convolution function, things are much more efficient with uniform
-vectors: the convolution function knows that all pixels are unsigned
-8-bit values (say), and can use a very tight inner loop.
-
-That is, when it is written in C.  Functions for efficiently working
-with uniform numeric vectors from C are listed at the end of this
-section.
-
-Procedures similar to the vector procedures (@pxref{Vectors}) are
-provided for handling these uniform vectors, but they are distinct
-datatypes and the two cannot be inter-mixed.  If you want to work
-primarily with uniform numeric vectors, but want to offer support for
-general vectors as a convenience, you can use one of the
address@hidden functions.  They will coerce lists and vectors to
-the given type of uniform vector.  Alternatively, you can write two
-versions of your code: one that is fast and works only with uniform
-numeric vectors, and one that works with any kind of vector but is
-slower.
-
-One set of the procedures listed below is a generic one: it works with
-all types of uniform numeric vectors.  In addition to that, there is a
-set of procedures for each type that only works with that type.  Unless
-you really need to the generality of the first set, it is best to use
-the more specific functions.  They might not be that much faster, but
-their use can serve as a kind of declaration and makes it easier to
-optimize later on.
-
-The generic set of procedures uses @code{uniform} in its names, the
-specific ones use the tag from the following table.
-
address@hidden @nicode
address@hidden u8
-unsigned 8-bit integers
-
address@hidden s8
-signed 8-bit integers
-
address@hidden u16
-unsigned 16-bit integers
-
address@hidden s16
-signed 16-bit integers
-
address@hidden u32
-unsigned 32-bit integers
-
address@hidden s32
-signed 32-bit integers
-
address@hidden u64
-unsigned 64-bit integers
-
address@hidden s64
-signed 64-bit integers
-
address@hidden f32
-the C type @code{float}
-
address@hidden f64
-the C type @code{double}
-
address@hidden c32
-complex numbers in rectangular form with the real and imaginary part
-being a @code{float}
-
address@hidden c64
-complex numbers in rectangular form with the real and imaginary part
-being a @code{double}
-
address@hidden table
-
-The external representation (ie.@: read syntax) for these vectors is
-similar to normal Scheme vectors, but with an additional tag from the
-table above indicating the vector's type.  For example,
-
address@hidden
-#u16(1 2 3)
-#f64(3.1415 2.71)
address@hidden lisp
-
-Note that the read syntax for floating-point here conflicts with
address@hidden for false.  In Standard Scheme one can write @code{(1 #f3)}
-for a three element list @code{(1 #f 3)}, but for Guile @code{(1 #f3)}
-is invalid.  @code{(1 #f 3)} is almost certainly what one should write
-anyway to make the intention clear, so this is rarely a problem.
-
address@hidden  {Scheme Procedure} uniform-vector? obj
address@hidden {Scheme Procedure} u8vector? obj
address@hidden {Scheme Procedure} s8vector? obj
address@hidden {Scheme Procedure} u16vector? obj
address@hidden {Scheme Procedure} s16vector? obj
address@hidden {Scheme Procedure} u32vector? obj
address@hidden {Scheme Procedure} s32vector? obj
address@hidden {Scheme Procedure} u64vector? obj
address@hidden {Scheme Procedure} s64vector? obj
address@hidden {Scheme Procedure} f32vector? obj
address@hidden {Scheme Procedure} f64vector? obj
address@hidden {Scheme Procedure} c32vector? obj
address@hidden {Scheme Procedure} c64vector? obj
address@hidden {C Function} scm_uniform_vector_p (obj)
address@hidden {C Function} scm_u8vector_p (obj)
address@hidden {C Function} scm_s8vector_p (obj)
address@hidden {C Function} scm_u16vector_p (obj)
address@hidden {C Function} scm_s16vector_p (obj)
address@hidden {C Function} scm_u32vector_p (obj)
address@hidden {C Function} scm_s32vector_p (obj)
address@hidden {C Function} scm_u64vector_p (obj)
address@hidden {C Function} scm_s64vector_p (obj)
address@hidden {C Function} scm_f32vector_p (obj)
address@hidden {C Function} scm_f64vector_p (obj)
address@hidden {C Function} scm_c32vector_p (obj)
address@hidden {C Function} scm_c64vector_p (obj)
-Return @code{#t} if @var{obj} is a homogeneous numeric vector of the
-indicated type.
address@hidden deffn
-
address@hidden  {Scheme Procedure} make-u8vector n [value]
address@hidden {Scheme Procedure} make-s8vector n [value]
address@hidden {Scheme Procedure} make-u16vector n [value]
address@hidden {Scheme Procedure} make-s16vector n [value]
address@hidden {Scheme Procedure} make-u32vector n [value]
address@hidden {Scheme Procedure} make-s32vector n [value]
address@hidden {Scheme Procedure} make-u64vector n [value]
address@hidden {Scheme Procedure} make-s64vector n [value]
address@hidden {Scheme Procedure} make-f32vector n [value]
address@hidden {Scheme Procedure} make-f64vector n [value]
address@hidden {Scheme Procedure} make-c32vector n [value]
address@hidden {Scheme Procedure} make-c64vector n [value]
address@hidden {C Function} scm_make_u8vector n [value]
address@hidden {C Function} scm_make_s8vector n [value]
address@hidden {C Function} scm_make_u16vector n [value]
address@hidden {C Function} scm_make_s16vector n [value]
address@hidden {C Function} scm_make_u32vector n [value]
address@hidden {C Function} scm_make_s32vector n [value]
address@hidden {C Function} scm_make_u64vector n [value]
address@hidden {C Function} scm_make_s64vector n [value]
address@hidden {C Function} scm_make_f32vector n [value]
address@hidden {C Function} scm_make_f64vector n [value]
address@hidden {C Function} scm_make_c32vector n [value]
address@hidden {C Function} scm_make_c64vector n [value]
-Return a newly allocated homogeneous numeric vector holding @var{n}
-elements of the indicated type.  If @var{value} is given, the vector
-is initialized with that value, otherwise the contents are
-unspecified.
address@hidden deffn
-
address@hidden  {Scheme Procedure} u8vector value @dots{}
address@hidden {Scheme Procedure} s8vector value @dots{}
address@hidden {Scheme Procedure} u16vector value @dots{}
address@hidden {Scheme Procedure} s16vector value @dots{}
address@hidden {Scheme Procedure} u32vector value @dots{}
address@hidden {Scheme Procedure} s32vector value @dots{}
address@hidden {Scheme Procedure} u64vector value @dots{}
address@hidden {Scheme Procedure} s64vector value @dots{}
address@hidden {Scheme Procedure} f32vector value @dots{}
address@hidden {Scheme Procedure} f64vector value @dots{}
address@hidden {Scheme Procedure} c32vector value @dots{}
address@hidden {Scheme Procedure} c64vector value @dots{}
address@hidden {C Function} scm_u8vector (values)
address@hidden {C Function} scm_s8vector (values)
address@hidden {C Function} scm_u16vector (values)
address@hidden {C Function} scm_s16vector (values)
address@hidden {C Function} scm_u32vector (values)
address@hidden {C Function} scm_s32vector (values)
address@hidden {C Function} scm_u64vector (values)
address@hidden {C Function} scm_s64vector (values)
address@hidden {C Function} scm_f32vector (values)
address@hidden {C Function} scm_f64vector (values)
address@hidden {C Function} scm_c32vector (values)
address@hidden {C Function} scm_c64vector (values)
-Return a newly allocated homogeneous numeric vector of the indicated
-type, holding the given parameter @var{value}s.  The vector length is
-the number of parameters given.
address@hidden deffn
-
address@hidden  {Scheme Procedure} uniform-vector-length vec
address@hidden {Scheme Procedure} u8vector-length vec
address@hidden {Scheme Procedure} s8vector-length vec
address@hidden {Scheme Procedure} u16vector-length vec
address@hidden {Scheme Procedure} s16vector-length vec
address@hidden {Scheme Procedure} u32vector-length vec
address@hidden {Scheme Procedure} s32vector-length vec
address@hidden {Scheme Procedure} u64vector-length vec
address@hidden {Scheme Procedure} s64vector-length vec
address@hidden {Scheme Procedure} f32vector-length vec
address@hidden {Scheme Procedure} f64vector-length vec
address@hidden {Scheme Procedure} c32vector-length vec
address@hidden {Scheme Procedure} c64vector-length vec
address@hidden {C Function} scm_uniform_vector_length (vec)
address@hidden {C Function} scm_u8vector_length (vec)
address@hidden {C Function} scm_s8vector_length (vec)
address@hidden {C Function} scm_u16vector_length (vec)
address@hidden {C Function} scm_s16vector_length (vec)
address@hidden {C Function} scm_u32vector_length (vec)
address@hidden {C Function} scm_s32vector_length (vec)
address@hidden {C Function} scm_u64vector_length (vec)
address@hidden {C Function} scm_s64vector_length (vec)
address@hidden {C Function} scm_f32vector_length (vec)
address@hidden {C Function} scm_f64vector_length (vec)
address@hidden {C Function} scm_c32vector_length (vec)
address@hidden {C Function} scm_c64vector_length (vec)
-Return the number of elements in @var{vec}.
address@hidden deffn
-
address@hidden  {Scheme Procedure} uniform-vector-ref vec i
address@hidden {Scheme Procedure} u8vector-ref vec i
address@hidden {Scheme Procedure} s8vector-ref vec i
address@hidden {Scheme Procedure} u16vector-ref vec i
address@hidden {Scheme Procedure} s16vector-ref vec i
address@hidden {Scheme Procedure} u32vector-ref vec i
address@hidden {Scheme Procedure} s32vector-ref vec i
address@hidden {Scheme Procedure} u64vector-ref vec i
address@hidden {Scheme Procedure} s64vector-ref vec i
address@hidden {Scheme Procedure} f32vector-ref vec i
address@hidden {Scheme Procedure} f64vector-ref vec i
address@hidden {Scheme Procedure} c32vector-ref vec i
address@hidden {Scheme Procedure} c64vector-ref vec i
address@hidden {C Function} scm_uniform_vector_ref (vec i)
address@hidden {C Function} scm_u8vector_ref (vec i)
address@hidden {C Function} scm_s8vector_ref (vec i)
address@hidden {C Function} scm_u16vector_ref (vec i)
address@hidden {C Function} scm_s16vector_ref (vec i)
address@hidden {C Function} scm_u32vector_ref (vec i)
address@hidden {C Function} scm_s32vector_ref (vec i)
address@hidden {C Function} scm_u64vector_ref (vec i)
address@hidden {C Function} scm_s64vector_ref (vec i)
address@hidden {C Function} scm_f32vector_ref (vec i)
address@hidden {C Function} scm_f64vector_ref (vec i)
address@hidden {C Function} scm_c32vector_ref (vec i)
address@hidden {C Function} scm_c64vector_ref (vec i)
-Return the element at index @var{i} in @var{vec}.  The first element
-in @var{vec} is index 0.
address@hidden deffn
-
address@hidden  {Scheme Procedure} uniform-vector-set! vec i value
address@hidden {Scheme Procedure} u8vector-set! vec i value
address@hidden {Scheme Procedure} s8vector-set! vec i value
address@hidden {Scheme Procedure} u16vector-set! vec i value
address@hidden {Scheme Procedure} s16vector-set! vec i value
address@hidden {Scheme Procedure} u32vector-set! vec i value
address@hidden {Scheme Procedure} s32vector-set! vec i value
address@hidden {Scheme Procedure} u64vector-set! vec i value
address@hidden {Scheme Procedure} s64vector-set! vec i value
address@hidden {Scheme Procedure} f32vector-set! vec i value
address@hidden {Scheme Procedure} f64vector-set! vec i value
address@hidden {Scheme Procedure} c32vector-set! vec i value
address@hidden {Scheme Procedure} c64vector-set! vec i value
address@hidden {C Function} scm_uniform_vector_set_x (vec i value)
address@hidden {C Function} scm_u8vector_set_x (vec i value)
address@hidden {C Function} scm_s8vector_set_x (vec i value)
address@hidden {C Function} scm_u16vector_set_x (vec i value)
address@hidden {C Function} scm_s16vector_set_x (vec i value)
address@hidden {C Function} scm_u32vector_set_x (vec i value)
address@hidden {C Function} scm_s32vector_set_x (vec i value)
address@hidden {C Function} scm_u64vector_set_x (vec i value)
address@hidden {C Function} scm_s64vector_set_x (vec i value)
address@hidden {C Function} scm_f32vector_set_x (vec i value)
address@hidden {C Function} scm_f64vector_set_x (vec i value)
address@hidden {C Function} scm_c32vector_set_x (vec i value)
address@hidden {C Function} scm_c64vector_set_x (vec i value)
-Set the element at index @var{i} in @var{vec} to @var{value}.  The
-first element in @var{vec} is index 0.  The return value is
-unspecified.
address@hidden deffn
-
address@hidden  {Scheme Procedure} uniform-vector->list vec
address@hidden {Scheme Procedure} u8vector->list vec
address@hidden {Scheme Procedure} s8vector->list vec
address@hidden {Scheme Procedure} u16vector->list vec
address@hidden {Scheme Procedure} s16vector->list vec
address@hidden {Scheme Procedure} u32vector->list vec
address@hidden {Scheme Procedure} s32vector->list vec
address@hidden {Scheme Procedure} u64vector->list vec
address@hidden {Scheme Procedure} s64vector->list vec
address@hidden {Scheme Procedure} f32vector->list vec
address@hidden {Scheme Procedure} f64vector->list vec
address@hidden {Scheme Procedure} c32vector->list vec
address@hidden {Scheme Procedure} c64vector->list vec
address@hidden {C Function} scm_uniform_vector_to_list (vec)
address@hidden {C Function} scm_u8vector_to_list (vec)
address@hidden {C Function} scm_s8vector_to_list (vec)
address@hidden {C Function} scm_u16vector_to_list (vec)
address@hidden {C Function} scm_s16vector_to_list (vec)
address@hidden {C Function} scm_u32vector_to_list (vec)
address@hidden {C Function} scm_s32vector_to_list (vec)
address@hidden {C Function} scm_u64vector_to_list (vec)
address@hidden {C Function} scm_s64vector_to_list (vec)
address@hidden {C Function} scm_f32vector_to_list (vec)
address@hidden {C Function} scm_f64vector_to_list (vec)
address@hidden {C Function} scm_c32vector_to_list (vec)
address@hidden {C Function} scm_c64vector_to_list (vec)
-Return a newly allocated list holding all elements of @var{vec}.
address@hidden deffn
-
address@hidden  {Scheme Procedure} list->u8vector lst
address@hidden {Scheme Procedure} list->s8vector lst
address@hidden {Scheme Procedure} list->u16vector lst
address@hidden {Scheme Procedure} list->s16vector lst
address@hidden {Scheme Procedure} list->u32vector lst
address@hidden {Scheme Procedure} list->s32vector lst
address@hidden {Scheme Procedure} list->u64vector lst
address@hidden {Scheme Procedure} list->s64vector lst
address@hidden {Scheme Procedure} list->f32vector lst
address@hidden {Scheme Procedure} list->f64vector lst
address@hidden {Scheme Procedure} list->c32vector lst
address@hidden {Scheme Procedure} list->c64vector lst
address@hidden {C Function} scm_list_to_u8vector (lst)
address@hidden {C Function} scm_list_to_s8vector (lst)
address@hidden {C Function} scm_list_to_u16vector (lst)
address@hidden {C Function} scm_list_to_s16vector (lst)
address@hidden {C Function} scm_list_to_u32vector (lst)
address@hidden {C Function} scm_list_to_s32vector (lst)
address@hidden {C Function} scm_list_to_u64vector (lst)
address@hidden {C Function} scm_list_to_s64vector (lst)
address@hidden {C Function} scm_list_to_f32vector (lst)
address@hidden {C Function} scm_list_to_f64vector (lst)
address@hidden {C Function} scm_list_to_c32vector (lst)
address@hidden {C Function} scm_list_to_c64vector (lst)
-Return a newly allocated homogeneous numeric vector of the indicated type,
-initialized with the elements of the list @var{lst}.
address@hidden deffn
-
address@hidden  {Scheme Procedure} any->u8vector obj
address@hidden {Scheme Procedure} any->s8vector obj
address@hidden {Scheme Procedure} any->u16vector obj
address@hidden {Scheme Procedure} any->s16vector obj
address@hidden {Scheme Procedure} any->u32vector obj
address@hidden {Scheme Procedure} any->s32vector obj
address@hidden {Scheme Procedure} any->u64vector obj
address@hidden {Scheme Procedure} any->s64vector obj
address@hidden {Scheme Procedure} any->f32vector obj
address@hidden {Scheme Procedure} any->f64vector obj
address@hidden {Scheme Procedure} any->c32vector obj
address@hidden {Scheme Procedure} any->c64vector obj
address@hidden {C Function} scm_any_to_u8vector (obj)
address@hidden {C Function} scm_any_to_s8vector (obj)
address@hidden {C Function} scm_any_to_u16vector (obj)
address@hidden {C Function} scm_any_to_s16vector (obj)
address@hidden {C Function} scm_any_to_u32vector (obj)
address@hidden {C Function} scm_any_to_s32vector (obj)
address@hidden {C Function} scm_any_to_u64vector (obj)
address@hidden {C Function} scm_any_to_s64vector (obj)
address@hidden {C Function} scm_any_to_f32vector (obj)
address@hidden {C Function} scm_any_to_f64vector (obj)
address@hidden {C Function} scm_any_to_c32vector (obj)
address@hidden {C Function} scm_any_to_c64vector (obj)
-Return a (maybe newly allocated) uniform numeric vector of the indicated
-type, initialized with the elements of @var{obj}, which must be a list,
-a vector, or a uniform vector.  When @var{obj} is already a suitable
-uniform numeric vector, it is returned unchanged.
address@hidden deffn
-
address@hidden {C Function} int scm_is_uniform_vector (SCM uvec)
-Return non-zero when @var{uvec} is a uniform numeric vector, zero
-otherwise.
address@hidden deftypefn
-
address@hidden  {C Function} SCM scm_take_u8vector (const scm_t_uint8 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s8vector (const scm_t_int8 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u16vector (const scm_t_uint16 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s16vector (const scm_t_int16 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u32vector (const scm_t_uint32 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s32vector (const scm_t_int32 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u64vector (const scm_t_uint64 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s64vector (const scm_t_int64 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_f32vector (const float *data, size_t 
len)
address@hidden {C Function} SCM scm_take_f64vector (const double *data, size_t 
len)
address@hidden {C Function} SCM scm_take_c32vector (const float *data, size_t 
len)
address@hidden {C Function} SCM scm_take_c64vector (const double *data, size_t 
len)
-Return a new uniform numeric vector of the indicated type and length
-that uses the memory pointed to by @var{data} to store its elements.
-This memory will eventually be freed with @code{free}.  The argument
address@hidden specifies the number of elements in @var{data}, not its size
-in bytes.
-
-The @code{c32} and @code{c64} variants take a pointer to a C array of
address@hidden or @code{double}s.  The real parts of the complex numbers
-are at even indices in that array, the corresponding imaginary parts are
-at the following odd index.
address@hidden deftypefn
-
address@hidden {C Function} size_t scm_c_uniform_vector_length (SCM uvec)
-Return the number of elements of @var{uvec} as a @code{size_t}.
address@hidden deftypefn
-
address@hidden  {C Function} {const void *} scm_uniform_vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint8 *} scm_u8vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int8 *} scm_s8vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint16 *} scm_u16vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int16 *} scm_s16vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint32 *} scm_u32vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int32 *} scm_s32vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint64 *} scm_u64vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int64 *} scm_s64vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const float *} scm_f23vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const double *} scm_f64vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const float *} scm_c32vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const double *} scm_c64vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
-Like @code{scm_vector_elements} (@pxref{Vector Accessing from C}), but
-returns a pointer to the elements of a uniform numeric vector of the
-indicated kind.
address@hidden deftypefn
-
address@hidden  {C Function} {void *} scm_uniform_vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint8 *} scm_u8vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int8 *} scm_s8vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint16 *} scm_u16vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int16 *} scm_s16vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint32 *} scm_u32vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int32 *} scm_s32vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint64 *} scm_u64vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int64 *} scm_s64vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {float *} scm_f23vector_writable_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {double *} scm_f64vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {float *} scm_c32vector_writable_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {double *} scm_c64vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
-Like @code{scm_vector_writable_elements} (@pxref{Vector Accessing from
-C}), but returns a pointer to the elements of a uniform numeric vector
-of the indicated kind.
address@hidden deftypefn
-
-Uniform numeric vectors can be written to and read from input/output
-ports using the procedures listed below.  However, bytevectors may often
-be more convenient for binary input/output since they provide more
-flexibility in the interpretation of raw byte sequences
-(@pxref{Bytevectors}).
-
address@hidden {Scheme Procedure} uniform-vector-read! uvec [port_or_fd [start 
[end]]]
address@hidden {C Function} scm_uniform_vector_read_x (uvec, port_or_fd, start, 
end)
-Fill the elements of @var{uvec} by reading
-raw bytes from @var{port-or-fdes}, using host byte order.
-
-The optional arguments @var{start} (inclusive) and @var{end}
-(exclusive) allow a specified region to be read,
-leaving the remainder of the vector unchanged.
-
-When @var{port-or-fdes} is a port, all specified elements
-of @var{uvec} are attempted to be read, potentially blocking
-while waiting formore input or end-of-file.
-When @var{port-or-fd} is an integer, a single call to
-read(2) is made.
-
-An error is signalled when the last element has only
-been partially filled before reaching end-of-file or in
-the single call to read(2).
-
address@hidden returns the number of elements
-read.
-
address@hidden may be omitted, in which case it defaults
-to the value returned by @code{(current-input-port)}.
address@hidden deffn
-
address@hidden {Scheme Procedure} uniform-vector-write uvec [port_or_fd [start 
[end]]]
address@hidden {C Function} scm_uniform_vector_write (uvec, port_or_fd, start, 
end)
-Write the elements of @var{uvec} as raw bytes to
address@hidden, in the host byte order.
-
-The optional arguments @var{start} (inclusive)
-and @var{end} (exclusive) allow
-a specified region to be written.
-
-When @var{port-or-fdes} is a port, all specified elements
-of @var{uvec} are attempted to be written, potentially blocking
-while waiting for more room.
-When @var{port-or-fd} is an integer, a single call to
-write(2) is made.
-
-An error is signalled when the last element has only
-been partially written in the single call to write(2).
-
-The number of objects actually written is returned.
address@hidden may be
-omitted, in which case it defaults to the value returned by
address@hidden(current-output-port)}.
address@hidden deffn
+sizes. @xref{SRFI-4}, for more information.
 
+For many purposes, bytevectors work just as well as uniform vectors, and have
+the advantage that they integrate well with binary input and output.
address@hidden, for more information on bytevectors.
 
 @node Bit Vectors
 @subsection Bit Vectors
@@ -1982,45 +1493,6 @@ a @result{} #2((#f #f) (#f #t))
 @end example
 @end deffn
 
address@hidden {Scheme Procedure} enclose-array array dim1 @dots{}
address@hidden {C Function} scm_enclose_array (array, dimlist)
address@hidden, @var{dim2} @dots{} should be nonnegative integers less than
-the rank of @var{array}.  @code{enclose-array} returns an array
-resembling an array of shared arrays.  The dimensions of each shared
-array are the same as the @var{dim}th dimensions of the original array,
-the dimensions of the outer array are the same as those of the original
-array that did not match a @var{dim}.
-
-An enclosed array is not a general Scheme array.  Its elements may not
-be set using @code{array-set!}.  Two references to the same element of
-an enclosed array will be @code{equal?} but will not in general be
address@hidden  The value returned by @code{array-prototype} when given an
-enclosed array is unspecified.
-
-For example,
-
address@hidden
-(enclose-array '#3(((a b c)
-                    (d e f))
-                   ((1 2 3)
-                    (4 5 6)))
-               1)
address@hidden
-#<enclosed-array (#1(a d) #1(b e) #1(c f))
-                 (#1(1 4) #1(2 5) #1(3 6))>
-
-(enclose-array '#3(((a b c)
-                    (d e f))
-                   ((1 2 3)
-                    (4 5 6)))
-               1 0)
address@hidden
-#<enclosed-array #2((a 1) (d 4))
-                 #2((b 2) (e 5))
-                 #2((c 3) (f 6))>
address@hidden lisp
address@hidden deffn
-
 @deffn {Scheme Procedure} array-shape array
 @deffnx {Scheme Procedure} array-dimensions array
 @deffnx {C Function} scm_array_dimensions (array)
@@ -2078,9 +1550,7 @@ is unspecified.
 Return @code{#t} if all arguments are arrays with the same shape, the
 same type, and have corresponding elements which are either
 @code{equal?} or @code{array-equal?}.  This function differs from
address@hidden (@pxref{Equality}) in that a one dimensional shared
-array may be @code{array-equal?} but not @code{equal?} to a vector or
-uniform vector.
address@hidden (@pxref{Equality}) in that all arguments must be arrays.
 @end deffn
 
 @c  FIXME: array-map! accepts no source arrays at all, and in that
@@ -2615,6 +2085,172 @@ reading and writing.  You must take care not to modify 
bits outside of
 the allowed index range of the array, even for contiguous arrays.
 @end deftypefn
 
address@hidden VLists
address@hidden VLists
+
address@hidden vlist
+
+The @code{(ice-9 vlist)} module provides an implementation of the @dfn{VList}
+data structure designed by Phil Bagwell in 2002.  VLists are immutable lists,
+which can contain any Scheme object.  They improve on standard Scheme linked
+lists in several areas:
+
address@hidden
address@hidden
+Random access has typically constant-time complexity.
+
address@hidden
+Computing the length of a VList has time complexity logarithmic in the number 
of
+elements.
+
address@hidden
+VLists use less storage space than standard lists.
+
address@hidden
+VList elements are stored in contiguous regions, which improves memory locality
+and leads to more efficient use of hardware caches.
address@hidden itemize
+
+The idea behind VLists is to store vlist elements in increasingly large
+contiguous blocks (implemented as vectors here).  These blocks are linked to 
one
+another using a pointer to the next block and an offset within that block.  The
+size of these blocks form a geometric series with ratio
address@hidden (2 by default).
+
+The VList structure also serves as the basis for the @dfn{VList-based hash
+lists} or ``vhashes'', an immutable dictionary type (@pxref{VHashes}).
+
+However, the current implementation in @code{(ice-9 vlist)} has several
+noteworthy shortcomings:
+
address@hidden
+
address@hidden
+It is @emph{not} thread-safe.  Although operations on vlists are all
address@hidden transparent} (i.e., purely functional), adding elements to a
+vlist with @code{vlist-cons} mutates part of its internal structure, which 
makes
+it non-thread-safe.  This could be fixed, but it would slow down
address@hidden
+
address@hidden
address@hidden always allocates at least as much memory as @code{cons}.
+Again, Phil Bagwell describes how to fix it, but that would require tuning the
+garbage collector in a way that may not be generally beneficial.
+
address@hidden
address@hidden is a Scheme procedure compiled to bytecode, and it does not
+compete with the straightforward C implementation of @code{cons}, and with the
+fact that the VM has a special @code{cons} instruction.
+
address@hidden itemize
+
+We hope to address these in the future.
+
+The programming interface exported by @code{(ice-9 vlist)} is defined below.
+Most of it is the same as SRFI-1 with an added @code{vlist-} prefix to function
+names.
+
address@hidden {Scheme Procedure} vlist? obj
+Return true if @var{obj} is a VList.
address@hidden deffn
+
address@hidden {Scheme Variable} vlist-null
+The empty VList.  Note that it's possible to create an empty VList not
address@hidden to @code{vlist-null}; thus, callers should always use
address@hidden when testing whether a VList is empty.
address@hidden defvr
+
address@hidden {Scheme Procedure} vlist-null? vlist
+Return true if @var{vlist} is empty.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-cons item vlist
+Return a new vlist with @var{item} as its head and @var{vlist} as its tail.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-head vlist
+Return the head of @var{vlist}.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-tail vlist
+Return the tail of @var{vlist}.
address@hidden deffn
+
address@hidden {Scheme Variable} block-growth-factor
+A fluid that defines the growth factor of VList blocks, 2 by default.
address@hidden defvr
+
+The functions below provide the usual set of higher-level list operations.
+
address@hidden {Scheme Procedure} vlist-fold proc init vlist
address@hidden {Scheme Procedure} vlist-fold-right proc init vlist
+Fold over @var{vlist}, calling @var{proc} for each element, as for SRFI-1
address@hidden and @code{fold-right} (@pxref{SRFI-1, @code{fold}}).
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-ref vlist index
+Return the element at index @var{index} in @var{vlist}.  This is typically a
+constant-time operation.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-length vlist
+Return the length of @var{vlist}.  This is typically logarithmic in the number
+of elements in @var{vlist}.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-reverse vlist
+Return a new @var{vlist} whose content are those of @var{vlist} in reverse
+order.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-map proc vlist
+Map @var{proc} over the elements of @var{vlist} and return a new vlist.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-for-each proc vlist
+Call @var{proc} on each element of @var{vlist}.  The result is unspecified.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-drop vlist count
+Return a new vlist that does not contain the @var{count} first elements of
address@hidden  This is typically a constant-time operation.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-take vlist count
+Return a new vlist that contains only the @var{count} first elements of
address@hidden
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-filter pred vlist
+Return a new vlist containing all the elements from @var{vlist} that satisfy
address@hidden
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-delete x vlist [equal?]
+Return a new vlist corresponding to @var{vlist} without the elements
address@hidden to @var{x}.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-unfold p f g seed [tail-gen]
address@hidden {Scheme Procedure} vlist-unfold-right p f g seed [tail]
+Return a new vlist, as for SRFI-1 @code{unfold} and @code{unfold-right}
+(@pxref{SRFI-1, @code{unfold}}).
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist-append vlists ...
+Append the given vlists and return the resulting vlist.
address@hidden deffn
+
address@hidden {Scheme Procedure} list->vlist lst
+Return a new vlist whose contents correspond to @var{lst}.
address@hidden deffn
+
address@hidden {Scheme Procedure} vlist->list vlist
+Return a new list whose contents match those of @var{vlist}.
address@hidden deffn
+
+
+
 @node Records
 @subsection Records
 
@@ -3559,6 +3195,118 @@ capitals
     ("Florida" . "Tallahassee"))
 @end lisp
 
address@hidden VHashes
address@hidden VList-Based Hash Lists or ``VHashes''
+
address@hidden VList-based hash lists
address@hidden VHash
+
+The @code{(ice-9 vlist)} module provides an implementation of @dfn{VList-based
+hash lists} (@pxref{VLists}).  VList-based hash lists, or @dfn{vhashes}, are an
+immutable dictionary type similar to association lists that maps @dfn{keys} to
address@hidden  However, unlike association lists, accessing a value given its
+key is typically a constant-time operation.
+
+The VHash programming interface of @code{(ice-9 vlist)} is mostly the same as
+that of association lists found in SRFI-1, with procedure names prefixed by
address@hidden instead of @code{vlist-} (@pxref{SRFI-1 Association Lists}).
+
+In addition, vhashes can be manipulated using VList operations:
+
address@hidden
+(vlist-head (vhash-consq 'a 1 vlist-null))
address@hidden (a . 1)
+
+(define vh1 (vhash-consq 'b 2 (vhash-consq 'a 1 vlist-null)))
+(define vh2 (vhash-consq 'c 3 (vlist-tail vh1)))
+
+(vhash-assq 'a vh2)
address@hidden (a . 1)
+(vhash-assq 'b vh2)
address@hidden #f
+(vhash-assq 'c vh2)
address@hidden (c . 3)
+(vlist->list vh2)
address@hidden ((c . 3) (a . 1))
address@hidden example
+
+However, keep in mind that procedures that construct new VLists
+(@code{vlist-map}, @code{vlist-filter}, etc.) return raw VLists, not vhashes:
+
address@hidden
+(define vh (alist->vhash '((a . 1) (b . 2) (c . 3)) hashq))
+(vhash-assq 'a vh)
address@hidden (a . 1)
+
+(define vl
+  ;; This will create a raw vlist.
+  (vlist-filter (lambda (key+value) (odd? (cdr key+value))) vh))
+(vhash-assq 'a vl)
address@hidden ERROR: Wrong type argument in position 2
+
+(vlist->list vl)
address@hidden ((a . 1) (c . 3))
address@hidden example
+
address@hidden {Scheme Procedure} vhash? obj
+Return true if @var{obj} is a vhash.
address@hidden deffn
+
address@hidden {Scheme Procedure} vhash-cons key value vhash [hash-proc]
address@hidden {Scheme Procedure} vhash-consq key value vhash
address@hidden {Scheme Procedure} vhash-consv key value vhash
+Return a new hash list based on @var{vhash} where @var{key} is associated with
address@hidden, using @var{hash-proc} to compute the hash of @var{key}.
address@hidden must be either @code{vlist-null} or a vhash returned by a 
previous
+call to @code{vhash-cons}.  @var{hash-proc} defaults to @code{hash} 
(@pxref{Hash
+Table Reference, @code{hash} procedure}).  With @code{vhash-consq}, the
address@hidden hash function is used; with @code{vhash-consv} the @code{hashv}
+hash function is used.
+
+All @code{vhash-cons} calls made to construct a vhash should use the same
address@hidden  Failing to do that, the result is undefined.
address@hidden deffn
+
address@hidden {Scheme Procedure} vhash-assoc key vhash [equal? [hash-proc]]
address@hidden {Scheme Procedure} vhash-assq key vhash
address@hidden {Scheme Procedure} vhash-assv key vhash
+Return the first key/value pair from @var{vhash} whose key is equal to 
@var{key}
+according to the @var{equal?} equality predicate (which defaults to
address@hidden), and using @var{hash-proc} (which defaults to @code{hash}) to
+compute the hash of @var{key}.  The second form uses @code{eq?} as the equality
+predicate and @code{hashq} as the hash function; the last form uses @code{eqv?}
+and @code{hashv}.
+
+Note that it is important to consistently use the same hash function for
address@hidden as was passed to @code{vhash-cons}.  Failing to do that, the
+result is unpredictable.
address@hidden deffn
+
address@hidden {Scheme Procedure} vhash-delete key vhash [equal? [hash-proc]]
address@hidden {Scheme Procedure} vhash-delq key vhash
address@hidden {Scheme Procedure} vhash-delv key vhash
+Remove all associations from @var{vhash} with @var{key}, comparing keys with
address@hidden (which defaults to @code{equal?}), and computing the hash of
address@hidden using @var{hash-proc} (which defaults to @code{hash}).  The 
second
+form uses @code{eq?} as the equality predicate and @code{hashq} as the hash
+function; the last one uses @code{eqv?} and @code{hashv}.
+
+Again the choice of @var{hash-proc} must be consistent with previous calls to
address@hidden
address@hidden deffn
+
address@hidden {Scheme Procedure} vhash-fold proc vhash
+Fold over the key/pair elements of @var{vhash}.  For each pair call @var{proc}
+as @code{(@var{proc} key value result)}.
address@hidden deffn
+
address@hidden {Scheme Procedure} alist->vhash alist [hash-proc]
+Return the vhash corresponding to @var{alist}, an association list, using
address@hidden to compute key hashes.  When omitted, @var{hash-proc} defaults
+to @code{hash}.
address@hidden deffn
+
+
 @node Hash Tables
 @subsection Hash Tables
 @tpindex Hash Tables
diff --git a/doc/ref/api-control.texi b/doc/ref/api-control.texi
index a8296c9..0b4b587 100644
--- a/doc/ref/api-control.texi
+++ b/doc/ref/api-control.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -15,7 +15,8 @@ flow of Scheme affects C code.
 * if cond case::                Simple conditional evaluation.
 * and or::                      Conditional evaluation of a sequence.
 * while do::                    Iteration mechanisms.
-* Continuations::               Continuations.
+* Prompts::                     Composable, delimited continuations.
+* Continuations::               Non-composable continuations.
 * Multiple Values::             Returning and accepting multiple values.
 * Exceptions::                  Throwing and catching exceptions.
 * Error Reporting::             Procedures for signaling errors.
@@ -343,6 +344,112 @@ times.
 @end deffn
 
 
address@hidden Prompts
address@hidden Prompts
address@hidden prompts
address@hidden delimited continuations
address@hidden composable continuations
address@hidden non-local exit
+
+Prompts are control-flow barriers between different parts of a program. In the
+same way that a user sees a shell prompt (e.g., the Bash prompt) as a barrier
+between the operating system and her programs, Scheme prompts allow the Scheme
+programmer to treat parts of programs as if they were running in different
+operating systems.
+
+We use this roundabout explanation because, unless you're a functional
+programming junkie, you probably haven't heard the term, ``delimited, 
composable
+continuation''. That's OK; it's a relatively recent topic, but a very useful
+one to know about.
+
address@hidden {Scheme Procedure} call-with-prompt tag thunk handler
+Set up a prompt, and call @var{thunk} within that prompt.
+
+During the dynamic extent of the call to @var{thunk}, a prompt named @var{tag}
+will be present in the dynamic context, such that if a user calls
address@hidden (see below) with that tag, control rewinds back to the
+prompt, and the @var{handler} is run.
+
address@hidden must be a procedure. The first argument to @var{handler} will be
+the state of the computation begun when @var{thunk} was called, and ending with
+the call to @code{abort-to-prompt}. The remaining arguments to @var{handler} 
are
+those passed to @code{abort-to-prompt}.
address@hidden deffn
+
address@hidden {Scheme Procedure} abort-to-prompt tag val ...
+Unwind the dynamic and control context to the nearest prompt named @var{tag},
+also passing the given values.
address@hidden deffn
+
+C programmers may recognize @code{call-with-prompt} and @code{abort-to-prompt}
+as a fancy kind of @code{setjmp} and @code{longjmp}, respectively. Prompts are
+indeed quite useful as non-local escape mechanisms. Guile's @code{catch} and
address@hidden are implemented in terms of prompts. Prompts are more convenient
+than @code{longjmp}, in that one has the opportunity to pass multiple values to
+the jump target.
+
+Also unlike @code{longjmp}, the prompt handler is given the full state of the
+process that was aborted, as the first argument to the prompt's handler. That
+state is the @dfn{continuation} of the computation wrapped by the prompt. It is
+a @dfn{delimited continuation}, because it is not the whole continuation of the
+program; rather, just the computation initiated by the call to
address@hidden
+
+The continuation is a procedure, and may be reinstated simply by invoking it,
+with any number of values. Here's where things get interesting, and complicated
+as well. Besides being described as delimited, continuations reified by prompts
+are also @dfn{composable}, because invoking a prompt-saved continuation 
composes
+that continuation with the current one.
+
+Imagine you have saved a continuation via call-with-prompt:
+
address@hidden
+(define cont
+  (call-with-prompt
+   ;; tag
+   'foo
+   ;; thunk
+   (lambda ()
+     (+ 34 (abort-to-prompt 'foo)))
+   ;; handler
+   (lambda (k) k)))
address@hidden example
+
+The resulting continuation is the addition of 34. It's as if you had written:
+
address@hidden
+(define cont
+  (lambda (x)
+    (+ 34 x)))
address@hidden example
+
+So, if we call @code{cont} with one numeric value, we get that number,
+incremented by 34:
+
address@hidden
+(cont 8)
address@hidden 42
+(* 2 (cont 8))
address@hidden 84
address@hidden example
+
+The last example illustrates what we mean when we say, "composes with the
+current continuation". We mean that there is a current continuation -- some
+remaining things to compute, like @code{(lambda (x) (* x 2))} -- and that
+calling the saved continuation doesn't wipe out the current continuation, it
+composes the saved continuation with the current one.
+
+We're belaboring the point here because traditional Scheme continuations, as
+discussed in the next section, aren't composable, and are actually less
+expressive than continuations captured by prompts. But there's a place for them
+both.
+
+Before moving on, we should mention that if the handler of a prompt is a
address@hidden expression, and the first argument isn't referenced, an abort to
+that prompt will not cause a continuation to be reified. This can be an
+important efficiency consideration to keep in mind.
+
+
 @node Continuations
 @subsection Continuations
 @cindex continuations
@@ -409,15 +516,6 @@ invoke that continuation.
 This is in common use since the latter is rather long.
 @end deffn
 
address@hidden {C Function} SCM scm_make_continuation (int *first)
-Capture the current continuation as described above.  The return value
-is the new continuation, and @var{*first} is set to 1.
-
-When the continuation is invoked, @code{scm_make_continuation} will
-return again, this time returning the value (or set of multiple
-values) passed in that invocation, and with @var{*first} set to 0.
address@hidden deftypefn
-
 @sp 1
 @noindent
 Here is a simple example,
@@ -475,13 +573,12 @@ with programs written in other languages, such as C, 
which do not know
 about continuations.  Basically continuations are captured by a block
 copy of the stack, and resumed by copying back.
 
-For this reason, generally continuations should be used only when
-there is no other simple way to achieve the desired result, or when
-the elegance of the continuation mechanism outweighs the need for
-performance.
+For this reason, continuations captured by @code{call/cc} should be used only
+when there is no other simple way to achieve the desired result, or when the
+elegance of the continuation mechanism outweighs the need for performance.
 
 Escapes upwards from loops or nested functions are generally best
-handled with exceptions (@pxref{Exceptions}).  Coroutines can be
+handled with prompts (@pxref{Prompts}).  Coroutines can be
 efficiently implemented with cooperating threads (a thread holds a
 full program stack but doesn't copy it around the way continuations
 do).
@@ -614,8 +711,7 @@ more conveniently.
 @menu
 * Exception Terminology::       Different ways to say the same thing.
 * Catch::                       Setting up to catch exceptions.
-* Throw Handlers::              Adding extra handling to a throw.
-* Lazy Catch::                  Catch without unwinding the stack.
+* Throw Handlers::              Handling exceptions before unwinding the stack.
 * Throw::                       Throwing an exception.
 * Exception Implementation::    How Guile implements exceptions.
 @end menu
@@ -808,17 +904,53 @@ Operations}).
 @subsubsection Throw Handlers
 
 It's sometimes useful to be able to intercept an exception that is being
-thrown, but without changing where in the dynamic context that exception
-will eventually be caught.  This could be to clean up some related state
-or to pass information about the exception to a debugger, for example.
-The @code{with-throw-handler} procedure provides a way to do this.
+thrown before the stack is unwound. This could be to clean up some
+related state, to print a backtrace, or to pass information about the
+exception to a debugger, for example. The @code{with-throw-handler}
+procedure provides a way to do this.
 
 @deffn {Scheme Procedure} with-throw-handler key thunk handler
 @deffnx {C Function} scm_with_throw_handler (key, thunk, handler)
 Add @var{handler} to the dynamic context as a throw handler
 for key @var{key}, then invoke @var{thunk}.
+
+This behaves exactly like @code{catch}, except that it does not unwind
+the stack before invoking @var{handler}. If the @var{handler} procedure
+returns normally, Guile rethrows the same exception again to the next
+innermost catch or throw handler. @var{handler} may exit nonlocally, of
+course, via an explicit throw or via invoking a continuation.
 @end deffn
 
+Typically @var{handler} is used to display a backtrace of the stack at
+the point where the corresponding @code{throw} occurred, or to save off
+this information for possible display later.
+
+Not unwinding the stack means that throwing an exception that is handled
+via a throw handler is equivalent to calling the throw handler handler
+inline instead of each @code{throw}, and then omitting the surrounding
address@hidden In other words,
+
address@hidden
+(with-throw-handler 'key
+  (lambda () @dots{} (throw 'key args @dots{}) @dots{})
+  handler)
address@hidden lisp
+
address@hidden
+is mostly equivalent to
+
address@hidden
+((lambda () @dots{} (handler 'key args @dots{}) @dots{}))
address@hidden lisp
+
+In particular, the dynamic context when @var{handler} is invoked is that
+of the site where @code{throw} is called. The examples are not quite
+equivalent, because the body of a @code{with-throw-handler} is not in
+tail position with respect to the @code{with-throw-handler}, and if
address@hidden exits normally, Guile arranges to rethrow the error, but
+hopefully the intention is clear. (For an introduction to what is meant
+by dynamic context, @xref{Dynamic Wind}.)
+
 @deftypefn {C Function} SCM scm_c_with_throw_handler (SCM tag, 
scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, void 
*handler_data, int lazy_catch_p)
 The above @code{scm_with_throw_handler} takes Scheme procedures as body
 (thunk) and handler arguments.  @code{scm_c_with_throw_handler} is an
@@ -846,141 +978,13 @@ everything that a @code{catch} would do until the point 
where
 then it rethrows to the next innermost @code{catch} or throw handler
 instead.
 
+Note also that since the dynamic context is not unwound, if a
address@hidden handler throws to a key that does not match
+the @code{with-throw-handler} expression's @var{key}, the new throw may
+be handled by a @code{catch} or throw handler that is @emph{closer} to
+the throw than the first @code{with-throw-handler}.
 
address@hidden Lazy Catch
address@hidden Catch Without Unwinding
-
-Before version 1.8, Guile's closest equivalent to
address@hidden was @code{lazy-catch}.  From version 1.8
-onwards we recommend using @code{with-throw-handler} because its
-behaviour is more useful than that of @code{lazy-catch}, but
address@hidden is still supported as well.
-
-A @dfn{lazy catch} is used in the same way as a normal @code{catch},
-with @var{key}, @var{thunk} and @var{handler} arguments specifying the
-exception type, normal case code and handler procedure, but differs in
-one important respect: the handler procedure is executed without
-unwinding the call stack from the context of the @code{throw} expression
-that caused the handler to be invoked.
-
address@hidden {Scheme Procedure} lazy-catch key thunk handler
address@hidden {C Function} scm_lazy_catch (key, thunk, handler)
-This behaves exactly like @code{catch}, except that it does
-not unwind the stack before invoking @var{handler}.
-If the @var{handler} procedure returns normally, Guile
-rethrows the same exception again to the next innermost catch,
-lazy-catch or throw handler.  If the @var{handler} exits
-non-locally, that exit determines the continuation.
address@hidden deffn
-
address@hidden {C Function} SCM scm_internal_lazy_catch (SCM tag, 
scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, void 
*handler_data)
-The above @code{scm_lazy_catch} takes Scheme procedures as body and
-handler arguments.  @code{scm_internal_lazy_catch} is an equivalent
-taking C functions.  See @code{scm_internal_catch} (@pxref{Catch}) for
-a description of the parameters, the behaviour however of course
-follows @code{lazy-catch}.
address@hidden deftypefn
-
-Typically @var{handler} is used to display a backtrace of the stack at
-the point where the corresponding @code{throw} occurred, or to save off
-this information for possible display later.
-
-Not unwinding the stack means that throwing an exception that is caught
-by a @code{lazy-catch} is @emph{almost} equivalent to calling the
address@hidden's handler inline instead of each @code{throw}, and
-then omitting the surrounding @code{lazy-catch}.  In other words,
-
address@hidden
-(lazy-catch 'key
-  (lambda () @dots{} (throw 'key args @dots{}) @dots{})
-  handler)
address@hidden lisp
-
address@hidden
-is @emph{almost} equivalent to
-
address@hidden
-((lambda () @dots{} (handler 'key args @dots{}) @dots{}))
address@hidden lisp
-
address@hidden
-But why only @emph{almost}?  The difference is that with
address@hidden (as with normal @code{catch}), the dynamic context is
-unwound back to just outside the @code{lazy-catch} expression before
-invoking the handler.  (For an introduction to what is meant by dynamic
-context, @xref{Dynamic Wind}.)
-
-Then, when the handler @emph{itself} throws an exception, that exception
-must be caught by some kind of @code{catch} (including perhaps another
address@hidden) higher up the call stack.
-
-The dynamic context also includes @code{with-fluids} blocks
-(@pxref{Fluids and Dynamic States}),
-so the effect of unwinding the dynamic context can also be seen in fluid
-variable values.  This is illustrated by the following code, in which
-the normal case thunk uses @code{with-fluids} to temporarily change the
-value of a fluid:
-
address@hidden
-(define f (make-fluid))
-(fluid-set! f "top level value")
-
-(define (handler . args)
-  (cons (fluid-ref f) args))
-
-(lazy-catch 'foo
-            (lambda ()
-              (with-fluids ((f "local value"))
-                (throw 'foo)))
-            handler)
address@hidden
-("top level value" foo)
-
-((lambda ()
-   (with-fluids ((f "local value"))
-     (handler 'foo))))
address@hidden
-("local value" foo)
address@hidden lisp
-
address@hidden
-In the @code{lazy-catch} version, the unwinding of dynamic context
-restores @code{f} to its value outside the @code{with-fluids} block
-before the handler is invoked, so the handler's @code{(fluid-ref f)}
-returns the external value.
-
address@hidden is useful because it permits the implementation of
-debuggers and other reflective programming tools that need to access the
-state of the call stack at the exact point where an exception or an
-error is thrown.  For an example of this, see REFFIXME:stack-catch.
-
-It should be obvious from the above that @code{lazy-catch} is very
-similar to @code{with-throw-handler}.  In fact Guile implements
address@hidden in exactly the same way as @code{with-throw-handler},
-except with a flag set to say ``where there are slight differences
-between what @code{with-throw-handler} and @code{lazy-catch} would do,
-do what @code{lazy-catch} has always done''.  There are two such
-differences:
-
address@hidden
address@hidden
address@hidden handlers execute in the full dynamic context
-of the originating @code{throw} call.  @code{lazy-catch} handlers
-execute in the dynamic context of the @code{lazy-catch} expression,
-excepting only that the stack has not yet been unwound from the point of
-the @code{throw} call.
-
address@hidden
-If a @code{with-throw-handler} handler throws to a key that does not
-match the @code{with-throw-handler} expression's @var{key}, the new
-throw may be handled by a @code{catch} or throw handler that is _closer_
-to the throw than the first @code{with-throw-handler}.  If a
address@hidden handler throws, it will always be handled by a
address@hidden or throw handler that is higher up the dynamic context than
-the first @code{lazy-catch}.
address@hidden enumerate
-
-Here is an example to illustrate the second difference:
+Here is an example to illustrate this behavior:
 
 @lisp
 (catch 'a
@@ -998,14 +1002,7 @@ Here is an example to illustrate the second difference:
 
 @noindent
 This code will call @code{inner-handler} and then continue with the
-continuation of the inner @code{catch}.  If the
address@hidden was changed to @code{lazy-catch}, however, the
-code would call @code{outer-handler} and then continue with the
-continuation of the outer @code{catch}.
-
-Modulo these two differences, any statements in the previous and
-following subsections about throw handlers apply to lazy catches as
-well.
+continuation of the inner @code{catch}.
 
 
 @node Throw
@@ -1501,6 +1498,42 @@ which is the name of the procedure incorrectly invoked.
 @end deftypefn
 
 
address@hidden Signalling Type Errors
+
+Every function visible at the Scheme level should aggressively check the
+types of its arguments, to avoid misinterpreting a value, and perhaps
+causing a segmentation fault.  Guile provides some macros to make this
+easier.
+
address@hidden Macro void SCM_ASSERT (int @var{test}, SCM @var{obj}, unsigned 
int @var{position}, const char address@hidden)
+If @var{test} is zero, signal a ``wrong type argument'' error,
+attributed to the subroutine named @var{subr}, operating on the value
address@hidden, which is the @var{position}'th argument of @var{subr}.
address@hidden deftypefn
+
address@hidden Macro int SCM_ARG1
address@hidden Macro int SCM_ARG2
address@hidden Macro int SCM_ARG3
address@hidden Macro int SCM_ARG4
address@hidden Macro int SCM_ARG5
address@hidden Macro int SCM_ARG6
address@hidden Macro int SCM_ARG7
+One of the above values can be used for @var{position} to indicate the
+number of the argument of @var{subr} which is being checked.
+Alternatively, a positive integer number can be used, which allows to
+check arguments after the seventh.  However, for parameter numbers up to
+seven it is preferable to use @code{SCM_ARGN} instead of the
+corresponding raw number, since it will make the code easier to
+understand.
address@hidden deftypefn
+
address@hidden Macro int SCM_ARGn
+Passing a value of zero or @code{SCM_ARGn} for @var{position} allows to
+leave it unspecified which argument's type is incorrect.  Again,
address@hidden should be preferred over a raw zero constant.
address@hidden deftypefn
+
+
 @node Continuation Barriers
 @subsection Continuation Barriers
 
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index c6022e9..420660b 100755
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -1053,10 +1053,9 @@ locale-dependent parsing).
 @rnindex magnitude
 @rnindex angle
 
address@hidden {Scheme Procedure} make-rectangular real imaginary
address@hidden {C Function} scm_make_rectangular (real, imaginary)
-Return a complex number constructed of the given @var{real} and
address@hidden parts.
address@hidden {Scheme Procedure} make-rectangular real_part imaginary_part
address@hidden {C Function} scm_make_rectangular (real_part, imaginary_part)
+Return a complex number constructed of the given @var{real-part} and 
@var{imaginary-part} parts.
 @end deffn
 
 @deffn {Scheme Procedure} make-polar x y
@@ -1688,11 +1687,28 @@ the backslash of @code{#\}.
 Many of the non-printing characters, such as whitespace characters and
 control characters, also have names.
 
-The most commonly used non-printing characters are space and
-newline.  Their character names are @code{#\space} and
address@hidden  There are also names for all of the ``C0 control
-characters'' (those with code points below 32).  The following table
-describes the names for each character.
+The most commonly used non-printing characters have long character
+names, described in the table below.
+
address@hidden address@hidden {Preferred}
address@hidden Character Name @tab Codepoint
address@hidden @code{#\nul} @tab U+0000
address@hidden @code{#\alarm} @tab u+0007
address@hidden @code{#\backspace} @tab U+0008
address@hidden @code{#\tab} @tab U+0009
address@hidden @code{#\linefeed} @tab U+000A
address@hidden @code{#\newline} @tab U+000A
address@hidden @code{#\vtab} @tab U+000B
address@hidden @code{#\page} @tab U+000C
address@hidden @code{#\return} @tab U+000D
address@hidden @code{#\esc} @tab U+001B
address@hidden @code{#\space} @tab U+0020
address@hidden @code{#\delete} @tab U+007F
address@hidden multitable
+
+There are also short names for all of the ``C0 control characters''
+(those with code points below 32).  The following table lists the short
+name for each character.
 
 @multitable @columnfractions .25 .25 .25 .25
 @item 0 = @code{#\nul}
@@ -1705,7 +1721,7 @@ describes the names for each character.
  @tab 7 = @code{#\bel}
 @item 8 = @code{#\bs}
  @tab 9 = @code{#\ht}
- @tab 10 = @code{#\lf} 
+ @tab 10 = @code{#\lf}
  @tab 11 = @code{#\vt}
 @item 12 = @code{#\ff}
  @tab 13 = @code{#\cr}
@@ -1730,24 +1746,16 @@ describes the names for each character.
 @item 32 = @code{#\sp}
 @end multitable
 
-The ``delete'' character (code point U+007F) may be referred to with the
-name @code{#\del}.
+The short name for the ``delete'' character (code point U+007F) is
address@hidden
 
-One might note that the space character has two names --
address@hidden and @code{#\sp} -- as does the newline character.
-Several other non-printing characters have more than one name, for the
-sake of compatibility with previous versions.
+There are also a few alternative names left over for compatibility with
+previous versions of Guile.
 
 @multitable address@hidden {Preferred}
 @item Alternate @tab Standard
address@hidden @code{#\sp} @tab @code{#\space}
 @item @code{#\nl} @tab @code{#\newline}
address@hidden @code{#\lf} @tab @code{#\newline}
address@hidden @code{#\tab} @tab @code{#\ht}
address@hidden @code{#\backspace} @tab @code{#\bs}
address@hidden @code{#\return} @tab @code{#\cr}
address@hidden @code{#\page} @tab @code{#\ff}
address@hidden @code{#\np} @tab @code{#\ff}
address@hidden @code{#\np} @tab @code{#\page}
 @item @code{#\null} @tab @code{#\nul}
 @end multitable
 
@@ -1755,6 +1763,18 @@ Characters may also be written using their code point 
values.  They can
 be written with as an octal number, such as @code{#\10} for
 @code{#\bs} or @code{#\177} for @code{#\del}.
 
+When the @code{r6rs-hex-escapes} reader option is enabled, there is an
+additional syntax for character escapes: @code{#\xHHHH} -- the letter 'x'
+followed by a hexadecimal number of one to eight digits.
+
address@hidden
+(read-enable 'r6rs-hex-escapes)
address@hidden lisp
+
+Enabling this option will also change the hex escape format for strings.  More
+on string escapes can be found at (@pxref{String Syntax}).  More on reader
+options in general can be found at (@pxref{Reader options}).
+
 @rnindex char?
 @deffn {Scheme Procedure} char? x
 @deffnx {C Function} scm_char_p (x)
@@ -1874,6 +1894,81 @@ Return @code{#t} iff @var{chr} is either uppercase or 
lowercase, else
 @code{#f}.
 @end deffn
 
address@hidden {Scheme Procedure} char-general-category chr
address@hidden {C Function} scm_char_general_category (chr)
+Return a symbol giving the two-letter name of the Unicode general 
+category assigned to @var{chr} or @code{#f} if no named category is 
+assigned.  The following table provides a list of category names along
+with their meanings.
+
address@hidden @columnfractions .1 .4 .1 .4
address@hidden Lu
+ @tab Uppercase letter
+ @tab Pf
+ @tab Final quote punctuation
address@hidden Ll
+ @tab Lowercase letter
+ @tab Po
+ @tab Other punctuation
address@hidden Lt
+ @tab Titlecase letter
+ @tab Sm
+ @tab Math symbol
address@hidden Lm
+ @tab Modifier letter
+ @tab Sc
+ @tab Currency symbol
address@hidden Lo
+ @tab Other letter
+ @tab Sk
+ @tab Modifier symbol
address@hidden Mn
+ @tab Non-spacing mark
+ @tab So
+ @tab Other symbol
address@hidden Mc
+ @tab Combining spacing mark
+ @tab Zs
+ @tab Space separator
address@hidden Me
+ @tab Enclosing mark
+ @tab Zl
+ @tab Line separator
address@hidden Nd
+ @tab Decimal digit number
+ @tab Zp
+ @tab Paragraph separator
address@hidden Nl
+ @tab Letter number
+ @tab Cc
+ @tab Control
address@hidden No
+ @tab Other number
+ @tab Cf
+ @tab Format
address@hidden Pc
+ @tab Connector punctuation
+ @tab Cs
+ @tab Surrogate
address@hidden Pd
+ @tab Dash punctuation
+ @tab Co
+ @tab Private use
address@hidden Ps
+ @tab Open punctuation
+ @tab Cn
+ @tab Unassigned
address@hidden Pe
+ @tab Close punctuation
+ @tab
+ @tab
address@hidden Pi
+ @tab Initial quote punctuation
+ @tab
+ @tab
address@hidden multitable
address@hidden deffn
+
 @rnindex char->integer
 @deffn {Scheme Procedure} char->integer chr
 @deffnx {C Function} scm_char_to_integer (chr)
@@ -1900,6 +1995,30 @@ Return the uppercase character version of @var{chr}.
 Return the lowercase character version of @var{chr}.
 @end deffn
 
address@hidden char-titlecase
address@hidden {Scheme Procedure} char-titlecase chr
address@hidden {C Function} scm_char_titlecase (chr)
+Return the titlecase character version of @var{chr} if one exists;
+otherwise return the uppercase version.  
+
+For most characters these will be the same, but the Unicode Standard 
+includes certain digraph compatibility characters, such as @code{U+01F3}
+``dz'', for which the uppercase and titlecase characters are different 
+(@code{U+01F1} ``DZ'' and @code{U+01F2} ``Dz'' in this case, 
+respectively).
address@hidden deffn
+
address@hidden scm_t_wchar
address@hidden {C Function} scm_t_wchar scm_c_upcase (scm_t_wchar @var{c})
address@hidden {C Function} scm_t_wchar scm_c_downcase (scm_t_wchar @var{c})
address@hidden {C Function} scm_t_wchar scm_c_titlecase (scm_t_wchar @var{c})
+
+These C functions take an integer representation of a Unicode
+codepoint and return the codepoint corresponding to its uppercase,
+lowercase, and titlecase forms respectively.  The type
address@hidden is a signed, 32-bit integer.
address@hidden deftypefn
+
 @node Character Sets
 @subsection Character Sets
 
@@ -2493,7 +2612,8 @@ Guile provides all procedures of SRFI-13 and a few more.
 * Reversing and Appending Strings:: Appending strings to form a new string.
 * Mapping Folding and Unfolding::   Iterating over strings.
 * Miscellaneous String Operations:: Replicating, insertion, parsing, ...
-* Conversion to/from C::       
+* Conversion to/from C::
+* String Internals::                The storage strategy for strings.
 @end menu
 
 @node String Syntax
@@ -2507,10 +2627,10 @@ Guile provides all procedures of SRFI-13 and a few more.
 The read syntax for strings is an arbitrarily long sequence of
 characters enclosed in double quotes (@nicode{"}).
 
-Backslash is an escape character and can be used to insert the
-following special characters.  @nicode{\"} and @nicode{\\} are R5RS
-standard, the rest are Guile extensions, notice they follow C string
-syntax.
+Backslash is an escape character and can be used to insert the following
+special characters.  @nicode{\"} and @nicode{\\} are R5RS standard, the
+next seven are R6RS standard --- notice they follow C syntax --- and the
+remaining four are Guile extensions.
 
 @table @asis
 @item @nicode{\\}
@@ -2520,9 +2640,6 @@ Backslash character.
 Double quote character (an unescaped @nicode{"} is otherwise the end
 of the string).
 
address@hidden @nicode{\0}
-NUL character (ASCII 0).
-
 @item @nicode{\a}
 Bell character (ASCII 7).
 
@@ -2541,6 +2658,12 @@ Tab character (ASCII 9).
 @item @nicode{\v}
 Vertical tab character (ASCII 11).
 
address@hidden @nicode{\b}
+Backspace character (ASCII 8).
+
address@hidden @nicode{\0}
+NUL character (ASCII 0).
+
 @item @nicode{\xHH}
 Character code given by two hexadecimal digits.  For example
 @nicode{\x7f} for an ASCII DEL (127).
@@ -2564,6 +2687,20 @@ The following are examples of string literals:
 "\"Hi\", he said."
 @end lisp
 
+The three escape sequences @code{\xHH}, @code{\uHHHH} and @code{\UHHHHHH} were
+chosen to not break compatibility with code written for previous versions of
+Guile.  The R6RS specification suggests a different, incompatible syntax for 
hex
+escapes: @code{\xHHHH;} -- a character code followed by one to eight 
hexadecimal
+digits terminated with a semicolon.  If this escape format is desired instead,
+it can be enabled with the reader option @code{r6rs-hex-escapes}.
+
address@hidden
+(read-enable 'r6rs-hex-escapes)
address@hidden lisp
+
+Enabling this option will also change the hex escape format for characters.
+More on character escapes can be found at (@pxref{Characters}).  More on
+reader options in general can be found at (@pxref{Reader options}).
 
 @node String Predicates
 @subsubsection String Predicates
@@ -2973,7 +3110,7 @@ predicates (@pxref{Characters}), but are defined on 
character sequences.
 
 The first set is specified in R5RS and has names that end in @code{?}.
 The second set is specified in SRFI-13 and the names have not ending
address@hidden  
address@hidden
 
 The predicates ending in @code{-ci} ignore the character case
 when comparing strings.  For now, case-insensitive comparison is done
@@ -2983,7 +3120,8 @@ comparison.  See @xref{Text Collation, the @code{(ice-9
 i18n)} module}, for locale-dependent string comparison.
 
 @rnindex string=?
address@hidden {Scheme Procedure} string=? s1 s2
address@hidden {Scheme Procedure} string=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_equal_p (s1, s2, rest)
 Lexicographic equality predicate; return @code{#t} if the two
 strings are the same length and contain the same characters in
 the same positions, otherwise return @code{#f}.
@@ -2995,31 +3133,36 @@ characters.
 @end deffn
 
 @rnindex string<?
address@hidden {Scheme Procedure} string<? s1 s2
address@hidden {Scheme Procedure} string<? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_less_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically less than @var{s2}.
 @end deffn
 
 @rnindex string<=?
address@hidden {Scheme Procedure} string<=? s1 s2
address@hidden {Scheme Procedure} string<=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_leq_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically less than or equal to @var{s2}.
 @end deffn
 
 @rnindex string>?
address@hidden {Scheme Procedure} string>? s1 s2
address@hidden {Scheme Procedure} string>? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_gr_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically greater than @var{s2}.
 @end deffn
 
 @rnindex string>=?
address@hidden {Scheme Procedure} string>=? s1 s2
address@hidden {Scheme Procedure} string>=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_geq_p (s1, s2, rest)
 Lexicographic ordering predicate; return @code{#t} if @var{s1}
 is lexicographically greater than or equal to @var{s2}.
 @end deffn
 
 @rnindex string-ci=?
address@hidden {Scheme Procedure} string-ci=? s1 s2
address@hidden {Scheme Procedure} string-ci=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_equal_p (s1, s2, rest)
 Case-insensitive string equality predicate; return @code{#t} if
 the two strings are the same length and their component
 characters match (ignoring case) at each position; otherwise
@@ -3027,28 +3170,32 @@ return @code{#f}.
 @end deffn
 
 @rnindex string-ci<?
address@hidden {Scheme Procedure} string-ci<? s1 s2
address@hidden {Scheme Procedure} string-ci<? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_less_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically less than @var{s2}
 regardless of case.
 @end deffn
 
 @rnindex string<=?
address@hidden {Scheme Procedure} string-ci<=? s1 s2
address@hidden {Scheme Procedure} string-ci<=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_leq_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically less than or equal
 to @var{s2} regardless of case.
 @end deffn
 
 @rnindex string-ci>?
address@hidden {Scheme Procedure} string-ci>? s1 s2
address@hidden {Scheme Procedure} string-ci>? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_gr_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically greater than
 @var{s2} regardless of case.
 @end deffn
 
 @rnindex string-ci>=?
address@hidden {Scheme Procedure} string-ci>=? s1 s2
address@hidden {Scheme Procedure} string-ci>=? [s1 [s2 . rest]]
address@hidden {C Function} scm_i_string_ci_geq_p (s1, s2, rest)
 Case insensitive lexicographic ordering predicate; return
 @code{#t} if @var{s1} is lexicographically greater than or
 equal to @var{s2} regardless of case.
@@ -3071,8 +3218,9 @@ mismatch index, depending upon whether @var{s1} is less 
than,
 equal to, or greater than @var{s2}.  The mismatch index is the
 largest index @var{i} such that for every 0 <= @var{j} <
 @var{i}, @address@hidden = @address@hidden -- that is,
address@hidden is the first position that does not match.  The
-character comparison is done case-insensitively.
address@hidden is the first position where the lowercased letters 
+do not match.
+
 @end deffn
 
 @deffn {Scheme Procedure} string= s1 s2 [start1 [end1 [start2 [end2]]]]
@@ -3163,6 +3311,70 @@ Compute a hash value for @var{S}.  the optional argument 
@var{bound} is a non-ne
 Compute a hash value for @var{S}.  the optional argument @var{bound} is a 
non-negative exact integer specifying the range of the hash function. A 
positive value restricts the return value to the range [0,bound).
 @end deffn
 
+Because the same visual appearance of an abstract Unicode character can 
+be obtained via multiple sequences of Unicode characters, even the 
+case-insensitive string comparison functions described above may return
address@hidden when presented with strings containing different 
+representations of the same character.  For example, the Unicode 
+character ``LATIN SMALL LETTER S WITH DOT BELOW AND DOT ABOVE'' can be 
+represented with a single character (U+1E69) or by the character ``LATIN
+SMALL LETTER S'' (U+0073) followed by the combining marks ``COMBINING 
+DOT BELOW'' (U+0323) and ``COMBINING DOT ABOVE'' (U+0307).
+
+For this reason, it is often desirable to ensure that the strings
+to be compared are using a mutually consistent representation for every 
+character.  The Unicode standard defines two methods of normalizing the
+contents of strings: Decomposition, which breaks composite characters 
+into a set of constituent characters with an ordering defined by the
+Unicode Standard; and composition, which performs the converse.
+
+There are two decomposition operations.  ``Canonical decomposition'' 
+produces character sequences that share the same visual appearance as
+the original characters, while ``compatiblity decomposition'' produces
+ones whose visual appearances may differ from the originals but which
+represent the same abstract character.
+
+These operations are encapsulated in the following set of normalization
+forms:
+
address@hidden @dfn
address@hidden NFD
+Characters are decomposed to their canonical forms.
+
address@hidden NFKD
+Characters are decomposed to their compatibility forms.
+
address@hidden NFC
+Characters are decomposed to their canonical forms, then composed.
+
address@hidden NFKC
+Characters are decomposed to their compatibility forms, then composed.
+
address@hidden table
+
+The functions below put their arguments into one of the forms described
+above.
+
address@hidden {Scheme Procedure} string-normalize-nfd s
address@hidden {C Function} scm_string_normalize_nfd (s)
+Return the @code{NFD} normalized form of @var{s}.
address@hidden deffn
+
address@hidden {Scheme Procedure} string-normalize-nfkd s
address@hidden {C Function} scm_string_normalize_nfkd (s)
+Return the @code{NFKD} normalized form of @var{s}.
address@hidden deffn
+
address@hidden {Scheme Procedure} string-normalize-nfc s
address@hidden {C Function} scm_string_normalize_nfc (s)
+Return the @code{NFC} normalized form of @var{s}.
address@hidden deffn
+
address@hidden {Scheme Procedure} string-normalize-nfkc s
address@hidden {C Function} scm_string_normalize_nfkc (s)
+Return the @code{NFKC} normalized form of @var{s}.
address@hidden deffn
+
 @node String Searching
 @subsubsection String Searching
 
@@ -3337,6 +3549,13 @@ case-insensitively.
 These are procedures for mapping strings to their upper- or lower-case
 equivalents, respectively, or for capitalizing strings.
 
+They use the basic case mapping rules for Unicode characters.  No
+special language or context rules are considered.  The resulting strings
+are guaranteed to be the same length as the input strings.
+
address@hidden Case Mapping, the @code{(ice-9
+i18n)} module}, for locale-dependent case conversions.
+
 @deffn {Scheme Procedure} string-upcase str [start [end]]
 @deffnx {C Function} scm_substring_upcase (str, start, end)
 @deffnx {C Function} scm_string_upcase (str)
@@ -3437,8 +3656,8 @@ concatenation of the given strings, @var{args}.
 @end example
 @end deffn
 
address@hidden {Scheme Procedure} string-append/shared . ls
address@hidden {C Function} scm_string_append_shared (ls)
address@hidden {Scheme Procedure} string-append/shared . rest
address@hidden {C Function} scm_string_append_shared (rest)
 Like @code{string-append}, but the result may share memory
 with the argument strings.
 @end deffn
@@ -3658,12 +3877,19 @@ that make up the string.  For Scheme strings, character 
encoding is
 not an issue (most of the time), since in Scheme you never get to see
 the bytes, only the characters.
 
-Well, ideally, anyway.  Right now, Guile simply equates Scheme
-characters and bytes, ignoring the possibility of multi-byte encodings
-completely.  This will change in the future, where Guile will use
-Unicode codepoints as its characters and UTF-8 or some other encoding
-as its internal encoding.  When you exclusively use the functions
-listed in this section, you are `future-proof'.
+Converting to C and converting from C each have their own challenges.
+
+When converting from C to Scheme, it is important that the sequence of
+bytes in the C string be valid with respect to its encoding.  ASCII
+strings, for example, can't have any bytes greater than 127.  An ASCII
+byte greater than 127 is considered @emph{ill-formed} and cannot be
+converted into a Scheme character.
+
+Problems can occur in the reverse operation as well.  Not all character
+encodings can hold all possible Scheme characters.  Some encodings, like
+ASCII for example, can only describe a small subset of all possible
+characters.  So, when converting to C, one must first decide what to do
+with Scheme characters that can't be represented in the C string.
 
 Converting a Scheme string to a C string will often allocate fresh
 memory to hold the result.  You must take care that this memory is
@@ -3673,8 +3899,9 @@ using @code{scm_dynwind_free} inside an appropriate 
dynwind context,
 
 @deftypefn  {C Function} SCM scm_from_locale_string (const char *str)
 @deftypefnx {C Function} SCM scm_from_locale_stringn (const char *str, size_t 
len)
-Creates a new Scheme string that has the same contents as @var{str}
-when interpreted in the current locale character encoding.
+Creates a new Scheme string that has the same contents as @var{str} when
+interpreted in the locale character encoding of the
address@hidden
 
 For @code{scm_from_locale_string}, @var{str} must be null-terminated.
 
@@ -3682,6 +3909,8 @@ For @code{scm_from_locale_stringn}, @var{len} specifies 
the length of
 @var{str} in bytes, and @var{str} does not need to be null-terminated.
 If @var{len} is @code{(size_t)-1}, then @var{str} does need to be
 null-terminated and the real length will be found with @code{strlen}.
+
+If the C string is ill-formed, an error will be raised.
 @end deftypefn
 
 @deftypefn  {C Function} SCM scm_take_locale_string (char *str)
@@ -3695,10 +3924,10 @@ can then use @var{str} directly as its internal 
representation.
 
 @deftypefn  {C Function} {char *} scm_to_locale_string (SCM str)
 @deftypefnx {C Function} {char *} scm_to_locale_stringn (SCM str, size_t *lenp)
-Returns a C string in the current locale encoding with the same
-contents as @var{str}.  The C string must be freed with @code{free}
-eventually, maybe by using @code{scm_dynwind_free}, @xref{Dynamic
-Wind}.
+Returns a C string with the same contents as @var{str} in the locale
+encoding of the @code{current-output-port}.  The C string must be freed
+with @code{free} eventually, maybe by using @code{scm_dynwind_free},
address@hidden Wind}.
 
 For @code{scm_to_locale_string}, the returned string is
 null-terminated and an error is signalled when @var{str} contains
@@ -3710,6 +3939,14 @@ returned string in bytes is stored in @address@hidden  
The
 returned string will not be null-terminated in this case.  If
 @var{lenp} is @code{NULL}, @code{scm_to_locale_stringn} behaves like
 @code{scm_to_locale_string}.
+
+If a character in @var{str} cannot be represented in the locale encoding
+of the current output port, the port conversion strategy of the current
+output port will determine the result, @xref{Ports}.  If output port's
+conversion strategy is @code{error}, an error will be raised.  If it is
address@hidden, a replacement character, such as a question mark, will
+be inserted in its place.  If it is @code{escape}, a hex escape will be
+inserted in its place.
 @end deftypefn
 
 @deftypefn {C Function} size_t scm_to_locale_stringbuf (SCM str, char *buf, 
size_t max_len)
@@ -3725,6 +3962,71 @@ is larger than @var{max_len}, only @var{max_len} bytes 
have been
 stored and you probably need to try again with a larger buffer.
 @end deftypefn
 
address@hidden String Internals
address@hidden String Internals
+
+Guile stores each string in memory as a contiguous array of Unicode code
+points along with an associated set of attributes.  If all of the code
+points of a string have an integer range between 0 and 255 inclusive,
+the code point array is stored as one byte per code point: it is stored
+as an ISO-8859-1 (aka Latin-1) string.  If any of the code points of the
+string has an integer value greater that 255, the code point array is
+stored as four bytes per code point: it is stored as a UTF-32 string.
+
+Conversion between the one-byte-per-code-point and
+four-bytes-per-code-point representations happens automatically as
+necessary.
+
+No API is provided to set the internal representation of strings;
+however, there are pair of procedures available to query it.  These are
+debugging procedures.  Using them in production code is discouraged,
+since the details of Guile's internal representation of strings may
+change from release to release.
+
address@hidden {Scheme Procedure} string-bytes-per-char str
address@hidden {C Function} scm_string_bytes_per_char (str)
+Return the number of bytes used to encode a Unicode code point in string
address@hidden  The result is one or four.
address@hidden deffn
+
address@hidden {Scheme Procedure} %string-dump str
address@hidden {C Function} scm_sys_string_dump (str)
+Returns an association list containing debugging information for
address@hidden The association list has the following entries.
address@hidden @code
+
address@hidden string
+The string itself.
+
address@hidden start
+The start index of the string into its stringbuf
+
address@hidden length
+The length of the string
+
address@hidden shared
+If this string is a substring, it returns its
+parent string.  Otherwise, it returns @code{#f}
+
address@hidden read-only
address@hidden if the string is read-only
+
address@hidden stringbuf-chars
+A new string containing this string's stringbuf's characters
+
address@hidden stringbuf-length
+The number of characters in this stringbuf
+
address@hidden stringbuf-shared
address@hidden if this stringbuf is shared
+
address@hidden stringbuf-wide
address@hidden if this stringbuf's characters are stored in a 32-bit buffer,
+or @code{#f} if they are stored in an 8-bit buffer
address@hidden table
address@hidden deffn
+
+
 @node Bytevectors
 @subsection Bytevectors
 
@@ -3768,6 +4070,7 @@ R6RS (@pxref{R6RS I/O Ports}).
 * Bytevectors as Floats::       Interpreting bytes as real numbers.
 * Bytevectors as Strings::      Interpreting bytes as Unicode strings.
 * Bytevectors as Generalized Vectors::  Guile extension to the bytevector API.
+* Bytevectors as Uniform Vectors::  Bytevectors and SRFI-4.
 @end menu
 
 @node Bytevector Endianness
@@ -4102,12 +4405,7 @@ the host's native endianness.
 @cindex Unicode string encoding
 
 Bytevector contents can also be interpreted as Unicode strings encoded
-in one of the most commonly available encoding address@hidden
-1.8 does @emph{not} support Unicode strings.  Therefore, the procedures
-described here assume that Guile strings are internally encoded
-according to the current locale.  For instance, if @code{$LC_CTYPE} is
address@hidden, then @code{string->utf-8} @i{et al.} will
-assume that Guile strings are Latin-1-encoded.}.
+in one of the most commonly available encoding formats.
 
 @lisp
 (utf8->string (u8-list->bytevector '(99 97 102 101)))
@@ -4118,23 +4416,27 @@ assume that Guile strings are Latin-1-encoded.}.
 @end lisp
 
 @deffn {Scheme Procedure} string->utf8 str
address@hidden {Scheme Procedure} string->utf16 str
address@hidden {Scheme Procedure} string->utf32 str
address@hidden {Scheme Procedure} string->utf16 str [endianness]
address@hidden {Scheme Procedure} string->utf32 str [endianness]
 @deffnx {C Function} scm_string_to_utf8 (str)
address@hidden {C Function} scm_string_to_utf16 (str)
address@hidden {C Function} scm_string_to_utf32 (str)
address@hidden {C Function} scm_string_to_utf16 (str, endianness)
address@hidden {C Function} scm_string_to_utf32 (str, endianness)
 Return a newly allocated bytevector that contains the UTF-8, UTF-16, or
-UTF-32 (aka. UCS-4) encoding of @var{str}.
+UTF-32 (aka. UCS-4) encoding of @var{str}.  For UTF-16 and UTF-32,
address@hidden should be the symbol @code{big} or @code{little}; when omitted,
+it defaults to big endian.
 @end deffn
 
 @deffn {Scheme Procedure} utf8->string utf
address@hidden {Scheme Procedure} utf16->string utf
address@hidden {Scheme Procedure} utf32->string utf
address@hidden {Scheme Procedure} utf16->string utf [endianness]
address@hidden {Scheme Procedure} utf32->string utf [endianness]
 @deffnx {C Function} scm_utf8_to_string (utf)
address@hidden {C Function} scm_utf16_to_string (utf)
address@hidden {C Function} scm_utf32_to_string (utf)
address@hidden {C Function} scm_utf16_to_string (utf, endianness)
address@hidden {C Function} scm_utf32_to_string (utf, endianness)
 Return a newly allocated string that contains from the UTF-8-, UTF-16-,
-or UTF-32-decoded contents of bytevector @var{utf}.
+or UTF-32-decoded contents of bytevector @var{utf}.  For UTF-16 and UTF-32,
address@hidden should be the symbol @code{big} or @code{little}; when omitted,
+it defaults to big endian.
 @end deffn
 
 @node Bytevectors as Generalized Vectors
@@ -4164,6 +4466,13 @@ these APIs, bytes are accessed one at a time as 8-bit 
unsigned integers:
 @end example
 
 
address@hidden Bytevectors as Uniform Vectors
address@hidden Accessing Bytevectors with the SRFI-4 API
+
+Bytevectors may also be accessed with the SRFI-4 API. @xref{SRFI-4 and
+Bytevectors}, for more information.
+
+
 @node Regular Expressions
 @subsection Regular Expressions
 @tpindex Regular expressions
@@ -5550,7 +5859,7 @@ Equivalent to @code{scm_symbol_to_keyword 
(scm_from_locale_symbol
 @subsection ``Functionality-Centric'' Data Types
 
 Procedures and macros are documented in their own chapter: see
address@hidden and Macros}.
address@hidden and @ref{Macros}.
 
 Variable objects are documented as part of the description of Guile's
 module system: see @ref{Variables}.
diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index 916453a..0aa1bb6 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -9,9 +9,9 @@
 
 @cindex Debugging
 In order to understand Guile's debugging facilities, you first need to
-understand a little about how the evaluator works and what the Scheme
-stack is.  With that in place we explain the low level trap calls that
-the evaluator can be configured to make, and the trap and breakpoint
+understand a little about how Guile represent the Scheme control stack.
+With that in place we explain the low level trap calls that the
+evaluator can be configured to make, and the trap and breakpoint
 infrastructure that builds on top of those calls.
 
 @menu
@@ -24,41 +24,31 @@ infrastructure that builds on top of those calls.
 @node Evaluation Model
 @subsection Evaluation and the Scheme Stack
 
-The idea of the Scheme stack is central to a lot of debugging.  It
-always exists implicitly, as a result of the way that the Guile
-evaluator works, and can be summoned into concrete existence as a
-first-class Scheme value by the @code{make-stack} call, so that an
-introspective Scheme program -- such as a debugger -- can present it in
-some way and allow the user to query its details.  The first thing to
-understand, therefore, is how the workings of the evaluator build up the
-stack.
-
address@hidden Evaluations
address@hidden Applications
-Broadly speaking, the evaluator performs @dfn{evaluations} and
address@hidden  An evaluation means that it is looking at a source
-code expression like @code{(+ x 5)} or @code{(if msg (loop))}, deciding
-whether the top level of the expression is a procedure call, macro,
-builtin syntax, or whatever, and doing some appropriate processing in
-each case.  (In the examples here, @code{(+ x 5)} would normally be a
-procedure call, and @code{(if msg (loop))} builtin syntax.)  For a
-procedure call, ``appropriate processing'' includes evaluating the
-procedure's arguments, as that must happen before the procedure itself
-can be called.  An application means calling a procedure once its
-arguments have been calculated.
-
address@hidden Stack
address@hidden Frames
address@hidden Stack frames
-Typically evaluations and applications alternate with each other, and
-together they form a @dfn{stack} of operations pending completion.  This
-is because, on the one hand, evaluation of an expression like @code{(+ x
-5)} requires --- once its arguments have been calculated --- an
-application (in this case, of the procedure @code{+}) before it can
-complete and return a result, and, on the other hand, the application of
-a procedure written in Scheme involves evaluating the sequence of
-expressions that constitute that procedure's code.  Each level on this
-stack is called a @dfn{frame}.
+The idea of the Scheme stack is central to a lot of debugging.  The
+Scheme stack is a reified representation of the pending function returns
+in an expression's continuation. As Guile implements function calls
+using a stack, this reification takes the form of a number of nested
+stack frames, each of which has the procedure and its arguments, along
+with local variables and temporary values.
+
+A Scheme stack always exists implicitly, and can be summoned into
+concrete existence as a first-class Scheme value by the
address@hidden call, so that an introspective Scheme program -- such
+as a debugger -- can present it in some way and allow the user to query
+its details. The first thing to understand, therefore, is how Guile's
+function call convention creates the stack.
+
+Broadly speaking, Guile represents all control flow on a stack. Calling
+a function involves pushing an empty frame on the stack, then evaluating
+the procedure and its arguments, then fixing up the new frame so that it
+points to the old one. Frames on the stack are thus linked together. A
+tail call is the same, except it reuses the existing frame instead of
+pushing on a new one.
+
+In this way, the only frames that are on the stack are ``active''
+frames, frames which need to do some work before the computation is
+complete. On the other hand, a function that has tail-called another
+function will not be on the stack, as it has no work left to do.
 
 Therefore, when an error occurs in a running program, or the program
 hits a breakpoint, or in fact at any point that the programmer chooses,
@@ -73,7 +63,6 @@ stack and its frames.
 * Examining the Stack::
 * Examining Stack Frames::
 * Source Properties::           Remembering the source of an expression.
-* Decoding Memoized Source Expressions::
 * Starting a New Stack::
 @end menu
 
@@ -95,10 +84,10 @@ describes the Scheme stack at that point.
 Create a new stack. If @var{obj} is @code{#t}, the current
 evaluation stack is used for creating the stack frames,
 otherwise the frames are taken from @var{obj} (which must be
-either a debug object or a continuation).
+a continuation or a frame object).
 
 @var{args} should be a list containing any combination of
-integer, procedure and @code{#t} values.
+integer, procedure, prompt tag and @code{#t} values.
 
 These values specify various ways of cutting away uninteresting
 stack frames from the top and bottom of the stack that
@@ -106,28 +95,26 @@ stack frames from the top and bottom of the stack that
 @code{(@var{inner_cut_1} @var{outer_cut_1} @var{inner_cut_2}
 @var{outer_cut_2} @dots{})}.
 
-Each @var{inner_cut_N} can be @code{#t}, an integer, or a
-procedure.  @code{#t} means to cut away all frames up to but
-excluding the first user module frame.  An integer means to cut
-away exactly that number of frames.  A procedure means to cut
-away all frames up to but excluding the application frame whose
+Each @var{inner_cut_N} can be @code{#t}, an integer, a prompt
+tag, or a procedure.  @code{#t} means to cut away all frames up
+to but excluding the first user module frame.  An integer means
+to cut away exactly that number of frames.  A prompt tag means
+to cut away all frames that are inside a prompt with the given
+tag. A procedure means to cut away all frames up to but
+excluding the application frame whose procedure matches the
+specified one.
+
+Each @var{outer_cut_N} can be an integer, a prompt tag, or a
+procedure.  An integer means to cut away that number of frames.
+A prompt tag means to cut away all frames that are outside a
+prompt with the given tag. A procedure means to cut away
+frames down to but excluding the application frame whose
 procedure matches the specified one.
 
-Each @var{outer_cut_N} can be an integer or a procedure.  An
-integer means to cut away that number of frames.  A procedure
-means to cut away frames down to but excluding the application
-frame whose procedure matches the specified one.
-
 If the @var{outer_cut_N} of the last pair is missing, it is
 taken as 0.
 @end deffn
 
address@hidden {Scheme Procedure} last-stack-frame obj
address@hidden {C Function} scm_last_stack_frame (obj)
-Return the last (innermost) frame of @var{obj}, which must be
-either a debug object or a continuation.
address@hidden deffn
-
 
 @node Examining the Stack
 @subsubsection Examining the Stack
@@ -174,33 +161,12 @@ backtrace.
 Return @code{#t} if @var{obj} is a stack frame.
 @end deffn
 
address@hidden {Scheme Procedure} frame-number frame
address@hidden {C Function} scm_frame_number (frame)
-Return the frame number of @var{frame}.
address@hidden deffn
-
 @deffn {Scheme Procedure} frame-previous frame
 @deffnx {C Function} scm_frame_previous (frame)
 Return the previous frame of @var{frame}, or @code{#f} if
 @var{frame} is the first frame in its stack.
 @end deffn
 
address@hidden {Scheme Procedure} frame-next frame
address@hidden {C Function} scm_frame_next (frame)
-Return the next frame of @var{frame}, or @code{#f} if
address@hidden is the last frame in its stack.
address@hidden deffn
-
address@hidden {Scheme Procedure} frame-source frame
address@hidden {C Function} scm_frame_source (frame)
-Return the source of @var{frame}.
address@hidden deffn
-
address@hidden {Scheme Procedure} frame-procedure? frame
address@hidden {C Function} scm_frame_procedure_p (frame)
-Return @code{#t} if a procedure is associated with @var{frame}.
address@hidden deffn
-
 @deffn {Scheme Procedure} frame-procedure frame
 @deffnx {C Function} scm_frame_procedure (frame)
 Return the procedure for @var{frame}, or @code{#f} if no
@@ -212,21 +178,6 @@ procedure is associated with @var{frame}.
 Return the arguments of @var{frame}.
 @end deffn
 
address@hidden {Scheme Procedure} frame-evaluating-args? frame
address@hidden {C Function} scm_frame_evaluating_args_p (frame)
-Return @code{#t} if @var{frame} contains evaluated arguments.
address@hidden deffn
-
address@hidden {Scheme Procedure} frame-overflow? frame
address@hidden {C Function} scm_frame_overflow_p (frame)
-Return @code{#t} if @var{frame} is an overflow frame.
address@hidden deffn
-
address@hidden {Scheme Procedure} frame-real? frame
address@hidden {C Function} scm_frame_real_p (frame)
-Return @code{#t} if @var{frame} is a real frame.
address@hidden deffn
-
 @deffn {Scheme Procedure} display-application frame [port [indent]]
 @deffnx {C Function} scm_display_application (frame, port, indent)
 Display a procedure application @var{frame} to the output port
@@ -241,14 +192,12 @@ output.
 @cindex source properties
 As Guile reads in Scheme code from file or from standard input, it
 remembers the file name, line number and column number where each
-expression begins.  These pieces of information are known as the
address@hidden properties} of the expression.  If an expression undergoes
-transformation --- for example, if there is a syntax transformer in
-effect, or the expression is a macro call --- the source properties are
-copied from the untransformed to the transformed expression so that, if
-an error occurs when evaluating the transformed expression, Guile's
-debugger can point back to the file and location where the expression
-originated.
+expression begins. These pieces of information are known as the
address@hidden properties} of the expression. Syntax expanders and the
+compiler propagate these source properties to compiled procedures, so
+that, if an error occurs when evaluating the transformed expression,
+Guile's debugger can point back to the file and location where the
+expression originated.
 
 The way that source properties are stored means that Guile can only
 associate source properties with parenthesized expressions, and not, for
@@ -274,10 +223,7 @@ port>''.
 
 The recording of source properties is controlled by the read option
 named ``positions'' (@pxref{Reader options}).  This option is switched
address@hidden by default, together with the debug options ``debug'' and
-``backtrace'' (@pxref{Debugger options}), when Guile is run
-interactively; all these options are @emph{off} by default when Guile
-runs a script non-interactively.
address@hidden by default.
 
 The following procedures can be used to access and set the source
 properties of read expressions.
@@ -305,51 +251,19 @@ Return the property specified by @var{key} from 
@var{obj}'s source
 properties.
 @end deffn
 
-In practice there are only two ways that you should use the ability to
-set an expression's source properties.
+If the @code{positions} reader option is enabled, each parenthesized
+expression will have values set for the @code{filename}, @code{line} and
address@hidden properties.
 
address@hidden
address@hidden
-To set a breakpoint on an expression, use @code{(set-source-property!
address@hidden 'breakpoint #t)}.  If you do this, you should also set the
address@hidden and @code{enter-frame-handler} trap options
-(@pxref{Evaluator trap options}) and @code{breakpoints} debug option
-(@pxref{Debugger options}) appropriately, and the evaluator will then
-call your enter frame handler whenever it is about to evaluate that
-expression.
-
address@hidden
-To make a read or constructed expression appear to have come from a
-different source than what the expression's source properties already
-say, you can use @code{set-source-property!} to set the expression's
address@hidden, @code{line} and @code{column} properties.  The
-properties that you set will then show up later if that expression is
-involved in a backtrace or error report.
address@hidden itemize
-
-If you are looking for a way to attach arbitrary information to an
-expression other than these properties, you should use
address@hidden instead (@pxref{Object Properties}).  That
-will avoid bloating the source property hash table, which is really
-only intended for the debugging purposes just described.
-
-
address@hidden Decoding Memoized Source Expressions
address@hidden Decoding Memoized Source Expressions
-
address@hidden {Scheme Procedure} memoized? obj
address@hidden {C Function} scm_memoized_p (obj)
-Return @code{#t} if @var{obj} is memoized.
address@hidden deffn
+If you're stuck with defmacros (@pxref{Defmacros}), and want to preserve
+source information, the following helper function might be useful to
+you:
 
address@hidden {Scheme Procedure} unmemoize m
address@hidden {C Function} scm_unmemoize (m)
-Unmemoize the memoized expression @var{m},
address@hidden deffn
-
address@hidden {Scheme Procedure} memoized-environment m
address@hidden {C Function} scm_memoized_environment (m)
-Return the environment of the memoized expression @var{m}.
address@hidden {Scheme Procedure} cons-source xorig x y
address@hidden {C Function} scm_cons_source (xorig, x, y)
+Create and return a new pair whose car and cdr are @var{x} and @var{y}.
+Any source properties associated with @var{xorig} are also associated
+with the new pair.
 @end deffn
 
 
@@ -376,15 +290,15 @@ the error chose explicitly to provide.  This information 
originates with
 the @code{error} or @code{throw} call (or their C code equivalents, if
 the error is detected by C code) that signals the error, and is passed
 automatically to the handler procedure of the innermost applicable
address@hidden, @code{lazy-catch} or @code{with-throw-handler} expression.
address@hidden or @code{with-throw-handler} expression.
 
 @subsubsection Intercepting basic error information
 
 Therefore, to catch errors that occur within a chunk of Scheme code, and
 to intercept basic information about those errors, you need to execute
-that code inside the dynamic context of a @code{catch},
address@hidden or @code{with-throw-handler} expression, or the
-equivalent in C.  In Scheme, this means you need something like this:
+that code inside the dynamic context of a @code{catch} or
address@hidden expression, or the equivalent in C. In Scheme,
+this means you need something like this:
 
 @lisp
 (catch #t
@@ -399,13 +313,12 @@ equivalent in C.  In Scheme, this means you need 
something like this:
 @end lisp
 
 @noindent
-The @code{catch} here can also be @code{lazy-catch} or
address@hidden; see @ref{Throw Handlers} and @ref{Lazy Catch}
-for the details of how these differ from @code{catch}.  The @code{#t}
-means that the catch is applicable to all kinds of error; if you want to
-restrict your catch to just one kind of error, you can put the symbol
-for that kind of error instead of @code{#t}.  The equivalent to this in
-C would be something like this:
+The @code{catch} here can also be @code{with-throw-handler}; see @ref{Throw
+Handlers} for information on the when you might want to use
address@hidden instead of @code{catch}. The @code{#t} means that the
+catch is applicable to all kinds of error; if you want to restrict your catch 
to
+just one kind of error, you can put the symbol for that kind of error instead 
of
address@hidden The equivalent to this in C would be something like this:
 
 @lisp
 SCM my_body_proc (void *body_data)
@@ -436,9 +349,8 @@ SCM my_handler_proc (void *handler_data,
 
 @noindent
 Again, as with the Scheme version, @code{scm_c_catch} could be replaced
-by @code{scm_internal_lazy_catch} or @code{scm_c_with_throw_handler},
-and @code{SCM_BOOL_T} could instead be the symbol for a particular kind
-of error.
+by @code{scm_c_with_throw_handler}, and @code{SCM_BOOL_T} could instead
+be the symbol for a particular kind of error.
 
 @subsubsection Capturing the full error stack
 
@@ -446,19 +358,10 @@ The other interesting information about an error is the 
full Scheme
 stack at the point where the error occurred; in other words what
 innermost expression was being evaluated, what was the expression that
 called that one, and so on.  If you want to write your code so that it
-captures and can display this information as well, there are three
+captures and can display this information as well, there are a couple
 important things to understand.
 
-Firstly, the code in question must be executed using the debugging
-version of the evaluator, because information about the Scheme stack is
-only available at all from the debugging evaluator.  Using the debugging
-evaluator means that the debugger option (@pxref{Debugger options})
-called @code{debug} must be enabled; this can be done by running
address@hidden(debug-enable 'debug)} or @code{(turn-on-debugging)} at the top
-level of your program; or by running guile with the @code{--debug}
-command line option, if your program begins life as a Scheme script.
-
-Secondly, the stack at the point of the error needs to be explicitly
+Firstly, the stack at the point of the error needs to be explicitly
 captured by a @code{make-stack} call (or the C equivalent
 @code{scm_make_stack}).  The Guile library does not do this
 ``automatically'' for you, so you will need to write code with a
@@ -472,16 +375,15 @@ running on top of the Guile library, and which uses 
@code{catch} and
 @code{make-stack} in the way we are about to describe to capture the
 stack when an error occurs.)
 
-Thirdly, in order to capture the stack effectively at the point where
-the error occurred, the @code{make-stack} call must be made before Guile
-unwinds the stack back to the location of the prevailing catch
-expression.  This means that the @code{make-stack} call must be made
-within the handler of a @code{lazy-catch} or @code{with-throw-handler}
-expression, or the optional "pre-unwind" handler of a @code{catch}.
-(For the full story of how these alternatives differ from each other,
-see @ref{Exceptions}.  The main difference is that @code{catch}
-terminates the error, whereas @code{lazy-catch} and
address@hidden only intercept it temporarily and then allow
+And secondly, in order to capture the stack effectively at the point
+where the error occurred, the @code{make-stack} call must be made before
+Guile unwinds the stack back to the location of the prevailing catch
+expression. This means that the @code{make-stack} call must be made
+within the handler of a @code{with-throw-handler} expression, or the
+optional "pre-unwind" handler of a @code{catch}. (For the full story of
+how these alternatives differ from each other, see @ref{Exceptions}. The
+main difference is that @code{catch} terminates the error, whereas
address@hidden only intercepts it temporarily and then allow
 it to continue propagating up to the next innermost handler.)
 
 So, here are some examples of how to do all this in Scheme and in C.
@@ -582,11 +484,11 @@ application frame -- that is, a frame that satisfies the
 
 @subsubsection What the Guile REPL does
 
-The Guile REPL code (in @file{ice-9/boot-9.scm}) uses a @code{catch}
-with a pre-unwind handler to capture the stack when an error occurs in
-an expression that was typed into the REPL, and saves the captured stack
-in a fluid (@pxref{Fluids and Dynamic States}) called
address@hidden  You can then use the @code{(backtrace)} command,
+The Guile REPL code (in @file{system/repl/repl.scm} and related files)
+uses a @code{catch} with a pre-unwind handler to capture the stack when
+an error occurs in an expression that was typed into the REPL, and saves
+the captured stack in a fluid (@pxref{Fluids and Dynamic States}) called
address@hidden You can then use the @code{(backtrace)} command,
 which is basically equivalent to @code{(display-backtrace (fluid-ref
 the-last-stack))}, to print out this stack at any time until it is
 overwritten by the next error that occurs.
@@ -619,17 +521,16 @@ Invoke the Guile debugger to explore the context of the 
last error.
 @cindex Tracing
 @cindex Code coverage
 @cindex Profiling
-The low level C code of Guile's evaluator can be configured to call
-out at key points to arbitrary user-specified procedures.  These
-procedures, and the circumstances under which the evaluator calls
-them, are configured by the ``evaluator trap options'' interface
-(@pxref{Evaluator trap options}), and by the @code{trace} and
address@hidden fields of the ``debug options'' interface
-(@pxref{Debugger options}).  In principle this allows Scheme code to
-implement any model it chooses for examining the evaluation stack as
-program execution proceeds, and for suspending execution to be resumed
-later.  Possible applications of this feature include breakpoints,
-runtime tracing, code coverage, and profiling.
+Guile's virtual machine can be configured to call out at key points to
+arbitrary user-specified procedures. For more information on these
+hooks, and the circumstances under which the VM calls them, see @ref{VM
+Behaviour}.
+
+In principle, these hooks allow Scheme code to implement any model it
+chooses for examining the evaluation stack as program execution
+proceeds, and for suspending execution to be resumed later. Possible
+applications of this feature include breakpoints, runtime tracing, code
+coverage, and profiling.
 
 @cindex Trap classes
 @cindex Trap objects
@@ -650,6 +551,14 @@ user wanting to use traps, and the developer interested in
 understanding how the interface hangs together.
 
 
address@hidden Actually, this section is bitrotten
+
+Dear reader: the following sections have some great ideas, and some code
+that just needs a few days of massaging to get it to work with the VM
+(as opposed to the old interpreter). Want to help? Yes? Yes!
address@hidden@@gnu.org}, that's where.
+
+
 @subsubsection A Quick Note on Terminology
 
 @cindex Trap terminology
@@ -1886,19 +1795,6 @@ hi!
 guile> 
 @end lisp
 
address@hidden
address@hidden Memoization
-(For anyone wondering why the first @code{(do-main 4)} call above
-generates lots more trace lines than the subsequent calls: these
-examples also demonstrate how the Guile evaluator ``memoizes'' code.
-When Guile evaluates a source code expression for the first time, it
-changes some parts of the expression so that they will be quicker to
-evaluate when that expression is evaluated again; this is called
-memoization.  The trace output from the first @code{(do-main 4)} call
-shows memoization steps, such as an internal define being transformed to
-a letrec.)
-
-
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi
index 457015e..21eee68 100644
--- a/doc/ref/api-evaluation.texi
+++ b/doc/ref/api-evaluation.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -291,7 +291,9 @@ Install the procedure @var{proc} for reading expressions
 starting with the character sequence @code{#} and @var{chr}.
 @var{proc} will be called with two arguments:  the character
 @var{chr} and the port to read further data from. The object
-returned will be the return value of @code{read}.
+returned will be the return value of @code{read}. 
+Passing @code{#f} for @var{proc} will remove a previous setting. 
+
 @end deffn
 
 
@@ -457,8 +459,7 @@ Note that well-written Scheme programs will not typically 
call the
 procedures in this section, for the same reason that it is often bad
 taste to use @code{eval}. The normal interface to the compiler is the
 command-line file compiler, which can be invoked from the shell as
address@hidden compile @var{foo.scm}}. This interface needs more
-documentation.
address@hidden compile foo.scm}.
 
 (Why are calls to @code{eval} and @code{compile} usually in bad taste?
 Because they are limited, in that they can only really make sense for
@@ -471,6 +472,49 @@ For more information on the compiler itself, see 
@ref{Compiling to the
 Virtual Machine}. For information on the virtual machine, see @ref{A
 Virtual Machine for Guile}.
 
+The command-line interface to Guile's compiler is the @command{guile-tools
+compile} command:
+
address@hidden {Command} {guile-tools compile} address@hidden @var{file}...
+Compile @var{file}, a source file, and store bytecode in the compilation cache
+or in the file specified by the @option{-o} option.  The following options are
+available:
+
address@hidden @option
+
address@hidden -L @var{dir}
address@hidden address@hidden
+Add @var{dir} to the front of the module load path.
+
address@hidden -o @var{ofile}
address@hidden address@hidden
+Write output bytecode to @var{ofile}.  By convention, bytecode file names end
+in @code{.go}.
+
address@hidden -W @var{warning}
address@hidden address@hidden
+Emit warnings of type @var{warning}; use @code{--warn=help} for a list of
+available warnings.  Currently recognized warnings include
address@hidden, @code{unused-toplevel}, @code{unbound-variable}, and
address@hidden
+
address@hidden -f @var{lang}
address@hidden address@hidden
+Use @var{lang} as the source language of @var{file}.  If this option is 
omitted,
address@hidden is assumed.
+
address@hidden -t @var{lang}
address@hidden address@hidden
+Use @var{lang} as the target language of @var{file}.  If this option is 
omitted,
address@hidden is assumed.
+
address@hidden table
+
address@hidden deffn
+
+The compiler can also be invoked directly by Scheme code using the procedures
+below:
+
 @deffn {Scheme Procedure} compile exp [env=#f] [from=(current-language)] 
[to=value] [opts=()]
 Compile the expression @var{exp} in the environment @var{env}. If
 @var{exp} is a procedure, the result will be a compiled procedure;
@@ -856,6 +900,15 @@ Accessors to a virtual machine's hooks. Usually you pass
 @code{(the-vm)} as the @var{vm}.
 @end deffn
 
address@hidden {Scheme Procedure} vm-trace-level vm
+Retrieve the ``trace level'' of the VM. If positive, the trace hooks associated
+with @var{vm} will be run. The initial trace level is 0.
address@hidden deffn
+
address@hidden {Scheme Procedure} set-vm-trace-level! vm level
+Set the ``trace level'' of the VM.
address@hidden deffn
+
 @xref{A Virtual Machine for Guile}, for more information on Guile's
 virtual machine.
 
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
new file mode 100644
index 0000000..2a4f0df
--- /dev/null
+++ b/doc/ref/api-foreign.texi
@@ -0,0 +1,831 @@
address@hidden -*-texinfo-*-
address@hidden This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2008, 2009, 2010
address@hidden   Free Software Foundation, Inc.
address@hidden See the file guile.texi for copying conditions.
+
address@hidden
address@hidden Foreign Function Interface
address@hidden Foreign Function Interface
address@hidden foreign function interface
address@hidden ffi
+
+The more one hacks in Scheme, the more one realizes that there are
+actually two computational worlds: one which is warm and alive, that
+land of parentheses, and one cold and dead, the land of C and its ilk.
+
+But yet we as programmers live in both worlds, and Guile itself is half
+implemented in C. So it is that Guile's living half pays respect to its
+dead counterpart, via a spectrum of interfaces to C ranging from dynamic
+loading of Scheme primitives to dynamic binding of stock C library
+prodedures.
+
address@hidden
+* Foreign Libraries::           Dynamically linking to libraries.
+* Foreign Functions::           Simple calls to C procedures.
+* C Extensions::                Extending Guile in C with loadable modules.
+* Modules and Extensions::      Loading C extensions into modules.
+* Foreign Pointers::            Accessing global variables.
+* Dynamic FFI::                 Calling arbitrary C functions.
address@hidden menu
+
+
address@hidden Foreign Libraries
address@hidden Foreign Libraries
+
+Most modern Unices have something called @dfn{shared libraries}.  This
+ordinarily means that they have the capability to share the executable
+image of a library between several running programs to save memory and
+disk space.  But generally, shared libraries give a lot of additional
+flexibility compared to the traditional static libraries.  In fact,
+calling them `dynamic' libraries is as correct as calling them `shared'.
+
+Shared libraries really give you a lot of flexibility in addition to the
+memory and disk space savings.  When you link a program against a shared
+library, that library is not closely incorporated into the final
+executable.  Instead, the executable of your program only contains
+enough information to find the needed shared libraries when the program
+is actually run.  Only then, when the program is starting, is the final
+step of the linking process performed.  This means that you need not
+recompile all programs when you install a new, only slightly modified
+version of a shared library.  The programs will pick up the changes
+automatically the next time they are run.
+
+Now, when all the necessary machinery is there to perform part of the
+linking at run-time, why not take the next step and allow the programmer
+to explicitly take advantage of it from within his program?  Of course,
+many operating systems that support shared libraries do just that, and
+chances are that Guile will allow you to access this feature from within
+your Scheme programs.  As you might have guessed already, this feature
+is called @dfn{dynamic address@hidden people also refer to the
+final linking stage at program startup as `dynamic linking', so if you
+want to make yourself perfectly clear, it is probably best to use the
+more technical term @dfn{dlopening}, as suggested by Gordon Matzigkeit
+in his libtool documentation.}
+
+We titled this section ``foreign libraries'' because although the name
+``foreign'' doesn't leak into the API, the world of C really is foreign
+to Scheme -- and that estrangement extends to components of foreign
+libraries as well, as we see in future sections.
+
address@hidden {Scheme Procedure} dynamic-link [library]
address@hidden {C Function} scm_dynamic_link (library)
+Find the shared library denoted by @var{library} (a string) and link it
+into the running Guile application.  When everything works out, return a
+Scheme object suitable for representing the linked object file.
+Otherwise an error is thrown.  How object files are searched is system
+dependent.
+
+Normally, @var{library} is just the name of some shared library file
+that will be searched for in the places where shared libraries usually
+reside, such as in @file{/usr/lib} and @file{/usr/local/lib}.
+
+When @var{library} is omitted, a @dfn{global symbol handle} is returned.  This
+handle provides access to the symbols available to the program at run-time,
+including those exported by the program itself and the shared libraries already
+loaded.
address@hidden deffn
+
address@hidden {Scheme Procedure} dynamic-object? obj
address@hidden {C Function} scm_dynamic_object_p (obj)
+Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f}
+otherwise.
address@hidden deffn
+
address@hidden {Scheme Procedure} dynamic-unlink dobj
address@hidden {C Function} scm_dynamic_unlink (dobj)
+Unlink the indicated object file from the application.  The
+argument @var{dobj} must have been obtained by a call to
address@hidden  After @code{dynamic-unlink} has been
+called on @var{dobj}, its content is no longer accessible.
address@hidden deffn
+
address@hidden
+(define libgl-obj (dynamic-link "libGL"))
+libgl-obj
address@hidden #<dynamic-object "libGL">
+(dynamic-unlink libGL-obj)
+libGL-obj
address@hidden #<dynamic-object "libGL" (unlinked)>
address@hidden smallexample
+
+As you can see, after calling @code{dynamic-unlink} on a dynamically
+linked library, it is marked as @samp{(unlinked)} and you are no longer
+able to use it with @code{dynamic-call}, etc.  Whether the library is
+really removed from you program is system-dependent and will generally
+not happen when some other parts of your program still use it.
+
+When dynamic linking is disabled or not supported on your system,
+the above functions throw errors, but they are still available.
+
+
address@hidden Foreign Functions
address@hidden Foreign Functions
+
+The most natural thing to do with a dynamic library is to grovel around
+in it for a function pointer: a @dfn{foreign function}.
address@hidden exists for that purpose.
+
address@hidden {Scheme Procedure} dynamic-func name dobj
address@hidden {C Function} scm_dynamic_func (name, dobj)
+Return a ``handle'' for the func @var{name} in the shared object referred to
+by @var{dobj}. The handle can be passed to @code{dynamic-call} to
+actually call the function.
+
+Regardless whether your C compiler prepends an underscore @samp{_} to the 
global
+names in a program, you should @strong{not} include this underscore in
address@hidden since it will be added automatically when necessary.
address@hidden deffn
+
+Guile has static support for calling functions with no arguments,
address@hidden
+
address@hidden {Scheme Procedure} dynamic-call func dobj
address@hidden {C Function} scm_dynamic_call (func, dobj)
+Call the C function indicated by @var{func} and @var{dobj}.
+The function is passed no arguments and its return value is
+ignored.  When @var{function} is something returned by
address@hidden, call that function and ignore @var{dobj}.
+When @var{func} is a string , look it up in @var{dynobj}; this
+is equivalent to
address@hidden
+(dynamic-call (dynamic-func @var{func} @var{dobj}) #f)
address@hidden smallexample
+
+Interrupts are deferred while the C function is executing (with
address@hidden/@code{SCM_ALLOW_INTS}).
address@hidden deffn
+
address@hidden is not very powerful. It is mostly intended to be
+used for calling specially written initialization functions that will
+then add new primitives to Guile. For example, we do not expect that you
+will dynamically link @file{libX11} with @code{dynamic-link} and then
+construct a beautiful graphical user interface just by using
address@hidden Instead, the usual way would be to write a special
+Guile-to-X11 glue library that has intimate knowledge about both Guile
+and X11 and does whatever is necessary to make them inter-operate
+smoothly. This glue library could then be dynamically linked into a
+vanilla Guile interpreter and activated by calling its initialization
+function. That function would add all the new types and primitives to
+the Guile interpreter that it has to offer.
+
+(There is actually another, better option: simply to create a
address@hidden wrapper in Scheme via the dynamic FFI. @xref{Dynamic FFI},
+for more information.)
+
+Given some set of C extensions to Guile, the next logical step is to
+integrate these glue libraries into the module system of Guile so that
+you can load new primitives into a running system just as you can load
+new Scheme code.
+
address@hidden {Scheme Procedure} load-extension lib init
address@hidden {C Function} scm_load_extension (lib, init)
+Load and initialize the extension designated by LIB and INIT.
+When there is no pre-registered function for LIB/INIT, this is
+equivalent to
+
address@hidden
+(dynamic-call INIT (dynamic-link LIB))
address@hidden lisp
+
+When there is a pre-registered function, that function is called
+instead.
+
+Normally, there is no pre-registered function.  This option exists
+only for situations where dynamic linking is unavailable or unwanted.
+In that case, you would statically link your program with the desired
+library, and register its init function right after Guile has been
+initialized.
+
+LIB should be a string denoting a shared library without any file type
+suffix such as ".so".  The suffix is provided automatically.  It
+should also not contain any directory components.  Libraries that
+implement Guile Extensions should be put into the normal locations for
+shared libraries.  We recommend to use the naming convention
+libguile-bla-blum for a extension related to a module `(bla blum)'.
+
+The normal way for a extension to be used is to write a small Scheme
+file that defines a module, and to load the extension into this
+module.  When the module is auto-loaded, the extension is loaded as
+well.  For example,
+
address@hidden
+(define-module (bla blum))
+
+(load-extension "libguile-bla-blum" "bla_init_blum")
address@hidden lisp
address@hidden deffn
+
address@hidden C Extensions
address@hidden C Extensions
+
+The most interesting application of dynamically linked libraries is
+probably to use them for providing @emph{compiled code modules} to
+Scheme programs.  As much fun as programming in Scheme is, every now and
+then comes the need to write some low-level C stuff to make Scheme even
+more fun.
+
+Not only can you put these new primitives into their own module (see the
+previous section), you can even put them into a shared library that is
+only then linked to your running Guile image when it is actually
+needed.
+
+An example will hopefully make everything clear.  Suppose we want to
+make the Bessel functions of the C library available to Scheme in the
+module @samp{(math bessel)}.  First we need to write the appropriate
+glue code to convert the arguments and return values of the functions
+from Scheme to C and back.  Additionally, we need a function that will
+add them to the set of Guile primitives.  Because this is just an
+example, we will only implement this for the @code{j0} function.
+
address@hidden
+#include <math.h>
+#include <libguile.h>
+
+SCM
+j0_wrapper (SCM x)
address@hidden
+  return scm_from_double (j0 (scm_to_double (x, "j0")));
address@hidden
+
+void
+init_math_bessel ()
address@hidden
+  scm_c_define_gsubr ("j0", 1, 0, 0, j0_wrapper);
address@hidden
address@hidden smallexample
+
+We can already try to bring this into action by manually calling the low
+level functions for performing dynamic linking.  The C source file needs
+to be compiled into a shared library.  Here is how to do it on
+GNU/Linux, please refer to the @code{libtool} documentation for how to
+create dynamically linkable libraries portably.
+
address@hidden
+gcc -shared -o libbessel.so -fPIC bessel.c
address@hidden smallexample
+
+Now fire up Guile:
+
address@hidden
+(define bessel-lib (dynamic-link "./libbessel.so"))
+(dynamic-call "init_math_bessel" bessel-lib)
+(j0 2)
address@hidden 0.223890779141236
address@hidden lisp
+
+The filename @file{./libbessel.so} should be pointing to the shared
+library produced with the @code{gcc} command above, of course.  The
+second line of the Guile interaction will call the
address@hidden function which in turn will register the C
+function @code{j0_wrapper} with the Guile interpreter under the name
address@hidden  This function becomes immediately available and we can call
+it from Scheme.
+
+Fun, isn't it?  But we are only half way there.  This is what
address@hidden has to say about @code{j0}:
+
address@hidden
+(apropos "j0")
address@hidden (guile-user): j0     #<primitive-procedure j0>
address@hidden smallexample
+
+As you can see, @code{j0} is contained in the root module, where all
+the other Guile primitives like @code{display}, etc live.  In general,
+a primitive is put into whatever module is the @dfn{current module} at
+the time @code{scm_c_define_gsubr} is called.
+
+A compiled module should have a specially named @dfn{module init
+function}.  Guile knows about this special name and will call that
+function automatically after having linked in the shared library.  For
+our example, we replace @code{init_math_bessel} with the following code in
address@hidden:
+
address@hidden
+void
+init_math_bessel (void *unused)
address@hidden
+  scm_c_define_gsubr ("j0", 1, 0, 0, j0_wrapper);
+  scm_c_export ("j0", NULL);
address@hidden
+
+void
+scm_init_math_bessel_module ()
address@hidden
+  scm_c_define_module ("math bessel", init_math_bessel, NULL);   
address@hidden
address@hidden smallexample
+
+The general pattern for the name of a module init function is:
address@hidden, followed by the name of the module where the
+individual hierarchical components are concatenated with underscores,
+followed by @samp{_module}.
+
+After @file{libbessel.so} has been rebuilt, we need to place the shared
+library into the right place.
+
+Once the module has been correctly installed, it should be possible to
+use it like this:
+
address@hidden
+guile> (load-extension "./libbessel.so" "scm_init_math_bessel_module")
+guile> (use-modules (math bessel))
+guile> (j0 2)
+0.223890779141236
+guile> (apropos "j0")
address@hidden (math bessel): j0      #<primitive-procedure j0>
address@hidden smallexample
+
+That's it!
+
+
address@hidden Modules and Extensions
address@hidden Modules and Extensions
+
+The new primitives that you add to Guile with @code{scm_c_define_gsubr}
+(@pxref{Primitive Procedures}) or with any of the other mechanisms are
+placed into the module that is current when the
address@hidden is executed. Extensions loaded from the REPL,
+for example, will be placed into the @code{(guile-user)} module, if the
+REPL module was not changed.
+
+To define C primitives within a specific module, the simplest way is:
+
address@hidden
+(define-module (foo bar))
+(load-extension "foobar-c-code" "foo_bar_init")
address@hidden example
+
+When loaded with @code{(use-modules (foo bar))}, the
address@hidden call looks for the @file{foobar-c-code.so} (etc)
+object file in the standard system locations, such as @file{/usr/lib}
+or @file{/usr/local/lib}.
+
+If someone installs your module to a non-standard location then the
+object file won't be found.  You can address this by inserting the
+install location in the @file{foo/bar.scm} file.  This is convenient
+for the user and also guarantees the intended object is read, even if
+stray older or newer versions are in the loader's path.
+
+The usual way to specify an install location is with a @code{prefix}
+at the configure stage, for instance @samp{./configure prefix=/opt}
+results in library files as say @file{/opt/lib/foobar-c-code.so}.
+When using Autoconf (@pxref{Top, , Introduction, autoconf, The GNU
+Autoconf Manual}), the library location is in a @code{libdir}
+variable.  Its value is intended to be expanded by @command{make}, and
+can by substituted into a source file like @file{foo.scm.in}
+
address@hidden
+(define-module (foo bar))
+(load-extension "XXlibdirXX/foobar-c-code" "foo_bar_init")
address@hidden example
+
address@hidden
+with the following in a @file{Makefile}, using @command{sed}
+(@pxref{Top, , Introduction, sed, SED, A Stream Editor}),
+
address@hidden
+foo.scm: foo.scm.in
+        sed 's|XXlibdirXX|$(libdir)|' <foo.scm.in >foo.scm
address@hidden example
+
+The actual pattern @code{XXlibdirXX} is arbitrary, it's only something
+which doesn't otherwise occur.  If several modules need the value, it
+can be easier to create one @file{foo/config.scm} with a define of the
address@hidden location, and use that as required.
+
address@hidden
+(define-module (foo config))
+(define-public foo-config-libdir "XXlibdirXX"")
address@hidden example
+
+Such a file might have other locations too, for instance a data
+directory for auxiliary files, or @code{localedir} if the module has
+its own @code{gettext} message catalogue
+(@pxref{Internationalization}).
+
+When installing multiple C code objects, it can be convenient to put
+them in a subdirectory of @code{libdir}, thus giving for example
address@hidden/usr/lib/foo/some-obj.so}.  If the objects are only meant to be
+used through the module, then a subdirectory keeps them out of sight.
+
+It will be noted all of the above requires that the Scheme code to be
+found in @code{%load-path} (@pxref{Build Config}).  Presently it's
+left up to the system administrator or each user to augment that path
+when installing Guile modules in non-default locations.  But having
+reached the Scheme code, that code should take care of hitting any of
+its own private files etc.
+
+Presently there's no convention for having a Guile version number in
+module C code filenames or directories.  This is primarily because
+there's no established principles for two versions of Guile to be
+installed under the same prefix (eg. two both under @file{/usr}).
+Assuming upward compatibility is maintained then this should be
+unnecessary, and if compatibility is not maintained then it's highly
+likely a package will need to be revisited anyway.
+
+The present suggestion is that modules should assume when they're
+installed under a particular @code{prefix} that there's a single
+version of Guile there, and the @code{guile-config} at build time has
+the necessary information about it.  C code or Scheme code might adapt
+itself accordingly (allowing for features not available in an older
+version for instance).
+
+
address@hidden Foreign Pointers
address@hidden Foreign Pointers
+
+The previous sections have shown how Guile can be extended at runtime by
+loading compiled C extensions. This approach is all well and good, but
+wouldn't it be nice if we didn't have to write any C at all? This
+section takes up the problem of accessing C values from Scheme, and the
+next discusses C functions.
+
address@hidden
+* Foreign Types::                  Expressing C types in Scheme.
+* Foreign Variables::              Typed pointers.
+* Void Pointers and Byte Access::  Pointers into the ether.
+* Foreign Structs::                Packing and unpacking structs.
address@hidden menu
+
address@hidden Foreign Types
address@hidden Foreign Types
+
+The first impedance mismatch that one sees between C and Scheme is that
+in C, the storage locations (variables) are typed, but in Scheme types
+are associated with values, not variables. @xref{Values and Variables}.
+
+So when accessing a C value through a Scheme pointer, we must give the
+type of the pointed-to value explicitly, as a parameter to any Scheme
+procedure that accesses the value.
+
+These ``C type values'' may be constructed using the constants and
+procedures from the @code{(system foreign)} module, which may be loaded
+like this:
+
address@hidden
+(use-modules (system foreign))
address@hidden example
+
address@hidden(system foreign)} exports a number of values expressing the basic
+C types:
+
address@hidden {Scheme Variable} int8
address@hidden {Scheme Variable} uint8
address@hidden {Scheme Variable} uint16
address@hidden {Scheme Variable} int16
address@hidden {Scheme Variable} uint32
address@hidden {Scheme Variable} int32
address@hidden {Scheme Variable} uint64
address@hidden {Scheme Variable} int64
address@hidden {Scheme Variable} float
address@hidden {Scheme Variable} double
+Values exported by the @code{(system foreign)} module, representing C
+numeric types of the specified sizes and signednesses.
address@hidden defvr
+
+In addition there are some convenience bindings for indicating types of
+platform-dependent size:
+
address@hidden {Scheme Variable} int
address@hidden {Scheme Variable} unsigned-int
address@hidden {Scheme Variable} long
address@hidden {Scheme Variable} unsigned-long
address@hidden {Scheme Variable} size_t
+Values exported by the @code{(system foreign)} module, representing C
+numeric types. For example, @code{long} may be @code{equal?} to
address@hidden on a 64-bit platform.
address@hidden defvr
+
address@hidden Foreign Variables
address@hidden Foreign Variables
+
+Given the types defined in the previous section, C pointers may be
+looked up dynamically using @code{dynamic-pointer}.
+
address@hidden {Scheme Procedure} dynamic-pointer name type dobj [len]
address@hidden {C Function} scm_dynamic_pointer (name, type, dobj, len)
+Return a ``handle'' for the pointer @var{name} in the shared object referred to
+by @var{dobj}. The handle aliases a C value, and is declared to be of type
address@hidden Valid types are defined in the @code{(system foreign)} module.
+
+This facility works by asking the dynamic linker for the address of a symbol,
+then assuming that it aliases a value of a given type. Obviously, the user must
+be very careful to ensure that the value actually is of the declared type, or
+bad things will happen.
+
+Regardless whether your C compiler prepends an underscore @samp{_} to the 
global
+names in a program, you should @strong{not} include this underscore in
address@hidden since it will be added automatically when necessary.
address@hidden deffn
+
+For example, currently Guile has a variable, @code{scm_numptob}, as part
+of its API. It is declared as a C @code{long}. So, to create a handle
+pointing to that foreign value, we do:
+
address@hidden
+(use-modules (system foreign))
+(define numptob (dynamic-pointer "scm_numptob" long (dynamic-link)))
+numptob
address@hidden #<foreign int32 8>
address@hidden example
+
+A value returned by @code{dynamic-pointer} is a Scheme wrapper for a C
+pointer, with additional type information. A foreign pointer prints
+according to its type. This example showed that a @code{long} on this
+platform is an @code{int32}, and that the value pointed to by
address@hidden is 8.
+
+Typed pointers may be referenced using the @code{foreign-ref} and
address@hidden functions.
+
address@hidden {Scheme Procedure} foreign-ref foreign
address@hidden {C Function} scm_foreign_ref foreign
+Reference the foreign value pointed to by @var{foreign}.
+
+The value will be referenced according to its type.
+
address@hidden
+(foreign-ref numptob) @result{} 8 ; YMMV
address@hidden example
address@hidden deffn
+
address@hidden {Scheme Procedure} foreign-set! foreign val
address@hidden {C Function} scm_foreign_set_x foreign val
+Set the foreign value pointed to by @var{foreign}.
+
+The value will be set according to its type.
+
address@hidden
+(foreign-set! numptob 120) ; Don't try this at home!
address@hidden example
address@hidden deffn
+
+If we wanted to corrupt Guile's internal state, we could set
address@hidden to another value; but we shouldn't, because that
+variable is not meant to be set. Indeed this point applies more widely:
+the C API is a dangerous place to be. Not only might setting a value
+crash your program, simply referencing a value with a wrong-sized type
+can prove equally disastrous.
+
+
address@hidden Void Pointers and Byte Access
address@hidden Void Pointers and Byte Access
+
+As a special case, a dynamic pointer may be declared to point to type
address@hidden, in which case it is treated as a void pointer. A void
+pointer prints its value as a pointer, without dereferencing the
+pointer.
+
+It's important at this point to conceptually separate foreign values
+from foreign pointers. @code{dynamic-pointer} gives you a foreign
+pointer. A foreign value is the semantic meaning of the bytes pointed to
+by a pointer. Only foreign pointers may be wrapped in Scheme. One may
+make a pointer to a foreign value, and wrap that as a Scheme object, but
+a bare foreign value may not be wrapped.
+
+When you call @code{dynamic-pointer}, the @var{type} argument indicates
+the type to which the given symbol points, but sometimes you don't know
+that type. Sometimes you have a pointer, and you don't know what kind of
+object it references. It's simply a pointer out into the ether, into the
address@hidden
+
+Guile can wrap such a pointer, by declaring that it points to
address@hidden
+
address@hidden {Scheme Variable} void
+A foreign type value representing nothing.
+
address@hidden has two uses: for a foreign pointer, declaring it to be of
+type @code{void} is like having a @code{void*} in C. For a function, a
+return type of @code{void} indicates that the function returns no
+values. A function argument type of @code{void} is invalid.
address@hidden defvr
+
+As an example, @code{(dynamic-pointer "foo" void bar-lib)} links in the
address@hidden symbol in the @var{bar-lib} library as a pointer to
address@hidden: a @code{void*}.
+
+Void pointers may be accessed as bytevectors.
+
address@hidden {Scheme Procedure} foreign->bytevector foreign [uvec_type 
[offset [len]]]
address@hidden {C Function} scm_foreign_to_bytevector foreign uvec_type offset 
len
+Return a bytevector aliasing the memory pointed to by
address@hidden
+
address@hidden must be a void pointer, a foreign whose type is
address@hidden By default, the resulting bytevector will alias
+all of the memory pointed to by @var{foreign}, from beginning
+to end, treated as a @code{vu8} array.
+
+The user may specify an alternate default interpretation for
+the memory by passing the @var{uvec_type} argument, to indicate
+that the memory is an array of elements of that type.
address@hidden should be something that
address@hidden would return, like @code{f32}
+or @code{s16}.
+
+Users may also specify that the bytevector should only alias a
+subset of the memory, by specifying @var{offset} and @var{len}
+arguments.
+
+Mutating the returned bytevector mutates the memory pointed to by
address@hidden, so buckle your seatbelts.
address@hidden deffn
+
address@hidden {Scheme Procedure} bytevector->foreign bv [offset [len]]
address@hidden {C Function} scm_bytevector_to_foreign bv offset len
+Return a foreign pointer aliasing the memory pointed to by
address@hidden
+
+The resulting foreign will be a void pointer, a foreign whose
+type is @code{void}. By default it will alias all of the
+memory pointed to by @var{bv}, from beginning to end.
+
+Users may explicily specify that the foreign should only alias a
+subset of the memory, by specifying @var{offset} and @var{len}
+arguments.
address@hidden deffn
+
+
address@hidden Foreign Structs
address@hidden Foreign Structs
+
+Finally, one last note on foreign values before moving on to actually
+calling foreign functions. Sometimes you need to deal with C structs,
+which requires interpreting each element of the struct according to the
+its type, offset, and alignment. Guile has some primitives to support
+this.
+
address@hidden {Scheme Procedure} sizeof type
address@hidden {C Function} scm_sizeof type
+Return the size of @var{type}, in bytes.
+
address@hidden should be a valid C type, like @code{int}.
+Alternately @var{type} may be the symbol @code{*}, in which
+case the size of a pointer is returned. @var{type} may
+also be a list of types, in which case the size of a
address@hidden with ABI-conventional packing is returned.
address@hidden deffn
+
address@hidden {Scheme Procedure} alignof type
address@hidden {C Function} scm_alignof type
+Return the alignment of @var{type}, in bytes.
+
address@hidden should be a valid C type, like @code{int}.
+Alternately @var{type} may be the symbol @code{*}, in which
+case the alignment of a pointer is returned. @var{type} may
+also be a list of types, in which case the alignment of a
address@hidden with ABI-conventional packing is returned.
address@hidden deffn
+
+Guile also provides some convenience methods to pack and unpack foreign
+pointers wrapping C structs.
+
address@hidden {Scheme Procedure} make-c-struct types vals
+Create a foreign pointer to a C struct containing @var{vals} with types
address@hidden
+
address@hidden and @code{types} should be lists of the same length.
address@hidden deffn
+
address@hidden {Scheme Procedure} parse-c-struct foreign types
+Parse a foreign pointer to a C struct, returning a list of values.
+
address@hidden should be a list of C types.
address@hidden deffn
+
+For example, to create and parse the equivalent of a @code{struct @{
+int64_t a; uint8_t b; @}}:
+
address@hidden
+(parse-c-struct (make-c-struct (list int64 uint8)
+                               (list 300 43))
+                (list int64 uint8))
address@hidden (300 43)
address@hidden example
+
+As yet, Guile only has convenience routines to support
+conventionally-packed structs. But given the @code{bytevector->foreign}
+and @code{foreign->bytevector} routines, one can create and parse
+tightly packed structs and unions by hand. See the code for
address@hidden(system foreign)} for details.
+
+
address@hidden Dynamic FFI
address@hidden Dynamic FFI
+
+Of course, the land of C is not all nouns and no verbs: there are
+functions too, and Guile allows you to call them.
+
address@hidden {Scheme Procedure} make-foreign-function return_type func_ptr 
arg_types
address@hidden {C Procedure} scm_make_foreign_function return_type func_ptr 
arg_types
+Make a foreign function.
+
+Given the foreign void pointer @var{func_ptr}, its argument and
+return types @var{arg_types} and @var{return_type}, return a
+procedure that will pass arguments to the foreign function
+and return appropriate values.
+
address@hidden should be a list of foreign types.
address@hidden should be a foreign type. @xref{Foreign Types}, for
+more information on foreign types.
address@hidden deffn
+
+Here is a better definition of @code{(math bessel)}:
+
address@hidden
+(define-module (math bessel)
+  #:use-module (system foreign)
+  #:export (j0))
+
+(define libm (dynamic-link "libm"))
+
+(define j0
+  (make-foreign-function double
+                         (dynamic-func "j0" libm)
+                         (list double)))
address@hidden example
+
+That's it! No C at all.
+
+Numeric arguments and return values from foreign functions are
+represented as Scheme values. For example, @code{j0} in the above
+example takes a Scheme number as its argument, and returns a Scheme
+number.
+
+Pointers may be passed to and returned from foreign functions as well.
+In that case the type of the argument or return value should be the
+symbol @code{*}, indicating a pointer. For example, the following
+code makes @code{memcpy} available to Scheme:
+
address@hidden
+(define memcpy
+  (let ((this (dynamic-link)))
+    (make-foreign-function '*
+                           (dynamic-func "memcpy" this)
+                           (list '* '* size_t))))
address@hidden example
+
+To invoke @code{memcpy}, one must pass it foreign pointers:
+
address@hidden
+(use-modules (rnrs bytevector))
+
+(define src
+  (bytevector->foreign (u8-list->bytevector '(0 1 2 3 4 5 6 7))))
+(define dest
+  (bytevector->foreign (make-bytevector 16 0)))
+
+(memcpy dest src (bytevector-length (foreign->bytevector src)))))
+
+(bytevector->u8-list (foreign->bytevector dest))
address@hidden (0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0)
address@hidden example
+
+One may also pass structs as values, passing structs as foreign
+pointers. @xref{Foreign Structs}, for more information on how to express
+struct types and struct values.
+
+``Out'' arguments are passed as foreign pointers. The memory pointed to
+by the foreign pointer is mutated in place.
+
address@hidden
+;; struct timeval @{
+;;      time_t      tv_sec;     /* seconds */
+;;      suseconds_t tv_usec;    /* microseconds */
+;; @};
+;; assuming fields are of type "long"
+
+(define gettimeofday
+  (let ((f (make-foreign-function
+            int
+            (dynamic-func "gettimeofday" (dynamic-link))
+            (list '* '*)))
+        (tv-type (list long long)))
+    (lambda ()
+      (let* ((timeval (make-c-struct tv-type (list 0 0)))
+             (ret (f timeval %null-pointer)))
+        (if (zero? ret)
+            (apply values (parse-c-struct timeval tv-type))
+            (error "gettimeofday returned an error" ret))))))
+
+(gettimeofday)    
address@hidden 1270587589
address@hidden 499553
address@hidden example
+
+This example also shows use of @code{%null-pointer}, which is a null
+foreign pointer, exported by @code{(system foreign)}.
+
address@hidden {Scheme Variable} %null-pointer
+A foreign pointer whose value is 0.
address@hidden defvr
+
+As you can see, this interface to foreign functions is at a very low,
+somewhat dangerous level. A contribution to Guile in the form of a
+high-level FFI would be most welcome.
+
address@hidden Local Variables:
address@hidden TeX-master: "guile.texi"
address@hidden End:
diff --git a/doc/ref/api-i18n.texi b/doc/ref/api-i18n.texi
index fba8f32..e98db12 100644
--- a/doc/ref/api-i18n.texi
+++ b/doc/ref/api-i18n.texi
@@ -196,6 +196,12 @@ Return the uppercase character that corresponds to 
@var{chr} according
 to either @var{locale} or the current locale.
 @end deffn
 
address@hidden {Scheme Procedure} char-locale-titlecase chr [locale]
address@hidden {C Function} scm_char_locale_titlecase (chr, locale)
+Return the titlecase character that corresponds to @var{chr} according
+to either @var{locale} or the current locale.
address@hidden deffn
+
 @deffn {Scheme Procedure} string-locale-upcase str [locale]
 @deffnx {C Function} scm_string_locale_upcase (str, locale)
 Return a new string that is the uppercase version of @var{str}
@@ -208,6 +214,12 @@ Return a new string that is the down-case version of 
@var{str}
 according to either @var{locale} or the current locale.
 @end deffn
 
address@hidden {Scheme Procedure} string-locale-titlecase str [locale]
address@hidden {C Function} scm_string_locale_titlecase (str, locale)
+Return a new string that is the titlecase version of @var{str}
+according to either @var{locale} or the current locale.
address@hidden deffn
+
 Note that in the current implementation Guile has no notion of
 multibyte characters and in a multibyte locale characters may not be
 converted correctly.
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index a483f19..f09ecfb 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -75,6 +75,12 @@ how characters and strings written to the port are converted 
to bytes.
 When ports are created, they inherit their character encoding from the
 current locale, but, that can be modified after the port is created.
 
+Currently, the ports only work with @emph{non-modal} encodings.  Most
+encodings are non-modal, meaning that the conversion of bytes to a
+string doesn't depend on its context: the same byte sequence will always
+return the same string.  A couple of modal encodings are in common use,
+like ISO-2022-JP and ISO-2022-KR, and they are not yet supported.
+
 Each port also has an associated conversion strategy: what to do when
 a Guile character can't be converted to the port's encoded character
 representation for output. There are three possible strategies: to
@@ -971,6 +977,28 @@ away from its default.
 Calls the one-argument procedure @var{proc} with a newly created output
 port.  When the function returns, the string composed of the characters
 written into the port is returned.  @var{proc} should not close the port.
+
+Note that which characters can be written to a string port depend on the port's
+encoding.  The default encoding of string ports is specified by the
address@hidden fluid (@pxref{Ports,
address@hidden).  For instance, it is an error to write Greek
+letter alpha to an ISO-8859-1-encoded string port since this character cannot 
be
+represented with ISO-8859-1:
+
address@hidden
+(define alpha (integer->char #x03b1)) ; GREEK SMALL LETTER ALPHA
+
+(with-fluids ((%default-port-encoding "ISO-8859-1"))
+  (call-with-output-string
+    (lambda (p)
+      (display alpha p))))
+
address@hidden
+Throw to key `encoding-error'
address@hidden example
+
+Changing the string port's encoding to a Unicode-capable encoding such as UTF-8
+solves the problem.
 @end deffn
 
 @deffn {Scheme Procedure} call-with-input-string string proc
@@ -984,6 +1012,8 @@ read.  The value yielded by the @var{proc} is returned.
 Calls the zero-argument procedure @var{thunk} with the current output
 port set temporarily to a new string port.  It returns a string
 composed of the characters written to the current output.
+
+See @code{call-with-output-string} above for character encoding considerations.
 @end deffn
 
 @deffn {Scheme Procedure} with-input-from-string string thunk
diff --git a/doc/ref/api-lalr.texi b/doc/ref/api-lalr.texi
new file mode 100644
index 0000000..e19614c
--- /dev/null
+++ b/doc/ref/api-lalr.texi
@@ -0,0 +1,36 @@
address@hidden -*-texinfo-*-
address@hidden This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2009, 2010
address@hidden   Free Software Foundation, Inc.
address@hidden See the file guile.texi for copying conditions.
+
address@hidden
address@hidden LALR(1) Parsing
address@hidden LALR(1) Parsing
+
+The @code{(system base lalr)} module provides the
address@hidden://code.google.com/p/lalr-scm/, @code{lalr-scm} LALR(1) parser
+generator by Dominique Boucher}.  @code{lalr-scm} uses the same algorithm as 
GNU
+Bison (@pxref{Introduction, Introduction to Bison,, bison, address@hidden The
+Yacc-compatible Parser Generator}).  Parsers are defined using the
address@hidden macro.
+
address@hidden {Scheme Syntax} lalr-parser address@hidden @var{tokens} 
@var{rules}...
+Generate an LALR(1) syntax analyzer.  @var{tokens} is a list of symbols
+representing the terminal symbols of the grammar.  @var{rules} are the grammar
+production rules.
+
+Each rule has the form @code{(@var{non-terminal} (@var{rhs} ...) : @var{action}
+...)}, where @var{non-terminal} is the name of the rule, @var{rhs} are the
+right-hand sides, i.e., the production rule, and @var{action} is a semantic
+action associated with the rule.
+
+The generated parser is a two-argument procedure that takes a @dfn{tokenizer}
+and a @dfn{syntax error procedure}.  The tokenizer should be a unary procedure
+taking a port and returning a lexical token as produced by
address@hidden  The syntax error procedure may be called with at
+least an error message (a string), and optionally the lexical token that caused
+the error.
address@hidden deffn
+
+Please refer to the @code{lalr-scm} documentation for details.
diff --git a/doc/ref/api-macros.texi b/doc/ref/api-macros.texi
new file mode 100644
index 0000000..51f54ed
--- /dev/null
+++ b/doc/ref/api-macros.texi
@@ -0,0 +1,878 @@
address@hidden -*-texinfo-*-
address@hidden This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010
address@hidden   Free Software Foundation, Inc.
address@hidden See the file guile.texi for copying conditions.
+
address@hidden
address@hidden Macros
address@hidden Macros
+
+At its best, programming in Lisp is an iterative process of building up a
+language appropriate to the problem at hand, and then solving the problem in
+that language. Defining new procedures is part of that, but Lisp also allows
+the user to extend its syntax, with its famous @dfn{macros}.
+
address@hidden macros
address@hidden transformation
+Macros are syntactic extensions which cause the expression that they appear in
+to be transformed in some way @emph{before} being evaluated. In expressions 
that
+are intended for macro transformation, the identifier that names the relevant
+macro must appear as the first element, like this:
+
address@hidden
+(@var{macro-name} @var{macro-args} @dots{})
address@hidden lisp
+
address@hidden macro expansion
+Macro expansion is a separate phase of evaluation, run before code is
+interpreted or compiled. A macro is a program that runs on programs, 
translating
+an embedded language into core Scheme.
+
address@hidden
+* Defining Macros::             Binding macros, globally and locally.
+* Syntax Rules::                Pattern-driven macros.
+* Syntax Case::                 Procedural, hygienic macros.
+* Defmacros::                   Lisp-style macros.
+* Identifier Macros::           Identifier macros.
+* Eval When::                   Affecting the expand-time environment.
+* Internal Macros::             Macros as first-class values.
address@hidden menu
+
address@hidden Defining Macros
address@hidden Defining Macros
+
+A macro is a binding between a keyword and a syntax transformer. Since it's
+difficult to discuss @code{define-syntax} without discussing the format of
+transformers, consider the following example macro definition:
+
address@hidden
+(define-syntax when
+  (syntax-rules ()
+    ((when condition exp ...)
+     (if condition
+         (begin exp ...)))))
+
+(when #t
+  (display "hey ho\n") 
+  (display "let's go\n"))
address@hidden hey ho
address@hidden let's go
address@hidden example
+
+In this example, the @code{when} binding is bound with @code{define-syntax}.
+Syntax transformers are discussed in more depth in @ref{Syntax Rules} and
address@hidden Case}.
+
address@hidden {Syntax} define-syntax keyword transformer
+Bind @var{keyword} to the syntax transformer obtained by evaluating
address@hidden
+
+After a macro has been defined, further instances of @var{keyword} in Scheme
+source code will invoke the syntax transformer defined by @var{transformer}.
address@hidden deffn
+
+One can also establish local syntactic bindings with @code{let-syntax}.
+
address@hidden {Syntax} let-syntax ((keyword transformer) ...) exp...
+Bind @var{keyword...} to @var{transformer...} while expanding @var{exp...}.
+
+A @code{let-syntax} binding only exists at expansion-time. 
+
address@hidden
+(let-syntax ((unless
+              (syntax-rules ()
+                ((unless condition exp ...)
+                 (if (not condition)
+                     (begin exp ...))))))
+  (unless #t
+    (primitive-exit 1))
+  "rock rock rock")
address@hidden "rock rock rock"
address@hidden example
address@hidden deffn
+
+A @code{define-syntax} form is valid anywhere a definition may appear: at the
+top-level, or locally. Just as a local @code{define} expands out to an instance
+of @code{letrec}, a local @code{define-syntax} expands out to
address@hidden
+
address@hidden {Syntax} letrec-syntax ((keyword transformer) ...) exp...
+Bind @var{keyword...} to @var{transformer...} while expanding @var{exp...}.
+
+In the spirit of @code{letrec} versus @code{let}, an expansion produced by
address@hidden may reference a @var{keyword} bound by the
+same @var{letrec-syntax}.
+
address@hidden
+(letrec-syntax ((my-or
+                 (syntax-rules ()
+                   ((my-or)
+                    #t)
+                   ((my-or exp)
+                    exp)
+                   ((my-or exp rest ...)
+                    (let ((t exp))
+                      (if exp
+                          exp
+                          (my-or rest ...)))))))
+  (my-or #f "rockaway beach"))
address@hidden "rockaway beach"
address@hidden example
address@hidden deffn
+
address@hidden Syntax Rules
address@hidden Syntax-rules Macros
+
address@hidden macros are simple, pattern-driven syntax transformers, with
+a beauty worthy of Scheme.
+
address@hidden {Syntax} syntax-rules literals (pattern template)...
+Create a syntax transformer that will rewrite an expression using the rules
+embodied in the @var{pattern} and @var{template} clauses.
address@hidden deffn
+
+A @code{syntax-rules} macro consists of three parts: the literals (if any), the
+patterns, and as many templates as there are patterns.
+
+When the syntax expander sees the invocation of a @code{syntax-rules} macro, it
+matches the expression against the patterns, in order, and rewrites the
+expression using the template from the first matching pattern. If no pattern
+matches, a syntax error is signalled.
+
address@hidden Patterns
+
+We have already seen some examples of patterns in the previous section:
address@hidden(unless condition exp ...)}, @code{(my-or exp)}, and so on. A 
pattern is
+structured like the expression that it is to match. It can have nested 
structure
+as well, like @code{(let ((var val) ...) exp exp* ...)}. Broadly speaking,
+patterns are made of lists, improper lists, vectors, identifiers, and datums.
+Users can match a sequence of patterns using the ellipsis (@code{...}).
+
+Identifiers in a pattern are called @dfn{literals} if they are present in the
address@hidden literals list, and @dfn{pattern variables} otherwise. When
+building up the macro output, the expander replaces instances of a pattern
+variable in the template with the matched subexpression.
+
address@hidden
+(define-syntax kwote
+  (syntax-rules ()
+    ((kwote exp)
+     (quote exp))))
+(kwote (foo . bar))
address@hidden (foo . bar)
address@hidden example
+
+An improper list of patterns matches as rest arguments do:
+
address@hidden
+(define-syntax let1
+  (syntax-rules ()
+    ((_ (var val) . exps)
+     (let ((var val)) . exps))))
address@hidden example
+
+However this definition of @code{let1} probably isn't what you want, as the 
tail
+pattern @var{exps} will match non-lists, like @code{(let1 (foo 'bar) . baz)}. 
So
+often instead of using improper lists as patterns, ellipsized patterns are
+better. Instances of a pattern variable in the template must be followed by an
+ellipsis.
+
address@hidden
+(define-syntax let1
+  (syntax-rules ()
+    ((_ (var val) exp ...)
+     (let ((var val)) exp ...))))
address@hidden example
+
+This @code{let1} probably still doesn't do what we want, because the body
+matches sequences of zero expressions, like @code{(let1 (foo 'bar))}. In this
+case we need to assert we have at least one body expression. A common idiom for
+this is to name the ellipsized pattern variable with an asterisk:
+
address@hidden
+(define-syntax let1
+  (syntax-rules ()
+    ((_ (var val) exp exp* ...)
+     (let ((var val)) exp exp* ...))))
address@hidden example
+
+A vector of patterns matches a vector whose contents match the patterns,
+including ellipsizing and tail patterns.
+
address@hidden
+(define-syntax letv
+  (syntax-rules ()
+    ((_ #((var val) ...) exp exp* ...)
+     (let ((var val) ...) exp exp* ...))))
+(letv #((foo 'bar)) foo)
address@hidden foo
address@hidden example
+
+Literals are used to match specific datums in an expression, like the use of
address@hidden>} and @code{else} in @code{cond} expressions.
+
address@hidden
+(define-syntax cond1
+  (syntax-rules (=> else)
+    ((cond1 test => fun)
+     (let ((exp test))
+       (if exp (fun exp) #f)))
+    ((cond1 test exp exp* ...)
+     (if test (begin exp exp* ...)))
+    ((cond1 else exp exp* ...)
+     (begin exp exp* ...))))
+
+(define (square x) (* x x))
+(cond1 10 => square)
address@hidden 100
+(let ((=> #t))
+  (cond1 10 => square))
address@hidden #<procedure square (x)>
address@hidden example
+
+A literal matches an input expression if the input expression is an identifier
+with the same name as the literal, and both are address@hidden
+lawyers probably see the need here for use of @code{literal-identifier=?} 
rather
+than @code{free-identifier=?}, and would probably be correct. Patches
+accepted.}.
+
+If a pattern is not a list, vector, or an identifier, it matches as a literal,
+with @code{equal?}.
+
address@hidden
+(define-syntax define-matcher-macro
+  (syntax-rules ()
+    ((_ name lit)
+     (define-syntax name
+       (syntax-rules ()
+        ((_ lit) #t)
+        ((_ else) #f))))))
+
+(define-matcher-macro is-literal-foo? "foo")
+
+(is-literal-foo? "foo")
address@hidden #t
+(is-literal-foo? "bar")
address@hidden #f
+(let ((foo "foo"))
+  (is-literal-foo? foo))
address@hidden #f
address@hidden example
+
+The last example indicates that matching happens at expansion-time, not
+at run-time.
+
+Syntax-rules macros are always used as @code{(@var{macro} . @var{args})}, and
+the @var{macro} will always be a symbol. Correspondingly, a @code{syntax-rules}
+pattern must be a list (proper or improper), and the first pattern in that list
+must be an identifier. Incidentally it can be any identifier -- it doesn't have
+to actually be the name of the macro. Thus the following three are equivalent:
+
address@hidden
+(define-syntax when
+  (syntax-rules ()
+    ((when c e ...)
+     (if c (begin e ...)))))
+
+(define-syntax when
+  (syntax-rules ()
+    ((_ c e ...)
+     (if c (begin e ...)))))
+
+(define-syntax when
+  (syntax-rules ()
+    ((something-else-entirely c e ...)
+     (if c (begin e ...)))))
address@hidden example
+
+For clarity, use one of the first two variants. Also note that since the 
pattern
+variable will always match the macro itself (e.g., @code{cond1}), it is 
actually
+left unbound in the template.
+
address@hidden Hygiene
+
address@hidden macros have a magical property: they preserve referential
+transparency. When you read a macro definition, any free bindings in that macro
+are resolved relative to the macro definition; and when you read a macro
+instantiation, all free bindings in that expression are resolved relative to 
the
+expression.
+
+This property is sometimes known as @dfn{hygiene}, and it does aid in code
+cleanliness. In your macro definitions, you can feel free to introduce 
temporary
+variables, without worrying about inadvertantly introducing bindings into the
+macro expansion.
+
+Consider the definition of @code{my-or} from the previous section:
+
address@hidden
+(define-syntax my-or
+  (syntax-rules ()
+    ((my-or)
+     #t)
+    ((my-or exp)
+     exp)
+    ((my-or exp rest ...)
+     (let ((t exp))
+       (if exp
+           exp
+           (my-or rest ...))))))
address@hidden example
+
+A naive expansion of @code{(let ((t #t)) (my-or #f t))} would yield:
+
address@hidden
+(let ((t #t))
+  (let ((t #f))
+    (if t t t)))
address@hidden #f
address@hidden example
+
address@hidden
+Which clearly is not what we want. Somehow the @code{t} in the definition is
+distinct from the @code{t} at the site of use; and it is indeed this 
distinction
+that is maintained by the syntax expander, when expanding hygienic macros.
+
+This discussion is mostly relevant in the context of traditional Lisp macros
+(@pxref{Defmacros}), which do not preserve referential transparency. Hygiene
+adds to the expressive power of Scheme.
+
address@hidden Further Information
+
+For a formal definition of @code{syntax-rules} and its pattern language, see
address@hidden, , Macros, r5rs, Revised(5) Report on the Algorithmic Language
+Scheme}.
+
address@hidden macros are simple and clean, but do they have limitations.
+They do not lend themselves to expressive error messages: patterns either match
+or they don't. Their ability to generate code is limited to template-driven
+expansion; often one needs to define a number of helper macros to get real work
+done. Sometimes one wants to introduce a binding into the lexical context of 
the
+generated code; this is impossible with @code{syntax-rules}. Relatedly, they
+cannot programmatically generate identifiers.
+
+The solution to all of these problems is to use @code{syntax-case} if you need
+its features. But if for some reason you're stuck with @code{syntax-rules}, you
+might enjoy Joe Marshall's
address@hidden://sites.google.com/site/evalapply/eccentric.txt,@code{syntax-rules}
+Primer for the Merely Eccentric}.
+
address@hidden Syntax Case
address@hidden Support for the @code{syntax-case} System
+
address@hidden macros are procedural syntax transformers, with a power
+worthy of Scheme.
+
address@hidden {Syntax} syntax-case syntax literals (pattern [guard] exp)...
+Match the syntax object @var{syntax} against the given patterns, in order. If a
address@hidden matches, return the result of evaluating the associated 
@var{exp}.
address@hidden deffn
+
+Compare the following definitions of @code{when}:
+
address@hidden
+(define-syntax when
+  (syntax-rules ()
+    ((_ test e e* ...)
+     (if test (begin e e* ...)))))
+
+(define-syntax when
+  (lambda (x)
+    (syntax-case x ()
+      ((_ test e e* ...)
+       #'(if test (begin e e* ...))))))
address@hidden example
+
+Clearly, the @code{syntax-case} definition is similar to its 
@code{syntax-rules}
+counterpart, and equally clearly there are some differences. The
address@hidden definition is wrapped in a @code{lambda}, a function of one
+argument; that argument is passed to the @code{syntax-case} invocation; and the
+``return value'' of the macro has a @code{#'} prefix.
+
+All of these differences stem from the fact that @code{syntax-case} does not
+define a syntax transformer itself -- instead, @code{syntax-case} expressions
+provide a way to destructure a @dfn{syntax object}, and to rebuild syntax
+objects as output.
+
+So the @code{lambda} wrapper is simply a leaky implementation detail, that
+syntax transformers are just functions that transform syntax to syntax. This
+should not be surprising, given that we have already described macros as
+``programs that write programs''. @code{syntax-case} is simply a way to take
+apart and put together program text, and to be a valid syntax transformer it
+needs to be wrapped in a procedure.
+
+Unlike traditional Lisp macros (@pxref{Defmacros}), @code{syntax-case} macros
+transform syntax objects, not raw Scheme forms. Recall the naive expansion of
address@hidden given in the previous section:
+
address@hidden
+(let ((t #t))
+  (my-or #f t))
+;; naive expansion:
+(let ((t #t))
+  (let ((t #f))
+    (if t t t)))
address@hidden example
+
+Raw Scheme forms simply don't have enough information to distinguish the first
+two @code{t} instances in @code{(if t t t)} from the third @code{t}. So instead
+of representing identifiers as symbols, the syntax expander represents
+identifiers as annotated syntax objects, attaching such information to those
+syntax objects as is needed to maintain referential transparency.
+
address@hidden {Syntax} syntax form
+Create a syntax object wrapping @var{form} within the current lexical context.
address@hidden deffn
+
+Syntax objects are typically created internally to the process of expansion, 
but
+it is possible to create them outside of syntax expansion:
+
address@hidden
+(syntax (foo bar baz))
address@hidden #<some representation of that syntax>
address@hidden example
+
address@hidden
+However it is more common, and useful, to create syntax objects when building
+output from a @code{syntax-case} expression.
+
address@hidden
+(define-syntax add1
+  (lambda (x)
+    (syntax-case x ()
+      ((_ exp)
+       (syntax (+ exp 1))))))
address@hidden example
+
+It is not strictly necessary for a @code{syntax-case} expression to return a
+syntax object, because @code{syntax-case} expressions can be used in helper
+functions, or otherwise used outside of syntax expansion itself. However a
+syntax transformer procedure  must return a syntax object, so most uses of
address@hidden do end up returning syntax objects.
+
+Here in this case, the form that built the return value was @code{(syntax (+ 
exp
+1))}. The interesting thing about this is that within a @code{syntax}
+expression, any appearance of a pattern variable is substitued into the
+resulting syntax object, carrying with it all relevant metadata from the source
+expression, such as lexical identity and source location.
+
+Indeed, a pattern variable may only be referenced from inside a @code{syntax}
+form. The syntax expander would raise an error when defining @code{add1} if it
+found @var{exp} referenced outside a @code{syntax} form.
+
+Since @code{syntax} appears frequently in macro-heavy code, it has a special
+reader macro: @code{#'}. @code{#'foo} is transformed by the reader into
address@hidden(syntax foo)}, just as @code{'foo} is tranformed into 
@code{(quote foo)}.
+
+The pattern language used by @code{syntax-case} is conveniently the same
+language used by @code{syntax-rules}. Given this, Guile actually defines
address@hidden in terms of @code{syntax-case}:
+
address@hidden
+(define-syntax syntax-rules
+  (lambda (x)
+    (syntax-case x ()
+      ((_ (k ...) ((keyword . pattern) template) ...)
+       #'(lambda (x)
+           (syntax-case x (k ...)
+             ((dummy . pattern) #'template)
+             ...))))))
address@hidden example
+
+And that's that.
+
address@hidden Why @code{syntax-case}?
+
+The examples we have shown thus far could just as well have been expressed with
address@hidden, and have just shown that @code{syntax-case} is more
+verbose, which is true. But there is a difference: @code{syntax-case} creates
address@hidden macros, giving the full power of Scheme to the macro expander.
+This has many practical applications.
+
+A common desire is to be able to match a form only if it is an identifier. This
+is impossible with @code{syntax-rules}, given the datum matching forms. But 
with
address@hidden it is easy:
+
address@hidden {Scheme Procedure} identifier? syntax-object
+Returns @code{#t} iff @var{syntax-object} is an identifier.
address@hidden deffn
+
address@hidden
+(define-syntax add1!
+  (lambda (x)
+    (syntax-case x ()
+      ((_ var) (identifier? #'var)
+       #'(set! var (add1 var))))))
+
+(define foo 0)
+(add1! foo)
+foo @result{} 1
+(add1! "not-an-identifier") @result{} error
address@hidden example
+
+With @code{syntax-rules}, the error for @code{(add1! "not-an-identifier")} 
would
+be something like ``invalid @code{set!}''. With @code{syntax-case}, it will say
+something like ``invalid @code{add1!}'', because we attach the @dfn{guard
+clause} to the pattern: @code{(identifier? #'var)}. This becomes more important
+with more complicated macros. It is necessary to use @code{identifier?}, 
because
+to the expander, an identifier is more than a bare symbol.
+
+Note that even in the guard clause, we reference the @var{var} pattern variable
+within a @code{syntax} form, via @code{#'var}.
+
+Another common desire is to introduce bindings into the lexical context of the
+output expression. One example would be in the so-called ``anaphoric macros'',
+like @code{aif}. Anaphoric macros bind some expression to a well-known
+identifier, often @code{it}, within their bodies. For example, in @code{(aif
+(foo) (bar it))}, @code{it} would be bound to the result of @code{(foo)}.
+
+To begin with, we should mention a solution that doesn't work:
+
address@hidden
+;; doesn't work
+(define-syntax aif
+  (lambda (x)
+    (syntax-case x ()
+      ((_ test then else)
+       #'(let ((it test))
+           (if it then else))))))
address@hidden example
+
+The reason that this doesn't work is that, by default, the expander will
+preserve referential transparency; the @var{then} and @var{else} expressions
+won't have access to the binding of @code{it}.
+
+But they can, if we explicitly introduce a binding via @code{datum->syntax}.
+
address@hidden {Scheme Procedure} datum->syntax for-syntax datum
+Create a syntax object that wraps @var{datum}, within the lexical context
+corresponding to the syntax object @var{for-syntax}.
address@hidden deffn
+
+For completeness, we should mention that it is possible to strip the metadata
+from a syntax object, returning a raw Scheme datum:
+
address@hidden {Scheme Procedure} syntax->datum syntax-object
+Strip the metadata from @var{syntax-object}, returning its contents as a raw
+Scheme datum.
address@hidden deffn
+
+In this case we want to introduce @code{it} in the context of the whole
+expression, so we can create a syntax object as @code{(datum->syntax x 'it)},
+where @code{x} is the whole expression, as passed to the transformer procedure.
+
+Here's another solution that doesn't work:
+
address@hidden
+;; doesn't work either
+(define-syntax aif
+  (lambda (x)
+    (syntax-case x ()
+      ((_ test then else)
+       (let ((it (datum->syntax x 'it)))
+         #'(let ((it test))
+             (if it then else)))))))
address@hidden example
+
+The reason that this one doesn't work is that there are really two environments
+at work here -- the environment of pattern variables, as bound by
address@hidden, and the environment of lexical variables, as bound by normal
+Scheme. Here we need to introduce a piece of Scheme's environment into that of
+the syntax expander, and we can do so using @code{syntax-case} itself:
+
address@hidden
+;; works, but is obtuse
+(define-syntax aif
+  (lambda (x)
+    (syntax-case x ()
+      ((_ test then else)
+       ;; invoking syntax-case on the generated
+       ;; syntax object to expose it to `syntax'
+       (syntax-case (datum->syntax x 'it) ()
+         (it
+           #'(let ((it test))
+               (if it then else))))))))
+
+(aif (getuid) (display it) (display "none")) (newline)
address@hidden 500
address@hidden example
+
+However there are easier ways to write this. @code{with-syntax} is often
+convenient:
+
address@hidden {Syntax} with-syntax ((pat val)...) exp...
+Bind patterns @var{pat} from their corresponding values @var{val}, within the
+lexical context of @var{exp...}.
+
address@hidden
+;; better
+(define-syntax aif
+  (lambda (x)
+    (syntax-case x ()
+      ((_ test then else)
+       (with-syntax ((it (datum->syntax x 'it)))
+         #'(let ((it test))
+             (if it then else)))))))
address@hidden example
address@hidden deffn
+
+As you might imagine, @code{with-syntax} is defined in terms of
address@hidden But even that might be off-putting to you if you are an old
+Lisp macro hacker, used to building macro output with @code{quasiquote}. The
+issue is that @code{with-syntax} creates a separation between the point of
+definition of a value and its point of substitution.
+
address@hidden quasisyntax
address@hidden unsyntax
address@hidden unsyntax-splicing
+So for cases in which a @code{quasiquote} style makes more sense,
address@hidden also defines @code{quasisyntax}, and the related
address@hidden and @code{unsyntax-splicing}, abbreviated by the reader as
address@hidden, @code{#,}, and @code{#,@@}, respectively.
+
+For example, to define a macro that inserts a compile-time timestamp into a
+source file, one may write:
+
address@hidden
+(define-syntax display-compile-timestamp
+  (lambda (x)
+    (syntax-case x ()
+      ((_)
+       #`(begin
+          (display "The compile timestamp was: ")
+          (display #,(current-time))
+          (newline))))))
address@hidden example
+
+Finally, we should mention the following helper procedures defined by the core
+of @code{syntax-case}:
+
address@hidden {Scheme Procedure} bound-identifier=? a b
+Returns @code{#t} iff the syntax objects @var{a} and @var{b} refer to the same
+lexically-bound identifier.
address@hidden deffn
+
address@hidden {Scheme Procedure} free-identifier=? a b
+Returns @code{#t} iff the syntax objects @var{a} and @var{b} refer to the same
+free identifier.
address@hidden deffn
+
address@hidden {Scheme Procedure} generate-temporaries ls
+Return a list of temporary identifiers as long as @var{ls} is long.
address@hidden deffn
+
+Readers interested in further information on @code{syntax-case} macros should
+see R. Kent Dybvig's excellent @cite{The Scheme Programming Language}, either
+edition 3 or 4, in the chapter on syntax. Dybvig was the primary author of the
address@hidden system. The book itself is available online at
address@hidden://scheme.com/tspl4/}.
+
address@hidden Defmacros
address@hidden Lisp-style Macro Definitions
+
+The traditional way to define macros in Lisp is very similar to procedure
+definitions. The key differences are that the macro definition body should
+return a list that describes the transformed expression, and that the 
definition
+is marked as a macro definition (rather than a procedure definition) by the use
+of a different definition keyword: in Lisp, @code{defmacro} rather than
address@hidden, and in Scheme, @code{define-macro} rather than @code{define}.
+
address@hidden defmacro
address@hidden define-macro
+Guile supports this style of macro definition using both @code{defmacro}
+and @code{define-macro}.  The only difference between them is how the
+macro name and arguments are grouped together in the definition:
+
address@hidden
+(defmacro @var{name} (@var{args} @dots{}) @var{body} @dots{})
address@hidden lisp
+
address@hidden
+is the same as
+
address@hidden
+(define-macro (@var{name} @var{args} @dots{}) @var{body} @dots{})
address@hidden lisp
+
address@hidden
+The difference is analogous to the corresponding difference between
+Lisp's @code{defun} and Scheme's @code{define}.
+
+Having read the previous section on @code{syntax-case}, it's probably clear 
that
+Guile actually implements defmacros in terms of @code{syntax-case}, applying 
the
+transformer on the expression between invocations of @code{syntax->datum} and
address@hidden>syntax}. This realization leads us to the problem with defmacros,
+that they do not preserve referential transparency. One can be careful to not
+introduce bindings into expanded code, via liberal use of @code{gensym}, but
+there is no getting around the lack of referential transparency for free
+bindings in the macro itself.
+
+Even a macro as simple as our @code{when} from before is difficult to get 
right:
+
address@hidden
+(define-macro (when cond exp . rest)
+  `(if ,cond
+       (begin ,exp . ,rest)))
+
+(when #f (display "Launching missiles!\n"))
address@hidden #f
+
+(let ((if list))
+  (when #f (display "Launching missiles!\n")))
address@hidden Launching missiles!
address@hidden (#f #<unspecified>)
address@hidden example
+
+Guile's perspective is that defmacros have had a good run, but that modern
+macros should be written with @code{syntax-rules} or @code{syntax-case}. There
+are still many uses of defmacros within Guile itself, but we will be phasing
+them out over time. Of course we won't take away @code{defmacro} or
address@hidden themselves, as there is lots of code out there that uses
+them.
+
+
address@hidden Identifier Macros
address@hidden Identifier Macros
+
+When the syntax expander sees a form in which the first element is a macro, the
+whole form gets passed to the macro's syntax transformer. One may visualize 
this
+as:
+
address@hidden
+(define-syntax foo foo-transformer)
+(foo @var{arg}...)
+;; expands via
+(foo-transformer #'(foo @var{arg}...))
address@hidden example
+
+If, on the other hand, a macro is referenced in some other part of a form, the
+syntax transformer is invoked with only the macro reference, not the whole 
form.
+
address@hidden
+(define-syntax foo foo-transformer)
+foo
+;; expands via
+(foo-transformer #'foo)
address@hidden example
+
+This allows bare identifier references to be replaced programmatically via a
+macro. @code{syntax-rules} provides some syntax to effect this transformation
+more easily.
+
address@hidden {Syntax} identifier-syntax exp
+Returns a macro transformer that will replace occurences of the macro with
address@hidden
address@hidden deffn
+
+For example, if you are importing external code written in terms of @code{fx+},
+the fixnum addition operator, but Guile doesn't have @code{fx+}, you may use 
the
+following to replace @code{fx+} with @code{+}:
+
address@hidden
+(define-syntax fx+ (identifier-syntax +))
address@hidden example
+
+Later versions of the @code{psyntax} @code{syntax-case} expander, on which
+Guile's syntax expander is based, include @code{identifier-syntax} support for
+recognizing identifiers on the left-hand side of a @code{set!} expression as
+well. Guile should port that code to its expander.
+
address@hidden Eval When
address@hidden Eval-when
+
+As @code{syntax-case} macros have the whole power of Scheme available to them,
+they present a problem regarding time: when a macro runs, what parts of the
+program are available for the macro to use?
+
+The default answer to this question is that when you import a module (via
address@hidden or @code{use-modules}), that module will be loaded up at
+expansion-time, as well as at run-time. Additionally, top-level syntactic
+definitions within one compilation unit made by @code{define-syntax} are also
+evaluated at expansion time, in the order that they appear in the compilation
+unit (file).
+
+But if a syntactic definition needs to call out to a normal procedure at
+expansion-time, it might well need need special declarations to indicate that
+the procedure should be made available at expansion-time.
+
+For example, the following code will work at a REPL, but not in a file:
+
address@hidden
+;; incorrect
+(use-modules (srfi srfi-19))
+(define (date) (date->string (current-date)))
+(define-syntax %date (identifier-syntax (date)))
+(define *compilation-date* %date)
address@hidden example
+
+It works at a REPL because the expressions are evaluated one-by-one, in order,
+but if placed in a file, the expressions are expanded one-by-one, but not
+evaluated until the compiled file is loaded.
+
+The fix is to use @code{eval-when}.
+
address@hidden
+;; correct: using eval-when
+(use-modules (srfi srfi-19))
+(eval-when (compile load eval)
+  (define (date) (date->string (current-date))))
+(define-syntax %date (identifier-syntax (date)))
+(define *compilation-date* %date)
address@hidden example
+
address@hidden {Syntax} eval-when conditions exp...
+Evaluate @var{exp...} under the given @var{conditions}. Valid conditions 
include
address@hidden, @code{load}, and @code{compile}. If you need to use
address@hidden, use it with all three conditions, as in the above example.
+Other uses of @code{eval-when} may void your warranty or poison your cat.
address@hidden deffn
+
address@hidden Internal Macros
address@hidden Internal Macros
+
address@hidden {Scheme Procedure} make-syntax-transformer name type binding
+Construct a syntax transformer object. This is part of Guile's low-level 
support
+for syntax-case.
address@hidden deffn
+
address@hidden {Scheme Procedure} macro? obj
address@hidden {C Function} scm_macro_p (obj)
+Return @code{#t} iff @var{obj} is a syntax transformer.
+
+Note that it's a bit difficult to actually get a macro as a first-class object;
+simply naming it (like @code{case}) will produce a syntax error. But it is
+possible to get these objects using @code{module-ref}:
+
address@hidden
+(macro? (module-ref (current-module) 'case))
address@hidden #t
address@hidden example
address@hidden deffn
+
address@hidden {Scheme Procedure} macro-type m
address@hidden {C Function} scm_macro_type (m)
+Return the @var{type} that was given when @var{m} was constructed, via
address@hidden
address@hidden deffn
+
address@hidden {Scheme Procedure} macro-name m
address@hidden {C Function} scm_macro_name (m)
+Return the name of the macro @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} macro-binding m
address@hidden {C Function} scm_macro_binding (m)
+Return the binding of the macro @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} macro-transformer m
address@hidden {C Function} scm_macro_transformer (m)
+Return the transformer of the macro @var{m}. This will return a procedure, for
+which one may ask the docstring. That's the whole reason this section is
+documented. Actually a part of the result of @code{macro-binding}.
address@hidden deffn
+
+
address@hidden Local Variables:
address@hidden TeX-master: "guile.texi"
address@hidden End:
diff --git a/doc/ref/api-modules.texi b/doc/ref/api-modules.texi
index 054f87f..618f5fa 100644
--- a/doc/ref/api-modules.texi
+++ b/doc/ref/api-modules.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2008
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 
2008, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -41,121 +41,20 @@ In addition, Guile offers variables as first-class 
objects.  They can
 be used for interacting with the module system.
 
 @menu
-* provide and require::         The SLIB feature mechanism.
-* Environments::                R5RS top-level environments.
-* The Guile module system::     How Guile does it.
-* Dynamic Libraries::           Loading libraries of compiled code at run time.
-* Variables::                   First-class variables.
address@hidden menu
-
address@hidden provide and require
address@hidden provide and require
-
-Aubrey Jaffer, mostly to support his portable Scheme library SLIB,
-implemented a provide/require mechanism for many Scheme implementations.
-Library files in SLIB @emph{provide} a feature, and when user programs
address@hidden that feature, the library file is loaded in.
-
-For example, the file @file{random.scm} in the SLIB package contains the
-line
-
address@hidden
-(provide 'random)
address@hidden lisp
-
-so to use its procedures, a user would type
-
address@hidden
-(require 'random)
address@hidden lisp
-
-and they would magically become available, @emph{but still have the same
-names!}  So this method is nice, but not as good as a full-featured
-module system.
-
-When SLIB is used with Guile, provide and require can be used to access
-its facilities.
-
address@hidden Environments
address@hidden Environments
address@hidden environment
-
-Scheme, as defined in R5RS, does @emph{not} have a full module system.
-However it does define the concept of a top-level @dfn{environment}.
-Such an environment maps identifiers (symbols) to Scheme objects such
-as procedures and lists: @ref{About Closure}.  In other words, it
-implements a set of @dfn{bindings}.
-
-Environments in R5RS can be passed as the second argument to
address@hidden (@pxref{Fly Evaluation}).  Three procedures are defined to
-return environments: @code{scheme-report-environment},
address@hidden and @code{interaction-environment} (@pxref{Fly
-Evaluation}).
-
-In addition, in Guile any module can be used as an R5RS environment,
-i.e., passed as the second argument to @code{eval}.
-
-Note: the following two procedures are available only when the 
address@hidden(ice-9 r5rs)} module is loaded:
-
address@hidden
-(use-modules (ice-9 r5rs))
address@hidden lisp
-
address@hidden {Scheme Procedure} scheme-report-environment version
address@hidden {Scheme Procedure} null-environment version
address@hidden must be the exact integer `5', corresponding to revision
-5 of the Scheme report (the Revised^5 Report on Scheme).
address@hidden returns a specifier for an
-environment that is empty except for all bindings defined in the
-report that are either required or both optional and supported by the
-implementation. @code{null-environment} returns a specifier for an
-environment that is empty except for the (syntactic) bindings for all
-syntactic keywords defined in the report that are either required or
-both optional and supported by the implementation.
-
-Currently Guile does not support values of @var{version} for other
-revisions of the report.
-
-The effect of assigning (through the use of @code{eval}) a variable
-bound in a @code{scheme-report-environment} (for example @code{car})
-is unspecified.  Currently the environments specified by
address@hidden are not immutable in Guile.
address@hidden deffn
-
address@hidden The Guile module system
address@hidden The Guile module system
-
-The Guile module system extends the concept of environments, discussed
-in the previous section, with mechanisms to define, use and customise
-sets of bindings.
-
-In 1996 Tom Lord implemented a full-featured module system for Guile which
-allows loading Scheme source files into a private name space.  This system has
-been available since at least Guile version 1.1.
-
-For Guile version 1.5.0 and later, the system has been improved to have better
-integration from C code, more fine-grained user control over interfaces, and
-documentation.
-
-Although it is anticipated that the module system implementation will
-change in the future, the Scheme programming interface described in this
-manual should be considered stable.  The C programming interface is
-considered relatively stable, although at the time of this writing,
-there is still some flux.
-
address@hidden
 * General Information about Modules::  Guile module basics.
 * Using Guile Modules::         How to use existing modules.
 * Creating Guile Modules::      How to package your code into modules.
 * Module System Reflection::    Accessing module objects at run-time.
-* Module System Quirks::        Strange things to be aware of.
 * Included Guile Modules::      Which modules come with Guile?
+* R6RS Version References::     Using version numbers with modules.
 * Accessing Modules from C::    How to work with modules with C code.
+* Variables::                   First-class variables.
+* provide and require::         The SLIB feature mechanism.
+* Environments::                R5RS top-level environments.
 @end menu
 
 @node General Information about Modules
address@hidden General Information about Modules
address@hidden General Information about Modules
 
 A Guile module can be thought of as a collection of named procedures,
 variables and macros.  More precisely, it is a set of @dfn{bindings}
@@ -194,6 +93,21 @@ would result in the filename @code{ice-9/popen.scm} and 
searched in the
 installation directories of Guile and in all other directories in the
 load path.
 
+A slightly different search mechanism is used when a client module
+specifies a version reference as part of a request to load a module
+(@pxref{R6RS Version References}).  Instead of searching the directories
+in the load path for a single filename, Guile uses the elements of the 
+version reference to locate matching, numbered subdirectories of a 
+constructed base path.  For example, a request for the 
address@hidden(rnrs base)} module with version reference @code{(6)} would cause
+Guile to discover the @code{rnrs/6} subdirectory (if it exists in any of
+the directories in the load path) and search its contents for the
+filename @code{base.scm}.
+
+When multiple modules are found that match a version reference, Guile
+sorts these modules by version number, followed by the length of their
+version specifications, in order to choose a ``best'' match.
+
 @c FIXME::martin:  Not sure about this, maybe someone knows better?
 Every module has a so-called syntax transformer associated with it.
 This is a procedure which performs all syntax transformation for the
@@ -202,13 +116,9 @@ you can manipulate the current syntax transformer using the
 @code{use-syntax} syntactic form or the @code{#:use-syntax} module
 definition option (@pxref{Creating Guile Modules}).
 
-Please note that there are some problems with the current module system
-you should keep in mind (@pxref{Module System Quirks}).  We hope to
-address these eventually.
-
 
 @node Using Guile Modules
address@hidden Using Guile Modules
address@hidden Using Guile Modules
 
 To use a Guile module is to access either its public interface or a
 custom interface (@pxref{General Information about Modules}).  Both
@@ -323,6 +233,21 @@ omitted, the returned interface has no bindings.  If the 
@code{:select}
 clause is omitted, @var{renamer} operates on the used module's public
 interface.
 
+In addition to the above, @var{spec} can also include a @code{:version} 
+clause, of the form:
+
address@hidden
+ :version VERSION-SPEC
address@hidden lisp
+
+where @var{version-spec} is an R6RS-compatible version reference.  The 
+presence of this clause changes Guile's search behavior as described in
+the section on module name resolution 
+(@pxref{General Information about Modules}).  An error will be signaled 
+in the case in which a module with the same name has already been 
+loaded, if that module specifies a version and that version is not 
+compatible with @var{version-spec}.
+
 Signal error if module name is not resolvable.
 @end deffn
 
@@ -349,7 +274,7 @@ last resort.
 @end deffn
 
 @node Creating Guile Modules
address@hidden Creating Guile Modules
address@hidden Creating Guile Modules
 
 When you want to create your own modules, you have to take the following
 steps:
@@ -420,40 +345,42 @@ the module is used.
 
 @item #:export @var{list}
 @cindex export
-Export all identifiers in @var{list} which must be a list of symbols.
-This is equivalent to @code{(export @var{list})} in the module body.
+Export all identifiers in @var{list} which must be a list of symbols
+or pairs of symbols. This is equivalent to @code{(export @var{list})} 
+in the module body.
 
 @item #:re-export @var{list}
 @cindex re-export
 Re-export all identifiers in @var{list} which must be a list of
-symbols.  The symbols in @var{list} must be imported by the current
-module from other modules.  This is equivalent to @code{re-export}
-below.
+symbols or pairs of symbols.  The symbols in @var{list} must be 
+imported by the current module from other modules.  This is equivalent
+to @code{re-export} below.
 
 @item #:export-syntax @var{list}
 @cindex export-syntax
-Export all identifiers in @var{list} which must be a list of symbols.
-The identifiers in @var{list} must refer to macros (@pxref{Macros})
-defined in the current module.  This is equivalent to
address@hidden(export-syntax @var{list})} in the module body.
+Export all identifiers in @var{list} which must be a list of symbols
+or pairs of symbols.  The identifiers in @var{list} must refer to 
+macros (@pxref{Macros}) defined in the current module.  This is 
+equivalent to @code{(export-syntax @var{list})} in the module body.
 
 @item #:re-export-syntax @var{list}
 @cindex re-export-syntax
 Re-export all identifiers in @var{list} which must be a list of
-symbols.  The symbols in @var{list} must refer to macros imported by
-the current module from other modules.  This is equivalent to
address@hidden(re-export-syntax @var{list})} in the module body. 
+symbols or pairs of symbols.  The symbols in @var{list} must refer to
+macros imported by the current module from other modules.  This is 
+equivalent to @code{(re-export-syntax @var{list})} in the module body. 
 
 @item #:replace @var{list}
 @cindex replace
 @cindex replacing binding
 @cindex overriding binding
 @cindex duplicate binding
-Export all identifiers in @var{list} (a list of symbols) and mark them
-as @dfn{replacing bindings}.  In the module user's name space, this
-will have the effect of replacing any binding with the same name that
-is not also ``replacing''.  Normally a replacement results in an
-``override'' warning message, @code{#:replace} avoids that.
+Export all identifiers in @var{list} (a list of symbols or pairs of
+symbols) and mark them as @dfn{replacing bindings}.  In the module 
+user's name space, this will have the effect of replacing any binding 
+with the same name that is not also ``replacing''.  Normally a 
+replacement results in an ``override'' warning message, 
address@hidden:replace} avoids that.
 
 This is useful for modules that export bindings that have the same
 name as core bindings.  @code{#:replace}, in a sense, lets Guile know
@@ -482,6 +409,13 @@ instead of a comparison.
 The @code{#:duplicates} (see below) provides fine-grain control about
 duplicate binding handling on the module-user side.
 
address@hidden #:version @var{list}
address@hidden module version
+Specify a version for the module in the form of @var{list}, a list of
+zero or more exact, nonnegative integers.  The corresponding 
address@hidden:version} option in the @code{use-modules} form allows callers
+to restrict the value of this option in various ways.
+
 @item #:duplicates @var{list}
 @cindex duplicate binding handlers
 @cindex duplicate binding
@@ -561,8 +495,11 @@ do not know anything about dangerous procedures.
 @c end
 
 @deffn syntax export variable @dots{}
-Add all @var{variable}s (which must be symbols) to the list of exported
-bindings of the current module.
+Add all @var{variable}s (which must be symbols or pairs of symbols) to 
+the list of exported bindings of the current module.  If @var{variable}
+is a pair, its @code{car} gives the name of the variable as seen by the
+current module and its @code{cdr} specifies a name for the binding in
+the current module's public interface.
 @end deffn
 
 @c begin (scm-doc-string "boot-9.scm" "define-public")
@@ -572,13 +509,14 @@ Equivalent to @code{(begin (define foo ...) (export 
foo))}.
 @c end
 
 @deffn syntax re-export variable @dots{}
-Add all @var{variable}s (which must be symbols) to the list of
-re-exported bindings of the current module.  Re-exported bindings must
-be imported by the current module from some other module.
+Add all @var{variable}s (which must be symbols or pairs of symbols) to 
+the list of re-exported bindings of the current module.  Pairs of 
+symbols are handled as in @code{export}.  Re-exported bindings must be
+imported by the current module from some other module.
 @end deffn
 
 @node Module System Reflection
address@hidden Module System Reflection
address@hidden Module System Reflection
 
 The previous sections have described a declarative view of the module
 system.  You can also work with it programmatically by accessing and
@@ -631,40 +569,9 @@ arguments should be module objects, and @var{interface} 
should very
 likely be a module returned by @code{resolve-interface}.
 @end deffn
 
address@hidden Module System Quirks
address@hidden Module System Quirks
-
-Although the programming interfaces are relatively stable, the Guile
-module system itself is still evolving.  Here are some situations where
-usage surpasses design.
-
address@hidden @bullet
-
address@hidden
-When using a module which exports a macro definition, the other module
-must export all bindings the macro expansion uses, too, because the
-expanded code would otherwise not be able to see these definitions and
-issue a ``variable unbound'' error, or worse, would use another binding
-which might be present in the scope of the expansion.
-
address@hidden
-When two or more used modules export bindings with the same names, the
-last accessed module wins, and the exported binding of that last module
-will silently be used.  This might lead to hard-to-find errors because
-wrong procedures or variables are used.  To avoid this kind of
address@hidden situation, use a custom interface specification
-(@pxref{Using Guile Modules}).  (We include this entry for the possible
-benefit of users of Guile versions previous to 1.5.0, when custom
-interfaces were added to the module system.)
-
address@hidden
-[Add other quirks here.]
-
address@hidden itemize
-
 
 @node Included Guile Modules
address@hidden Included Guile Modules
address@hidden Included Guile Modules
 
 @c FIXME::martin: Review me!
 
@@ -787,8 +694,92 @@ library SLIB from Guile (@pxref{SLIB}).
 @end table
 
 
address@hidden R6RS Version References
address@hidden R6RS Version References
+
+Guile's module system includes support for locating modules based on
+a declared version specifier of the same form as the one described in
+R6RS (@pxref{Library form, R6RS Library Form,, r6rs, The Revised^6 
+Report on the Algorithmic Language Scheme}).  By using the 
address@hidden:version} keyword in a @code{define-module} form, a module may
+specify a version as a list of zero or more exact, nonnegative integers.
+
+This version can then be used to locate the module during the module
+search process.  Client modules and callers of the @code{use-modules} 
+function may specify constraints on the versions of target modules by
+providing a @dfn{version reference}, which has one of the following
+forms:
+
address@hidden
+ (@var{sub-version-reference} ...)
+ (and @var{version-reference} ...)
+ (or @var{version-reference} ...)
+ (not @var{version-reference})
address@hidden lisp
+
+in which @var{sub-version-reference} is in turn one of:
+
address@hidden
+ (@var{sub-version})
+ (>= @var{sub-version})
+ (<= @var{sub-version})
+ (and @var{sub-version-reference} ...)
+ (or @var{sub-version-reference} ...)
+ (not @var{sub-version-reference})
address@hidden lisp
+
+in which @var{sub-version} is an exact, nonnegative integer as above. A
+version reference matches a declared module version if each element of
+the version reference matches a corresponding element of the module 
+version, according to the following rules:
+
address@hidden @bullet
address@hidden
+The @code{and} sub-form matches a version or version element if every 
+element in the tail of the sub-form matches the specified version or 
+version element.
+
address@hidden
+The @code{or} sub-form matches a version or version element if any 
+element in the tail of the sub-form matches the specified version or
+version element.
+
address@hidden
+The @code{not} sub-form matches a version or version element if the tail
+of the sub-form does not match the version or version element.  
+
address@hidden
+The @code{>=} sub-form matches a version element if the element is 
+greater than or equal to the @var{sub-version} in the tail of the 
+sub-form.
+
address@hidden
+The @code{<=} sub-form matches a version element if the version is less
+than or equal to the @var{sub-version} in the tail of the sub-form.
+
address@hidden
+A @var{sub-version} matches a version element if one is @var{eqv?} to
+the other.
address@hidden itemize
+
+For example, a module declared as:
+
address@hidden
+ (define-module (mylib mymodule) #:version (1 2 0))
address@hidden lisp
+
+would be successfully loaded by any of the following @code{use-modules}
+expressions:
+
address@hidden
+ (use-modules ((mylib mymodule) #:version (1 2 (>= 0))))
+ (use-modules ((mylib mymodule) #:version (or (1 2 0) (1 2 1))))
+ (use-modules ((mylib mymodule) #:version ((and (>= 1) (not 2)) 2 0)))
address@hidden lisp
+
+
 @node Accessing Modules from C
address@hidden Accessing Modules from C
address@hidden Accessing Modules from C
 
 The last sections have described how modules are used in Scheme code,
 which is the recommended way of creating and accessing modules.  You
@@ -884,454 +875,6 @@ of the current module.  The list of names is terminated by
 @code{NULL}.
 @end deftypefn
 
address@hidden Dynamic Libraries
address@hidden Dynamic Libraries
-
-Most modern Unices have something called @dfn{shared libraries}.  This
-ordinarily means that they have the capability to share the executable
-image of a library between several running programs to save memory and
-disk space.  But generally, shared libraries give a lot of additional
-flexibility compared to the traditional static libraries.  In fact,
-calling them `dynamic' libraries is as correct as calling them `shared'.
-
-Shared libraries really give you a lot of flexibility in addition to the
-memory and disk space savings.  When you link a program against a shared
-library, that library is not closely incorporated into the final
-executable.  Instead, the executable of your program only contains
-enough information to find the needed shared libraries when the program
-is actually run.  Only then, when the program is starting, is the final
-step of the linking process performed.  This means that you need not
-recompile all programs when you install a new, only slightly modified
-version of a shared library.  The programs will pick up the changes
-automatically the next time they are run.
-
-Now, when all the necessary machinery is there to perform part of the
-linking at run-time, why not take the next step and allow the programmer
-to explicitly take advantage of it from within his program?  Of course,
-many operating systems that support shared libraries do just that, and
-chances are that Guile will allow you to access this feature from within
-your Scheme programs.  As you might have guessed already, this feature
-is called @dfn{dynamic address@hidden people also refer to the
-final linking stage at program startup as `dynamic linking', so if you
-want to make yourself perfectly clear, it is probably best to use the
-more technical term @dfn{dlopening}, as suggested by Gordon Matzigkeit
-in his libtool documentation.}
-
-As with many aspects of Guile, there is a low-level way to access the
-dynamic linking apparatus, and a more high-level interface that
-integrates dynamically linked libraries into the module system.
-
address@hidden
-* Low level dynamic linking::   
-* Compiled Code Modules::       
-* Dynamic Linking and Compiled Code Modules::  
-* Compiled Code Installation::  
address@hidden menu
-
address@hidden Low level dynamic linking
address@hidden Low level dynamic linking
-
-When using the low level procedures to do your dynamic linking, you have
-complete control over which library is loaded when and what gets done
-with it.
-
address@hidden {Scheme Procedure} dynamic-link library
address@hidden {C Function} scm_dynamic_link (library)
-Find the shared library denoted by @var{library} (a string) and link it
-into the running Guile application.  When everything works out, return a
-Scheme object suitable for representing the linked object file.
-Otherwise an error is thrown.  How object files are searched is system
-dependent.
-
-Normally, @var{library} is just the name of some shared library file
-that will be searched for in the places where shared libraries usually
-reside, such as in @file{/usr/lib} and @file{/usr/local/lib}.
address@hidden deffn
-
address@hidden {Scheme Procedure} dynamic-object? obj
address@hidden {C Function} scm_dynamic_object_p (obj)
-Return @code{#t} if @var{obj} is a dynamic library handle, or @code{#f}
-otherwise.
address@hidden deffn
-
address@hidden {Scheme Procedure} dynamic-unlink dobj
address@hidden {C Function} scm_dynamic_unlink (dobj)
-Unlink the indicated object file from the application.  The
-argument @var{dobj} must have been obtained by a call to
address@hidden  After @code{dynamic-unlink} has been
-called on @var{dobj}, its content is no longer accessible.
address@hidden deffn
-
address@hidden {Scheme Procedure} dynamic-func name dobj
address@hidden {C Function} scm_dynamic_func (name, dobj)
-Search the dynamic object @var{dobj} for the C function
-indicated by the string @var{name} and return some Scheme
-handle that can later be used with @code{dynamic-call} to
-actually call the function.
-
-Regardless whether your C compiler prepends an underscore @samp{_} to
-the global names in a program, you should @strong{not} include this
-underscore in @var{function}.  Guile knows whether the underscore is
-needed or not and will add it when necessary.
address@hidden deffn
-
address@hidden {Scheme Procedure} dynamic-call func dobj
address@hidden {C Function} scm_dynamic_call (func, dobj)
-Call the C function indicated by @var{func} and @var{dobj}.
-The function is passed no arguments and its return value is
-ignored.  When @var{function} is something returned by
address@hidden, call that function and ignore @var{dobj}.
-When @var{func} is a string , look it up in @var{dynobj}; this
-is equivalent to
address@hidden
-(dynamic-call (dynamic-func @var{func} @var{dobj}) #f)
address@hidden smallexample
-
-Interrupts are deferred while the C function is executing (with
address@hidden/@code{SCM_ALLOW_INTS}).
address@hidden deffn
-
address@hidden {Scheme Procedure} dynamic-args-call func dobj args
address@hidden {C Function} scm_dynamic_args_call (func, dobj, args)
-Call the C function indicated by @var{func} and @var{dobj},
-just like @code{dynamic-call}, but pass it some arguments and
-return its return value.  The C function is expected to take
-two arguments and return an @code{int}, just like @code{main}:
address@hidden
-int c_func (int argc, char **argv);
address@hidden smallexample
-
-The parameter @var{args} must be a list of strings and is
-converted into an array of @code{char *}.  The array is passed
-in @var{argv} and its size in @var{argc}.  The return value is
-converted to a Scheme number and returned from the call to
address@hidden
address@hidden deffn
-
-When dynamic linking is disabled or not supported on your system,
-the above functions throw errors, but they are still available.
-
-Here is a small example that works on GNU/Linux:
-
address@hidden
-(define libc-obj (dynamic-link "libc.so"))
-libc-obj
address@hidden #<dynamic-object "libc.so">
-(dynamic-args-call 'rand libc-obj '())
address@hidden 269167349
-(dynamic-unlink libc-obj)
-libc-obj
address@hidden #<dynamic-object "libc.so" (unlinked)>
address@hidden smallexample
-
-As you can see, after calling @code{dynamic-unlink} on a dynamically
-linked library, it is marked as @samp{(unlinked)} and you are no longer
-able to use it with @code{dynamic-call}, etc.  Whether the library is
-really removed from you program is system-dependent and will generally
-not happen when some other parts of your program still use it.  In the
-example above, @code{libc} is almost certainly not removed from your
-program because it is badly needed by almost everything.
-
-The functions to call a function from a dynamically linked library,
address@hidden and @code{dynamic-args-call}, are not very powerful.
-They are mostly intended to be used for calling specially written
-initialization functions that will then add new primitives to Guile.
-For example, we do not expect that you will dynamically link
address@hidden with @code{dynamic-link} and then construct a beautiful
-graphical user interface just by using @code{dynamic-call} and
address@hidden  Instead, the usual way would be to write a
-special Guile<->X11 glue library that has intimate knowledge about both
-Guile and X11 and does whatever is necessary to make them inter-operate
-smoothly.  This glue library could then be dynamically linked into a
-vanilla Guile interpreter and activated by calling its initialization
-function.  That function would add all the new types and primitives to
-the Guile interpreter that it has to offer.
-
-From this setup the next logical step is to integrate these glue
-libraries into the module system of Guile so that you can load new
-primitives into a running system just as you can load new Scheme code.
-
-There is, however, another possibility to get a more thorough access to
-the functions contained in a dynamically linked library.  Anthony Green
-has written @file{libffi}, a library that implements a @dfn{foreign
-function interface} for a number of different platforms.  With it, you
-can extend the Spartan functionality of @code{dynamic-call} and
address@hidden considerably.  There is glue code available in
-the Guile contrib archive to make @file{libffi} accessible from Guile.
-
address@hidden Compiled Code Modules
address@hidden Putting Compiled Code into Modules
-
-The new primitives that you add to Guile with
address@hidden (@pxref{Primitive Procedures}) or with any
-of the other mechanisms are placed into the @code{(guile-user)} module
-by default.  However, it is also possible to put new primitives into
-other modules.
-
-The mechanism for doing so is not very well thought out and is likely to
-change when the module system of Guile itself is revised, but it is
-simple and useful enough to document it as it stands.
-
-What @code{scm_c_define_gsubr} and the functions used by the snarfer
-really do is to add the new primitives to whatever module is the
address@hidden module} when they are called.  This is analogous to the
-way Scheme code is put into modules: the @code{define-module} expression
-at the top of a Scheme source file creates a new module and makes it the
-current module while the rest of the file is evaluated.  The
address@hidden expressions in that file then add their new definitions to
-this current module.
-
-Therefore, all we need to do is to make sure that the right module is
-current when calling @code{scm_c_define_gsubr} for our new primitives.
-
address@hidden Dynamic Linking and Compiled Code Modules
address@hidden Dynamic Linking and Compiled Code Modules
-
-The most interesting application of dynamically linked libraries is
-probably to use them for providing @emph{compiled code modules} to
-Scheme programs.  As much fun as programming in Scheme is, every now and
-then comes the need to write some low-level C stuff to make Scheme even
-more fun.
-
-Not only can you put these new primitives into their own module (see the
-previous section), you can even put them into a shared library that is
-only then linked to your running Guile image when it is actually
-needed.
-
-An example will hopefully make everything clear.  Suppose we want to
-make the Bessel functions of the C library available to Scheme in the
-module @samp{(math bessel)}.  First we need to write the appropriate
-glue code to convert the arguments and return values of the functions
-from Scheme to C and back.  Additionally, we need a function that will
-add them to the set of Guile primitives.  Because this is just an
-example, we will only implement this for the @code{j0} function.
-
address@hidden FIXME::martin: Change all gh_ references to their scm_ 
equivalents.
-
address@hidden
-#include <math.h>
-#include <libguile.h>
-
-SCM
-j0_wrapper (SCM x)
address@hidden
-  return scm_double2num (j0 (scm_num2dbl (x, "j0")));
address@hidden
-
-void
-init_math_bessel ()
address@hidden
-  scm_c_define_gsubr ("j0", 1, 0, 0, j0_wrapper);
address@hidden
address@hidden smallexample
-
-We can already try to bring this into action by manually calling the low
-level functions for performing dynamic linking.  The C source file needs
-to be compiled into a shared library.  Here is how to do it on
-GNU/Linux, please refer to the @code{libtool} documentation for how to
-create dynamically linkable libraries portably.
-
address@hidden
-gcc -shared -o libbessel.so -fPIC bessel.c
address@hidden smallexample
-
-Now fire up Guile:
-
address@hidden
-(define bessel-lib (dynamic-link "./libbessel.so"))
-(dynamic-call "init_math_bessel" bessel-lib)
-(j0 2)
address@hidden 0.223890779141236
address@hidden lisp
-
-The filename @file{./libbessel.so} should be pointing to the shared
-library produced with the @code{gcc} command above, of course.  The
-second line of the Guile interaction will call the
address@hidden function which in turn will register the C
-function @code{j0_wrapper} with the Guile interpreter under the name
address@hidden  This function becomes immediately available and we can call
-it from Scheme.
-
-Fun, isn't it?  But we are only half way there.  This is what
address@hidden has to say about @code{j0}:
-
address@hidden
-(apropos "j0")
address@hidden (guile-user): j0     #<primitive-procedure j0>
address@hidden smallexample
-
-As you can see, @code{j0} is contained in the root module, where all
-the other Guile primitives like @code{display}, etc live.  In general,
-a primitive is put into whatever module is the @dfn{current module} at
-the time @code{scm_c_define_gsubr} is called.
-
-A compiled module should have a specially named @dfn{module init
-function}.  Guile knows about this special name and will call that
-function automatically after having linked in the shared library.  For
-our example, we replace @code{init_math_bessel} with the following code in
address@hidden:
-
address@hidden
-void
-init_math_bessel (void *unused)
address@hidden
-  scm_c_define_gsubr ("j0", 1, 0, 0, j0_wrapper);
-  scm_c_export ("j0", NULL);
address@hidden
-
-void
-scm_init_math_bessel_module ()
address@hidden
-  scm_c_define_module ("math bessel", init_math_bessel, NULL);   
address@hidden
address@hidden smallexample
-
-The general pattern for the name of a module init function is:
address@hidden, followed by the name of the module where the
-individual hierarchical components are concatenated with underscores,
-followed by @samp{_module}.
-
-After @file{libbessel.so} has been rebuilt, we need to place the shared
-library into the right place.
-
-Once the module has been correctly installed, it should be possible to
-use it like this:
-
address@hidden
-guile> (load-extension "./libbessel.so" "scm_init_math_bessel_module")
-guile> (use-modules (math bessel))
-guile> (j0 2)
-0.223890779141236
-guile> (apropos "j0")
address@hidden (math bessel): j0      #<primitive-procedure j0>
address@hidden smallexample
-
-That's it!
-
address@hidden {Scheme Procedure} load-extension lib init
address@hidden {C Function} scm_load_extension (lib, init)
-Load and initialize the extension designated by LIB and INIT.
-When there is no pre-registered function for LIB/INIT, this is
-equivalent to
-
address@hidden
-(dynamic-call INIT (dynamic-link LIB))
address@hidden lisp
-
-When there is a pre-registered function, that function is called
-instead.
-
-Normally, there is no pre-registered function.  This option exists
-only for situations where dynamic linking is unavailable or unwanted.
-In that case, you would statically link your program with the desired
-library, and register its init function right after Guile has been
-initialized.
-
-LIB should be a string denoting a shared library without any file type
-suffix such as ".so".  The suffix is provided automatically.  It
-should also not contain any directory components.  Libraries that
-implement Guile Extensions should be put into the normal locations for
-shared libraries.  We recommend to use the naming convention
-libguile-bla-blum for a extension related to a module `(bla blum)'.
-
-The normal way for a extension to be used is to write a small Scheme
-file that defines a module, and to load the extension into this
-module.  When the module is auto-loaded, the extension is loaded as
-well.  For example,
-
address@hidden
-(define-module (bla blum))
-
-(load-extension "libguile-bla-blum" "bla_init_blum")
address@hidden lisp
address@hidden deffn
-
-
address@hidden Compiled Code Installation
address@hidden Compiled Code Installation
-
-The simplest way to write a module using compiled C code is
-
address@hidden
-(define-module (foo bar))
-(load-extension "foobar-c-code" "foo_bar_init")
address@hidden example
-
-When loaded with @code{(use-modules (foo bar))}, the
address@hidden call looks for the @file{foobar-c-code.so} (etc)
-object file in the standard system locations, such as @file{/usr/lib}
-or @file{/usr/local/lib}.
-
-If someone installs your module to a non-standard location then the
-object file won't be found.  You can address this by inserting the
-install location in the @file{foo/bar.scm} file.  This is convenient
-for the user and also guarantees the intended object is read, even if
-stray older or newer versions are in the loader's path.
-
-The usual way to specify an install location is with a @code{prefix}
-at the configure stage, for instance @samp{./configure prefix=/opt}
-results in library files as say @file{/opt/lib/foobar-c-code.so}.
-When using Autoconf (@pxref{Top, , Introduction, autoconf, The GNU
-Autoconf Manual}), the library location is in a @code{libdir}
-variable.  Its value is intended to be expanded by @command{make}, and
-can by substituted into a source file like @file{foo.scm.in}
-
address@hidden
-(define-module (foo bar))
-(load-extension "XXlibdirXX/foobar-c-code" "foo_bar_init")
address@hidden example
-
address@hidden
-with the following in a @file{Makefile}, using @command{sed}
-(@pxref{Top, , Introduction, sed, SED, A Stream Editor}),
-
address@hidden
-foo.scm: foo.scm.in
-        sed 's|XXlibdirXX|$(libdir)|' <foo.scm.in >foo.scm
address@hidden example
-
-The actual pattern @code{XXlibdirXX} is arbitrary, it's only something
-which doesn't otherwise occur.  If several modules need the value, it
-can be easier to create one @file{foo/config.scm} with a define of the
address@hidden location, and use that as required.
-
address@hidden
-(define-module (foo config))
-(define-public foo-config-libdir "XXlibdirXX"")
address@hidden example
-
-Such a file might have other locations too, for instance a data
-directory for auxiliary files, or @code{localedir} if the module has
-its own @code{gettext} message catalogue
-(@pxref{Internationalization}).
-
-When installing multiple C code objects, it can be convenient to put
-them in a subdirectory of @code{libdir}, thus giving for example
address@hidden/usr/lib/foo/some-obj.so}.  If the objects are only meant to be
-used through the module, then a subdirectory keeps them out of sight.
-
-It will be noted all of the above requires that the Scheme code to be
-found in @code{%load-path} (@pxref{Build Config}).  Presently it's
-left up to the system administrator or each user to augment that path
-when installing Guile modules in non-default locations.  But having
-reached the Scheme code, that code should take care of hitting any of
-its own private files etc.
-
-Presently there's no convention for having a Guile version number in
-module C code filenames or directories.  This is primarily because
-there's no established principles for two versions of Guile to be
-installed under the same prefix (eg. two both under @file{/usr}).
-Assuming upward compatibility is maintained then this should be
-unnecessary, and if compatibility is not maintained then it's highly
-likely a package will need to be revisited anyway.
-
-The present suggestion is that modules should assume when they're
-installed under a particular @code{prefix} that there's a single
-version of Guile there, and the @code{guile-config} at build time has
-the necessary information about it.  C code or Scheme code might adapt
-itself accordingly (allowing for features not available in an older
-version for instance).
-
 
 @node Variables
 @subsection Variables
@@ -1374,9 +917,6 @@ name @var{name} in the current module.  But they can also 
be created
 dynamically by calling one of the constructor procedures
 @code{make-variable} and @code{make-undefined-variable}.
 
-First-class variables are especially useful for interacting with the
-current module system (@pxref{The Guile module system}).
-
 @deffn {Scheme Procedure} make-undefined-variable
 @deffnx {C Function} scm_make_undefined_variable ()
 Return a variable that is initially unbound.
@@ -1414,6 +954,83 @@ return @code{#f}.
 @end deffn
 
 
address@hidden provide and require
address@hidden provide and require
+
+Aubrey Jaffer, mostly to support his portable Scheme library SLIB,
+implemented a provide/require mechanism for many Scheme implementations.
+Library files in SLIB @emph{provide} a feature, and when user programs
address@hidden that feature, the library file is loaded in.
+
+For example, the file @file{random.scm} in the SLIB package contains the
+line
+
address@hidden
+(provide 'random)
address@hidden lisp
+
+so to use its procedures, a user would type
+
address@hidden
+(require 'random)
address@hidden lisp
+
+and they would magically become available, @emph{but still have the same
+names!}  So this method is nice, but not as good as a full-featured
+module system.
+
+When SLIB is used with Guile, provide and require can be used to access
+its facilities.
+
address@hidden Environments
address@hidden Environments
address@hidden environment
+
+Scheme, as defined in R5RS, does @emph{not} have a full module system.
+However it does define the concept of a top-level @dfn{environment}.
+Such an environment maps identifiers (symbols) to Scheme objects such
+as procedures and lists: @ref{About Closure}.  In other words, it
+implements a set of @dfn{bindings}.
+
+Environments in R5RS can be passed as the second argument to
address@hidden (@pxref{Fly Evaluation}).  Three procedures are defined to
+return environments: @code{scheme-report-environment},
address@hidden and @code{interaction-environment} (@pxref{Fly
+Evaluation}).
+
+In addition, in Guile any module can be used as an R5RS environment,
+i.e., passed as the second argument to @code{eval}.
+
+Note: the following two procedures are available only when the 
address@hidden(ice-9 r5rs)} module is loaded:
+
address@hidden
+(use-modules (ice-9 r5rs))
address@hidden lisp
+
address@hidden {Scheme Procedure} scheme-report-environment version
address@hidden {Scheme Procedure} null-environment version
address@hidden must be the exact integer `5', corresponding to revision
+5 of the Scheme report (the Revised^5 Report on Scheme).
address@hidden returns a specifier for an
+environment that is empty except for all bindings defined in the
+report that are either required or both optional and supported by the
+implementation. @code{null-environment} returns a specifier for an
+environment that is empty except for the (syntactic) bindings for all
+syntactic keywords defined in the report that are either required or
+both optional and supported by the implementation.
+
+Currently Guile does not support values of @var{version} for other
+revisions of the report.
+
+The effect of assigning (through the use of @code{eval}) a variable
+bound in a @code{scheme-report-environment} (for example @code{car})
+is unspecified.  Currently the environments specified by
address@hidden are not immutable in Guile.
address@hidden deffn
+
+
+
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/api-options.texi b/doc/ref/api-options.texi
index 464c7f0..b44bb18 100644
--- a/doc/ref/api-options.texi
+++ b/doc/ref/api-options.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2008, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2006, 2008, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -509,6 +509,7 @@ keywords         #f      Style of keyword recognition: #f, 
'prefix or 'postfix
 case-insensitive no      Convert symbols to lower case.
 positions        yes     Record positions of source code expressions.
 copy             no      Copy source code expressions.
+r6rs-hex-escapes no      Use R6RS-style string and character hex escapes
 @end smalllisp
 
 Notice that while Standard Scheme is case insensitive, to ease
@@ -521,6 +522,9 @@ To make Guile case insensitive, you can type
 (read-enable 'case-insensitive)
 @end lisp
 
+For more information on the effect of the @code{r6rs-hex-escapes} option, see
+(@pxref{Characters}) and (@pxref{String Syntax}).
+
 @node Printing options
 @subsubsection Printing options
 
diff --git a/doc/ref/api-procedures.texi b/doc/ref/api-procedures.texi
index 0644556..a2f647c 100644
--- a/doc/ref/api-procedures.texi
+++ b/doc/ref/api-procedures.texi
@@ -1,11 +1,11 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
address@hidden Procedures and Macros
address@hidden Procedures and Macros
address@hidden Procedures
address@hidden Procedures
 
 @menu
 * Lambda::                      Basic procedure creation using lambda.
@@ -15,10 +15,6 @@
 * Case-lambda::                 One function, multiple arities.
 * Procedure Properties::        Procedure properties and meta-information.
 * Procedures with Setters::     Procedures with setters.
-* Macros::                      Lisp style macro definitions.
-* Syntax Rules::                Support for R5RS @code{syntax-rules}.
-* Syntax Case::                 Support for the @code{syntax-case} system.
-* Internal Macros::             Guile's internal representation.
 @end menu
 
 
@@ -111,7 +107,7 @@ the given @var{name} but no environment binding will be 
created.  The
 arguments @var{req}, @var{opt} and @var{rst} specify the number of
 required, optional and ``rest'' arguments respectively.  The total
 number of these arguments should match the actual number of arguments
-to @var{fcn}.  The number of rest arguments should be 0 or 1.
+to @var{fcn}, but may not exceed 10.  The number of rest arguments should be 0 
or 1.
 @code{scm_c_make_gsubr} returns a value of type @code{SCM} which is a
 ``handle'' for the procedure.
 @end deftypefun
@@ -767,8 +763,8 @@ associated setter procedure.
 
 @deffn {Scheme Procedure} procedure proc
 @deffnx {C Function} scm_procedure (proc)
-Return the procedure of @var{proc}, which must be either a
-procedure with setter, or an operator struct.
+Return the procedure of @var{proc}, which must be an
+applicable struct.
 @end deffn
 
 @deffn {Scheme Procedure} setter proc
@@ -777,290 +773,6 @@ setter or an operator struct.
 @end deffn
 
 
address@hidden Macros
address@hidden Lisp Style Macro Definitions
-
address@hidden macros
address@hidden transformation
-Macros are objects which cause the expression that they appear in to be
-transformed in some way @emph{before} being evaluated.  In expressions
-that are intended for macro transformation, the identifier that names
-the relevant macro must appear as the first element, like this:
-
address@hidden
-(@var{macro-name} @var{macro-args} @dots{})
address@hidden lisp
-
-In Lisp-like languages, the traditional way to define macros is very
-similar to procedure definitions.  The key differences are that the
-macro definition body should return a list that describes the
-transformed expression, and that the definition is marked as a macro
-definition (rather than a procedure definition) by the use of a
-different definition keyword: in Lisp, @code{defmacro} rather than
address@hidden, and in Scheme, @code{define-macro} rather than
address@hidden
-
address@hidden defmacro
address@hidden define-macro
-Guile supports this style of macro definition using both @code{defmacro}
-and @code{define-macro}.  The only difference between them is how the
-macro name and arguments are grouped together in the definition:
-
address@hidden
-(defmacro @var{name} (@var{args} @dots{}) @var{body} @dots{})
address@hidden lisp
-
address@hidden
-is the same as
-
address@hidden
-(define-macro (@var{name} @var{args} @dots{}) @var{body} @dots{})
address@hidden lisp
-
address@hidden
-The difference is analogous to the corresponding difference between
-Lisp's @code{defun} and Scheme's @code{define}.
-
address@hidden, from the @file{boot-9.scm} file in the Guile
-distribution, is a good example of macro definition using
address@hidden:
-
address@hidden
-(defmacro false-if-exception (expr)
-  `(catch #t
-          (lambda () ,expr)
-          (lambda args #f)))
address@hidden lisp
-
address@hidden
-The effect of this definition is that expressions beginning with the
-identifier @code{false-if-exception} are automatically transformed into
-a @code{catch} expression following the macro definition specification.
-For example:
-
address@hidden
-(false-if-exception (open-input-file "may-not-exist"))
address@hidden
-(catch #t
-       (lambda () (open-input-file "may-not-exist"))
-       (lambda args #f))
address@hidden lisp
-
-
address@hidden Syntax Rules
address@hidden The R5RS @code{syntax-rules} System
address@hidden R5RS syntax-rules system
-
-R5RS defines an alternative system for macro and syntax transformations
-using the keywords @code{define-syntax}, @code{let-syntax},
address@hidden and @code{syntax-rules}.
-
-The main difference between the R5RS system and the traditional macros
-of the previous section is how the transformation is specified.  In
-R5RS, rather than permitting a macro definition to return an arbitrary
-expression, the transformation is specified in a pattern language that
-
address@hidden @bullet
address@hidden
-does not require complicated quoting and extraction of components of the
-source expression using @code{caddr} etc.
-
address@hidden
-is designed such that the bindings associated with identifiers in the
-transformed expression are well defined, and such that it is impossible
-for the transformed expression to construct new identifiers.
address@hidden itemize
-
address@hidden
-The last point is commonly referred to as being @dfn{hygienic}: the R5RS
address@hidden system provides @dfn{hygienic macros}.
-
-For example, the R5RS pattern language for the @code{false-if-exception}
-example of the previous section looks like this:
-
address@hidden
-(syntax-rules ()
-  ((_ expr)
-   (catch #t
-          (lambda () expr)
-          (lambda args #f))))
address@hidden lisp
-
address@hidden @code{syncase}
-In Guile, the @code{syntax-rules} system is provided by the @code{(ice-9
-syncase)} module.  To make these facilities available in your code,
-include the expression @code{(use-syntax (ice-9 syncase))} (@pxref{Using
-Guile Modules}) before the first usage of @code{define-syntax} etc.  If
-you are writing a Scheme module, you can alternatively include the form
address@hidden:use-syntax (ice-9 syncase)} in your @code{define-module}
-declaration (@pxref{Creating Guile Modules}).
-
address@hidden
-* Pattern Language::            The @code{syntax-rules} pattern language.
-* Define-Syntax::               Top level syntax definitions.
-* Let-Syntax::                  Local syntax definitions.
address@hidden menu
-
-
address@hidden Pattern Language
address@hidden The @code{syntax-rules} Pattern Language
-
-
address@hidden Define-Syntax
address@hidden Top Level Syntax Definitions
-
-define-syntax:  The gist is
-
-  (define-syntax <keyword> <transformer-spec>)
-
-makes the <keyword> into a macro so that
-
-  (<keyword> ...)
-
-expands at _compile_ or _read_ time (i.e. before any
-evaluation begins) into some expression that is
-given by the <transformer-spec>.
-
-
address@hidden Let-Syntax
address@hidden Local Syntax Definitions
-
-
address@hidden Syntax Case
address@hidden Support for the @code{syntax-case} System
-
-
-
address@hidden Internal Macros
address@hidden Internal Representation of Macros and Syntax
-
-[FIXME: used to be true. Isn't any more. Use syntax-rules or
-syntax-case please :)]
-
-Internally, Guile uses three different flavors of macros.  The three
-flavors are called @dfn{acro} (or @dfn{syntax}), @dfn{macro} and
address@hidden
-
-Given the expression
-
address@hidden
-(foo @dots{})
address@hidden lisp
-
address@hidden
-with @code{foo} being some flavor of macro, one of the following things
-will happen when the expression is evaluated.
-
address@hidden @bullet
address@hidden
-When @code{foo} has been defined to be an @dfn{acro}, the procedure used
-in the acro definition of @code{foo} is passed the whole expression and
-the current lexical environment, and whatever that procedure returns is
-the value of evaluating the expression.  You can think of this a
-procedure that receives its argument as an unevaluated expression.
-
address@hidden
-When @code{foo} has been defined to be a @dfn{macro}, the procedure used
-in the macro definition of @code{foo} is passed the whole expression and
-the current lexical environment, and whatever that procedure returns is
-evaluated again.  That is, the procedure should return a valid Scheme
-expression.
-
address@hidden
-When @code{foo} has been defined to be a @dfn{mmacro}, the procedure
-used in the mmacro definition of `foo' is passed the whole expression
-and the current lexical environment, and whatever that procedure returns
-replaces the original expression.  Evaluation then starts over from the
-new expression that has just been returned.
address@hidden itemize
-
-The key difference between a @dfn{macro} and a @dfn{mmacro} is that the
-expression returned by a @dfn{mmacro} procedure is remembered (or
address@hidden) so that the expansion does not need to be done again
-next time the containing code is evaluated.
-
-The primitives @code{procedure->syntax}, @code{procedure->macro} and
address@hidden>memoizing-macro} are used to construct acros, macros
-and mmacros respectively.  However, if you do not have a very special
-reason to use one of these primitives, you should avoid them: they are
-very specific to Guile's current implementation and therefore likely to
-change.  Use @code{defmacro}, @code{define-macro} (@pxref{Macros}) or
address@hidden (@pxref{Syntax Rules}) instead.  (In low level
-terms, @code{defmacro}, @code{define-macro} and @code{define-syntax} are
-all implemented as mmacros.)
-
address@hidden {Scheme Procedure} procedure->syntax code
address@hidden {C Function} scm_makacro (code)
-Return a macro which, when a symbol defined to this value appears as the
-first symbol in an expression, returns the result of applying @var{code}
-to the expression and the environment.
address@hidden deffn
-
address@hidden {Scheme Procedure} procedure->macro code
address@hidden {C Function} scm_makmacro (code)
-Return a macro which, when a symbol defined to this value appears as the
-first symbol in an expression, evaluates the result of applying
address@hidden to the expression and the environment.  For example:
-
address@hidden
-(define trace
-  (procedure->macro
-    (lambda (x env)
-      `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
-
-(trace @i{foo})
address@hidden
-(set! @i{foo} (tracef @i{foo} '@i{foo})).
address@hidden lisp
address@hidden deffn
-
address@hidden {Scheme Procedure} procedure->memoizing-macro code
address@hidden {C Function} scm_makmmacro (code)
-Return a macro which, when a symbol defined to this value appears as the
-first symbol in an expression, evaluates the result of applying
address@hidden to the expression and the environment.
address@hidden>memoizing-macro} is the same as
address@hidden>macro}, except that the expression returned by
address@hidden replaces the original macro expression in the memoized form
-of the containing code.
address@hidden deffn
-
-In the following primitives, @dfn{acro} flavor macros are referred to
-as @dfn{syntax transformers}.
-
address@hidden {Scheme Procedure} macro? obj
address@hidden {C Function} scm_macro_p (obj)
-Return @code{#t} if @var{obj} is a regular macro, a memoizing macro or a
-syntax transformer.
address@hidden deffn
-
address@hidden {Scheme Procedure} macro-type m
address@hidden {C Function} scm_macro_type (m)
-Return one of the symbols @code{syntax}, @code{macro} or
address@hidden, depending on whether @var{m} is a syntax
-transformer, a regular macro, or a memoizing macro,
-respectively.  If @var{m} is not a macro, @code{#f} is
-returned.
address@hidden deffn
-
address@hidden {Scheme Procedure} macro-name m
address@hidden {C Function} scm_macro_name (m)
-Return the name of the macro @var{m}.
address@hidden deffn
-
address@hidden {Scheme Procedure} macro-transformer m
address@hidden {C Function} scm_macro_transformer (m)
-Return the transformer of the macro @var{m}.
address@hidden deffn
-
address@hidden {Scheme Procedure} cons-source xorig x y
address@hidden {C Function} scm_cons_source (xorig, x, y)
-Create and return a new pair whose car and cdr are @var{x} and @var{y}.
-Any source properties associated with @var{xorig} are also associated
-with the new pair.
address@hidden deffn
-
-
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/api-undocumented.texi b/doc/ref/api-undocumented.texi
index ef1df19..cae96bc 100644
--- a/doc/ref/api-undocumented.texi
+++ b/doc/ref/api-undocumented.texi
@@ -155,7 +155,7 @@ has been passed to scm_register_module_xxx.
 
 @deffn {Scheme Procedure} module-import-interface module sym
 @deffnx {C Function} scm_module_import_interface (module, sym)
-
+Return the module or interface from which @var{sym} is imported in 
@var{module}.  If @var{sym} is not imported (i.e., it is not defined in 
@var{module} or it is a module-local binding instead of an imported one), then 
@code{#f} is returned.
 @end deffn
 
 
@@ -623,7 +623,7 @@ on the C level which depends on the loaded GOOPS modules.
 
 @deffn {Scheme Procedure} %method-more-specific? m1 m2 targs
 @deffnx {C Function} scm_sys_method_more_specific_p (m1, m2, targs)
-
+Return true if method @var{m1} is more specific than @var{m2} given the 
argument types (classes) listed in @var{targs}.
 @end deffn
 
 @deffn {Scheme Procedure} find-method . l
diff --git a/doc/ref/data-rep.texi b/doc/ref/data-rep.texi
index 5f2a22b..7e80478 100644
--- a/doc/ref/data-rep.texi
+++ b/doc/ref/data-rep.texi
@@ -1,11 +1,11 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
address@hidden Data Representation in Scheme
address@hidden Data Representation in Scheme
address@hidden Data Representation
address@hidden Data Representation
 
 Scheme is a latently-typed language; this means that the system cannot,
 in general, determine the type of a given expression at compile time.
@@ -27,27 +27,25 @@ single type large enough to hold either a complete value or 
a pointer
 to a complete value, along with the necessary typing information.
 
 The following sections will present a simple typing system, and then
-make some refinements to correct its major weaknesses.  However, this is
-not a description of the system Guile actually uses.  It is only an
-illustration of the issues Guile's system must address.  We provide all
-the information one needs to work with Guile's data in @ref{The
-Libguile Runtime Environment}.
-
+make some refinements to correct its major weaknesses. We then conclude
+with a discussion of specific choices that Guile has made regarding
+garbage collection and data representation.
 
 @menu
 * A Simple Representation::     
 * Faster Integers::             
 * Cheaper Pairs::               
-* Guile Is Hairier::            
+* Conservative GC::          
+* The SCM Type in Guile::
 @end menu
 
 @node A Simple Representation
 @subsection A Simple Representation
 
-The simplest way to meet the above requirements in C would be to
-represent each value as a pointer to a structure containing a type
-indicator, followed by a union carrying the real value.  Assuming that
address@hidden is the name of our universal type, we can write:
+The simplest way to represent Scheme values in C would be to represent
+each value as a pointer to a structure containing a type indicator,
+followed by a union carrying the real value. Assuming that @code{SCM} is
+the name of our universal type, we can write:
 
 @example
 enum type @{ integer, pair, string, vector, ... @};
@@ -98,17 +96,17 @@ too costly, in both time and space.  Integers should be 
very cheap to
 create and manipulate.
 
 One possible solution comes from the observation that, on many
-architectures, structures must be aligned on a four-byte boundary.
-(Whether or not the machine actually requires it, we can write our own
-allocator for @code{struct value} objects that assures this is true.)
-In this case, the lower two bits of the structure's address are known to
-be zero.
+architectures, heap-allocated data (i.e., what you get when you call
address@hidden) must be aligned on an eight-byte boundary. (Whether or
+not the machine actually requires it, we can write our own allocator for
address@hidden value} objects that assures this is true.) In this case,
+the lower three bits of the structure's address are known to be zero.
 
 This gives us the room we need to provide an improved representation
 for integers.  We make the following rules:
 @itemize @bullet
 @item
-If the lower two bits of an @code{SCM} value are zero, then the SCM
+If the lower three bits of an @code{SCM} value are zero, then the SCM
 value is a pointer to a @code{struct value}, and everything proceeds as
 before.
 @item
@@ -132,11 +130,11 @@ struct value @{
   @} value;
 @};
 
-#define POINTER_P(x) (((int) (x) & 3) == 0)
+#define POINTER_P(x) (((int) (x) & 7) == 0)
 #define INTEGER_P(x) (! POINTER_P (x))
 
-#define GET_INTEGER(x)  ((int) (x) >> 2)
-#define MAKE_INTEGER(x) ((SCM) (((x) << 2) | 1))
+#define GET_INTEGER(x)  ((int) (x) >> 3)
+#define MAKE_INTEGER(x) ((SCM) (((x) << 3) | 1))
 @end example
 
 Notice that @code{integer} no longer appears as an element of @code{enum
@@ -174,34 +172,36 @@ integers, we can compute their sum as follows:
 @example
 MAKE_INTEGER (GET_INTEGER (@var{x}) + GET_INTEGER (@var{y}))
 @end example
-Now, integer math requires no allocation or memory references.  Most
-real Scheme systems actually use an even more efficient representation,
-but this essay isn't about bit-twiddling.  (Hint: what if pointers had
address@hidden in their least significant bits, and integers had @code{00}?)
+Now, integer math requires no allocation or memory references. Most real
+Scheme systems actually implement addition and other operations using an
+even more efficient algorithm, but this essay isn't about
+bit-twiddling. (Hint: how do you decide when to overflow to a bignum?
+How would you do it in assembly?)
 
 
 @node Cheaper Pairs
 @subsection Cheaper Pairs
 
-However, there is yet another issue to confront.  Most Scheme heaps
-contain more pairs than any other type of object; Jonathan Rees says
-that pairs occupy 45% of the heap in his Scheme implementation, Scheme
-48.  However, our representation above spends three @code{SCM}-sized
-words per pair --- one for the type, and two for the @sc{car} and
address@hidden  Is there any way to represent pairs using only two words?
+However, there is yet another issue to confront. Most Scheme heaps
+contain more pairs than any other type of object; Jonathan Rees said at
+one point that pairs occupy 45% of the heap in his Scheme
+implementation, Scheme 48. However, our representation above spends
+three @code{SCM}-sized words per pair --- one for the type, and two for
+the @sc{car} and @sc{cdr}. Is there any way to represent pairs using
+only two words?
 
 Let us refine the convention we established earlier.  Let us assert
 that:
 @itemize @bullet
 @item
-  If the bottom two bits of an @code{SCM} value are @code{#b00}, then
+  If the bottom three bits of an @code{SCM} value are @code{#b000}, then
   it is a pointer, as before.
 @item
-  If the bottom two bits are @code{#b01}, then the upper bits are an
+  If the bottom three bits are @code{#b001}, then the upper bits are an
   integer.  This is a bit more restrictive than before.
 @item
-  If the bottom two bits are @code{#b10}, then the value, with the bottom
-  two bits masked out, is the address of a pair.
+  If the bottom two bits are @code{#b010}, then the value, with the bottom
+  three bits masked out, is the address of a pair.
 @end itemize
 
 Here is the new C code:
@@ -223,14 +223,14 @@ struct pair @{
   SCM car, cdr;
 @};
 
-#define POINTER_P(x) (((int) (x) & 3) == 0)
+#define POINTER_P(x) (((int) (x) & 7) == 0)
 
-#define INTEGER_P(x)  (((int) (x) & 3) == 1)
-#define GET_INTEGER(x)  ((int) (x) >> 2)
-#define MAKE_INTEGER(x) ((SCM) (((x) << 2) | 1))
+#define INTEGER_P(x)  (((int) (x) & 7) == 1)
+#define GET_INTEGER(x)  ((int) (x) >> 3)
+#define MAKE_INTEGER(x) ((SCM) (((x) << 3) | 1))
 
-#define PAIR_P(x) (((int) (x) & 3) == 2)
-#define GET_PAIR(x) ((struct pair *) ((int) (x) & ~3))
+#define PAIR_P(x) (((int) (x) & 7) == 2)
+#define GET_PAIR(x) ((struct pair *) ((int) (x) & ~7))
 @end example
 
 Notice that @code{enum type} and @code{struct value} now only contain
@@ -278,94 +278,32 @@ are referencing, making a modified pointer as fast to use 
as an
 unmodified pointer.
 
 
address@hidden Guile Is Hairier
address@hidden Guile Is Hairier
-
-We originally started with a very simple typing system --- each object
-has a field that indicates its type.  Then, for the sake of efficiency
-in both time and space, we moved some of the typing information directly
-into the @code{SCM} value, and left the rest in the @code{struct value}.
-Guile itself employs a more complex hierarchy, storing finer and finer
-gradations of type information in different places, depending on the
-object's coarser type.
-
-In the author's opinion, Guile could be simplified greatly without
-significant loss of efficiency, but the simplified system would still be
-more complex than what we've presented above.
-
-
address@hidden The Libguile Runtime Environment
address@hidden The Libguile Runtime Environment
-
-Here we present the specifics of how Guile represents its data.  We
-don't go into complete detail; an exhaustive description of Guile's
-system would be boring, and we do not wish to encourage people to write
-code which depends on its details anyway.  We do, however, present
-everything one need know to use Guile's data. It is assumed that the
-reader understands the concepts laid out in @ref{Data Representation
-in Scheme}.
-
-FIXME: much of this is outdated as of 1.8, we don't provide many of
-these macros any more. Also here we're missing sections about the
-evaluator implementation, which is interesting, and notes about tail
-recursion between scheme and c.
-
address@hidden
-* General Rules::               
-* Conservative GC::          
-* Immediates vs Non-immediates::  
-* Immediate Datatypes::         
-* Non-immediate Datatypes::     
-* Signalling Type Errors::      
-* Unpacking the SCM type::
address@hidden menu
-
address@hidden General Rules
address@hidden General Rules
-
-Any code which operates on Guile datatypes must @code{#include} the
-header file @code{<libguile.h>}.  This file contains a definition for
-the @code{SCM} typedef (Guile's universal type, as in the examples
-above), and definitions and declarations for a host of macros and
-functions that operate on @code{SCM} values.
-
-All identifiers declared by @code{<libguile.h>} begin with @code{scm_}
-or @code{SCM_}.
-
address@hidden [[I wish this were true, but I don't think it is at the moment. 
-JimB]]
address@hidden Macros do not evaluate their arguments more than once, unless 
documented
address@hidden to do so.
-
-The functions described here generally check the types of their
address@hidden arguments, and signal an error if their arguments are of an
-inappropriate type.  Macros generally do not, unless that is their
-specified purpose.  You must verify their argument types beforehand, as
-necessary.
-
-Macros and functions that return a boolean value have names ending in
address@hidden or @code{_p} (for ``predicate'').  Those that return a negated
-boolean value have names starting with @code{SCM_N}.  For example,
address@hidden (@var{x})} is a predicate which returns non-zero iff
address@hidden is an immediate value (an @code{IM}).  @code{SCM_NCONSP
-(@var{x})} is a predicate which returns non-zero iff @var{x} is
address@hidden a pair object (a @code{CONS}).
-
-
 @node Conservative GC
 @subsection Conservative Garbage Collection
 
 Aside from the latent typing, the major source of constraints on a
 Scheme implementation's data representation is the garbage collector.
 The collector must be able to traverse every live object in the heap, to
-determine which objects are not live.
-
-There are many ways to implement this, but Guile uses an algorithm
-called @dfn{mark and sweep}.  The collector scans the system's global
-variables and the local variables on the stack to determine which
-objects are immediately accessible by the C code.  It then scans those
-objects to find the objects they point to, @i{et cetera}.  The collector
-sets a @dfn{mark bit} on each object it finds, so each object is
-traversed only once.  This process is called @dfn{tracing}.
+determine which objects are not live, and thus collectable.
+
+There are many ways to implement this. Guile's garbage collection is
+built on a library, the Boehm-Demers-Weiser conservative garbage
+collector (BDW-GC). The BDW-GC ``just works'', for the most part. But
+since it is interesting to know how these things work, we include here a
+high-level description of what the BDW-GC does.
+
+Garbage collection has two logical phases: a @dfn{mark} phase, in which
+the set of live objects is enumerated, and a @dfn{sweep} phase, in which
+objects not traversed in the mark phase are collected. Correct
+functioning of the collector depends on being able to traverse the
+entire set of live objects.
+
+In the mark phase, the collector scans the system's global variables and
+the local variables on the stack to determine which objects are
+immediately accessible by the C code. It then scans those objects to
+find the objects they point to, and so on. The collector logically sets
+a @dfn{mark bit} on each object it finds, so each object is traversed
+only once.
 
 When the collector can find no unmarked objects pointed to by marked
 objects, it assumes that any objects that are still unmarked will never
@@ -380,9 +318,9 @@ to all global variables that refer to the heap, and another 
list
 for the collector's benefit.
 
 The list of global variables is usually not too difficult to maintain,
-since global variables are relatively rare.  However, an explicitly
+since global variables are relatively rare. However, an explicitly
 maintained list of local variables (in the author's personal experience)
-is a nightmare to maintain.  Thus, Guile uses a technique called
+is a nightmare to maintain. Thus, the BDW-GC uses a technique called
 @dfn{conservative garbage collection}, to make the local variable list
 unnecessary.
 
@@ -392,50 +330,21 @@ is a pointer into the heap.  Thus, the collector marks 
all objects whose
 addresses appear anywhere in the stack, without knowing for sure how
 that word is meant to be interpreted.
 
+In addition to the stack, the BDW-GC will also scan static data
+sections. This means that global variables are also scanned when looking
+for live Scheme objects.
+
 Obviously, such a system will occasionally retain objects that are
-actually garbage, and should be freed.  In practice, this is not a
-problem.  The alternative, an explicitly maintained list of local
+actually garbage, and should be freed. In practice, this is not a
+problem. The alternative, an explicitly maintained list of local
 variable addresses, is effectively much less reliable, due to programmer
-error.
-
-To accommodate this technique, data must be represented so that the
-collector can accurately determine whether a given stack word is a
-pointer or not.  Guile does this as follows:
-
address@hidden @bullet
address@hidden
-Every heap object has a two-word header, called a @dfn{cell}.  Some
-objects, like pairs, fit entirely in a cell's two words; others may
-store pointers to additional memory in either of the words.  For
-example, strings and vectors store their length in the first word, and a
-pointer to their elements in the second.
-
address@hidden
-Guile allocates whole arrays of cells at a time, called @dfn{heap
-segments}.  These segments are always allocated so that the cells they
-contain fall on eight-byte boundaries, or whatever is appropriate for
-the machine's word size.  Guile keeps all cells in a heap segment
-initialized, whether or not they are currently in use.
-
address@hidden
-Guile maintains a sorted table of heap segments.
address@hidden itemize
-
-Thus, given any random word @var{w} fetched from the stack, Guile's
-garbage collector can consult the table to see if @var{w} falls within a
-known heap segment, and check @var{w}'s alignment.  If both tests pass,
-the collector knows that @var{w} is a valid pointer to a cell,
-intentional or not, and proceeds to trace the cell.
-
-Note that heap segments do not contain all the data Guile uses; cells
-for objects like vectors and strings contain pointers to other memory
-areas.  However, since those pointers are internal, and not shared among
-many pieces of code, it is enough for the collector to find the cell,
-and then use the cell's type to find more pointers to trace.
+error. Interested readers should see the BDW-GC web page at
address@hidden://www.hpl.hp.com/personal/Hans_Boehm/gc}, for more
+information.
 
 
address@hidden Immediates vs Non-immediates
address@hidden Immediates vs Non-immediates
address@hidden The SCM Type in Guile
address@hidden The SCM Type in Guile
 
 Guile classifies Scheme objects into two kinds: those that fit entirely
 within an @code{SCM}, and those that require heap storage.
@@ -446,481 +355,15 @@ mysterious end-of-file object, and some others.
 
 The remaining types are called, not surprisingly, @dfn{non-immediates}.
 They include pairs, procedures, strings, vectors, and all other data
-types in Guile.
-
address@hidden Macro int SCM_IMP (SCM @var{x})
-Return non-zero iff @var{x} is an immediate object.
address@hidden deftypefn
-
address@hidden Macro int SCM_NIMP (SCM @var{x})
-Return non-zero iff @var{x} is a non-immediate object.  This is the
-exact complement of @code{SCM_IMP}, above.
address@hidden deftypefn
-
-Note that for versions of Guile prior to 1.4 it was necessary to use the
address@hidden macro before calling a finer-grained predicate to
-determine @var{x}'s type, such as @code{SCM_CONSP} or
address@hidden  This is no longer required: the definitions of all
-Guile type predicates now include a call to @code{SCM_NIMP} where
-necessary.
-
-
address@hidden Immediate Datatypes
address@hidden Immediate Datatypes
-
-The following datatypes are immediate values; that is, they fit entirely
-within an @code{SCM} value.  The @code{SCM_IMP} and @code{SCM_NIMP}
-macros will distinguish these from non-immediates; see @ref{Immediates
-vs Non-immediates} for an explanation of the distinction.
-
-Note that the type predicates for immediate values work correctly on any
address@hidden value; you do not need to call @code{SCM_IMP} first, to
-establish that a value is immediate.
-
address@hidden
-* Integer Data::                    
-* Character Data::                  
-* Boolean Data::                    
-* Unique Values::               
address@hidden menu
-
address@hidden Integer Data
address@hidden Integers
-
-Here are functions for operating on small integers, that fit within an
address@hidden  Such integers are called @dfn{immediate numbers}, or
address@hidden  In general, INUMs occupy all but two bits of an
address@hidden
-
-Bignums and floating-point numbers are non-immediate objects, and have
-their own, separate accessors.  The functions here will not work on
-them.  This is not as much of a problem as you might think, however,
-because the system never constructs bignums that could fit in an INUM,
-and never uses floating point values for exact integers.
-
address@hidden Macro int SCM_INUMP (SCM @var{x})
-Return non-zero iff @var{x} is a small integer value.
address@hidden deftypefn
-
address@hidden Macro int SCM_NINUMP (SCM @var{x})
-The complement of SCM_INUMP.
address@hidden deftypefn
-
address@hidden Macro int SCM_INUM (SCM @var{x})
-Return the value of @var{x} as an ordinary, C integer.  If @var{x}
-is not an INUM, the result is undefined.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_MAKINUM (int @var{i})
-Given a C integer @var{i}, return its representation as an @code{SCM}.
-This function does not check for overflow.
address@hidden deftypefn
-
+types in Guile. For non-immediates, the @code{SCM} word contains a
+pointer to data on the heap, with further information about the object
+in question is stored in that data.
 
address@hidden Character Data
address@hidden Characters
-
-Here are functions for operating on characters.
-
address@hidden Macro int SCM_CHARP (SCM @var{x})
-Return non-zero iff @var{x} is a character value.
address@hidden deftypefn
-
address@hidden Macro {unsigned int} SCM_CHAR (SCM @var{x})
-Return the value of @code{x} as a C character.  If @var{x} is not a
-Scheme character, the result is undefined.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_MAKE_CHAR (int @var{c})
-Given a C character @var{c}, return its representation as a Scheme
-character value.
address@hidden deftypefn
-
-
address@hidden Boolean Data
address@hidden Booleans
-
-Booleans are represented as two specific immediate SCM values,
address@hidden and @code{SCM_BOOL_F}.  @xref{Booleans}, for more
+This section describes how the @code{SCM} type is actually represented
+and used at the C level. Interested readers should see
address@hidden/tags.h} for an exposition of how Guile stores type
 information.
 
address@hidden Unique Values
address@hidden Unique Values
-
-The immediate values that are neither small integers, characters, nor
-booleans are all unique values --- that is, datatypes with only one
-instance.
-
address@hidden Macro SCM SCM_EOL
-The Scheme empty list object, or ``End Of List'' object, usually written
-in Scheme as @code{'()}.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_EOF_VAL
-The Scheme end-of-file value.  It has no standard written
-representation, for obvious reasons.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_UNSPECIFIED
-The value returned by expressions which the Scheme standard says return
-an ``unspecified'' value.
-
-This is sort of a weirdly literal way to take things, but the standard
-read-eval-print loop prints nothing when the expression returns this
-value, so it's not a bad idea to return this when you can't think of
-anything else helpful.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_UNDEFINED
-The ``undefined'' value.  Its most important property is that is not
-equal to any valid Scheme value.  This is put to various internal uses
-by C code interacting with Guile.
-
-For example, when you write a C function that is callable from Scheme
-and which takes optional arguments, the interpreter passes
address@hidden for any arguments you did not receive.
-
-We also use this to mark unbound variables.
address@hidden deftypefn
-
address@hidden Macro int SCM_UNBNDP (SCM @var{x})
-Return true if @var{x} is @code{SCM_UNDEFINED}.  Apply this to a
-symbol's value to see if it has a binding as a global variable.
address@hidden deftypefn
-
-
address@hidden Non-immediate Datatypes
address@hidden Non-immediate Datatypes 
-
-A non-immediate datatype is one which lives in the heap, either because
-it cannot fit entirely within a @code{SCM} word, or because it denotes a
-specific storage location (in the nomenclature of the Revised^5 Report
-on Scheme).
-
-The @code{SCM_IMP} and @code{SCM_NIMP} macros will distinguish these
-from immediates; see @ref{Immediates vs Non-immediates}.
-
-Given a cell, Guile distinguishes between pairs and other non-immediate
-types by storing special @dfn{tag} values in a non-pair cell's car, that
-cannot appear in normal pairs.  A cell with a non-tag value in its car
-is an ordinary pair.  The type of a cell with a tag in its car depends
-on the tag; the non-immediate type predicates test this value.  If a tag
-value appears elsewhere (in a vector, for example), the heap may become
-corrupted.
-
-Note how the type information for a non-immediate object is split
-between the @code{SCM} word and the cell that the @code{SCM} word points
-to.  The @code{SCM} word itself only indicates that the object is
-non-immediate --- in other words stored in a heap cell.  The tag stored
-in the first word of the heap cell indicates more precisely the type of
-that object.
-
-The type predicates for non-immediate values work correctly on any
address@hidden value; you do not need to call @code{SCM_NIMP} first, to
-establish that a value is non-immediate.
-
address@hidden
-* Pair Data::                       
-* Vector Data::                     
-* Procedures::                  
-* Closures::                    
-* Subrs::                       
-* Port Data::                       
address@hidden menu
-
-
address@hidden Pair Data
address@hidden Pairs
-
-Pairs are the essential building block of list structure in Scheme.  A
-pair object has two fields, called the @dfn{car} and the @dfn{cdr}.
-
-It is conventional for a pair's @sc{car} to contain an element of a
-list, and the @sc{cdr} to point to the next pair in the list, or to
-contain @code{SCM_EOL}, indicating the end of the list.  Thus, a set of
-pairs chained through their @sc{cdr}s constitutes a singly-linked list.
-Scheme and libguile define many functions which operate on lists
-constructed in this fashion, so although lists chained through the
address@hidden of pairs will work fine too, they may be less convenient to
-manipulate, and receive less support from the community.
-
-Guile implements pairs by mapping the @sc{car} and @sc{cdr} of a pair
-directly into the two words of the cell.
-
-
address@hidden Macro int SCM_CONSP (SCM @var{x})
-Return non-zero iff @var{x} is a Scheme pair object.
address@hidden deftypefn
-
address@hidden Macro int SCM_NCONSP (SCM @var{x})
-The complement of SCM_CONSP.
address@hidden deftypefn
-
address@hidden SCM scm_cons (SCM @var{car}, SCM @var{cdr})
-Allocate (``CONStruct'') a new pair, with @var{car} and @var{cdr} as its
-contents.
address@hidden deftypefun
-
-The macros below perform no type checking.  The results are undefined if
address@hidden is an immediate.  However, since all non-immediate Guile
-objects are constructed from cells, and these macros simply return the
-first element of a cell, they actually can be useful on datatypes other
-than pairs.  (Of course, it is not very modular to use them outside of
-the code which implements that datatype.)
-
address@hidden Macro SCM SCM_CAR (SCM @var{cell})
-Return the @sc{car}, or first field, of @var{cell}.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_CDR (SCM @var{cell})
-Return the @sc{cdr}, or second field, of @var{cell}.
address@hidden deftypefn
-
address@hidden Macro void SCM_SETCAR (SCM @var{cell}, SCM @var{x})
-Set the @sc{car} of @var{cell} to @var{x}.
address@hidden deftypefn
-
address@hidden Macro void SCM_SETCDR (SCM @var{cell}, SCM @var{x})
-Set the @sc{cdr} of @var{cell} to @var{x}.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_CAAR (SCM @var{cell})
address@hidden Macro SCM SCM_CADR (SCM @var{cell})
address@hidden Macro SCM SCM_CDAR (SCM @var{cell}) @dots{}
address@hidden Macro SCM SCM_CDDDDR (SCM @var{cell})
-Return the @sc{car} of the @sc{car} of @var{cell}, the @sc{car} of the
address@hidden of @var{cell}, @i{et cetera}.
address@hidden deftypefn
-
-
address@hidden Vector Data
address@hidden Vectors, Strings, and Symbols
-
-Vectors, strings, and symbols have some properties in common.  They all
-have a length, and they all have an array of elements.  In the case of a
-vector, the elements are @code{SCM} values; in the case of a string or
-symbol, the elements are characters.
-
-All these types store their length (along with some tagging bits) in the
address@hidden of their header cell, and store a pointer to the elements in
-their @sc{cdr}.  Thus, the @code{SCM_CAR} and @code{SCM_CDR} macros
-are (somewhat) meaningful when applied to these datatypes.
-
address@hidden Macro int SCM_VECTORP (SCM @var{x})
-Return non-zero iff @var{x} is a vector.
address@hidden deftypefn
-
address@hidden Macro int SCM_STRINGP (SCM @var{x})
-Return non-zero iff @var{x} is a string.
address@hidden deftypefn
-
address@hidden Macro int SCM_SYMBOLP (SCM @var{x})
-Return non-zero iff @var{x} is a symbol.
address@hidden deftypefn
-
address@hidden Macro int SCM_VECTOR_LENGTH (SCM @var{x})
address@hidden Macro int SCM_STRING_LENGTH (SCM @var{x})
address@hidden Macro int SCM_SYMBOL_LENGTH (SCM @var{x})
-Return the length of the object @var{x}.  The result is undefined if
address@hidden is not a vector, string, or symbol, respectively.
address@hidden deftypefn
-
address@hidden Macro {SCM *} SCM_VECTOR_BASE (SCM @var{x})
-Return a pointer to the array of elements of the vector @var{x}.
-The result is undefined if @var{x} is not a vector.
address@hidden deftypefn
-
address@hidden Macro {char *} SCM_STRING_CHARS (SCM @var{x})
address@hidden Macro {char *} SCM_SYMBOL_CHARS (SCM @var{x})
-Return a pointer to the characters of @var{x}.  The result is undefined
-if @var{x} is not a symbol or string, respectively.
address@hidden deftypefn
-
-There are also a few magic values stuffed into memory before a symbol's
-characters, but you don't want to know about those.  What cruft!
-
-Note that @code{SCM_VECTOR_BASE}, @code{SCM_STRING_CHARS} and
address@hidden return pointers to data within the respective
-object.  Care must be taken that the object is not garbage collected
-while that data is still being accessed.  This is the same as for a
-smob, @xref{Remembering During Operations}.
-
-
address@hidden Procedures
address@hidden Procedures
-
-Guile provides two kinds of procedures: @dfn{closures}, which are the
-result of evaluating a @code{lambda} expression, and @dfn{subrs}, which
-are C functions packaged up as Scheme objects, to make them available to
-Scheme programmers.
-
-(There are actually other sorts of procedures: compiled closures, and
-continuations; see the source code for details about them.)
-
address@hidden SCM scm_procedure_p (SCM @var{x})
-Return @code{SCM_BOOL_T} iff @var{x} is a Scheme procedure object, of
-any sort.  Otherwise, return @code{SCM_BOOL_F}.
address@hidden deftypefun
-
-
address@hidden Closures
address@hidden Closures
-
-[FIXME: this needs to be further subbed, but texinfo has no subsubsub]
-
-A closure is a procedure object, generated as the value of a
address@hidden expression in Scheme.  The representation of a closure is
-straightforward --- it contains a pointer to the code of the lambda
-expression from which it was created, and a pointer to the environment
-it closes over.
-
-In Guile, each closure also has a property list, allowing the system to
-store information about the closure.  I'm not sure what this is used for
-at the moment --- the debugger, maybe?
-
address@hidden Macro int SCM_CLOSUREP (SCM @var{x})
-Return non-zero iff @var{x} is a closure.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_PROCPROPS (SCM @var{x})
-Return the property list of the closure @var{x}.  The results are
-undefined if @var{x} is not a closure.
address@hidden deftypefn
-
address@hidden Macro void SCM_SETPROCPROPS (SCM @var{x}, SCM @var{p})
-Set the property list of the closure @var{x} to @var{p}.  The results
-are undefined if @var{x} is not a closure.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_CODE (SCM @var{x})
-Return the code of the closure @var{x}.  The result is undefined if
address@hidden is not a closure.
-
-This function should probably only be used internally by the
-interpreter, since the representation of the code is intimately
-connected with the interpreter's implementation.
address@hidden deftypefn
-
address@hidden Macro SCM SCM_ENV (SCM @var{x})
-Return the environment enclosed by @var{x}.
-The result is undefined if @var{x} is not a closure.
-
-This function should probably only be used internally by the
-interpreter, since the representation of the environment is intimately
-connected with the interpreter's implementation.
address@hidden deftypefn
-
-
address@hidden Subrs
address@hidden Subrs
-
-[FIXME: this needs to be further subbed, but texinfo has no subsubsub]
-
-A subr is a pointer to a C function, packaged up as a Scheme object to
-make it callable by Scheme code.  In addition to the function pointer,
-the subr also contains a pointer to the name of the function, and
-information about the number of arguments accepted by the C function, for
-the sake of error checking.
-
-There is no single type predicate macro that recognizes subrs, as
-distinct from other kinds of procedures.  The closest thing is
address@hidden; see @ref{Procedures}.
-
address@hidden Macro {char *} SCM_SNAME (@var{x})
-Return the name of the subr @var{x}.  The result is undefined if
address@hidden is not a subr.
address@hidden deftypefn
-
address@hidden SCM scm_c_define_gsubr (char address@hidden, int @var{req}, int 
@var{opt}, int @var{rest}, SCM (address@hidden)())
-Create a new subr object named @var{name}, based on the C function
address@hidden, make it visible to Scheme the value of as a global
-variable named @var{name}, and return the subr object.
-
-The subr object accepts @var{req} required arguments, @var{opt} optional
-arguments, and a @var{rest} argument iff @var{rest} is non-zero.  The C
-function @var{function} should accept @address@hidden + @var{opt}}
-arguments, or @address@hidden + @var{opt} + 1} arguments if @code{rest}
-is non-zero.
-
-When a subr object is applied, it must be applied to at least @var{req}
-arguments, or else Guile signals an error.  @var{function} receives the
-subr's first @var{req} arguments as its first @var{req} arguments.  If
-there are fewer than @var{opt} arguments remaining, then @var{function}
-receives the value @code{SCM_UNDEFINED} for any missing optional
-arguments.
-
-If @var{rst} is non-zero, then any arguments after the first
address@hidden@var{req} + @var{opt}} are packaged up as a list and passed as
address@hidden's last argument.  @var{function} must not modify that
-list.  (Because when subr is called through @code{apply} the list is
-directly from the @code{apply} argument, which the caller will expect
-to be unchanged.)
-
-Note that subrs can actually only accept a predefined set of
-combinations of required, optional, and rest arguments.  For example, a
-subr can take one required argument, or one required and one optional
-argument, but a subr can't take one required and two optional arguments.
-It's bizarre, but that's the way the interpreter was written.  If the
-arguments to @code{scm_c_define_gsubr} do not fit one of the predefined
-patterns, then @code{scm_c_define_gsubr} will return a compiled closure
-object instead of a subr object.
address@hidden deftypefun
-
-
address@hidden Port Data
address@hidden Ports
-
-Haven't written this yet, 'cos I don't understand ports yet.
-
-
address@hidden Signalling Type Errors
address@hidden Signalling Type Errors
-
-Every function visible at the Scheme level should aggressively check the
-types of its arguments, to avoid misinterpreting a value, and perhaps
-causing a segmentation fault.  Guile provides some macros to make this
-easier.
-
address@hidden Macro void SCM_ASSERT (int @var{test}, SCM @var{obj}, unsigned 
int @var{position}, const char address@hidden)
-If @var{test} is zero, signal a ``wrong type argument'' error,
-attributed to the subroutine named @var{subr}, operating on the value
address@hidden, which is the @var{position}'th argument of @var{subr}.
address@hidden deftypefn
-
address@hidden Macro int SCM_ARG1
address@hidden Macro int SCM_ARG2
address@hidden Macro int SCM_ARG3
address@hidden Macro int SCM_ARG4
address@hidden Macro int SCM_ARG5
address@hidden Macro int SCM_ARG6
address@hidden Macro int SCM_ARG7
-One of the above values can be used for @var{position} to indicate the
-number of the argument of @var{subr} which is being checked.
-Alternatively, a positive integer number can be used, which allows to
-check arguments after the seventh.  However, for parameter numbers up to
-seven it is preferable to use @code{SCM_ARGN} instead of the
-corresponding raw number, since it will make the code easier to
-understand.
address@hidden deftypefn
-
address@hidden Macro int SCM_ARGn
-Passing a value of zero or @code{SCM_ARGn} for @var{position} allows to
-leave it unspecified which argument's type is incorrect.  Again,
address@hidden should be preferred over a raw zero constant.
address@hidden deftypefn
-
-
address@hidden Unpacking the SCM type
address@hidden Unpacking the SCM Type
-
-The previous sections have explained how @code{SCM} values can refer to
-immediate and non-immediate Scheme objects.  For immediate objects, the
-complete object value is stored in the @code{SCM} word itself, while for
-non-immediates, the @code{SCM} word contains a pointer to a heap cell,
-and further information about the object in question is stored in that
-cell.  This section describes how the @code{SCM} type is actually
-represented and used at the C level.
-
 In fact, there are two basic C data types to represent objects in
 Guile: @code{SCM} and @code{scm_t_bits}.
 
@@ -931,7 +374,6 @@ Guile: @code{SCM} and @code{scm_t_bits}.
 * Allocating Cells::
 * Heap Cell Type Information::
 * Accessing Cell Entries::
-* Basic Rules for Accessing Cell Entries::
 @end menu
 
 
@@ -986,6 +428,48 @@ If so, all of the type and value information can be 
determined from the
 (@var{x})}.
 @end itemize
 
+There are a number of special values in Scheme, most of them documented
+elsewhere in this manual. It's not quite the right place to put them,
+but for now, here's a list of the C names given to some of these values:
+
address@hidden Macro SCM SCM_EOL
+The Scheme empty list object, or ``End Of List'' object, usually written
+in Scheme as @code{'()}.
address@hidden deftypefn
+
address@hidden Macro SCM SCM_EOF_VAL
+The Scheme end-of-file value.  It has no standard written
+representation, for obvious reasons.
address@hidden deftypefn
+
address@hidden Macro SCM SCM_UNSPECIFIED
+The value returned by expressions which the Scheme standard says return
+an ``unspecified'' value.
+
+This is sort of a weirdly literal way to take things, but the standard
+read-eval-print loop prints nothing when the expression returns this
+value, so it's not a bad idea to return this when you can't think of
+anything else helpful.
address@hidden deftypefn
+
address@hidden Macro SCM SCM_UNDEFINED
+The ``undefined'' value.  Its most important property is that is not
+equal to any valid Scheme value.  This is put to various internal uses
+by C code interacting with Guile.
+
+For example, when you write a C function that is callable from Scheme
+and which takes optional arguments, the interpreter passes
address@hidden for any arguments you did not receive.
+
+We also use this to mark unbound variables.
address@hidden deftypefn
+
address@hidden Macro int SCM_UNBNDP (SCM @var{x})
+Return true if @var{x} is @code{SCM_UNDEFINED}.  Note that this is not a
+check to see if @var{x} is @code{SCM_UNBOUND}.  History will not be kind
+to us.
address@hidden deftypefn
+
 
 @node Non-immediate objects
 @subsubsection Non-immediate objects
@@ -1187,31 +671,6 @@ entries.
 @end itemize
 
 
address@hidden Basic Rules for Accessing Cell Entries
address@hidden Basic Rules for Accessing Cell Entries
-
-For each cell type it is generally up to the implementation of that type
-which of the corresponding cell entries hold Scheme objects and which
-hold raw C values.  However, there is one basic rule that has to be
-followed: Scheme pairs consist of exactly two cell entries, which both
-contain Scheme objects.  Further, a cell which contains a Scheme object
-in it first entry has to be a Scheme pair.  In other words, it is not
-allowed to store a Scheme object in the first cell entry and a non
-Scheme object in the second cell entry.
-
address@hidden Fixme:shouldn't this rather be SCM_PAIRP / SCM_PAIR_P ?
address@hidden Macro int SCM_CONSP (SCM @var{x})
-Determine, whether the Scheme object @var{x} is a Scheme pair,
-i.e. whether @var{x} references a heap cell consisting of exactly two
-entries, where both entries contain a Scheme object.  In this case, both
-entries will have to be accessed using the @code{SCM_CELL_OBJECT}
-macros.  On the contrary, if the @code{SCM_CONSP} predicate is not
-fulfilled, the first entry of the Scheme cell is guaranteed not to be a
-Scheme value and thus the first cell entry must be accessed using the
address@hidden macro.
address@hidden deftypefn
-
-
 @c Local Variables:
 @c TeX-master: "guile.texi"
 @c End:
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index 0438e24..60d1ea5 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -13,7 +13,7 @@
 @copying
 This manual documents Guile version @value{VERSION}.
 
-Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2009 Free
+Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free
 Software Foundation.
 
 Permission is granted to copy, distribute and/or modify this document
@@ -175,6 +175,7 @@ x
 * API Reference::
 
 * Guile Modules::
+* Standard Library::
 
 * GOOPS::
 
@@ -253,13 +254,10 @@ musings and guidelines about programming with Guile.  It 
explores
 different ways to design a program around Guile, or how to embed Guile
 into existing programs.
 
-There is also a pedagogical yet detailed explanation of how the data
-representation of Guile is implemented, see @ref{Data Representation in
-Scheme} and @ref{The Libguile Runtime Environment}.
-
-You don't need to know the details given there to use Guile from C,
-but they are useful when you want to modify Guile itself or when you
-are just curious about how it is all done.
+For a pedagogical yet detailed explanation of how the data representation of
+Guile is implemented, @xref{Data Representation}. You don't need to know the
+details given there to use Guile from C, but they are useful when you want to
+modify Guile itself or when you are just curious about how it is all done.
 
 For detailed reference information on the variables, functions
 etc. that make up Guile's application programming interface (API),
@@ -298,15 +296,18 @@ available through both Scheme and C interfaces.
 * Simple Data Types::           Numbers, strings, booleans and so on.
 * Compound Data Types::         Data types for holding other data.
 * Smobs::                       Defining new data types in C.
-* Procedures and Macros::       Procedures and macros.
+* Procedures::                  Procedures.
+* Macros::                      Extending the syntax of Scheme.
 * Utility Functions::           General utility functions.
 * Binding Constructs::          Definitions and variable bindings.
 * Control Mechanisms::          Controlling the flow of program execution.
 * Input and Output::            Ports, reading and writing.
+* LALR(1) Parsing::             Generating LALR(1) parsers.            
 * Read/Load/Eval/Compile::      Reading and evaluating Scheme code.
 * Memory Management::           Memory management and garbage collection.
 * Objects::                     Low level object orientation support.
 * Modules::                     Designing reusable code libraries.
+* Foreign Function Interface::  Interacting with C procedures and data.
 * Scheduling::                  Threads, mutexes, asyncs and dynamic roots.
 * Options and Config::          Configuration, features and runtime options.
 * Translation::                 Support for translating other languages.
@@ -323,13 +324,16 @@ available through both Scheme and C interfaces.
 @include api-compound.texi
 @include api-smobs.texi
 @include api-procedures.texi
address@hidden api-macros.texi
 @include api-utility.texi
 @include api-binding.texi
 @include api-control.texi
 @include api-io.texi
address@hidden api-lalr.texi
 @include api-evaluation.texi
 @include api-memory.texi
 @include api-modules.texi
address@hidden api-foreign.texi
 @include api-scheduling.texi
 @c object orientation support here
 @include api-options.texi
@@ -368,6 +372,13 @@ available through both Scheme and C interfaces.
 @include scsh.texi
 @include scheme-debugging.texi
 
address@hidden Standard Library
address@hidden Standard Library
+
address@hidden
address@hidden standard-library.texi
address@hidden
+
 @include goops.texi
 
 @node Guile Implementation
@@ -393,13 +404,10 @@ This knowledge can help you to make that step from being 
one who is
 merely familiar with Scheme to being a real hacker.
 
 @menu
-* History::                             A brief history of Guile.
-* Data Representation in Scheme::       Why things aren't just totally
-                                        straightforward, in general terms.
-* The Libguile Runtime Environment::    Low-level details on Guile's C
-                                        runtime library.
-* A Virtual Machine for Guile::         How compiled procedures work.
-* Compiling to the Virtual Machine::    Not as hard as you might think.
+* History::                          A brief history of Guile.
+* Data Representation::              How Guile represents Scheme data.
+* A Virtual Machine for Guile::      How compiled procedures work.
+* Compiling to the Virtual Machine:: Not as hard as you might think.
 @end menu
 
 @include history.texi
diff --git a/doc/ref/history.texi b/doc/ref/history.texi
index 7454cfe..f1109b2 100644
--- a/doc/ref/history.texi
+++ b/doc/ref/history.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  2008
address@hidden Copyright (C)  2008, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -134,7 +134,8 @@ Since then, Guile has had a group maintainership. The first 
group was
 Maciej Stachowiak, Mikael Djurfeldt, and Marius Vollmer, with Vollmer
 staying on the longest. By late 2007, Vollmer had mostly moved on to
 other things, so Neil Jerram and Ludovic Courtès stepped up to take on
-the primary maintenance responsibility.
+the primary maintenance responsibility. Jerram and Courtès were joined
+by Andy Wingo in late 2009.
 
 Of course, a large part of the actual work on Guile has come from
 other contributors too numerous to mention, but without whom the world
@@ -167,18 +168,17 @@ less the same form.
 @itemx 1.2 --- 24 June 1997
 Support for Tcl/Tk and ctax were split off as separate packages, and
 have remained there since. Guile became more compatible with SCSH, and
-more useful as a UNIX scripting language. Libguile can now be built as
+more useful as a UNIX scripting language. Libguile could now be built as
 a shared library, and third-party extensions written in C became
 loadable via dynamic linking.
 
 @item 1.3.0 --- 19 October 1998
 Command-line editing became much more pleasant through the use of the
 readline library. The initial support for internationalization via
-multi-byte strings was removed, and has yet to be added back, though
-UTF-8 hacks are common. Modules gained the ability to have custom
-expanders, which is still used for syntax-case macros. Initial Emacs
-Lisp support landed, ports gained better support for file descriptors,
-and fluids were added.
+multi-byte strings was removed; 10 years were to pass before proper
+internationalization would land again. Initial Emacs Lisp support
+landed, ports gained better support for file descriptors, and fluids
+were added.
 
 @item 1.3.2 --- 20 August 1999
 @itemx 1.3.4 --- 25 September 1999
@@ -186,8 +186,8 @@ and fluids were added.
 A long list of lispy features were added: hooks, Common Lisp's
 @code{format}, optional and keyword procedure arguments,
 @code{getopt-long}, sorting, random numbers, and many other fixes and
-enhancements. Guile now has an interactive debugger, interactive help,
-and gives better backtraces.
+enhancements. Guile also gained an interactive debugger, interactive
+help, and better backtraces.
 
 @item 1.6 --- 6 September 2002
 Guile gained support for the R5RS standard, and added a number of SRFI
@@ -202,12 +202,15 @@ user-space threading was removed in favor of POSIX 
pre-emptive
 threads, providing true multiprocessing. Gettext support was added,
 and Guile's C API was cleaned up and orthogonalized in a massive way.
 
address@hidden 2.0 --- thus far, only unstable snapshots available
-A virtual machine was added to Guile, along with the associated
-compiler and toolchain. Support for internationalization was added.
-Running Guile instances became controllable and debuggable from within
-Emacs, via GDS, which was also backported to 1.8.5. An SRFI-18
-interface to multithreading was added, including thread cancellation.
address@hidden 2.0 --- April 2010
+A virtual machine was added to Guile, along with the associated compiler
+and toolchain. Support for internationalization was finally
+reimplemented, in terms of unicode, locales, and libunistring. Running
+Guile instances became controllable and debuggable from within Emacs,
+via GDS and Geiser. Guile caught up to features found in a number of
+other Schemes: SRFI-18 threads, including thread cancellation,
+module-hygienic macros, a profiler, tracer, and debugger, SSAX XML
+integration, bytevectors, module versions, and partial support for R6RS.
 @end table
 
 @node Status
@@ -267,12 +270,12 @@ language with a syntax that is closer to C, or to Python. 
Another
 interesting idea to consider is compiling e.g. Python to Guile. It's
 not that far-fetched of an idea: see for example IronPython or JRuby.
 
-And then there's Emacs itself. Though there is a somewhat-working
-Emacs Lisp translator for Guile, it cannot yet execute all of Emacs
-Lisp. A serious integration of Guile with Emacs would replace the
-Elisp virtual machine with Guile, and provide the necessary C shims so
-that Guile could emulate Emacs' C API. This would give lots of
-exciting things to Emacs: native threads, a real object system, more
+And then there's Emacs itself. Though there is a somewhat-working Emacs
+Lisp language frontend for Guile, it cannot yet execute all of Emacs
+Lisp. A serious integration of Guile with Emacs would replace the Elisp
+virtual machine with Guile, and provide the necessary C shims so that
+Guile could emulate Emacs' C API. This would give lots of exciting
+things to Emacs: native threads, a real object system, more
 sophisticated types, cleaner syntax, and access to all of the Guile
 extensions.
 
diff --git a/doc/ref/intro.texi b/doc/ref/intro.texi
index c91aacb..3301ded 100644
--- a/doc/ref/intro.texi
+++ b/doc/ref/intro.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -302,7 +302,8 @@ When Guile is correctly installed on your system, the above 
program
 can be compiled and linked like this:
 
 @example
-$ gcc -o simple-guile simple-guile.c -lguile
+$ gcc -o simple-guile simple-guile.c \
+    `pkg-config --cflags --libs guile-2.0`
 @end example
 
 When it is run, it behaves just like the @code{guile} program except
diff --git a/doc/ref/libguile-concepts.texi b/doc/ref/libguile-concepts.texi
index f0471c2..1e4cb1e 100644
--- a/doc/ref/libguile-concepts.texi
+++ b/doc/ref/libguile-concepts.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -152,8 +152,8 @@ that have been added to Guile by third-party libraries.
 
 Also, computing with @code{SCM} is not necessarily inefficient.  Small
 integers will be encoded directly in the @code{SCM} value, for example,
-and do not need any additional memory on the heap.  See @ref{The
-Libguile Runtime Environment} to find out the details.
+and do not need any additional memory on the heap.  See @ref{Data
+Representation} to find out the details.
 
 Some special @code{SCM} values are available to C code without needing
 to convert them from C values:
@@ -169,9 +169,8 @@ In addition to @code{SCM}, Guile also defines the related 
type
 @code{scm_t_bits}.  This is an unsigned integral type of sufficient
 size to hold all information that is directly contained in a
 @code{SCM} value.  The @code{scm_t_bits} type is used internally by
-Guile to do all the bit twiddling explained in @ref{The Libguile
-Runtime Environment}, but you will encounter it occasionally in low-level
-user code as well.
+Guile to do all the bit twiddling explained in @ref{Data Representation}, but
+you will encounter it occasionally in low-level user code as well.
 
 
 @node Garbage Collection
@@ -450,21 +449,15 @@ that are stored in local variables.  When a thread puts 
itself into
 guile mode for the first time, it gets a Scheme representation and is
 listed by @code{all-threads}, for example.
 
-While in guile mode, a thread promises to reach a safe point
-reasonably frequently (@pxref{Asynchronous Signals}).  In addition to
-running signal handlers, these points are also potential rendezvous
-points of all guile mode threads where Guile can orchestrate global
-things like garbage collection.  Consequently, when a thread in guile
-mode blocks and does no longer frequent safe points, it might cause
-all other guile mode threads to block as well.  To prevent this from
-happening, a guile mode thread should either only block in libguile
-functions (who know how to do it right), or should temporarily leave
-guile mode with @code{scm_without_guile}.
-
-For some common blocking operations, Guile provides convenience
-functions.  For example, if you want to lock a pthread mutex while in
-guile mode, you might want to use @code{scm_pthread_mutex_lock} which is
-just like @code{pthread_mutex_lock} except that it leaves guile mode
+Threads in guile mode can block (e.g., do blocking I/O) without causing any
address@hidden Guile 1.8, a thread blocking in guile mode would prevent
+garbage collection to occur.  Thus, threads had to leave guile mode whenever
+they could block.  This is no longer needed with Guile 2.0.}; temporarily
+leaving guile mode with @code{scm_without_guile} before blocking slightly
+improves GC performance, though.  For some common blocking operations, Guile
+provides convenience functions.  For example, if you want to lock a pthread
+mutex while in guile mode, you might want to use @code{scm_pthread_mutex_lock}
+which is just like @code{pthread_mutex_lock} except that it leaves guile mode
 while blocking.
 
 
diff --git a/doc/ref/libguile-linking.texi b/doc/ref/libguile-linking.texi
index 78a93e6..b6a8855 100644
--- a/doc/ref/libguile-linking.texi
+++ b/doc/ref/libguile-linking.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -174,9 +174,7 @@ checking for Guile... yes
 creating ./config.status
 creating Makefile
 $ make
-gcc -c -I/usr/local/include simple-guile.c
-gcc simple-guile.o -L/usr/local/lib -lguile -lqthreads -lpthread -lm
-  -o simple-guile
+[...]
 $ ./simple-guile
 guile> (+ 1 2 3)
 6
diff --git a/doc/ref/libguile-smobs.texi b/doc/ref/libguile-smobs.texi
index 213312c..c6581a1 100644
--- a/doc/ref/libguile-smobs.texi
+++ b/doc/ref/libguile-smobs.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 
2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -69,8 +69,7 @@ function is allowed to do.
 Guile will apply this function to each instance of the new type to print
 the value, as for @code{display} or @code{write}.  The default print
 function prints @code{#<NAME ADDRESS>} where @code{NAME} is the first
-argument passed to @code{scm_make_smob_type}.  For more information on
-printing, see @ref{Port Data}.
+argument passed to @code{scm_make_smob_type}.
 
 @item equalp
 If Scheme code asks the @code{equal?} function to compare two instances
@@ -521,7 +520,7 @@ Smobs are called smob because they are small: they normally 
have only
 room for one @code{void*} or @code{SCM} value plus 16 bits.  The
 reason for this is that smobs are directly implemented by using the
 low-level, two-word cells of Guile that are also used to implement
-pairs, for example.  (@pxref{The Libguile Runtime Environment} for the
+pairs, for example.  (@pxref{Data Representation} for the
 details.)  One word of the two-word cells is used for
 @code{SCM_SMOB_DATA} (or @code{SCM_SMOB_OBJECT}), the other contains
 the 16-bit type tag and the 16 extra bits.
diff --git a/doc/ref/make-texinfo.scm b/doc/ref/make-texinfo.scm
new file mode 100644
index 0000000..c967bc1
--- /dev/null
+++ b/doc/ref/make-texinfo.scm
@@ -0,0 +1,28 @@
+;; make-texinfo.scm -- document a set of scheme modules as texinfo
+;; Copyright (C) 2006,2007,2009  Andy Wingo <wingo at pobox dot com>
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+(use-modules (texinfo reflection)
+             (texinfo serialize))
+
+(define (main config-scm)
+  (load config-scm)
+  (display
+   (stexi->texi
+    (package-stexi-documentation-for-include
+     (map car *modules*)
+     (map cdr *modules*)))))
+
+(apply main (cdr (command-line)))
diff --git a/doc/ref/misc-modules.texi b/doc/ref/misc-modules.texi
index b56bcff..6cd0ad2 100644
--- a/doc/ref/misc-modules.texi
+++ b/doc/ref/misc-modules.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -15,7 +15,7 @@ The module @code{(ice-9 pretty-print)} provides the procedure
 objects.  This is especially useful for deeply nested or complex data
 structures, such as lists and vectors.
 
-The module is loaded by simply saying.
+The module is loaded by entering the following:
 
 @lisp
 (use-modules (ice-9 pretty-print))
@@ -59,6 +59,67 @@ Print within the given @var{columns}.  The default is 79.
 @end deffn
 
 
address@hidden truncated printing
+Also exported by the @code{(ice-9 pretty-print)} module is
address@hidden, a procedure to print Scheme datums, truncating
+the output to a certain number of characters. This is useful when you
+need to present an arbitrary datum to the user, but you only have one
+line in which to do so.
+
address@hidden
+(define exp '(a b #(c d e) f . g))
+(truncated-print exp #:width 10) (newline)
address@hidden (a b . #)
+(truncated-print exp #:width 15) (newline)
address@hidden (a b # f . g)
+(truncated-print exp #:width 18) (newline)
address@hidden (a b #(c ...) . #)
+(truncated-print exp #:width 20) (newline)
address@hidden (a b #(c d e) f . g)
+(truncated-print "The quick brown fox" #:width 20) (newline)
address@hidden "The quick brown..."
+(truncated-print (current-module) #:width 20) (newline)
address@hidden #<directory (gui...>
address@hidden lisp
+
address@hidden will not output a trailing newline. If an expression does
+not fit in the given width, it will be truncated -- possibly
address@hidden Unicode-capable ports, the ellipsis is represented by
+character `HORIZONTAL ELLIPSIS' (U+2026), otherwise it is represented by three
+dots.}, or in the worst case, displayed as @nicode{#}.
+
address@hidden {Scheme Procedure} truncated-print obj [port] [keyword-options]
+Print @var{obj}, truncating the output, if necessary, to make it fit
+into @var{width} characters. By default, @var{x} will be printed using
address@hidden, though that behavior can be overriden via the
address@hidden keyword argument.
+
+The default behaviour is to print depth-first, meaning that the entire
+remaining width will be available to each sub-expressoin of @var{x} --
+e.g., if @var{x} is a vector, each member of @var{x}. One can attempt to
+``ration'' the available width, trying to allocate it equally to each
+sub-expression, via the @var{breadth-first?} keyword argument.
+
+The further @var{keyword-options} are keywords and parameters as
+follows,
+
address@hidden @asis
address@hidden @nicode{#:display?} @var{flag}
+If @var{flag} is true then print using @code{display}.  The default is
address@hidden which means use @code{write} style.  (@pxref{Writing})
+
address@hidden @nicode{#:width} @var{columns}
+Print within the given @var{columns}.  The default is 79.
+
address@hidden @nicode{#:breadth-first?} @var{flag}
+If @var{flag} is true, then allocate the available width breadth-first
+among elements of a compound data structure (list, vector, pair,
+etc.). The default is @code{#f} which means that any element is
+allowed to consume all of the available width.
address@hidden table
address@hidden deffn
+
+
 @node Formatted Output
 @section Formatted Output
 @cindex formatted output
@@ -575,9 +636,22 @@ to help.  When using @code{gettext} to translate messages
 (@pxref{Internationalization}).
 
 @item @nicode{~y}
-Pretty print.  No parameters.
-
-Output an argument with @code{pretty-print} (@pxref{Pretty Printing}).
+Structured printing.  Parameters: @var{width}.
+
address@hidden outputs an argument using @code{pretty-print}
+(@pxref{Pretty Printing}). The result will be formatted to fit within
address@hidden columns (79 by default), consuming multiple lines if
+necessary.
+
address@hidden@@y} outputs an argument using @code{truncated-print}
+(@pxref{Pretty Printing}). The resulting code will be formatted to fit
+within @var{width} columns (79 by default), on a single line. The
+output will be truncated if necessary.
+
address@hidden:@@y} is like @nicode{~@@y}, except the @var{width} parameter
+is interpreted to be the maximum column to which to output. That is to
+say, if you are at column 10, and @nicode{~60:@@y} is seen, the datum
+will be truncated to 50 columns.
 
 @item @nicode{~?}
 @itemx @nicode{~k}
diff --git a/doc/ref/new-docstrings.texi b/doc/ref/new-docstrings.texi
index c8f16a3..65dda6e 100644
--- a/doc/ref/new-docstrings.texi
+++ b/doc/ref/new-docstrings.texi
@@ -1,3 +1,274 @@
 @c module-for-docstring (guile)
 
 
+
address@hidden {Scheme Procedure} uniform-array->bytevector array
address@hidden {C Function} scm_uniform_array_to_bytevector (array)
+Return a newly allocated bytevector whose contents
+will be copied from the uniform array @var{array}.
address@hidden deffn
+
address@hidden {Scheme Procedure} %start-stack id thunk
address@hidden {C Function} scm_sys_start_stack (id, thunk)
+Call @var{thunk} on an evaluator stack tagged with @var{id}.
address@hidden deffn
+
address@hidden {Scheme Procedure} guardian-destroyed? guardian
address@hidden {C Function} scm_guardian_destroyed_p (guardian)
+Return @code{#t} if @var{guardian} has been destroyed, otherwise @code{#f}.
address@hidden deffn
+
address@hidden {Scheme Procedure} guardian-greedy? guardian
address@hidden {C Function} scm_guardian_greedy_p (guardian)
+Return @code{#t} if @var{guardian} is a greedy guardian, otherwise @code{#f}.
address@hidden deffn
+
address@hidden {Scheme Procedure} destroy-guardian! guardian
address@hidden {C Function} scm_destroy_guardian_x (guardian)
+Destroys @var{guardian}, by making it impossible to put any more
+objects in it or get any objects from it.  It also unguards any
+objects guarded by @var{guardian}.
address@hidden deffn
+
address@hidden {Scheme Procedure} gc-dump
address@hidden {C Function} scm_gc_dump ()
+Dump information about the garbage collector's internal data structures and 
memory usage to the standard output.
address@hidden deffn
+
address@hidden {Scheme Procedure} gc-disable
address@hidden {C Function} scm_gc_disable ()
+Disables the garbage collector.  Nested calls are permitted.  GC is re-enabled 
once @code{gc-enable} has been called the same number of times 
@code{gc-disable} was called.
address@hidden deffn
+
address@hidden {Scheme Procedure} gc-enable
address@hidden {C Function} scm_gc_enable ()
+Enables the garbage collector.
address@hidden deffn
+
address@hidden {Scheme Procedure} make-generalized-vector type len [fill]
address@hidden {C Function} scm_make_generalized_vector (type, len, fill)
+Make a generalized vector
address@hidden deffn
+
address@hidden {Scheme Procedure} set-primitive-generic! subr generic
address@hidden {C Function} scm_set_primitive_generic_x (subr, generic)
+
address@hidden deffn
+
address@hidden {Scheme Procedure} nl-langinfo item [locale]
address@hidden {C Function} scm_nl_langinfo (item, locale)
+Return a string denoting locale information for @var{item} in the current 
locale or that specified by @var{locale}.  The semantics and arguments are the 
same as those of the X/Open @code{nl_langinfo} function (@pxref{The Elegant and 
Fast Way, @code{nl_langinfo},, libc, The GNU C Library Reference Manual}).
address@hidden deffn
+
address@hidden {Scheme Procedure} %warn-autocompilation-enabled
address@hidden {C Function} scm_sys_warn_autocompilation_enabled ()
+
address@hidden deffn
+
address@hidden {Scheme Procedure} make-syncase-macro type binding
address@hidden {C Function} scm_make_syncase_macro (type, binding)
+Return a @dfn{macro} that requires expansion by syntax-case.
+While users should not call this function, it is useful to know
+that syntax-case macros are represented as Guile primitive macros.
address@hidden deffn
+
address@hidden {Scheme Procedure} make-extended-syncase-macro m type binding
address@hidden {C Function} scm_make_extended_syncase_macro (m, type, binding)
+Extend a core macro @var{m} with a syntax-case binding.
address@hidden deffn
+
address@hidden {Scheme Procedure} syncase-macro-type m
address@hidden {C Function} scm_syncase_macro_type (m)
+Return the type of the macro @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} syncase-macro-binding m
address@hidden {C Function} scm_syncase_macro_binding (m)
+Return the binding of the macro @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} memoize-expression exp
address@hidden {C Function} scm_memoize_expression (exp)
+Memoize the expression @var{exp}.
address@hidden deffn
+
address@hidden {Scheme Procedure} unmemoize-expression m
address@hidden {C Function} scm_unmemoize_expression (m)
+Unmemoize the memoized expression @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} memoized-expression-typecode m
address@hidden {C Function} scm_memoized_expression_typecode (m)
+Return the typecode from the memoized expression @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} memoized-expression-data m
address@hidden {C Function} scm_memoized_expression_data (m)
+Return the data from the memoized expression @var{m}.
address@hidden deffn
+
address@hidden {Scheme Procedure} memoized-typecode sym
address@hidden {C Function} scm_memoized_typecode (sym)
+Return the memoized typecode corresponding to the symbol @var{sym}.
address@hidden deffn
+
address@hidden {Scheme Procedure} memoize-variable-access! m mod
address@hidden {C Function} scm_memoize_variable_access_x (m, mod)
+Look up and cache the variable that @var{m} will access, returning the 
variable.
address@hidden deffn
+
address@hidden {Scheme Procedure} module-local-variable module sym
address@hidden {C Function} scm_module_local_variable (module, sym)
+Return the variable bound to @var{sym} in @var{module}.  Return @code{#f} is 
@var{sym} is not bound locally in @var{module}.
address@hidden deffn
+
address@hidden {Scheme Procedure} module-variable module sym
address@hidden {C Function} scm_module_variable (module, sym)
+Return the variable bound to @var{sym} in @var{module}.  This may be both a 
local variable or an imported variable.  Return @code{#f} is @var{sym} is not 
bound in @var{module}.
address@hidden deffn
+
address@hidden {Scheme Procedure} eval-closure-module eval_closure
address@hidden {C Function} scm_eval_closure_module (eval_closure)
+Return the module associated with this eval closure.
address@hidden deffn
+
address@hidden {Scheme Procedure} module-transformer module
address@hidden {C Function} scm_module_transformer (module)
+Returns the syntax expander for the given module.
address@hidden deffn
+
address@hidden {Scheme Procedure} module-public-interface module
address@hidden {C Function} scm_module_public_interface (module)
+Return the public interface of @var{module}.
+
+If @var{module} has no public interface, @code{#f} is returned.
address@hidden deffn
+
address@hidden {Scheme Procedure} define! sym value
address@hidden {C Function} scm_define (sym, value)
+Define @var{sym} to be @var{value} in the current module.Returns the variable 
itself. Note that this is a procedure, not a macro.
address@hidden deffn
+
address@hidden {Scheme Procedure} module-reverse-lookup module variable
address@hidden {C Function} scm_module_reverse_lookup (module, variable)
+Return the symbol under which @var{variable} is bound in @var{module} or 
@var{#f} if @var{variable} is not visible from @var{module}.  If @var{module} 
is @code{#f}, then the pre-module obarray is used.
address@hidden deffn
+
address@hidden {Scheme Procedure} cddr x
address@hidden {C Function} scm_cddr (x)
+
address@hidden deffn
+
address@hidden {Scheme Procedure} make-promise thunk
address@hidden {C Function} scm_make_promise (thunk)
+Create a new promise object.
+
address@hidden is a procedural form of @code{delay}.
+These two expressions are equivalent:
address@hidden
+(delay @var{exp})
+(make-promise (lambda () @var{exp}))
address@hidden lisp
+
address@hidden deffn
+
address@hidden {Scheme Procedure} %get-stack-size
address@hidden {C Function} scm_sys_get_stack_size ()
+Return the current thread's C stack size (in Scheme objects).
address@hidden deffn
+
address@hidden {Scheme Procedure} %string-dump str
address@hidden {C Function} scm_sys_string_dump (str)
+Returns an association list containing debugging information
+for @var{str}. The association list has the following address@hidden @code
address@hidden string
+The string itself.
address@hidden start
+The start index of the string into its stringbuf
address@hidden length
+The length of the string
address@hidden shared
+If this string is a substring, it returns its parent string.
+Otherwise, it returns @code{#f}
address@hidden read-only
address@hidden if the string is read-only
address@hidden stringbuf-chars
+A new string containing this string's stringbuf's characters
address@hidden stringbuf-length
+The number of characters in this stringbuf
address@hidden stringbuf-shared
address@hidden if this stringbuf is shared
address@hidden stringbuf-wide
address@hidden if this stringbuf's characters are stored in a
+32-bit buffer, or @code{#f} if they are stored in an 8-bit
+buffer
address@hidden table
address@hidden deffn
+
address@hidden {Scheme Procedure} %symbol-dump sym
address@hidden {C Function} scm_sys_symbol_dump (sym)
+Returns an association list containing debugging information
+for @var{sym}. The association list has the following address@hidden @code
address@hidden symbol
+The symbol itself
address@hidden hash
+Its hash value
address@hidden interned
address@hidden if it is an interned symbol
address@hidden stringbuf-chars
+A new string containing this symbols's stringbuf's characters
address@hidden stringbuf-length
+The number of characters in this stringbuf
address@hidden stringbuf-shared
address@hidden if this stringbuf is shared
address@hidden stringbuf-wide
address@hidden if this stringbuf's characters are stored in a
+32-bit buffer, or @code{#f} if they are stored in an 8-bit
+buffer
address@hidden table
address@hidden deffn
+
address@hidden {Scheme Procedure} string-bytes-per-char string
address@hidden {C Function} scm_string_bytes_per_char (string)
+Return the bytes used to represent a character in @var{string}.This will 
return 1 or 4.
address@hidden deffn
+
address@hidden {Scheme Procedure} uniform-vector-element-type v
address@hidden {C Function} scm_uniform_vector_element_type (v)
+Return the type of the elements in the uniform vector, @var{v}.
address@hidden deffn
+
address@hidden {Scheme Procedure} uniform-vector-element-size v
address@hidden {C Function} scm_uniform_vector_element_size (v)
+Return the number of bytes allocated to each element in the
+uniform vector, @var{v}.
address@hidden deffn
+
address@hidden {Scheme Procedure} canonicalize-path path
address@hidden {C Function} scm_canonicalize_path (path)
+Return the canonical path of @var{path}. A canonical path has
+no @code{.} or @code{..} components, nor any repeated path
+separators (@code{/}) nor symlinks.
+
+Raises an error if any component of @var{path} does not exist.
address@hidden deffn
+
address@hidden {Scheme Procedure} getrlimit resource
address@hidden {C Function} scm_getrlimit (resource)
+Get a resource limit for this process. @var{resource} identifies the resource,
+either as an integer or as a symbol. For example, @code{(getrlimit 'stack)}
+gets the limits associated with @code{RLIMIT_STACK}.
+
address@hidden returns two values, the soft and the hard limit. If no
+limit is set for the resource in question, the returned limit will be 
@code{#f}.
address@hidden deffn
+
address@hidden {Scheme Procedure} setrlimit resource soft hard
address@hidden {C Function} scm_setrlimit (resource, soft, hard)
+Set a resource limit for this process. @var{resource} identifies the resource,
+either as an integer or as a symbol. @var{soft} and @var{hard} should be 
integers,
+or @code{#f} to indicate no limit (i.e., @code{RLIM_INFINITY}).
+
+For example, @code{(setrlimit 'stack 150000 300000)} sets the 
@code{RLIMIT_STACK}
+limit to 150 kilobytes, with a hard limit of 300 kB.
address@hidden deffn
diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index fbe3059..89f8e84 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -687,13 +687,21 @@ case @code{stat:rdev} returns @code{#f}.
 The size of a regular file in bytes.
 @end deffn
 @deffn {Scheme Procedure} stat:atime st
-The last access time for the file.
+The last access time for the file, in seconds.
 @end deffn
 @deffn {Scheme Procedure} stat:mtime st
-The last modification time for the file.
+The last modification time for the file, in seconds.
 @end deffn
 @deffn {Scheme Procedure} stat:ctime st
-The last modification time for the attributes of the file.
+The last modification time for the attributes of the file, in seconds.
address@hidden deffn
address@hidden {Scheme Procedure} stat:atimensec st
address@hidden {Scheme Procedure} stat:mtimensec st
address@hidden {Scheme Procedure} stat:ctimensec st
+The fractional part of a file's access, modification, or attribute modification
+time, in nanoseconds. Nanosecond timestamps are only available on some 
operating
+systems and filesystems. If Guile cannot retrieve nanosecond-level timestamps
+for a file, these fields will be set to 0.
 @end deffn
 @deffn {Scheme Procedure} stat:blksize st
 The optimal block size for reading or writing the file, in bytes.  On
@@ -763,14 +771,18 @@ the new permissions as a decimal number, e.g., 
@code{(chmod "foo" #o755)}.
 The return value is unspecified.
 @end deffn
 
address@hidden {Scheme Procedure} utime pathname [actime [modtime]]
address@hidden {C Function} scm_utime (pathname, actime, modtime)
address@hidden file times
address@hidden {Scheme Procedure} utime pathname [actime [modtime [actimens 
[modtimens [flags]]]]]
address@hidden {C Function} scm_utime (pathname, actime, modtime, actimens, 
modtimens, flags)
 @code{utime} sets the access and modification times for the
 file named by @var{path}.  If @var{actime} or @var{modtime} is
 not supplied, then the current time is used.  @var{actime} and
 @var{modtime} must be integer time values as returned by the
 @code{current-time} procedure.
+
+The optional @var{actimens} and @var{modtimens} are nanoseconds
+to add @var{actime} and @var{modtime}. Nanosecond precision is
+only supported on some combinations of filesystems and operating
+systems.
 @lisp
 (utime "foo" (- (current-time) 3600))
 @end lisp
@@ -1596,6 +1608,12 @@ from its controlling terminal if it has one.
 The return value is an integer representing the new process group ID.
 @end deffn
 
address@hidden {Scheme Procedure} getsid pid
address@hidden {C Function} scm_getsid (pid)
+Returns the session ID of process @var{pid}.  (The session
+ID of a process is the process group ID of its session leader.)
address@hidden deffn
+
 @deffn {Scheme Procedure} waitpid pid [options]
 @deffnx {C Function} scm_waitpid (pid, options)
 This procedure collects status information from a child process which
@@ -2318,6 +2336,164 @@ This section describes procedures which query various 
network databases.
 Care should be taken when using the database routines since they are not
 reentrant.
 
address@hidden @code{getaddrinfo}
+
address@hidden @code{addrinfo} object type
address@hidden host name lookup
address@hidden service name lookup
+
+The @code{getaddrinfo} procedure maps host and service names to socket 
addresses
+and associated information in a protocol-independent way.
+
address@hidden {Scheme Procedure} getaddrinfo name service [hint_flags 
[hint_family [hint_socktype [hint_protocol]]]]
address@hidden {C Function} scm_getaddrinfo (name, service, hint_flags, 
hint_family, hint_socktype, hint_protocol)
+Return a list of @code{addrinfo} structures containing
+a socket address and associated information for host @var{name}
+and/or @var{service} to be used in creating a socket with
+which to address the specified service.
+
address@hidden
+(let* ((ai (car (getaddrinfo "www.gnu.org" "http")))
+       (s  (socket (addrinfo:fam ai) (addrinfo:socktype ai)
+                   (addrinfo:protocol ai))))
+  (connect s (addrinfo:addr ai))
+  s)
address@hidden example
+
+When @var{service} is omitted or is @code{#f}, return
+network-level addresses for @var{name}.  When @var{name}
+is @code{#f} @var{service} must be provided and service
+locations local to the caller are returned.
+
+Additional hints can be provided.  When specified,
address@hidden should be a bitwise-or of zero or more
+constants among the following:
+
address@hidden @code
address@hidden AI_PASSIVE
+Socket address is intended for @code{bind}.
+
address@hidden AI_CANONNAME
+Request for canonical host name, available via
address@hidden:canonname}.  This makes sense mainly when
+DNS lookups are involved.
+
address@hidden AI_NUMERICHOST
+Specifies that @var{name} is a numeric host address string
+(e.g., @code{"127.0.0.1"}), meaning that name resolution
+will not be used.
+
address@hidden AI_NUMERICSERV
+Likewise, specifies that @var{service} is a numeric port
+string (e.g., @code{"80"}).
+
address@hidden AI_ADDRCONFIG
+Return only addresses configured on the local system  It is
+highly recommended to provide this flag when the returned
+socket addresses are to be used to make connections;
+otherwise, some of the returned addresses could be unreachable
+or use a protocol that is not supported.
+
address@hidden AI_V4MAPPED
+When looking up IPv6 addresses, return mapped IPv4 addresses if
+there is no IPv6 address available at all.
+
address@hidden AI_ALL
+If this flag is set along with @code{AI_V4MAPPED} when looking up IPv6
+addresses, return all IPv6 addresses as well as all IPv4 addresses, the latter
+mapped to IPv6 format.
address@hidden table
+
+When given, @var{hint_family} should specify the requested
+address family, e.g., @code{AF_INET6}.  Similarly,
address@hidden should specify the requested socket type
+(e.g., @code{SOCK_DGRAM}), and @var{hint_protocol} should
+specify the requested protocol (its value is interpretered
+as in calls to @code{socket}).
+
+On error, an exception with key @code{getaddrinfo-error} is
+thrown, with an error code (an integer) as its argument:
+
address@hidden
+(catch 'getaddrinfo-error
+  (lambda ()
+    (getaddrinfo "www.gnu.org" "gopher"))
+  (lambda (key errcode)
+    (cond ((= errcode EAI_SERVICE)
+          (display "doesn't know about Gopher!\n"))
+         ((= errcode EAI_NONAME)
+          (display "www.gnu.org not found\\n"))
+         (else
+          (format #t "something wrong: ~a\n"
+                  (gai-strerror errcode))))))
address@hidden example
+
+Error codes are:
+
address@hidden @code
address@hidden EAI_AGAIN
+The name or service could not be resolved at this time. Future
+attempts may succeed.
+
address@hidden EAI_BADFLAGS
address@hidden contains an invalid value.
+
address@hidden EAI_FAIL
+A non-recoverable error occurred when attempting to
+resolve the name.
+
address@hidden EAI_FAMILY
address@hidden was not recognized.
+
address@hidden EAI_NONAME
+Either @var{name} does not resolve for the supplied parameters,
+or neither @var{name} nor @var{service} were supplied.
+
address@hidden EAI_SERVICE
address@hidden was not recognized for the specified socket type.
+
address@hidden EAI_SOCKTYPE
address@hidden was not recognized.
+
address@hidden EAI_SYSTEM
+A system error occurred; the error code can be found in
address@hidden
address@hidden table
+
+Users are encouraged to read the
address@hidden://www.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html,
+"POSIX specification} for more details.
address@hidden deffn
+
+The following procedures take an @code{addrinfo} object as returned by
address@hidden:
+
address@hidden {Scheme Procedure} addrinfo:flags ai
+Return flags for @var{ai} as a bitwise or of @code{AI_} values (see above).
address@hidden deffn
+
address@hidden {Scheme Procedure} addrinfo:fam ai
+Return the address family of @var{ai} (a @code{AF_} value).
address@hidden deffn
+
address@hidden {Scheme Procedure} addrinfo:socktype ai
+Return the socket type for @var{ai} (a @code{SOCK_} value).
address@hidden deffn
+
address@hidden {Scheme Procedure} addrinfo:protocol ai
+Return the protocol of @var{ai}.
address@hidden deffn
+
address@hidden {Scheme Procedure} addrinfo:addr ai
+Return the socket address associated with @var{ai} as a @code{sockaddr}
+object (@pxref{Network Socket Address}).
address@hidden deffn
+
address@hidden {Scheme Procedure} addrinfo:canonname ai
+Return a string for the canonical name associated with @var{ai} if
+the @code{AI_CANONNAME} flag was supplied.
address@hidden deffn
+
 @subsubheading The Host Database
 @cindex @file{/etc/hosts}
 @cindex network database
@@ -2348,7 +2524,9 @@ The list of network addresses associated with @var{host}. 
 For
 Conversion}).
 @end deffn
 
-The following procedures are used to search the host database:
+The following procedures can be used to search the host database.  However,
address@hidden should be preferred over them since it's more generic and
+thread-safe.
 
 @deffn {Scheme Procedure} gethost [host]
 @deffnx {Scheme Procedure} gethostbyname hostname
diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi
index 8f8889c..0d192fa 100644
--- a/doc/ref/srfi-modules.texi
+++ b/doc/ref/srfi-modules.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009
address@hidden Copyright (C)  1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 
2007, 2008, 2009, 2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
@@ -1292,8 +1292,539 @@ from separate @code{and} and @code{let*}, or from 
@code{cond} with
 @subsection SRFI-4 - Homogeneous numeric vector datatypes
 @cindex SRFI-4
 
-The SRFI-4 procedures and data types are always available, @xref{Uniform
-Numeric Vectors}.
+SRFI-4 provides an interface to uniform numeric vectors: vectors whose elements
+are all of a single numeric type. Guile offers uniform numeric vectors for
+signed and unsigned 8-bit, 16-bit, 32-bit, and 64-bit integers, two sizes of
+floating point values, and, as an extension to SRFI-4, complex floating-point
+numbers of these two sizes.
+
+The standard SRFI-4 procedures and data types may be included via loading the
+appropriate module:
+
address@hidden
+(use-modules (srfi srfi-4))
address@hidden example
+
+This module is currently a part of the default Guile environment, but it is a
+good practice to explicitly import the module. In the future, using SRFI-4
+procedures without importing the SRFI-4 module will cause a deprecation message
+to be printed. (Of course, one may call the C functions at any time. Would that
+C had modules!)
+
address@hidden
+* SRFI-4 Overview::             The warp and weft of uniform numeric vectors.
+* SRFI-4 API::                  Uniform vectors, from Scheme and from C.
+* SRFI-4 Generic Operations::   The general, operating on the specific.
+* SRFI-4 and Bytevectors::      SRFI-4 vectors are backed by bytevectors.
+* SRFI-4 Extensions::           Guile-specific extensions to the standard.
address@hidden menu
+
address@hidden SRFI-4 Overview
address@hidden SRFI-4 - Overview
+
+Uniform numeric vectors can be useful since they consume less memory
+than the non-uniform, general vectors.  Also, since the types they can
+store correspond directly to C types, it is easier to work with them
+efficiently on a low level.  Consider image processing as an example,
+where you want to apply a filter to some image.  While you could store
+the pixels of an image in a general vector and write a general
+convolution function, things are much more efficient with uniform
+vectors: the convolution function knows that all pixels are unsigned
+8-bit values (say), and can use a very tight inner loop.
+
+This is implemented in Scheme by having the compiler notice calls to the SRFI-4
+accessors, and inline them to appropriate compiled code. From C you have access
+to the raw array; functions for efficiently working with uniform numeric 
vectors
+from C are listed at the end of this section.
+
+Uniform numeric vectors are the special case of one dimensional uniform
+numeric arrays.
+
+There are 12 standard kinds of uniform numeric vectors, and they all have their
+own complement of constructors, accessors, and so on. Procedures that operate 
on
+a specific kind of uniform numeric vector have a ``tag'' in their name,
+indicating the element type.
+
address@hidden @nicode
address@hidden u8
+unsigned 8-bit integers
+
address@hidden s8
+signed 8-bit integers
+
address@hidden u16
+unsigned 16-bit integers
+
address@hidden s16
+signed 16-bit integers
+
address@hidden u32
+unsigned 32-bit integers
+
address@hidden s32
+signed 32-bit integers
+
address@hidden u64
+unsigned 64-bit integers
+
address@hidden s64
+signed 64-bit integers
+
address@hidden f32
+the C type @code{float}
+
address@hidden f64
+the C type @code{double}
+
address@hidden table
+
+In addition, Guile supports uniform arrays of complex numbers, with the
+nonstandard tags:
+
address@hidden @nicode
+
address@hidden c32
+complex numbers in rectangular form with the real and imaginary part
+being a @code{float}
+
address@hidden c64
+complex numbers in rectangular form with the real and imaginary part
+being a @code{double}
+
address@hidden table
+
+The external representation (ie.@: read syntax) for these vectors is
+similar to normal Scheme vectors, but with an additional tag from the
+tables above indicating the vector's type.  For example,
+
address@hidden
+#u16(1 2 3)
+#f64(3.1415 2.71)
address@hidden lisp
+
+Note that the read syntax for floating-point here conflicts with
address@hidden for false.  In Standard Scheme one can write @code{(1 #f3)}
+for a three element list @code{(1 #f 3)}, but for Guile @code{(1 #f3)}
+is invalid.  @code{(1 #f 3)} is almost certainly what one should write
+anyway to make the intention clear, so this is rarely a problem.
+
+
address@hidden SRFI-4 API
address@hidden SRFI-4 - API
+
+Note that the @nicode{c32} and @nicode{c64} functions are only available from
address@hidden(srfi srfi-4 gnu)}.
+
address@hidden {Scheme Procedure} u8vector? obj
address@hidden {Scheme Procedure} s8vector? obj
address@hidden {Scheme Procedure} u16vector? obj
address@hidden {Scheme Procedure} s16vector? obj
address@hidden {Scheme Procedure} u32vector? obj
address@hidden {Scheme Procedure} s32vector? obj
address@hidden {Scheme Procedure} u64vector? obj
address@hidden {Scheme Procedure} s64vector? obj
address@hidden {Scheme Procedure} f32vector? obj
address@hidden {Scheme Procedure} f64vector? obj
address@hidden {Scheme Procedure} c32vector? obj
address@hidden {Scheme Procedure} c64vector? obj
address@hidden {C Function} scm_u8vector_p (obj)
address@hidden {C Function} scm_s8vector_p (obj)
address@hidden {C Function} scm_u16vector_p (obj)
address@hidden {C Function} scm_s16vector_p (obj)
address@hidden {C Function} scm_u32vector_p (obj)
address@hidden {C Function} scm_s32vector_p (obj)
address@hidden {C Function} scm_u64vector_p (obj)
address@hidden {C Function} scm_s64vector_p (obj)
address@hidden {C Function} scm_f32vector_p (obj)
address@hidden {C Function} scm_f64vector_p (obj)
address@hidden {C Function} scm_c32vector_p (obj)
address@hidden {C Function} scm_c64vector_p (obj)
+Return @code{#t} if @var{obj} is a homogeneous numeric vector of the
+indicated type.
address@hidden deffn
+
address@hidden  {Scheme Procedure} make-u8vector n [value]
address@hidden {Scheme Procedure} make-s8vector n [value]
address@hidden {Scheme Procedure} make-u16vector n [value]
address@hidden {Scheme Procedure} make-s16vector n [value]
address@hidden {Scheme Procedure} make-u32vector n [value]
address@hidden {Scheme Procedure} make-s32vector n [value]
address@hidden {Scheme Procedure} make-u64vector n [value]
address@hidden {Scheme Procedure} make-s64vector n [value]
address@hidden {Scheme Procedure} make-f32vector n [value]
address@hidden {Scheme Procedure} make-f64vector n [value]
address@hidden {Scheme Procedure} make-c32vector n [value]
address@hidden {Scheme Procedure} make-c64vector n [value]
address@hidden {C Function} scm_make_u8vector n [value]
address@hidden {C Function} scm_make_s8vector n [value]
address@hidden {C Function} scm_make_u16vector n [value]
address@hidden {C Function} scm_make_s16vector n [value]
address@hidden {C Function} scm_make_u32vector n [value]
address@hidden {C Function} scm_make_s32vector n [value]
address@hidden {C Function} scm_make_u64vector n [value]
address@hidden {C Function} scm_make_s64vector n [value]
address@hidden {C Function} scm_make_f32vector n [value]
address@hidden {C Function} scm_make_f64vector n [value]
address@hidden {C Function} scm_make_c32vector n [value]
address@hidden {C Function} scm_make_c64vector n [value]
+Return a newly allocated homogeneous numeric vector holding @var{n}
+elements of the indicated type.  If @var{value} is given, the vector
+is initialized with that value, otherwise the contents are
+unspecified.
address@hidden deffn
+
address@hidden  {Scheme Procedure} u8vector value @dots{}
address@hidden {Scheme Procedure} s8vector value @dots{}
address@hidden {Scheme Procedure} u16vector value @dots{}
address@hidden {Scheme Procedure} s16vector value @dots{}
address@hidden {Scheme Procedure} u32vector value @dots{}
address@hidden {Scheme Procedure} s32vector value @dots{}
address@hidden {Scheme Procedure} u64vector value @dots{}
address@hidden {Scheme Procedure} s64vector value @dots{}
address@hidden {Scheme Procedure} f32vector value @dots{}
address@hidden {Scheme Procedure} f64vector value @dots{}
address@hidden {Scheme Procedure} c32vector value @dots{}
address@hidden {Scheme Procedure} c64vector value @dots{}
address@hidden {C Function} scm_u8vector (values)
address@hidden {C Function} scm_s8vector (values)
address@hidden {C Function} scm_u16vector (values)
address@hidden {C Function} scm_s16vector (values)
address@hidden {C Function} scm_u32vector (values)
address@hidden {C Function} scm_s32vector (values)
address@hidden {C Function} scm_u64vector (values)
address@hidden {C Function} scm_s64vector (values)
address@hidden {C Function} scm_f32vector (values)
address@hidden {C Function} scm_f64vector (values)
address@hidden {C Function} scm_c32vector (values)
address@hidden {C Function} scm_c64vector (values)
+Return a newly allocated homogeneous numeric vector of the indicated
+type, holding the given parameter @var{value}s.  The vector length is
+the number of parameters given.
address@hidden deffn
+
address@hidden {Scheme Procedure} u8vector-length vec
address@hidden {Scheme Procedure} s8vector-length vec
address@hidden {Scheme Procedure} u16vector-length vec
address@hidden {Scheme Procedure} s16vector-length vec
address@hidden {Scheme Procedure} u32vector-length vec
address@hidden {Scheme Procedure} s32vector-length vec
address@hidden {Scheme Procedure} u64vector-length vec
address@hidden {Scheme Procedure} s64vector-length vec
address@hidden {Scheme Procedure} f32vector-length vec
address@hidden {Scheme Procedure} f64vector-length vec
address@hidden {Scheme Procedure} c32vector-length vec
address@hidden {Scheme Procedure} c64vector-length vec
address@hidden {C Function} scm_u8vector_length (vec)
address@hidden {C Function} scm_s8vector_length (vec)
address@hidden {C Function} scm_u16vector_length (vec)
address@hidden {C Function} scm_s16vector_length (vec)
address@hidden {C Function} scm_u32vector_length (vec)
address@hidden {C Function} scm_s32vector_length (vec)
address@hidden {C Function} scm_u64vector_length (vec)
address@hidden {C Function} scm_s64vector_length (vec)
address@hidden {C Function} scm_f32vector_length (vec)
address@hidden {C Function} scm_f64vector_length (vec)
address@hidden {C Function} scm_c32vector_length (vec)
address@hidden {C Function} scm_c64vector_length (vec)
+Return the number of elements in @var{vec}.
address@hidden deffn
+
address@hidden {Scheme Procedure} u8vector-ref vec i
address@hidden {Scheme Procedure} s8vector-ref vec i
address@hidden {Scheme Procedure} u16vector-ref vec i
address@hidden {Scheme Procedure} s16vector-ref vec i
address@hidden {Scheme Procedure} u32vector-ref vec i
address@hidden {Scheme Procedure} s32vector-ref vec i
address@hidden {Scheme Procedure} u64vector-ref vec i
address@hidden {Scheme Procedure} s64vector-ref vec i
address@hidden {Scheme Procedure} f32vector-ref vec i
address@hidden {Scheme Procedure} f64vector-ref vec i
address@hidden {Scheme Procedure} c32vector-ref vec i
address@hidden {Scheme Procedure} c64vector-ref vec i
address@hidden {C Function} scm_u8vector_ref (vec i)
address@hidden {C Function} scm_s8vector_ref (vec i)
address@hidden {C Function} scm_u16vector_ref (vec i)
address@hidden {C Function} scm_s16vector_ref (vec i)
address@hidden {C Function} scm_u32vector_ref (vec i)
address@hidden {C Function} scm_s32vector_ref (vec i)
address@hidden {C Function} scm_u64vector_ref (vec i)
address@hidden {C Function} scm_s64vector_ref (vec i)
address@hidden {C Function} scm_f32vector_ref (vec i)
address@hidden {C Function} scm_f64vector_ref (vec i)
address@hidden {C Function} scm_c32vector_ref (vec i)
address@hidden {C Function} scm_c64vector_ref (vec i)
+Return the element at index @var{i} in @var{vec}.  The first element
+in @var{vec} is index 0.
address@hidden deffn
+
address@hidden {Scheme Procedure} u8vector-set! vec i value
address@hidden {Scheme Procedure} s8vector-set! vec i value
address@hidden {Scheme Procedure} u16vector-set! vec i value
address@hidden {Scheme Procedure} s16vector-set! vec i value
address@hidden {Scheme Procedure} u32vector-set! vec i value
address@hidden {Scheme Procedure} s32vector-set! vec i value
address@hidden {Scheme Procedure} u64vector-set! vec i value
address@hidden {Scheme Procedure} s64vector-set! vec i value
address@hidden {Scheme Procedure} f32vector-set! vec i value
address@hidden {Scheme Procedure} f64vector-set! vec i value
address@hidden {Scheme Procedure} c32vector-set! vec i value
address@hidden {Scheme Procedure} c64vector-set! vec i value
address@hidden {C Function} scm_u8vector_set_x (vec i value)
address@hidden {C Function} scm_s8vector_set_x (vec i value)
address@hidden {C Function} scm_u16vector_set_x (vec i value)
address@hidden {C Function} scm_s16vector_set_x (vec i value)
address@hidden {C Function} scm_u32vector_set_x (vec i value)
address@hidden {C Function} scm_s32vector_set_x (vec i value)
address@hidden {C Function} scm_u64vector_set_x (vec i value)
address@hidden {C Function} scm_s64vector_set_x (vec i value)
address@hidden {C Function} scm_f32vector_set_x (vec i value)
address@hidden {C Function} scm_f64vector_set_x (vec i value)
address@hidden {C Function} scm_c32vector_set_x (vec i value)
address@hidden {C Function} scm_c64vector_set_x (vec i value)
+Set the element at index @var{i} in @var{vec} to @var{value}.  The
+first element in @var{vec} is index 0.  The return value is
+unspecified.
address@hidden deffn
+
address@hidden {Scheme Procedure} u8vector->list vec
address@hidden {Scheme Procedure} s8vector->list vec
address@hidden {Scheme Procedure} u16vector->list vec
address@hidden {Scheme Procedure} s16vector->list vec
address@hidden {Scheme Procedure} u32vector->list vec
address@hidden {Scheme Procedure} s32vector->list vec
address@hidden {Scheme Procedure} u64vector->list vec
address@hidden {Scheme Procedure} s64vector->list vec
address@hidden {Scheme Procedure} f32vector->list vec
address@hidden {Scheme Procedure} f64vector->list vec
address@hidden {Scheme Procedure} c32vector->list vec
address@hidden {Scheme Procedure} c64vector->list vec
address@hidden {C Function} scm_u8vector_to_list (vec)
address@hidden {C Function} scm_s8vector_to_list (vec)
address@hidden {C Function} scm_u16vector_to_list (vec)
address@hidden {C Function} scm_s16vector_to_list (vec)
address@hidden {C Function} scm_u32vector_to_list (vec)
address@hidden {C Function} scm_s32vector_to_list (vec)
address@hidden {C Function} scm_u64vector_to_list (vec)
address@hidden {C Function} scm_s64vector_to_list (vec)
address@hidden {C Function} scm_f32vector_to_list (vec)
address@hidden {C Function} scm_f64vector_to_list (vec)
address@hidden {C Function} scm_c32vector_to_list (vec)
address@hidden {C Function} scm_c64vector_to_list (vec)
+Return a newly allocated list holding all elements of @var{vec}.
address@hidden deffn
+
address@hidden  {Scheme Procedure} list->u8vector lst
address@hidden {Scheme Procedure} list->s8vector lst
address@hidden {Scheme Procedure} list->u16vector lst
address@hidden {Scheme Procedure} list->s16vector lst
address@hidden {Scheme Procedure} list->u32vector lst
address@hidden {Scheme Procedure} list->s32vector lst
address@hidden {Scheme Procedure} list->u64vector lst
address@hidden {Scheme Procedure} list->s64vector lst
address@hidden {Scheme Procedure} list->f32vector lst
address@hidden {Scheme Procedure} list->f64vector lst
address@hidden {Scheme Procedure} list->c32vector lst
address@hidden {Scheme Procedure} list->c64vector lst
address@hidden {C Function} scm_list_to_u8vector (lst)
address@hidden {C Function} scm_list_to_s8vector (lst)
address@hidden {C Function} scm_list_to_u16vector (lst)
address@hidden {C Function} scm_list_to_s16vector (lst)
address@hidden {C Function} scm_list_to_u32vector (lst)
address@hidden {C Function} scm_list_to_s32vector (lst)
address@hidden {C Function} scm_list_to_u64vector (lst)
address@hidden {C Function} scm_list_to_s64vector (lst)
address@hidden {C Function} scm_list_to_f32vector (lst)
address@hidden {C Function} scm_list_to_f64vector (lst)
address@hidden {C Function} scm_list_to_c32vector (lst)
address@hidden {C Function} scm_list_to_c64vector (lst)
+Return a newly allocated homogeneous numeric vector of the indicated type,
+initialized with the elements of the list @var{lst}.
address@hidden deffn
+
address@hidden  {C Function} SCM scm_take_u8vector (const scm_t_uint8 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s8vector (const scm_t_int8 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u16vector (const scm_t_uint16 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s16vector (const scm_t_int16 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u32vector (const scm_t_uint32 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s32vector (const scm_t_int32 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_u64vector (const scm_t_uint64 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_s64vector (const scm_t_int64 *data, 
size_t len)
address@hidden {C Function} SCM scm_take_f32vector (const float *data, size_t 
len)
address@hidden {C Function} SCM scm_take_f64vector (const double *data, size_t 
len)
address@hidden {C Function} SCM scm_take_c32vector (const float *data, size_t 
len)
address@hidden {C Function} SCM scm_take_c64vector (const double *data, size_t 
len)
+Return a new uniform numeric vector of the indicated type and length
+that uses the memory pointed to by @var{data} to store its elements.
+This memory will eventually be freed with @code{free}.  The argument
address@hidden specifies the number of elements in @var{data}, not its size
+in bytes.
+
+The @code{c32} and @code{c64} variants take a pointer to a C array of
address@hidden or @code{double}s.  The real parts of the complex numbers
+are at even indices in that array, the corresponding imaginary parts are
+at the following odd index.
address@hidden deftypefn
+
address@hidden {C Function} {const scm_t_uint8 *} scm_u8vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int8 *} scm_s8vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint16 *} scm_u16vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int16 *} scm_s16vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint32 *} scm_u32vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int32 *} scm_s32vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_uint64 *} scm_u64vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const scm_t_int64 *} scm_s64vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const float *} scm_f23vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const double *} scm_f64vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const float *} scm_c32vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {const double *} scm_c64vector_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+Like @code{scm_vector_elements} (@pxref{Vector Accessing from C}), but
+returns a pointer to the elements of a uniform numeric vector of the
+indicated kind.
address@hidden deftypefn
+
address@hidden {C Function} {scm_t_uint8 *} scm_u8vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int8 *} scm_s8vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint16 *} scm_u16vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int16 *} scm_s16vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint32 *} scm_u32vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int32 *} scm_s32vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_uint64 *} scm_u64vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {scm_t_int64 *} scm_s64vector_writable_elements 
(SCM vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {float *} scm_f23vector_writable_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {double *} scm_f64vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {float *} scm_c32vector_writable_elements (SCM vec, 
scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
address@hidden {C Function} {double *} scm_c64vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+Like @code{scm_vector_writable_elements} (@pxref{Vector Accessing from
+C}), but returns a pointer to the elements of a uniform numeric vector
+of the indicated kind.
address@hidden deftypefn
+
address@hidden SRFI-4 Generic Operations
address@hidden SRFI-4 - Generic operations
+
+Guile also provides procedures that operate on all types of uniform numeric
+vectors.  In what is probably a bug, these procedures are currently available 
in
+the default environment as well; however prudent hackers will make sure to
+import @code{(srfi srfi-4 gnu)} before using these.
+
address@hidden {C Function} int scm_is_uniform_vector (SCM uvec)
+Return non-zero when @var{uvec} is a uniform numeric vector, zero
+otherwise.
address@hidden deftypefn
+
address@hidden {C Function} size_t scm_c_uniform_vector_length (SCM uvec)
+Return the number of elements of @var{uvec} as a @code{size_t}.
address@hidden deftypefn
+
address@hidden  {Scheme Procedure} uniform-vector? obj
address@hidden {C Function} scm_uniform_vector_p (obj)
+Return @code{#t} if @var{obj} is a homogeneous numeric vector of the
+indicated type.
address@hidden deffn
+
address@hidden  {Scheme Procedure} uniform-vector-length vec
address@hidden {C Function} scm_uniform_vector_length (vec)
+Return the number of elements in @var{vec}.
address@hidden deffn
+
address@hidden  {Scheme Procedure} uniform-vector-ref vec i
address@hidden {C Function} scm_uniform_vector_ref (vec i)
+Return the element at index @var{i} in @var{vec}.  The first element
+in @var{vec} is index 0.
address@hidden deffn
+
address@hidden  {Scheme Procedure} uniform-vector-set! vec i value
address@hidden {C Function} scm_uniform_vector_set_x (vec i value)
+Set the element at index @var{i} in @var{vec} to @var{value}.  The
+first element in @var{vec} is index 0.  The return value is
+unspecified.
address@hidden deffn
+
address@hidden  {Scheme Procedure} uniform-vector->list vec
address@hidden {C Function} scm_uniform_vector_to_list (vec)
+Return a newly allocated list holding all elements of @var{vec}.
address@hidden deffn
+
address@hidden  {C Function} {const void *} scm_uniform_vector_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+Like @code{scm_vector_elements} (@pxref{Vector Accessing from C}), but
+returns a pointer to the elements of a uniform numeric vector.
address@hidden deftypefn
+
address@hidden  {C Function} {void *} scm_uniform_vector_writable_elements (SCM 
vec, scm_t_array_handle *handle, size_t *lenp, ssize_t *incp)
+Like @code{scm_vector_writable_elements} (@pxref{Vector Accessing from
+C}), but returns a pointer to the elements of a uniform numeric vector.
address@hidden deftypefn
+
+Unless you really need to the limited generality of these functions, it is best
+to use the type-specific functions, or the generalized vector accessors.
+
address@hidden SRFI-4 and Bytevectors
address@hidden SRFI-4 - Relation to bytevectors
+
+Guile implements SRFI-4 vectors using bytevectors (@pxref{Bytevectors}). Often
+when you have a numeric vector, you end up wanting to write its bytes 
somewhere,
+or have access to the underlying bytes, or read in bytes from somewhere else.
+Bytevectors are very good at this sort of thing. But the SRFI-4 APIs are nicer
+to use when doing number-crunching, because they are addressed by element and
+not by byte.
+
+So as a compromise, Guile allows all bytevector functions to operate on numeric
+vectors. They address the underlying bytes in the native endianness, as one
+would expect.
+
+Following the same reasoning, that it's just bytes underneath, Guile also 
allows
+uniform vectors of a given type to be accessed as if they were of any type. One
+can fill a @nicode{u32vector}, and access its elements with
address@hidden One can use @nicode{f64vector-ref} on bytevectors. It's
+all the same to Guile.
+
+In this way, uniform numeric vectors may be written to and read from
+input/output ports using the procedures that operate on bytevectors.
+
address@hidden, for more information.
+
+
address@hidden SRFI-4 Extensions
address@hidden SRFI-4 - Guile extensions
+
+Guile defines some useful extensions to SRFI-4, which are not available in the
+default Guile environment. They may be imported by loading the extensions
+module:
+
address@hidden
+(use-modules (srfi srfi-4 gnu))
address@hidden example
+
address@hidden  {Scheme Procedure} any->u8vector obj
address@hidden {Scheme Procedure} any->s8vector obj
address@hidden {Scheme Procedure} any->u16vector obj
address@hidden {Scheme Procedure} any->s16vector obj
address@hidden {Scheme Procedure} any->u32vector obj
address@hidden {Scheme Procedure} any->s32vector obj
address@hidden {Scheme Procedure} any->u64vector obj
address@hidden {Scheme Procedure} any->s64vector obj
address@hidden {Scheme Procedure} any->f32vector obj
address@hidden {Scheme Procedure} any->f64vector obj
address@hidden {Scheme Procedure} any->c32vector obj
address@hidden {Scheme Procedure} any->c64vector obj
address@hidden {C Function} scm_any_to_u8vector (obj)
address@hidden {C Function} scm_any_to_s8vector (obj)
address@hidden {C Function} scm_any_to_u16vector (obj)
address@hidden {C Function} scm_any_to_s16vector (obj)
address@hidden {C Function} scm_any_to_u32vector (obj)
address@hidden {C Function} scm_any_to_s32vector (obj)
address@hidden {C Function} scm_any_to_u64vector (obj)
address@hidden {C Function} scm_any_to_s64vector (obj)
address@hidden {C Function} scm_any_to_f32vector (obj)
address@hidden {C Function} scm_any_to_f64vector (obj)
address@hidden {C Function} scm_any_to_c32vector (obj)
address@hidden {C Function} scm_any_to_c64vector (obj)
+Return a (maybe newly allocated) uniform numeric vector of the indicated
+type, initialized with the elements of @var{obj}, which must be a list,
+a vector, or a uniform vector.  When @var{obj} is already a suitable
+uniform numeric vector, it is returned unchanged.
address@hidden deffn
+
 
 @node SRFI-6
 @subsection SRFI-6 - Basic String Ports
diff --git a/doc/ref/standard-library.am b/doc/ref/standard-library.am
new file mode 100644
index 0000000..27246f4
--- /dev/null
+++ b/doc/ref/standard-library.am
@@ -0,0 +1,2 @@
+# Automatically generated, do not edit.
+standard_library_scm_files = $(top_srcdir)/module/statprof.scm 
$(top_srcdir)/module/sxml/apply-templates.scm 
$(top_srcdir)/module/sxml/fold.scm $(top_srcdir)/module/sxml/simple.scm 
$(top_srcdir)/module/sxml/ssax.scm 
$(top_srcdir)/module/sxml/ssax/input-parse.scm 
$(top_srcdir)/module/sxml/transform.scm $(top_srcdir)/module/sxml/xpath.scm 
$(top_srcdir)/module/texinfo.scm $(top_srcdir)/module/texinfo/docbook.scm 
$(top_srcdir)/module/texinfo/html.scm $(top_srcdir)/module/texinfo/indexing.scm 
$(top_srcdir)/module/texinfo/string-utils.scm 
$(top_srcdir)/module/texinfo/plain-text.scm 
$(top_srcdir)/module/texinfo/serialize.scm 
$(top_srcdir)/module/texinfo/reflection.scm 
\ No newline at end of file
diff --git a/doc/ref/standard-library.scm b/doc/ref/standard-library.scm
new file mode 100644
index 0000000..7fd17b5
--- /dev/null
+++ b/doc/ref/standard-library.scm
@@ -0,0 +1,48 @@
+;; The modules to document
+(define *modules*
+  '(((statprof)
+     "Statistical profiler")
+    ((sxml apply-templates)
+     "A more XSLT-like approach to SXML transformations")
+    ((sxml fold)
+     "Fold-based SXML transformation operators")
+    ((sxml simple)
+     "Convenient XML parsing and serializing")
+    ((sxml ssax)
+     "Functional-style XML parsing for Scheme")
+    ((sxml ssax input-parse)
+     "The SSAX tokenizer, optimized for Guile")
+    ((sxml transform)
+     "A higher-order SXML transformation operator, "
+     (code "pre-post-order"))
+    ((sxml xpath)
+     "XPath for SXML")
+    ((texinfo)
+     "Parse texinfo files or fragments into " (code "stexi") ", a "
+     "scheme representation")
+    ((texinfo docbook)
+     "Transform a subset of docbook into " (code "stexi"))
+    ((texinfo html)
+     "Transform " (code "stexi") " into HTML")
+    ((texinfo indexing)
+     "Extract an index from a piece of " (code "stexi"))
+    ((texinfo string-utils)
+     "String utility functions used by the texinfo processor")
+    ((texinfo plain-text)
+     "Render " (code "stexi") " as plain text")
+    ((texinfo serialize)
+     "Render " (code "stexi") " as texinfo")
+    ((texinfo reflection)
+     "Enable texinfo across Guile's help system")))
+
+(define *module-sources*
+  '(((sxml ssax) . "http://ssax.sourceforge.net/";)
+    ((sxml xpath) . "http://ssax.sourceforge.net/";)
+    ((sxml transform) . "http://ssax.sourceforge.net/";)
+    ((sxml apply-templates) . "http://ssax.sourceforge.net/";)
+    ((sxml ssax input-parse) . "http://ssax.sourceforge.net/";)
+    ((htmlprag) . "http://neilvandyke.org/htmlprag/";)))
+
+(define *scripts* '())
+
+;; arch-tag: e493ad42-ad58-451c-a2d6-b17ba6c1d1d0
diff --git a/doc/ref/vm.texi b/doc/ref/vm.texi
index fe5c1ee..0b56b4b 100644
--- a/doc/ref/vm.texi
+++ b/doc/ref/vm.texi
@@ -1,15 +1,15 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Guile Reference Manual.
address@hidden Copyright (C)  2008,2009
address@hidden Copyright (C)  2008,2009,2010
 @c   Free Software Foundation, Inc.
 @c See the file guile.texi for copying conditions.
 
 @node A Virtual Machine for Guile
 @section A Virtual Machine for Guile
 
-Guile has both an interpreter and a compiler. To a user, the
-difference is largely transparent---interpreted and compiled
-procedures can call each other as they please.
+Guile has both an interpreter and a compiler. To a user, the difference
+is transparent---interpreted and compiled procedures can call each other
+as they please.
 
 The difference is that the compiler creates and interprets bytecode
 for a custom virtual machine, instead of interpreting the
@@ -33,21 +33,19 @@ machine.
 @subsection Why a VM?
 
 @cindex interpreter
address@hidden evaluator
-For a long time, Guile only had an interpreter, called the
address@hidden Guile's evaluator operates directly on the
-S-expression representation of Scheme source code.
+For a long time, Guile only had an interpreter. Guile's interpreter
+operated directly on the S-expression representation of Scheme source
+code.
 
-But while the evaluator is highly optimized and hand-tuned, and
-contains some extensive speed trickery (@pxref{Memoization}), it still
+But while the interpreter was highly optimized and hand-tuned, it still
 performs many needless computations during the course of evaluating an
 expression. For example, application of a function to arguments
-needlessly conses up the arguments in a list. Evaluation of an
-expression always has to figure out what the car of the expression is
--- a procedure, a memoized form, or something else. All values have to
-be allocated on the heap. Et cetera.
+needlessly consed up the arguments in a list. Evaluation of an
+expression always had to figure out what the car of the expression is --
+a procedure, a memoized form, or something else. All values have to be
+allocated on the heap. Et cetera.
 
-The solution to this problem is to compile the higher-level language,
+The solution to this problem was to compile the higher-level language,
 Scheme, into a lower-level language for which all of the checks and
 dispatching have already been done---the code is instead stripped to
 the bare minimum needed to ``do the job''.
@@ -71,7 +69,21 @@ for Guile (@code{cons}, @code{struct-ref}, etc.).
 So this is what Guile does. The rest of this section describes that VM
 that Guile implements, and the compiled procedures that run on it.
 
-Note that this decision to implement a bytecode compiler does not
+Before moving on, though, we should note that though we spoke of the
+interpreter in the past tense, Guile still has an interpreter. The
+difference is that before, it was Guile's main evaluator, and so was
+implemented in highly optimized C; now, it is actually implemented in
+Scheme, and compiled down to VM bytecode, just like any other program.
+(There is still a C interpreter around, used to bootstrap the compiler,
+but it is not normally used at runtime.)
+
+The upside of implementing the interpreter in Scheme is that we preserve
+tail calls and multiple-value handling between interpreted and compiled
+code. The downside is that the interpreter in Guile 2.0 is slower than
+the interpreter in 1.8. We hope the that the compiler's speed makes up
+for the loss!
+
+Also note that this decision to implement a bytecode compiler does not
 preclude native compilation. We can compile from bytecode to native
 code at runtime, or even do ahead of time compilation. More
 possibilities are discussed in @ref{Extending the Compiler}.
@@ -79,12 +91,9 @@ possibilities are discussed in @ref{Extending the Compiler}.
 @node VM Concepts
 @subsection VM Concepts
 
-A virtual machine (VM) is a Scheme object. Users may create virtual
-machines using the standard procedures described later in this manual,
-but that is usually unnecessary, as Guile ensures that there is one
-virtual machine per thread. When a VM-compiled procedure is run, Guile
-looks up the virtual machine for the current thread and executes the
-procedure using that VM.
+Compiled code is run by a virtual machine (VM). Each thread has its own
+VM. When a compiled procedure is run, Guile looks up the virtual machine
+for the current thread and executes the procedure using that VM.
 
 Guile's virtual machine is a stack machine---that is, it has few
 registers, and the instructions defined in the VM operate by pushing
@@ -113,12 +122,6 @@ the ``program counter'' (pc). This set of registers is 
pretty typical
 for stack machines; their exact meanings in the context of Guile's VM
 are described in the next section.
 
-A virtual machine executes by loading a compiled procedure, and
-executing the object code associated with that procedure. Of course,
-that procedure may call other procedures, tail-call others, ad
-infinitum---indeed, within a guile whose modules have all been
-compiled to object code, one might never leave the virtual machine.
-
 @c wingo: The following is true, but I don't know in what context to
 @c describe it. A documentation FIXME.
 
@@ -241,8 +244,8 @@ prove statements about functions. It is especially good at 
describing
 scope relations, and it is for that reason that we mention it here.
 
 Guile allocates all variables on the stack. When a lexically enclosed
-procedure with free variables---a @dfn{closure}---is created, it
-copies those variables its free variable vector. References to free
+procedure with free variables---a @dfn{closure}---is created, it copies
+those variables into its free variable vector. References to free
 variables are then redirected through the free variable vector.
 
 If a variable is ever @code{set!}, however, it will need to be
@@ -306,42 +309,45 @@ We can see how these concepts tie together by 
disassembling the
 @smallexample
 scheme@@(guile-user)> (define (foo a) (lambda (b) (list foo a b)))
 scheme@@(guile-user)> ,x foo
-Disassembly of #<program foo (a)>:
+Disassembly of #<procedure foo (a)>:
 
-   0    (object-ref 1)          ;; #<program b7e478b0 at <unknown port>:0:16 
(b)>
-   2    (local-ref 0)           ;; `a' (arg)
-   4    (vector 0 1)            ;; 1 element
-   7    (make-closure)                  
-   8    (return)                        
+   0    (assert-nargs-ee 0 1)           
+   3    (reserve-locals 0 1)            
+   6    (object-ref 1)                  ;; #<procedure 85bfec0 at <current 
input>:0:16 (b)>
+   8    (local-ref 0)                   ;; `a'
+  10    (make-closure 0 1)              
+  13    (return)                        
 
 ----------------------------------------
-Disassembly of #<program b7e478b0 at <unknown port>:0:16 (b)>:
-
-   0    (toplevel-ref 1)        ;; `foo'
-   2    (free-ref 0)            ;; (closure variable)
-   4    (local-ref 0)           ;; `b' (arg)
-   6    (list 0 3)              ;; 3 elements         at (unknown file):0:28
-   9    (return)                        
+Disassembly of #<procedure 85bfec0 at <current input>:0:16 (b)>:
+
+   0    (assert-nargs-ee 0 1)           
+   3    (reserve-locals 0 1)            
+   6    (toplevel-ref 1)                ;; `foo'
+   8    (free-ref 0)                    ;; (closure variable)
+  10    (local-ref 0)                   ;; `b'
+  12    (list 0 3)                      ;; 3 elements         at (unknown 
file):0:28
+  15    (return)                        
 @end smallexample
 
-At @code{ip} 0, we load up the compiled lambda. @code{Ip} 2 and 4
-create the free variables vector, and @code{ip} 7 makes the
-closure---binding code (from the compiled lambda) with data (the
-free-variable vector). Finally we return the closure.
-
-The second stanza disassembles the compiled lambda. Toplevel variables
-are resolved relative to the module that was current when the
-procedure was created. This lookup occurs lazily, at the first time
-the variable is actually referenced, and the location of the lookup is
-cached so that future references are very cheap. @xref{Environment
-Control Instructions}, for more details.
-
-Then we see a reference to an external variable, corresponding to
address@hidden The disassembler doesn't have enough information to give a
-name to that variable, so it just marks it as being a ``closure
-variable''. Finally we see the reference to @code{b}, then the
address@hidden opcode, an inline implementation of the @code{list} scheme
-routine.
+First there's some prelude, where @code{foo} checks that it was called with 
only
+1 argument. Then at @code{ip} 6, we load up the compiled lambda. @code{Ip} 8
+loads up `a', so that it can be captured into a closure by at @code{ip}
+10---binding code (from the compiled lambda) with data (the free-variable
+vector). Finally we return the closure.
+
+The second stanza disassembles the compiled lambda. After the prelude, we note
+that toplevel variables are resolved relative to the module that was current
+when the procedure was created. This lookup occurs lazily, at the first time 
the
+variable is actually referenced, and the location of the lookup is cached so
+that future references are very cheap. @xref{Environment Control Instructions},
+for more details.
+
+Then we see a reference to a free variable, corresponding to @code{a}. The
+disassembler doesn't have enough information to give a name to that variable, 
so
+it just marks it as being a ``closure variable''. Finally we see the reference
+to @code{b}, then the @code{list} opcode, an inline implementation of the
address@hidden scheme routine.
 
 @node Instruction Set
 @subsection Instruction Set
@@ -548,8 +554,8 @@ All the conditional branch instructions described below 
work in the
 same way:
 
 @itemize
address@hidden They pop off the Scheme object located on the stack and use it as
-the branch condition;
address@hidden They pop off Scheme object(s) located on the stack for use in the
+branch condition
 @item If the condition is true, then the instruction pointer is
 increased by the offset passed as an argument to the branch
 instruction;
@@ -557,22 +563,20 @@ instruction;
 the one to which the instruction pointer points).
 @end itemize
 
-Note that the offset passed to the instruction is encoded on two 8-bit
-integers which are then combined by the VM as one 16-bit integer. Note
-also that jump targets in Guile are aligned on 8-byte boundaries, and
-that the offset refers to the @var{n}th 8-byte boundary, effectively
-giving Guile a 19-bit relative address space.
+Note that the offset passed to the instruction is encoded as three 8-bit
+integers, in big-endian order, effectively giving Guile a 24-bit
+relative address space.
 
 @deffn Instruction br offset
-Jump to @var{offset}.
+Jump to @var{offset}. No values are popped.
 @end deffn
 
 @deffn Instruction br-if offset
-Jump to @var{offset} if the condition on the stack is not false.
+Jump to @var{offset} if the object on the stack is not false.
 @end deffn
 
 @deffn Instruction br-if-not offset
-Jump to @var{offset} if the condition on the stack is false.
+Jump to @var{offset} if the object on the stack is false.
 @end deffn
 
 @deffn Instruction br-if-eq offset
@@ -678,14 +682,12 @@ and arguments off the stack, and push the result of 
calling
 @code{scm_apply}.
 @end deffn
 
address@hidden Instruction goto/args nargs
address@hidden Instruction tail-call nargs
 Like @code{call}, but reusing the current continuation. This
 instruction implements tail calls as required by RnRS.
 
-For compiled procedures, that means that @code{goto/args} simply
+For compiled procedures, that means that @code{tail-call} simply
 shuffles down the procedure and arguments to the current stack frame.
-The @code{goto/*} instruction family is named as it is because tail
-calls are equivalent to @code{goto}, along with relabeled variables.
 
 For non-VM procedures, the result is the same, but the current VM
 invocation remains on the C stack. True tail calls are not currently
@@ -693,16 +695,16 @@ possible between compiled and non-compiled procedures.
 @end deffn
 
 @deffn Instruction apply nargs
address@hidden Instruction goto/apply nargs
-Like @code{call} and @code{goto/args}, except that the top item on the
address@hidden Instruction tail-apply nargs
+Like @code{call} and @code{tail-call}, except that the top item on the
 stack must be a list. The elements of that list are then pushed on the
 stack and treated as additional arguments, replacing the list itself,
 then the procedure is invoked as usual.
 @end deffn
 
 @deffn Instruction call/nargs
address@hidden Instruction goto/nargs
-These are like @code{call} and @code{goto/args}, except they take the
address@hidden Instruction tail-call/nargs
+These are like @code{call} and @code{tail-call}, except they take the
 number of arguments from the stack instead of the instruction stream.
 These instructions are used in the implementation of multiple value
 returns, where the actual number of values is pushed on the stack.
@@ -767,7 +769,7 @@ Signals an error if there is an insufficient number of 
values.
 @end deffn
 
 @deffn Instruction call/cc
address@hidden Instruction goto/cc
address@hidden Instruction tail-call/cc
 Capture the current continuation, and then call (or tail-call) the
 procedure on the top of the stack, with the continuation as the
 argument.
@@ -821,7 +823,7 @@ Push @code{#t} onto the stack.
 @end deffn
 
 @deffn Instruction make-nil
-Push @code{%nil} onto the stack.
+Push @code{#nil} onto the stack.
 @end deffn
 
 @deffn Instruction make-eol
diff --git a/doc/tutorial/ChangeLog-2008 b/doc/tutorial/ChangeLog-2008
deleted file mode 100644
index 9b78ed7..0000000
--- a/doc/tutorial/ChangeLog-2008
+++ /dev/null
@@ -1,54 +0,0 @@
-2004-07-29  Kevin Ryde  <address@hidden>
-
-       * doc/tutorial/guile-tut.texi (What is libguile): Correction to
-       reference manual "Data representation" cross reference.
-
-2004-06-28  Marius Vollmer  <address@hidden>
-
-       * Makefile.am: Removed home-grown code for HTML generation.
-       Automake does it for us now.
-
-       * guile-tut.texi (Top): Use @ifnottex instead of @ifinfo for the
-       beneift of makeinfo --html.
-
-2003-09-27  Neil Jerram  <address@hidden>
-
-       * guile-tut.texi (Using Guile to program in Scheme): Fix result of
-       `(reverse ls)', and change `squaring function' example to use `(*
-       n n)' instead of `(expt n n)'.  Thanks to Jack Pavlovsky for
-       pointing these out.
-
-2003-05-27  Dirk Herrmann  <address@hidden>
-
-       * guile-tut.texi: Fix example, where a vector constant is used
-       without quoting.
-
-2002-07-16  Neil Jerram  <address@hidden>
-
-       * guile-tut.texi (Jump Start): Apply patch from M. Luedde on use
-       of tail recursion to avoid stack overflow (with minor editing).
-
-2001-11-18  Neil Jerram  <address@hidden>
-
-       * guile-tut.texi (History of Guile and its motivations): Update
-       Tcl war URLs.
-
-2001-09-19  Thien-Thi Nguyen  <address@hidden>
-
-       * guile-tut.texi: Fix improper address@hidden' usage.
-       Fix number typo in "Jump Start" section.
-
-2001-08-27  Neil Jerram  <address@hidden>
-
-       * Makefile.am (guile_tut_TEXINFOS): Removed.
-       (TEXINFO_TEX): Added; avoids shipping multiple copies of
-       texinfo.tex in a single distribution.
-
-       * guile-tut.texi: Incorporate text previously in separate AUTHORS
-       file.
-
-2001-08-27  Neil Jerram  <address@hidden>
-
-       The change log for files in this directory continues backwards
-       from 2001-08-27 in ../ChangeLog, as all the Guile documentation
-       prior to this date was contained in a single directory.
diff --git a/doc/tutorial/ChangeLog-guile-doc-tutorial 
b/doc/tutorial/ChangeLog-guile-doc-tutorial
deleted file mode 100644
index 9d7233a..0000000
--- a/doc/tutorial/ChangeLog-guile-doc-tutorial
+++ /dev/null
@@ -1,16 +0,0 @@
-2001-01-27  Neil Jerram  <address@hidden>
-
-       * texinfo.tex: Replaced by latest version from ftp.gnu.org.
-
-1999-12-06  Gary Houston  <address@hidden>
-
-       * guile-tut.texi: tweaked the dircategory.
-
-1998-01-28  Mark Galassi  <address@hidden>
-
-       * guile-tut.texi: set @dircategory to "Scheme Programming".
-
-Mon Aug 18 16:11:43 1997  Jim Blandy  <address@hidden>
-
-       * texinfo.tex: Installed from texinfo release 3.11.
-
diff --git a/doc/tutorial/Makefile.am b/doc/tutorial/Makefile.am
deleted file mode 100644
index d359c4f..0000000
--- a/doc/tutorial/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-## Process this file with Automake to create Makefile.in
-##
-##     Copyright (C) 1998, 2006, 2008 Free Software Foundation, Inc.
-##
-##   This file is part of GUILE.
-##   
-##   GUILE is free software; you can redistribute it and/or modify it
-##   under the terms of the GNU Lesser General Public License as
-##   published by the Free Software Foundation; either version 3, or
-##   (at your option) any later version.
-##
-##   GUILE is distributed in the hope that it will be useful, but
-##   WITHOUT ANY WARRANTY; without even the implied warranty of
-##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-##   GNU Lesser General Public License for more details.
-##
-##   You should have received a copy of the GNU Lesser General Public
-##   License along with GUILE; see the file COPYING.LESSER.  If not,
-##   write to the Free Software Foundation, Inc., 51 Franklin Street,
-##   Fifth Floor, Boston, MA 02110-1301 USA
-
-AUTOMAKE_OPTIONS = gnu
-
-info_TEXINFOS = guile-tut.texi
-
-EXTRA_DIST = ChangeLog-2008
diff --git a/doc/tutorial/guile-tut.texi b/doc/tutorial/guile-tut.texi
deleted file mode 100644
index ed0b202..0000000
--- a/doc/tutorial/guile-tut.texi
+++ /dev/null
@@ -1,1373 +0,0 @@
-\input texinfo @c -*-texinfo-*-
address@hidden %**start of header
address@hidden guile-tut.info
address@hidden Guile Tutorial
address@hidden guile-tut
-
address@hidden version.texi
-
address@hidden The Algorithmic Language Scheme
address@hidden
-* Guile Tutorial: (guile-tut).  The Guile tutorial.
address@hidden direntry
-
address@hidden off
address@hidden Choices for setchapternewpage are {on,off,odd}.
address@hidden 2
address@hidden %**end of header
-
address@hidden
address@hidden
address@hidden DL: lose the egregious vertical whitespace, esp. around examples
address@hidden but paras in @defun-like things don't have parindent
address@hidden 4pt plus 1pt
address@hidden iftex
-
address@hidden
address@hidden Guile Tutorial
address@hidden For use with Guile @value{VERSION}
address@hidden Last updated @value{UPDATED}
-
address@hidden Mark Galassi
address@hidden Cygnus Solutions and Los Alamos National Laboratory
address@hidden @email{rosalia@@nis.lanl.gov}
-
address@hidden
address@hidden 0pt plus 1filll
-Copyright @copyright{} 1997, 1998, 2004, 2006 Free Software Foundation
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the author.
address@hidden titlepage
-
-
address@hidden
address@hidden Top
address@hidden Guile Tutorial
address@hidden ifnottex
-
address@hidden
-This file gives a tutorial introduction to Guile.
-
-Copyright (C) 1997, 2004, 2006 Free Software Foundation
-
-Permission is granted to make and distribute verbatim copies of
-this manual provided the copyright notice and this permission notice
-are preserved on all copies.
-
address@hidden
-Permission is granted to process this file through TeX and print the
-results, provided the printed document carries copying permission
-notice identical to this one except for the removal of this paragraph
-(this paragraph not being relevant to the printed manual).
-
address@hidden ignore
-Permission is granted to copy and distribute modified versions of this
-manual under the conditions for verbatim copying, provided that the entire
-resulting derived work is distributed under the terms of a permission
-notice identical to this one.
-
-Permission is granted to copy and distribute translations of this manual
-into another language, under the above conditions for modified versions,
-except that this permission notice may be stated in a translation approved
-by the author.
address@hidden ifinfo
-
-
address@hidden
-* Jump Start::
-* Introduction::
-* Using Guile to program in Scheme::
-* Guile in a Library::
-* Regular Expression Support::
-* UNIX System Programming::
-* Where to find more Guile/Scheme resources::
-* Concept Index::
-* Procedure and Macro Index::
-* Variable Index::
-* Type Index::
address@hidden menu
-
-
address@hidden Jump Start
address@hidden Jump Start
-
address@hidden
-Before giving an overview of Guile, I present some simple commands and
-programs that you can type to get going immediately.
-
-Start by invoking the Guile interpreter.  Usually you do this by just
-typing @code{guile}.  Then type (or paste) the following expressions at
-the prompt; the interpreter's response is preceded (in this manual) by
address@hidden
-
address@hidden
-<shell-prompt> guile
address@hidden example
address@hidden
-(+ 20 35)
address@hidden 55
-(define (recursive-factorial n)
-  (if (zero? n)
-      1
-      (* n (recursive-factorial (- n 1)))))
-(recursive-factorial 5)
address@hidden 120
-(quit)
address@hidden lisp
-
-In this example we did some simple arithmetic @code{(+ 20 35)} and got
-the answer @code{55}.  Then we coded the classic (and rather wasteful)
-factorial algorithm and computed the factorial of @code{55}.  Finally we
-quit with @code{(quit)}.
-
address@hidden bignumbers
-We can find out about some of Scheme's nice features by asking for the
-factorial of some big number, say @code{500}.  On some systems the
-correct answer will be returned (I do not indicate calling and leaving
-the guile session anymore).
-
address@hidden
-(recursive-factorial 500)
address@hidden 1220136825991110068701238785423046926253574342803192842192413588
-   3858453731538819976054964475022032818630136164771482035841633787
-   2207817720048078520515932928547790757193933060377296085908627042
-   9174547882424912726344305670173270769461062802310452644218878789
-   4657547771498634943677810376442740338273653974713864778784954384
-   8959553753799042324106127132698432774571554630997720278101456108
-   1188373709531016356324432987029563896628911658974769572087926928
-   8712817800702651745077684107196243903943225364226052349458501299
-   1857150124870696156814162535905669342381300885624924689156412677
-   5654481886506593847951775360894005745238940335798476363944905313
-   0623237490664450488246650759467358620746379251842004593696929810
-   2226397195259719094521782333175693458150855233282076282002340262
-   6907898342451712006207714640979456116127629145951237229913340169
-   5523638509428855920187274337951730145863575708283557801587354327
-   6888868012039988238470215146760544540766353598417443048012893831
-   3896881639487469658817504506926365338175055478128640000000000000
-   0000000000000000000000000000000000000000000000000000000000000000
-   00000000000000000000000000000000000000000000000
address@hidden lisp
-
-The result is an example of Scheme's @emph{bignumbers}.  However, there
-are operating environments that provide (by default) too little stack
-space.  They will instead produce an error message like this:
-
address@hidden
-(recursive-factorial 500)
address@hidden
-ERROR: Stack overflow
-ABORT: (stack-overflow)
address@hidden lisp
-
-Rather than enlarging the system's stack, we can implement the algorithm
-such that it does not consume increasing stack space.  This is called a
address@hidden recursive} implementation.  The following definition is tail
-recursive and so should work on all systems.
-
address@hidden
-(define (tail-recursive-factorial n)
-  (define (loop k l)
-    (if (zero? k) l
-       (loop (- k 1) (* k l))))
-  (loop n 1))
-
-(tail-recursive-factorial 500)
address@hidden 1220136825991110068701238785423046926253574342803192842192413588
-        ;; ... skipped
address@hidden lisp
-
-This is the most basic use of Guile: a simple Scheme interpreter.  In
-the rest of this tutorial I will show you how Guile has many facets: it
-is also an @emph{extensible} interpreter (to which many features can be
-easilly added) and an @emph{embeddable} interpreter (which can be
-invoked from your C programs).
-
-
address@hidden Introduction
address@hidden Introduction
-
address@hidden
address@hidden (which can stand for @emph{GNU Ubiquitous Intelligent
-Language Extension}) is the GNU extension language.  It started out as
-an embeddable Scheme interpreter, and has rapidly evolved into a
-kitchen-sink package including a standalone Scheme interpreter, an
-embeddable Scheme interpreter, several graphics options, other languages
-that can be used along with Scheme (for now just @emph{ctax} and
address@hidden), and hooks for much more.
-
-
address@hidden
-* What are scripting and extension languages::
-* History of Guile and its motivations::
-* How to characterize Guile::
address@hidden menu
-
address@hidden What are scripting and extension languages
address@hidden What are scripting and extension languages
address@hidden scripting languages
address@hidden extension languages
-
-A @dfn{scripting language} is a programming language which serves as
-glue between other system programs.  In the UNIX world, the traditional
-scripting language is the @emph{Bourne shell}, which allows many UNIX
-commands to be executed in sequence, or in a pipeline.  Traditional UNIX
-commands are cleverly written to work well when put together in a
-script.
-
-Other examples of UNIX scripting languages are AWK, Perl, Scsh (the
-Scheme Shell: a Scheme interpreter enhanced to do good scripting),
-Python, Tcl, Java @dots{}
address@hidden scripting languages - examples
-
-UNIX programmers noticed, more than 25 years ago, that scripting
-languages can do serious work, so the Bourne shell was written to have
-variables, operators and control structures, just like a full-featured
-programming language.
address@hidden Bourne shell
-
-What scripting languages have, that traditional programming languages do
-not, is the ability to easily run an external program (or a pipeline of
-external programs) and use the returned values and output from that
-program in useful ways.
-
-An @dfn{extension language} is a programming language interpreter
-offered by an application program, so that users can write macros or
-even full-fledged programs to extend the original application.
-Extension languages have a C interface (it is usually C, but it could be
-any other compiled language), and can be given access to the C data
-structures.  Likewise, there are C routines to access the extension
-language data structures.
-
-Extension languages abound in the software world, even though the name
address@hidden language} is seldom used.  Examples are:
address@hidden extension languages - examples
-
address@hidden @bullet
address@hidden
-Emacs Lisp, the language used to program and customize GNU Emacs.
address@hidden Emacs Lisp
-
address@hidden
-Tcl, John Ousterhout's general-purpose scripting and extension language.
address@hidden Tcl
-
address@hidden
-The Lotus 1-2-3 macro language (any spreadsheet macro language,
-really).  I mention this one first because it is a classic, even though
-it is seldom used any more.
address@hidden Lotus 1-2-3
-
address@hidden
-Other spreadsheet and database macro languages.
-
address@hidden
-The Dominion empire-style game's @emph{exec} files.
address@hidden Dominion
-
address@hidden
-Any syntax for a ".*rc" file you might have used.  Almost all programs
-end up parsing some kind of startup or configuration file.  The syntax
-for those can get pretty involved, thus justifying calling them
-"extension languages".  The @emph{fvwm} window manager, for example,
-parses a rather elaborate @file{.fvwmrc} file.
-
address@hidden
-Brent Benson's libscheme.a, an embeddable Scheme interpreter.
address@hidden Benson, Brent
address@hidden libscheme
-
address@hidden
-Guile, the GNU extension language, which is the subject of this
-tutorial.
-
address@hidden itemize
-
-One lesson we can learn from looking at classical large software
-applications is that "writers of large programs" always end up throwing
-in some kind of parser for configuration or scripting.
-
-Of the examples listed above, Emacs Lisp, Tcl, Libscheme and Guile have
-an important property: they are not added as an afterthought for a
-specific application.  They are general-purpose languages which a user
-can learn (even in college courses) and then use to customize the
-application program.
-
-This is a recent and (in my opinion) very exciting direction in
-large-program software engineering: program designers can link in the
-Guile or Tcl library from the very beginning, and tell their users "You
-want to customize this program?  Just use Scheme (or Tcl, or whatever
-language), which you already know!"
address@hidden large programs
-
-
address@hidden History of Guile and its motivations
address@hidden History of Guile and its motivations
-
-A few separate threads of events led to the development of Guile.
-
-In the fall of 1994, Richard Stallman, director of the GNU project,
-posted an article with the subject "Why you should not use Tcl", in
-which he argued that Tcl is inadequate as an extension language.  This
-generated a flurry of flames (available in the hypermail archive
-(@url{http://www.vanderburg.org/Tcl/war/}) @strong{The Tcl War}).
address@hidden Stallman, Richard
address@hidden GNU project
address@hidden Tcl
-
-The result was that Stallman then proposed his design for the GNU
-Extension Language, first called GEL and then renamed Guile.  The
-discussion triggered by that article is also available in a hypermail
-archive, @url{http://www.vanderburg.org/Tcl/war2/}.
-
-One interesting feature of this GNU Extension Language plan was that
-users should have a @emph{choice} of languages to use in extending their
-program.  The basic language would be a slightly modified Scheme, and
-translators would be written to convert other languages (like Tcl,
-Python, Perl, C-like languages @dots{}) into Scheme.
-
-Tom Lord started working on this project immediately, taking Aubrey
-Jaffer's small and portable implementation of Scheme, SCM, and making it
-into an embeddable interpreter: callable from C and allowing new Scheme
-procedures to be written in C.
address@hidden Lord, Tom
address@hidden Jaffer, Aubrey
-
-In the spring of 1995, the guile-ii snapshot was released.  This made it
-possible to start writing code in C and Scheme using the guile
-facilities.
-
-The guile-iii snapshot was released the summer of 1995, and it had fixed
-enough problems so that the access to Scheme data structures from C was
-almost complete.
-
-After this, Cygnus Support added many features to Guile and finished
-implementing others, so that Guile acquired thread support, a regular
-expression matcher, a Tk interface, an interface to the SGI OpenGL
-graphics system, an @emph{applet} formalism, and some other packages.
-This was all in the Cygnus Guile r0.3 and r0.4 releases.
address@hidden Cygnus Support
-
-Meanwhile, Tom Lord left the project after having produced a divergent
-version of Guile: 1.0b2.  The Free Software Foundation hired Jim Blandy
-to coordinate Guile development.  The FSF released its first version of
-Guile in January 1997.  In the future, many of the Cygnus packages will
-be re-integrated into Guile.
address@hidden Blandy, Jim
address@hidden Free Software Foundation
-
-
-
address@hidden How to characterize Guile
address@hidden How to characterize Guile
-
-I have already mentioned that Guile has become a kitchen sink package;
-here you can see how Guile freely takes new commands and constructs from
-the portable Scheme library @emph{slib}, the @emph{Tk} widget set, a
-posix library (useful for UNIX systems programming), the regular
-expression library @emph{rx}, and many more @dots{}
address@hidden slib
address@hidden Tk
address@hidden POSIX
address@hidden @cindex OpenGL
address@hidden rx
-
-So Guile has many more primitive procedures available to it than those
-specified in @ref{Standard Procedures, Revised(5) Report on the
-Algorithmic Language Scheme, , r5rs, Revised(5) Report on the
-Algorithmic Language Scheme}.  On top of that, Guile will interpret
-almost all standard Scheme programs.  The only incompatible difference
-between the basic Guile language and R5RS Scheme is that Guile is case
-sensitive, whereas R5RS is case insensitive.  We hope that few people
-have written Scheme programs that depend on case insensitivity.
address@hidden case sensitivity
address@hidden Revised(5) Report on the Algorithmic Language Scheme
address@hidden report on Scheme
address@hidden Scheme language - report
address@hidden Scheme language - definition
-
-Here is a possible view of the @emph{sum of the parts} in Guile:
address@hidden extensions to standard Scheme
address@hidden extensions to R5RS
address@hidden Scheme extensions
address@hidden
-guile   =       standard Scheme (R5RS)
-        PLUS    extensions to R5RS offered by SCM
-        PLUS    some extra primitives offered by Guile (catch/throw)
-        PLUS    portable Scheme library (SLIB)
-        PLUS    embeddable Scheme interpreter library (libguile)
-        PLUS    Tk toolkit
-        PLUS    threads
-        PLUS    Posix library
address@hidden         PLUS    OpenGL library (mesa)
address@hidden         PLUS    OpenGL toolkit (glut)
-        PLUS    Regular expression library (rx)
address@hidden         PLUS    Applet formalism
-        PLUS    Tcl library
address@hidden example
-
-
address@hidden Using Guile to program in Scheme
address@hidden Using Guile to program in Scheme
address@hidden Scheme programming tutorial
address@hidden tutorial on Scheme programming
-
-In this section I give a tutorial introduction to programming in Scheme,
-with a slant toward the interesting things that can be done in Guile.
-
address@hidden Applets are so @emph{chic} that they get their own section, but 
this
-This section will try to touch on many of the interesting and cool
-aspects of Guile, showing you how new types of problems can be solved
-with Guile.  Note that using Guile as a library with @code{libguile.a}
-is described in its own chapter (@pxref{Guile in a Library}).  Also note
-that some small examples are given in @ref{Jump Start}.
-
-To get started you need to know how to program in @dfn{Scheme} (a
-dialect of LISP).  Fortunately Scheme is a small, clean language and is
-not hard to learn.  It is also used in many undergraduate courses to
-introduce computer programming.
address@hidden lisp dialects
-
-I will not try to teach you Scheme here (although you might end up
-learning by example), since there are many good books on the subject,
-listed in @ref{Where to find more Guile/Scheme resources}. @footnote{To
-get started, look at the books @cite{Simply Scheme} and @cite{The Little
-Schemer} from that list.}
-
-
address@hidden Hello World
address@hidden hello world
-
-Our first program is the typical Scheme "hello world" program.  Put the
-following code in a file called @code{hello.scm} (this can be find in
address@hidden/scheme/hello.scm}).
-
address@hidden
-#!/usr/local/bin/guile -s
-!#
-
-(display "hello world")
-(newline)
address@hidden smalllisp
-
-Then run guile on it.  One way to do so is to start up guile and load
-this file:
-
address@hidden
-<shell-prompt> @kbd{guile}
-guile> @kbd{(load "hello")}
address@hidden smallexample
-
-Another way is to make the file executable and execute it directly.
-Notice how Guile recognizes a @code{-s} option which tells it to run a
-script and then exit.  Guile also has a new type of block comment
-enclosed by @code{#!} and @code{!#}, so that you can make executable
-Scheme scripts with the standard UNIX @code{#!} mechanism.
-
-In the given example, the first line is used to invoke the Guile
-interpreter (make sure you correct the path if you installed Guile in
-something other than /usr/local/bin).  Once Guile is invoked on this
-file, it will understand that the first line is a comment.  The comment
-is then terminated with @code{!#} on the second line so as to not
-interfere with the execution mechanism.
-
-
address@hidden A bunch of operations in Scheme
-
-Here is some code you can type at the @code{guile>} prompt to see some
-of the Scheme data types at work (mostly lists and vectors).  I have
-inserted brief comments @emph{before} each line of code explaining what
-happens.
-
address@hidden
-;; @r{make a list and bind it to the symbol @code{ls}}
-guile> @kbd{(define ls (list 1 2 3 4 5 6 7))}
-       @result{}
-;; @r{display the list}
-guile> @kbd{ls}
-       @result{} (1 2 3 4 5 6 7)
-;; @r{ask if @code{ls} is a vector; @code{#f} means it is not}
-guile> @kbd{(vector? ls)}
-       @result{} #f
-;; @r{ask if @code{ls} is a list; @code{#t} means it is}
-guile> @kbd{(list? ls)}
-       @result{} #t
-;; @r{ask for the length of @code{ls}}
-guile> @kbd{(length ls)}
-       @result{} 7
-;; @r{pick out the first element of the list}
-guile> @kbd{(car ls)}
-       @result{} 1
-;; @r{pick the rest of the list without the first element}
-guile> @kbd{(cdr ls)}
-       @result{} (2 3 4 5 6 7)
-;; @r{this should pick out the 3rd element of the list}
-guile> @kbd{(car (cdr (cdr ls)))}
-       @result{} 3
-;; @r{a shorthand for doing the same thing}
-guile> @kbd{(caddr ls)}
-       @result{} 3
-;; @r{append the given list onto @code{ls}, print the result}
-;; @address@hidden:} the original list @code{ls} is @emph{not} modified}
-guile> @kbd{(append ls (list 8 9 10))}
-       @result{} (1 2 3 4 5 6 7 8 9 10)
-guile> @kbd{(reverse ls)}
-       @result{} (7 6 5 4 3 2 1)
-;; @r{ask if 12 is in the list --- it obviously is not}
-guile> @kbd{(memq 12 ls)}
-       @result{} #f
-;; @r{ask if 4 is in the list --- returns the list from 4 on.}
-;; @r{Notice that the result will behave as true in conditionals}
-guile> @kbd{(memq 4 ls)}
-       @result{} (4 5 6 7)
-;; @r{an @code{if} statement using the aforementioned result}
-guile> @kbd{(if (memq 4 ls)
-           (display "hey, it's true!\n")
-           (display "dude, it's false\n"))}
-       @print{hey, it's true!}
-       @result{}
-guile> @kbd{(if (memq 12 ls)
-           (display "hey, it's true!\n")
-           (display "dude, it's false\n"))}
-       @print{dude, it's false}
-       @result{}
-guile> @kbd{(memq 4 (reverse ls))}
-       @result{} (4 3 2 1)
-;; @r{make a smaller list @code{ls2} to work with}
-guile> @kbd{(define ls2 (list 2 3 4))}
-;; @r{make a list in which the function @code{sin} has been}
-;; @r{applied to all elements of @code{ls2}}
-guile> @kbd{(map sin ls2)}
-       @result{} (0.909297426825682 0.141120008059867 -0.756802495307928)
-;; @r{make a list in which the squaring function has been}
-;; @r{applied to all elements of @code{ls}}
-guile> @kbd{(map (lambda (n) (* n n)) ls)}
-       @result{} (1 4 9 16 25 36 49)
address@hidden smalllisp
-
address@hidden
-;; @r{make a vector and bind it to the symbol @code{v}}
-guile> @kbd{(define v '#(1 2 3 4 5 6 7))}
-guile> @kbd{v}
-       @result{} #(1 2 3 4 5 6 7)
-guile> @kbd{(vector? v)}
-       @result{} #t
-guile> @kbd{(list? v)}
-       @result{} #f
-guile> @kbd{(vector-length v)}
-       @result{} 7
-;; @r{vector-ref allows you to pick out elements by index}
-guile> @kbd{(vector-ref v 2)}
-       @result{} 3
-;; @r{play around with the vector: make it into a list, reverse}
-;; @r{the list, go back to a vector and take the second element}
-guile> @kbd{(vector-ref (list->vector (reverse (vector->list v))) 2)}
-       @result{} 5
-;; @r{this demonstrates that the entries in a vector do not have}
-;; @r{to be of uniform type}
-guile> @kbd{(vector-set! v 4 "hi there")}
-       @result{} "hi there"
-guile> @kbd{v}
-       @result{} #(1 2 3 4 "hi there" 6 7)
address@hidden smalllisp
-
-
address@hidden Using recursion to process lists
address@hidden recursion
address@hidden list processing
-
-Here are some typical examples of using recursion to process a list.
-
address@hidden
-;; @r{this is a rather trivial way of reversing a list}
-(define (my-reverse l)
-  (if (null? l)
-      l
-      (append (my-reverse (cdr l)) (list (car l)))))
-(my-reverse '(27 32 33 40))
address@hidden (40 33 32 27)
address@hidden smalllisp
-
-
address@hidden Processing matrices
-
-Suppose you have a matrix represented as a list of lists:
-
address@hidden
-(define m
-  (list
-   (list 7 2 1 3 2 8 5 3 6)
-   (list 4 1 1 1 3 8 9 8 1)
-   (list 5 5 4 8 1 8 2 2 4)))
address@hidden smalllisp
-
-Then you could apply a certain function to each element of the matrix in
-the following manner:
address@hidden
-;; @r{apply the function func to the matrix m element-by-element;}
-;; @r{return a matrix with the result.}
-(define (process-matrix m func)
-  (map (lambda (l)
-         (map func l))
-       m))
address@hidden smalllisp
-Notice that I have used the Scheme @code{map} procedure because I am
-interested in the matrix that results from the application of
address@hidden, rather than in the side effects associated with applying
address@hidden
-
-This could be invoked with @code{(process-matrix m sin)} or
address@hidden(process-matrix m (lambda (x) (* x x)))}; for example:
-
address@hidden
-(process-matrix m (lambda (x) (* x x)))
address@hidden ((49 4 1 9 4 64 25 9 36) (16 1 1 1 9 64 81 64 1) (25 25 16 64 1 
64 4 4 16))
address@hidden smalllisp
-
-To print a representation of the matrix, we could define a generalized
-routine:
address@hidden
-;; @r{proc is a procedure to represent the single element,}
-;; @r{row-proc is a procedure that is invoked after each row.}
-;; @r{Example: proc could be (lambda (x) (begin (display x) (display " ")))}
-;; @r{and row-proc could be (lambda (l) (display "\n"))}
-(define (represent-matrix m proc row-proc)
-  (for-each (lambda (l)
-              (begin
-                (for-each proc l)
-                (row-proc l)))
-            m))
address@hidden smalllisp
address@hidden represent-matrix
-
-And then invoke it with
address@hidden
-(represent-matrix m
-                  (lambda (x) (begin (display x) (display " ")))
-                  (lambda (l) (begin (display "\n"))))
address@hidden 2 1 3 2 8 5 3 6}
address@hidden 1 1 1 3 8 9 8 1}
address@hidden 5 4 8 1 8 2 2 4}
address@hidden smalllisp
-
address@hidden objects
-
-Now we write a helper routine that uses Scheme @dfn{closures} to make
-objects with state that then receive messages to draw little squares.
address@hidden closures
address@hidden syntactic closures
-
-But let us take it one step at a time.  I will start by showing you a
-simple example of object in Scheme.  The object I make here represents a
-cell, which could be a cell in a matrix.  The cell responds to commands
-to draw itself, to return the next cell, and so forth.  @emph{Guile does
-not currently have a Tk interface, so I will leave the hooks for
-graphical rendering.  In a future release of Guile I will add graphical
-rendering messages to the cell object.}
-
address@hidden
-;; @r{cell-object.scm: routines for creating and manipulating cell objects}
-
-;; @r{(the-x, the-y) is the initial position of the cell.}
-;; @r{the-color is a string representing a color; must be something Tk can 
grok.}
-;; @r{square-size is the size of the square that gets drawn.}
-;; @r{(sizex, sizey) is the size of the matrix.}
-(define (MAKE-CELL the-x the-y the-color square-size sizex sizey)
-  (define (get-x) the-x)
-  (define (get-y) the-y)
-
-  (define (set-x! new-x)
-    (set! the-x new-x)
-    the-x)
-  (define (set-y! new-y)
-    (set! the-y new-y)
-    the-y)
-  (define (get-color) the-color)
-  (define (set-color! new-color)
-    (set! the-color new-color)
-    the-color)
-  (define (next!)
-    (set! the-x (+ the-x 1))
-    (if (>= the-x sizex)
-       (begin
-         (set! the-x 0)
-         (set! the-y (+ the-y 1))))
-       (if (>= the-y sizey)
-           (begin
-             (display "CELL next!: value of y is too big; not changing it\n")
-             (set! the-y (- the-y 1))))
-       (cons the-x the-y))
-  (define (draw)
-    (let* ((x0 (* the-x square-size))
-          (y0 (* the-y square-size))
-          (x1 (+ x0 square-size))
-          (y1 (+ y0 square-size)))
-      (display "I should draw a ")
-      (display the-color)
-      (display " rectangle with corners at ")
-      (display x0) (display y0) (display x1) (display y1)
-      ))
-
-  ;; self is the dispatch procedure
-  (define (self message)
-    (case message
-      ((x)            get-x)
-      ((y)            get-y)
-      ((set-x!)       set-x!)
-      ((set-y!)       set-y!)
-      ((color)        get-color)
-      ((set-color!)   set-color!)
-      ((next!)        next!)
-      ((draw)         draw)
-      (else (error "CELL: Unknown message -> " message))))
-  ;; and now return the dispatch procedure
-  self
-  )
address@hidden smallexample
address@hidden cell-object
address@hidden MAKE-CELL
-
-What does this procedure do?  It returns another procedure
-(@code{self}) which receives a message (x, y, set-x!, set-y!, @dots{})
-and takes an action to return or modify its state.  The state consists
-of the values of variables @code{the-x}, @code{the-y}, @code{the-color}
-and so forth.
-
-Here are some examples of how to use MAKE-CELL and the cell object it
-creates:
address@hidden
-(define c (MAKE-CELL 0 0 "red" 10 7 9))
-
-;; @r{retrieve the x and y coordinates}
-((c 'x))
address@hidden 0
-((c 'y))
address@hidden 0
-;; @r{change the x coordinate}
-((c 'set-x!) 5)
address@hidden 5
-((c 'x))
address@hidden 5
-;; @r{change the color}
-((c 'color))
address@hidden "red"
-((c 'set-color!) "green")
address@hidden "green"
-((c 'color))
address@hidden "green"
-;; @r{now use the next! message to move to the next cell}
-((c 'next!))
address@hidden (6 . 0)
-((c 'x))
address@hidden 6
-((c 'y))
address@hidden 0
-;; @r{now make things wrap around}
-((c 'next!))
address@hidden (0 . 1)
-((c 'next!))
address@hidden (1 . 1)
-((c 'next!))
address@hidden (2 . 1)
-((c 'x))
address@hidden 2
-((c 'y))
address@hidden 1
address@hidden smallexample
-
-You will notice that expressions like @code{(c 'next)} return procedures
-that do the job, so we have to use extra parentheses to make the job
-happen.  This syntax is rather awkward; one way around it is to define a
address@hidden procedure:
-
address@hidden
-;; @r{send makes object syntax a bit easier; instead of saying}
-;; @r{    ((my-cell 'set-x!) 4)}
-;; @r{you can say}
-;; @r{    (send my-cell 'set-x! 4)}
-(define (send obj . args)
-  (let ((first-eval (apply obj (list (car args)))))
-    (if (null? (cdr args))
-       (first-eval)
-       (apply first-eval (cdr args)))))
address@hidden smallexample
address@hidden send
-
-You can see that @code{send} passes the message to the object, making
-sure that things are evaluated the proper number of times.  You can now
-type:
-
address@hidden
-(define c2 (MAKE-CELL 0 0 "red" 10 7 9))
-(send c2 'x)
address@hidden 0
-(send c2 'set-x! 5)
address@hidden 5
-(send c2 'color)
address@hidden "red"
-(send c2 'set-color! "green")
address@hidden "green"
-(send c2 'next!)
address@hidden (1 . 0)
-(send c2 'x)
address@hidden 1
-(send c2 'y)
address@hidden 0
address@hidden smallexample
-
address@hidden object-based programming
address@hidden object-oriented programming
-
-This is the simplest way of implementing objects in Scheme, but it does
-not really allow for full @emph{object-oriented programming} (for
-example, there is no inheritance).  But it is useful for
address@hidden programming}.
-
-Guile comes with a couple more complete object-oriented extensions to
-Scheme: these are part of slib (@pxref{Object, , , slib, SLIB: the
-portable Scheme library} and @pxref{Yasos, , , slib, SLIB: the portable
-Scheme library}).
-
address@hidden Guile in a Library
address@hidden Guile in a Library
-
address@hidden
address@hidden
address@hidden iftex
-In the previous chapters Guile was used to write programs entirely in
-Scheme, and no C code was seen; but I have been claiming @emph{ad
-nauseam} that Guile is an @emph{extension} language.  Here we see how
-that is done, and how that can be useful.
address@hidden libguile
address@hidden extending C programs
-
-
address@hidden
-* Two world views::
-* What is libguile::
-* How to get started with libguile::
-* More interesting programming with libguile::
-* Further examples::
address@hidden menu
-
address@hidden Two world views
address@hidden Two world views
address@hidden master world
-
-In this manual, I usually jump into examples and explain them as you
-type in the code; here I will digress and ramble for a few paragraphs to
-set some concepts straight, and then let you type (or paste) in fun
-examples.
-
-In 1995, I implemented a large program, @dfn{Gnudl}, using Guile quite
-extensively.  In the design phase of Gnudl, I found I had to make a
-choice: should the fundamental data structures be C or Scheme data
-structures?
address@hidden gnudl
address@hidden GNU Data Language
address@hidden Galassi, Mark
-
-Guile allows C to see its data structures (scalar types, lists, vectors,
-strings @dots{}).  C also allows Guile to see its data structures.  As a
-large program designer, you have to decide which of those capabilities
-to use.  You have two main choices:
-
address@hidden 1
address@hidden
-You can write your software mostly in Scheme.  In this case, your C
-software will mostly parse the Scheme code with Guile calls, and provide
-some new primitive procedures to be used by Scheme.  This is what Gnudl
-does.
-
address@hidden
-You can write your software mostly in C, occasionally allowing Scheme
-code to be parsed by Guile, either to allow the user to modify data
-structures, or to parse a configuration file, @dots{}
address@hidden enumerate
-
-Mixing the two approaches seems unwise: the overall layout would be
-confusing.  But who knows?  There might be problems that are best solved
-by a hybrid approach.  Please let me know if you think of such a
-problem.
-
-If you use the former approach, we will say that the @dfn{master world}
-is Scheme, and the C routines serve Scheme and access Scheme data
-structures.  In the latter case, the master world is C, and Scheme
-routines serve the C code and access C data structures.
-
-In both approaches the @code{libguile.a} library is the same, but a
-predominantly different set of routines will be used.  When we go
-through examples of libguile use, we will point out which is the master
-world in order to clarify these two approaches.
-
-
address@hidden What is libguile
address@hidden What is libguile
address@hidden libguile
address@hidden gh interface
address@hidden scm interface
-
address@hidden is the library which allows C programs to start a Scheme
-interpreter and execute Scheme code.  There are also facilities in
-libguile to make C data structures available to Scheme, and vice versa.
-
-The interface provided by the libguile C library is somewhat specific to
-the implementation of the Scheme interpreter.  This low-level libguile
-interface is usually referred to as the @code{scm_} interface, since its
-public calls (API) all have the @code{scm_} prefix.
-
-There is also a higher-level libguile interface, which is usually
-referred to as the @code{gh_} interface (libGuile High).  Its public
-calls all have the @code{gh_} prefix.  The @code{gh_} library interface
-is designed to hide the implementation details, thus making it easier to
-assimilate and portable to other underlying Scheme implementations.
-
-People extending Guile by adding bindings to C libraries (like OpenGL or
-Rx) are encouraged to use the @code{gh_} interface, so their work will
-be portable to other Scheme systems.  The @code{gh_} interface should be
-more stable, because it is simpler.
-
-The @code{scm_} interface is necessary if you want to poke into the
-innards of Scheme data structures, or do anything else that is not
-offered by the @code{gh_} interface.  It is not covered in this
-tutorial, but is covered extensively in @ref{Data representation,, Data
-Representation in Guile, guile, Guile Reference Manual}.
-
-This chapter gives a gentle introduction to the @code{gh_} interface,
-presenting some @emph{hello world}-style programs which I wrote while
-teaching myself to use libguile.
address@hidden hello world
-
-The @cite{Guile Programmer's Manual} gives more examples of programs
-written using libguile, illustrating diverse applications.  You can also
-consult my @emph{Gnudl} documentation at
address@hidden://nis-www.lanl.gov/~rosalia/mydocs/} to see a large scale
-project that uses C and Scheme code together.
-
-
address@hidden How to get started with libguile
address@hidden How to get started with libguile
address@hidden learn0
-
-Here is an elementary first program, @code{learn0}, to get going with
-libguile.  The program (which uses Scheme as a master world) is in a
-single source file, @code{learn0.c}:
-
address@hidden
-/* @r{test the new libgh.a (Guile High-level library) with a trivial
-   program} */
-
-#include <stdio.h>
-
-#include <guile/gh.h>
-
-void main_prog(int argc, char *argv[]);
-
-main(int argc, char *argv[])
address@hidden
-  gh_enter(argc, argv, main_prog);
address@hidden
-
-void main_prog(int argc, char *argv[])
address@hidden
-  int done;
-  char input_str[200];
-
-  gh_eval_str("(display \"hello Guile\")");
-  gh_eval_str("(newline)");
-
-  /* @r{for fun, evaluate some simple Scheme expressions here} */
-  gh_eval_str("(define (square x) (* x x))");
-  gh_eval_str("(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))");
-  gh_eval_str("(square 9)");
-
-  /* @r{now sit in a Scheme eval loop: I input the expressions, have
-     Guile evaluate them, and then get another expression.} */
-  done = 0;
-  fputs("learn0> ", stdout);
-  while (fgets(input_str, 199, stdin) != NULL) @{
-    gh_eval_str(input_str);
-    fputs("\nlearn0> ", stdout);
-  @}
-
-  exit(0);
address@hidden
address@hidden smallexample
-
-If you name this program @code{learn0.c}, it can now be compiled with:
address@hidden
-gcc -g -c learn0.c -o learn0.o
-gcc -o learn0 learn0.o -lguile -lm
address@hidden smallexample
-
address@hidden @emph{NOTE: If you are in the Guile development tree, you can 
simply do
address@hidden ``cd doc/examples/c; make; ./learn0''.}
-
-The program is simple: it creates a Scheme interpreter, passes a couple
-of strings to it that define new Scheme functions @code{square} and
address@hidden, and then a couple of strings that invoke those
-functions.
-
-It then goes into a read-eval-print-loop (REPL), so you could type
-one-line Scheme expressions to it and have them evaluated.  For example:
address@hidden
-<shell-prompt> ./learn0
-hello Guile
-learn0> (display (sin 1.3))
-963.558185417193e-3
-learn0> (display (fact 10))
-3628800
-learn0> (quit)
-<shell-prompt>
address@hidden smallexample
-
-You should notice the key steps involved in this @code{learn0} program:
-
address@hidden
address@hidden
address@hidden
address@hidden <guile/gh.h>}
address@hidden
-You need to invoke the initialization routine @code{gh_enter()}.  This
-starts up a Scheme interpreter, handling many implementation-specific
-details.
address@hidden
-Your main() function should be almost empty: the real main program goes
-in a separate function main_prog() which is passed to gh_enter().  This
-rather arcane convention is due to the way Guile's garbage collector
-works: the whole program has to run in the dynamic context of
address@hidden()}.
address@hidden
-You pass strings to the Scheme interpreter with the @code{gh_eval_str()}
-routine.
address@hidden
-You link your program with @code{-lguile}.
address@hidden enumerate
address@hidden cartouche
-
-
address@hidden More interesting programming with libguile
address@hidden More interesting programming with libguile
address@hidden learn1
address@hidden callback
address@hidden builtin functions
-
-The @code{learn0} program shows how you can invoke Scheme commands from
-a C program.  This is not such a great achievement: the same could have
-been done by opening a pipe to SCM or any other Scheme interpreter.
-
-A true extension language must allow @dfn{callbacks}.  Callbacks allow
-you to write C routines that can be invoked as Scheme procedures, thus
-adding new primitive procedures to Scheme.  This also means that a
-Scheme procedure can modify a C data structure.
-
-Guile allows you to define new Scheme procedures in C, and provides a
-mechanism to go back and forth between C and Scheme data types.
-
-Here is a second program, @code{learn1}, which demonstrates these
-features.  It is split into three source files: @code{learn1.c},
address@hidden and @code{c_builtins.c}.  I am including the code
-here.
address@hidden , but you might just want to look at the online source code and 
the
address@hidden Makefile.am that come with Guile in the
address@hidden @file{doc/examples/c} directory.
-
-Notice that @code{learn1} uses a Scheme master world, and the C routines
-in @code{c_builtins.c} are simply adding new primitives to Scheme.
-
address@hidden
-* learn1.c::
-* c_builtins.h::
-* c_builtins.c::
-* What learn1 is doing::
-* Compiling and running learn1::
address@hidden menu
-
address@hidden learn1.c
address@hidden learn1.c
-
-Here is @file{learn1.c}:
address@hidden
-#include <stdio.h>
-
-#include <guile/gh.h>
-
-#include "c_builtins.h"
-
-void main_prog(int argc, char *argv[]);
-
-main(int argc, char *argv[])
address@hidden
-  gh_enter(argc, argv, main_prog);
address@hidden
-
-void main_prog(int argc, char *argv[])
address@hidden
-  char input_str[200];         /* @r{ugly hack: assume strlen(line) < 200} */
-  int done;
-
-  /* @r{for fun, evaluate some simple Scheme expressions here} */
-  gh_eval_str("(define (square x) (* x x))");
-  gh_eval_str("(define (fact n) (if (= n 1) 1 (* n (fact (- n 1)))))");
-  gh_eval_str("(square 9)");
-  gh_eval_str("(fact 100)");
-
-  /* @r{now try to define some new builtins, coded in C, so that they are
-     available in Scheme.} */
-  gh_new_procedure1_0("c-factorial", c_factorial);
-  gh_new_procedure1_0("c-sin", c_sin);
-  gh_new_procedure1_0("v-t", vector_test);
-
-  /* @r{now sit in a Scheme eval loop: I input the expressions, have
-     Guile evaluate them, and then get another expression.}  */
-  done = 0;
-  fputs("learn1> ", stdout);
-  while (!done) @{
-    if (gets(input_str) == NULL) @{
-      done = 1;
-    @} else @{
-      gh_eval_str(input_str);
-      fputs("learn1> ", stdout);
-    @}
-  @}
-
-  exit(0);
address@hidden
address@hidden smallexample
-
address@hidden c_builtins.h
address@hidden c_builtins.h
-
-Here is @file{c_builtins.h}:
address@hidden
-/* @r{builtin function prototypes} */
-
-#include <guile/gh.h>
-
-SCM c_factorial(SCM n);
-SCM c_sin(SCM n);
-SCM vector_test(SCM s_length);
address@hidden smallexample
-
address@hidden c_builtins.c
address@hidden c_builtins.c
-
-Here is @file{c_builtins.c}:
address@hidden
-#include <stdio.h>
-#include <math.h>
-
-#include <guile/gh.h>
-
-#include "c_builtins.h"
-
-/* @r{this is a factorial routine in C, made to be callable by Scheme} */
-SCM c_factorial(SCM s_n)
address@hidden
-  int i;
-  unsigned long result = 1, n;
-
-  n = gh_scm2ulong(s_n);
-
-  gh_defer_ints();
-  for (i = 1; i <= n; ++i) @{
-    result = result*i;
-  @}
-  gh_allow_ints();
-  return gh_ulong2scm(result);
address@hidden
-
-/* @r{a sin routine in C, callable from Scheme.  it is named c_sin() to
-   distinguish it from the default Scheme sin function} */
-SCM c_sin(SCM s_x)
address@hidden
-  double x = gh_scm2double(s_x);
-
-  return gh_double2scm(sin(x));
address@hidden
-
-/* @r{play around with vectors in Guile: this routine creates a vector of
-   the given length, initializes it all to zero except element 2 which
-   is set to 1.9.}  */
-SCM vector_test(SCM s_length)
address@hidden
-  SCM xvec;
-
-  c_length = gh_scm2ulong(s_length);
-  printf("requested length for vector: %ld\n", gh_scm2ulong(s_length));
-
-  /* create a vector */
-  xvec = gh_make_vector(s_length, gh_double2scm(0.0));
-  /* set the second element in it */
-  gh_vector_set_x(xvec, gh_int2scm(2), gh_double2scm(1.9));
-
-  return xvec;
address@hidden
address@hidden smallexample
-
address@hidden What learn1 is doing
address@hidden What learn1 is doing
address@hidden registering callbacks
address@hidden registering C functions
address@hidden primitive procedures
-
-If you compare learn1 to learn0, you will find that learn1 uses a new
-Guile construct: the function @code{gh_new_procedure()}, and its
-siblings:
-
address@hidden
-  /* @r{now try to define some new builtins, coded in C, so that they are
-     available in Scheme.} */
-  gh_new_procedure1_0("c-factorial", c_factorial);
-  gh_new_procedure1_0("c-sin", c_sin);
-  gh_new_procedure1_0("v-t", vector_test);
address@hidden smallexample
-
-It is clear that @code{gh_new_procedure()} adds a new builtin
-routine written in C which can be invoked from Scheme.  We can now
-revise our checklist for programming with libguile, so it includes
-adding callbacks.
address@hidden libguile - step by step
-
address@hidden
address@hidden
address@hidden
address@hidden <guile/gh.h>}
address@hidden
-You need to invoke the initialization routine @code{gh_enter()}.  This
-starts up a Scheme interpreter, handling many details.
address@hidden
-Your main() function should be almost empty: the real main program goes
-in a separate function main_prog() which is passed to gh_enter().  This
-rather arcane convention is due to the way Guile's garbage collector
-works: the whole program has to run in the dynamic context of
address@hidden()}.
address@hidden
-You pass strings to the Scheme interpreter with the @code{gh_eval_str()}
-routine.
address@hidden
address@hidden You can now define new builtin Scheme functions;
-i.e. define new builtin Scheme functions, with the
address@hidden()} routine.
address@hidden
-You pass strings to the Scheme interpreter with the
address@hidden()} routine.
address@hidden
-You link your program with @code{-lguile}.
address@hidden enumerate
address@hidden cartouche
-
-I breezed by the issue of how to write your C routines that are
-registered to be called from Scheme.  This is non-trivial, and is
-discussed at length in the @cite{Guile Programmer's Manual}.
-
-
address@hidden Compiling and running learn1
address@hidden Compiling and running learn1
-
address@hidden
-gcc -g -c learn1.c -o learn1.o
-gcc -g -c c_builtins.c -o c_builtins.o
-gcc -o learn1 learn1.o c_builtins.o -lguile -lm
address@hidden smallexample
-
-If you run @code{learn1}, it will prompt you for a one-line Scheme
-expression, just as @code{learn0} did.  The difference is that you can
-use the new C builtin procedures (@code{c-factorial}, @code{c-sin},
address@hidden).
-
address@hidden
-<shell-prompt> ./learn1
-welcome to Guile
-hello Guile
-learn1> (display (c-factorial 6))
-720
-learn1> (display (c-factorial 20))
-2192834560
-learn1> (display (c-factorial 100))
-0
-learn1> (display (c-sin 1.5))
-0.997494986604054
-learn1> (display (v-t 10))
-requested length for vector: 10
-#(0.0 0.0 1.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
-learn1> (display (v-t 15))
-requested length for vector: 15
-#(0.0 0.0 1.9 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0)
-learn1> (quit)
-<shell-prompt>
address@hidden smallexample
-
-As you see, taking @code{(c-factorial 100)} does not use bignumbers and
-returns a bogus answer.
-
address@hidden Further examples
address@hidden Further examples
-
-Further ``idealized'' examples are included in the @code{doc/examples/c}
-distribution.  They include programs to:
-
address@hidden [FIXME: still have to write some of these; then I will revise 
the list.]
-
address@hidden @bullet
address@hidden
-Parse a startup file (C is the master world).
address@hidden
-Set up initial conditions for an n-body simulation (C is the master
-world).
address@hidden
-Implement a Scheme interpreter with all of Guile's goodies, @emph{plus}
-the readline library @emph{and} a fast Fourier transform routine
-provided in C (Scheme is the master world).
address@hidden itemize
-
address@hidden Regular Expression Support
address@hidden Regular Expression Support
-
address@hidden UNIX System Programming
address@hidden UNIX System Programming
-
address@hidden Where to find more Guile/Scheme resources
address@hidden Where to find more Guile/Scheme resources
-
-
address@hidden Concept Index
address@hidden Concept Index
-
address@hidden cp
-
address@hidden Procedure and Macro Index
address@hidden Procedure and Macro Index
-
-This is an alphabetical list of all the procedures and macros in Dominion.
-
address@hidden fn
-
address@hidden Variable Index
address@hidden Variable Index
-
-This is an alphabetical list of the major global variables in Dominion.
-
address@hidden vr
-
address@hidden Type Index
address@hidden Type Index
-
-This is an alphabetical list of the major data structures in Dominion.
-
address@hidden tp
-
address@hidden
-
address@hidden
diff --git a/guile-readline/Makefile.am b/guile-readline/Makefile.am
index efdcd75..8d22b24 100644
--- a/guile-readline/Makefile.am
+++ b/guile-readline/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with Automake to create Makefile.in
 ##
-##     Copyright (C) 1998, 1999, 2000, 2001, 2004, 2006, 2007, 2008, 2009 Free 
Software Foundation, Inc.
+##     Copyright (C) 1998, 1999, 2000, 2001, 2004, 2006, 2007, 2008, 2009, 
2010 Free Software Foundation, Inc.
 ##
 ##   This file is part of guile-readline.
 ##
@@ -45,7 +45,7 @@ lib_LTLIBRARIES = address@hidden@.la
 address@hidden@_la_SOURCES = readline.c
 address@hidden@_la_LIBADD =    \
   $(READLINE_LIBS)                                     \
-  ../libguile/libguile.la ../lib/libgnu.la
+  ../libguile/address@hidden@.la ../lib/libgnu.la
 
 address@hidden@_la_LDFLAGS =   \
   -version-info @LIBGUILEREADLINE_INTERFACE@ -export-dynamic   \
@@ -54,7 +54,8 @@ address@hidden@_la_LDFLAGS =  \
 
 BUILT_SOURCES = readline.x
 
-pkginclude_HEADERS = readline.h
+modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)
+modinclude_HEADERS = readline.h
 
 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
 SUFFIXES = .x
diff --git a/lib/Makefile.am b/lib/Makefile.am
index b33fb6d..149586e 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2009 Free Software Foundation, Inc.
+# Copyright (C) 2002-2010 Free Software Foundation, Inc.
 #
 # This file is free software, distributed under the terms of the GNU
 # General Public License.  As a special exception to the GNU General
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
full-read full-write gendocs gitlog-to-changelog gnu-web-doc-update gnupload 
havelib iconv_open-utf inet_ntop inet_pton lib-symbol-versions 
lib-symbol-visibility libunistring locale maintainer-makefile putenv stdlib 
strcase strftime striconveh string sys_stat verify version-etc-fsf vsnprintf 
warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 
--libtool --macro-prefix=gl --no-vc-files alignof alloca-opt announce-gen 
autobuild byteswap canonicalize-lgpl duplocale environ extensions flock fpieee 
full-read full-write func gendocs getaddrinfo gitlog-to-changelog 
gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton 
lib-symbol-versions lib-symbol-visibility libunistring locale 
maintainer-makefile putenv stdlib strcase strftime striconveh string sys_stat 
verify version-etc-fsf vsnprintf warnings
 
 AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
 
@@ -71,6 +71,11 @@ EXTRA_DIST += $(top_srcdir)/build-aux/announce-gen
 
 ## begin gnulib module arg-nonnull
 
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
 BUILT_SOURCES += arg-nonnull.h
 # The arg-nonnull.h that gets inserted into generated .h files is the same as
 # build-aux/arg-nonnull.h, except that it has the copyright header cut off.
@@ -90,11 +95,11 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h
 
 ## begin gnulib module arpa_inet
 
-BUILT_SOURCES += $(ARPA_INET_H)
+BUILT_SOURCES += arpa/inet.h
 
 # We need the following in order to create <arpa/inet.h> when the system
 # doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) arpa
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -106,8 +111,8 @@ arpa/inet.h: arpa_inet.in.h $(LINK_WARNING_H) 
$(ARG_NONNULL_H)
              -e 's|@''GNULIB_INET_PTON''@|$(GNULIB_INET_PTON)|g' \
              -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
              -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/arpa_inet.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -136,6 +141,30 @@ EXTRA_DIST += byteswap.in.h
 
 ## end   gnulib module byteswap
 
+## begin gnulib module c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/c++defs.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/_GL_CXXDEFS/,$$p' \
+         < $(top_srcdir)/build-aux/c++defs.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h
+
+## end   gnulib module c++defs
+
 ## begin gnulib module c-ctype
 
 libgnu_la_SOURCES += c-ctype.h c-ctype.c
@@ -310,6 +339,15 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gendocs.sh
 
 ## end   gnulib module gendocs
 
+## begin gnulib module getaddrinfo
+
+
+EXTRA_DIST += gai_strerror.c getaddrinfo.c
+
+EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
+
+## end   gnulib module getaddrinfo
+
 ## begin gnulib module gettext-h
 
 libgnu_la_SOURCES += gettext.h
@@ -360,13 +398,13 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
 
 ## end   gnulib module havelib
 
-## begin gnulib module iconv_open
+## begin gnulib module iconv-h
 
 BUILT_SOURCES += $(ICONV_H)
 
 # We need the following in order to create <iconv.h> when the system
 # doesn't have one that works with the given compiler.
-iconv.h: iconv.in.h $(ARG_NONNULL_H)
+iconv.h: iconv.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -376,12 +414,20 @@ iconv.h: iconv.in.h $(ARG_NONNULL_H)
              -e 's|@''REPLACE_ICONV''@|$(REPLACE_ICONV)|g' \
              -e 's|@''REPLACE_ICONV_OPEN''@|$(REPLACE_ICONV_OPEN)|g' \
              -e 's|@''REPLACE_ICONV_UTF''@|$(REPLACE_ICONV_UTF)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/iconv.in.h; \
        } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += iconv.h iconv.h-t
 
+EXTRA_DIST += iconv.in.h
+
+## end   gnulib module iconv-h
+
+## begin gnulib module iconv_open
+
 iconv_open-aix.h: iconv_open-aix.gperf
        $(GPERF) -m 10 $(srcdir)/iconv_open-aix.gperf > 
$(srcdir)/iconv_open-aix.h-t
        mv $(srcdir)/iconv_open-aix.h-t $(srcdir)/iconv_open-aix.h
@@ -402,7 +448,7 @@ MOSTLYCLEANFILES     += iconv_open-aix.h-t 
iconv_open-hpux.h-t iconv_open-irix.h
 MAINTAINERCLEANFILES += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h 
iconv_open-osf.h iconv_open-solaris.h
 EXTRA_DIST           += iconv_open-aix.h iconv_open-hpux.h iconv_open-irix.h 
iconv_open-osf.h iconv_open-solaris.h
 
-EXTRA_DIST += iconv.in.h iconv_open-aix.gperf iconv_open-hpux.gperf 
iconv_open-irix.gperf iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c
+EXTRA_DIST += iconv_open-aix.gperf iconv_open-hpux.gperf iconv_open-irix.gperf 
iconv_open-osf.gperf iconv_open-solaris.gperf iconv_open.c
 
 EXTRA_libgnu_la_SOURCES += iconv_open.c
 
@@ -445,25 +491,6 @@ AM_CFLAGS += $(CFLAG_VISIBILITY)
 
 ## end   gnulib module lib-symbol-visibility
 
-## begin gnulib module link-warning
-
-BUILT_SOURCES += link-warning.h
-# The link-warning.h that gets inserted into generated .h files is the same as
-# build-aux/link-warning.h, except that it has the copyright header cut off.
-link-warning.h: $(top_srcdir)/build-aux/link-warning.h
-       $(AM_V_GEN)rm -f address@hidden $@ && \
-       sed -n -e '/GL_LINK_WARNING/,$$p' \
-         < $(top_srcdir)/build-aux/link-warning.h \
-         > address@hidden && \
-       mv address@hidden $@
-MOSTLYCLEANFILES += link-warning.h link-warning.h-t
-
-LINK_WARNING_H=link-warning.h
-
-EXTRA_DIST += $(top_srcdir)/build-aux/link-warning.h
-
-## end   gnulib module link-warning
-
 ## begin gnulib module localcharset
 
 libgnu_la_SOURCES += localcharset.h localcharset.c
@@ -540,20 +567,23 @@ EXTRA_DIST += config.charset ref-add.sin ref-del.sin
 
 ## begin gnulib module locale
 
-BUILT_SOURCES += $(LOCALE_H)
+BUILT_SOURCES += locale.h
 
 # We need the following in order to create <locale.h> when the system
 # doesn't have one that provides all definitions.
-locale.h: locale.in.h $(ARG_NONNULL_H)
+locale.h: locale.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
              -e 's|@''GNULIB_DUPLOCALE''@|$(GNULIB_DUPLOCALE)|g' \
+             -e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
              -e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
              -e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/locale.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -631,6 +661,35 @@ EXTRA_libgnu_la_SOURCES += memchr.c
 
 ## end   gnulib module memchr
 
+## begin gnulib module netdb
+
+BUILT_SOURCES += $(NETDB_H)
+
+# We need the following in order to create <netdb.h> when the system
+# doesn't have one that works with the given compiler.
+netdb.h: netdb.in.h $(ARG_NONNULL_H)
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''NEXT_NETDB_H''@|$(NEXT_NETDB_H)|g' \
+             -e 's|@''HAVE_NETDB_H''@|$(HAVE_NETDB_H)|g' \
+             -e 's|@''GNULIB_GETADDRINFO''@|$(GNULIB_GETADDRINFO)|g' \
+             -e 's|@''HAVE_STRUCT_ADDRINFO''@|$(HAVE_STRUCT_ADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_FREEADDRINFO''@|$(HAVE_DECL_FREEADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_GAI_STRERROR''@|$(HAVE_DECL_GAI_STRERROR)|g' \
+             -e 's|@''HAVE_DECL_GETADDRINFO''@|$(HAVE_DECL_GETADDRINFO)|g' \
+             -e 's|@''HAVE_DECL_GETNAMEINFO''@|$(HAVE_DECL_GETNAMEINFO)|g' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             < $(srcdir)/netdb.in.h; \
+       } > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += netdb.h netdb.h-t
+
+EXTRA_DIST += netdb.in.h
+
+## end   gnulib module netdb
+
 ## begin gnulib module netinet_in
 
 BUILT_SOURCES += $(NETINET_IN_H)
@@ -704,6 +763,15 @@ libgnu_la_SOURCES += size_max.h
 
 ## end   gnulib module size_max
 
+## begin gnulib module snprintf
+
+
+EXTRA_DIST += snprintf.c
+
+EXTRA_libgnu_la_SOURCES += snprintf.c
+
+## end   gnulib module snprintf
+
 ## begin gnulib module stat
 
 
@@ -823,7 +891,7 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+stdio.h: stdio.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -869,7 +937,8 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
-             -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
+             < $(srcdir)/stdio.in.h | \
+         sed -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 
's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
@@ -890,6 +959,7 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
+             -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
              -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \
              -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \
@@ -907,9 +977,9 @@ stdio.h: stdio.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \
              -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             < $(srcdir)/stdio.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
@@ -926,7 +996,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -982,8 +1052,9 @@ stdlib.h: stdlib.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/stdlib.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1035,7 +1106,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1074,6 +1145,8 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
              -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
+             < $(srcdir)/string.in.h | \
+         sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
@@ -1101,8 +1174,9 @@ string.h: string.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
              -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
              < $(srcdir)/string.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1118,7 +1192,7 @@ BUILT_SOURCES += strings.h
 
 # We need the following in order to create <strings.h> when the system
 # doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+strings.h: strings.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1126,8 +1200,8 @@ strings.h: strings.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
              -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
              -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/strings.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1139,11 +1213,11 @@ EXTRA_DIST += strings.in.h
 
 ## begin gnulib module sys_file
 
-BUILT_SOURCES += $(SYS_FILE_H)
+BUILT_SOURCES += sys/file.h
 
 # We need the following in order to create <sys/file.h> when the system
 # has one that is incomplete.
-sys/file.h: sys_file.in.h
+sys/file.h: sys_file.in.h $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1153,6 +1227,7 @@ sys/file.h: sys_file.in.h
              -e 's|@''NEXT_SYS_FILE_H''@|$(NEXT_SYS_FILE_H)|g' \
              -e 's/@''HAVE_FLOCK''@/$(HAVE_FLOCK)/g' \
              -e 's/@''GNULIB_FLOCK''@/$(GNULIB_FLOCK)/g' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_file.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1165,11 +1240,11 @@ EXTRA_DIST += sys_file.in.h
 
 ## begin gnulib module sys_socket
 
-BUILT_SOURCES += $(SYS_SOCKET_H)
+BUILT_SOURCES += sys/socket.h
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/socket.h: sys_socket.in.h $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1198,8 +1273,9 @@ sys/socket.h: sys_socket.in.h $(LINK_WARNING_H) 
$(ARG_NONNULL_H)
              -e 
's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \
              -e 's|@''HAVE_SA_FAMILY_T''@|$(HAVE_SA_FAMILY_T)|g' \
              -e 's|@''HAVE_ACCEPT4''@|$(HAVE_ACCEPT4)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_socket.in.h; \
        } > address@hidden && \
        mv -f address@hidden $@
@@ -1216,7 +1292,7 @@ BUILT_SOURCES += sys/stat.h
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_at)$(MKDIR_P) sys
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1255,8 +1331,9 @@ sys/stat.h: sys_stat.in.h $(LINK_WARNING_H) 
$(ARG_NONNULL_H)
              -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \
              -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \
              -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/sys_stat.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1273,20 +1350,27 @@ BUILT_SOURCES += time.h
 
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
-time.h: time.in.h $(ARG_NONNULL_H)
+time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
-             -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
-             -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-             -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
-             -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
-             -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
-             -e 
's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
-             -e 
's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+             -e 's|@''GNULIB_MKTIME''@|$(GNULIB_MKTIME)|g' \
+             -e 's|@''GNULIB_NANOSLEEP''@|$(GNULIB_NANOSLEEP)|g' \
+             -e 's|@''GNULIB_STRPTIME''@|$(GNULIB_STRPTIME)|g' \
+             -e 's|@''GNULIB_TIMEGM''@|$(GNULIB_TIMEGM)|g' \
+             -e 's|@''GNULIB_TIME_R''@|$(GNULIB_TIME_R)|g' \
+             -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+             -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
+             -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+             -e 's|@''REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+             -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 
's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
+             -e 
's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/time.in.h; \
        } > address@hidden && \
        mv address@hidden $@
@@ -1311,7 +1395,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+unistd.h: unistd.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -1334,6 +1418,7 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
              -e 's|@''GNULIB_GETGROUPS''@|$(GNULIB_GETGROUPS)|g' \
              -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
+             -e 's|@''GNULIB_GETLOGIN''@|$(GNULIB_GETLOGIN)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
              -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
@@ -1355,7 +1440,8 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''GNULIB_UNLINKAT''@|$(GNULIB_UNLINKAT)|g' \
              -e 's|@''GNULIB_USLEEP''@|$(GNULIB_USLEEP)|g' \
              -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
-             -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
+             < $(srcdir)/unistd.in.h | \
+         sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \
              -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
@@ -1367,6 +1453,7 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
              -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \
              -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
+             -e 's|@''HAVE_GETLOGIN''@|$(HAVE_GETLOGIN)|g' \
              -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
              -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \
@@ -1409,9 +1496,9 @@ unistd.h: unistd.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
              -e 
's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g'
 \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-             < $(srcdir)/unistd.in.h; \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
        } > address@hidden && \
        mv address@hidden $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
@@ -1464,6 +1551,31 @@ EXTRA_DIST += unitypes.h
 
 ## end   gnulib module unitypes
 
+## begin gnulib module unused-parameter
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += unused-parameter.h
+# The unused-parameter.h that gets inserted into generated .h files is the same
+# as build-aux/unused-parameter.h, except that it has the copyright header cut
+# off.
+unused-parameter.h: $(top_srcdir)/build-aux/unused-parameter.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/GL_UNUSED_PARAMETER/,$$p' \
+         < $(top_srcdir)/build-aux/unused-parameter.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += unused-parameter.h unused-parameter.h-t
+
+UNUSED_PARAMETER_H=unused-parameter.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/unused-parameter.h
+
+## end   gnulib module unused-parameter
+
 ## begin gnulib module useless-if-before-free
 
 
@@ -1514,13 +1626,32 @@ EXTRA_libgnu_la_SOURCES += vsnprintf.c
 
 ## end   gnulib module vsnprintf
 
+## begin gnulib module warn-on-use
+
+BUILT_SOURCES += warn-on-use.h
+# The warn-on-use.h that gets inserted into generated .h files is the same as
+# build-aux/warn-on-use.h, except that it has the copyright header cut off.
+warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h
+       $(AM_V_GEN)rm -f address@hidden $@ && \
+       sed -n -e '/^.ifndef/,$$p' \
+         < $(top_srcdir)/build-aux/warn-on-use.h \
+         > address@hidden && \
+       mv address@hidden $@
+MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t
+
+WARN_ON_USE_H=warn-on-use.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h
+
+## end   gnulib module warn-on-use
+
 ## begin gnulib module wchar
 
-BUILT_SOURCES += $(WCHAR_H)
+BUILT_SOURCES += wchar.h
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
+wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
@@ -1562,8 +1693,9 @@ wchar.h: wchar.in.h $(LINK_WARNING_H) $(ARG_NONNULL_H)
              -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
              -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-             -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
            < $(srcdir)/wchar.in.h; \
        } > address@hidden && \
        mv address@hidden $@
diff --git a/lib/alignof.h b/lib/alignof.h
index 28ce79c..13687ab 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -1,5 +1,5 @@
 /* Determine alignment of types.
-   Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2004, 2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 3d4f88b..ee7aa9a 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,7 +1,7 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
-   Foundation, Inc.
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2010 Free Software Foundation,
+   Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 3f2f841..8e6c6c5 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <arpa/inet.h>.
 
-   Copyright (C) 2005-2006, 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -19,8 +19,11 @@
 #ifndef _GL_ARPA_INET_H
 
 /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc
-   under MinGW. */
-#include <sys/socket.h>
+   under MinGW.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <sys/socket.h>
+#endif
 
 #if @HAVE_ARPA_INET_H@
 
@@ -36,10 +39,10 @@
 #ifndef _GL_ARPA_INET_H
 #define _GL_ARPA_INET_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -67,10 +70,10 @@ extern const char *inet_ntop (int af, const void *restrict 
src,
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_ntop
-# define inet_ntop(af,src,dst,cnt) \
-    (GL_LINK_WARNING ("inet_ntop is unportable - " \
-                      "use gnulib module inet_ntop for portability"), \
-     inet_ntop (af, src, dst, cnt))
+# if HAVE_RAW_DECL_INET_NTOP
+_GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - "
+                 "use gnulib module inet_ntop for portability");
+# endif
 #endif
 
 #if @GNULIB_INET_PTON@
@@ -80,10 +83,10 @@ extern int inet_pton (int af, const char *restrict src, 
void *restrict dst)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef inet_pton
-# define inet_pton(af,src,dst) \
-  (GL_LINK_WARNING ("inet_pton is unportable - " \
-                    "use gnulib module inet_pton for portability"), \
-   inet_pton (af, src, dst))
+# if HAVE_RAW_DECL_INET_PTON
+_GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - "
+                 "use gnulib module inet_pton for portability");
+# endif
 #endif
 
 #ifdef __cplusplus
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index 3b374a2..bc5a8af 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2006, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index 7b80cb5..cf2accb 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -1,5 +1,5 @@
 /* byteswap.h - Byte swapping
-   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Oskar Liljeblad <address@hidden>, 2005.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index e36a513..403adc2 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,6 +1,6 @@
 /* Character handling in C locale.
 
-   Copyright 2000-2003, 2006 Free Software Foundation, Inc.
+   Copyright 2000-2003, 2006, 2009-2010 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index d7b067e..00c0a26 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2010 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 714a3c6..99e7faf 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,6 @@
 /* Case-insensitive string comparison functions in C locale.
-   Copyright (C) 1995-1996, 2001, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index ce28582..bc3e76d 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
 /* c-strcasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h
index cd29b66..0af82f3 100644
--- a/lib/c-strcaseeq.h
+++ b/lib/c-strcaseeq.h
@@ -1,5 +1,5 @@
 /* Optimized case-insensitive string comparison in C locale.
-   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 0a4e027..01dbf39 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
 /* c-strncasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index c361a46..0f36add 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/config.charset b/lib/config.charset
index 217bef1..ae2efc4 100644
--- a/lib/config.charset
+++ b/lib/config.charset
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Output a system dependent table of character encoding aliases.
 #
-#   Copyright (C) 2000-2004, 2006-2009 Free Software Foundation, Inc.
+#   Copyright (C) 2000-2004, 2006-2010 Free Software Foundation, Inc.
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/duplocale.c b/lib/duplocale.c
index ee928fd..857f545 100644
--- a/lib/duplocale.c
+++ b/lib/duplocale.c
@@ -1,5 +1,5 @@
 /* Duplicate a locale object.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/errno.in.h b/lib/errno.in.h
index a9b81d5..0e6fb7f 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/float+.h b/lib/float+.h
index 2288e3d..956eb28 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -1,5 +1,5 @@
 /* Supplemental information about the floating-point formats.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2007.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/float.in.h b/lib/float.in.h
index 63d55f8..ad99af3 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -1,6 +1,6 @@
 /* A correct <float.h>.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/flock.c b/lib/flock.c
index f583245..72eef5b 100644
--- a/lib/flock.c
+++ b/lib/flock.c
@@ -6,7 +6,7 @@
 
    Written by Richard W.M. Jones <rjones.at.redhat.com>
 
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
diff --git a/lib/full-read.c b/lib/full-read.c
index e02a42a..93d378d 100644
--- a/lib/full-read.c
+++ b/lib/full-read.c
@@ -1,5 +1,5 @@
 /* An interface to read that retries after partial reads and interrupts.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/full-read.h b/lib/full-read.h
index adb8faa..71817a7 100644
--- a/lib/full-read.h
+++ b/lib/full-read.h
@@ -1,6 +1,6 @@
 /* An interface to read() that reads all it is asked to read.
 
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/full-write.c b/lib/full-write.c
index 1e49da8..b0f6b27 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -1,7 +1,6 @@
 /* An interface to read and write that retries (if necessary) until complete.
 
-   Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1997-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/full-write.h b/lib/full-write.h
index 3857e87..03dabfb 100644
--- a/lib/full-write.h
+++ b/lib/full-write.h
@@ -1,6 +1,6 @@
 /* An interface to write() that writes all it is asked to write.
 
-   Copyright (C) 2002-2003 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
new file mode 100644
index 0000000..21e8076
--- /dev/null
+++ b/lib/gai_strerror.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 Free
+   Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Philip Blundell <address@hidden>, 1997.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <netdb.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(String) gettext (String)
+# define N_(String) String
+#endif
+
+static struct
+  {
+    int code;
+    const char *msg;
+  }
+values[] =
+  {
+    { EAI_ADDRFAMILY, N_("Address family for hostname not supported") },
+    { EAI_AGAIN, N_("Temporary failure in name resolution") },
+    { EAI_BADFLAGS, N_("Bad value for ai_flags") },
+    { EAI_FAIL, N_("Non-recoverable failure in name resolution") },
+    { EAI_FAMILY, N_("ai_family not supported") },
+    { EAI_MEMORY, N_("Memory allocation failure") },
+    { EAI_NODATA, N_("No address associated with hostname") },
+    { EAI_NONAME, N_("Name or service not known") },
+    { EAI_SERVICE, N_("Servname not supported for ai_socktype") },
+    { EAI_SOCKTYPE, N_("ai_socktype not supported") },
+    { EAI_SYSTEM, N_("System error") },
+    { EAI_OVERFLOW, N_("Argument buffer too small") },
+#ifdef EAI_INPROGRESS
+    { EAI_INPROGRESS, N_("Processing request in progress") },
+    { EAI_CANCELED, N_("Request canceled") },
+    { EAI_NOTCANCELED, N_("Request not canceled") },
+    { EAI_ALLDONE, N_("All requests done") },
+    { EAI_INTR, N_("Interrupted by a signal") },
+    { EAI_IDN_ENCODE, N_("Parameter string not correctly encoded") }
+#endif
+  };
+
+const char *
+gai_strerror (int code)
+{
+  size_t i;
+  for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
+    if (values[i].code == code)
+      return _(values[i].msg);
+
+  return _("Unknown error");
+}
+#ifdef _LIBC
+libc_hidden_def (gai_strerror)
+#endif
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
new file mode 100644
index 0000000..475eaa0
--- /dev/null
+++ b/lib/getaddrinfo.c
@@ -0,0 +1,438 @@
+/* Get address information (partial implementation).
+   Copyright (C) 1997, 2001-2002, 2004-2010 Free Software Foundation, Inc.
+   Contributed by Simon Josefsson <address@hidden>.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Don't use __attribute__ __nonnull__ in this compilation unit.  Otherwise gcc
+   optimizes away the sa == NULL test below.  */
+#define _GL_ARG_NONNULL(params)
+
+#include <netdb.h>
+
+#if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
+
+/* Get inet_ntop.  */
+#include <arpa/inet.h>
+
+/* Get calloc. */
+#include <stdlib.h>
+
+/* Get memcpy, strdup. */
+#include <string.h>
+
+/* Get snprintf. */
+#include <stdio.h>
+
+#include <stdbool.h>
+
+#include "gettext.h"
+#define _(String) gettext (String)
+#define N_(String) String
+
+/* BeOS has AF_INET, but not PF_INET.  */
+#ifndef PF_INET
+# define PF_INET AF_INET
+#endif
+/* BeOS also lacks PF_UNSPEC.  */
+#ifndef PF_UNSPEC
+# define PF_UNSPEC 0
+#endif
+
+#if defined _WIN32 || defined __WIN32__
+# define WIN32_NATIVE
+#endif
+
+#ifdef WIN32_NATIVE
+typedef int (WSAAPI *getaddrinfo_func) (const char*, const char*,
+                                        const struct addrinfo*,
+                                        struct addrinfo**);
+typedef void (WSAAPI *freeaddrinfo_func) (struct addrinfo*);
+typedef int (WSAAPI *getnameinfo_func) (const struct sockaddr*,
+                                        socklen_t, char*, DWORD,
+                                        char*, DWORD, int);
+
+static getaddrinfo_func getaddrinfo_ptr = NULL;
+static freeaddrinfo_func freeaddrinfo_ptr = NULL;
+static getnameinfo_func getnameinfo_ptr = NULL;
+
+static int
+use_win32_p (void)
+{
+  static int done = 0;
+  HMODULE h;
+
+  if (done)
+    return getaddrinfo_ptr ? 1 : 0;
+
+  done = 1;
+
+  h = GetModuleHandle ("ws2_32.dll");
+
+  if (h)
+    {
+      getaddrinfo_ptr = (getaddrinfo_func) GetProcAddress (h, "getaddrinfo");
+      freeaddrinfo_ptr = (freeaddrinfo_func) GetProcAddress (h, 
"freeaddrinfo");
+      getnameinfo_ptr = (getnameinfo_func) GetProcAddress (h, "getnameinfo");
+    }
+
+  /* If either is missing, something is odd. */
+  if (!getaddrinfo_ptr || !freeaddrinfo_ptr || !getnameinfo_ptr)
+    {
+      getaddrinfo_ptr = NULL;
+      freeaddrinfo_ptr = NULL;
+      getnameinfo_ptr = NULL;
+      return 0;
+    }
+
+  return 1;
+}
+#endif
+
+static inline bool
+validate_family (int family)
+{
+  /* FIXME: Support more families. */
+#if HAVE_IPV4
+     if (family == PF_INET)
+       return true;
+#endif
+#if HAVE_IPV6
+     if (family == PF_INET6)
+       return true;
+#endif
+     if (family == PF_UNSPEC)
+       return true;
+     return false;
+}
+
+/* Translate name of a service location and/or a service name to set of
+   socket addresses. */
+int
+getaddrinfo (const char *restrict nodename,
+             const char *restrict servname,
+             const struct addrinfo *restrict hints,
+             struct addrinfo **restrict res)
+{
+  struct addrinfo *tmp;
+  int port = 0;
+  struct hostent *he;
+  void *storage;
+  size_t size;
+#if HAVE_IPV6
+  struct v6_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in6 sockaddr_in6;
+  };
+#endif
+#if HAVE_IPV4
+  struct v4_pair {
+    struct addrinfo addrinfo;
+    struct sockaddr_in sockaddr_in;
+  };
+#endif
+
+#ifdef WIN32_NATIVE
+  if (use_win32_p ())
+    return getaddrinfo_ptr (nodename, servname, hints, res);
+#endif
+
+  if (hints && (hints->ai_flags & ~(AI_CANONNAME|AI_PASSIVE)))
+    /* FIXME: Support more flags. */
+    return EAI_BADFLAGS;
+
+  if (hints && !validate_family (hints->ai_family))
+    return EAI_FAMILY;
+
+  if (hints &&
+      hints->ai_socktype != SOCK_STREAM && hints->ai_socktype != SOCK_DGRAM)
+    /* FIXME: Support other socktype. */
+    return EAI_SOCKTYPE; /* FIXME: Better return code? */
+
+  if (!nodename)
+    {
+      if (!(hints->ai_flags & AI_PASSIVE))
+        return EAI_NONAME;
+
+#ifdef HAVE_IPV6
+      nodename = (hints->ai_family == AF_INET6) ? "::" : "0.0.0.0";
+#else
+      nodename = "0.0.0.0";
+#endif
+    }
+
+  if (servname)
+    {
+      struct servent *se = NULL;
+      const char *proto =
+        (hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
+
+      if (hints == NULL || !(hints->ai_flags & AI_NUMERICSERV))
+        /* FIXME: Use getservbyname_r if available. */
+        se = getservbyname (servname, proto);
+
+      if (!se)
+        {
+          char *c;
+          if (!(*servname >= '0' && *servname <= '9'))
+            return EAI_NONAME;
+          port = strtoul (servname, &c, 10);
+          if (*c || port > 0xffff)
+            return EAI_NONAME;
+          port = htons (port);
+        }
+      else
+        port = se->s_port;
+    }
+
+  /* FIXME: Use gethostbyname_r if available. */
+  he = gethostbyname (nodename);
+  if (!he || he->h_addr_list[0] == NULL)
+    return EAI_NONAME;
+
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV6
+    case PF_INET6:
+      size = sizeof (struct v6_pair);
+      break;
+#endif
+
+#if HAVE_IPV4
+    case PF_INET:
+      size = sizeof (struct v4_pair);
+      break;
+#endif
+
+    default:
+      return EAI_NODATA;
+    }
+
+  storage = calloc (1, size);
+  if (!storage)
+    return EAI_MEMORY;
+
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV6
+    case PF_INET6:
+      {
+        struct v6_pair *p = storage;
+        struct sockaddr_in6 *sinp = &p->sockaddr_in6;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin6_port = port;
+
+        if (he->h_length != sizeof (sinp->sin6_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin6_addr, he->h_addr_list[0], sizeof sinp->sin6_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+#endif
+
+#if HAVE_IPV4
+    case PF_INET:
+      {
+        struct v4_pair *p = storage;
+        struct sockaddr_in *sinp = &p->sockaddr_in;
+        tmp = &p->addrinfo;
+
+        if (port)
+          sinp->sin_port = port;
+
+        if (he->h_length != sizeof (sinp->sin_addr))
+          {
+            free (storage);
+            return EAI_SYSTEM; /* FIXME: Better return code?  Set errno? */
+          }
+
+        memcpy (&sinp->sin_addr, he->h_addr_list[0], sizeof sinp->sin_addr);
+
+        tmp->ai_addr = (struct sockaddr *) sinp;
+        tmp->ai_addrlen = sizeof *sinp;
+      }
+      break;
+#endif
+
+    default:
+      free (storage);
+      return EAI_NODATA;
+    }
+
+  if (hints && hints->ai_flags & AI_CANONNAME)
+    {
+      const char *cn;
+      if (he->h_name)
+        cn = he->h_name;
+      else
+        cn = nodename;
+
+      tmp->ai_canonname = strdup (cn);
+      if (!tmp->ai_canonname)
+        {
+          free (storage);
+          return EAI_MEMORY;
+        }
+    }
+
+  tmp->ai_protocol = (hints) ? hints->ai_protocol : 0;
+  tmp->ai_socktype = (hints) ? hints->ai_socktype : 0;
+  tmp->ai_addr->sa_family = he->h_addrtype;
+  tmp->ai_family = he->h_addrtype;
+
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+  switch (he->h_addrtype)
+    {
+#if HAVE_IPV4
+    case AF_INET:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in);
+      break;
+#endif
+#if HAVE_IPV6
+    case AF_INET6:
+      tmp->ai_addr->sa_len = sizeof (struct sockaddr_in6);
+      break;
+#endif
+    }
+#endif
+
+  /* FIXME: If more than one address, create linked list of addrinfo's. */
+
+  *res = tmp;
+
+  return 0;
+}
+
+/* Free `addrinfo' structure AI including associated storage.  */
+void
+freeaddrinfo (struct addrinfo *ai)
+{
+#ifdef WIN32_NATIVE
+  if (use_win32_p ())
+    {
+      freeaddrinfo_ptr (ai);
+      return;
+    }
+#endif
+
+  while (ai)
+    {
+      struct addrinfo *cur;
+
+      cur = ai;
+      ai = ai->ai_next;
+
+      free (cur->ai_canonname);
+      free (cur);
+    }
+}
+
+int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+                char *restrict node, socklen_t nodelen,
+                char *restrict service, socklen_t servicelen,
+                int flags)
+{
+#ifdef WIN32_NATIVE
+  if (use_win32_p ())
+    return getnameinfo_ptr (sa, salen, node, nodelen,
+                            service, servicelen, flags);
+#endif
+
+  /* FIXME: Support other flags. */
+  if ((node && nodelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (service && servicelen > 0 && !(flags & NI_NUMERICHOST)) ||
+      (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV)))
+    return EAI_BADFLAGS;
+
+  if (sa == NULL || salen < sizeof (sa->sa_family))
+    return EAI_FAMILY;
+
+  switch (sa->sa_family)
+    {
+#if HAVE_IPV4
+    case AF_INET:
+      if (salen < sizeof (struct sockaddr_in))
+        return EAI_FAMILY;
+      break;
+#endif
+#if HAVE_IPV6
+    case AF_INET6:
+      if (salen < sizeof (struct sockaddr_in6))
+        return EAI_FAMILY;
+      break;
+#endif
+    default:
+      return EAI_FAMILY;
+    }
+
+  if (node && nodelen > 0 && flags & NI_NUMERICHOST)
+    {
+      switch (sa->sa_family)
+        {
+#if HAVE_IPV4
+        case AF_INET:
+          if (!inet_ntop (AF_INET,
+                          &(((const struct sockaddr_in *) sa)->sin_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+#endif
+
+#if HAVE_IPV6
+        case AF_INET6:
+          if (!inet_ntop (AF_INET6,
+                          &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                          node, nodelen))
+            return EAI_SYSTEM;
+          break;
+#endif
+
+        default:
+          return EAI_FAMILY;
+        }
+    }
+
+  if (service && servicelen > 0 && flags & NI_NUMERICSERV)
+    switch (sa->sa_family)
+      {
+#if HAVE_IPV4
+      case AF_INET:
+#endif
+#if HAVE_IPV6
+      case AF_INET6:
+#endif
+        {
+          unsigned short int port
+            = ntohs (((const struct sockaddr_in *) sa)->sin_port);
+          if (servicelen <= snprintf (service, servicelen, "%u", port))
+            return EAI_OVERFLOW;
+        }
+        break;
+      }
+
+  return 0;
+}
diff --git a/lib/gettext.h b/lib/gettext.h
index 3d7d08c..987009f 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,6 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software 
Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/iconv.c b/lib/iconv.c
index f64c045..5b29d9a 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,5 +1,5 @@
 /* Character set conversion.
-   Copyright (C) 1999-2001, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999-2001, 2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index d90f289..5512c60 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <iconv.h>.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -28,20 +28,29 @@
 #ifndef _GL_ICONV_H
 #define _GL_ICONV_H
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 #if @REPLACE_ICONV_OPEN@
 /* An iconv_open wrapper that supports the IANA standardized encoding names
    ("ISO-8859-1" etc.) as far as possible.  */
-# define iconv_open rpl_iconv_open
-extern iconv_t iconv_open (const char *tocode, const char *fromcode)
-     _GL_ARG_NONNULL ((1, 2));
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define iconv_open rpl_iconv_open
+# endif
+_GL_FUNCDECL_RPL (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode));
+#else
+_GL_CXXALIAS_SYS (iconv_open, iconv_t,
+                  (const char *tocode, const char *fromcode));
 #endif
+_GL_CXXALIASWARN (iconv_open);
 
 #if @REPLACE_ICONV_UTF@
 /* Special constants for supporting UTF-{16,32}{BE,LE} encodings.
@@ -57,18 +66,36 @@ extern iconv_t iconv_open (const char *tocode, const char 
*fromcode)
 #endif
 
 #if @REPLACE_ICONV@
-# define iconv rpl_iconv
-extern size_t iconv (iconv_t cd,
-                     @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
-                     char **outbuf, size_t *outbytesleft);
-# define iconv_close rpl_iconv_close
-extern int iconv_close (iconv_t cd);
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define iconv rpl_iconv
+# endif
+_GL_FUNCDECL_RPL (iconv, size_t,
+                  (iconv_t cd,
+                   @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
+                   char **outbuf, size_t *outbytesleft));
+_GL_CXXALIAS_RPL (iconv, size_t,
+                  (iconv_t cd,
+                   @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
+                   char **outbuf, size_t *outbytesleft));
+#else
+_GL_CXXALIAS_SYS (iconv, size_t,
+                  (iconv_t cd,
+                   @ICONV_CONST@ char **inbuf, size_t *inbytesleft,
+                   char **outbuf, size_t *outbytesleft));
 #endif
+_GL_CXXALIASWARN (iconv);
 
-
-#ifdef __cplusplus
-}
+#if @REPLACE_ICONV@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define iconv_close rpl_iconv_close
+# endif
+_GL_FUNCDECL_RPL (iconv_close, int, (iconv_t cd));
+_GL_CXXALIAS_RPL (iconv_close, int, (iconv_t cd));
+#else
+_GL_CXXALIAS_SYS (iconv_close, int, (iconv_t cd));
 #endif
+_GL_CXXALIASWARN (iconv_close);
+
 
 #endif /* _GL_ICONV_H */
 #endif /* _GL_ICONV_H */
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index 3680412..1b300ec 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -1,5 +1,5 @@
 /* Character set conversion.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index d62dfda..1d1c053 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,5 +1,5 @@
 /* Character set conversion.
-   Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/iconveh.h b/lib/iconveh.h
index fe1bfe7..da15126 100644
--- a/lib/iconveh.h
+++ b/lib/iconveh.h
@@ -1,5 +1,5 @@
 /* Character set conversion handler type.
-   Copyright (C) 2001-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 08ac7d4..cd5dbf1 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -1,6 +1,6 @@
 /* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
 
-   Copyright (C) 2005, 2006, 2008, 2009  Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index ae1bcb8..e7d4ba0 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -1,6 +1,6 @@
 /* inet_pton.c -- convert IPv4 and IPv6 addresses from text to binary form
 
-   Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 14359fc..29de23d 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -1,6 +1,6 @@
 /* Determine a canonical name for the current locale's character encoding.
 
-   Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2000-2006, 2008-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/localcharset.h b/lib/localcharset.h
index 1772a50..c18f492 100644
--- a/lib/localcharset.h
+++ b/lib/localcharset.h
@@ -1,5 +1,5 @@
 /* Determine a canonical name for the current locale's character encoding.
-   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2009-2010 Free Software Foundation, Inc.
    This file is part of the GNU CHARSET Library.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/locale.in.h b/lib/locale.in.h
index ff661dc..0d3ca80 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -1,5 +1,5 @@
 /* A POSIX <locale.h>.
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -34,8 +34,12 @@
 # include <xlocale.h>
 #endif
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
    On systems that don't define it, use the same value as GNU libintl.  */
 #if !defined LC_MESSAGES
@@ -44,16 +48,24 @@
 
 #if @GNULIB_DUPLOCALE@
 # if @REPLACE_DUPLOCALE@
-#  undef duplocale
-#  define duplocale rpl_duplocale
-extern locale_t duplocale (locale_t locale) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef duplocale
+#   define duplocale rpl_duplocale
+#  endif
+_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL 
((1)));
+_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
+# else
+#  if @HAVE_DUPLOCALE@
+_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
+#  endif
 # endif
+_GL_CXXALIASWARN (duplocale);
 #elif defined GNULIB_POSIXCHECK
 # undef duplocale
-# define duplocale(l) \
-   (GL_LINK_WARNING ("duplocale is buggy on some glibc systems - " \
-                     "use gnulib module duplocale for portability"), \
-    duplocale (l))
+# if HAVE_RAW_DECL_DUPLOCALE
+_GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
+                 "use gnulib module duplocale for portability");
+# endif
 #endif
 
 #endif /* _GL_LOCALE_H */
diff --git a/lib/lstat.c b/lib/lstat.c
index 3f9a97e..a8e95e6 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,7 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-1999, 2000-2006, 2008-2009 Free Software
-   Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/malloc.c b/lib/malloc.c
index 9111c7a..614320c 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -1,6 +1,6 @@
 /* malloc() function that is glibc compatible.
 
-   Copyright (C) 1997, 1998, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997-1998, 2006-2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/malloca.c b/lib/malloca.c
index 38575a2..39baa5e 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2003.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/malloca.h b/lib/malloca.h
index 77c3ba1..e39d0f4 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,5 +1,5 @@
 /* Safe automatic memory allocation.
-   Copyright (C) 2003-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2003.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/mbrlen.c b/lib/mbrlen.c
index 94c66d6..1bd1cf4 100644
--- a/lib/mbrlen.c
+++ b/lib/mbrlen.c
@@ -1,5 +1,5 @@
 /* Recognize multibyte character.
-   Copyright (C) 1999-2000, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index e8b26e2..31f229c 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -1,5 +1,5 @@
 /* Convert multibyte character to wide character.
-   Copyright (C) 1999-2002, 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2005-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index 7495794..811e39b 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -1,5 +1,5 @@
 /* Test for initial conversion state.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/memchr.c b/lib/memchr.c
index ffc61cd..1e897cd 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2006, 2008
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2010
    Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
new file mode 100644
index 0000000..8fa6164
--- /dev/null
+++ b/lib/netdb.in.h
@@ -0,0 +1,192 @@
+/* Provide a netdb.h header file for systems lacking it (read: MinGW).
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+/* This file is supposed to be used on platforms that lack <netdb.h>.
+   It is intended to provide definitions and prototypes needed by an
+   application.  */
+
+#ifndef _GL_NETDB_H
+
+#if @HAVE_NETDB_H@
+
+# if __GNUC__ >= 3
address@hidden@
+# endif
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_NETDB_H@
+
+#endif
+
+#ifndef _GL_NETDB_H
+#define _GL_NETDB_H
+
+/* Get netdb.h definitions such as struct hostent for MinGW.  */
+#include <sys/socket.h>
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* Declarations for a platform that lacks <netdb.h>, or where it is
+   incomplete.  */
+
+#if @GNULIB_GETADDRINFO@
+
+# if address@hidden@
+
+/* Structure to contain information about address of a service provider.  */
+struct addrinfo
+{
+  int ai_flags;                 /* Input flags.  */
+  int ai_family;                /* Protocol family for socket.  */
+  int ai_socktype;              /* Socket type.  */
+  int ai_protocol;              /* Protocol for socket.  */
+  socklen_t ai_addrlen;         /* Length of socket address.  */
+  struct sockaddr *ai_addr;     /* Socket address for socket.  */
+  char *ai_canonname;           /* Canonical name for service location.  */
+  struct addrinfo *ai_next;     /* Pointer to next in list.  */
+};
+# endif
+
+/* Possible values for `ai_flags' field in `addrinfo' structure.  */
+# ifndef AI_PASSIVE
+#  define AI_PASSIVE    0x0001  /* Socket address is intended for `bind'.  */
+# endif
+# ifndef AI_CANONNAME
+#  define AI_CANONNAME  0x0002  /* Request for canonical name.  */
+# endif
+# ifndef AI_NUMERICSERV
+#  define AI_NUMERICSERV        0x0400  /* Don't use name resolution.  */
+# endif
+
+# if 0
+#  define AI_NUMERICHOST        0x0004  /* Don't use name resolution.  */
+# endif
+
+/* These symbolic constants are required to be present by POSIX, but
+   our getaddrinfo replacement doesn't use them (yet).  Setting them
+   to 0 on systems that doesn't have them avoids causing problems for
+   system getaddrinfo implementations that would be confused by
+   unknown values.  */
+# ifndef AI_V4MAPPED
+#  define AI_V4MAPPED    0 /* 0x0008: IPv4 mapped addresses are acceptable.  */
+# endif
+# ifndef AI_ALL
+#  define AI_ALL         0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */
+# endif
+# ifndef AI_ADDRCONFIG
+#  define AI_ADDRCONFIG  0 /* 0x0020: Use configuration of this host to choose
+                                      returned address type.  */
+# endif
+
+/* Error values for `getaddrinfo' function.  */
+# ifndef EAI_BADFLAGS
+#  define EAI_BADFLAGS    -1    /* Invalid value for `ai_flags' field.  */
+#  define EAI_NONAME      -2    /* NAME or SERVICE is unknown.  */
+#  define EAI_AGAIN       -3    /* Temporary failure in name resolution.  */
+#  define EAI_FAIL        -4    /* Non-recoverable failure in name res.  */
+#  define EAI_NODATA      -5    /* No address associated with NAME.  */
+#  define EAI_FAMILY      -6    /* `ai_family' not supported.  */
+#  define EAI_SOCKTYPE    -7    /* `ai_socktype' not supported.  */
+#  define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
+#  define EAI_MEMORY      -10   /* Memory allocation failure.  */
+# endif
+
+/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
+   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
+   in favor of EAI_NONAME.  */
+# if !defined EAI_NODATA && defined EAI_NONAME
+#  define EAI_NODATA EAI_NONAME
+# endif
+
+# ifndef EAI_OVERFLOW
+/* Not defined on mingw32 and Haiku. */
+#  define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
+# endif
+# ifndef EAI_ADDRFAMILY
+/* Not defined on mingw32. */
+#  define EAI_ADDRFAMILY  -9    /* Address family for NAME not supported.  */
+# endif
+# ifndef EAI_SYSTEM
+/* Not defined on mingw32. */
+#  define EAI_SYSTEM      -11   /* System error returned in `errno'.  */
+# endif
+
+# if 0
+/* The commented out definitions below are not yet implemented in the
+   GNULIB getaddrinfo() replacement, so are not yet needed.
+
+   If they are restored, be sure to protect the definitions with #ifndef.  */
+#  ifndef EAI_INPROGRESS
+#   define EAI_INPROGRESS       -100    /* Processing request in progress.  */
+#   define EAI_CANCELED         -101    /* Request canceled.  */
+#   define EAI_NOTCANCELED      -102    /* Request not canceled.  */
+#   define EAI_ALLDONE          -103    /* All requests done.  */
+#   define EAI_INTR             -104    /* Interrupted by a signal.  */
+#   define EAI_IDN_ENCODE       -105    /* IDN encoding failed.  */
+#  endif
+# endif
+
+# if address@hidden@
+/* Translate name of a service location and/or a service name to set of
+   socket addresses.
+   For more details, see the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
+extern int getaddrinfo (const char *restrict nodename,
+                        const char *restrict servname,
+                        const struct addrinfo *restrict hints,
+                        struct addrinfo **restrict res)
+     _GL_ARG_NONNULL ((4));
+# endif
+
+# if address@hidden@
+/* Free `addrinfo' structure AI including associated storage.
+   For more details, see the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
+extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1));
+# endif
+
+# if address@hidden@
+/* Convert error return from getaddrinfo() to a string.
+   For more details, see the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */
+extern const char *gai_strerror (int ecode);
+# endif
+
+# if address@hidden@
+/* Convert socket address to printable node and service names.
+   For more details, see the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
+extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+                       char *restrict node, socklen_t nodelen,
+                       char *restrict service, socklen_t servicelen,
+                       int flags)
+     _GL_ARG_NONNULL ((1));
+# endif
+
+/* Possible flags for getnameinfo.  */
+# ifndef NI_NUMERICHOST
+#  define NI_NUMERICHOST 1
+# endif
+# ifndef NI_NUMERICSERV
+#  define NI_NUMERICSERV 2
+# endif
+
+#endif /* @GNULIB_GETADDRINFO@ */
+
+#endif /* _GL_NETDB_H */
+#endif /* _GL_NETDB_H */
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index 8c94f6a..8a86bca 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <netinet/in.h>.
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/pathmax.h b/lib/pathmax.h
index 99d5ad8..c53aa9d 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,6 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009 Free Software Foundation, 
Inc.
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/printf-args.c b/lib/printf-args.c
index 921931c..597bba9 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -1,5 +1,5 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2005-2007, 2009 Free Software
+   Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2010 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-args.h b/lib/printf-args.h
index 60b56d6..d76352d 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -1,5 +1,6 @@
 /* Decomposed printf argument list.
-   Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2006-2007, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 577befa..d88ddf3 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index 3225173..2cf965b 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -1,5 +1,6 @@
 /* Parse printf format string.
-   Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/putenv.c b/lib/putenv.c
index 630a510..36c5123 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2008
-   Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2010 Free Software
+   Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to address@hidden
diff --git a/lib/readlink.c b/lib/readlink.c
index 704e6f0..7d326b4 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -29,8 +29,8 @@
    such as DJGPP 2.03 and mingw32.  */
 
 ssize_t
-readlink (const char *name, char *buf _UNUSED_PARAMETER_,
-          size_t bufsize _UNUSED_PARAMETER_)
+readlink (const char *name, char *buf _GL_UNUSED,
+          size_t bufsize _GL_UNUSED)
 {
   struct stat statbuf;
 
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
index 3acdcc8..cb482d7 100644
--- a/lib/ref-add.sin
+++ b/lib/ref-add.sin
@@ -1,6 +1,6 @@
 # Add this package to a list of references stored in a text file.
 #
-#   Copyright (C) 2000 Free Software Foundation, Inc.
+#   Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc.
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
index 7923d06..74f8e1c 100644
--- a/lib/ref-del.sin
+++ b/lib/ref-del.sin
@@ -1,6 +1,6 @@
 # Remove this package from a list of references stored in a text file.
 #
-#   Copyright (C) 2000 Free Software Foundation, Inc.
+#   Copyright (C) 2000, 2009, 2010 Free Software Foundation, Inc.
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/safe-read.c b/lib/safe-read.c
index 76bb640..1a24096 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -1,7 +1,7 @@
 /* An interface to read and write that retries after interrupts.
 
-   Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004, 2005, 2006 Free
-   Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2010 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/safe-read.h b/lib/safe-read.h
index 103fc3f..21c860b 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -1,5 +1,5 @@
 /* An interface to read() that retries after interrupts.
-   Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/safe-write.c b/lib/safe-write.c
index fcd5c42..6e8c8d7 100644
--- a/lib/safe-write.c
+++ b/lib/safe-write.c
@@ -1,5 +1,5 @@
 /* An interface to write that retries after interrupts.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/safe-write.h b/lib/safe-write.h
index 51e3dcb..5c24996 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -1,5 +1,5 @@
 /* An interface to write() that retries after interrupts.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/size_max.h b/lib/size_max.h
index 419d73a..381eea1 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -1,5 +1,5 @@
 /* size_max.h -- declare SIZE_MAX through system headers
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/snprintf.c b/lib/snprintf.c
new file mode 100644
index 0000000..4243679
--- /dev/null
+++ b/lib/snprintf.c
@@ -0,0 +1,72 @@
+/* Formatted output to strings.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
+   Written by Simon Josefsson and Paul Eggert.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License 
along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include <stdio.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "vasnprintf.h"
+
+/* Print formatted output to string STR.  Similar to sprintf, but
+   additional length SIZE limit how much is written into STR.  Returns
+   string length of formatted string (which may be larger than SIZE).
+   STR may be NULL, in which case nothing will be written.  On error,
+   return a negative value.  */
+int
+snprintf (char *str, size_t size, const char *format, ...)
+{
+  char *output;
+  size_t len;
+  size_t lenbuf = size;
+  va_list args;
+
+  va_start (args, format);
+  output = vasnprintf (str, &lenbuf, format, args);
+  len = lenbuf;
+  va_end (args);
+
+  if (!output)
+    return -1;
+
+  if (output != str)
+    {
+      if (size)
+        {
+          size_t pruned_len = (len < size ? len : size - 1);
+          memcpy (str, output, pruned_len);
+          str[pruned_len] = '\0';
+        }
+
+      free (output);
+    }
+
+  if (INT_MAX < len)
+    {
+      errno = EOVERFLOW;
+      return -1;
+    }
+
+  return len;
+}
diff --git a/lib/stat.c b/lib/stat.c
index 97b340c..60fe127 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,5 +1,5 @@
 /* Work around platform bugs in stat.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 873e6c0..4bbd01e 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <stdarg.h>.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index 3390484..7b681f6 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index dacc83d..b1dfb67 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 36e6469..a1162d4 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2010 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
diff --git a/lib/stdio-write.c b/lib/stdio-write.c
index 7b26c78..61bba92 100644
--- a/lib/stdio-write.c
+++ b/lib/stdio-write.c
@@ -1,5 +1,5 @@
 /* POSIX compatible FILE stream write function.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 8e09570..27c554b 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -36,598 +36,970 @@
 #ifndef _GL_STDIO_H
 #define _GL_STDIO_H
 
+/* Get va_list.  Needed on many systems, including glibc 2.8.  */
 #include <stdarg.h>
+
 #include <stddef.h>
 
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && address@hidden@) \
-  || (@GNULIB_GETLINE@ && (address@hidden@ || @REPLACE_GETLINE@))
-/* Get off_t and ssize_t.  */
-# include <sys/types.h>
-#endif
+/* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8.  */
+#include <sys/types.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 
 #if @GNULIB_DPRINTF@
 # if @REPLACE_DPRINTF@
-#  define dprintf rpl_dprintf
-# endif
-# if @REPLACE_DPRINTF@ || address@hidden@
-extern int dprintf (int fd, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dprintf rpl_dprintf
+#  endif
+_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *format, ...)
+                                __attribute__ ((__format__ (__printf__, 2, 3)))
+                                _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *format, ...));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *format, ...)
+                                __attribute__ ((__format__ (__printf__, 2, 3)))
+                                _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *format, ...));
 # endif
+_GL_CXXALIASWARN (dprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef dprintf
-# define dprintf(d,f,a) \
-    (GL_LINK_WARNING ("dprintf is unportable - " \
-                      "use gnulib module dprintf for portability"), \
-     dprintf (d, f, a))
+# if HAVE_RAW_DECL_DPRINTF
+_GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
+                 "use gnulib module dprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_FCLOSE@
+/* Close STREAM and its underlying file descriptor.  */
 # if @REPLACE_FCLOSE@
-#  define fclose rpl_fclose
-  /* Close STREAM and its underlying file descriptor.  */
-extern int fclose (FILE *stream) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fclose rpl_fclose
+#  endif
+_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
 # endif
+_GL_CXXALIASWARN (fclose);
 #elif defined GNULIB_POSIXCHECK
 # undef fclose
-# define fclose(f) \
-   (GL_LINK_WARNING ("fclose is not always POSIX compliant - " \
-                     "use gnulib module fclose for portable " \
-                     "POSIX compliance"), \
-    fclose (f))
+/* Assume fclose is always declared.  */
+_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
+                 "use gnulib module fclose for portable POSIX compliance");
 #endif
 
 #if @GNULIB_FFLUSH@
+/* Flush all pending data on STREAM according to POSIX rules.  Both
+   output and seekable input streams are supported.
+   Note! LOSS OF DATA can occur if fflush is applied on an input stream
+   that is _not_seekable_ or on an update stream that is _not_seekable_
+   and in which the most recent operation was input.  Seekability can
+   be tested with lseek(fileno(fp),0,SEEK_CUR).  */
 # if @REPLACE_FFLUSH@
-#  define fflush rpl_fflush
-  /* Flush all pending data on STREAM according to POSIX rules.  Both
-     output and seekable input streams are supported.
-     Note! LOSS OF DATA can occur if fflush is applied on an input stream
-     that is _not_seekable_ or on an update stream that is _not_seekable_
-     and in which the most recent operation was input.  Seekability can
-     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
-  extern int fflush (FILE *gl_stream);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fflush rpl_fflush
+#  endif
+_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
+_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
+# else
+_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
 # endif
+_GL_CXXALIASWARN (fflush);
 #elif defined GNULIB_POSIXCHECK
 # undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
+/* Assume fflush is always declared.  */
+_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
+                 "use gnulib module fflush for portable POSIX compliance");
 #endif
 
+/* It is very rare that the developer ever has full control of stdin,
+   so any use of gets warrants an unconditional warning.  Assume it is
+   always declared, since it is required by C89.  */
+#undef gets
+_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+
 #if @GNULIB_FOPEN@
 # if @REPLACE_FOPEN@
-#  undef fopen
-#  define fopen rpl_fopen
-extern FILE * fopen (const char *filename, const char *mode)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fopen
+#   define fopen rpl_fopen
+#  endif
+_GL_FUNCDECL_RPL (fopen, FILE *, (const char *filename, const char *mode)
+                                 _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fopen, FILE *, (const char *filename, const char *mode));
+# else
+_GL_CXXALIAS_SYS (fopen, FILE *, (const char *filename, const char *mode));
 # endif
+_GL_CXXALIASWARN (fopen);
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
-# define fopen(f,m) \
-   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module fopen for portability"), \
-    fopen (f, m))
-#endif
-
-#if @GNULIB_FPRINTF_POSIX@
-# if @REPLACE_FPRINTF@
-#  define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)))
-       _GL_ARG_NONNULL ((1, 2));
-# endif
-#elif @GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)))
-       _GL_ARG_NONNULL ((1, 2));
-#elif defined GNULIB_POSIXCHECK
-# undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
+/* Assume fopen is always declared.  */
+_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+                 "use gnulib module fopen for portability");
+#endif
+
+#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
+# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
+     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fprintf rpl_fprintf
+#  endif
+#  define GNULIB_overrides_fprintf 1
+_GL_FUNCDECL_RPL (fprintf, int, (FILE *fp, const char *format, ...)
+                                __attribute__ ((__format__ (__printf__, 2, 3)))
+                                _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fprintf, int, (FILE *fp, const char *format, ...));
+# else
+_GL_CXXALIAS_SYS (fprintf, int, (FILE *fp, const char *format, ...));
+# endif
+_GL_CXXALIASWARN (fprintf);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_fprintf
+#  undef fprintf
+# endif
+/* Assume fprintf is always declared.  */
+_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
+                 "use gnulib module fprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_FPURGE@
+/* Discard all pending buffered I/O data on STREAM.
+   STREAM must not be wide-character oriented.
+   When discarding pending output, the file position is set back to where it
+   was before the write calls.  When discarding pending input, the file
+   position is advanced to match the end of the previously read input.
+   Return 0 if successful.  Upon error, return -1 and set errno.  */
 # if @REPLACE_FPURGE@
-#  define fpurge rpl_fpurge
-# endif
-# if @REPLACE_FPURGE@ || address@hidden@
-  /* Discard all pending buffered I/O data on STREAM.
-     STREAM must not be wide-character oriented.
-     When discarding pending output, the file position is set back to where it
-     was before the write calls.  When discarding pending input, the file
-     position is advanced to match the end of the previously read input.
-     Return 0 if successful.  Upon error, return -1 and set errno.  */
-  extern int fpurge (FILE *gl_stream) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define fpurge rpl_fpurge
+#  endif
+_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
 # endif
+_GL_CXXALIASWARN (fpurge);
 #elif defined GNULIB_POSIXCHECK
 # undef fpurge
-# define fpurge(f) \
-   (GL_LINK_WARNING ("fpurge is not always present - " \
-                     "use gnulib module fpurge for portability"), \
-    fpurge (f))
+# if HAVE_RAW_DECL_FPURGE
+_GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
+                 "use gnulib module fpurge for portability");
+# endif
 #endif
 
-#if @GNULIB_FPUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef fputc
-# define fputc rpl_fputc
-extern int fputc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
+#if @GNULIB_FPUTC@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fputc
+#   define fputc rpl_fputc
+#  endif
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fputc);
 #endif
 
-#if @GNULIB_FPUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef fputs
-# define fputs rpl_fputs
-extern int fputs (const char *string, FILE *stream) _GL_ARG_NONNULL ((1, 2));
+#if @GNULIB_FPUTS@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fputs
+#   define fputs rpl_fputs
+#  endif
+_GL_FUNCDECL_RPL (fputs, int, (const char *string, FILE *stream)
+                              _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (fputs, int, (const char *string, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fputs, int, (const char *string, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fputs);
 #endif
 
 #if @GNULIB_FREOPEN@
 # if @REPLACE_FREOPEN@
-#  undef freopen
-#  define freopen rpl_freopen
-extern FILE * freopen (const char *filename, const char *mode, FILE *stream)
-     _GL_ARG_NONNULL ((2, 3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef freopen
+#   define freopen rpl_freopen
+#  endif
+_GL_FUNCDECL_RPL (freopen, FILE *,
+                  (const char *filename, const char *mode, FILE *stream)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (freopen, FILE *,
+                  (const char *filename, const char *mode, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (freopen, FILE *,
+                  (const char *filename, const char *mode, FILE *stream));
 # endif
+_GL_CXXALIASWARN (freopen);
 #elif defined GNULIB_POSIXCHECK
 # undef freopen
-# define freopen(f,m,s) \
-   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
-                     "use gnulib module freopen for portability"), \
-    freopen (f, m, s))
-#endif
-
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence) _GL_ARG_NONNULL ((1));
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      rpl_fseek (f, o, w))
+/* Assume freopen is always declared.  */
+_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible 
- "
+                 "use gnulib module freopen for portability");
+#endif
+
+
+/* Set up the following warnings, based on which modules are in use.
+   GNU Coding Standards discourage the use of fseek, since it imposes
+   an arbitrary limitation on some 32-bit hosts.  Remember that the
+   fseek module depends on the fseeko module, so we only have three
+   cases to consider:
+
+   1. The developer is not using either module.  Issue a warning under
+   GNULIB_POSIXCHECK for both functions, to remind them that both
+   functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
+   impact on this warning.
+
+   2. The developer is using both modules.  They may be unaware of the
+   arbitrary limitations of fseek, so issue a warning under
+   GNULIB_POSIXCHECK.  On the other hand, they may be using both
+   modules intentionally, so the developer can define
+   _GL_NO_LARGE_FILES in the compilation units where the use of fseek
+   is safe, to silence the warning.
+
+   3. The developer is using the fseeko module, but not fseek.  Gnulib
+   guarantees that fseek will still work around platform bugs in that
+   case, but we presume that the developer is aware of the pitfalls of
+   fseek and was trying to avoid it, so issue a warning even when
+   GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
+   defined to silence the warning in particular compilation units.
+   In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
+   fseek gets defined as a macro, it is recommended that the developer
+   uses the fseek module, even if he is not calling the fseek function.
+
+   Most gnulib clients that perform stream operations should fall into
+   category 3.  */
+
+#if @GNULIB_FSEEK@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 2, above.  */
+#  undef fseek
+# endif
+# if @REPLACE_FSEEK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fseek
+#   define fseek rpl_fseek
+#  endif
+_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
 # else
-#  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef fseek
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseek (f, o, w))
+_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
 # endif
+_GL_CXXALIASWARN (fseek);
 #endif
 
 #if @GNULIB_FSEEKO@
+# if address@hidden@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FSEEK_WARN /* Category 3, above.  */
+#  undef fseek
+# endif
 # if @REPLACE_FSEEKO@
 /* Provide fseek, fseeko functions that are aware of a preceding
    fflush(), and which detect pipes.  */
-#  define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fseeko
+#   define fseeko rpl_fseeko
+#  endif
+_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
+                               _GL_ARG_NONNULL ((1)));
 #  if address@hidden@
+    /* In order to avoid that fseek gets defined as a macro here, the
+       developer can request the 'fseek' module.  */
 #   undef fseek
-#   define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseeko (f, o, w))
+#   define fseek rpl_fseek
+static inline int _GL_ARG_NONNULL ((1))
+rpl_fseek (FILE *fp, long offset, int whence)
+{
+  return fseeko (fp, offset, whence);
+}
 #  endif
+_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
+# else
+_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
 # endif
+_GL_CXXALIASWARN (fseeko);
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FSEEK_WARN /* Category 1, above.  */
+# undef fseek
 # undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
+# if HAVE_RAW_DECL_FSEEKO
+_GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
+                 "use gnulib module fseeko for portability");
+# endif
 #endif
 
-#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp) _GL_ARG_NONNULL ((1));
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
+#ifdef _GL_FSEEK_WARN
+# undef _GL_FSEEK_WARN
+/* Here, either fseek is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_fseek (declared above).  */
+_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use fseeko function for handling of large files");
+#endif
+
+
+/* ftell, ftello.  See the comments on fseek/fseeko.  */
+
+#if @GNULIB_FTELL@
+# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 2, above.  */
+#  undef ftell
 # endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef ftell
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftell (f))
+# if @REPLACE_FTELL@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftell
+#   define ftell rpl_ftell
+#  endif
+_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
+# else
+_GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
 # endif
+_GL_CXXALIASWARN (ftell);
 #endif
 
 #if @GNULIB_FTELLO@
+# if address@hidden@ && !defined _GL_NO_LARGE_FILES
+#  define _GL_FTELL_WARN /* Category 3, above.  */
+#  undef ftell
+# endif
 # if @REPLACE_FTELLO@
-#  define ftello rpl_ftello
-extern off_t ftello (FILE *fp) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftello
+#   define ftello rpl_ftello
+#  endif
+_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
 #  if address@hidden@
+    /* In order to avoid that ftell gets defined as a macro here, the
+       developer can request the 'ftell' module.  */
 #   undef ftell
-#   define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftello (f))
+#   define ftell rpl_ftell
+static inline long _GL_ARG_NONNULL ((1))
+rpl_ftell (FILE *f)
+{
+  return ftello (f);
+}
 #  endif
+_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
+# else
+_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
 # endif
+_GL_CXXALIASWARN (ftello);
 #elif defined GNULIB_POSIXCHECK
+# define _GL_FTELL_WARN /* Category 1, above.  */
+# undef ftell
 # undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
+# if HAVE_RAW_DECL_FTELLO
+_GL_WARN_ON_USE (ftello, "ftello is unportable - "
+                 "use gnulib module ftello for portability");
+# endif
 #endif
 
-#if @GNULIB_FWRITE@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef fwrite
-# define fwrite rpl_fwrite
-extern size_t fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
-     _GL_ARG_NONNULL ((1, 4));
+#ifdef _GL_FTELL_WARN
+# undef _GL_FTELL_WARN
+/* Here, either ftell is undefined (but C89 guarantees that it is
+   declared), or it is defined as rpl_ftell (declared above).  */
+_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
+                 "on 32-bit platforms - "
+                 "use ftello function for handling of large files");
+#endif
+
+
+#if @GNULIB_FWRITE@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fwrite
+#   define fwrite rpl_fwrite
+#  endif
+_GL_FUNCDECL_RPL (fwrite, size_t,
+                  (const void *ptr, size_t s, size_t n, FILE *stream)
+                  _GL_ARG_NONNULL ((1, 4)));
+_GL_CXXALIAS_RPL (fwrite, size_t,
+                  (const void *ptr, size_t s, size_t n, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (fwrite, size_t,
+                  (const void *ptr, size_t s, size_t n, FILE *stream));
+# endif
+_GL_CXXALIASWARN (fwrite);
 #endif
 
 #if @GNULIB_GETDELIM@
-# if address@hidden@
 /* Read input, up to (and including) the next occurrence of DELIMITER, from
    STREAM, store it in *LINEPTR (and NUL-terminate it).
    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
    bytes of space.  It is realloc'd as necessary.
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
-extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
-                         FILE *stream)
-     _GL_ARG_NONNULL ((1, 2, 4));
+# if @REPLACE_GETDELIM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getdelim
+#   define getdelim rpl_getdelim
+#  endif
+_GL_FUNCDECL_RPL (getdelim, ssize_t,
+                  (char **lineptr, size_t *linesize, int delimiter,
+                   FILE *stream)
+                  _GL_ARG_NONNULL ((1, 2, 4)));
+_GL_CXXALIAS_RPL (getdelim, ssize_t,
+                  (char **lineptr, size_t *linesize, int delimiter,
+                   FILE *stream));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (getdelim, ssize_t,
+                  (char **lineptr, size_t *linesize, int delimiter,
+                   FILE *stream)
+                  _GL_ARG_NONNULL ((1, 2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (getdelim, ssize_t,
+                  (char **lineptr, size_t *linesize, int delimiter,
+                   FILE *stream));
 # endif
+_GL_CXXALIASWARN (getdelim);
 #elif defined GNULIB_POSIXCHECK
 # undef getdelim
-# define getdelim(l, s, d, f)                                       \
-  (GL_LINK_WARNING ("getdelim is unportable - "                     \
-                    "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
+# if HAVE_RAW_DECL_GETDELIM
+_GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
+                 "use gnulib module getdelim for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLINE@
-# if @REPLACE_GETLINE@
-#  undef getline
-#  define getline rpl_getline
-# endif
-# if address@hidden@ || @REPLACE_GETLINE@
 /* Read a line, up to (and including) the next newline, from STREAM, store it
    in *LINEPTR (and NUL-terminate it).
    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
    bytes of space.  It is realloc'd as necessary.
    Return the number of bytes read and stored at *LINEPTR (not including the
    NUL terminator), or -1 on error or EOF.  */
-extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream)
-     _GL_ARG_NONNULL ((1, 2, 3));
+# if @REPLACE_GETLINE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getline
+#   define getline rpl_getline
+#  endif
+_GL_FUNCDECL_RPL (getline, ssize_t,
+                  (char **lineptr, size_t *linesize, FILE *stream)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (getline, ssize_t,
+                  (char **lineptr, size_t *linesize, FILE *stream));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (getline, ssize_t,
+                  (char **lineptr, size_t *linesize, FILE *stream)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (getline, ssize_t,
+                  (char **lineptr, size_t *linesize, FILE *stream));
 # endif
+_GL_CXXALIASWARN (getline);
 #elif defined GNULIB_POSIXCHECK
 # undef getline
-# define getline(l, s, f)                                               \
-  (GL_LINK_WARNING ("getline is unportable - "                          \
-                    "use gnulib module getline for portability"),       \
-   getline (l, s, f))
+# if HAVE_RAW_DECL_GETLINE
+_GL_WARN_ON_USE (getline, "getline is unportable - "
+                 "use gnulib module getline for portability");
+# endif
 #endif
 
-#if @GNULIB_OBSTACK_PRINTF@
+#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
+struct obstack;
+/* Grow an obstack with formatted output.  Return the number of
+   bytes added to OBS.  No trailing nul byte is added, and the
+   object should be closed with obstack_finish before use.  Upon
+   memory allocation error, call obstack_alloc_failed_handler.  Upon
+   other error, return -1.  */
 # if @REPLACE_OBSTACK_PRINTF@
-#  define obstack_printf rpl_osbtack_printf
-#  define obstack_vprintf rpl_obstack_vprintf
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define obstack_printf rpl_obstack_printf
+#  endif
+_GL_FUNCDECL_RPL (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 2, 3)))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 2, 3)))
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (obstack_printf, int,
+                  (struct obstack *obs, const char *format, ...));
 # endif
-# if @REPLACE_OBSTACK_PRINTF@ || address@hidden@
-  struct obstack;
-  /* Grow an obstack with formatted output.  Return the number of
-     bytes added to OBS.  No trailing nul byte is added, and the
-     object should be closed with obstack_finish before use.  Upon
-     memory allocation error, call obstack_alloc_failed_handler.  Upon
-     other error, return -1.  */
-  extern int obstack_printf (struct obstack *obs, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
-  extern int obstack_vprintf (struct obstack *obs, const char *format,
-                              va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
+_GL_CXXALIASWARN (obstack_printf);
+# if @REPLACE_OBSTACK_PRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define obstack_vprintf rpl_obstack_vprintf
+#  endif
+_GL_FUNCDECL_RPL (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 2, 0)))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 2, 0)))
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (obstack_vprintf, int,
+                  (struct obstack *obs, const char *format, va_list args));
 # endif
+_GL_CXXALIASWARN (obstack_vprintf);
 #endif
 
 #if @GNULIB_PERROR@
-# if @REPLACE_PERROR@
-#  define perror rpl_perror
 /* Print a message to standard error, describing the value of ERRNO,
    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
    and terminated with a newline.  */
-extern void perror (const char *string);
+# if @REPLACE_PERROR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define perror rpl_perror
+#  endif
+_GL_FUNCDECL_RPL (perror, void, (const char *string));
+_GL_CXXALIAS_RPL (perror, void, (const char *string));
+# else
+_GL_CXXALIAS_SYS (perror, void, (const char *string));
 # endif
+_GL_CXXALIASWARN (perror);
 #elif defined GNULIB_POSIXCHECK
 # undef perror
-# define perror(s) \
-    (GL_LINK_WARNING ("perror is not always POSIX compliant - " \
-                      "use gnulib module perror for portability"), \
-     perror (s))
+/* Assume perror is always declared.  */
+_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
+                 "use gnulib module perror for portability");
 #endif
 
 #if @GNULIB_POPEN@
 # if @REPLACE_POPEN@
-#  undef popen
-#  define popen rpl_popen
-extern FILE *popen (const char *cmd, const char *mode)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef popen
+#   define popen rpl_popen
+#  endif
+_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
+                                 _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
+# else
+_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
 # endif
+_GL_CXXALIASWARN (popen);
 #elif defined GNULIB_POSIXCHECK
 # undef popen
-# define popen(c,m) \
-   (GL_LINK_WARNING ("popen is buggy on some platforms - " \
-                     "use gnulib module popen or pipe for more portability"), \
-    popen (c, m))
+# if HAVE_RAW_DECL_POPEN
+_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
+                 "use gnulib module popen or pipe for more portability");
+# endif
 #endif
 
-#if @GNULIB_PRINTF_POSIX@
-# if @REPLACE_PRINTF@
+#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
+# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
+     || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 /* Don't break __attribute__((format(printf,M,N))).  */
-#  define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
+#   define printf __printf__
+#  endif
+#  define GNULIB_overrides_printf 1
+_GL_FUNCDECL_RPL_1 (__printf__, int,
+                    (const char *format, ...)
+                    __attribute__ ((__format__ (__printf__, 1, 2)))
+                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
+# else
+_GL_CXXALIAS_SYS (printf, int, (const char *format, ...));
 # endif
-#elif @GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2))) _GL_ARG_NONNULL ((1));
-#elif defined GNULIB_POSIXCHECK
-# undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
+_GL_CXXALIASWARN (printf);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_printf
+#  undef printf
+# endif
+/* Assume printf is always declared.  */
+_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
+                 "use gnulib module printf-posix for portable "
+                 "POSIX compliance");
 #endif
 
-#if @GNULIB_PUTC@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef putc
-# define putc rpl_fputc
-extern int putc (int c, FILE *stream) _GL_ARG_NONNULL ((2));
+#if @GNULIB_PUTC@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putc
+#   define putc rpl_fputc
+#  endif
+_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
+# else
+_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
+# endif
+_GL_CXXALIASWARN (putc);
 #endif
 
-#if @GNULIB_PUTCHAR@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef putchar
-# define putchar rpl_putchar
-extern int putchar (int c);
+#if @GNULIB_PUTCHAR@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putchar
+#   define putchar rpl_putchar
+#  endif
+_GL_FUNCDECL_RPL (putchar, int, (int c));
+_GL_CXXALIAS_RPL (putchar, int, (int c));
+# else
+_GL_CXXALIAS_SYS (putchar, int, (int c));
+# endif
+_GL_CXXALIASWARN (putchar);
 #endif
 
-#if @GNULIB_PUTS@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
-# undef puts
-# define puts rpl_puts
-extern int puts (const char *string) _GL_ARG_NONNULL ((1));
+#if @GNULIB_PUTS@
+# if @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef puts
+#   define puts rpl_puts
+#  endif
+_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (puts, int, (const char *string));
+# else
+_GL_CXXALIAS_SYS (puts, int, (const char *string));
+# endif
+_GL_CXXALIASWARN (puts);
 #endif
 
 #if @GNULIB_REMOVE@
 # if @REPLACE_REMOVE@
-#  undef remove
-#  define remove rpl_remove
-extern int remove (const char *name) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef remove
+#   define remove rpl_remove
+#  endif
+_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (remove, int, (const char *name));
+# else
+_GL_CXXALIAS_SYS (remove, int, (const char *name));
 # endif
+_GL_CXXALIASWARN (remove);
 #elif defined GNULIB_POSIXCHECK
 # undef remove
-# define remove(n)                                         \
-   (GL_LINK_WARNING ("remove cannot handle directories on some platforms - " \
-                     "use gnulib module remove for more portability"), \
-    remove (n))
+/* Assume remove is always declared.  */
+_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - 
"
+                 "use gnulib module remove for more portability");
 #endif
 
 #if @GNULIB_RENAME@
 # if @REPLACE_RENAME@
-#  undef rename
-#  define rename rpl_rename
-extern int rename (const char *old_filename, const char *new_filename)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef rename
+#   define rename rpl_rename
+#  endif
+_GL_FUNCDECL_RPL (rename, int,
+                  (const char *old_filename, const char *new_filename)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (rename, int,
+                  (const char *old_filename, const char *new_filename));
+# else
+_GL_CXXALIAS_SYS (rename, int,
+                  (const char *old_filename, const char *new_filename));
 # endif
+_GL_CXXALIASWARN (rename);
 #elif defined GNULIB_POSIXCHECK
 # undef rename
-# define rename(o,n)                                       \
-   (GL_LINK_WARNING ("rename is buggy on some platforms - " \
-                     "use gnulib module rename for more portability"), \
-    rename (o, n))
+/* Assume rename is always declared.  */
+_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
+                 "use gnulib module rename for more portability");
 #endif
 
 #if @GNULIB_RENAMEAT@
 # if @REPLACE_RENAMEAT@
-#  undef renameat
-#  define renameat rpl_renameat
-# endif
-# if address@hidden@ || @REPLACE_RENAMEAT@
-extern int renameat (int fd1, char const *file1, int fd2, char const *file2)
-     _GL_ARG_NONNULL ((2, 4));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef renameat
+#   define renameat rpl_renameat
+#  endif
+_GL_FUNCDECL_RPL (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2)
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2)
+                  _GL_ARG_NONNULL ((2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (renameat, int,
+                  (int fd1, char const *file1, int fd2, char const *file2));
 # endif
+_GL_CXXALIASWARN (renameat);
 #elif defined GNULIB_POSIXCHECK
 # undef renameat
-# define renameat(d1,f1,d2,f2)             \
-    (GL_LINK_WARNING ("renameat is not portable - " \
-                      "use gnulib module renameat for portability"), \
-     renameat (d1, f1, d2, f2))
+# if HAVE_RAW_DECL_RENAMEAT
+_GL_WARN_ON_USE (renameat, "renameat is not portable - "
+                 "use gnulib module renameat for portability");
+# endif
 #endif
 
 #if @GNULIB_SNPRINTF@
 # if @REPLACE_SNPRINTF@
-#  define snprintf rpl_snprintf
-# endif
-# if @REPLACE_SNPRINTF@ || address@hidden@
-extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)))
-       _GL_ARG_NONNULL ((3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define snprintf rpl_snprintf
+#  endif
+_GL_FUNCDECL_RPL (snprintf, int,
+                  (char *str, size_t size, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 3, 4)))
+                  _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_RPL (snprintf, int,
+                  (char *str, size_t size, const char *format, ...));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (snprintf, int,
+                  (char *str, size_t size, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 3, 4)))
+                  _GL_ARG_NONNULL ((3)));
+#  endif
+_GL_CXXALIAS_SYS (snprintf, int,
+                  (char *str, size_t size, const char *format, ...));
 # endif
+_GL_CXXALIASWARN (snprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
+# if HAVE_RAW_DECL_SNPRINTF
+_GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+                 "use gnulib module snprintf for portability");
+# endif
 #endif
 
+/* Some people would argue that sprintf should be handled like gets
+   (for example, OpenBSD issues a link warning for both functions),
+   since both can cause security holes due to buffer overruns.
+   However, we believe that sprintf can be used safely, and is more
+   efficient than snprintf in those safe cases; and as proof of our
+   belief, we use sprintf in several gnulib modules.  So this header
+   intentionally avoids adding a warning to sprintf except when
+   GNULIB_POSIXCHECK is defined.  */
+
 #if @GNULIB_SPRINTF_POSIX@
 # if @REPLACE_SPRINTF@
-#  define sprintf rpl_sprintf
-extern int sprintf (char *str, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)))
-       _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define sprintf rpl_sprintf
+#  endif
+_GL_FUNCDECL_RPL (sprintf, int, (char *str, const char *format, ...)
+                                __attribute__ ((__format__ (__printf__, 2, 3)))
+                                _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (sprintf, int, (char *str, const char *format, ...));
+# else
+_GL_CXXALIAS_SYS (sprintf, int, (char *str, const char *format, ...));
 # endif
+_GL_CXXALIASWARN (sprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
+/* Assume sprintf is always declared.  */
+_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
+                 "use gnulib module sprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VASPRINTF@
+/* Write formatted output to a string dynamically allocated with malloc().
+   If the memory allocation succeeds, store the address of the string in
+   *RESULT and return the number of resulting bytes, excluding the trailing
+   NUL.  Upon memory allocation error, or some other error, return -1.  */
 # if @REPLACE_VASPRINTF@
-#  define asprintf rpl_asprintf
-#  define vasprintf rpl_vasprintf
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define asprintf rpl_asprintf
+#  endif
+_GL_FUNCDECL_RPL (asprintf, int,
+                  (char **result, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 2, 3)))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (asprintf, int,
+                  (char **result, const char *format, ...));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (asprintf, int,
+                  (char **result, const char *format, ...)
+                  __attribute__ ((__format__ (__printf__, 2, 3)))
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (asprintf, int,
+                  (char **result, const char *format, ...));
 # endif
-# if @REPLACE_VASPRINTF@ || address@hidden@
-  /* Write formatted output to a string dynamically allocated with malloc().
-     If the memory allocation succeeds, store the address of the string in
-     *RESULT and return the number of resulting bytes, excluding the trailing
-     NUL.  Upon memory allocation error, or some other error, return -1.  */
-  extern int asprintf (char **result, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3))) _GL_ARG_NONNULL ((1, 2));
-  extern int vasprintf (char **result, const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((1, 2));
+_GL_CXXALIASWARN (asprintf);
+# if @REPLACE_VASPRINTF@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vasprintf rpl_vasprintf
+#  endif
+_GL_FUNCDECL_RPL (vasprintf, int,
+                  (char **result, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 2, 0)))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vasprintf, int,
+                  (char **result, const char *format, va_list args));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (vasprintf, int,
+                  (char **result, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 2, 0)))
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (vasprintf, int,
+                  (char **result, const char *format, va_list args));
 # endif
+_GL_CXXALIASWARN (vasprintf);
 #endif
 
 #if @GNULIB_VDPRINTF@
 # if @REPLACE_VDPRINTF@
-#  define vdprintf rpl_vdprintf
-# endif
-# if @REPLACE_VDPRINTF@ || address@hidden@
-extern int vdprintf (int fd, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0))) _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vdprintf rpl_vdprintf
+#  endif
+_GL_FUNCDECL_RPL (vdprintf, int, (int fd, const char *format, va_list args)
+                                 __attribute__ ((__format__ (__printf__, 2, 
0)))
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (vdprintf, int, (int fd, const char *format, va_list args));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (vdprintf, int, (int fd, const char *format, va_list args)
+                                 __attribute__ ((__format__ (__printf__, 2, 
0)))
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (vdprintf, int, (int fd, const char *format, va_list args));
 # endif
+_GL_CXXALIASWARN (vdprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef vdprintf
-# define vdprintf(d,f,a) \
-    (GL_LINK_WARNING ("vdprintf is unportable - " \
-                      "use gnulib module vdprintf for portability"), \
-     vdprintf (d, f, a))
-#endif
-
-#if @GNULIB_VFPRINTF_POSIX@
-# if @REPLACE_VFPRINTF@
-#  define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)))
-       _GL_ARG_NONNULL ((1, 2));
-# endif
-#elif @GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)))
-       _GL_ARG_NONNULL ((1, 2));
-#elif defined GNULIB_POSIXCHECK
-# undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
-#endif
-
-#if @GNULIB_VPRINTF_POSIX@
-# if @REPLACE_VPRINTF@
-#  define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
-# endif
-#elif @GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@
-# define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0))) _GL_ARG_NONNULL ((1));
-#elif defined GNULIB_POSIXCHECK
-# undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
+# if HAVE_RAW_DECL_VDPRINTF
+_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
+                 "use gnulib module vdprintf for portability");
+# endif
+#endif
+
+#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
+# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
+     || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vfprintf rpl_vfprintf
+#  endif
+#  define GNULIB_overrides_vfprintf 1
+_GL_FUNCDECL_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args)
+                                 __attribute__ ((__format__ (__printf__, 2, 
0)))
+                                 _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vfprintf, int, (FILE *fp, const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vfprintf);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vfprintf
+#  undef vfprintf
+# endif
+/* Assume vfprintf is always declared.  */
+_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
+                 "use gnulib module vfprintf-posix for portable "
+                      "POSIX compliance");
+#endif
+
+#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
+# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
+     || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && 
@GNULIB_STDIO_H_SIGPIPE@)
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vprintf rpl_vprintf
+#  endif
+#  define GNULIB_overrides_vprintf 1
+_GL_FUNCDECL_RPL (vprintf, int, (const char *format, va_list args)
+                                __attribute__ ((__format__ (__printf__, 1, 0)))
+                                _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vprintf, int, (const char *format, va_list args));
+# endif
+_GL_CXXALIASWARN (vprintf);
+#endif
+#if address@hidden@ && defined GNULIB_POSIXCHECK
+# if !GNULIB_overrides_vprintf
+#  undef vprintf
+# endif
+/* Assume vprintf is always declared.  */
+_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
+                 "use gnulib module vprintf-posix for portable "
+                 "POSIX compliance");
 #endif
 
 #if @GNULIB_VSNPRINTF@
 # if @REPLACE_VSNPRINTF@
-#  define vsnprintf rpl_vsnprintf
-# endif
-# if @REPLACE_VSNPRINTF@ || address@hidden@
-extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)))
-       _GL_ARG_NONNULL ((3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vsnprintf rpl_vsnprintf
+#  endif
+_GL_FUNCDECL_RPL (vsnprintf, int,
+                  (char *str, size_t size, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 3, 0)))
+                  _GL_ARG_NONNULL ((3)));
+_GL_CXXALIAS_RPL (vsnprintf, int,
+                  (char *str, size_t size, const char *format, va_list args));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (vsnprintf, int,
+                  (char *str, size_t size, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 3, 0)))
+                  _GL_ARG_NONNULL ((3)));
+#  endif
+_GL_CXXALIAS_SYS (vsnprintf, int,
+                  (char *str, size_t size, const char *format, va_list args));
 # endif
+_GL_CXXALIASWARN (vsnprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
+# if HAVE_RAW_DECL_VSNPRINTF
+_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
+                 "use gnulib module vsnprintf for portability");
+# endif
 #endif
 
 #if @GNULIB_VSPRINTF_POSIX@
 # if @REPLACE_VSPRINTF@
-#  define vsprintf rpl_vsprintf
-extern int vsprintf (char *str, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)))
-       _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define vsprintf rpl_vsprintf
+#  endif
+_GL_FUNCDECL_RPL (vsprintf, int,
+                  (char *str, const char *format, va_list args)
+                  __attribute__ ((__format__ (__printf__, 2, 0)))
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (vsprintf, int,
+                  (char *str, const char *format, va_list args));
+# else
+_GL_CXXALIAS_SYS (vsprintf, int,
+                  (char *str, const char *format, va_list args));
 # endif
+_GL_CXXALIASWARN (vsprintf);
 #elif defined GNULIB_POSIXCHECK
 # undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
+/* Assume vsprintf is always declared.  */
+_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
+                 "use gnulib module vsprintf-posix for portable "
+                      "POSIX compliance");
 #endif
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif /* _GL_STDIO_H */
 #endif /* _GL_STDIO_H */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index f566ab9..00415e0 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -39,7 +39,7 @@
 #include <stddef.h>
 
 /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
-#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
+#if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
 # include <sys/loadavg.h>
 #endif
 
@@ -49,7 +49,8 @@
 # include <random.h>
 #endif
 
-#if @GNULIB_RANDOM_R@ || address@hidden@
+#if address@hidden@ || (@GNULIB_RANDOM_R@ && address@hidden@) \
+    || defined GNULIB_POSIXCHECK
 # include <stdint.h>
 #endif
 
@@ -66,10 +67,19 @@ struct random_data
 };
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! 
defined __GLIBC__
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
+/* But avoid namespace pollution on glibc systems.  */
+# include <unistd.h>
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
 #ifndef EXIT_SUCCESS
@@ -85,67 +95,82 @@ struct random_data
 #endif
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #if @GNULIB_ATOLL@
-# if address@hidden@
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
-extern long long atoll (const char *string) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL 
((1)));
 # endif
+_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
+_GL_CXXALIASWARN (atoll);
 #elif defined GNULIB_POSIXCHECK
 # undef atoll
-# define atoll(s) \
-    (GL_LINK_WARNING ("atoll is unportable - " \
-                      "use gnulib module atoll for portability"), \
-     atoll (s))
+# if HAVE_RAW_DECL_ATOLL
+_GL_WARN_ON_USE (atoll, "atoll is unportable - "
+                 "use gnulib module atoll for portability");
+# endif
 #endif
 
 #if @GNULIB_CALLOC_POSIX@
 # if address@hidden@
-#  undef calloc
-#  define calloc rpl_calloc
-extern void * calloc (size_t nmemb, size_t size);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef calloc
+#   define calloc rpl_calloc
+#  endif
+_GL_FUNCDECL_RPL (calloc, void *, (size_t nmemb, size_t size));
+_GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
+# else
+_GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
 # endif
+_GL_CXXALIASWARN (calloc);
 #elif defined GNULIB_POSIXCHECK
 # undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
+/* Assume calloc is always declared.  */
+_GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
+                 "use gnulib module calloc-posix for portability");
 #endif
 
 #if @GNULIB_CANONICALIZE_FILE_NAME@
 # if @REPLACE_CANONICALIZE_FILE_NAME@
-#  define canonicalize_file_name rpl_canonicalize_file_name
-# endif
-# if address@hidden@ || @REPLACE_CANONICALIZE_FILE_NAME@
-extern char *canonicalize_file_name (const char *name) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define canonicalize_file_name rpl_canonicalize_file_name
+#  endif
+_GL_FUNCDECL_RPL (canonicalize_file_name, char *, (const char *name)
+                                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (canonicalize_file_name, char *, (const char *name)
+                                                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
 # endif
+_GL_CXXALIASWARN (canonicalize_file_name);
 #elif defined GNULIB_POSIXCHECK
 # undef canonicalize_file_name
-# define canonicalize_file_name(n)                        \
-    (GL_LINK_WARNING ("canonicalize_file_name is unportable - " \
-                      "use gnulib module canonicalize-lgpl for portability"), \
-     canonicalize_file_name (n))
+# if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
+_GL_WARN_ON_USE (canonicalize_file_name, "canonicalize_file_name is unportable 
- "
+                 "use gnulib module canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_GETLOADAVG@
-# if address@hidden@
 /* Store max(NELEM,3) load average numbers in LOADAVG[].
    The three numbers are the load average of the last 1 minute, the last 5
    minutes, and the last 15 minutes, respectively.
    LOADAVG is an array of NELEM numbers.  */
-extern int getloadavg (double loadavg[], int nelem) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
+                                   _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
+_GL_CXXALIASWARN (getloadavg);
 #elif defined GNULIB_POSIXCHECK
 # undef getloadavg
-# define getloadavg(l,n) \
-    (GL_LINK_WARNING ("getloadavg is not portable - " \
-                      "use gnulib module getloadavg for portability"), \
-     getloadavg (l, n))
+# if HAVE_RAW_DECL_GETLOADAVG
+_GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
+                 "use gnulib module getloadavg for portability");
+# endif
 #endif
 
 #if @GNULIB_GETSUBOPT@
@@ -161,50 +186,60 @@ extern int getloadavg (double loadavg[], int nelem) 
_GL_ARG_NONNULL ((1));
    For more details see the POSIX:2001 specification.
    http://www.opengroup.org/susv3xsh/getsubopt.html */
 # if address@hidden@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep)
-     _GL_ARG_NONNULL ((1, 2, 3));
+_GL_FUNCDECL_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep)
+                  _GL_ARG_NONNULL ((1, 2, 3)));
 # endif
+_GL_CXXALIAS_SYS (getsubopt, int,
+                  (char **optionp, char *const *tokens, char **valuep));
+_GL_CXXALIASWARN (getsubopt);
 #elif defined GNULIB_POSIXCHECK
 # undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
+# if HAVE_RAW_DECL_GETSUBOPT
+_GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
+                 "use gnulib module getsubopt for portability");
+# endif
 #endif
 
 #if @GNULIB_MALLOC_POSIX@
 # if address@hidden@
-#  undef malloc
-#  define malloc rpl_malloc
-extern void * malloc (size_t size);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef malloc
+#   define malloc rpl_malloc
+#  endif
+_GL_FUNCDECL_RPL (malloc, void *, (size_t size));
+_GL_CXXALIAS_RPL (malloc, void *, (size_t size));
+# else
+_GL_CXXALIAS_SYS (malloc, void *, (size_t size));
 # endif
+_GL_CXXALIASWARN (malloc);
 #elif defined GNULIB_POSIXCHECK
 # undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
+/* Assume malloc is always declared.  */
+_GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
+                 "use gnulib module malloc-posix for portability");
 #endif
 
 #if @GNULIB_MKDTEMP@
-# if address@hidden@
 /* Create a unique temporary directory from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the directory name unique.
    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
    The directory is created mode 700.  */
-extern char * mkdtemp (char * /*template*/) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL 
((1)));
 # endif
+_GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
+_GL_CXXALIASWARN (mkdtemp);
 #elif defined GNULIB_POSIXCHECK
 # undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
+# if HAVE_RAW_DECL_MKDTEMP
+_GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
+                 "use gnulib module mkdtemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMP@
-# if address@hidden@
 /* Create a unique temporary file from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the file name unique.
@@ -217,18 +252,21 @@ extern char * mkdtemp (char * /*template*/) 
_GL_ARG_NONNULL ((1));
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemp (char * /*template*/, int /*flags*/) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
+                                 _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
+_GL_CXXALIASWARN (mkostemp);
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemp
-# define mkostemp(t,f) \
-    (GL_LINK_WARNING ("mkostemp is unportable - " \
-                      "use gnulib module mkostemp for portability"), \
-     mkostemp (t, f))
+# if HAVE_RAW_DECL_MKOSTEMP
+_GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
+                 "use gnulib module mkostemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKOSTEMPS@
-# if address@hidden@
 /* Create a unique temporary file from TEMPLATE.
    The last six characters of TEMPLATE before a suffix of length
    SUFFIXLEN must be "XXXXXX";
@@ -242,19 +280,23 @@ extern int mkostemp (char * /*template*/, int /*flags*/) 
_GL_ARG_NONNULL ((1));
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkostemps (char * /*template*/, int /*suffixlen*/, int /*flags*/)
-     _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/)
+                  _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (mkostemps, int,
+                  (char * /*template*/, int /*suffixlen*/, int /*flags*/));
+_GL_CXXALIASWARN (mkostemps);
 #elif defined GNULIB_POSIXCHECK
 # undef mkostemps
-# define mkostemps(t,s,f)                          \
-    (GL_LINK_WARNING ("mkostemps is unportable - " \
-                      "use gnulib module mkostemps for portability"), \
-     mkostemps (t, s, f))
+# if HAVE_RAW_DECL_MKOSTEMPS
+_GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
+                 "use gnulib module mkostemps for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMP@
-# if @REPLACE_MKSTEMP@
 /* Create a unique temporary file from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the file name unique.
@@ -264,22 +306,25 @@ extern int mkostemps (char * /*template*/, int 
/*suffixlen*/, int /*flags*/)
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-#  define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/) _GL_ARG_NONNULL ((1));
+# if @REPLACE_MKSTEMP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mkstemp rpl_mkstemp
+#  endif
+_GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
 # else
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-#  include <unistd.h>
+_GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
 # endif
+_GL_CXXALIASWARN (mkstemp);
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
+# if HAVE_RAW_DECL_MKSTEMP
+_GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
+                 "use gnulib module mkstemp for portability");
+# endif
 #endif
 
 #if @GNULIB_MKSTEMPS@
-# if address@hidden@
 /* Create a unique temporary file from TEMPLATE.
    The last six characters of TEMPLATE prior to a suffix of length
    SUFFIXLEN must be "XXXXXX";
@@ -290,145 +335,228 @@ extern int mkstemp (char * /*template*/) 
_GL_ARG_NONNULL ((1));
    implementation.
    Returns the open file descriptor if successful, otherwise -1 and errno
    set.  */
-extern int mkstemps (char * /*template*/, int /*suffixlen*/)
-     _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
+                                 _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
+_GL_CXXALIASWARN (mkstemps);
 #elif defined GNULIB_POSIXCHECK
 # undef mkstemps
-# define mkstemps(t,s)                             \
-    (GL_LINK_WARNING ("mkstemps is unportable - " \
-                      "use gnulib module mkstemps for portability"), \
-     mkstemps (t, s))
+# if HAVE_RAW_DECL_MKSTEMPS
+_GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
+                 "use gnulib module mkstemps for portability");
+# endif
 #endif
 
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
-#  undef putenv
-#  define putenv rpl_putenv
-extern int putenv (char *string) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef putenv
+#   define putenv rpl_putenv
+#  endif
+_GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (putenv, int, (char *string));
+# else
+_GL_CXXALIAS_SYS (putenv, int, (char *string));
 # endif
+_GL_CXXALIASWARN (putenv);
 #endif
 
+
 #if @GNULIB_RANDOM_R@
 # if address@hidden@
-
 #  ifndef RAND_MAX
 #   define RAND_MAX 2147483647
 #  endif
+# endif
+#endif
 
-int srandom_r (unsigned int seed, struct random_data *rand_state)
-     _GL_ARG_NONNULL ((2));
-int initstate_r (unsigned int seed, char *buf, size_t buf_size,
-                 struct random_data *rand_state)
-     _GL_ARG_NONNULL ((2, 4));
-int setstate_r (char *arg_state, struct random_data *rand_state)
-     _GL_ARG_NONNULL ((1, 2));
-int random_r (struct random_data *buf, int32_t *result)
-     _GL_ARG_NONNULL ((1, 2));
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
+                                 _GL_ARG_NONNULL ((1, 2)));
 # endif
+_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
+_GL_CXXALIASWARN (random_r);
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
-# define random_r(b,r)                            \
-    (GL_LINK_WARNING ("random_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     random_r (b,r))
-# undef initstate_r
-# define initstate_r(s,b,sz,r)                       \
-    (GL_LINK_WARNING ("initstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     initstate_r (s,b,sz,r))
+# if HAVE_RAW_DECL_RANDOM_R
+_GL_WARN_ON_USE (random_r, "random_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state));
+_GL_CXXALIASWARN (srandom_r);
+#elif defined GNULIB_POSIXCHECK
 # undef srandom_r
-# define srandom_r(s,r)                            \
-    (GL_LINK_WARNING ("srandom_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     srandom_r (s,r))
+# if HAVE_RAW_DECL_SRANDOM_R
+_GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2, 4)));
+# endif
+_GL_CXXALIAS_SYS (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state));
+_GL_CXXALIASWARN (initstate_r);
+#elif defined GNULIB_POSIXCHECK
+# undef initstate_r
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM_R@
+# if address@hidden@
+_GL_FUNCDECL_SYS (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((1, 2)));
+# endif
+_GL_CXXALIAS_SYS (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state));
+_GL_CXXALIASWARN (setstate_r);
+#elif defined GNULIB_POSIXCHECK
 # undef setstate_r
-# define setstate_r(a,r)                                    \
-    (GL_LINK_WARNING ("setstate_r is unportable - " \
-                      "use gnulib module random_r for portability"), \
-     setstate_r (a,r))
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
+                 "use gnulib module random_r for portability");
+# endif
 #endif
 
+
 #if @GNULIB_REALLOC_POSIX@
 # if address@hidden@
-#  undef realloc
-#  define realloc rpl_realloc
-extern void * realloc (void *ptr, size_t size);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef realloc
+#   define realloc rpl_realloc
+#  endif
+_GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size));
+_GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
+# else
+_GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
 # endif
+_GL_CXXALIASWARN (realloc);
 #elif defined GNULIB_POSIXCHECK
 # undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
+/* Assume realloc is always declared.  */
+_GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
+                 "use gnulib module realloc-posix for portability");
 #endif
 
 #if @GNULIB_REALPATH@
 # if @REPLACE_REALPATH@
-#  define realpath rpl_realpath
-# endif
-# if address@hidden@ || @REPLACE_REALPATH@
-extern char *realpath (const char *name, char *resolved) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define realpath rpl_realpath
+#  endif
+_GL_FUNCDECL_RPL (realpath, char *, (const char *name, char *resolved)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (realpath, char *, (const char *name, char *resolved));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (realpath, char *, (const char *name, char *resolved)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (realpath, char *, (const char *name, char *resolved));
 # endif
+_GL_CXXALIASWARN (realpath);
 #elif defined GNULIB_POSIXCHECK
 # undef realpath
-# define realpath(n,r)                        \
-    (GL_LINK_WARNING ("realpath is unportable - use gnulib module " \
-                      "canonicalize or canonicalize-lgpl for portability"), \
-     realpath (n, r))
+# if HAVE_RAW_DECL_REALPATH
+_GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
+                 "canonicalize or canonicalize-lgpl for portability");
+# endif
 #endif
 
 #if @GNULIB_RPMATCH@
-# if address@hidden@
 /* Test a user response to a question.
    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
-extern int rpmatch (const char *response) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
+_GL_CXXALIASWARN (rpmatch);
 #elif defined GNULIB_POSIXCHECK
 # undef rpmatch
-# define rpmatch(r) \
-    (GL_LINK_WARNING ("rpmatch is unportable - " \
-                      "use gnulib module rpmatch for portability"), \
-     rpmatch (r))
+# if HAVE_RAW_DECL_RPMATCH
+_GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
+                 "use gnulib module rpmatch for portability");
+# endif
 #endif
 
 #if @GNULIB_SETENV@
-# if @REPLACE_SETENV@
-#  undef setenv
-#  define setenv rpl_setenv
-# endif
-# if address@hidden@ || @REPLACE_SETENV@
 /* Set NAME to VALUE in the environment.
    If REPLACE is nonzero, overwrite an existing value.  */
-extern int setenv (const char *name, const char *value, int replace)
-     _GL_ARG_NONNULL ((1));
+# if @REPLACE_SETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setenv
+#   define setenv rpl_setenv
+#  endif
+_GL_FUNCDECL_RPL (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setenv, int,
+                  (const char *name, const char *value, int replace));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (setenv, int,
+                  (const char *name, const char *value, int replace)
+                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (setenv, int,
+                  (const char *name, const char *value, int replace));
 # endif
+_GL_CXXALIASWARN (setenv);
 #elif defined GNULIB_POSIXCHECK
 # undef setenv
-# define setenv(n,v,o)                                                  \
-    (GL_LINK_WARNING ("setenv is unportable - "                         \
-                      "use gnulib module setenv for portability"),      \
-     setenv (n, v, o))
+# if HAVE_RAW_DECL_SETENV
+_GL_WARN_ON_USE (setenv, "setenv is unportable - "
+                 "use gnulib module setenv for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOD@
-# if @REPLACE_STRTOD@
-#  define strtod rpl_strtod
-# endif
-# if address@hidden@ || @REPLACE_STRTOD@
  /* Parse a double from STRING, updating ENDP if appropriate.  */
-extern double strtod (const char *str, char **endp) _GL_ARG_NONNULL ((1));
+# if @REPLACE_STRTOD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtod rpl_strtod
+#  endif
+_GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (strtod, double, (const char *str, char **endp)
+                                  _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtod, double, (const char *str, char **endp));
 # endif
+_GL_CXXALIASWARN (strtod);
 #elif defined GNULIB_POSIXCHECK
 # undef strtod
-# define strtod(s, e)                           \
-    (GL_LINK_WARNING ("strtod is unportable - " \
-                      "use gnulib module strtod for portability"), \
-     strtod (s, e))
+# if HAVE_RAW_DECL_STRTOD
+_GL_WARN_ON_USE (strtod, "strtod is unportable - "
+                 "use gnulib module strtod for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOLL@
-# if address@hidden@
 /* Parse a signed integer whose textual representation starts at STRING.
    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
@@ -437,19 +565,23 @@ extern double strtod (const char *str, char **endp) 
_GL_ARG_NONNULL ((1));
    stored in *ENDPTR.
    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
    to ERANGE.  */
-extern long long strtoll (const char *string, char **endptr, int base)
-     _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (strtoll, long long,
+                  (const char *string, char **endptr, int base)
+                  _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoll, long long,
+                  (const char *string, char **endptr, int base));
+_GL_CXXALIASWARN (strtoll);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoll
-# define strtoll(s,e,b) \
-    (GL_LINK_WARNING ("strtoll is unportable - " \
-                      "use gnulib module strtoll for portability"), \
-     strtoll (s, e, b))
+# if HAVE_RAW_DECL_STRTOLL
+_GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
+                 "use gnulib module strtoll for portability");
+# endif
 #endif
 
 #if @GNULIB_STRTOULL@
-# if address@hidden@
 /* Parse an unsigned integer whose textual representation starts at STRING.
    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
@@ -458,37 +590,46 @@ extern long long strtoll (const char *string, char 
**endptr, int base)
    stored in *ENDPTR.
    Upon overflow, the return value is ULLONG_MAX, and errno is set to
    ERANGE.  */
-extern unsigned long long strtoull (const char *string, char **endptr, int 
base)
-     _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (strtoull, unsigned long long,
+                  (const char *string, char **endptr, int base)
+                  _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoull, unsigned long long,
+                  (const char *string, char **endptr, int base));
+_GL_CXXALIASWARN (strtoull);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoull
-# define strtoull(s,e,b) \
-    (GL_LINK_WARNING ("strtoull is unportable - " \
-                      "use gnulib module strtoull for portability"), \
-     strtoull (s, e, b))
+# if HAVE_RAW_DECL_STRTOULL
+_GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
+                 "use gnulib module strtoull for portability");
+# endif
 #endif
 
 #if @GNULIB_UNSETENV@
-# if @REPLACE_UNSETENV@
-#  undef unsetenv
-#  define unsetenv rpl_unsetenv
-# endif
-# if address@hidden@ || @REPLACE_UNSETENV@
 /* Remove the variable NAME from the environment.  */
-extern int unsetenv (const char *name) _GL_ARG_NONNULL ((1));
+# if @REPLACE_UNSETENV@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unsetenv
+#   define unsetenv rpl_unsetenv
+#  endif
+_GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
 # endif
+_GL_CXXALIASWARN (unsetenv);
 #elif defined GNULIB_POSIXCHECK
 # undef unsetenv
-# define unsetenv(n)                                                    \
-    (GL_LINK_WARNING ("unsetenv is unportable - "                       \
-                      "use gnulib module unsetenv for portability"),    \
-     unsetenv (n))
+# if HAVE_RAW_DECL_UNSETENV
+_GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
+                 "use gnulib module unsetenv for portability");
+# endif
 #endif
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif /* _GL_STDLIB_H */
 #endif /* _GL_STDLIB_H */
diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c
index cc4778a..2891544 100644
--- a/lib/strcasecmp.c
+++ b/lib/strcasecmp.c
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison function.
-   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/streq.h b/lib/streq.h
index 1b4b1c5..8791598 100644
--- a/lib/streq.h
+++ b/lib/streq.h
@@ -1,5 +1,5 @@
 /* Optimized string comparison.
-   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/strftime.c b/lib/strftime.c
index a5cab69..c6a9ed2 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991-1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2009 
Free Software
-   Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2010 Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C 
Library.
    Bugs can be reported to address@hidden
diff --git a/lib/strftime.h b/lib/strftime.h
index 5f984b8..92501c3 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
 /* declarations for strftime.c
 
-   Copyright (C) 2002, 2004, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2008-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/striconveh.c b/lib/striconveh.c
index adb571e..ae10f3c 100644
--- a/lib/striconveh.c
+++ b/lib/striconveh.c
@@ -1,5 +1,5 @@
 /* Character set conversion with error handling.
-   Copyright (C) 2001-2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2010 Free Software Foundation, Inc.
    Written by Bruno Haible and Simon Josefsson.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/striconveh.h b/lib/striconveh.h
index be5e500..dc92cea 100644
--- a/lib/striconveh.h
+++ b/lib/striconveh.h
@@ -1,5 +1,5 @@
 /* Character set conversion with error handling.
-   Copyright (C) 2001-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible and Simon Josefsson.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/string.in.h b/lib/string.in.h
index 7a0a9a2..ee1a03d 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -31,6 +31,11 @@
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* MirBSD defines mbslen as a macro.  */
+#if @GNULIB_MBSLEN@ && defined __MirBSD__
+# include <wchar.h>
+#endif
+
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
@@ -43,78 +48,127 @@
 #endif
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Return the first instance of C within N bytes of S, or NULL.  */
 #if @GNULIB_MEMCHR@
 # if @REPLACE_MEMCHR@
-#  define memchr rpl_memchr
-extern void *memchr (void const *__s, int __c, size_t __n)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define memchr rpl_memchr
+#  endif
+_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
+                                  __attribute__ ((__pure__))
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
+# else
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C" { const void * std::memchr (const void *, int, size_t); }
+       extern "C++" { void * std::memchr (void *, int, size_t); }  */
+_GL_CXXALIAS_SYS_CAST2 (memchr,
+                        void *, (void const *__s, int __c, size_t __n),
+                        void const *, (void const *__s, int __c, size_t __n));
+# endif
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n));
+_GL_CXXALIASWARN1 (memchr, void const *,
+                   (void const *__s, int __c, size_t __n));
+# else
+_GL_CXXALIASWARN (memchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memchr
-# define memchr(s,c,n) \
-    (GL_LINK_WARNING ("memchr has platform-specific bugs - " \
-                      "use gnulib module memchr for portability" ), \
-     memchr (s, c, n))
+/* Assume memchr is always declared.  */
+_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - "
+                 "use gnulib module memchr for portability" );
 #endif
 
 /* Return the first occurrence of NEEDLE in HAYSTACK.  */
 #if @GNULIB_MEMMEM@
 # if @REPLACE_MEMMEM@
-#  define memmem rpl_memmem
-# endif
-# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
-extern void *memmem (void const *__haystack, size_t __haystack_len,
-                     void const *__needle, size_t __needle_len)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define memmem rpl_memmem
+#  endif
+_GL_FUNCDECL_RPL (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len)
+                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
+_GL_CXXALIAS_RPL (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len));
+# else
+#  if ! @HAVE_DECL_MEMMEM@
+_GL_FUNCDECL_SYS (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len)
+                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 3)));
+#  endif
+_GL_CXXALIAS_SYS (memmem, void *,
+                  (void const *__haystack, size_t __haystack_len,
+                   void const *__needle, size_t __needle_len));
 # endif
+_GL_CXXALIASWARN (memmem);
 #elif defined GNULIB_POSIXCHECK
 # undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
-                      "use gnulib module memmem-simple for portability, " \
-                      "and module memmem for speed" ), \
-     memmem (a, al, b, bl))
+# if HAVE_RAW_DECL_MEMMEM
+_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - "
+                 "use gnulib module memmem-simple for portability, "
+                 "and module memmem for speed" );
+# endif
 #endif
 
 /* Copy N bytes of SRC to DEST, return pointer to bytes after the
    last written byte.  */
 #if @GNULIB_MEMPCPY@
 # if ! @HAVE_MEMPCPY@
-extern void *mempcpy (void *restrict __dest, void const *restrict __src,
-                      size_t __n)
-     _GL_ARG_NONNULL ((1, 2));
+_GL_FUNCDECL_SYS (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
 # endif
+_GL_CXXALIAS_SYS (mempcpy, void *,
+                  (void *restrict __dest, void const *restrict __src,
+                   size_t __n));
+_GL_CXXALIASWARN (mempcpy);
 #elif defined GNULIB_POSIXCHECK
 # undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
+# if HAVE_RAW_DECL_MEMPCPY
+_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - "
+                 "use gnulib module mempcpy for portability");
+# endif
 #endif
 
 /* Search backwards through a block for a byte (specified as an int).  */
 #if @GNULIB_MEMRCHR@
 # if ! @HAVE_DECL_MEMRCHR@
-extern void *memrchr (void const *, int, size_t)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t)
+                                   __attribute__ ((__pure__))
+                                   _GL_ARG_NONNULL ((1)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const void * std::memrchr (const void *, int, size_t); }
+       extern "C++" { void * std::memrchr (void *, int, size_t); }  */
+_GL_CXXALIAS_SYS_CAST2 (memrchr,
+                        void *, (void const *, int, size_t),
+                        void const *, (void const *, int, size_t));
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t));
+_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t));
+# else
+_GL_CXXALIASWARN (memrchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
+# if HAVE_RAW_DECL_MEMRCHR
+_GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
+                 "use gnulib module memrchr for portability");
+# endif
 #endif
 
 /* Find the first occurrence of C in S.  More efficient than
@@ -122,105 +176,163 @@ extern void *memrchr (void const *, int, size_t)
    occur within N bytes.  */
 #if @GNULIB_RAWMEMCHR@
 # if ! @HAVE_RAWMEMCHR@
-extern void *rawmemchr (void const *__s, int __c_in)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in)
+                                     __attribute__ ((__pure__))
+                                     _GL_ARG_NONNULL ((1)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const void * std::rawmemchr (const void *, int); }
+       extern "C++" { void * std::rawmemchr (void *, int); }  */
+_GL_CXXALIAS_SYS_CAST2 (rawmemchr,
+                        void *, (void const *__s, int __c_in),
+                        void const *, (void const *__s, int __c_in));
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in));
+_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in));
+# else
+_GL_CXXALIASWARN (rawmemchr);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef rawmemchr
-# define rawmemchr(a,b) \
-    (GL_LINK_WARNING ("rawmemchr is unportable - " \
-                      "use gnulib module rawmemchr for portability"), \
-     rawmemchr (a, b))
+# if HAVE_RAW_DECL_RAWMEMCHR
+_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - "
+                 "use gnulib module rawmemchr for portability");
+# endif
 #endif
 
 /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
 #if @GNULIB_STPCPY@
 # if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src)
-     _GL_ARG_NONNULL ((1, 2));
+_GL_FUNCDECL_SYS (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src)
+                  _GL_ARG_NONNULL ((1, 2)));
 # endif
+_GL_CXXALIAS_SYS (stpcpy, char *,
+                  (char *restrict __dst, char const *restrict __src));
+_GL_CXXALIASWARN (stpcpy);
 #elif defined GNULIB_POSIXCHECK
 # undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
+# if HAVE_RAW_DECL_STPCPY
+_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - "
+                 "use gnulib module stpcpy for portability");
+# endif
 #endif
 
 /* Copy no more than N bytes of SRC to DST, returning a pointer past the
    last non-NUL byte written into DST.  */
 #if @GNULIB_STPNCPY@
 # if ! @HAVE_STPNCPY@
-#  define stpncpy gnu_stpncpy
-extern char *stpncpy (char *restrict __dst, char const *restrict __src,
-                      size_t __n)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define stpncpy rpl_stpncpy
+#  endif
+_GL_FUNCDECL_RPL (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n));
+# else
+_GL_CXXALIAS_SYS (stpncpy, char *,
+                  (char *restrict __dst, char const *restrict __src,
+                   size_t __n));
 # endif
+_GL_CXXALIASWARN (stpncpy);
 #elif defined GNULIB_POSIXCHECK
 # undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
+# if HAVE_RAW_DECL_STPNCPY
+_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - "
+                 "use gnulib module stpncpy for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
+/* Assume strchr is always declared.  */
+_GL_WARN_ON_USE (strchr, "strchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbschr if you care about internationalization");
 #endif
 
 /* Find the first occurrence of C in S or the final NUL byte.  */
 #if @GNULIB_STRCHRNUL@
 # if ! @HAVE_STRCHRNUL@
-extern char *strchrnul (char const *__s, int __c_in)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in)
+                                     __attribute__ ((__pure__))
+                                     _GL_ARG_NONNULL ((1)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * std::strchrnul (const char *, int); }
+       extern "C++" { char * std::strchrnul (char *, int); }  */
+_GL_CXXALIAS_SYS_CAST2 (strchrnul,
+                        char *, (char const *__s, int __c_in),
+                        char const *, (char const *__s, int __c_in));
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in));
+_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in));
+# else
+_GL_CXXALIASWARN (strchrnul);
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
+# if HAVE_RAW_DECL_STRCHRNUL
+_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - "
+                 "use gnulib module strchrnul for portability");
+# endif
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
 #if @GNULIB_STRDUP@
 # if @REPLACE_STRDUP@
-#  undef strdup
-#  define strdup rpl_strdup
-# endif
-# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
-extern char *strdup (char const *__s) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strdup
+#   define strdup rpl_strdup
+#  endif
+_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strdup, char *, (char const *__s));
+# else
+#  if !(@HAVE_DECL_STRDUP@ || defined strdup)
+_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strdup, char *, (char const *__s));
 # endif
+_GL_CXXALIASWARN (strdup);
 #elif defined GNULIB_POSIXCHECK
 # undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
+# if HAVE_RAW_DECL_STRDUP
+_GL_WARN_ON_USE (strdup, "strdup is unportable - "
+                 "use gnulib module strdup for portability");
+# endif
 #endif
 
 /* Return a newly allocated copy of at most N bytes of STRING.  */
 #if @GNULIB_STRNDUP@
 # if @REPLACE_STRNDUP@
-#  undef strndup
-#  define strndup rpl_strndup
-# endif
-# if @REPLACE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strndup
+#   define strndup rpl_strndup
+#  endif
+_GL_FUNCDECL_RPL (strndup, char *, (char const *__string, size_t __n)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strndup, char *, (char const *__string, size_t __n));
+# else
+#  if ! @HAVE_DECL_STRNDUP@
+_GL_FUNCDECL_SYS (strndup, char *, (char const *__string, size_t __n)
+                                   _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strndup, char *, (char const *__string, size_t __n));
 # endif
+_GL_CXXALIASWARN (strndup);
 #elif defined GNULIB_POSIXCHECK
 # undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
+# if HAVE_RAW_DECL_STRNDUP
+_GL_WARN_ON_USE (strndup, "strndup is unportable - "
+                 "use gnulib module strndup for portability");
+# endif
 #endif
 
 /* Find the length (number of bytes) of STRING, but scan at most
@@ -228,15 +340,18 @@ extern char *strndup (char const *__string, size_t __n) 
_GL_ARG_NONNULL ((1));
    return MAXLEN.  */
 #if @GNULIB_STRNLEN@
 # if ! @HAVE_DECL_STRNLEN@
-extern size_t strnlen (char const *__string, size_t __maxlen)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
+                                   __attribute__ ((__pure__))
+                                   _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
+_GL_CXXALIASWARN (strnlen);
 #elif defined GNULIB_POSIXCHECK
 # undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
+# if HAVE_RAW_DECL_STRNLEN
+_GL_WARN_ON_USE (strnlen, "strnlen is unportable - "
+                 "use gnulib module strnlen for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
@@ -245,18 +360,32 @@ extern size_t strnlen (char const *__string, size_t 
__maxlen)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 # undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
+/* Assume strcspn is always declared.  */
+_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbscspn if you care about internationalization");
 #endif
 
 /* Find the first occurrence in S of any character in ACCEPT.  */
 #if @GNULIB_STRPBRK@
 # if ! @HAVE_STRPBRK@
-extern char *strpbrk (char const *__s, char const *__accept)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
+_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept)
+                                   __attribute__ ((__pure__))
+                                   _GL_ARG_NONNULL ((1, 2)));
+# endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C" { const char * strpbrk (const char *, const char *); }
+       extern "C++" { char * strpbrk (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strpbrk,
+                        char *, (char const *__s, char const *__accept),
+                        const char *, (char const *__s, char const *__accept));
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept));
+_GL_CXXALIASWARN1 (strpbrk, char const *,
+                   (char const *__s, char const *__accept));
+# else
+_GL_CXXALIASWARN (strpbrk);
 # endif
 # if defined GNULIB_POSIXCHECK
 /* strpbrk() assumes the second argument is a list of single-byte characters.
@@ -264,40 +393,36 @@ extern char *strpbrk (char const *__s, char const 
*__accept)
    locale encoding is GB18030 and one of the characters to be searched is a
    digit.  */
 #  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
+_GL_WARN_ON_USE (strpbrk, "strpbrk cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbspbrk if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
+# if HAVE_RAW_DECL_STRPBRK
+_GL_WARN_ON_USE (strpbrk, "strpbrk is unportable - "
+                 "use gnulib module strpbrk for portability");
+# endif
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strspn() assumes the second argument is a list of single-byte characters.
    Even in this simple case, it cannot work with multibyte strings.  */
 # undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
+/* Assume strspn is always declared.  */
+_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbsspn if you care about internationalization");
 #endif
 
 #if defined GNULIB_POSIXCHECK
 /* strrchr() does not work with multibyte strings if the locale encoding is
    GB18030 and the character to be searched is a digit.  */
 # undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
+/* Assume strrchr is always declared.  */
+_GL_WARN_ON_USE (strrchr, "strrchr cannot work correctly on character strings "
+                 "in some multibyte locales - "
+                 "use mbsrchr if you care about internationalization");
 #endif
 
 /* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
@@ -318,30 +443,51 @@ extern char *strpbrk (char const *__s, char const 
*__accept)
    See also strtok_r().  */
 #if @GNULIB_STRSEP@
 # if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim)
-     _GL_ARG_NONNULL ((1, 2));
+_GL_FUNCDECL_SYS (strsep, char *,
+                  (char **restrict __stringp, char const *restrict __delim)
+                  _GL_ARG_NONNULL ((1, 2)));
 # endif
+_GL_CXXALIAS_SYS (strsep, char *,
+                  (char **restrict __stringp, char const *restrict __delim));
+_GL_CXXALIASWARN (strsep);
 # if defined GNULIB_POSIXCHECK
 #  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
+_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings "
+                 "in multibyte locales - "
+                 "use mbssep if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
+# if HAVE_RAW_DECL_STRSEP
+_GL_WARN_ON_USE (strsep, "strsep is unportable - "
+                 "use gnulib module strsep for portability");
+# endif
 #endif
 
 #if @GNULIB_STRSTR@
 # if @REPLACE_STRSTR@
-#  define strstr rpl_strstr
-extern char *strstr (const char *haystack, const char *needle)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strstr rpl_strstr
+#  endif
+_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle)
+                                  __attribute__ ((__pure__))
+                                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle));
+# else
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * strstr (const char *, const char *); }
+       extern "C++" { char * strstr (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strstr,
+                        char *, (const char *haystack, const char *needle),
+                        const char *, (const char *haystack, const char 
*needle));
+# endif
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle));
+_GL_CXXALIASWARN1 (strstr, const char *,
+                   (const char *haystack, const char *needle));
+# else
+_GL_CXXALIASWARN (strstr);
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strstr() does not work with multibyte strings if the locale encoding is
@@ -349,37 +495,59 @@ extern char *strstr (const char *haystack, const char 
*needle)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
-                      "work correctly on character strings in most "    \
-                      "multibyte locales - " \
-                      "use mbsstr if you care about internationalization, " \
-                      "or use strstr if you care about speed"), \
-     strstr (a, b))
+/* Assume strstr is always declared.  */
+_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot "
+                 "work correctly on character strings in most "
+                 "multibyte locales - "
+                 "use mbsstr if you care about internationalization, "
+                 "or use strstr if you care about speed");
 #endif
 
 /* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
    comparison.  */
 #if @GNULIB_STRCASESTR@
 # if @REPLACE_STRCASESTR@
-#  define strcasestr rpl_strcasestr
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strcasestr rpl_strcasestr
+#  endif
+_GL_FUNCDECL_RPL (strcasestr, char *,
+                  (const char *haystack, const char *needle)
+                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (strcasestr, char *,
+                  (const char *haystack, const char *needle));
+# else
+#  if ! @HAVE_STRCASESTR@
+_GL_FUNCDECL_SYS (strcasestr, char *,
+                  (const char *haystack, const char *needle)
+                  __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2)));
+#  endif
+  /* On some systems, this function is defined as an overloaded function:
+       extern "C++" { const char * strcasestr (const char *, const char *); }
+       extern "C++" { char * strcasestr (char *, const char *); }  */
+_GL_CXXALIAS_SYS_CAST2 (strcasestr,
+                        char *, (const char *haystack, const char *needle),
+                        const char *, (const char *haystack, const char 
*needle));
 # endif
-# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
-extern char *strcasestr (const char *haystack, const char *needle)
-     __attribute__ ((__pure__)) _GL_ARG_NONNULL ((1, 2));
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 10 \
+     && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle));
+_GL_CXXALIASWARN1 (strcasestr, const char *,
+                   (const char *haystack, const char *needle));
+# else
+_GL_CXXALIASWARN (strcasestr);
 # endif
 #elif defined GNULIB_POSIXCHECK
 /* strcasestr() does not work with multibyte strings:
    It is a glibc extension, and glibc implements it only for unibyte
    locales.  */
 # undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " 
\
-                      "a locale independent function"), \
-     strcasestr (a, b))
+# if HAVE_RAW_DECL_STRCASESTR
+_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasestr if you care about "
+                 "internationalization, or use c-strcasestr if you want "
+                 "a locale independent function");
+# endif
 #endif
 
 /* Parse S into tokens separated by characters in DELIM.
@@ -406,30 +574,43 @@ extern char *strcasestr (const char *haystack, const char 
*needle)
    See also strsep().  */
 #if @GNULIB_STRTOK_R@
 # if @REPLACE_STRTOK_R@
-#  undef strtok_r
-#  define strtok_r rpl_strtok_r
-# elif @UNDEFINE_STRTOK_R@
-#  undef strtok_r
-# endif
-# if ! @HAVE_DECL_STRTOK_R@ || @REPLACE_STRTOK_R@
-extern char *strtok_r (char *restrict s, char const *restrict delim,
-                       char **restrict save_ptr)
-     _GL_ARG_NONNULL ((2, 3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtok_r
+#   define strtok_r rpl_strtok_r
+#  endif
+_GL_FUNCDECL_RPL (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr));
+# else
+#  if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK
+#   undef strtok_r
+#  endif
+#  if ! @HAVE_DECL_STRTOK_R@
+_GL_FUNCDECL_SYS (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (strtok_r, char *,
+                  (char *restrict s, char const *restrict delim,
+                   char **restrict save_ptr));
 # endif
+_GL_CXXALIASWARN (strtok_r);
 # if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), 
\
-      strtok_r (s, d, p))
+_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbstok_r if you care about internationalization");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
+# if HAVE_RAW_DECL_STRTOK_R
+_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
+                 "use gnulib module strtok_r for portability");
+# endif
 #endif
 
 
@@ -439,13 +620,27 @@ extern char *strtok_r (char *restrict s, char const 
*restrict delim,
 #if @GNULIB_MBSLEN@
 /* Return the number of multibyte characters in the character string STRING.
    This considers multibyte characters, unlike strlen, which counts bytes.  */
-extern size_t mbslen (const char *string) _GL_ARG_NONNULL ((1));
+# ifdef __MirBSD__  /* MirBSD defines mbslen as a macro.  Override it.  */
+#  undef mbslen
+# endif
+# if @HAVE_MBSLEN@  /* AIX, OSF/1, MirBSD define mbslen already in libc.  */
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbslen rpl_mbslen
+#  endif
+_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
+# else
+_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
+# endif
+_GL_CXXALIASWARN (mbslen);
 #endif
 
 #if @GNULIB_MBSNLEN@
 /* Return the number of multibyte characters in the character string starting
    at STRING and ending at STRING + LEN.  */
-extern size_t mbsnlen (const char *string, size_t len) _GL_ARG_NONNULL ((1));
+_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
+     _GL_ARG_NONNULL ((1));
 #endif
 
 #if @GNULIB_MBSCHR@
@@ -453,8 +648,19 @@ extern size_t mbsnlen (const char *string, size_t len) 
_GL_ARG_NONNULL ((1));
    and return a pointer to it.  Return NULL if C is not found in STRING.
    Unlike strchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
-# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c) _GL_ARG_NONNULL ((1));
+# if defined __hpux
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbschr rpl_mbschr /* avoid collision with HP-UX function */
+#  endif
+_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
+# else
+_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
+                                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
+# endif
+_GL_CXXALIASWARN (mbschr);
 #endif
 
 #if @GNULIB_MBSRCHR@
@@ -462,8 +668,19 @@ extern char * mbschr (const char *string, int c) 
_GL_ARG_NONNULL ((1));
    and return a pointer to it.  Return NULL if C is not found in STRING.
    Unlike strrchr(), this function works correctly in multibyte locales with
    encodings such as GB18030.  */
-# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c) _GL_ARG_NONNULL ((1));
+# if defined __hpux
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+#  endif
+_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
+# else
+_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
+                                   _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
+# endif
+_GL_CXXALIASWARN (mbsrchr);
 #endif
 
 #if @GNULIB_MBSSTR@
@@ -471,7 +688,7 @@ extern char * mbsrchr (const char *string, int c) 
_GL_ARG_NONNULL ((1));
    string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
    Unlike strstr(), this function works correctly in multibyte locales with
    encodings different from UTF-8.  */
-extern char * mbsstr (const char *haystack, const char *needle)
+_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -482,7 +699,7 @@ extern char * mbsstr (const char *haystack, const char 
*needle)
    Note: This function may, in multibyte locales, return 0 for strings of
    different lengths!
    Unlike strcasecmp(), this function works correctly in multibyte locales.  */
-extern int mbscasecmp (const char *s1, const char *s2)
+_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -496,7 +713,7 @@ extern int mbscasecmp (const char *s1, const char *s2)
    of different lengths!
    Unlike strncasecmp(), this function works correctly in multibyte locales.
    But beware that N is not a byte count but a character count!  */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n)
+_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -510,7 +727,7 @@ extern int mbsncasecmp (const char *s1, const char *s2, 
size_t n)
    smaller length than PREFIX!
    Unlike strncasecmp(), this function works correctly in multibyte
    locales.  */
-extern char * mbspcasecmp (const char *string, const char *prefix)
+_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -520,7 +737,7 @@ extern char * mbspcasecmp (const char *string, const char 
*prefix)
    Note: This function may, in multibyte locales, return success even if
    strlen (haystack) < strlen (needle) !
    Unlike strcasestr(), this function works correctly in multibyte locales.  */
-extern char * mbscasestr (const char *haystack, const char *needle)
+_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -530,7 +747,7 @@ extern char * mbscasestr (const char *haystack, const char 
*needle)
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strcspn(), this function works correctly in multibyte locales.  */
-extern size_t mbscspn (const char *string, const char *accept)
+_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -539,9 +756,19 @@ extern size_t mbscspn (const char *string, const char 
*accept)
    in the character string ACCEPT.  Return the pointer to it, or NULL if none
    exists.
    Unlike strpbrk(), this function works correctly in multibyte locales.  */
-# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept)
-     _GL_ARG_NONNULL ((1, 2));
+# if defined __hpux
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
+#  endif
+_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
+# else
+_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
+                                   _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
+# endif
+_GL_CXXALIASWARN (mbspbrk);
 #endif
 
 #if @GNULIB_MBSSPN@
@@ -550,7 +777,7 @@ extern char * mbspbrk (const char *string, const char 
*accept)
    beginning of the string to this occurrence, or to the end of the string
    if none exists.
    Unlike strspn(), this function works correctly in multibyte locales.  */
-extern size_t mbsspn (const char *string, const char *reject)
+_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -569,7 +796,7 @@ extern size_t mbsspn (const char *string, const char 
*reject)
    Caveat: The identity of the delimiting character is lost.
 
    See also mbstok_r().  */
-extern char * mbssep (char **stringp, const char *delim)
+_GL_EXTERN_C char * mbssep (char **stringp, const char *delim)
      _GL_ARG_NONNULL ((1, 2));
 #endif
 
@@ -590,56 +817,69 @@ extern char * mbssep (char **stringp, const char *delim)
    Caveat: The identity of the delimiting character is lost.
 
    See also mbssep().  */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr)
+_GL_EXTERN_C char * mbstok_r (char *string, const char *delim, char **save_ptr)
      _GL_ARG_NONNULL ((2, 3));
 #endif
 
 /* Map any int, typically from errno, into an error message.  */
 #if @GNULIB_STRERROR@
 # if @REPLACE_STRERROR@
-#  undef strerror
-#  define strerror rpl_strerror
-extern char *strerror (int);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strerror
+#   define strerror rpl_strerror
+#  endif
+_GL_FUNCDECL_RPL (strerror, char *, (int));
+_GL_CXXALIAS_RPL (strerror, char *, (int));
+# else
+_GL_CXXALIAS_SYS (strerror, char *, (int));
 # endif
+_GL_CXXALIASWARN (strerror);
 #elif defined GNULIB_POSIXCHECK
 # undef strerror
-# define strerror(e) \
-    (GL_LINK_WARNING ("strerror is unportable - " \
-                      "use gnulib module strerror to guarantee non-NULL 
result"), \
-     strerror (e))
+/* Assume strerror is always declared.  */
+_GL_WARN_ON_USE (strerror, "strerror is unportable - "
+                 "use gnulib module strerror to guarantee non-NULL result");
 #endif
 
 #if @GNULIB_STRSIGNAL@
 # if @REPLACE_STRSIGNAL@
-#  define strsignal rpl_strsignal
-# endif
-# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
-extern char *strsignal (int __sig);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strsignal rpl_strsignal
+#  endif
+_GL_FUNCDECL_RPL (strsignal, char *, (int __sig));
+_GL_CXXALIAS_RPL (strsignal, char *, (int __sig));
+# else
+#  if ! @HAVE_DECL_STRSIGNAL@
+_GL_FUNCDECL_SYS (strsignal, char *, (int __sig));
+#  endif
+/* Need to cast, because on Cygwin 1.5.x systems, the return type is
+   'const char *'.  */
+_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig));
 # endif
+_GL_CXXALIASWARN (strsignal);
 #elif defined GNULIB_POSIXCHECK
 # undef strsignal
-# define strsignal(a) \
-    (GL_LINK_WARNING ("strsignal is unportable - " \
-                      "use gnulib module strsignal for portability"), \
-     strsignal (a))
+# if HAVE_RAW_DECL_STRSIGNAL
+_GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
+                 "use gnulib module strsignal for portability");
+# endif
 #endif
 
 #if @GNULIB_STRVERSCMP@
 # if address@hidden@
-extern int strverscmp (const char *, const char *) _GL_ARG_NONNULL ((1, 2));
+_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
+                                   _GL_ARG_NONNULL ((1, 2)));
 # endif
+_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
+_GL_CXXALIASWARN (strverscmp);
 #elif defined GNULIB_POSIXCHECK
 # undef strverscmp
-# define strverscmp(a, b) \
-    (GL_LINK_WARNING ("strverscmp is unportable - " \
-                      "use gnulib module strverscmp for portability"), \
-     strverscmp (a, b))
+# if HAVE_RAW_DECL_STRVERSCMP
+_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - "
+                 "use gnulib module strverscmp for portability");
+# endif
 #endif
 
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _GL_STRING_H */
 #endif /* _GL_STRING_H */
diff --git a/lib/strings.in.h b/lib/strings.in.h
index 8e2b95c..b2cf2cf 100644
--- a/lib/strings.in.h
+++ b/lib/strings.in.h
@@ -1,6 +1,6 @@
 /* A substitute <strings.h>.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -29,10 +29,9 @@
 #define _GL_STRINGS_H
 
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -52,14 +51,14 @@ extern int strcasecmp (char const *s1, char const *s2)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.   */
 # undef strcasecmp
-# define strcasecmp(a,b) \
-    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " 
\
-                      "in multibyte locales - " \
-                      "use mbscasecmp if you care about " \
-                      "internationalization, or use c_strcasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strcasecmp (a, b))
+# if HAVE_RAW_DECL_STRCASECMP
+_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbscasecmp if you care about "
+                 "internationalization, or use c_strcasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
@@ -75,14 +74,14 @@ extern int strncasecmp (char const *s1, char const *s2, 
size_t n)
    POSIX says that it operates on "strings", and "string" in POSIX is defined
    as a sequence of bytes, not of characters.  */
 # undef strncasecmp
-# define strncasecmp(a,b,n) \
-    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - " \
-                      "use mbsncasecmp or mbspcasecmp if you care about " \
-                      "internationalization, or use c_strncasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strncasecmp (a, b, n))
+# if HAVE_RAW_DECL_STRNCASECMP
+_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
+                 "strings in multibyte locales - "
+                 "use mbsncasecmp or mbspcasecmp if you care about "
+                 "internationalization, or use c_strncasecmp , "
+                 "gnulib module c-strcase) if you want a locale "
+                 "independent function");
+# endif
 #endif
 
 
diff --git a/lib/strncasecmp.c b/lib/strncasecmp.c
index 8a82d93..d525deb 100644
--- a/lib/strncasecmp.c
+++ b/lib/strncasecmp.c
@@ -1,5 +1,5 @@
 /* strncasecmp.c -- case insensitive string comparator
-   Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2007, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index 0973edc..bdf664d 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/file.h.
 
-   Copyright (C) 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -31,28 +31,30 @@
 #ifndef _GL_SYS_FILE_H
 #define _GL_SYS_FILE_H
 
+#ifndef LOCK_SH
+/* Operations for the 'flock' call (same as Linux kernel constants).  */
+# define LOCK_SH 1       /* Shared lock.  */
+# define LOCK_EX 2       /* Exclusive lock.  */
+# define LOCK_UN 8       /* Unlock.  */
+
+/* Can be OR'd in to one of the above.  */
+# define LOCK_NB 4       /* Don't block when locking.  */
+#endif
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #if @GNULIB_FLOCK@
 /* Apply or remove advisory locks on an open file.
    Return 0 if successful, otherwise -1 and errno set.  */
 # if address@hidden@
 extern int flock (int fd, int operation);
-
-/* Operations for the 'flock' call (same as Linux kernel constants).  */
-#define LOCK_SH 1       /* Shared lock.  */
-#define LOCK_EX 2       /* Exclusive lock.  */
-#define LOCK_UN 8       /* Unlock.  */
-
-/* Can be OR'd in to one of the above.  */
-#define LOCK_NB 4       /* Don't block when locking.  */
-
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef flock
-# define flock(fd,op)                          \
-    (GL_LINK_WARNING ("flock is unportable - " \
-                      "use gnulib module flock for portability"), \
-     flock ((fd), (op)))
+# if HAVE_RAW_DECL_FLOCK
+_GL_WARN_ON_USE (flock, "flock is unportable - "
+                 "use gnulib module flock for portability");
+# endif
 #endif
 
 
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 1d46175..f54d757 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -1,6 +1,6 @@
 /* Provide a sys/socket header file for systems lacking it (read: MinGW)
    and for systems where it is incomplete.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson.
 
    This program is free software; you can redistribute it and/or modify
@@ -23,10 +23,24 @@
    It is intended to provide definitions and prototypes needed by an
    application.  */
 
+#if defined _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+/* Special invocation convention:
+   - On Cygwin 1.5.x we have a sequence of nested includes
+     <sys/socket.h> -> <cygwin/socket.h> -> <asm/socket.h> -> <cygwin/if.h>,
+     and the latter includes <sys/socket.h>.  In this situation, the functions
+     are not yet declared, therefore we cannot provide the C++ aliases.  */
+
address@hidden@ @NEXT_SYS_SOCKET_H@
+
+#else
+/* Normal invocation convention.  */
+
 #ifndef _GL_SYS_SOCKET_H
 
 #if @HAVE_SYS_SOCKET_H@
 
+# define _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+
 # if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 # endif
@@ -38,13 +52,19 @@
 /* The include_next requires a split double-inclusion guard.  */
 # @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
 
+# undef _GL_ALREADY_INCLUDING_SYS_SOCKET_H
+
 #endif
 
 #ifndef _GL_SYS_SOCKET_H
 #define _GL_SYS_SOCKET_H
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 #if address@hidden@
 typedef unsigned short  sa_family_t;
 #endif
@@ -126,8 +146,6 @@ struct sockaddr_storage
 #  define SHUT_RDWR SD_BOTH
 # endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 # if @HAVE_WINSOCK2_H@
 /* Include headers needed by the emulation code.  */
 #  include <sys/types.h>
@@ -137,11 +155,9 @@ typedef int socklen_t;
 
 # endif
 
-# ifdef __cplusplus
-extern "C" {
-# endif
+#endif
 
-# if @HAVE_WINSOCK2_H@
+#if @HAVE_WINSOCK2_H@
 
 /* Re-define FD_ISSET to avoid a WSA call while we are not using
    network sockets.  */
@@ -159,280 +175,404 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
   return 0;
 }
 
-#  undef FD_ISSET
-#  define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
+# undef FD_ISSET
+# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
 
-# endif
+#endif
 
 /* Wrap everything else to use libc file descriptors for sockets.  */
 
-# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-#  undef close
-#  define close close_used_without_including_unistd_h
-# endif
+#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
+# undef close
+# define close close_used_without_including_unistd_h
+#endif
 
-# if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
-#  undef gethostname
-#  define gethostname gethostname_used_without_including_unistd_h
-# endif
+#if @HAVE_WINSOCK2_H@ && !defined _GL_UNISTD_H
+# undef gethostname
+# define gethostname gethostname_used_without_including_unistd_h
+#endif
 
-# if @GNULIB_SOCKET@
-#  if @HAVE_WINSOCK2_H@
+#if @GNULIB_SOCKET@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef socket
-#   define socket               rpl_socket
-extern int rpl_socket (int, int, int protocol);
+#   define socket rpl_socket
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef socket
-#  define socket socket_used_without_requesting_gnulib_module_socket
-# elif defined GNULIB_POSIXCHECK
-#  undef socket
-#  define socket(d,t,p) \
-     (GL_LINK_WARNING ("socket is not always POSIX compliant - " \
-                       "use gnulib module socket for portability"), \
-      socket (d, t, p))
-# endif
-
-# if @GNULIB_CONNECT@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (socket, int, (int domain, int type, int protocol));
+_GL_CXXALIAS_RPL (socket, int, (int domain, int type, int protocol));
+# else
+_GL_CXXALIAS_SYS (socket, int, (int domain, int type, int protocol));
+# endif
+_GL_CXXALIASWARN (socket);
+#elif @HAVE_WINSOCK2_H@
+# undef socket
+# define socket socket_used_without_requesting_gnulib_module_socket
+#elif defined GNULIB_POSIXCHECK
+# undef socket
+# if HAVE_RAW_DECL_SOCKET
+_GL_WARN_ON_USE (socket, "socket is not always POSIX compliant - "
+                 "use gnulib module socket for portability");
+# endif
+#endif
+
+#if @GNULIB_CONNECT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef connect
-#   define connect              rpl_connect
-extern int rpl_connect (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
+#   define connect rpl_connect
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef connect
-#  define connect socket_used_without_requesting_gnulib_module_connect
-# elif defined GNULIB_POSIXCHECK
-#  undef connect
-#  define connect(s,a,l) \
-     (GL_LINK_WARNING ("connect is not always POSIX compliant - " \
-                       "use gnulib module connect for portability"), \
-      connect (s, a, l))
-# endif
-
-# if @GNULIB_ACCEPT@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (connect, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (connect, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# else
+_GL_CXXALIAS_SYS (connect, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# endif
+_GL_CXXALIASWARN (connect);
+#elif @HAVE_WINSOCK2_H@
+# undef connect
+# define connect socket_used_without_requesting_gnulib_module_connect
+#elif defined GNULIB_POSIXCHECK
+# undef connect
+# if HAVE_RAW_DECL_CONNECT
+_GL_WARN_ON_USE (connect, "connect is not always POSIX compliant - "
+                 "use gnulib module connect for portability");
+# endif
+#endif
+
+#if @GNULIB_ACCEPT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef accept
-#   define accept               rpl_accept
-extern int rpl_accept (int, struct sockaddr *, int *);
+#   define accept rpl_accept
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef accept
-#  define accept accept_used_without_requesting_gnulib_module_accept
-# elif defined GNULIB_POSIXCHECK
-#  undef accept
-#  define accept(s,a,l) \
-     (GL_LINK_WARNING ("accept is not always POSIX compliant - " \
-                       "use gnulib module accept for portability"), \
-      accept (s, a, l))
-# endif
-
-# if @GNULIB_BIND@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (accept, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
+_GL_CXXALIAS_RPL (accept, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                                                       void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (accept, int,
+                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# endif
+_GL_CXXALIASWARN (accept);
+#elif @HAVE_WINSOCK2_H@
+# undef accept
+# define accept accept_used_without_requesting_gnulib_module_accept
+#elif defined GNULIB_POSIXCHECK
+# undef accept
+# if HAVE_RAW_DECL_ACCEPT
+_GL_WARN_ON_USE (accept, "accept is not always POSIX compliant - "
+                 "use gnulib module accept for portability");
+# endif
+#endif
+
+#if @GNULIB_BIND@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef bind
-#   define bind                 rpl_bind
-extern int rpl_bind (int, struct sockaddr *, int) _GL_ARG_NONNULL ((2));
+#   define bind rpl_bind
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef bind
-#  define bind bind_used_without_requesting_gnulib_module_bind
-# elif defined GNULIB_POSIXCHECK
-#  undef bind
-#  define bind(s,a,l) \
-     (GL_LINK_WARNING ("bind is not always POSIX compliant - " \
-                       "use gnulib module bind for portability"), \
-      bind (s, a, l))
-# endif
-
-# if @GNULIB_GETPEERNAME@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (bind, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (bind, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# else
+_GL_CXXALIAS_SYS (bind, int,
+                  (int fd, const struct sockaddr *addr, socklen_t addrlen));
+# endif
+_GL_CXXALIASWARN (bind);
+#elif @HAVE_WINSOCK2_H@
+# undef bind
+# define bind bind_used_without_requesting_gnulib_module_bind
+#elif defined GNULIB_POSIXCHECK
+# undef bind
+# if HAVE_RAW_DECL_BIND
+_GL_WARN_ON_USE (bind, "bind is not always POSIX compliant - "
+                 "use gnulib module bind for portability");
+# endif
+#endif
+
+#if @GNULIB_GETPEERNAME@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef getpeername
-#   define getpeername          rpl_getpeername
-extern int rpl_getpeername (int, struct sockaddr *, int *)
-     _GL_ARG_NONNULL ((2, 3));
+#   define getpeername rpl_getpeername
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef getpeername
-#  define getpeername 
getpeername_used_without_requesting_gnulib_module_getpeername
-# elif defined GNULIB_POSIXCHECK
-#  undef getpeername
-#  define getpeername(s,a,l) \
-     (GL_LINK_WARNING ("getpeername is not always POSIX compliant - " \
-                       "use gnulib module getpeername for portability"), \
-      getpeername (s, a, l))
-# endif
-
-# if @GNULIB_GETSOCKNAME@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (getpeername, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (getpeername, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                                                       void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (getpeername, int,
+                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# endif
+_GL_CXXALIASWARN (getpeername);
+#elif @HAVE_WINSOCK2_H@
+# undef getpeername
+# define getpeername 
getpeername_used_without_requesting_gnulib_module_getpeername
+#elif defined GNULIB_POSIXCHECK
+# undef getpeername
+# if HAVE_RAW_DECL_GETPEERNAME
+_GL_WARN_ON_USE (getpeername, "getpeername is not always POSIX compliant - "
+                 "use gnulib module getpeername for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSOCKNAME@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef getsockname
-#   define getsockname          rpl_getsockname
-extern int rpl_getsockname (int, struct sockaddr *, int *)
-     _GL_ARG_NONNULL ((2, 3));
+#   define getsockname rpl_getsockname
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef getsockname
-#  define getsockname 
getsockname_used_without_requesting_gnulib_module_getsockname
-# elif defined GNULIB_POSIXCHECK
-#  undef getsockname
-#  define getsockname(s,a,l) \
-     (GL_LINK_WARNING ("getsockname is not always POSIX compliant - " \
-                       "use gnulib module getsockname for portability"), \
-      getsockname (s, a, l))
-# endif
-
-# if @GNULIB_GETSOCKOPT@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (getsockname, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (getsockname, int,
+                  (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the third parameter is
+                                                       void *addrlen.  */
+_GL_CXXALIAS_SYS_CAST (getsockname, int,
+                       (int fd, struct sockaddr *addr, socklen_t *addrlen));
+# endif
+_GL_CXXALIASWARN (getsockname);
+#elif @HAVE_WINSOCK2_H@
+# undef getsockname
+# define getsockname 
getsockname_used_without_requesting_gnulib_module_getsockname
+#elif defined GNULIB_POSIXCHECK
+# undef getsockname
+# if HAVE_RAW_DECL_GETSOCKNAME
+_GL_WARN_ON_USE (getsockname, "getsockname is not always POSIX compliant - "
+                 "use gnulib module getsockname for portability");
+# endif
+#endif
+
+#if @GNULIB_GETSOCKOPT@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef getsockopt
-#   define getsockopt           rpl_getsockopt
-extern int rpl_getsockopt (int, int, int, void *, socklen_t *)
-     _GL_ARG_NONNULL ((4, 5));
+#   define getsockopt rpl_getsockopt
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef getsockopt
-#  define getsockopt 
getsockopt_used_without_requesting_gnulib_module_getsockopt
-# elif defined GNULIB_POSIXCHECK
-#  undef getsockopt
-#  define getsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("getsockopt is not always POSIX compliant - " \
-                       "use gnulib module getsockopt for portability"), \
-      getsockopt (s, lvl, o, v, l))
-# endif
-
-# if @GNULIB_LISTEN@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (getsockopt, int, (int fd, int level, int optname,
+                                    void *optval, socklen_t *optlen)
+                                   _GL_ARG_NONNULL ((4, 5)));
+_GL_CXXALIAS_RPL (getsockopt, int, (int fd, int level, int optname,
+                                    void *optval, socklen_t *optlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the fifth parameter is
+                                                       void *optlen.  */
+_GL_CXXALIAS_SYS_CAST (getsockopt, int, (int fd, int level, int optname,
+                                         void *optval, socklen_t *optlen));
+# endif
+_GL_CXXALIASWARN (getsockopt);
+#elif @HAVE_WINSOCK2_H@
+# undef getsockopt
+# define getsockopt getsockopt_used_without_requesting_gnulib_module_getsockopt
+#elif defined GNULIB_POSIXCHECK
+# undef getsockopt
+# if HAVE_RAW_DECL_GETSOCKOPT
+_GL_WARN_ON_USE (getsockopt, "getsockopt is not always POSIX compliant - "
+                 "use gnulib module getsockopt for portability");
+# endif
+#endif
+
+#if @GNULIB_LISTEN@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef listen
-#   define listen               rpl_listen
-extern int rpl_listen (int, int);
+#   define listen rpl_listen
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef listen
-#  define listen listen_used_without_requesting_gnulib_module_listen
-# elif defined GNULIB_POSIXCHECK
-#  undef listen
-#  define listen(s,b) \
-     (GL_LINK_WARNING ("listen is not always POSIX compliant - " \
-                       "use gnulib module listen for portability"), \
-      listen (s, b))
-# endif
-
-# if @GNULIB_RECV@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (listen, int, (int fd, int backlog));
+_GL_CXXALIAS_RPL (listen, int, (int fd, int backlog));
+# else
+_GL_CXXALIAS_SYS (listen, int, (int fd, int backlog));
+# endif
+_GL_CXXALIASWARN (listen);
+#elif @HAVE_WINSOCK2_H@
+# undef listen
+# define listen listen_used_without_requesting_gnulib_module_listen
+#elif defined GNULIB_POSIXCHECK
+# undef listen
+# if HAVE_RAW_DECL_LISTEN
+_GL_WARN_ON_USE (listen, "listen is not always POSIX compliant - "
+                 "use gnulib module listen for portability");
+# endif
+#endif
+
+#if @GNULIB_RECV@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef recv
-#   define recv                 rpl_recv
-extern int rpl_recv (int, void *, int, int) _GL_ARG_NONNULL ((2));
+#   define recv rpl_recv
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef recv
-#  define recv recv_used_without_requesting_gnulib_module_recv
-# elif defined GNULIB_POSIXCHECK
-#  undef recv
-#  define recv(s,b,n,f) \
-     (GL_LINK_WARNING ("recv is not always POSIX compliant - " \
-                       "use gnulib module recv for portability"), \
-      recv (s, b, n, f))
-# endif
-
-# if @GNULIB_SEND@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
+# else
+_GL_CXXALIAS_SYS (recv, ssize_t, (int fd, void *buf, size_t len, int flags));
+# endif
+_GL_CXXALIASWARN (recv);
+#elif @HAVE_WINSOCK2_H@
+# undef recv
+# define recv recv_used_without_requesting_gnulib_module_recv
+#elif defined GNULIB_POSIXCHECK
+# undef recv
+# if HAVE_RAW_DECL_RECV
+_GL_WARN_ON_USE (recv, "recv is not always POSIX compliant - "
+                 "use gnulib module recv for portability");
+# endif
+#endif
+
+#if @GNULIB_SEND@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef send
-#   define send                 rpl_send
-extern int rpl_send (int, const void *, int, int) _GL_ARG_NONNULL ((2));
+#   define send rpl_send
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef send
-#  define send send_used_without_requesting_gnulib_module_send
-# elif defined GNULIB_POSIXCHECK
-#  undef send
-#  define send(s,b,n,f) \
-     (GL_LINK_WARNING ("send is not always POSIX compliant - " \
-                       "use gnulib module send for portability"), \
-      send (s, b, n, f))
-# endif
-
-# if @GNULIB_RECVFROM@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (send, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (send, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags));
+# else
+_GL_CXXALIAS_SYS (send, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags));
+# endif
+_GL_CXXALIASWARN (send);
+#elif @HAVE_WINSOCK2_H@
+# undef send
+# define send send_used_without_requesting_gnulib_module_send
+#elif defined GNULIB_POSIXCHECK
+# undef send
+# if HAVE_RAW_DECL_SEND
+_GL_WARN_ON_USE (send, "send is not always POSIX compliant - "
+                 "use gnulib module send for portability");
+# endif
+#endif
+
+#if @GNULIB_RECVFROM@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef recvfrom
-#   define recvfrom             rpl_recvfrom
-extern int rpl_recvfrom (int, void *, int, int, struct sockaddr *, int *)
-     _GL_ARG_NONNULL ((2));
+#   define recvfrom rpl_recvfrom
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef recvfrom
-#  define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
-# elif defined GNULIB_POSIXCHECK
-#  undef recvfrom
-#  define recvfrom(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("recvfrom is not always POSIX compliant - " \
-                       "use gnulib module recvfrom for portability"), \
-      recvfrom (s, b, n, f, a, l))
-# endif
-
-# if @GNULIB_SENDTO@
-#  if @HAVE_WINSOCK2_H@
+_GL_FUNCDECL_RPL (recvfrom, ssize_t,
+                  (int fd, void *buf, size_t len, int flags,
+                   struct sockaddr *from, socklen_t *fromlen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (recvfrom, ssize_t,
+                  (int fd, void *buf, size_t len, int flags,
+                   struct sockaddr *from, socklen_t *fromlen));
+# else
+/* Need to cast, because on Solaris 10 systems, the sixth parameter is
+                                               void *fromlen.  */
+_GL_CXXALIAS_SYS_CAST (recvfrom, ssize_t,
+                       (int fd, void *buf, size_t len, int flags,
+                        struct sockaddr *from, socklen_t *fromlen));
+# endif
+_GL_CXXALIASWARN (recvfrom);
+#elif @HAVE_WINSOCK2_H@
+# undef recvfrom
+# define recvfrom recvfrom_used_without_requesting_gnulib_module_recvfrom
+#elif defined GNULIB_POSIXCHECK
+# undef recvfrom
+# if HAVE_RAW_DECL_RECVFROM
+_GL_WARN_ON_USE (recvfrom, "recvfrom is not always POSIX compliant - "
+                 "use gnulib module recvfrom for portability");
+# endif
+#endif
+
+#if @GNULIB_SENDTO@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   undef sendto
-#   define sendto               rpl_sendto
-extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int)
-     _GL_ARG_NONNULL ((2));
+#   define sendto rpl_sendto
 #  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef sendto
-#  define sendto sendto_used_without_requesting_gnulib_module_sendto
-# elif defined GNULIB_POSIXCHECK
-#  undef sendto
-#  define sendto(s,b,n,f,a,l) \
-     (GL_LINK_WARNING ("sendto is not always POSIX compliant - " \
-                       "use gnulib module sendto for portability"), \
-      sendto (s, b, n, f, a, l))
-# endif
-
-# if @GNULIB_SETSOCKOPT@
-#  if @HAVE_WINSOCK2_H@
-#   undef setsockopt
-#   define setsockopt           rpl_setsockopt
-extern int rpl_setsockopt (int, int, int, const void *, socklen_t)
-     _GL_ARG_NONNULL ((4));
-#  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef setsockopt
-#  define setsockopt 
setsockopt_used_without_requesting_gnulib_module_setsockopt
-# elif defined GNULIB_POSIXCHECK
-#  undef setsockopt
-#  define setsockopt(s,lvl,o,v,l) \
-     (GL_LINK_WARNING ("setsockopt is not always POSIX compliant - " \
-                       "use gnulib module setsockopt for portability"), \
-      setsockopt (s, lvl, o, v, l))
-# endif
-
-# if @GNULIB_SHUTDOWN@
-#  if @HAVE_WINSOCK2_H@
-#   undef shutdown
-#   define shutdown             rpl_shutdown
-extern int rpl_shutdown (int, int);
-#  endif
-# elif @HAVE_WINSOCK2_H@
-#  undef shutdown
-#  define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
-# elif defined GNULIB_POSIXCHECK
-#  undef shutdown
-#  define shutdown(s,h) \
-     (GL_LINK_WARNING ("shutdown is not always POSIX compliant - " \
-                       "use gnulib module shutdown for portability"), \
-      shutdown (s, h))
+_GL_FUNCDECL_RPL (sendto, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags,
+                   const struct sockaddr *to, socklen_t tolen)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (sendto, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags,
+                   const struct sockaddr *to, socklen_t tolen));
+# else
+_GL_CXXALIAS_SYS (sendto, ssize_t,
+                  (int fd, const void *buf, size_t len, int flags,
+                   const struct sockaddr *to, socklen_t tolen));
+# endif
+_GL_CXXALIASWARN (sendto);
+#elif @HAVE_WINSOCK2_H@
+# undef sendto
+# define sendto sendto_used_without_requesting_gnulib_module_sendto
+#elif defined GNULIB_POSIXCHECK
+# undef sendto
+# if HAVE_RAW_DECL_SENDTO
+_GL_WARN_ON_USE (sendto, "sendto is not always POSIX compliant - "
+                 "use gnulib module sendto for portability");
 # endif
+#endif
 
+#if @GNULIB_SETSOCKOPT@
 # if @HAVE_WINSOCK2_H@
-#  undef select
-#  define select                select_used_without_including_sys_select_h
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setsockopt
+#   define setsockopt rpl_setsockopt
+#  endif
+_GL_FUNCDECL_RPL (setsockopt, int, (int fd, int level, int optname,
+                                    const void * optval, socklen_t optlen)
+                                   _GL_ARG_NONNULL ((4)));
+_GL_CXXALIAS_RPL (setsockopt, int, (int fd, int level, int optname,
+                                    const void * optval, socklen_t optlen));
+# else
+_GL_CXXALIAS_SYS (setsockopt, int, (int fd, int level, int optname,
+                                    const void * optval, socklen_t optlen));
+# endif
+_GL_CXXALIASWARN (setsockopt);
+#elif @HAVE_WINSOCK2_H@
+# undef setsockopt
+# define setsockopt setsockopt_used_without_requesting_gnulib_module_setsockopt
+#elif defined GNULIB_POSIXCHECK
+# undef setsockopt
+# if HAVE_RAW_DECL_SETSOCKOPT
+_GL_WARN_ON_USE (setsockopt, "setsockopt is not always POSIX compliant - "
+                 "use gnulib module setsockopt for portability");
 # endif
+#endif
 
-# ifdef __cplusplus
-}
+#if @GNULIB_SHUTDOWN@
+# if @HAVE_WINSOCK2_H@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef shutdown
+#   define shutdown rpl_shutdown
+#  endif
+_GL_FUNCDECL_RPL (shutdown, int, (int fd, int how));
+_GL_CXXALIAS_RPL (shutdown, int, (int fd, int how));
+# else
+_GL_CXXALIAS_SYS (shutdown, int, (int fd, int how));
+# endif
+_GL_CXXALIASWARN (shutdown);
+#elif @HAVE_WINSOCK2_H@
+# undef shutdown
+# define shutdown shutdown_used_without_requesting_gnulib_module_shutdown
+#elif defined GNULIB_POSIXCHECK
+# undef shutdown
+# if HAVE_RAW_DECL_SHUTDOWN
+_GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
+                 "use gnulib module shutdown for portability");
 # endif
+#endif
 
-#endif /* HAVE_SYS_SOCKET_H */
-
-#ifdef __cplusplus
-extern "C" {
+#if @HAVE_WINSOCK2_H@
+# undef select
+# define select                select_used_without_including_sys_select_h
 #endif
 
 #if @GNULIB_ACCEPT4@
@@ -442,21 +582,32 @@ extern "C" {
    See also the Linux man page at
    <http://www.kernel.org/doc/man-pages/online/pages/man2/accept4.2.html>.  */
 # if @HAVE_ACCEPT4@
-#  define accept4 rpl_accept4
-# endif
-extern int accept4 (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
-                    int flags);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define accept4 rpl_accept4
+#  endif
+_GL_FUNCDECL_RPL (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+_GL_CXXALIAS_RPL (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+# else
+_GL_FUNCDECL_SYS (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+_GL_CXXALIAS_SYS (accept4, int,
+                  (int sockfd, struct sockaddr *addr, socklen_t *addrlen,
+                   int flags));
+# endif
+_GL_CXXALIASWARN (accept4);
 #elif defined GNULIB_POSIXCHECK
 # undef accept4
-# define accept4(s,a,l,f) \
-    (GL_LINK_WARNING ("accept4 is unportable - " \
-                      "use gnulib module accept4 for portability"), \
-     accept4 (s, a, l, f))
-#endif
-
-#ifdef __cplusplus
-}
+# if HAVE_RAW_DECL_ACCEPT4
+_GL_WARN_ON_USE (accept4, "accept4 is unportable - "
+                 "use gnulib module accept4 for portability");
+# endif
 #endif
 
 #endif /* _GL_SYS_SOCKET_H */
 #endif /* _GL_SYS_SOCKET_H */
+#endif
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 0db3c4d..571cfe4 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2005-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -47,10 +47,12 @@
 #ifndef _GL_SYS_STAT_H
 #define _GL_SYS_STAT_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  */
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
@@ -290,63 +292,87 @@
 #endif
 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 #if @GNULIB_FCHMODAT@
 # if address@hidden@
-extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
-     _GL_ARG_NONNULL ((2));
+_GL_FUNCDECL_SYS (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
 # endif
+_GL_CXXALIAS_SYS (fchmodat, int,
+                  (int fd, char const *file, mode_t mode, int flag));
+_GL_CXXALIASWARN (fchmodat);
 #elif defined GNULIB_POSIXCHECK
 # undef fchmodat
-# define fchmodat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("fchmodat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchmodat (d, n, m, f))
+# if HAVE_RAW_DECL_FCHMODAT
+_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_FSTAT@
-# define fstat rpl_fstat
-extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define fstat rpl_fstat
+# endif
+_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL 
((2)));
+_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
+#else
+_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
 #endif
+_GL_CXXALIASWARN (fstat);
 
 
 #if @GNULIB_FSTATAT@
 # if @REPLACE_FSTATAT@
-#  undef fstatat
-#  define fstatat rpl_fstatat
-# endif
-# if address@hidden@ || @REPLACE_FSTATAT@
-extern int fstatat (int fd, char const *name, struct stat *st, int flags)
-     _GL_ARG_NONNULL ((2, 3));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fstatat
+#   define fstatat rpl_fstatat
+#  endif
+_GL_FUNCDECL_RPL (fstatat, int,
+                  (int fd, char const *name, struct stat *st, int flags)
+                  _GL_ARG_NONNULL ((2, 3)));
+_GL_CXXALIAS_RPL (fstatat, int,
+                  (int fd, char const *name, struct stat *st, int flags));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (fstatat, int,
+                  (int fd, char const *name, struct stat *st, int flags)
+                  _GL_ARG_NONNULL ((2, 3)));
+#  endif
+_GL_CXXALIAS_SYS (fstatat, int,
+                  (int fd, char const *name, struct stat *st, int flags));
 # endif
+_GL_CXXALIASWARN (fstatat);
 #elif defined GNULIB_POSIXCHECK
 # undef fstatat
-# define fstatat(d,n,s,f)                         \
-    (GL_LINK_WARNING ("fstatat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fstatat (d, n, s, f))
+# if HAVE_RAW_DECL_FSTATAT
+_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FUTIMENS@
 # if @REPLACE_FUTIMENS@
-#  undef futimens
-#  define futimens rpl_futimens
-# endif
-# if address@hidden@ || @REPLACE_FUTIMENS@
-extern int futimens (int fd, struct timespec const times[2]);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef futimens
+#   define futimens rpl_futimens
+#  endif
+_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
+_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
+#  endif
+_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
 # endif
+_GL_CXXALIASWARN (futimens);
 #elif defined GNULIB_POSIXCHECK
 # undef futimens
-# define futimens(f,t)                         \
-    (GL_LINK_WARNING ("futimens is not portable - " \
-                      "use gnulib module futimens for portability"), \
-     futimens (f, t))
+# if HAVE_RAW_DECL_FUTIMENS
+_GL_WARN_ON_USE (futimens, "futimens is not portable - "
+                 "use gnulib module futimens for portability");
+# endif
 #endif
 
 
@@ -361,17 +387,24 @@ extern int futimens (int fd, struct timespec const 
times[2]);
    invocation of lchmod, but we know of no workarounds that are
    reliable in general.  You might try requesting support for lchmod
    from your operating system supplier.  */
-#  define lchmod chmod
-# endif
-# if 0 /* assume already declared */
-extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define lchmod chmod
+#  endif
+_GL_CXXALIAS_RPL_1 (lchmod, chmod, int, (const char *filename, mode_t mode));
+# else
+#  if 0 /* assume already declared */
+_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
 # endif
+_GL_CXXALIASWARN (lchmod);
 #elif defined GNULIB_POSIXCHECK
 # undef lchmod
-# define lchmod(f,m) \
-    (GL_LINK_WARNING ("lchmod is unportable - " \
-                      "use gnulib module lchmod for portability"), \
-     lchmod (f, m))
+# if HAVE_RAW_DECL_LCHMOD
+_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
+                 "use gnulib module lchmod for portability");
+# endif
 #endif
 
 
@@ -379,26 +412,39 @@ extern int lchmod (const char *filename, mode_t mode) 
_GL_ARG_NONNULL ((1));
 # if ! @HAVE_LSTAT@
 /* mingw does not support symlinks, therefore it does not have lstat.  But
    without links, stat does just fine.  */
-#  define lstat stat
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define lstat stat
+#  endif
+_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
 # elif @REPLACE_LSTAT@
-#  undef lstat
-#  define lstat rpl_lstat
-extern int rpl_lstat (const char *name, struct stat *buf)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lstat
+#   define lstat rpl_lstat
+#  endif
+_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
+                              _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
+# else
+_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
 # endif
+_GL_CXXALIASWARN (lstat);
 #elif defined GNULIB_POSIXCHECK
 # undef lstat
-# define lstat(p,b)                                                     \
-  (GL_LINK_WARNING ("lstat is unportable - "                            \
-                    "use gnulib module lstat for portability"),         \
-   lstat (p, b))
+# if HAVE_RAW_DECL_LSTAT
+_GL_WARN_ON_USE (lstat, "lstat is unportable - "
+                 "use gnulib module lstat for portability");
+# endif
 #endif
 
 
 #if @REPLACE_MKDIR@
-# undef mkdir
-# define mkdir rpl_mkdir
-extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  undef mkdir
+#  define mkdir rpl_mkdir
+# endif
+_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
 #else
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
@@ -411,85 +457,116 @@ rpl_mkdir (char const *name, mode_t mode)
   return _mkdir (name);
 }
 
-#  define mkdir rpl_mkdir
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define mkdir rpl_mkdir
+#  endif
+_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
+# else
+_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
 # endif
 #endif
+_GL_CXXALIASWARN (mkdir);
 
 
 #if @GNULIB_MKDIRAT@
 # if address@hidden@
-extern int mkdirat (int fd, char const *file, mode_t mode)
-     _GL_ARG_NONNULL ((2));
+_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
+                                _GL_ARG_NONNULL ((2)));
 # endif
+_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
+_GL_CXXALIASWARN (mkdirat);
 #elif defined GNULIB_POSIXCHECK
 # undef mkdirat
-# define mkdirat(d,n,m)                         \
-    (GL_LINK_WARNING ("mkdirat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     mkdirat (d, n, m))
+# if HAVE_RAW_DECL_MKDIRAT
+_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKFIFO@
 # if @REPLACE_MKFIFO@
-#  undef mkfifo
-#  define mkfifo rpl_mkfifo
-# endif
-# if address@hidden@ || @REPLACE_MKFIFO@
-extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mkfifo
+#   define mkfifo rpl_mkfifo
+#  endif
+_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
 # endif
+_GL_CXXALIASWARN (mkfifo);
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifo
-# define mkfifo(n,m)                                                    \
-    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
-                      "use gnulib module mkfifo for portability"),      \
-     mkfifo (n, m))
+# if HAVE_RAW_DECL_MKFIFO
+_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
+                 "use gnulib module mkfifo for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKFIFOAT@
 # if address@hidden@
-extern int mkfifoat (int fd, char const *file, mode_t mode)
-     _GL_ARG_NONNULL ((2));
+_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
+                                 _GL_ARG_NONNULL ((2)));
 # endif
+_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
+_GL_CXXALIASWARN (mkfifoat);
 #elif defined GNULIB_POSIXCHECK
 # undef mkfifoat
-# define mkfifoat(d,n,m)                                     \
-    (GL_LINK_WARNING ("mkfifoat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mkfifoat (d, n, m))
+# if HAVE_RAW_DECL_MKFIFOAT
+_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKNOD@
 # if @REPLACE_MKNOD@
-#  undef mknod
-#  define mknod rpl_mknod
-# endif
-# if address@hidden@ || @REPLACE_MKNOD@
-extern int mknod (char const *file, mode_t mode, dev_t dev)
-     _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mknod
+#   define mknod rpl_mknod
+#  endif
+_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
+                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev));
 # endif
+_GL_CXXALIASWARN (mknod);
 #elif defined GNULIB_POSIXCHECK
 # undef mknod
-# define mknod(n,m,d)                                                   \
-    (GL_LINK_WARNING ("mknod is not portable - "                        \
-                      "use gnulib module mknod for portability"),       \
-     mknod (n, m, d))
+# if HAVE_RAW_DECL_MKNOD
+_GL_WARN_ON_USE (mknod, "mknod is not portable - "
+                 "use gnulib module mknod for portability");
+# endif
 #endif
 
 
 #if @GNULIB_MKNODAT@
 # if address@hidden@
-extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
-     _GL_ARG_NONNULL ((2));
+_GL_FUNCDECL_SYS (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev)
+                  _GL_ARG_NONNULL ((2)));
 # endif
+_GL_CXXALIAS_SYS (mknodat, int,
+                  (int fd, char const *file, mode_t mode, dev_t dev));
+_GL_CXXALIASWARN (mknodat);
 #elif defined GNULIB_POSIXCHECK
 # undef mknodat
-# define mknodat(f,n,m,d)                            \
-    (GL_LINK_WARNING ("mknodat is not portable - " \
-                      "use gnulib module mkfifoat for portability"), \
-     mknodat (f, n, m, d))
+# if HAVE_RAW_DECL_MKNODAT
+_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
+                 "use gnulib module mkfifoat for portability");
+# endif
 #endif
 
 
@@ -508,38 +585,44 @@ extern int mknodat (int fd, char const *file, mode_t 
mode, dev_t dev)
 #  else /* !_LARGE_FILES */
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
-extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
+_GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL 
((1, 2));
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef stat
-# define stat(p,b)                                                      \
-  (GL_LINK_WARNING ("stat is unportable - "                             \
-                    "use gnulib module stat for portability"),          \
-   stat (p, b))
+# if HAVE_RAW_DECL_STAT
+_GL_WARN_ON_USE (stat, "stat is unportable - "
+                 "use gnulib module stat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_UTIMENSAT@
 # if @REPLACE_UTIMENSAT@
-#  undef utimensat
-#  define utimensat rpl_utimensat
-# endif
-# if address@hidden@ || @REPLACE_UTIMENSAT@
-   extern int utimensat (int fd, char const *name,
-                         struct timespec const times[2], int flag)
-        _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef utimensat
+#   define utimensat rpl_utimensat
+#  endif
+_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag)
+                                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag)
+                                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
+                                   struct timespec const times[2], int flag));
 # endif
+_GL_CXXALIASWARN (utimensat);
 #elif defined GNULIB_POSIXCHECK
 # undef utimensat
-# define utimensat(d,n,t,f)                          \
-    (GL_LINK_WARNING ("utimensat is not portable - " \
-                      "use gnulib module utimensat for portability"), \
-     utimensat (d, n, t, f))
-#endif
-
-
-#ifdef __cplusplus
-}
+# if HAVE_RAW_DECL_UTIMENSAT
+_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
+                 "use gnulib module utimensat for portability");
+# endif
 #endif
 
 
diff --git a/lib/time.in.h b/lib/time.in.h
index eb35cc2..958de82 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -40,8 +40,12 @@
 /* NetBSD 5.0 mis-defines NULL.  */
 #include <stddef.h>
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 # ifdef __cplusplus
 extern "C" {
 # endif
@@ -63,54 +67,117 @@ struct timespec
 #  endif
 # endif
 
+# ifdef __cplusplus
+}
+# endif
+
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
    return -1 and store the remaining time into RMTP.  See
    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
-# if @REPLACE_NANOSLEEP@
-#  define nanosleep rpl_nanosleep
-extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
-     _GL_ARG_NONNULL ((1));
+# if @GNULIB_NANOSLEEP@
+#  if @REPLACE_NANOSLEEP@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define nanosleep rpl_nanosleep
+#   endif
+_GL_FUNCDECL_RPL (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp));
+#  else
+_GL_CXXALIAS_SYS (nanosleep, int,
+                  (struct timespec const *__rqtp, struct timespec *__rmtp));
+#  endif
+_GL_CXXALIASWARN (nanosleep);
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
-# if @REPLACE_MKTIME@
-#  define mktime rpl_mktime
-extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
+# if @GNULIB_MKTIME@
+#  if @REPLACE_MKTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    define mktime rpl_mktime
+#   endif
+_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
+#  else
+_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
+#  endif
+_GL_CXXALIASWARN (mktime);
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
    <http://www.opengroup.org/susv3xsh/localtime_r.html> and
    <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
-# if @REPLACE_LOCALTIME_R@
-#  undef localtime_r
-#  define localtime_r rpl_localtime_r
-#  undef gmtime_r
-#  define gmtime_r rpl_gmtime_r
-extern struct tm *localtime_r (time_t const *restrict __timer,
-                               struct tm *restrict __result)
-     _GL_ARG_NONNULL ((1, 2));
-extern struct tm *gmtime_r (time_t const *restrict __timer,
-                            struct tm *restrict __result)
-     _GL_ARG_NONNULL ((1, 2));
+# if @GNULIB_TIME_R@
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef localtime_r
+#    define localtime_r rpl_localtime_r
+#   endif
+_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result)
+                                            _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result));
+#  else
+_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
+                                             struct tm *restrict __result));
+#  endif
+_GL_CXXALIASWARN (localtime_r);
+#  if @REPLACE_LOCALTIME_R@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef gmtime_r
+#    define gmtime_r rpl_gmtime_r
+#   endif
+_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result)
+                                         _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result));
+#  else
+_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
+                                          struct tm *restrict __result));
+#  endif
+_GL_CXXALIASWARN (gmtime_r);
 # endif
 
 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
    the resulting broken-down time into TM.  See
    <http://www.opengroup.org/susv3xsh/strptime.html>.  */
-# if @REPLACE_STRPTIME@
-#  undef strptime
-#  define strptime rpl_strptime
-extern char *strptime (char const *restrict __buf,
-                       char const *restrict __format,
-                       struct tm *restrict __tm)
-     _GL_ARG_NONNULL ((1, 2, 3));
+# if @GNULIB_STRPTIME@
+#  if @REPLACE_STRPTIME@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef strptime
+#    define strptime rpl_strptime
+#   endif
+_GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf,
+                                     char const *restrict __format,
+                                     struct tm *restrict __tm)
+                                    _GL_ARG_NONNULL ((1, 2, 3)));
+_GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf,
+                                     char const *restrict __format,
+                                     struct tm *restrict __tm));
+#  else
+_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
+                                     char const *restrict __format,
+                                     struct tm *restrict __tm));
+#  endif
+_GL_CXXALIASWARN (strptime);
 # endif
 
 /* Convert TM to a time_t value, assuming UTC.  */
-# if @REPLACE_TIMEGM@
-#  undef timegm
-#  define timegm rpl_timegm
-extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
+# if @GNULIB_TIMEGM@
+#  if @REPLACE_TIMEGM@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef timegm
+#    define timegm rpl_timegm
+#   endif
+_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
+#  else
+_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
+#  endif
+_GL_CXXALIASWARN (timegm);
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
@@ -127,8 +194,4 @@ extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL 
((1));
 #  define ctime_r eschew_ctime_r
 # endif
 
-# ifdef __cplusplus
-}
-# endif
-
 #endif
diff --git a/lib/time_r.c b/lib/time_r.c
index 90dcf00..a4f2b4d 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index c6d1d13..7609d58 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -33,23 +33,43 @@
 #include <stddef.h>
 
 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
+     || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
+    && ! defined __GLIBC__
 # include <stdio.h>
 #endif
 
+/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
+# include <fcntl.h>
+#endif
+
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
-#include <stdlib.h>
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stdlib.h>
+#endif
 
-#if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@)   \
-     || (@GNULIB_READLINK@ && (address@hidden@ || @REPLACE_READLINK@)) \
-     || (@GNULIB_READLINKAT@ && address@hidden@))
+/* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
+#if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
+     && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# include <io.h>
+#endif
+
+#if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
+     || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK)
 /* Get ssize_t.  */
 # include <sys/types.h>
 #endif
 
-/* Get getopt(), optarg, optind, opterr, optopt.  */
-#if @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
+/* Get getopt(), optarg, optind, opterr, optopt.
+   But avoid namespace pollution on glibc systems.  */
+#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined 
_GL_SYSTEM_GETOPT
 # include <getopt.h>
 #endif
 
@@ -94,10 +114,12 @@
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* OS/2 EMX lacks these macros.  */
 #ifndef STDIN_FILENO
@@ -121,78 +143,107 @@
 
 /* Declare overridden functions.  */
 
-#ifdef __cplusplus
-extern "C" {
+
+#if defined GNULIB_POSIXCHECK
+/* The access() function is a security risk.  */
+_GL_WARN_ON_USE (access, "the access function is a security risk - "
+                 "use the gnulib module faccessat instead");
 #endif
 
 
 #if @GNULIB_CHOWN@
-# if @REPLACE_CHOWN@
-#  undef chown
-#  define chown rpl_chown
-# endif
-# if address@hidden@ || @REPLACE_CHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/chown.html>.  */
-extern int chown (const char *file, uid_t uid, gid_t gid)
-     _GL_ARG_NONNULL ((1));
+# if @REPLACE_CHOWN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef chown
+#   define chown rpl_chown
+#  endif
+_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
+                              _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
+                              _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
 # endif
+_GL_CXXALIASWARN (chown);
 #elif defined GNULIB_POSIXCHECK
 # undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
+# if HAVE_RAW_DECL_CHOWN
+_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
+                 "doesn't treat a uid or gid of -1 on some systems - "
+                 "use gnulib module chown for portability");
+# endif
 #endif
 
 
 #if @GNULIB_CLOSE@
 # if @REPLACE_CLOSE@
 /* Automatically included by modules that need a replacement for close.  */
-#  undef close
-#  define close rpl_close
-extern int close (int);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close rpl_close
+#  endif
+_GL_FUNCDECL_RPL (close, int, (int fd));
+_GL_CXXALIAS_RPL (close, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (close, int, (int fd));
 # endif
+_GL_CXXALIASWARN (close);
 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 # undef close
 # define close close_used_without_requesting_gnulib_module_close
 #elif defined GNULIB_POSIXCHECK
 # undef close
-# define close(f) \
-    (GL_LINK_WARNING ("close does not portably work on sockets - " \
-                      "use gnulib module close for portability"), \
-     close (f))
+/* Assume close is always declared.  */
+_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
+                 "use gnulib module close for portability");
 #endif
 
 
 #if @REPLACE_DUP@
-# define dup rpl_dup
-extern int dup (int);
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#  define dup rpl_dup
+# endif
+_GL_FUNCDECL_RPL (dup, int, (int oldfd));
+_GL_CXXALIAS_RPL (dup, int, (int oldfd));
+#else
+_GL_CXXALIAS_SYS (dup, int, (int oldfd));
 #endif
+_GL_CXXALIASWARN (dup);
 
 
 #if @GNULIB_DUP2@
-# if @REPLACE_DUP2@
-#  define dup2 rpl_dup2
-# endif
-# if address@hidden@ || @REPLACE_DUP2@
 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
    Return newfd if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
-extern int dup2 (int oldfd, int newfd);
+# if @REPLACE_DUP2@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dup2 rpl_dup2
+#  endif
+_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
+_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
+#  endif
+_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
 # endif
+_GL_CXXALIASWARN (dup2);
 #elif defined GNULIB_POSIXCHECK
 # undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
+# if HAVE_RAW_DECL_DUP2
+_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
+                 "use gnulib module dup2 for portability");
+# endif
 #endif
 
 
@@ -206,15 +257,22 @@ extern int dup2 (int oldfd, int newfd);
    See the Linux man page at
    <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
 # if @HAVE_DUP3@
-#  define dup3 rpl_dup3
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define dup3 rpl_dup3
+#  endif
+_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
+_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
+# else
+_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
+_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
 # endif
-extern int dup3 (int oldfd, int newfd, int flags);
+_GL_CXXALIASWARN (dup3);
 #elif defined GNULIB_POSIXCHECK
 # undef dup3
-# define dup3(o,n,f) \
-    (GL_LINK_WARNING ("dup3 is unportable - " \
-                      "use gnulib module dup3 for portability"), \
-     dup3 (o, n, f))
+# if HAVE_RAW_DECL_DUP3
+_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
+                 "use gnulib module dup3 for portability");
+# endif
 #endif
 
 
@@ -226,88 +284,128 @@ extern int dup3 (int oldfd, int newfd, int flags);
 #   include <crt_externs.h>
 #   define environ (*_NSGetEnviron ())
 #  else
+#   ifdef __cplusplus
+extern "C" {
+#   endif
 extern char **environ;
+#   ifdef __cplusplus
+}
+#   endif
 #  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
-# undef environ
-# define environ \
-    (GL_LINK_WARNING ("environ is unportable - " \
-                      "use gnulib module environ for portability"), \
-     environ)
+# if HAVE_RAW_DECL_ENVIRON
+static inline char ***
+rpl_environ (void)
+{
+  return &environ;
+}
+_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
+                 "use gnulib module environ for portability");
+#  undef environ
+#  define environ (*rpl_environ ())
+# endif
 #endif
 
 
 #if @GNULIB_EUIDACCESS@
-# if address@hidden@
 /* Like access(), except that it uses the effective user id and group id of
    the current process.  */
-extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
+# if address@hidden@
+_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
+                                   _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
+_GL_CXXALIASWARN (euidaccess);
+# if defined GNULIB_POSIXCHECK
+/* Like access(), this function is a security risk.  */
+_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
+                 "use the gnulib module faccessat instead");
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef euidaccess
-# define euidaccess(f,m) \
-    (GL_LINK_WARNING ("euidaccess is unportable - " \
-                      "use gnulib module euidaccess for portability"), \
-     euidaccess (f, m))
+# if HAVE_RAW_DECL_EUIDACCESS
+_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
+                 "use gnulib module euidaccess for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FACCESSAT@
 # if address@hidden@
-extern int faccessat (int fd, char const *file, int mode, int flag)
-     _GL_ARG_NONNULL ((2));
+_GL_FUNCDECL_SYS (faccessat, int,
+                  (int fd, char const *file, int mode, int flag)
+                  _GL_ARG_NONNULL ((2)));
 # endif
+_GL_CXXALIAS_SYS (faccessat, int,
+                  (int fd, char const *file, int mode, int flag));
+_GL_CXXALIASWARN (faccessat);
 #elif defined GNULIB_POSIXCHECK
 # undef faccessat
-# define faccessat(d,n,m,f)                         \
-    (GL_LINK_WARNING ("faccessat is not portable - " \
-                      "use gnulib module faccessat for portability"), \
-     faccessat (d, n, m, f))
+# if HAVE_RAW_DECL_FACCESSAT
+_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
+                 "use gnulib module faccessat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FCHDIR@
-# if @REPLACE_FCHDIR@
 /* Change the process' current working directory to the directory on which
    the given file descriptor is open.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
-extern int fchdir (int /*fd*/);
+# if @REPLACE_FCHDIR@
+_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/));
+_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
 
 /* Gnulib internal hooks needed to maintain the fchdir metadata.  */
-extern int _gl_register_fd (int fd, const char *filename)
+_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
      _GL_ARG_NONNULL ((2));
-extern void _gl_unregister_fd (int fd);
-extern int _gl_register_dup (int oldfd, int newfd);
-extern const char *_gl_directory_name (int fd);
+_GL_EXTERN_C void _gl_unregister_fd (int fd);
+_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
+_GL_EXTERN_C const char *_gl_directory_name (int fd);
 
+# else
+_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
 # endif
+_GL_CXXALIASWARN (fchdir);
 #elif defined GNULIB_POSIXCHECK
 # undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
+# if HAVE_RAW_DECL_FCHDIR
+_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
+                 "use gnulib module fchdir for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FCHOWNAT@
 # if @REPLACE_FCHOWNAT@
-#  undef fchownat
-#  define fchownat rpl_fchownat
-# endif
-# if address@hidden@ || @REPLACE_FCHOWNAT@
-extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int 
flag)
-     _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef fchownat
+#   define fchownat rpl_fchownat
+#  endif
+_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
+                                  uid_t owner, gid_t group, int flag));
 # endif
+_GL_CXXALIASWARN (fchownat);
 #elif defined GNULIB_POSIXCHECK
 # undef fchownat
-# define fchownat(d,n,o,g,f)                        \
-    (GL_LINK_WARNING ("fchownat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     fchownat (d, n, o, g, f))
+# if HAVE_RAW_DECL_FCHOWNAT
+_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
@@ -317,39 +415,39 @@ extern int fchownat (int fd, char const *file, uid_t 
owner, gid_t group, int fla
    See POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/fsync.html>.  */
 # if address@hidden@
-extern int fsync (int fd);
+_GL_FUNCDECL_SYS (fsync, int, (int fd));
 # endif
+_GL_CXXALIAS_SYS (fsync, int, (int fd));
+_GL_CXXALIASWARN (fsync);
 #elif defined GNULIB_POSIXCHECK
 # undef fsync
-# define fsync(fd) \
-    (GL_LINK_WARNING ("fsync is unportable - " \
-                      "use gnulib module fsync for portability"), \
-     fsync (fd))
+# if HAVE_RAW_DECL_FSYNC
+_GL_WARN_ON_USE (fsync, "fsync is unportable - "
+                 "use gnulib module fsync for portability");
+# endif
 #endif
 
 
 #if @GNULIB_FTRUNCATE@
-# if address@hidden@
 /* Change the size of the file to which FD is opened to become equal to LENGTH.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
-extern int ftruncate (int fd, off_t length);
+# if address@hidden@
+_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
 # endif
+_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIASWARN (ftruncate);
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
+# if HAVE_RAW_DECL_FTRUNCATE
+_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
+                 "use gnulib module ftruncate for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETCWD@
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-# include <stdlib.h>
-# if @REPLACE_GETCWD@
 /* Get the name of the current working directory, and put it in SIZE bytes
    of BUF.
    Return BUF if successful, or NULL if the directory couldn't be determined
@@ -360,15 +458,22 @@ extern int ftruncate (int fd, off_t length);
    extension: If BUF is NULL, an array is allocated with 'malloc'; the array
    is SIZE bytes long, unless SIZE == 0, in which case it is as big as
    necessary.  */
-#  define getcwd rpl_getcwd
-extern char * getcwd (char *buf, size_t size);
+# if @REPLACE_GETCWD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define getcwd rpl_getcwd
+#  endif
+_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
+_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
+# else
+_GL_CXXALIAS_SYS (getcwd, char *, (char *buf, size_t size));
 # endif
+_GL_CXXALIASWARN (getcwd);
 #elif defined GNULIB_POSIXCHECK
 # undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
+# if HAVE_RAW_DECL_GETCWD
+_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
+                 "use gnulib module getcwd for portability");
+# endif
 #endif
 
 
@@ -384,51 +489,65 @@ extern char * getcwd (char *buf, size_t size);
    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
    Return 0 if successful, otherwise set errno and return -1.  */
 # if address@hidden@
-extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
+                                      _GL_ARG_NONNULL ((1)));
 # endif
+/* Need to cast, because on MacOS X 10.5 systems, the second parameter is
+                                                        int len.  */
+_GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len));
+_GL_CXXALIASWARN (getdomainname);
 #elif defined GNULIB_POSIXCHECK
 # undef getdomainname
-# define getdomainname(n,l) \
-    (GL_LINK_WARNING ("getdomainname is unportable - " \
-                      "use gnulib module getdomainname for portability"), \
-     getdomainname (n, l))
+# if HAVE_RAW_DECL_GETDOMAINNAME
+_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
+                 "use gnulib module getdomainname for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETDTABLESIZE@
-# if address@hidden@
 /* Return the maximum number of file descriptors in the current process.
    In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
-extern int getdtablesize (void);
+# if address@hidden@
+_GL_FUNCDECL_SYS (getdtablesize, int, (void));
 # endif
+_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+_GL_CXXALIASWARN (getdtablesize);
 #elif defined GNULIB_POSIXCHECK
 # undef getdtablesize
-# define getdtablesize() \
-    (GL_LINK_WARNING ("getdtablesize is unportable - " \
-                      "use gnulib module getdtablesize for portability"), \
-     getdtablesize ())
+# if HAVE_RAW_DECL_GETDTABLESIZE
+_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
+                 "use gnulib module getdtablesize for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETGROUPS@
-# if @REPLACE_GETGROUPS@
-#  undef getgroups
-#  define getgroups rpl_getgroups
-# endif
-# if address@hidden@ || @REPLACE_GETGROUPS@
 /* Return the supplemental groups that the current process belongs to.
    It is unspecified whether the effective group id is in the list.
    If N is 0, return the group count; otherwise, N describes how many
    entries are available in GROUPS.  Return -1 and set errno if N is
    not 0 and not large enough.  Fails with ENOSYS on some systems.  */
-int getgroups (int n, gid_t *groups);
+# if @REPLACE_GETGROUPS@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef getgroups
+#   define getgroups rpl_getgroups
+#  endif
+_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
+_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
+#  endif
+_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
 # endif
+_GL_CXXALIASWARN (getgroups);
 #elif defined GNULIB_POSIXCHECK
 # undef getgroups
-# define getgroups(n,g)                                                 \
-    (GL_LINK_WARNING ("getgroups is unportable - "                      \
-                      "use gnulib module getgroups for portability"),   \
-     getgroups (n, g))
+# if HAVE_RAW_DECL_GETGROUPS
+_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
+                 "use gnulib module getgroups for portability");
+# endif
 #endif
 
 
@@ -441,21 +560,57 @@ int getgroups (int n, gid_t *groups);
    If the host name is longer than LEN, set errno = EINVAL and return -1.
    Return 0 if successful, otherwise set errno and return -1.  */
 # if @UNISTD_H_HAVE_WINSOCK2_H@
-#  undef gethostname
-#  define gethostname rpl_gethostname
-# endif
-# if @UNISTD_H_HAVE_WINSOCK2_H@ || address@hidden@
-extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname rpl_gethostname
+#  endif
+_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+#  endif
+/* Need to cast, because on Solaris 10 systems, the second parameter is
+                                                      int len.  */
+_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
 # endif
+_GL_CXXALIASWARN (gethostname);
 #elif @UNISTD_H_HAVE_WINSOCK2_H@
 # undef gethostname
 # define gethostname 
gethostname_used_without_requesting_gnulib_module_gethostname
 #elif defined GNULIB_POSIXCHECK
 # undef gethostname
-# define gethostname(n,l) \
-    (GL_LINK_WARNING ("gethostname is unportable - " \
-                      "use gnulib module gethostname for portability"), \
-     gethostname (n, l))
+# if HAVE_RAW_DECL_GETHOSTNAME
+_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
+                 "use gnulib module gethostname for portability");
+# endif
+#endif
+
+
+#if @GNULIB_GETLOGIN@
+/* Returns the user's login name, or NULL if it cannot be found.  Upon error,
+   returns NULL with errno set.
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
+ */
+# if address@hidden@
+_GL_FUNCDECL_SYS (getlogin, char *, (void));
+# endif
+_GL_CXXALIAS_SYS (getlogin, char *, (void));
+_GL_CXXALIASWARN (getlogin);
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin
+# if HAVE_RAW_DECL_GETLOGIN
+_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
+                 "use gnulib module getlogin for portability");
+# endif
 #endif
 
 
@@ -468,186 +623,272 @@ extern int gethostname(char *name, size_t len) 
_GL_ARG_NONNULL ((1));
    provided (this case is hopefully rare but is left open by the POSIX spec).
 
    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+
+   Most programs don't need to use this function, because the information is
+   available through environment variables:
+     ${LOGNAME-$USER}        on Unix platforms,
+     $USERNAME               on native Windows platforms.
  */
 # if address@hidden@
-extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
+                                   _GL_ARG_NONNULL ((1)));
 # endif
+/* Need to cast, because on Solaris 10 systems, the second argument is
+                                                     int size.  */
+_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
+_GL_CXXALIASWARN (getlogin_r);
 #elif defined GNULIB_POSIXCHECK
 # undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
+# if HAVE_RAW_DECL_GETLOGIN_R
+_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
+                 "use gnulib module getlogin_r for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETPAGESIZE@
 # if @REPLACE_GETPAGESIZE@
-#  define getpagesize rpl_getpagesize
-extern int getpagesize (void);
-# elif address@hidden@
-/* This is for POSIX systems.  */
-#  if !defined getpagesize && defined _SC_PAGESIZE
-#   if ! (defined __VMS && __VMS_VER < 70000000)
-#    define getpagesize() sysconf (_SC_PAGESIZE)
-#   endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define getpagesize rpl_getpagesize
 #  endif
+_GL_FUNCDECL_RPL (getpagesize, int, (void));
+_GL_CXXALIAS_RPL (getpagesize, int, (void));
+# else
+#  if address@hidden@
+#   if !defined getpagesize
+/* This is for POSIX systems.  */
+#    if !defined _gl_getpagesize && defined _SC_PAGESIZE
+#     if ! (defined __VMS && __VMS_VER < 70000000)
+#      define _gl_getpagesize() sysconf (_SC_PAGESIZE)
+#     endif
+#    endif
 /* This is for older VMS.  */
-#  if !defined getpagesize && defined __VMS
-#   ifdef __ALPHA
-#    define getpagesize() 8192
-#   else
-#    define getpagesize() 512
-#   endif
-#  endif
+#    if !defined _gl_getpagesize && defined __VMS
+#     ifdef __ALPHA
+#      define _gl_getpagesize() 8192
+#     else
+#      define _gl_getpagesize() 512
+#     endif
+#    endif
 /* This is for BeOS.  */
-#  if !defined getpagesize && @HAVE_OS_H@
-#   include <OS.h>
-#   if defined B_PAGE_SIZE
-#    define getpagesize() B_PAGE_SIZE
-#   endif
-#  endif
+#    if !defined _gl_getpagesize && @HAVE_OS_H@
+#     include <OS.h>
+#     if defined B_PAGE_SIZE
+#      define _gl_getpagesize() B_PAGE_SIZE
+#     endif
+#    endif
 /* This is for AmigaOS4.0.  */
-#  if !defined getpagesize && defined __amigaos4__
-#   define getpagesize() 2048
-#  endif
+#    if !defined _gl_getpagesize && defined __amigaos4__
+#     define _gl_getpagesize() 2048
+#    endif
 /* This is for older Unix systems.  */
-#  if !defined getpagesize && @HAVE_SYS_PARAM_H@
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else
-#    ifdef NBPG
-#     ifndef CLSIZE
-#      define CLSIZE 1
+#    if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
+#     include <sys/param.h>
+#     ifdef EXEC_PAGESIZE
+#      define _gl_getpagesize() EXEC_PAGESIZE
+#     else
+#      ifdef NBPG
+#       ifndef CLSIZE
+#        define CLSIZE 1
+#       endif
+#       define _gl_getpagesize() (NBPG * CLSIZE)
+#      else
+#       ifdef NBPC
+#        define _gl_getpagesize() NBPC
+#       endif
+#      endif
 #     endif
-#     define getpagesize() (NBPG * CLSIZE)
+#    endif
+#    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#     define getpagesize() _gl_getpagesize ()
 #    else
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     endif
+static inline int
+getpagesize ()
+{
+  return _gl_getpagesize ();
+}
 #    endif
 #   endif
 #  endif
+/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t.  
*/
+_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
 # endif
+_GL_CXXALIASWARN (getpagesize);
 #elif defined GNULIB_POSIXCHECK
 # undef getpagesize
-# define getpagesize() \
-    (GL_LINK_WARNING ("getpagesize is unportable - " \
-                      "use gnulib module getpagesize for portability"), \
-     getpagesize ())
+# if HAVE_RAW_DECL_GETPAGESIZE
+_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
+                 "use gnulib module getpagesize for portability");
+# endif
 #endif
 
 
 #if @GNULIB_GETUSERSHELL@
-# if address@hidden@
 /* Return the next valid login shell on the system, or NULL when the end of
    the list has been reached.  */
-extern char *getusershell (void);
+# if address@hidden@
+_GL_FUNCDECL_SYS (getusershell, char *, (void));
+# endif
+_GL_CXXALIAS_SYS (getusershell, char *, (void));
+_GL_CXXALIASWARN (getusershell);
+#elif defined GNULIB_POSIXCHECK
+# undef getusershell
+# if HAVE_RAW_DECL_GETUSERSHELL
+_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
+#endif
+
+#if @GNULIB_GETUSERSHELL@
 /* Rewind to pointer that is advanced at each getusershell() call.  */
-extern void setusershell (void);
+# if address@hidden@
+_GL_FUNCDECL_SYS (setusershell, void, (void));
+# endif
+_GL_CXXALIAS_SYS (setusershell, void, (void));
+_GL_CXXALIASWARN (setusershell);
+#elif defined GNULIB_POSIXCHECK
+# undef setusershell
+# if HAVE_RAW_DECL_SETUSERSHELL
+_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
+#endif
+
+#if @GNULIB_GETUSERSHELL@
 /* Free the pointer that is advanced at each getusershell() call and
    associated resources.  */
-extern void endusershell (void);
+# if address@hidden@
+_GL_FUNCDECL_SYS (endusershell, void, (void));
 # endif
+_GL_CXXALIAS_SYS (endusershell, void, (void));
+_GL_CXXALIASWARN (endusershell);
 #elif defined GNULIB_POSIXCHECK
-# undef getusershell
-# define getusershell() \
-    (GL_LINK_WARNING ("getusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     getusershell ())
-# undef setusershell
-# define setusershell() \
-    (GL_LINK_WARNING ("setusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     setusershell ())
 # undef endusershell
-# define endusershell() \
-    (GL_LINK_WARNING ("endusershell is unportable - " \
-                      "use gnulib module getusershell for portability"), \
-     endusershell ())
+# if HAVE_RAW_DECL_ENDUSERSHELL
+_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
+                 "use gnulib module getusershell for portability");
+# endif
 #endif
 
 
 #if @GNULIB_LCHOWN@
-# if @REPLACE_LCHOWN@
-#  undef lchown
-#  define lchown rpl_lchown
-# endif
-# if address@hidden@ || @REPLACE_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-extern int lchown (char const *file, uid_t owner, gid_t group)
-     _GL_ARG_NONNULL ((1));
+# if @REPLACE_LCHOWN@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef lchown
+#   define lchown rpl_lchown
+#  endif
+_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
+                               _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
+                               _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
 # endif
+_GL_CXXALIASWARN (lchown);
 #elif defined GNULIB_POSIXCHECK
 # undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
+# if HAVE_RAW_DECL_LCHOWN
+_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
+                 "use gnulib module lchown for portability");
+# endif
 #endif
 
 
 #if @GNULIB_LINK@
-# if @REPLACE_LINK@
-#  define link rpl_link
-# endif
 /* Create a new hard link for an existing file.
    Return 0 if successful, otherwise -1 and errno set.
    See POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/link.html>.  */
-# if address@hidden@ || @REPLACE_LINK@
-extern int link (const char *path1, const char *path2)
-     _GL_ARG_NONNULL ((1, 2));
+# if @REPLACE_LINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define link rpl_link
+#  endif
+_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
+                             _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
+                             _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
 # endif
+_GL_CXXALIASWARN (link);
 #elif defined GNULIB_POSIXCHECK
 # undef link
-# define link(path1,path2) \
-    (GL_LINK_WARNING ("link is unportable - " \
-                      "use gnulib module link for portability"), \
-     link (path1, path2))
+# if HAVE_RAW_DECL_LINK
+_GL_WARN_ON_USE (link, "link is unportable - "
+                 "use gnulib module link for portability");
+# endif
 #endif
 
+
 #if @GNULIB_LINKAT@
-# if @REPLACE_LINKAT@
-#  undef linkat
-#  define linkat rpl_linkat
-# endif
 /* Create a new hard link for an existing file, relative to two
    directories.  FLAG controls whether symlinks are followed.
    Return 0 if successful, otherwise -1 and errno set.  */
-# if address@hidden@ || @REPLACE_LINKAT@
-extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
+# if @REPLACE_LINKAT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef linkat
+#   define linkat rpl_linkat
+#  endif
+_GL_FUNCDECL_RPL (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
                    int flag)
-     _GL_ARG_NONNULL ((2, 4));
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag)
+                  _GL_ARG_NONNULL ((2, 4)));
+#  endif
+_GL_CXXALIAS_SYS (linkat, int,
+                  (int fd1, const char *path1, int fd2, const char *path2,
+                   int flag));
 # endif
+_GL_CXXALIASWARN (linkat);
 #elif defined GNULIB_POSIXCHECK
 # undef linkat
-# define link(f1,path1,f2,path2,f)              \
-    (GL_LINK_WARNING ("linkat is unportable - " \
-                      "use gnulib module linkat for portability"), \
-     linkat (f1, path1, f2, path2,f))
+# if HAVE_RAW_DECL_LINKAT
+_GL_WARN_ON_USE (linkat, "linkat is unportable - "
+                 "use gnulib module linkat for portability");
+# endif
 #endif
 
+
 #if @GNULIB_LSEEK@
-# if @REPLACE_LSEEK@
 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
    Return the new offset if successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/lseek.html>.  */
-#  define lseek rpl_lseek
-   extern off_t lseek (int fd, off_t offset, int whence);
+# if @REPLACE_LSEEK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define lseek rpl_lseek
+#  endif
+_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
+# else
+_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
 # endif
+_GL_CXXALIASWARN (lseek);
 #elif defined GNULIB_POSIXCHECK
 # undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
+# if HAVE_RAW_DECL_LSEEK
+_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
+                 "systems - use gnulib module lseek for portability");
+# endif
 #endif
 
 
@@ -661,209 +902,294 @@ extern int linkat (int fd1, const char *path1, int fd2, 
const char *path2,
    See also the Linux man page at
    <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>.  */
 # if @HAVE_PIPE2@
-#  define pipe2 rpl_pipe2
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define pipe2 rpl_pipe2
+#  endif
+_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
+# else
+_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
 # endif
-extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
+_GL_CXXALIASWARN (pipe2);
 #elif defined GNULIB_POSIXCHECK
 # undef pipe2
-# define pipe2(f,o) \
-    (GL_LINK_WARNING ("pipe2 is unportable - " \
-                      "use gnulib module pipe2 for portability"), \
-     pipe2 (f, o))
+# if HAVE_RAW_DECL_PIPE2
+_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
+                 "use gnulib module pipe2 for portability");
+# endif
 #endif
 
 
 #if @GNULIB_PREAD@
-# if @REPLACE_PREAD@
-#  define pread rpl_pread
-# endif
 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
    Return the number of bytes placed into BUF if successful, otherwise
    set errno and return -1.  0 indicates EOF.  See the POSIX:2001
    specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
-# if address@hidden@ || @REPLACE_PREAD@
-  extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
-       _GL_ARG_NONNULL ((2));
+# if @REPLACE_PREAD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define pread rpl_pread
+#  endif
+_GL_FUNCDECL_RPL (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (pread, ssize_t,
+                  (int fd, void *buf, size_t bufsize, off_t offset));
 # endif
+_GL_CXXALIASWARN (pread);
 #elif defined GNULIB_POSIXCHECK
 # undef pread
-# define pread(f,b,s,o)                        \
-    (GL_LINK_WARNING ("pread is unportable - " \
-                      "use gnulib module pread for portability"), \
-     pread (f, b, s, o))
+# if HAVE_RAW_DECL_PREAD
+_GL_WARN_ON_USE (pread, "pread is unportable - "
+                 "use gnulib module pread for portability");
+# endif
 #endif
 
 
 #if @GNULIB_READLINK@
-# if @REPLACE_READLINK@
-#  define readlink rpl_readlink
-# endif
 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
    bytes of it into BUF.  Return the number of bytes placed into BUF if
    successful, otherwise -1 and errno set.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
-# if address@hidden@ || @REPLACE_READLINK@
-extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
-     _GL_ARG_NONNULL ((1, 2));
+# if @REPLACE_READLINK@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define readlink rpl_readlink
+#  endif
+_GL_FUNCDECL_RPL (readlink, ssize_t,
+                  (const char *file, char *buf, size_t bufsize)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (readlink, ssize_t,
+                  (const char *file, char *buf, size_t bufsize));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (readlink, ssize_t,
+                  (const char *file, char *buf, size_t bufsize)
+                  _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (readlink, ssize_t,
+                  (const char *file, char *buf, size_t bufsize));
 # endif
+_GL_CXXALIASWARN (readlink);
 #elif defined GNULIB_POSIXCHECK
 # undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
+# if HAVE_RAW_DECL_READLINK
+_GL_WARN_ON_USE (readlink, "readlink is unportable - "
+                 "use gnulib module readlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_READLINKAT@
 # if address@hidden@
-extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
-     _GL_ARG_NONNULL ((2, 3));
+_GL_FUNCDECL_SYS (readlinkat, ssize_t,
+                  (int fd, char const *file, char *buf, size_t len)
+                  _GL_ARG_NONNULL ((2, 3)));
 # endif
+_GL_CXXALIAS_SYS (readlinkat, ssize_t,
+                  (int fd, char const *file, char *buf, size_t len));
+_GL_CXXALIASWARN (readlinkat);
 #elif defined GNULIB_POSIXCHECK
 # undef readlinkat
-# define readlinkat(d,n,b,l)                         \
-    (GL_LINK_WARNING ("readlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     readlinkat (d, n, b, l))
+# if HAVE_RAW_DECL_READLINKAT
+_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_RMDIR@
-# if @REPLACE_RMDIR@
-#  define rmdir rpl_rmdir
 /* Remove the directory DIR.  */
-extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
+# if @REPLACE_RMDIR@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define rmdir rpl_rmdir
+#  endif
+_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
+# else
+_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
 # endif
+_GL_CXXALIASWARN (rmdir);
 #elif defined GNULIB_POSIXCHECK
 # undef rmdir
-# define rmdir(n) \
-    (GL_LINK_WARNING ("rmdir is unportable - " \
-                      "use gnulib module rmdir for portability"), \
-     rmdir (n))
+# if HAVE_RAW_DECL_RMDIR
+_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
+                 "use gnulib module rmdir for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SLEEP@
-# if @REPLACE_SLEEP@
-#  undef sleep
-#  define sleep rpl_sleep
-# endif
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if address@hidden@ || @REPLACE_SLEEP@
-extern unsigned int sleep (unsigned int n);
+# if @REPLACE_SLEEP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef sleep
+#   define sleep rpl_sleep
+#  endif
+_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
+_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
+#  endif
+_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
 # endif
+_GL_CXXALIASWARN (sleep);
 #elif defined GNULIB_POSIXCHECK
 # undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
+# if HAVE_RAW_DECL_SLEEP
+_GL_WARN_ON_USE (sleep, "sleep is unportable - "
+                 "use gnulib module sleep for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SYMLINK@
 # if @REPLACE_SYMLINK@
-#  undef symlink
-#  define symlink rpl_symlink
-# endif
-# if address@hidden@ || @REPLACE_SYMLINK@
-extern int symlink (char const *contents, char const *file)
-     _GL_ARG_NONNULL ((1, 2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef symlink
+#   define symlink rpl_symlink
+#  endif
+_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
+                                _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
+                                _GL_ARG_NONNULL ((1, 2)));
+#  endif
+_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
 # endif
+_GL_CXXALIASWARN (symlink);
 #elif defined GNULIB_POSIXCHECK
 # undef symlink
-# define symlink(c,n)                        \
-    (GL_LINK_WARNING ("symlink is not portable - " \
-                      "use gnulib module symlink for portability"), \
-     symlink (c, n))
+# if HAVE_RAW_DECL_SYMLINK
+_GL_WARN_ON_USE (symlink, "symlink is not portable - "
+                 "use gnulib module symlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_SYMLINKAT@
 # if address@hidden@
-extern int symlinkat (char const *contents, int fd, char const *file)
-     _GL_ARG_NONNULL ((1, 3));
+_GL_FUNCDECL_SYS (symlinkat, int,
+                  (char const *contents, int fd, char const *file)
+                  _GL_ARG_NONNULL ((1, 3)));
 # endif
+_GL_CXXALIAS_SYS (symlinkat, int,
+                  (char const *contents, int fd, char const *file));
+_GL_CXXALIASWARN (symlinkat);
 #elif defined GNULIB_POSIXCHECK
 # undef symlinkat
-# define symlinkat(c,d,n)                            \
-    (GL_LINK_WARNING ("symlinkat is not portable - " \
-                      "use gnulib module symlinkat for portability"), \
-     symlinkat (c, d, n))
+# if HAVE_RAW_DECL_SYMLINKAT
+_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
+                 "use gnulib module symlinkat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_UNLINK@
 # if @REPLACE_UNLINK@
-#  undef unlink
-#  define unlink rpl_unlink
-extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlink
+#   define unlink rpl_unlink
+#  endif
+_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (unlink, int, (char const *file));
+# else
+_GL_CXXALIAS_SYS (unlink, int, (char const *file));
 # endif
+_GL_CXXALIASWARN (unlink);
 #elif defined GNULIB_POSIXCHECK
 # undef unlink
-# define unlink(n)                         \
-    (GL_LINK_WARNING ("unlink is not portable - " \
-                      "use gnulib module unlink for portability"), \
-     unlink (n))
+# if HAVE_RAW_DECL_UNLINK
+_GL_WARN_ON_USE (unlink, "unlink is not portable - "
+                 "use gnulib module unlink for portability");
+# endif
 #endif
 
 
 #if @GNULIB_UNLINKAT@
 # if @REPLACE_UNLINKAT@
-#  undef unlinkat
-#  define unlinkat rpl_unlinkat
-# endif
-# if address@hidden@ || @REPLACE_UNLINKAT@
-extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef unlinkat
+#   define unlinkat rpl_unlinkat
+#  endif
+_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
+                                 _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
 # endif
+_GL_CXXALIASWARN (unlinkat);
 #elif defined GNULIB_POSIXCHECK
 # undef unlinkat
-# define unlinkat(d,n,f)                         \
-    (GL_LINK_WARNING ("unlinkat is not portable - " \
-                      "use gnulib module openat for portability"), \
-     unlinkat (d, n, f))
+# if HAVE_RAW_DECL_UNLINKAT
+_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
+                 "use gnulib module openat for portability");
+# endif
 #endif
 
 
 #if @GNULIB_USLEEP@
-# if @REPLACE_USLEEP@
-#  undef usleep
-#  define usleep rpl_usleep
-# endif
-# if address@hidden@ || @REPLACE_USLEEP@
 /* Pause the execution of the current thread for N microseconds.
    Returns 0 on completion, or -1 on range error.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-extern int usleep (useconds_t n);
+# if @REPLACE_USLEEP@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef usleep
+#   define usleep rpl_usleep
+#  endif
+_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
+_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
+#  endif
+_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
 # endif
+_GL_CXXALIASWARN (usleep);
 #elif defined GNULIB_POSIXCHECK
 # undef usleep
-# define usleep(n) \
-    (GL_LINK_WARNING ("usleep is unportable - " \
-                      "use gnulib module usleep for portability"), \
-     usleep (n))
+# if HAVE_RAW_DECL_USLEEP
+_GL_WARN_ON_USE (usleep, "usleep is unportable - "
+                 "use gnulib module usleep for portability");
+# endif
 #endif
 
 
-#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+#if @GNULIB_WRITE@
 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
    See the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/write.html>.  */
-# undef write
-# define write rpl_write
-extern ssize_t write (int fd, const void *buf, size_t count)
-     _GL_ARG_NONNULL ((2));
-#endif
-
-
-#ifdef __cplusplus
-}
+# if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef write
+#   define write rpl_write
+#  endif
+_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
+                                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
+# else
+_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
+# endif
+_GL_CXXALIASWARN (write);
 #endif
 
 
diff --git a/lib/unistr.h b/lib/unistr.h
index 35cd2da..26a3e33 100644
--- a/lib/unistr.h
+++ b/lib/unistr.h
@@ -1,5 +1,5 @@
 /* Elementary Unicode string functions.
-   Copyright (C) 2001-2002, 2005-2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2005-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
@@ -19,6 +19,9 @@
 
 #include "unitypes.h"
 
+/* Get common macros for C.  */
+#include "unused-parameter.h"
+
 /* Get bool.  */
 #include <stdbool.h>
 
@@ -183,7 +186,8 @@ extern int
        u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n);
 # else
 static inline int
-u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc_unsafe (ucs4_t *puc,
+                   const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
 {
   uint32_t c = *s;
 
@@ -253,7 +257,7 @@ extern int
        u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n);
 # else
 static inline int
-u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _UNUSED_PARAMETER_)
+u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER)
 {
   uint32_t c = *s;
 
@@ -525,8 +529,8 @@ extern uint16_t *
 extern uint32_t *
        u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
 
-/* Copy no more than N units of SRC to DEST, returning the address of
-   the last unit written into DEST.  */
+/* Copy no more than N units of SRC to DEST.  Return a pointer past the last
+   non-NUL unit written into DEST.  */
 /* Similar to stpncpy().  */
 extern uint8_t *
        u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);
diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c
index e0d20d9..c997589 100644
--- a/lib/unistr/u8-mbtouc-aux.c
+++ b/lib/unistr/u8-mbtouc-aux.c
@@ -1,5 +1,5 @@
 /* Conversion UTF-8 to UCS-4.
-   Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c 
b/lib/unistr/u8-mbtouc-unsafe-aux.c
index 5318863..47590e3 100644
--- a/lib/unistr/u8-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u8-mbtouc-unsafe-aux.c
@@ -1,5 +1,5 @@
 /* Conversion UTF-8 to UCS-4.
-   Copyright (C) 2001-2002, 2006-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c
index 0772c0b..41583f9 100644
--- a/lib/unistr/u8-mbtouc-unsafe.c
+++ b/lib/unistr/u8-mbtouc-unsafe.c
@@ -1,5 +1,5 @@
 /* Look at first character in UTF-8 string.
-   Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c
index 2c29279..96cd5b7 100644
--- a/lib/unistr/u8-mbtouc.c
+++ b/lib/unistr/u8-mbtouc.c
@@ -1,5 +1,5 @@
 /* Look at first character in UTF-8 string.
-   Copyright (C) 1999-2002, 2006-2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index c93ec88..a749c48 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -1,5 +1,5 @@
 /* Look at first character in UTF-8 string, returning an error code.
-   Copyright (C) 1999-2002, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999-2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2001.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c
index e97884e..97a27f5 100644
--- a/lib/unistr/u8-prev.c
+++ b/lib/unistr/u8-prev.c
@@ -1,5 +1,5 @@
 /* Iterate over previous character in UTF-8 string.
-   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index 5a6b6b5..695921d 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -1,5 +1,5 @@
 /* Conversion UCS-4 to UTF-8.
-   Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2006-2007, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index 81e41ad..fd33c05 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -1,5 +1,5 @@
 /* Store a character in UTF-8 string.
-   Copyright (C) 2002, 2005-2006, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2002.
 
    This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unitypes.h b/lib/unitypes.h
index fe8d877..3e524f8 100644
--- a/lib/unitypes.h
+++ b/lib/unitypes.h
@@ -1,5 +1,5 @@
 /* Elementary types for the GNU UniString library.
-   Copyright (C) 2002, 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU Lesser General Public License as published
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index e218500..3d7955b 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -2367,7 +2367,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     {
                       /* Use only as many wide characters as needed to produce
                          at most PRECISION bytes, from the left.  */
-#  if HAVE_WCRTOMB
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                       mbstate_t state;
                       memset (&state, '\0', sizeof (mbstate_t));
 #  endif
@@ -2381,7 +2381,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           if (*arg_end == 0)
                             /* Found the terminating null wide character.  */
                             break;
-#  if HAVE_WCRTOMB
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                           count = wcrtomb (cbuf, *arg_end, &state);
 #  else
                           count = wctomb (cbuf, *arg_end);
@@ -2412,7 +2412,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     {
                       /* Use the entire string, and count the number of
                          bytes.  */
-#  if HAVE_WCRTOMB
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                       mbstate_t state;
                       memset (&state, '\0', sizeof (mbstate_t));
 #  endif
@@ -2426,7 +2426,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                           if (*arg_end == 0)
                             /* Found the terminating null wide character.  */
                             break;
-#  if HAVE_WCRTOMB
+#  if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                           count = wcrtomb (cbuf, *arg_end, &state);
 #  else
                           count = wctomb (cbuf, *arg_end);
@@ -2464,7 +2464,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                   {
                     TCHAR_T *tmpptr = tmpsrc;
                     size_t remaining;
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                     mbstate_t state;
                     memset (&state, '\0', sizeof (mbstate_t));
 #   endif
@@ -2475,7 +2475,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
                         if (*arg == 0)
                           abort ();
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                         count = wcrtomb (cbuf, *arg, &state);
 #   else
                         count = wctomb (cbuf, *arg);
@@ -2545,7 +2545,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     {
                       /* We know the number of bytes in advance.  */
                       size_t remaining;
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                       mbstate_t state;
                       memset (&state, '\0', sizeof (mbstate_t));
 #   endif
@@ -2557,7 +2557,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
                           if (*arg == 0)
                             abort ();
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                           count = wcrtomb (cbuf, *arg, &state);
 #   else
                           count = wctomb (cbuf, *arg);
@@ -2575,7 +2575,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                     }
                   else
                     {
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                       mbstate_t state;
                       memset (&state, '\0', sizeof (mbstate_t));
 #   endif
@@ -2586,7 +2586,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 
                           if (*arg == 0)
                             abort ();
-#   if HAVE_WCRTOMB
+#   if HAVE_WCRTOMB && !defined GNULIB_defined_mbstate_t
                           count = wcrtomb (cbuf, *arg, &state);
 #   else
                           count = wctomb (cbuf, *arg);
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index 5ceab44..b55faf5 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -1,5 +1,5 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007-2008 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -25,15 +25,14 @@
 #include <stddef.h>
 
 #ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   We enable __attribute__ only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
+#  define __attribute__(Spec)   /* empty */
 # endif
 #endif
 
diff --git a/lib/verify.h b/lib/verify.h
index 152a9fa..7773c79 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c
index efbb37e..926a696 100644
--- a/lib/version-etc-fsf.c
+++ b/lib/version-etc-fsf.c
@@ -1,5 +1,5 @@
 /* Variable with FSF copyright information, for version-etc.
-   Copyright (C) 1999-2006 Free Software Foundation, Inc.
+   Copyright (C) 1999-2006, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/version-etc.c b/lib/version-etc.c
index 35f3626..2648c9a 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999-2009 Free Software Foundation, Inc.
+   Copyright (C) 1999-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -38,7 +38,7 @@
 # define PACKAGE PACKAGE_TARNAME
 #endif
 
-enum { COPYRIGHT_YEAR = 2009 };
+enum { COPYRIGHT_YEAR = 2010 };
 
 /* The three functions below display the --version information the
    standard way.
diff --git a/lib/version-etc.h b/lib/version-etc.h
index b01d7ca..1cbbe32 100644
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -1,5 +1,5 @@
 /* Print --version and bug-reporting information in a consistent format.
-   Copyright (C) 1999, 2003, 2005, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2003, 2005, 2009-2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index c5ddd8e..35eba15 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -1,5 +1,5 @@
 /* Formatted output to strings.
-   Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006-2010 Free Software Foundation, Inc.
    Written by Simon Josefsson and Yoann Vandoorselaere <address@hidden>.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index b0cf255..28bfa06 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
 
-   Copyright (C) 2007-2009 Free Software Foundation, Inc.
+   Copyright (C) 2007-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
@@ -30,9 +30,9 @@
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
-#if defined __need_mbstate_t || (defined __hpux && ((defined 
_INTTYPES_INCLUDED && !defined strtoimax) || defined 
_GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
+#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && 
((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined 
_GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
 /* Special invocation convention:
-   - Inside uClibc header files.
+   - Inside glibc and uClibc header files.
    - On HP-UX 11.00 we have a sequence of nested includes
      <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
      once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
@@ -55,10 +55,13 @@
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
    <wchar.h>.
    BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
+   included before <wchar.h>.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <stddef.h>
+# include <stdio.h>
+# include <time.h>
+#endif
 
 /* Include the original <wchar.h> if it exists.
    Some builds of uClibc lack it.  */
@@ -72,13 +75,11 @@
 #ifndef _GL_WCHAR_H
 #define _GL_WCHAR_H
 
-/* The definition of GL_LINK_WARNING is copied here.  */
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
 
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* The definition of _GL_WARN_ON_USE is copied here.  */
 
 
 /* Define wint_t.  (Also done in wctype.in.h.)  */
@@ -104,213 +105,320 @@ typedef int rpl_mbstate_t;
 /* Convert a single-byte character to a wide character.  */
 #if @GNULIB_BTOWC@
 # if @REPLACE_BTOWC@
-#  undef btowc
-#  define btowc rpl_btowc
-# endif
-# if address@hidden@ || @REPLACE_BTOWC@
-extern wint_t btowc (int c);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef btowc
+#   define btowc rpl_btowc
+#  endif
+_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
+_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
+#  endif
+_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
 # endif
+_GL_CXXALIASWARN (btowc);
 #elif defined GNULIB_POSIXCHECK
 # undef btowc
-# define btowc(c) \
-    (GL_LINK_WARNING ("btowc is unportable - " \
-                      "use gnulib module btowc for portability"), \
-     btowc (c))
+# if HAVE_RAW_DECL_BTOWC
+_GL_WARN_ON_USE (btowc, "btowc is unportable - "
+                 "use gnulib module btowc for portability");
+# endif
 #endif
 
 
 /* Convert a wide character to a single-byte character.  */
 #if @GNULIB_WCTOB@
 # if @REPLACE_WCTOB@
-#  undef wctob
-#  define wctob rpl_wctob
-# endif
-# if (!defined wctob && address@hidden@) || @REPLACE_WCTOB@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wctob
+#   define wctob rpl_wctob
+#  endif
+_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
+_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
+# else
+#  if !defined wctob && address@hidden@
 /* wctob is provided by gnulib, or wctob exists but is not declared.  */
-extern int wctob (wint_t wc);
+_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
+#  endif
+_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
 # endif
+_GL_CXXALIASWARN (wctob);
 #elif defined GNULIB_POSIXCHECK
 # undef wctob
-# define wctob(w) \
-    (GL_LINK_WARNING ("wctob is unportable - " \
-                      "use gnulib module wctob for portability"), \
-     wctob (w))
+# if HAVE_RAW_DECL_WCTOB
+_GL_WARN_ON_USE (wctob, "wctob is unportable - "
+                 "use gnulib module wctob for portability");
+# endif
 #endif
 
 
 /* Test whether *PS is in the initial state.  */
 #if @GNULIB_MBSINIT@
 # if @REPLACE_MBSINIT@
-#  undef mbsinit
-#  define mbsinit rpl_mbsinit
-# endif
-# if address@hidden@ || @REPLACE_MBSINIT@
-extern int mbsinit (const mbstate_t *ps);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsinit
+#   define mbsinit rpl_mbsinit
+#  endif
+_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (mbsinit);
 #elif defined GNULIB_POSIXCHECK
 # undef mbsinit
-# define mbsinit(p) \
-    (GL_LINK_WARNING ("mbsinit is unportable - " \
-                      "use gnulib module mbsinit for portability"), \
-     mbsinit (p))
+# if HAVE_RAW_DECL_MBSINIT
+_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
+                 "use gnulib module mbsinit for portability");
+# endif
 #endif
 
 
 /* Convert a multibyte character to a wide character.  */
 #if @GNULIB_MBRTOWC@
 # if @REPLACE_MBRTOWC@
-#  undef mbrtowc
-#  define mbrtowc rpl_mbrtowc
-# endif
-# if address@hidden@ || @REPLACE_MBRTOWC@
-extern size_t mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrtowc
+#   define mbrtowc rpl_mbrtowc
+#  endif
+_GL_FUNCDECL_RPL (mbrtowc, size_t,
+                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbrtowc, size_t,
+                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbrtowc, size_t,
+                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrtowc, size_t,
+                  (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (mbrtowc);
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtowc
-# define mbrtowc(w,s,n,p) \
-    (GL_LINK_WARNING ("mbrtowc is unportable - " \
-                      "use gnulib module mbrtowc for portability"), \
-     mbrtowc (w, s, n, p))
+# if HAVE_RAW_DECL_MBRTOWC
+_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
+                 "use gnulib module mbrtowc for portability");
+# endif
 #endif
 
 
 /* Recognize a multibyte character.  */
 #if @GNULIB_MBRLEN@
 # if @REPLACE_MBRLEN@
-#  undef mbrlen
-#  define mbrlen rpl_mbrlen
-# endif
-# if address@hidden@ || @REPLACE_MBRLEN@
-extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbrlen
+#   define mbrlen rpl_mbrlen
+#  endif
+_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
+_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (mbrlen);
 #elif defined GNULIB_POSIXCHECK
 # undef mbrlen
-# define mbrlen(s,n,p) \
-    (GL_LINK_WARNING ("mbrlen is unportable - " \
-                      "use gnulib module mbrlen for portability"), \
-     mbrlen (s, n, p))
+# if HAVE_RAW_DECL_MBRLEN
+_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
+                 "use gnulib module mbrlen for portability");
+# endif
 #endif
 
 
 /* Convert a string to a wide string.  */
 #if @GNULIB_MBSRTOWCS@
 # if @REPLACE_MBSRTOWCS@
-#  undef mbsrtowcs
-#  define mbsrtowcs rpl_mbsrtowcs
-# endif
-# if address@hidden@ || @REPLACE_MBSRTOWCS@
-extern size_t mbsrtowcs (wchar_t *dest, const char **srcp, size_t len, 
mbstate_t *ps)
-     _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsrtowcs
+#   define mbsrtowcs rpl_mbsrtowcs
+#  endif
+_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t len,
+                   mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t len,
+                   mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (mbsrtowcs);
 #elif defined GNULIB_POSIXCHECK
 # undef mbsrtowcs
-# define mbsrtowcs(d,s,l,p) \
-    (GL_LINK_WARNING ("mbsrtowcs is unportable - " \
-                      "use gnulib module mbsrtowcs for portability"), \
-     mbsrtowcs (d, s, l, p))
+# if HAVE_RAW_DECL_MBSRTOWCS
+_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
+                 "use gnulib module mbsrtowcs for portability");
+# endif
 #endif
 
 
 /* Convert a string to a wide string.  */
 #if @GNULIB_MBSNRTOWCS@
 # if @REPLACE_MBSNRTOWCS@
-#  undef mbsnrtowcs
-#  define mbsnrtowcs rpl_mbsnrtowcs
-# endif
-# if address@hidden@ || @REPLACE_MBSNRTOWCS@
-extern size_t mbsnrtowcs (wchar_t *dest, const char **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
-     _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef mbsnrtowcs
+#   define mbsnrtowcs rpl_mbsnrtowcs
+#  endif
+_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
+                  (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (mbsnrtowcs);
 #elif defined GNULIB_POSIXCHECK
 # undef mbsnrtowcs
-# define mbsnrtowcs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("mbsnrtowcs is unportable - " \
-                      "use gnulib module mbsnrtowcs for portability"), \
-     mbsnrtowcs (d, s, n, l, p))
+# if HAVE_RAW_DECL_MBSNRTOWCS
+_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
+                 "use gnulib module mbsnrtowcs for portability");
+# endif
 #endif
 
 
 /* Convert a wide character to a multibyte character.  */
 #if @GNULIB_WCRTOMB@
 # if @REPLACE_WCRTOMB@
-#  undef wcrtomb
-#  define wcrtomb rpl_wcrtomb
-# endif
-# if address@hidden@ || @REPLACE_WCRTOMB@
-extern size_t wcrtomb (char *s, wchar_t wc, mbstate_t *ps);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcrtomb
+#   define wcrtomb rpl_wcrtomb
+#  endif
+_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
+_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
+#  endif
+_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (wcrtomb);
 #elif defined GNULIB_POSIXCHECK
 # undef wcrtomb
-# define wcrtomb(s,w,p) \
-    (GL_LINK_WARNING ("wcrtomb is unportable - " \
-                      "use gnulib module wcrtomb for portability"), \
-     wcrtomb (s, w, p))
+# if HAVE_RAW_DECL_WCRTOMB
+_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
+                 "use gnulib module wcrtomb for portability");
+# endif
 #endif
 
 
 /* Convert a wide string to a string.  */
 #if @GNULIB_WCSRTOMBS@
 # if @REPLACE_WCSRTOMBS@
-#  undef wcsrtombs
-#  define wcsrtombs rpl_wcsrtombs
-# endif
-# if address@hidden@ || @REPLACE_WCSRTOMBS@
-extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, 
mbstate_t *ps)
-     _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsrtombs
+#   define wcsrtombs rpl_wcsrtombs
+#  endif
+_GL_FUNCDECL_RPL (wcsrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (wcsrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t len,
+                   mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (wcsrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (wcsrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t len,
+                   mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (wcsrtombs);
 #elif defined GNULIB_POSIXCHECK
 # undef wcsrtombs
-# define wcsrtombs(d,s,l,p) \
-    (GL_LINK_WARNING ("wcsrtombs is unportable - " \
-                      "use gnulib module wcsrtombs for portability"), \
-     wcsrtombs (d, s, l, p))
+# if HAVE_RAW_DECL_WCSRTOMBS
+_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
+                 "use gnulib module wcsrtombs for portability");
+# endif
 #endif
 
 
 /* Convert a wide string to a string.  */
 #if @GNULIB_WCSNRTOMBS@
 # if @REPLACE_WCSNRTOMBS@
-#  undef wcsnrtombs
-#  define wcsnrtombs rpl_wcsnrtombs
-# endif
-# if address@hidden@ || @REPLACE_WCSNRTOMBS@
-extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, 
size_t len, mbstate_t *ps)
-     _GL_ARG_NONNULL ((2));
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcsnrtombs
+#   define wcsnrtombs rpl_wcsnrtombs
+#  endif
+_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps)
+                  _GL_ARG_NONNULL ((2)));
+#  endif
+_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
+                  (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
+                   mbstate_t *ps));
 # endif
+_GL_CXXALIASWARN (wcsnrtombs);
 #elif defined GNULIB_POSIXCHECK
 # undef wcsnrtombs
-# define wcsnrtombs(d,s,n,l,p) \
-    (GL_LINK_WARNING ("wcsnrtombs is unportable - " \
-                      "use gnulib module wcsnrtombs for portability"), \
-     wcsnrtombs (d, s, n, l, p))
+# if HAVE_RAW_DECL_WCSNRTOMBS
+_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
+                 "use gnulib module wcsnrtombs for portability");
+# endif
 #endif
 
 
 /* Return the number of screen columns needed for WC.  */
 #if @GNULIB_WCWIDTH@
 # if @REPLACE_WCWIDTH@
-#  undef wcwidth
-#  define wcwidth rpl_wcwidth
-extern int wcwidth (wchar_t);
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef wcwidth
+#   define wcwidth rpl_wcwidth
+#  endif
+_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
+_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
 # else
 #  if !defined wcwidth && address@hidden@
 /* wcwidth exists but is not declared.  */
-extern int wcwidth (int /* actually wchar_t */);
+_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
 #  endif
+_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
 # endif
+_GL_CXXALIASWARN (wcwidth);
 #elif defined GNULIB_POSIXCHECK
 # undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
+# if HAVE_RAW_DECL_WCWIDTH
+_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
+                 "use gnulib module wcwidth for portability");
+# endif
 #endif
 
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif /* _GL_WCHAR_H */
 #endif /* _GL_WCHAR_H */
 #endif
diff --git a/lib/write.c b/lib/write.c
index a99bf5b..8e64659 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -1,5 +1,5 @@
 /* POSIX compatible write() function.
-   Copyright (C) 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2008-2010 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/xsize.h b/lib/xsize.h
index 0b30045..3382280 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -1,6 +1,6 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
diff --git a/libguile.h b/libguile.h
index 7a8b633..6f1b3f8 100644
--- a/libguile.h
+++ b/libguile.h
@@ -1,7 +1,7 @@
 #ifndef SCM_LIBGUILE_H
 #define SCM_LIBGUILE_H
 
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003, 2004, 2006, 2008, 
2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2003, 2004, 2006, 2008, 
2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -50,6 +50,7 @@ extern "C" {
 #include "libguile/feature.h"
 #include "libguile/filesys.h"
 #include "libguile/fluids.h"
+#include "libguile/foreign.h"
 #include "libguile/fports.h"
 #include "libguile/gc.h"
 #include "libguile/gdbint.h"
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 3e93a98..a841c9f 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with Automake to create Makefile.in
 ##
-##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 
2008, 2009 Free Software Foundation, Inc.
+##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 
2008, 2009, 2010 Free Software Foundation, Inc.
 ##
 ##   This file is part of GUILE.
 ##
@@ -33,7 +33,7 @@ DEFAULT_INCLUDES =
 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
 ## building.  Also look for Gnulib headers in `lib'.
 AM_CPPFLAGS = -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) \
-             -I$(top_srcdir)/lib -I$(top_builddir)/lib
+             -I$(top_srcdir)/lib -I$(top_builddir)/lib $(LIBFFI_CFLAGS)
 
 AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
 
@@ -43,7 +43,7 @@ gnulib_library = $(top_builddir)/lib/libgnu.la
 ETAGS_ARGS = 
--regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/'
 \
    --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
 
-lib_LTLIBRARIES = libguile.la
+lib_LTLIBRARIES = address@hidden@.la
 bin_PROGRAMS = guile
 
 noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
@@ -99,12 +99,12 @@ guile_filter_doc_snarfage$(EXEEXT): 
$(guile_filter_doc_snarfage_OBJECTS) $(guile
 
 guile_SOURCES = guile.c
 guile_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
-guile_LDADD = libguile.la
+guile_LDADD = address@hidden@.la
 guile_LDFLAGS = $(GUILE_CFLAGS)
 
-libguile_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
address@hidden@_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
 
-libguile_la_SOURCES =                          \
address@hidden@_la_SOURCES =                            \
        alist.c                                 \
        arbiters.c                              \
        array-handle.c                          \
@@ -116,6 +116,7 @@ libguile_la_SOURCES =                               \
        bitvectors.c                            \
        bytevectors.c                           \
        chars.c                                 \
+       control.c                               \
        continuations.c                         \
        debug.c                                 \
        deprecated.c                            \
@@ -129,6 +130,7 @@ libguile_la_SOURCES =                               \
        extensions.c                            \
        feature.c                               \
        fluids.c                                \
+       foreign.c                               \
        fports.c                                \
        frames.c                                \
        gc-malloc.c                             \
@@ -149,7 +151,6 @@ libguile_la_SOURCES =                               \
        instructions.c                          \
        ioext.c                                 \
        keywords.c                              \
-       lang.c                                  \
        list.c                                  \
        load.c                                  \
        macros.c                                \
@@ -216,6 +217,7 @@ DOT_X_FILES =                                       \
        bitvectors.x                            \
        bytevectors.x                           \
        chars.x                                 \
+       control.x                               \
        continuations.x                         \
        debug.x                                 \
        deprecated.x                            \
@@ -230,6 +232,7 @@ DOT_X_FILES =                                       \
        extensions.x                            \
        feature.x                               \
        fluids.x                                \
+       foreign.x                               \
        fports.x                                \
        gc-malloc.x                             \
        gc.x                                    \
@@ -246,7 +249,6 @@ DOT_X_FILES =                                       \
        init.x                                  \
        ioext.x                                 \
        keywords.x                              \
-       lang.x                                  \
        list.x                                  \
        load.x                                  \
        macros.x                                \
@@ -314,6 +316,7 @@ DOT_DOC_FILES =                             \
        bitvectors.doc                          \
        bytevectors.doc                         \
        chars.doc                               \
+       control.doc                             \
        continuations.doc                       \
        debug.doc                               \
        deprecated.doc                          \
@@ -328,6 +331,7 @@ DOT_DOC_FILES =                             \
        extensions.doc                          \
        feature.doc                             \
        fluids.doc                              \
+       foreign.doc                             \
        fports.doc                              \
        gc-malloc.doc                           \
        gc.doc                                  \
@@ -344,7 +348,6 @@ DOT_DOC_FILES =                             \
        init.doc                                \
        ioext.doc                               \
        keywords.doc                            \
-       lang.doc                                \
        list.doc                                \
        load.doc                                \
        macros.doc                              \
@@ -406,7 +409,7 @@ BUILT_SOURCES = cpp_err_symbols.c cpp_sig_symbols.c 
libpath.h \
     version.h scmconfig.h \
     $(DOT_I_FILES) $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
 
-EXTRA_libguile_la_SOURCES = _scm.h             \
address@hidden@_la_SOURCES = _scm.h             \
     memmove.c strerror.c                       \
     dynl.c regex-posix.c                       \
     filesys.c posix.c net_db.c socket.c                \
@@ -426,7 +429,6 @@ install-exec-hook:
 ## working.
 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c            \
                  ieee-754.h                                    \
-                 srfi-4.i.c                                    \
                  srfi-14.i.c                                   \
                  quicksort.i.c                                  \
                  win32-uname.h win32-dirent.h win32-socket.h   \
@@ -435,19 +437,20 @@ noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c       
        \
 # vm instructions
 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
 
-libguile_la_DEPENDENCIES = @LIBLOBJS@
-libguile_la_LIBADD =                           \
address@hidden@_la_DEPENDENCIES = @LIBLOBJS@
address@hidden@_la_LIBADD =                             \
   @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP)     \
-  $(LTLIBUNISTRING) $(LTLIBICONV)
-libguile_la_LDFLAGS =                                                  \
-  @LTLIBINTL@ $(INET_NTOP_LIB) $(INET_PTON_LIB)                                
\
+  $(LTLIBUNISTRING) $(LTLIBICONV) $(LTLIBINTL)
address@hidden@_la_LDFLAGS =                                                    
                                \
+  @LTLIBINTL@ $(LIBFFI_LIBS) $(INET_NTOP_LIB) $(INET_PTON_LIB)                 
                        \
+  $(GETADDRINFO_LIB) $(HOSTENT_LIB) $(SERVENT_LIB)                             
                        \
   -version-info 
@LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
    \
-  -export-dynamic -no-undefined                                                
\
+  -export-dynamic -no-undefined                                                
                                \
   $(GNU_LD_FLAGS)
 
 if HAVE_LD_VERSION_SCRIPT
 
-libguile_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
address@hidden@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
 
 endif HAVE_LD_VERSION_SCRIPT
 
@@ -456,7 +459,7 @@ endif HAVE_LD_VERSION_SCRIPT
 pkginclude_HEADERS = 
 
 # These are headers visible as <libguile/mumble.h>.
-modincludedir = $(includedir)/libguile
+modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
 modinclude_HEADERS =                           \
        __scm.h                                 \
        alist.h                                 \
@@ -471,6 +474,7 @@ modinclude_HEADERS =                                \
        bitvectors.h                            \
        bytevectors.h                           \
        chars.h                                 \
+       control.h                               \
        continuations.h                         \
        debug-malloc.h                          \
        debug.h                                 \
@@ -487,6 +491,7 @@ modinclude_HEADERS =                                \
        feature.h                               \
        filesys.h                               \
        fluids.h                                \
+       foreign.h                               \
        fports.h                                \
        frames.h                                \
        gc.h                                    \
@@ -508,7 +513,6 @@ modinclude_HEADERS =                                \
        ioext.h                                 \
        iselect.h                               \
        keywords.h                              \
-       lang.h                                  \
        list.h                                  \
        load.h                                  \
        macros.h                                \
@@ -566,7 +570,6 @@ modinclude_HEADERS =                                \
        values.h                                \
        variable.h                              \
        vectors.h                               \
-       vm-bootstrap.h                          \
        vm-engine.h                             \
        vm-expand.h                             \
        vm.h                                    \
@@ -593,11 +596,12 @@ EXTRA_DIST = ChangeLog-scm ChangeLog-threads              
\
 ## We use @-...-@ as the substitution brackets here, instead of the
 ## usual @...@, so autoconf doesn't go and substitute the values
 ## directly into the left-hand sides of the sed substitutions.  *sigh*
-version.h: version.h.in
+version.h: version.h.in $(top_builddir)/config.status
        sed < $(srcdir)/version.h.in > address@hidden \
          -e s:@-GUILE_MAJOR_VERSION-@:${GUILE_MAJOR_VERSION}: \
          -e s:@-GUILE_MINOR_VERSION-@:${GUILE_MINOR_VERSION}: \
-         -e s:@-GUILE_MICRO_VERSION-@:${GUILE_MICRO_VERSION}:
+         -e s:@-GUILE_MICRO_VERSION-@:${GUILE_MICRO_VERSION}: \
+         -e s:@-GUILE_EFFECTIVE_VERSION-@:${GUILE_EFFECTIVE_VERSION}:
        mv address@hidden $@
 
 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
diff --git a/libguile/_scm.h b/libguile/_scm.h
index b5c818c..a1884ca 100644
--- a/libguile/_scm.h
+++ b/libguile/_scm.h
@@ -3,7 +3,7 @@
 #ifndef SCM__SCM_H
 #define SCM__SCM_H
 
-/* Copyright (C) 1995,1996,2000,2001, 2002, 2006, 2008, 2009 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,2000,2001, 2002, 2006, 2008, 2009, 2010 Free 
Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -79,6 +79,8 @@
 #include "libguile/boolean.h"  /* Everyone wonders about the truth.  */
 #include "libguile/threads.h"  /* You are not alone. */
 #include "libguile/snarf.h"    /* Everyone snarfs. */
+#include "libguile/foreign.h"  /* Snarfing needs the foreign data structures. 
*/
+#include "libguile/programs.h" /* ... and program.h. */
 #include "libguile/variable.h"
 #include "libguile/modules.h"
 #include "libguile/inline.h"
@@ -176,7 +178,7 @@
 
 /* Major and minor versions must be single characters. */
 #define SCM_OBJCODE_MAJOR_VERSION 0
-#define SCM_OBJCODE_MINOR_VERSION M
+#define SCM_OBJCODE_MINOR_VERSION P
 #define SCM_OBJCODE_MAJOR_VERSION_STRING        \
   SCM_CPP_STRINGIFY(SCM_OBJCODE_MAJOR_VERSION)
 #define SCM_OBJCODE_MINOR_VERSION_STRING        \
diff --git a/libguile/alist.c b/libguile/alist.c
index 919bd22..fd2ccde 100644
--- a/libguile/alist.c
+++ b/libguile/alist.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001, 2004, 2006, 2008 Free 
Software Foundation, Inc.
+/* Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001, 2004, 2006, 2008, 2010 Free 
Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -25,7 +25,6 @@
 #include "libguile/_scm.h"
 #include "libguile/eq.h"
 #include "libguile/list.h"
-#include "libguile/lang.h"
 
 #include "libguile/validate.h"
 #include "libguile/pairs.h"
diff --git a/libguile/array-map.c b/libguile/array-map.c
index c673b4d..dd88136 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1998,2000,2001,2004,2005, 2006, 2008, 2009 Free Software 
Foundation, Inc.
+/* Copyright (C) 1996,1998,2000,2001,2004,2005, 2006, 2008, 2009, 2010 Free 
Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -812,123 +812,63 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 
2, 0, 0,
 
 
 static int
-raeql_1 (SCM ra0, SCM as_equal, SCM ra1)
+array_compare (scm_t_array_handle *hx, scm_t_array_handle *hy,
+               size_t dim, unsigned long posx, unsigned long posy)
 {
-  unsigned long i0 = 0, i1 = 0;
-  long inc0 = 1, inc1 = 1;
-  unsigned long n;
-  ra1 = SCM_CAR (ra1);
-  if (SCM_I_ARRAYP(ra0))
-    {
-      n = SCM_I_ARRAY_DIMS (ra0)->ubnd - SCM_I_ARRAY_DIMS (ra0)->lbnd + 1;
-      i0 = SCM_I_ARRAY_BASE (ra0);
-      inc0 = SCM_I_ARRAY_DIMS (ra0)->inc;
-      ra0 = SCM_I_ARRAY_V (ra0);
-    }
+  if (dim == scm_array_handle_rank (hx))
+    return scm_is_true (scm_equal_p (scm_array_handle_ref (hx, posx),
+                                     scm_array_handle_ref (hy, posy)));
   else
-    n = scm_c_generalized_vector_length (ra0);
-
-  if (SCM_I_ARRAYP (ra1))
     {
-      i1 = SCM_I_ARRAY_BASE (ra1);
-      inc1 = SCM_I_ARRAY_DIMS (ra1)->inc;
-      ra1 = SCM_I_ARRAY_V (ra1);
-    }
+      long incx, incy;
+      size_t i;
 
-  if (scm_is_generalized_vector (ra0))
-    {
-      for (; n--; i0 += inc0, i1 += inc1)
-       {
-         if (scm_is_false (as_equal))
-           {
-             if (scm_is_false (scm_array_equal_p (GVREF (ra0, i0), GVREF (ra1, 
i1))))
-               return 0;
-           }
-         else if (scm_is_false (scm_equal_p (GVREF (ra0, i0), GVREF (ra1, 
i1))))
-           return 0;
-       }
+      if (hx->dims[dim].lbnd != hy->dims[dim].lbnd
+          || hx->dims[dim].ubnd != hy->dims[dim].ubnd)
+        return 0;
+
+      i = hx->dims[dim].ubnd - hx->dims[dim].lbnd + 1;
+      
+      incx = hx->dims[dim].inc;
+      incy = hy->dims[dim].inc;
+      posx += (i - 1) * incx;
+      posy += (i - 1) * incy;
+
+      for (; i > 0; i--, posx -= incx, posy -= incy)
+        if (!array_compare (hx, hy, dim + 1, posx, posy))
+          return 0;
       return 1;
     }
-  else
-    return 0;
 }
 
-
-
-static int
-raeql (SCM ra0, SCM as_equal, SCM ra1)
+SCM
+scm_array_equal_p (SCM x, SCM y)
 {
-  SCM v0 = ra0, v1 = ra1;
-  scm_t_array_dim dim0, dim1;
-  scm_t_array_dim *s0 = &dim0, *s1 = &dim1;
-  unsigned long bas0 = 0, bas1 = 0;
-  int k, unroll = 1, vlen = 1, ndim = 1;
-  if (SCM_I_ARRAYP (ra0))
-    {
-      ndim = SCM_I_ARRAY_NDIM (ra0);
-      s0 = SCM_I_ARRAY_DIMS (ra0);
-      bas0 = SCM_I_ARRAY_BASE (ra0);
-      v0 = SCM_I_ARRAY_V (ra0);
-    }
-  else
-    {
-      s0->inc = 1;
-      s0->lbnd = 0;
-      s0->ubnd = scm_c_generalized_vector_length (v0) - 1;
-      unroll = 0;
-    }
-  if (SCM_I_ARRAYP (ra1))
-    {
-      if (ndim != SCM_I_ARRAY_NDIM (ra1))
-       return 0;
-      s1 = SCM_I_ARRAY_DIMS (ra1);
-      bas1 = SCM_I_ARRAY_BASE (ra1);
-      v1 = SCM_I_ARRAY_V (ra1);
-    }
-  else
-    {
-      /*
-       Huh ? Schizophrenic return type. --hwn
-      */
-      if (1 != ndim)
-       return 0;
-      s1->inc = 1;
-      s1->lbnd = 0;
-      s1->ubnd = scm_c_generalized_vector_length (v1) - 1;
-      unroll = 0;
-    }
-  if (SCM_TYP7 (v0) != SCM_TYP7 (v1))
-    return 0;
-  for (k = ndim; k--;)
-    {
-      if (s0[k].lbnd != s1[k].lbnd || s0[k].ubnd != s1[k].ubnd)
-       return 0;
-      if (unroll)
-       {
-         unroll = (s0[k].inc == s1[k].inc);
-         vlen *= s0[k].ubnd - s1[k].lbnd + 1;
-       }
-    }
-  if (unroll && bas0 == bas1 && scm_is_eq (v0, v1))
-    return 1;
-  return scm_ramapc (raeql_1, as_equal, ra0, scm_cons (ra1, SCM_EOL), "");
-}
+  scm_t_array_handle hx, hy;
+  SCM res;  
+  
+  scm_array_get_handle (x, &hx);
+  scm_array_get_handle (y, &hy);
+  
+  res = scm_from_bool (hx.ndims == hy.ndims
+                       && hx.element_type == hy.element_type);
 
+  if (scm_is_true (res))
+    res = scm_from_bool (array_compare (&hx, &hy, 0, 0, 0));
 
-SCM
-scm_raequal (SCM ra0, SCM ra1)
-{
-  return scm_from_bool(raeql (ra0, SCM_BOOL_T, ra1));
+  scm_array_handle_release (&hy);
+  scm_array_handle_release (&hx);
+
+  return res;
 }
 
+static SCM scm_i_array_equal_p (SCM, SCM, SCM);
 SCM_DEFINE (scm_i_array_equal_p, "array-equal?", 0, 2, 1,
             (SCM ra0, SCM ra1, SCM rest),
            "Return @code{#t} iff all arguments are arrays with the same\n"
            "shape, the same type, and have corresponding elements which are\n"
            "either @code{equal?}  or @code{array-equal?}.  This function\n"
-           "differs from @code{equal?} in that a one dimensional shared\n"
-           "array may be @var{array-equal?} but not @var{equal?} to a\n"
-           "vector or uniform vector.")
+           "differs from @code{equal?} in that all arguments must be arrays.")
 #define FUNC_NAME s_scm_i_array_equal_p
 {
   if (SCM_UNBNDP (ra0) || SCM_UNBNDP (ra1))
@@ -946,19 +886,10 @@ SCM_DEFINE (scm_i_array_equal_p, "array-equal?", 0, 2, 1,
 #undef FUNC_NAME
 
 
-SCM
-scm_array_equal_p (SCM ra0, SCM ra1)
-{
-  if (SCM_I_ARRAYP (ra0) || SCM_I_ARRAYP (ra1))
-    return scm_from_bool(raeql (ra0, SCM_BOOL_F, ra1));
-  return scm_equal_p (ra0, ra1);
-}
-
-
 void
 scm_init_array_map (void)
 {
-  scm_smobs[SCM_TC2SMOBNUM (scm_i_tc16_array)].equalp = scm_raequal;
+  scm_smobs[SCM_TC2SMOBNUM (scm_i_tc16_array)].equalp = scm_array_equal_p;
 #include "libguile/array-map.x"
   scm_add_feature (s_scm_array_for_each);
 }
diff --git a/libguile/array-map.h b/libguile/array-map.h
index a198099..471861b 100644
--- a/libguile/array-map.h
+++ b/libguile/array-map.h
@@ -3,7 +3,7 @@
 #ifndef SCM_ARRAY_MAP_H
 #define SCM_ARRAY_MAP_H
 
-/* Copyright (C) 1995,1996,1997,2000, 2006, 2008, 2009 Free Software 
Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,2000, 2006, 2008, 2009, 2010 Free Software 
Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -46,7 +46,6 @@ SCM_API int scm_array_identity (SCM src, SCM dst);
 SCM_API SCM scm_array_map_x (SCM ra0, SCM proc, SCM lra);
 SCM_API SCM scm_array_for_each (SCM proc, SCM ra0, SCM lra);
 SCM_API SCM scm_array_index_map_x (SCM ra, SCM proc);
-SCM_API SCM scm_raequal (SCM ra0, SCM ra1);
 SCM_API SCM scm_array_equal_p (SCM ra0, SCM ra1);
 SCM_INTERNAL void scm_init_array_map (void);
 
diff --git a/libguile/arrays.c b/libguile/arrays.c
index 39d1067..89f5e9d 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 
2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001,2002,2003,2004, 2005, 2006, 
2009, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -260,6 +260,41 @@ scm_from_contiguous_typed_array (SCM type, SCM bounds, 
const void *bytes,
 }
 #undef FUNC_NAME
 
+SCM
+scm_from_contiguous_array (SCM bounds, const SCM *elts, size_t len)
+#define FUNC_NAME "scm_from_contiguous_array"
+{
+  size_t k, rlen = 1;
+  scm_t_array_dim *s;
+  SCM ra;
+  scm_t_array_handle h;
+  
+  ra = scm_i_shap2ra (bounds);
+  SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
+  s = SCM_I_ARRAY_DIMS (ra);
+  k = SCM_I_ARRAY_NDIM (ra);
+
+  while (k--)
+    {
+      s[k].inc = rlen;
+      SCM_ASSERT_RANGE (1, bounds, s[k].lbnd <= s[k].ubnd + 1);
+      rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
+    }
+  if (rlen != len)
+    SCM_MISC_ERROR ("element length and dimensions do not match", SCM_EOL);
+
+  SCM_I_ARRAY_V (ra) = scm_c_make_vector (rlen, SCM_UNDEFINED);
+  scm_array_get_handle (ra, &h);
+  memcpy (h.writable_elements, elts, rlen * sizeof(SCM));
+  scm_array_handle_release (&h);
+
+  if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
+    if (s->ubnd < s->lbnd || (0 == s->lbnd && 1 == s->inc))
+      return SCM_I_ARRAY_V (ra);
+  return ra;
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_make_array, "make-array", 1, 0, 1,
            (SCM fill, SCM bounds),
            "Create and return an array.")
@@ -570,150 +605,6 @@ SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
 #undef FUNC_NAME
 
 
-SCM 
-scm_ra2contig (SCM ra, int copy)
-{
-  SCM ret;
-  long inc = 1;
-  size_t k, len = 1;
-  for (k = SCM_I_ARRAY_NDIM (ra); k--;)
-    len *= SCM_I_ARRAY_DIMS (ra)[k].ubnd - SCM_I_ARRAY_DIMS (ra)[k].lbnd + 1;
-  k = SCM_I_ARRAY_NDIM (ra);
-  if (SCM_I_ARRAY_CONTP (ra) && ((0 == k) || (1 == SCM_I_ARRAY_DIMS (ra)[k - 
1].inc)))
-    {
-      if (!scm_is_bitvector (SCM_I_ARRAY_V (ra)))
-