Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby-hacking-guide/ruby-hacking-guide.github.com
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ae5eb295a0fe00ba7e408807f7d310b9535becb2
Choose a base ref
..
head repository: ruby-hacking-guide/ruby-hacking-guide.github.com
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c8f234ba5a71e455ccf62e19170ef8216517420e
Choose a head ref
Showing with 98 additions and 98 deletions.
  1. +4 −4 contextual.md
  2. +29 −29 index.md
  3. +17 −17 intro.md
  4. +1 −1 iterator.md
  5. +10 −10 load.md
  6. +6 −6 minimum.md
  7. +2 −2 object.md
  8. +1 −1 parser.md
  9. +2 −2 preface.md
  10. +1 −1 security.md
  11. +19 −19 spec.md
  12. +2 −2 syntree.md
  13. +4 −4 thread.md
8 changes: 4 additions & 4 deletions contextual.md
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@ title: Finite-state scanner
---

Translated by Peter Zotov <br>
_I'm very grateful to my employer "Evil Martians":http://evl.ms , who sponsored
the work, and "Nikolay Konovalenko":mailto:nlkonovalenko@gmail.com , who put
_I'm very grateful to my employer [Evil Martians](http://evl.ms) , who sponsored
the work, and [Nikolay Konovalenko](mailto:nlkonovalenko@gmail.com) , who put
more effort in this translation than I could ever wish for. Without them,
I would be still figuring out what `COND_LEXPOP()` actually does._

@@ -593,12 +593,12 @@ For example, for `if` if there exists a normal notation and one for postfix
modification.

```TODO-lang
* Normal notation
# Normal notation
if cond then
  expr
end
* Postfix
# Postfix
expr if cond
```

58 changes: 29 additions & 29 deletions index.md
Original file line number Diff line number Diff line change
@@ -10,67 +10,67 @@ some diagrams may be missing and some sentences may be a little
rough. But it also means they are in open review, so do not hesitate
to address issues.

* "Preface":preface.html
* "Introduction":intro.html
* [Preface](preface)
* [Introduction](intro)

### Part 1: Objects

* "Chapter 1: A Minimal Introduction to Ruby":minimum.html
* "Chapter 2: Objects":object.html
* "Chapter 3: Names and name tables":name.html
* "Chapter 4: Classes and modules":class.html
* "Chapter 5: Garbage collection":gc.html
* "Chapter 6: Variables and constants":variable.html
* "Chapter 7: Security":security.html
* [Chapter 1: A Minimal Introduction to Ruby](minimum)
* [Chapter 2: Objects](object)
* [Chapter 3: Names and name tables](name)
* [Chapter 4: Classes and modules](class)
* [Chapter 5: Garbage collection](gc)
* [Chapter 6: Variables and constants](variable)
* [Chapter 7: Security](security)

### Part 2: Syntax analysis

* "Chapter 8: Ruby Language Details":spec.html
* "Chapter 9: yacc crash course":yacc.html
* "Chapter 10: Parser":parser.html
* "Chapter 11: Finite-state scanner":contextual.html
* "Chapter 12: Syntax tree construction":syntree.html
* [Chapter 8: Ruby Language Details](spec)
* [Chapter 9: yacc crash course](yacc)
* [Chapter 10: Parser](parser)
* [Chapter 11: Finite-state scanner](contextual)
* [Chapter 12: Syntax tree construction](syntree)

### Part 3: Evaluation

* "Chapter 13: Structure of the evaluator":evaluator.html
* "Chapter 14: Context":module.html
* "Chapter 15: Methods":method.html
* "Chapter 16: Blocks":iterator.html
* "Chapter 17: Dynamic evaluation":anyeval.html
* [Chapter 13: Structure of the evaluator](evaluator)
* [Chapter 14: Context](module)
* [Chapter 15: Methods](method)
* [Chapter 16: Blocks](iterator)
* [Chapter 17: Dynamic evaluation](anyeval)

### Part 4: Around the evaluator

* "Chapter 18: Loading":load.html
* "Chapter 19: Threads":thread.html
* [Chapter 18: Loading](load)
* [Chapter 19: Threads](thread)

* "Final chapter: Ruby's future - translation unstarted":fin.html
* [Final chapter: Ruby's future - translation unstarted](fin)

About this Guide
----------------

This is a new effort to gather efforts to help translate
"Ruby Hacking Guide":http://i.loveruby.net/ja/rhg/book/ into English.
[Ruby Hacking Guide](http://i.loveruby.net/ja/rhg/book/) into English.

The official support site of the original book is
http://i.loveruby.net/ja/rhg/

You can download the version of the source code explained and
the tool used in the book
from the official support site of the original book.
* "ruby (1.7.3 2002-09-12) in tar.gz format":http://i.loveruby.net/ja/rhg/ar/ruby-rhg.tar.gz
* "ruby (1.7.3 2002-09-12) in zip format":http://i.loveruby.net/ja/rhg/ar/ruby-rhg.zip
* "Pragmatic Programmers' nodeDump 0.1.7":http://i.loveruby.net/ja/rhg/ar/nodeDump-0.1.7.tgz
* "RHG-version nodedump":http://i.loveruby.net/ja/rhg/ar/nodedump-rhg.tar.gz
* [ruby (1.7.3 2002-09-12) in tar.gz format](http://i.loveruby.net/ja/rhg/ar/ruby-rhg.tar.gz)
* [ruby (1.7.3 2002-09-12) in zip format](http://i.loveruby.net/ja/rhg/ar/ruby-rhg.zip)
* [Pragmatic Programmers' nodeDump 0.1.7](http://i.loveruby.net/ja/rhg/ar/nodeDump-0.1.7.tgz)
* [RHG-version nodedump](http://i.loveruby.net/ja/rhg/ar/nodedump-rhg.tar.gz)

The original translating project is hosted at RubyForge
http://rubyforge.org/projects/rhg

Many thanks to "RubyForge":http://rubyforge.org for hosting us and to
Many thanks to [RubyForge](http://rubyforge.org) for hosting us and to
Minero AOKI for letting us translate his work.

You can get further information about this project from
"the archives of rhg-discussion mailing list":http://rubyforge.org/pipermail/rhg-discussion/
[the archives of rhg-discussion mailing list](http://rubyforge.org/pipermail/rhg-discussion/)

There is an old SVN repo, that is hosted at
The RubyForge project page is http://rubyforge.org/projects/rhg.
34 changes: 17 additions & 17 deletions intro.md
Original file line number Diff line number Diff line change
@@ -350,19 +350,19 @@ we can also use them in C in the almost same way.
See the following example.

```TODO-lang
* Method call
# Method call
obj.method(arg) # Ruby
rb_funcall(obj, rb_intern("method"), 1, arg); # C
* Block call
# Block call
yield arg # Ruby
rb_yield(arg); # C
* Raising exception
# Raising exception
raise ArgumentError, 'wrong number of arguments' # Ruby
rb_raise(rb_eArgError, "wrong number of arguments"); # C
* Generating an object
# Generating an object
arr = Array.new # Ruby
VALUE arr = rb_ary_new(); # C
```
@@ -971,19 +971,19 @@ Its content is something like this.
```TODO-lang
* HAVE_SYS_STAT_H 1
* HAVE_STDLIB_H 1
* HAVE_STRING_H 1
* HAVE_MEMORY_H 1
* HAVE_STRINGS_H 1
* HAVE_INTTYPES_H 1
* HAVE_STDINT_H 1
* HAVE_UNISTD_H 1
* _FILE_OFFSET_BITS 64
* HAVE_LONG_LONG 1
* HAVE_OFF_T 1
* SIZEOF_INT 4
* SIZEOF_SHORT 2
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define _FILE_OFFSET_BITS 64
#define HAVE_LONG_LONG 1
#define HAVE_OFF_T 1
#define SIZEOF_INT 4
#define SIZEOF_SHORT 2
```
2 changes: 1 addition & 1 deletion iterator.md
Original file line number Diff line number Diff line change
@@ -701,7 +701,7 @@ I'll tell the reason in advance. I'd like you to see the below program:
[0].each do
break
end
* the place to reach by break
# the place to reach by break
```


20 changes: 10 additions & 10 deletions load.md
Original file line number Diff line number Diff line change
@@ -147,13 +147,13 @@ defined constants will be top-level constants and the defined methods
will be function-style methods.

```TODO-lang
* mylib.rb
### mylib.rb
MY_OBJECT = Object.new
def my_p(obj)
p obj
end
* first.rb
### first.rb
require 'mylib'
my_p MY_OBJECT # we can use the constants and methods defined in an other file
```
@@ -409,7 +409,7 @@ Thread.fork {
require 'foo' # At the beginning of require, foo.rb is added to $"
} # However the thread changes during the evaluation of foo.rb
require 'foo' # foo.rb is already in $" so the function returns immediately
* (A) the classes of foo are used...
# (A) the classes of foo are used...
```

By doing something like this, even though the `foo` library is not
@@ -932,18 +932,18 @@ void*
dln_load(file)
const char *file;
{
* defined _WIN32 && !defined __CYGWIN__
#if defined _WIN32 && !defined __CYGWIN__
load with Win32 API
* #else
#else
initialization depending on each platform
* each platform
#ifdef each platform
……routines for each platform……
* #endif
* #endif
* !defined(_AIX) && !defined(NeXT)
#endif
#endif
#if !defined(_AIX) && !defined(NeXT)
failed:
rb_loaderror("%s - %s", error, file);
* #endif
#endif
return 0; /* dummy return */
}
```
12 changes: 6 additions & 6 deletions minimum.md
Original file line number Diff line number Diff line change
@@ -71,13 +71,13 @@ the so-called literals.
First the integers and floating point numbers.

```TODO-lang
* Integer
# Integer
1
2
100
9999999999999999999999999 # Arbitrarily big integers
* Float
# Float
1.0
99.999
1.3e4 # 1.3×10^4
@@ -352,8 +352,8 @@ many others are defined. So it looks as if each string object can respond to all
methods.

```TODO-lang
* They all belong to the String class,
* hence the same methods are defined
# They all belong to the String class,
# hence the same methods are defined
"content".upcase()
"This is a pen.".upcase()
"chapter II".upcase()
@@ -875,7 +875,7 @@ How is its relationship to modules?
For instance, let's think of the following case.

```TODO-lang
* modcls.rb
# modcls.rb
class Cls
def test()
@@ -1185,7 +1185,7 @@ any special preparation.
To partition the namespace of class names one has to explicitly nest modules as shown below.

```TODO-lang
* example of the namespace partition of net library
# example of the namespace partition of net library
module Net
class SMTP
# ...
4 changes: 2 additions & 2 deletions object.md
Original file line number Diff line number Diff line change
@@ -426,7 +426,7 @@ bit is 0. Then only `Qfalse` and `Qnil` become 0 with a bitwise and.

`!=0` has been added to be certain to only have 0 or 1, to satisfy the
requirements of the glib library that only wants 0 or 1
("[ruby-dev:11049]":http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/11049).
([[ruby-dev:11049]](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/11049).)

By the way, what is the '`Q`' of `Qnil`? 'R' I would have understood but why
'`Q`'? When I asked, the answer was "Because it's like that in Emacs." I did
@@ -1071,7 +1071,7 @@ rb_ary_push(ary, INT2FIX(9)); /* push a Ruby 9 */
RARRAY(ary)->ptr[0]; /* look what's at index 0 */
rb_p(RARRAY(ary)->ptr[0]); /* do p on ary[0] (the result is 9) */
* manage an array from Ruby
# manage an array from Ruby
ary = [] # create an empty array
ary.push(9) # push 9
ary[0] # look what's at index 0
2 changes: 1 addition & 1 deletion parser.md
Original file line number Diff line number Diff line change
@@ -507,7 +507,7 @@ For example, the following usage is possible ...

```TODO-lang
valid_items.include? arg or raise ArgumentError, 'invalid arg'
* valid_items.include?(arg) or raise(ArgumentError, 'invalid arg')
# valid_items.include?(arg) or raise(ArgumentError, 'invalid arg')
```


4 changes: 2 additions & 2 deletions preface.md
Original file line number Diff line number Diff line change
@@ -298,10 +298,10 @@ p(right). Minero Aoki


If you want to send remarks, suggestions and reports of typographcal errors,
please address to "Minero Aoki &lt;aamine@loveruby.net&gt;":mailto:aamine@loveruby.net .
please address to [Minero Aoki &lt;aamine@loveruby.net&gt;](mailto:aamine@loveruby.net).


"Rubyソースコード完全解説" can be reserved/ordered at ImpressDirect.
"(Jump to the introduction page)":http://direct.ips.co.jp/directsys/go_x_TempChoice.cfm?sh_id=EE0040&spm_id=1&GM_ID=1721
[(Jump to the introduction page)](http://direct.ips.co.jp/directsys/go_x_TempChoice.cfm?sh_id=EE0040&spm_id=1&GM_ID=1721)

Copyright (c) 2002-2004 Minero Aoki, All rights reserved.
2 changes: 1 addition & 1 deletion security.md
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ security level raised. I haven't yet explained how to create a thread,
but I will show an example here:

```TODO-lang
* Raise the security level in a different thread
# Raise the security level in a different thread
p($SAFE) # 0 is the default
Thread.fork { # Start a different thread
$SAFE = 4 # Raise the level
Loading