Remove *.pot files and ignore them now.

The .pot files can be generated automatically and the files contain
timestamps in their content. They can cause huge conflicts and take huge
space even if you are not a translator.

This commit is a part of improvement discussed on
https://github.com/mozilla/rust/pull/11383 .

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
This commit is contained in:
OGINO Masanori 2014-01-10 07:05:52 +09:00
parent d4051b6145
commit 20ec0be779
9 changed files with 1 additions and 15263 deletions

1
.gitignore vendored
View File

@ -95,3 +95,4 @@ src/etc/dl
build/ build/
i686-pc-mingw32/ i686-pc-mingw32/
src/librustc/lib/llvmdeps.rs src/librustc/lib/llvmdeps.rs
*.pot

File diff suppressed because it is too large Load Diff

View File

@ -1,323 +0,0 @@
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The Rust Project Developers
# This file is distributed under the same license as the Rust package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8\n"
"POT-Creation-Date: 2013-07-30 07:07+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
#: doc/rust.md:4 doc/rustpkg.md:4 doc/tutorial.md:4
#: doc/tutorial-borrowed-ptr.md:4 doc/tutorial-ffi.md:4
#: doc/tutorial-macros.md:4 doc/tutorial-tasks.md:4
msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/rust.md:30 doc/rustpkg.md:8
msgid "## Disclaimer"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:2
msgid "% Rustpkg Reference Manual"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:6
msgid ""
"This document is the reference manual for the Rustpkg packaging and build "
"tool for the Rust programming language."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:12
msgid ""
"Rustpkg is a work in progress, as is this reference manual. If the actual "
"behavior of rustpkg differs from the behavior described in this reference, "
"that reflects either an incompleteness or a bug in rustpkg."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:14
msgid "# Package searching"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:17
msgid ""
"rustpkg searches for packages using the `RUST_PATH` environment variable, "
"which is a colon-separated list (semicolon-separated on Windows) of "
"directories."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:19
msgid "Each directory in this list is a *workspace* for rustpkg."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:30
msgid ""
"`RUST_PATH` implicitly contains an entry for `./.rust` (as well as `../."
"rust`, `../../.rust`, and so on for every parent of `.` up to the filesystem "
"root). That means that if `RUST_PATH` is not set, then rustpkg will still "
"search for workspaces in `./.rust` and so on. `RUST_PATH` also implicitly "
"contains an entry for the system path: `/usr/local` or the equivalent on "
"Windows. This entry comes after the implicit entries for `./.rust` and so "
"on. Finally, the last implicit entry in `RUST_PATH` is `~/.rust` or the "
"equivalent on Windows."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:32
msgid "Each workspace may contain one or more packages."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:38
msgid ""
"When building code that contains one or more directives of the form `extern "
"mod P`, rustpkg automatically searches for packages named `P` in the "
"`RUST_PATH` (as described above). It builds those dependencies if "
"necessary. Thus, when using rustpkg, there is no need for `-L` flags to "
"tell the linker where to find libraries for external crates."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:40
msgid "# Package structure"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:42
msgid "A valid workspace must contain each of the following subdirectories:"
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:44
msgid ""
"'src/': contains one subdirectory per package. Each subdirectory contains "
"source files for a given package."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:49
#, no-wrap
msgid ""
" For example, if `foo` is a workspace containing the package `bar`,\n"
" then `foo/src/bar/main.rs` could be the `main` entry point for\n"
" building a `bar` executable.\n"
"* 'lib/': `rustpkg install` installs libraries into a target-specific subdirectory of this directory.\n"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:56
#, no-wrap
msgid ""
" For example, on a 64-bit machine running Mac OS X,\n"
" if `foo` is a workspace containing the package `bar`,\n"
" rustpkg will install libraries for bar to `foo/lib/x86_64-apple-darwin/`.\n"
" The libraries will have names of the form `foo/lib/x86_64-apple-darwin/libbar-[hash].dylib`,\n"
" where [hash] is a hash of the package ID.\n"
"* 'bin/': `rustpkg install` installs executable binaries into a target-specific subdirectory of this directory.\n"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:63
#, no-wrap
msgid ""
" For example, on a 64-bit machine running Mac OS X,\n"
" if `foo` is a workspace, containing the package `bar`,\n"
" rustpkg will install executables for `bar` to\n"
" `foo/bin/x86_64-apple-darwin/`.\n"
" The executables will have names of the form `foo/bin/x86_64-apple-darwin/bar`.\n"
"* 'build/': `rustpkg build` stores temporary build artifacts in a target-specific subdirectory of this directory.\n"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:67
#, no-wrap
msgid ""
" For example, on a 64-bit machine running Mac OS X,\n"
" if `foo` is a workspace containing the package `bar` and `foo/src/bar/main.rs` exists,\n"
" then `rustpkg build` will create `foo/build/x86_64-apple-darwin/bar/main.o`.\n"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:69
msgid "# Package identifiers"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:87
msgid ""
"A package identifier identifies a package uniquely. A package can be stored "
"in a workspace on the local file system, or on a remote Web server, in which "
"case the package ID resembles a URL. For example, `github.com/mozilla/rust` "
"is a package ID that would refer to the git repository browsable at `http://"
"github.com/mozilla/rust`. A package ID can also specify a version, like: "
"`github.com/mozilla/rust#0.3`. In this case, `rustpkg` will check that the "
"repository `github.com/mozilla/rust` has a tag named `0.3`, and report an "
"error otherwise. A package ID can also specify a particular revision of a "
"repository, like: `github.com/mozilla/rust#release-0.7`. When the refspec "
"(portion of the package ID after the `#`) can't be parsed as a decimal "
"number, rustpkg passes the refspec along to the version control system "
"without interpreting it. rustpkg also interprets any dependencies on such a "
"package ID literally (as opposed to versions, where a newer version "
"satisfies a dependency on an older version). Thus, `github.com/mozilla/"
"rust#5c4cd30f80` is also a valid package ID, since git can deduce that "
"5c4cd30f80 refers to a revision of the desired repository."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:89
msgid "## Source files"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:91
msgid ""
"rustpkg searches for four different fixed filenames in order to determine "
"the crates to build:"
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:96
msgid "`main.rs`: Assumed to be a main entry point for building an executable."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:96
msgid "`lib.rs`: Assumed to be a library crate."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:96
msgid ""
"`test.rs`: Assumed to contain tests declared with the `#[test]` attribute."
msgstr ""
#. type: Bullet: '* '
#: doc/rustpkg.md:96
msgid ""
"`bench.rs`: Assumed to contain benchmarks declared with the `#[bench]` "
"attribute."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:98
msgid "## Versions"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:105
msgid ""
"`rustpkg` packages do not need to declare their versions with an attribute "
"inside one of the source files, because `rustpkg` infers it from the version "
"control system. When building a package that is in a `git` repository, "
"`rustpkg` assumes that the most recent tag specifies the current version. "
"When building a package that is not under version control, or that has no "
"tags, `rustpkg` assumes the intended version is 0.1."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:107
msgid "# Dependencies"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:111
msgid ""
"rustpkg infers dependencies from `extern mod` directives. Thus, there "
"should be no need to pass a `-L` flag to rustpkg to tell it where to find a "
"library. (In the future, it will also be possible to write an `extern mod` "
"directive referring to a remote package.)"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:113
msgid "# Custom build scripts"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:117
msgid ""
"A file called `pkg.rs` at the root level in a workspace is called a *package "
"script*. If a package script exists, rustpkg executes it to build the "
"package rather than inferring crates as described previously."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:121
msgid ""
"Inside `pkg.rs`, it's possible to call back into rustpkg to finish up the "
"build. `rustpkg::api` contains functions to build, install, or clean "
"libraries and executables in the way rustpkg normally would without custom "
"build logic."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:123
msgid "# Command reference"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:125
msgid "## build"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:131
msgid ""
"`rustpkg build foo` searches for a package with ID `foo` and builds it in "
"any workspace(s) where it finds one. Supposing such packages are found in "
"workspaces X, Y, and Z, the command leaves behind files in `X`'s, `Y`'s, and "
"`Z`'s `build` directories, but not in their `lib` or `bin` directories."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:133
msgid "## clean"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:135
msgid "`rustpkg clean foo` deletes the contents of `foo`'s `build` directory."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:137
msgid "## install"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:141
msgid ""
"`rustpkg install foo` builds the libraries and/or executables that are "
"targets for `foo`, and then installs them either into `foo`'s `lib` and "
"`bin` directories, or into the `lib` and `bin` subdirectories of the first "
"entry in `RUST_PATH`."
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:143
msgid "## test"
msgstr ""
#. type: Plain text
#: doc/rustpkg.md:145
msgid ""
"`rustpkg test foo` builds `foo`'s `test.rs` file if necessary, then runs the "
"resulting test executable."
msgstr ""

File diff suppressed because it is too large Load Diff

View File

@ -1,673 +0,0 @@
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The Rust Project Developers
# This file is distributed under the same license as the Rust package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8\n"
"POT-Creation-Date: 2013-08-05 19:40+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
#: doc/tutorial-container.md:2
msgid "% Containers and iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:4
msgid "# Containers"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:6
msgid "The container traits are defined in the `std::container` module."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:8
msgid "## Unique and managed vectors"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:12
msgid ""
"Vectors have `O(1)` indexing and removal from the end, along with `O(1)` "
"amortized insertion. Vectors are the most common container in Rust, and are "
"flexible enough to fit many use cases."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:16
msgid ""
"Vectors can also be sorted and used as efficient lookup tables with the "
"`std::vec::bsearch` function, if all the elements are inserted at one time "
"and deletions are unnecessary."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:18
msgid "## Maps and sets"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:22
msgid ""
"Maps are collections of unique keys with corresponding values, and sets are "
"just unique keys without a corresponding value. The `Map` and `Set` traits "
"in `std::container` define the basic interface."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:24
msgid "The standard library provides three owned map/set types:"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:30
msgid ""
"`std::hashmap::HashMap` and `std::hashmap::HashSet`, requiring the keys to "
"implement `Eq` and `Hash`"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:30
msgid ""
"`std::trie::TrieMap` and `std::trie::TrieSet`, requiring the keys to be "
"`uint`"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:30
msgid ""
"`extra::treemap::TreeMap` and `extra::treemap::TreeSet`, requiring the keys "
"to implement `TotalOrd`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:34
msgid ""
"These maps do not use managed pointers so they can be sent between tasks as "
"long as the key and value types are sendable. Neither the key or value type "
"has to be copyable."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:37
msgid ""
"The `TrieMap` and `TreeMap` maps are ordered, while `HashMap` uses an "
"arbitrary order."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:42
msgid ""
"Each `HashMap` instance has a random 128-bit key to use with a keyed hash, "
"making the order of a set of keys in a given hash table randomized. Rust "
"provides a [SipHash](https://131002.net/siphash/) implementation for any "
"type implementing the `IterBytes` trait."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:44
msgid "## Double-ended queues"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:49
msgid ""
"The `extra::deque` module implements a double-ended queue with `O(1)` "
"amortized inserts and removals from both ends of the container. It also has "
"`O(1)` indexing like a vector. The contained elements are not required to be "
"copyable, and the queue will be sendable if the contained type is sendable."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:51
msgid "## Priority queues"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:55
msgid ""
"The `extra::priority_queue` module implements a queue ordered by a key. The "
"contained elements are not required to be copyable, and the queue will be "
"sendable if the contained type is sendable."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:61
msgid ""
"Insertions have `O(log n)` time complexity and checking or popping the "
"largest element is `O(1)`. Converting a vector to a priority queue can be "
"done in-place, and has `O(n)` complexity. A priority queue can also be "
"converted to a sorted vector in-place, allowing it to be used for an `O(n "
"log n)` in-place heapsort."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:63
msgid "# Iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:65
msgid "## Iteration protocol"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:69
msgid ""
"The iteration protocol is defined by the `Iterator` trait in the `std::"
"iterator` module. The minimal implementation of the trait is a `next` "
"method, yielding the next element from an iterator object:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:73
msgid "~~~ /// An infinite stream of zeroes struct ZeroStream;"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:80
#, no-wrap
msgid ""
"impl Iterator<int> for ZeroStream {\n"
" fn next(&mut self) -> Option<int> {\n"
" Some(0)\n"
" }\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:83
msgid ""
"Reaching the end of the iterator is signalled by returning `None` instead of "
"`Some(item)`:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:89 doc/tutorial-container.md:262
#, no-wrap
msgid ""
"~~~\n"
"/// A stream of N zeroes\n"
"struct ZeroStream {\n"
" priv remaining: uint\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:95
#, no-wrap
msgid ""
"impl ZeroStream {\n"
" fn new(n: uint) -> ZeroStream {\n"
" ZeroStream { remaining: n }\n"
" }\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:107 doc/tutorial-container.md:284
#, no-wrap
msgid ""
"impl Iterator<int> for ZeroStream {\n"
" fn next(&mut self) -> Option<int> {\n"
" if self.remaining == 0 {\n"
" None\n"
" } else {\n"
" self.remaining -= 1;\n"
" Some(0)\n"
" }\n"
" }\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:109
msgid "## Container iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:112
msgid ""
"Containers implement iteration over the contained elements by returning an "
"iterator object. For example, vector slices several iterators available:"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:116
msgid "`iter()` and `rev_iter()`, for immutable references to the elements"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:116
msgid ""
"`mut_iter()` and `mut_rev_iter()`, for mutable references to the elements"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-container.md:116
msgid ""
"`consume_iter()` and `consume_rev_iter`, to move the elements out by-value"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:119
msgid ""
"A typical mutable container will implement at least `iter()`, `mut_iter()` "
"and `consume_iter()` along with the reverse variants if it maintains an "
"order."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:121
msgid "### Freezing"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:125
msgid ""
"Unlike most other languages with external iterators, Rust has no *iterator "
"invalidation*. As long an iterator is still in scope, the compiler will "
"prevent modification of the container through another handle."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:130
#, no-wrap
msgid ""
"~~~\n"
"let mut xs = [1, 2, 3];\n"
"{\n"
" let _it = xs.iter();\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:136
#, no-wrap
msgid ""
" // the vector is frozen for this scope, the compiler will statically\n"
" // prevent modification\n"
"}\n"
"// the vector becomes unfrozen again at the end of the scope\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:139
msgid ""
"These semantics are due to most container iterators being implemented with "
"`&` and `&mut`."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:141
msgid "## Iterator adaptors"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:145
msgid ""
"The `IteratorUtil` trait implements common algorithms as methods extending "
"every `Iterator` implementation. For example, the `fold` method will "
"accumulate the items yielded by an `Iterator` into a single value:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:151
msgid ""
"~~~ let xs = [1, 9, 2, 3, 14, 12]; let result = xs.iter().fold(0, |"
"accumulator, item| accumulator - *item); assert_eq!(result, -41); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:153
msgid ""
"Some adaptors return an adaptor object implementing the `Iterator` trait "
"itself:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:160
msgid ""
"~~~ let xs = [1, 9, 2, 3, 14, 12]; let ys = [5, 2, 1, 8]; let sum = xs."
"iter().chain_(ys.iter()).fold(0, |a, b| a + *b); assert_eq!(sum, 57); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:164
msgid ""
"Note that some adaptors like the `chain_` method above use a trailing "
"underscore to work around an issue with method resolve. The underscores will "
"be dropped when they become unnecessary."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:166
msgid "## For loops"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:168
msgid ""
"The `for` keyword can be used as sugar for iterating through any iterator:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:171
msgid "~~~ let xs = [2, 3, 5, 7, 11, 13, 17];"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:176
#, no-wrap
msgid ""
"// print out all the elements in the vector\n"
"for x in xs.iter() {\n"
" println(x.to_str())\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:182
#, no-wrap
msgid ""
"// print out all but the first 3 elements in the vector\n"
"for x in xs.iter().skip(3) {\n"
" println(x.to_str())\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:185
msgid ""
"For loops are *often* used with a temporary iterator object, as above. They "
"can also advance the state of an iterator in a mutable location:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:189
msgid ""
"~~~ let xs = [1, 2, 3, 4, 5]; let ys = [\"foo\", \"bar\", \"baz\", \"foobar"
"\"];"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:192
msgid ""
"// create an iterator yielding tuples of elements from both vectors let mut "
"it = xs.iter().zip(ys.iter());"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:196
#, no-wrap
msgid ""
"// print out the pairs of elements up to (&3, &\"baz\")\n"
"for (x, y) in it {\n"
" printfln!(\"%d %s\", *x, *y);\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:201
#, no-wrap
msgid ""
" if *x == 3 {\n"
" break;\n"
" }\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:204
msgid ""
"// yield and print the last pair from the iterator printfln!(\"last: %?\", "
"it.next());"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:208
msgid "// the iterator is now fully consumed assert!(it.next().is_none()); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:210
msgid "## Conversion"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:212
msgid ""
"Iterators offer generic conversion to containers with the `collect` adaptor:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:218
msgid ""
"~~~ let xs = [0, 1, 1, 2, 3, 5, 8]; let ys = xs.rev_iter().skip(1)."
"transform(|&x| x * 2).collect::<~[int]>(); assert_eq!(ys, ~[10, 6, 4, 2, 2, "
"0]); ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:221
msgid ""
"The method requires a type hint for the container type, if the surrounding "
"code does not provide sufficient information."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:225
msgid ""
"Containers can provide conversion from iterators through `collect` by "
"implementing the `FromIterator` trait. For example, the implementation for "
"vectors is as follows:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:238
#, no-wrap
msgid ""
"~~~\n"
"impl<A> FromIterator<A> for ~[A] {\n"
" pub fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> ~[A] {\n"
" let (lower, _) = iterator.size_hint();\n"
" let mut xs = with_capacity(lower);\n"
" for x in iterator {\n"
" xs.push(x);\n"
" }\n"
" xs\n"
" }\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:240
msgid "### Size hints"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:243
msgid ""
"The `Iterator` trait provides a `size_hint` default method, returning a "
"lower bound and optionally on upper bound on the length of the iterator:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:247
msgid "~~~ fn size_hint(&self) -> (uint, Option<uint>) { (0, None) } ~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:251
msgid ""
"The vector implementation of `FromIterator` from above uses the lower bound "
"to pre-allocate enough space to hold the minimum number of elements the "
"iterator will yield."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:254
msgid ""
"The default implementation is always correct, but it should be overridden if "
"the iterator can provide better information."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:256
msgid ""
"The `ZeroStream` from earlier can provide an exact lower and upper bound:"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:267
#, no-wrap
msgid ""
"impl ZeroStream {\n"
" fn new(n: uint) -> ZeroStream {\n"
" ZeroStream { remaining: n }\n"
" }\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:272
#, no-wrap
msgid ""
" fn size_hint(&self) -> (uint, Option<uint>) {\n"
" (self.remaining, Some(self.remaining))\n"
" }\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:286
msgid "## Double-ended iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:290
msgid ""
"The `DoubleEndedIterator` trait represents an iterator able to yield "
"elements from either end of a range. It inherits from the `Iterator` trait "
"and extends it with the `next_back` function."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:293
msgid ""
"A `DoubleEndedIterator` can be flipped with the `invert` adaptor, returning "
"another `DoubleEndedIterator` with `next` and `next_back` exchanged."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:300
msgid ""
"~~~ let xs = [1, 2, 3, 4, 5, 6]; let mut it = xs.iter(); printfln!(\"%?\", "
"it.next()); // prints `Some(&1)` printfln!(\"%?\", it.next()); // prints "
"`Some(&2)` printfln!(\"%?\", it.next_back()); // prints `Some(&6)`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:306
#, no-wrap
msgid ""
"// prints `5`, `4` and `3`\n"
"for &x in it.invert() {\n"
" printfln!(\"%?\", x)\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:309
msgid ""
"The `rev_iter` and `mut_rev_iter` methods on vectors just return an inverted "
"version of the standard immutable and mutable vector iterators."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:312
msgid ""
"The `chain_`, `transform`, `filter`, `filter_map` and `peek` adaptors are "
"`DoubleEndedIterator` implementations if the underlying iterators are."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:317
msgid ""
"~~~ let xs = [1, 2, 3, 4]; let ys = [5, 6, 7, 8]; let mut it = xs.iter()."
"chain_(ys.iter()).transform(|&x| x * 2);"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:319
msgid "printfln!(\"%?\", it.next()); // prints `Some(2)`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:325
#, no-wrap
msgid ""
"// prints `16`, `14`, `12`, `10`, `8`, `6`, `4`\n"
"for x in it.invert() {\n"
" printfln!(\"%?\", x);\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:327
msgid "## Random-access iterators"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:331
msgid ""
"The `RandomAccessIterator` trait represents an iterator offering random "
"access to the whole range. The `indexable` method retrieves the number of "
"elements accessible with the `idx` method."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:334
msgid ""
"The `chain_` adaptor is an implementation of `RandomAccessIterator` if the "
"underlying iterators are."
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:343
msgid ""
"~~~ let xs = [1, 2, 3, 4, 5]; let ys = ~[7, 9, 11]; let mut it = xs.iter()."
"chain_(ys.iter()); printfln!(\"%?\", it.idx(0)); // prints `Some(&1)` "
"printfln!(\"%?\", it.idx(5)); // prints `Some(&7)` printfln!(\"%?\", it."
"idx(7)); // prints `Some(&11)` printfln!(\"%?\", it.idx(8)); // prints `None`"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:348
msgid ""
"// yield two elements from the beginning, and one from the end it.next(); it."
"next(); it.next_back();"
msgstr ""
#. type: Plain text
#: doc/tutorial-container.md:352
msgid ""
"printfln!(\"%?\", it.idx(0)); // prints `Some(&3)` printfln!(\"%?\", it."
"idx(4)); // prints `Some(&9)` printfln!(\"%?\", it.idx(6)); // prints `None` "
"~~~"
msgstr ""

View File

@ -1,602 +0,0 @@
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The Rust Project Developers
# This file is distributed under the same license as the Rust package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8\n"
"POT-Creation-Date: 2013-08-10 07:44+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
#: doc/rust.md:4 doc/rustpkg.md:4 doc/tutorial.md:4
#: doc/tutorial-borrowed-ptr.md:4 doc/tutorial-ffi.md:4
#: doc/tutorial-macros.md:4 doc/tutorial-tasks.md:4
msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/tutorial.md:868 doc/tutorial-ffi.md:143
msgid "# Destructors"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:2
msgid "% Rust Foreign Function Interface Tutorial"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:10
msgid ""
"This tutorial will use the [snappy](https://code.google.com/p/snappy/) "
"compression/decompression library as an introduction to writing bindings for "
"foreign code. Rust is currently unable to call directly into a C++ library, "
"but snappy includes a C interface (documented in [`snappy-c.h`](https://code."
"google.com/p/snappy/source/browse/trunk/snappy-c.h))."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:13
msgid ""
"The following is a minimal example of calling a foreign function which will "
"compile if snappy is installed:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:16
msgid "~~~~ {.xfail-test} use std::libc::size_t;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:21
#, no-wrap
msgid ""
"#[link_args = \"-lsnappy\"]\n"
"extern {\n"
" fn snappy_max_compressed_length(source_length: size_t) -> size_t;\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:27
#, no-wrap
msgid ""
"fn main() {\n"
" let x = unsafe { snappy_max_compressed_length(100) };\n"
" println(fmt!(\"max compressed length of a 100 byte buffer: %?\", x));\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:31
msgid ""
"The `extern` block is a list of function signatures in a foreign library, in "
"this case with the platform's C ABI. The `#[link_args]` attribute is used to "
"instruct the linker to link against the snappy library so the symbols are "
"resolved."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:37
msgid ""
"Foreign functions are assumed to be unsafe so calls to them need to be "
"wrapped with `unsafe {}` as a promise to the compiler that everything "
"contained within truly is safe. C libraries often expose interfaces that "
"aren't thread-safe, and almost any function that takes a pointer argument "
"isn't valid for all possible inputs since the pointer could be dangling, and "
"raw pointers fall outside of Rust's safe memory model."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:41
msgid ""
"When declaring the argument types to a foreign function, the Rust compiler "
"will not check if the declaration is correct, so specifying it correctly is "
"part of keeping the binding correct at runtime."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:43
msgid "The `extern` block can be extended to cover the entire snappy API:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:46
msgid "~~~~ {.xfail-test} use std::libc::{c_int, size_t};"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:65
#, no-wrap
msgid ""
"#[link_args = \"-lsnappy\"]\n"
"extern {\n"
" fn snappy_compress(input: *u8,\n"
" input_length: size_t,\n"
" compressed: *mut u8,\n"
" compressed_length: *mut size_t) -> c_int;\n"
" fn snappy_uncompress(compressed: *u8,\n"
" compressed_length: size_t,\n"
" uncompressed: *mut u8,\n"
" uncompressed_length: *mut size_t) -> c_int;\n"
" fn snappy_max_compressed_length(source_length: size_t) -> size_t;\n"
" fn snappy_uncompressed_length(compressed: *u8,\n"
" compressed_length: size_t,\n"
" result: *mut size_t) -> c_int;\n"
" fn snappy_validate_compressed_buffer(compressed: *u8,\n"
" compressed_length: size_t) -> c_int;\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:67
msgid "# Creating a safe interface"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:71
msgid ""
"The raw C API needs to be wrapped to provide memory safety and make use of "
"higher-level concepts like vectors. A library can choose to expose only the "
"safe, high-level interface and hide the unsafe internal details."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:76
msgid ""
"Wrapping the functions which expect buffers involves using the `vec::raw` "
"module to manipulate Rust vectors as pointers to memory. Rust's vectors are "
"guaranteed to be a contiguous block of memory. The length is number of "
"elements currently contained, and the capacity is the total size in elements "
"of the allocated memory. The length is less than or equal to the capacity."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:84
#, no-wrap
msgid ""
"~~~~ {.xfail-test}\n"
"pub fn validate_compressed_buffer(src: &[u8]) -> bool {\n"
" unsafe {\n"
" snappy_validate_compressed_buffer(src.as_ptr(), src.len() as size_t) == 0\n"
" }\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:88
msgid ""
"The `validate_compressed_buffer` wrapper above makes use of an `unsafe` "
"block, but it makes the guarantee that calling it is safe for all inputs by "
"leaving off `unsafe` from the function signature."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:91
msgid ""
"The `snappy_compress` and `snappy_uncompress` functions are more complex, "
"since a buffer has to be allocated to hold the output too."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:96
msgid ""
"The `snappy_max_compressed_length` function can be used to allocate a vector "
"with the maximum required capacity to hold the compressed output. The vector "
"can then be passed to the `snappy_compress` function as an output parameter. "
"An output parameter is also passed to retrieve the true length after "
"compression for setting the length."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:102
#, no-wrap
msgid ""
"~~~~ {.xfail-test}\n"
"pub fn compress(src: &[u8]) -> ~[u8] {\n"
" unsafe {\n"
" let srclen = src.len() as size_t;\n"
" let psrc = src.as_ptr();\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:106
#, no-wrap
msgid ""
" let mut dstlen = snappy_max_compressed_length(srclen);\n"
" let mut dst = vec::with_capacity(dstlen as uint);\n"
" let pdst = dst.as_mut_ptr();\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:113
#, no-wrap
msgid ""
" snappy_compress(psrc, srclen, pdst, &mut dstlen);\n"
" dst.set_len(dstlen as uint);\n"
" dst\n"
" }\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:116
msgid ""
"Decompression is similar, because snappy stores the uncompressed size as "
"part of the compression format and `snappy_uncompressed_length` will "
"retrieve the exact buffer size required."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:122
#, no-wrap
msgid ""
"~~~~ {.xfail-test}\n"
"pub fn uncompress(src: &[u8]) -> Option<~[u8]> {\n"
" unsafe {\n"
" let srclen = src.len() as size_t;\n"
" let psrc = src.as_ptr();\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:125
#, no-wrap
msgid ""
" let mut dstlen: size_t = 0;\n"
" snappy_uncompressed_length(psrc, srclen, &mut dstlen);\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:128
#, no-wrap
msgid ""
" let mut dst = vec::with_capacity(dstlen as uint);\n"
" let pdst = dst.as_mut_ptr();\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:138
#, no-wrap
msgid ""
" if snappy_uncompress(psrc, srclen, pdst, &mut dstlen) == 0 {\n"
" dst.set_len(dstlen as uint);\n"
" Some(dst)\n"
" } else {\n"
" None // SNAPPY_INVALID_INPUT\n"
" }\n"
" }\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:141
msgid ""
"For reference, the examples used here are also available as an [library on "
"GitHub](https://github.com/thestinger/rust-snappy)."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:147
msgid ""
"Foreign libraries often hand off ownership of resources to the calling code, "
"which should be wrapped in a destructor to provide safety and guarantee "
"their release."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:150
msgid ""
"A type with the same functionality as owned boxes can be implemented by "
"wrapping `malloc` and `free`:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:156
msgid ""
"~~~~ use std::cast; use std::libc::{c_void, size_t, malloc, free}; use std::"
"ptr; use std::unstable::intrinsics;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:161
#, no-wrap
msgid ""
"// a wrapper around the handle returned by the foreign code\n"
"pub struct Unique<T> {\n"
" priv ptr: *mut T\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:172
#, no-wrap
msgid ""
"impl<T: Send> Unique<T> {\n"
" pub fn new(value: T) -> Unique<T> {\n"
" unsafe {\n"
" let ptr = malloc(std::mem::size_of::<T>() as size_t) as *mut T;\n"
" assert!(!ptr::is_null(ptr));\n"
" // `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it\n"
" intrinsics::move_val_init(&mut *ptr, value);\n"
" Unique{ptr: ptr}\n"
" }\n"
" }\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:177
#, no-wrap
msgid ""
" // the 'r lifetime results in the same semantics as `&*x` with ~T\n"
" pub fn borrow<'r>(&'r self) -> &'r T {\n"
" unsafe { cast::copy_lifetime(self, &*self.ptr) }\n"
" }\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:183
#, no-wrap
msgid ""
" // the 'r lifetime results in the same semantics as `&mut *x` with ~T\n"
" pub fn borrow_mut<'r>(&'r mut self) -> &'r mut T {\n"
" unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }\n"
" }\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:195
#, no-wrap
msgid ""
"#[unsafe_destructor]\n"
"impl<T: Send> Drop for Unique<T> {\n"
" fn drop(&self) {\n"
" unsafe {\n"
" let x = intrinsics::init(); // dummy value to swap in\n"
" // moving the object out is needed to call the destructor\n"
" ptr::replace_ptr(self.ptr, x);\n"
" free(self.ptr as *c_void)\n"
" }\n"
" }\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:202
#, no-wrap
msgid ""
"// A comparison between the built-in ~ and this reimplementation\n"
"fn main() {\n"
" {\n"
" let mut x = ~5;\n"
" *x = 10;\n"
" } // `x` is freed here\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:209
#, no-wrap
msgid ""
" {\n"
" let mut y = Unique::new(5);\n"
" *y.borrow_mut() = 10;\n"
" } // `y` is freed here\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:211
msgid "# Linking"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:215
msgid ""
"In addition to the `#[link_args]` attribute for explicitly passing arguments "
"to the linker, an `extern mod` block will pass `-lmodname` to the linker by "
"default unless it has a `#[nolink]` attribute applied."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:217
msgid "# Unsafe blocks"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:221
msgid ""
"Some operations, like dereferencing unsafe pointers or calling functions "
"that have been marked unsafe are only allowed inside unsafe blocks. Unsafe "
"blocks isolate unsafety and are a promise to the compiler that the unsafety "
"does not leak out of the block."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:224
msgid ""
"Unsafe functions, on the other hand, advertise it to the world. An unsafe "
"function is written like this:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:228
msgid "~~~~ unsafe fn kaboom(ptr: *int) -> int { *ptr } ~~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:230
msgid ""
"This function can only be called from an `unsafe` block or another `unsafe` "
"function."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:232
msgid "# Accessing foreign globals"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:236
msgid ""
"Foreign APIs often export a global variable which could do something like "
"track global state. In order to access these variables, you declare them in "
"`extern` blocks with the `static` keyword:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:239
msgid "~~~{.xfail-test} use std::libc;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:244
#, no-wrap
msgid ""
"#[link_args = \"-lreadline\"]\n"
"extern {\n"
" static rl_readline_version: libc::c_int;\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:250
#, no-wrap
msgid ""
"fn main() {\n"
" println(fmt!(\"You have readline version %d installed.\",\n"
" rl_readline_version as int));\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:254
msgid ""
"Alternatively, you may need to alter global state provided by a foreign "
"interface. To do this, statics can be declared with `mut` so rust can mutate "
"them."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:258
msgid "~~~{.xfail-test} use std::libc; use std::ptr;"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:263
#, no-wrap
msgid ""
"#[link_args = \"-lreadline\"]\n"
"extern {\n"
" static mut rl_prompt: *libc::c_char;\n"
"}\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:272
#, no-wrap
msgid ""
"fn main() {\n"
" do \"[my-awesome-shell] $\".as_c_str |buf| {\n"
" unsafe { rl_prompt = buf; }\n"
" // get a line, process it\n"
" unsafe { rl_prompt = ptr::null(); }\n"
" }\n"
"}\n"
"~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:274
msgid "# Foreign calling conventions"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:279
msgid ""
"Most foreign code exposes a C ABI, and Rust uses the platform's C calling "
"convention by default when calling foreign functions. Some foreign "
"functions, most notably the Windows API, use other calling conventions. Rust "
"provides the `abi` attribute as a way to hint to the compiler which calling "
"convention to use:"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:288
#, no-wrap
msgid ""
"~~~~\n"
"#[cfg(target_os = \"win32\")]\n"
"#[abi = \"stdcall\"]\n"
"#[link_name = \"kernel32\"]\n"
"extern {\n"
" fn SetEnvironmentVariableA(n: *u8, v: *u8) -> int;\n"
"}\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:292
msgid ""
"The `abi` attribute applies to a foreign module (it cannot be applied to a "
"single function within a module), and must be either `\"cdecl\"` or `"
"\"stdcall\"`. The compiler may eventually support other calling conventions."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:294
msgid "# Interoperability with foreign code"
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:298
msgid ""
"Rust guarantees that the layout of a `struct` is compatible with the "
"platform's representation in C. A `#[packed]` attribute is available, which "
"will lay out the struct members without padding. However, there are "
"currently no guarantees about the layout of an `enum`."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:305
msgid ""
"Rust's owned and managed boxes use non-nullable pointers as handles which "
"point to the contained object. However, they should not be manually created "
"because they are managed by internal allocators. Borrowed pointers can "
"safely be assumed to be non-nullable pointers directly to the type. However, "
"breaking the borrow checking or mutability rules is not guaranteed to be "
"safe, so prefer using raw pointers (`*`) if that's needed because the "
"compiler can't make as many assumptions about them."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:310
msgid ""
"Vectors and strings share the same basic memory layout, and utilities are "
"available in the `vec` and `str` modules for working with C APIs. Strings "
"are terminated with `\\0` for interoperability with C, but it should not be "
"assumed because a slice will not always be nul-terminated. Instead, the "
"`str::as_c_str` function should be used."
msgstr ""
#. type: Plain text
#: doc/tutorial-ffi.md:312
msgid ""
"The standard library includes type aliases and function definitions for the "
"C standard library in the `libc` module, and Rust links against `libc` and "
"`libm` by default."
msgstr ""

View File

@ -1,683 +0,0 @@
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR The Rust Project Developers
# This file is distributed under the same license as the Rust package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Rust 0.8\n"
"POT-Creation-Date: 2013-07-22 23:37+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. type: Plain text
#: doc/rust.md:4 doc/rustpkg.md:4 doc/tutorial.md:4
#: doc/tutorial-borrowed-ptr.md:4 doc/tutorial-ffi.md:4
#: doc/tutorial-macros.md:4 doc/tutorial-tasks.md:4
msgid "# Introduction"
msgstr ""
#. type: Plain text
#: doc/rust.md:2136 doc/rust.md:2223 doc/tutorial-macros.md:323
msgid "~~~~"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:2
msgid "% Rust Macros Tutorial"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:12
msgid ""
"Functions are the primary tool that programmers can use to build "
"abstractions. Sometimes, however, programmers want to abstract over compile-"
"time syntax rather than run-time values. Macros provide syntactic "
"abstraction. For an example of how this can be useful, consider the "
"following two code fragments, which both pattern-match on their input and "
"both return early in one case, doing nothing otherwise:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:30
#, no-wrap
msgid ""
"~~~~\n"
"# enum t { special_a(uint), special_b(uint) };\n"
"# fn f() -> uint {\n"
"# let input_1 = special_a(0);\n"
"# let input_2 = special_a(0);\n"
"match input_1 {\n"
" special_a(x) => { return x; }\n"
" _ => {}\n"
"}\n"
"// ...\n"
"match input_2 {\n"
" special_b(x) => { return x; }\n"
" _ => {}\n"
"}\n"
"# return 0u;\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:38
msgid ""
"This code could become tiresome if repeated many times. However, no "
"function can capture its functionality to make it possible to abstract the "
"repetition away. Rust's macro system, however, can eliminate the "
"repetition. Macros are lightweight custom syntax extensions, themselves "
"defined using the `macro_rules!` syntax extension. The following "
"`early_return` macro captures the pattern in the above code:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:59
#, no-wrap
msgid ""
"~~~~\n"
"# enum t { special_a(uint), special_b(uint) };\n"
"# fn f() -> uint {\n"
"# let input_1 = special_a(0);\n"
"# let input_2 = special_a(0);\n"
"macro_rules! early_return(\n"
" ($inp:expr $sp:ident) => ( // invoke it like `(input_5 special_e)`\n"
" match $inp {\n"
" $sp(x) => { return x; }\n"
" _ => {}\n"
" }\n"
" );\n"
")\n"
"// ...\n"
"early_return!(input_1 special_a);\n"
"// ...\n"
"early_return!(input_2 special_b);\n"
"# return 0;\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:65
msgid ""
"Macros are defined in pattern-matching style: in the above example, the text "
"`($inp:expr $sp:ident)` that appears on the left-hand side of the `=>` is "
"the *macro invocation syntax*, a pattern denoting how to write a call to the "
"macro. The text on the right-hand side of the `=>`, beginning with `match "
"$inp`, is the *macro transcription syntax*: what the macro expands to."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:67
msgid "# Invocation syntax"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:71
msgid ""
"The macro invocation syntax specifies the syntax for the arguments to the "
"macro. It appears on the left-hand side of the `=>` in a macro definition. "
"It conforms to the following rules:"
msgstr ""
#. type: Bullet: '1. '
#: doc/tutorial-macros.md:76
msgid "It must be surrounded by parentheses."
msgstr ""
#. type: Bullet: '2. '
#: doc/tutorial-macros.md:76
msgid "`$` has special meaning (described below)."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:76
#, no-wrap
msgid ""
"3. The `()`s, `[]`s, and `{}`s it contains must balance. For example, `([)` is\n"
"forbidden.\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:78
msgid "Otherwise, the invocation syntax is free-form."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:83
#, no-wrap
msgid ""
"To take as an argument a fragment of Rust code, write `$` followed by a name\n"
" (for use on the right-hand side), followed by a `:`, followed by a *fragment\n"
" specifier*. The fragment specifier denotes the sort of fragment to match. The\n"
" most common fragment specifiers are:\n"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-macros.md:92
msgid ""
"`ident` (an identifier, referring to a variable or item. Examples: `f`, `x`, "
"`foo`.)"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-macros.md:92
msgid ""
"`expr` (an expression. Examples: `2 + 2`; `if true then { 1 } else { 2 }`; "
"`f(42)`.)"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-macros.md:92
msgid "`ty` (a type. Examples: `int`, `~[(char, ~str)]`, `&T`.)"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-macros.md:92
msgid ""
"`pat` (a pattern, usually appearing in a `match` or on the left-hand side of "
"a declaration. Examples: `Some(t)`; `(17, 'a')`; `_`.)"
msgstr ""
#. type: Bullet: '* '
#: doc/tutorial-macros.md:92
msgid ""
"`block` (a sequence of actions. Example: `{ log(error, \"hi\"); return 12; }"
"`)"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:95
msgid ""
"The parser interprets any token that's not preceded by a `$` literally. "
"Rust's usual rules of tokenization apply,"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:98
msgid ""
"So `($x:ident -> (($e:expr)))`, though excessively fancy, would designate a "
"macro that could be invoked like: `my_macro!(i->(( 2+2 )))`."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:100
msgid "## Invocation location"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:105
msgid ""
"A macro invocation may take the place of (and therefore expand to) an "
"expression, an item, or a statement. The Rust parser will parse the macro "
"invocation as a \"placeholder\" for whichever of those three nonterminals is "
"appropriate for the location."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:112
msgid ""
"At expansion time, the output of the macro will be parsed as whichever of "
"the three nonterminals it stands in for. This means that a single macro "
"might, for example, expand to an item or an expression, depending on its "
"arguments (and cause a syntax error if it is called with the wrong argument "
"for its location). Although this behavior sounds excessively dynamic, it is "
"known to be useful under some circumstances."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:115
msgid "# Transcription syntax"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:119
msgid ""
"The right-hand side of the `=>` follows the same rules as the left-hand "
"side, except that a `$` need only be followed by the name of the syntactic "
"fragment to transcribe into the macro expansion; its type need not be "
"repeated."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:126
msgid ""
"The right-hand side must be enclosed by delimiters, which the transcriber "
"ignores. Therefore `() => ((1,2,3))` is a macro that expands to a tuple "
"expression, `() => (let $x=$val)` is a macro that expands to a statement, "
"and `() => (1,2,3)` is a macro that expands to a syntax error (since the "
"transcriber interprets the parentheses on the right-hand-size as delimiters, "
"and `1,2,3` is not a valid Rust expression on its own)."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:133
msgid ""
"Except for permissibility of `$name` (and `$(...)*`, discussed below), the "
"right-hand side of a macro definition is ordinary Rust syntax. In "
"particular, macro invocations (including invocations of the macro currently "
"being defined) are permitted in expression, statement, and item locations. "
"However, nothing else about the code is examined or executed by the macro "
"system; execution still has to wait until run-time."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:135
msgid "## Interpolation location"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:139
msgid ""
"The interpolation `$argument_name` may appear in any location consistent "
"with its fragment specifier (i.e., if it is specified as `ident`, it may be "
"used anywhere an identifier is permitted)."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:141
msgid "# Multiplicity"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:143
msgid "## Invocation"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:150
msgid ""
"Going back to the motivating example, recall that `early_return` expanded "
"into a `match` that would `return` if the `match`'s scrutinee matched the "
"\"special case\" identifier provided as the second argument to "
"`early_return`, and do nothing otherwise. Now suppose that we wanted to "
"write a version of `early_return` that could handle a variable number of "
"\"special\" cases."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:156
msgid ""
"The syntax `$(...)*` on the left-hand side of the `=>` in a macro definition "
"accepts zero or more occurrences of its contents. It works much like the `*` "
"operator in regular expressions. It also supports a separator token (a comma-"
"separated list could be written `$(...),*`), and `+` instead of `*` to mean "
"\"at least one\"."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:179
#, no-wrap
msgid ""
"~~~~\n"
"# enum t { special_a(uint),special_b(uint),special_c(uint),special_d(uint)};\n"
"# fn f() -> uint {\n"
"# let input_1 = special_a(0);\n"
"# let input_2 = special_a(0);\n"
"macro_rules! early_return(\n"
" ($inp:expr, [ $($sp:ident)|+ ]) => (\n"
" match $inp {\n"
" $(\n"
" $sp(x) => { return x; }\n"
" )+\n"
" _ => {}\n"
" }\n"
" );\n"
")\n"
"// ...\n"
"early_return!(input_1, [special_a|special_c|special_d]);\n"
"// ...\n"
"early_return!(input_2, [special_b]);\n"
"# return 0;\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:181
msgid "### Transcription"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:191
msgid ""
"As the above example demonstrates, `$(...)*` is also valid on the right-hand "
"side of a macro definition. The behavior of `*` in transcription, especially "
"in cases where multiple `*`s are nested, and multiple different names are "
"involved, can seem somewhat magical and intuitive at first. The system that "
"interprets them is called \"Macro By Example\". The two rules to keep in "
"mind are (1) the behavior of `$(...)*` is to walk through one \"layer\" of "
"repetitions for all of the `$name`s it contains in lockstep, and (2) each `"
"$name` must be under at least as many `$(...)*`s as it was matched against. "
"If it is under more, it'll be repeated, as appropriate."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:193
msgid "## Parsing limitations"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:197
msgid ""
"For technical reasons, there are two limitations to the treatment of syntax "
"fragments by the macro parser:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:210
#, no-wrap
msgid ""
"1. The parser will always parse as much as possible of a Rust syntactic\n"
"fragment. For example, if the comma were omitted from the syntax of\n"
"`early_return!` above, `input_1 [` would've been interpreted as the beginning\n"
"of an array index. In fact, invoking the macro would have been impossible.\n"
"2. The parser must have eliminated all ambiguity by the time it reaches a\n"
"`$name:fragment_specifier` declaration. This limitation can result in parse\n"
"errors when declarations occur at the beginning of, or immediately after,\n"
"a `$(...)*`. For example, the grammar `$($t:ty)* $e:expr` will always fail to\n"
"parse because the parser would be forced to choose between parsing `t` and\n"
"parsing `e`. Changing the invocation syntax to require a distinctive token in\n"
"front can solve the problem. In the above example, `$(T $t:ty)* E $e:exp`\n"
"solves the problem.\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:212
msgid "# Macro argument pattern matching"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:214
msgid "Now consider code like the following:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:216
msgid "## Motivation"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:236
#, no-wrap
msgid ""
"~~~~\n"
"# enum t1 { good_1(t2, uint), bad_1 };\n"
"# pub struct t2 { body: t3 }\n"
"# enum t3 { good_2(uint), bad_2};\n"
"# fn f(x: t1) -> uint {\n"
"match x {\n"
" good_1(g1, val) => {\n"
" match g1.body {\n"
" good_2(result) => {\n"
" // complicated stuff goes here\n"
" return result + val;\n"
" },\n"
" _ => fail!(\"Didn't get good_2\")\n"
" }\n"
" }\n"
" _ => return 0 // default value\n"
"}\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:241
msgid ""
"All the complicated stuff is deeply indented, and the error-handling code is "
"separated from matches that fail. We'd like to write a macro that performs a "
"match, but with a syntax that suits the problem better. The following macro "
"can solve the problem:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:263
#, no-wrap
msgid ""
"~~~~\n"
"macro_rules! biased_match (\n"
" // special case: `let (x) = ...` is illegal, so use `let x = ...` instead\n"
" ( ($e:expr) ~ ($p:pat) else $err:stmt ;\n"
" binds $bind_res:ident\n"
" ) => (\n"
" let $bind_res = match $e {\n"
" $p => ( $bind_res ),\n"
" _ => { $err }\n"
" };\n"
" );\n"
" // more than one name; use a tuple\n"
" ( ($e:expr) ~ ($p:pat) else $err:stmt ;\n"
" binds $( $bind_res:ident ),*\n"
" ) => (\n"
" let ( $( $bind_res ),* ) = match $e {\n"
" $p => ( $( $bind_res ),* ),\n"
" _ => { $err }\n"
" };\n"
" )\n"
")\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:277
#, no-wrap
msgid ""
"# enum t1 { good_1(t2, uint), bad_1 };\n"
"# pub struct t2 { body: t3 }\n"
"# enum t3 { good_2(uint), bad_2};\n"
"# fn f(x: t1) -> uint {\n"
"biased_match!((x) ~ (good_1(g1, val)) else { return 0 };\n"
" binds g1, val )\n"
"biased_match!((g1.body) ~ (good_2(result) )\n"
" else { fail!(\"Didn't get good_2\") };\n"
" binds result )\n"
"// complicated stuff goes here\n"
"return result + val;\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:288
#, no-wrap
msgid ""
"This solves the indentation problem. But if we have a lot of chained matches\n"
"like this, we might prefer to write a single macro invocation. The input\n"
"pattern we want is clear:\n"
"~~~~\n"
"# macro_rules! b(\n"
" ( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*\n"
" binds $( $bind_res:ident ),*\n"
" )\n"
"# => (0))\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:291
msgid ""
"However, it's not possible to directly expand to nested match statements. "
"But there is a solution."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:293
msgid "## The recursive approach to macro writing"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:297
msgid ""
"A macro may accept multiple different input grammars. The first one to "
"successfully match the actual argument to a macro invocation is the one that "
"\"wins\"."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:301
msgid ""
"In the case of the example above, we want to write a recursive macro to "
"process the semicolon-terminated lines, one-by-one. So, we want the "
"following input patterns:"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:308
#, no-wrap
msgid ""
"~~~~\n"
"# macro_rules! b(\n"
" ( binds $( $bind_res:ident ),* )\n"
"# => (0))\n"
"~~~~\n"
"...and:\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:317
#, no-wrap
msgid ""
"~~~~\n"
"# macro_rules! b(\n"
" ( ($e :expr) ~ ($p :pat) else $err :stmt ;\n"
" $( ($e_rest:expr) ~ ($p_rest:pat) else $err_rest:stmt ; )*\n"
" binds $( $bind_res:ident ),*\n"
" )\n"
"# => (0))\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:321
msgid ""
"The resulting macro looks like this. Note that the separation into "
"`biased_match!` and `biased_match_rec!` occurs only because we have an outer "
"piece of syntax (the `let`) which we only want to transcribe once."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:342
#, no-wrap
msgid ""
"macro_rules! biased_match_rec (\n"
" // Handle the first layer\n"
" ( ($e :expr) ~ ($p :pat) else $err :stmt ;\n"
" $( ($e_rest:expr) ~ ($p_rest:pat) else $err_rest:stmt ; )*\n"
" binds $( $bind_res:ident ),*\n"
" ) => (\n"
" match $e {\n"
" $p => {\n"
" // Recursively handle the next layer\n"
" biased_match_rec!($( ($e_rest) ~ ($p_rest) else $err_rest ; )*\n"
" binds $( $bind_res ),*\n"
" )\n"
" }\n"
" _ => { $err }\n"
" }\n"
" );\n"
" ( binds $( $bind_res:ident ),* ) => ( ($( $bind_res ),*) )\n"
")\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:364
#, no-wrap
msgid ""
"// Wrap the whole thing in a `let`.\n"
"macro_rules! biased_match (\n"
" // special case: `let (x) = ...` is illegal, so use `let x = ...` instead\n"
" ( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*\n"
" binds $bind_res:ident\n"
" ) => (\n"
" let ( $( $bind_res ),* ) = biased_match_rec!(\n"
" $( ($e) ~ ($p) else $err ; )*\n"
" binds $bind_res\n"
" );\n"
" );\n"
" // more than one name: use a tuple\n"
" ( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*\n"
" binds $( $bind_res:ident ),*\n"
" ) => (\n"
" let ( $( $bind_res ),* ) = biased_match_rec!(\n"
" $( ($e) ~ ($p) else $err ; )*\n"
" binds $( $bind_res ),*\n"
" );\n"
" )\n"
")\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:378
#, no-wrap
msgid ""
"# enum t1 { good_1(t2, uint), bad_1 };\n"
"# pub struct t2 { body: t3 }\n"
"# enum t3 { good_2(uint), bad_2};\n"
"# fn f(x: t1) -> uint {\n"
"biased_match!(\n"
" (x) ~ (good_1(g1, val)) else { return 0 };\n"
" (g1.body) ~ (good_2(result) ) else { fail!(\"Didn't get good_2\") };\n"
" binds val, result )\n"
"// complicated stuff goes here\n"
"return result + val;\n"
"# }\n"
"~~~~\n"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:382
msgid ""
"This technique applies to many cases where transcribing a result all at once "
"is not possible. The resulting code resembles ordinary functional "
"programming in some respects, but has some important differences from "
"functional programming."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:390
msgid ""
"The first difference is important, but also easy to forget: the "
"transcription (right-hand) side of a `macro_rules!` rule is literal syntax, "
"which can only be executed at run-time. If a piece of transcription syntax "
"does not itself appear inside another macro invocation, it will become part "
"of the final program. If it is inside a macro invocation (for example, the "
"recursive invocation of `biased_match_rec!`), it does have the opportunity "
"to affect transcription, but only through the process of attempted pattern "
"matching."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:398
msgid ""
"The second, related, difference is that the evaluation order of macros feels "
"\"backwards\" compared to ordinary programming. Given an invocation `m1!(m2!"
"())`, the expander first expands `m1!`, giving it as input the literal "
"syntax `m2!()`. If it transcribes its argument unchanged into an appropriate "
"position (in particular, not as an argument to yet another macro "
"invocation), the expander will then proceed to evaluate `m2!()` (along with "
"any other macro invocations `m1!(m2!())` produced)."
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:400
msgid "# A final note"
msgstr ""
#. type: Plain text
#: doc/tutorial-macros.md:407
msgid ""
"Macros, as currently implemented, are not for the faint of heart. Even "
"ordinary syntax errors can be more difficult to debug when they occur inside "
"a macro, and errors caused by parse problems in generated code can be very "
"tricky. Invoking the `log_syntax!` macro can help elucidate intermediate "
"states, invoking `trace_macros!(true)` will automatically print those "
"intermediate states out, and passing the flag `--pretty expanded` as a "
"command-line argument to the compiler will show the result of expansion."
msgstr ""

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff