晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/opt/alt/ruby18/share/ri/1.8/system/RDoc/C_Parser/ |
| Current File : //opt/alt/ruby18/share/ri/1.8/system/RDoc/C_Parser/cdesc-C_Parser.yaml |
--- !ruby/object:RI::ClassDescription
attributes:
- !ruby/object:RI::Attribute
comment:
name: progress
rw: RW
class_methods:
- !ruby/object:RI::MethodSummary
name: new
comment:
- !ruby/struct:SM::Flow::P
body: "We attempt to parse C extension files. Basically we look for the standard patterns that you find in extensions: <tt>rb_define_class, rb_define_method</tt> and so on. We also try to find the corresponding C source for the methods and extract comments, but if we fail we don't worry too much."
- !ruby/struct:SM::Flow::P
body: "The comments associated with a Ruby method are extracted from the C comment block associated with the routine that <em>implements</em> that method, that is to say the method whose name is given in the <tt>rb_define_method</tt> call. For example, you might write:"
- !ruby/struct:SM::Flow::VERB
body: " /*\n * Returns a new array that is a one-dimensional flattening of this\n * array (recursively). That is, for every element that is an array,\n * extract its elements into the new array.\n *\n * s = [ 1, 2, 3 ] #=> [1, 2, 3]\n * t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]\n * a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]\n * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n */\n static VALUE\n rb_ary_flatten(ary)\n VALUE ary;\n {\n ary = rb_obj_dup(ary);\n rb_ary_flatten_bang(ary);\n return ary;\n }\n\n ...\n\n void\n Init_Array()\n {\n ...\n rb_define_method(rb_cArray, "flatten", rb_ary_flatten, 0);\n"
- !ruby/struct:SM::Flow::P
body: Here RDoc will determine from the rb_define_method line that there's a method called "flatten" in class Array, and will look for the implementation in the method rb_ary_flatten. It will then use the comment from that method in the HTML output. This method must be in the same source file as the rb_define_method.
- !ruby/struct:SM::Flow::P
body: C classes can be diagrammed (see /tc/dl/ruby/ruby/error.c), and RDoc integrates C and Ruby source into one tree
- !ruby/struct:SM::Flow::P
body: "The comment blocks may include special directives:"
- !ruby/object:SM::Flow::LIST
contents:
- !ruby/struct:SM::Flow::LI
label: "Document-class: <i>name</i>"
body: This comment block is documentation for the given class. Use this when the <tt>Init_xxx</tt> method is not named after the class.
- !ruby/struct:SM::Flow::LI
label: "Document-method: <i>name</i>"
body: This comment documents the named method. Use when RDoc cannot automatically find the method from it's declaration
- !ruby/struct:SM::Flow::LI
label: "call-seq: <i>text up to an empty line</i>"
body: Because C source doesn't give descriptive names to Ruby-level parameters, you need to document the calling sequence explicitly
type: :LABELED
- !ruby/struct:SM::Flow::P
body: In addition, RDoc assumes by default that the C method implementing a Ruby function is in the same source file as the rb_define_method call. If this isn't the case, add the comment
- !ruby/struct:SM::Flow::VERB
body: " rb_define_method(....); // in: filename\n"
- !ruby/struct:SM::Flow::P
body: As an example, we might have an extension that defines multiple classes in its Init_xxx method. We could document them using
- !ruby/struct:SM::Flow::VERB
body: " /*\n * Document-class: MyClass\n *\n * Encapsulate the writing and reading of the configuration\n * file. ...\n */\n\n /*\n * Document-method: read_value\n *\n * call-seq:\n * cfg.read_value(key) -> value\n * cfg.read_value(key} { |key| } -> value\n *\n * Return the value corresponding to <tt>key</tt> from the configuration.\n * In the second form, if the key isn't found, invoke the\n * block and return its value.\n */\n"
constants: []
full_name: RDoc::C_Parser
includes: []
instance_methods:
- !ruby/object:RI::MethodSummary
name: do_aliases
- !ruby/object:RI::MethodSummary
name: do_classes
- !ruby/object:RI::MethodSummary
name: do_constants
- !ruby/object:RI::MethodSummary
name: do_includes
- !ruby/object:RI::MethodSummary
name: do_methods
- !ruby/object:RI::MethodSummary
name: find_attr_comment
- !ruby/object:RI::MethodSummary
name: find_body
- !ruby/object:RI::MethodSummary
name: find_class
- !ruby/object:RI::MethodSummary
name: find_class_comment
- !ruby/object:RI::MethodSummary
name: find_const_comment
- !ruby/object:RI::MethodSummary
name: find_modifiers
- !ruby/object:RI::MethodSummary
name: find_override_comment
- !ruby/object:RI::MethodSummary
name: handle_attr
- !ruby/object:RI::MethodSummary
name: handle_class_module
- !ruby/object:RI::MethodSummary
name: handle_constants
- !ruby/object:RI::MethodSummary
name: handle_ifdefs_in
- !ruby/object:RI::MethodSummary
name: handle_method
- !ruby/object:RI::MethodSummary
name: handle_tab_width
- !ruby/object:RI::MethodSummary
name: mangle_comment
- !ruby/object:RI::MethodSummary
name: progress
- !ruby/object:RI::MethodSummary
name: remove_commented_out_lines
- !ruby/object:RI::MethodSummary
name: remove_private_comments
- !ruby/object:RI::MethodSummary
name: scan
- !ruby/object:RI::MethodSummary
name: warn
name: C_Parser
superclass: Object
|