Skip to content

Commit 53e1597

Browse files
committed
* README.EXT{,.ja}: nul should be uppercase.
change 'nul' => 'NUL'. [Fix GH-1172] derived from a patch by craft4coder <yooobuntu@163.com> * doc/extension.rdoc: Improvements to english grammers. [Bug #12246][ruby-core:74792][ci skip] derived from a patch by Marcus Stollsteimer <sto.mar@web.de> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent f9a641f commit 53e1597

File tree

4 files changed

+40
-30
lines changed

4 files changed

+40
-30
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Tue Apr 26 13:38:31 2016 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* README.EXT{,.ja}: `nul` should be uppercase.
4+
change 'nul' => 'NUL'. [Fix GH-1172]
5+
derived from a patch by craft4coder <yooobuntu@163.com>
6+
7+
* doc/extension.rdoc: Improvements to english grammers.
8+
[Bug #12246][ruby-core:74792][ci skip]
9+
derived from a patch by Marcus Stollsteimer <sto.mar@web.de>
10+
111
Tue Apr 26 13:25:25 2016 Marcus Stollsteimer <sto.mar@web.de>
212

313
* encoding.c: Fix return value of `Encoding::ISO8859_1.name`

README.EXT

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Ruby variables do not have a static type, and data themselves have
99
types, so data will need to be converted between the languages.
1010

1111
Data in Ruby are represented by the C type `VALUE'. Each VALUE data
12-
has its data-type.
12+
has its data type.
1313

1414
To retrieve C data from a VALUE, you need to:
1515

@@ -18,7 +18,7 @@ To retrieve C data from a VALUE, you need to:
1818

1919
Converting to the wrong data type may cause serious problems.
2020

21-
== Data-Types
21+
== Data Types
2222

2323
The Ruby interpreter has the following data types:
2424

@@ -74,7 +74,7 @@ data types, your code will look something like this:
7474
break;
7575
}
7676

77-
There is the data-type check function
77+
There is the data type check function
7878

7979
void Check_Type(VALUE value, int type)
8080

@@ -94,40 +94,40 @@ The equivalent C constants are: Qnil, Qfalse, Qtrue.
9494
Note that Qfalse is false in C also (i.e. 0), but not Qnil.
9595

9696
The T_FIXNUM data is a 31bit or 63bit length fixed integer.
97-
This size is depend on the size of long: if long is 32bit then
97+
This size depends on the size of long: if long is 32bit then
9898
T_FIXNUM is 31bit, if long is 64bit then T_FIXNUM is 63bit.
9999
T_FIXNUM can be converted to a C integer by using the
100100
FIX2INT() macro or FIX2LONG(). Though you have to check that the
101101
data is really FIXNUM before using them, they are faster. FIX2LONG()
102102
never raises exceptions, but FIX2INT() raises RangeError if the
103103
result is bigger or smaller than the size of int.
104104
There are also NUM2INT() and NUM2LONG() which converts any Ruby
105-
numbers into C integers. These macros includes a type check,
105+
numbers into C integers. These macros include a type check,
106106
so an exception will be raised if the conversion failed. NUM2DBL()
107107
can be used to retrieve the double float value in the same way.
108108

109109
You can use the macros
110110
StringValue() and StringValuePtr() to get a char* from a VALUE.
111111
StringValue(var) replaces var's value with the result of "var.to_str()".
112-
StringValuePtr(var) does same replacement and returns char*
112+
StringValuePtr(var) does the same replacement and returns char*
113113
representation of var. These macros will skip the replacement if var
114114
is a String. Notice that the macros take only the lvalue as their
115115
argument, to change the value of var in place.
116116

117117
You can also use the macro named StringValueCStr(). This is just
118-
like StringValuePtr(), but always add nul character at the end of
119-
the result. If the result contains nul character, this macro causes
118+
like StringValuePtr(), but always add NUL character at the end of
119+
the result. If the result contains NUL character, this macro causes
120120
the ArgumentError exception.
121-
StringValuePtr() doesn't guarantee the existence of a nul at the end
122-
of the result, and the result may contain nul.
121+
StringValuePtr() doesn't guarantee the existence of a NUL at the end
122+
of the result, and the result may contain NUL.
123123

124124
Other data types have corresponding C structures, e.g. struct RArray
125125
for T_ARRAY etc. The VALUE of the type which has the corresponding
126126
structure can be cast to retrieve the pointer to the struct. The
127127
casting macro will be of the form RXXXX for each data type; for
128128
instance, RARRAY(obj). See "ruby.h". However, we do not recommend
129-
to access RXXXX data directly because these data structure is complex.
130-
Use corresponding rb_xxx() functions to access internal struct.
129+
to access RXXXX data directly because these data structures are complex.
130+
Use corresponding rb_xxx() functions to access the internal struct.
131131
For example, to access an entry of array, use rb_ary_entry(ary, offset)
132132
and rb_ary_store(ary, offset, obj).
133133

@@ -145,22 +145,22 @@ To convert C data to Ruby values:
145145

146146
FIXNUM ::
147147

148-
left shift 1 bit, and turn on LSB.
148+
left shift 1 bit, and turn on its least significant bit (LSB).
149149

150150
Other pointer values::
151151

152152
cast to VALUE.
153153

154-
You can determine whether a VALUE is pointer or not by checking its LSB.
154+
You can determine whether a VALUE is a pointer or not by checking its LSB.
155155

156-
Notice Ruby does not allow arbitrary pointer values to be a VALUE. They
156+
Notice: Ruby does not allow arbitrary pointer values to be a VALUE. They
157157
should be pointers to the structures which Ruby knows about. The known
158158
structures are defined in <ruby.h>.
159159

160-
To convert C numbers to Ruby values, use these macros.
160+
To convert C numbers to Ruby values, use these macros:
161161

162162
INT2FIX() :: for integers within 31bits.
163-
INT2NUM() :: for arbitrary sized integer.
163+
INT2NUM() :: for arbitrary sized integers.
164164

165165
INT2NUM() converts an integer into a Bignum if it is out of the FIXNUM
166166
range, but is a bit slower.
@@ -258,7 +258,7 @@ rb_utf8_str_new_literal(const char *ptr) ::
258258

259259
rb_str_resize(VALUE str, long len) ::
260260

261-
Resizes Ruby string to len bytes. If str is not modifiable, this
261+
Resizes a Ruby string to len bytes. If str is not modifiable, this
262262
function raises an exception. The length of str must be set in
263263
advance. If len is less than the old length the content beyond
264264
len bytes is discarded, else if len is greater than the old length
@@ -268,9 +268,9 @@ rb_str_resize(VALUE str, long len) ::
268268

269269
rb_str_set_len(VALUE str, long len) ::
270270

271-
Sets the length of Ruby string. If str is not modifiable, this
271+
Sets the length of a Ruby string. If str is not modifiable, this
272272
function raises an exception. This function preserves the content
273-
upto len bytes, regardless RSTRING_LEN(str). len must not exceed
273+
up to len bytes, regardless RSTRING_LEN(str). len must not exceed
274274
the capacity of str.
275275

276276
=== Array Functions
@@ -398,9 +398,9 @@ There are two functions to define private/protected methods:
398398
void rb_define_protected_method(VALUE klass, const char *name,
399399
VALUE (*func)(), int argc)
400400

401-
At last, rb_define_module_function defines a module functions,
401+
At last, rb_define_module_function defines a module function,
402402
which are private AND singleton methods of the module.
403-
For example, sqrt is the module function defined in Math module.
403+
For example, sqrt is a module function defined in the Math module.
404404
It can be called in the following way:
405405

406406
Math.sqrt(4)
@@ -476,7 +476,7 @@ function:
476476

477477
VALUE rb_eval_string_protect(const char *str, int *state)
478478

479-
It returns nil when an error occur. Moreover, *state is zero if str was
479+
It returns nil when an error occurred. Moreover, *state is zero if str was
480480
successfully evaluated, or nonzero otherwise.
481481

482482
=== ID or Symbol
@@ -560,7 +560,7 @@ See also Constant Definition above.
560560

561561
= Information Sharing Between Ruby and C
562562

563-
=== Ruby Constants That C Can Be Accessed From C
563+
=== Ruby Constants That Can Be Accessed From C
564564

565565
As stated in section 1.3,
566566
the following Ruby constants can be referred from C.
@@ -658,7 +658,7 @@ A pointer to the structure will be assigned to the variable sval.
658658

659659
See the example below for details.
660660

661-
= Example - Creating dbm Extension
661+
= Example - Creating the dbm Extension
662662

663663
OK, here's the example of making an extension library. This is the
664664
extension to access DBMs. The full source is included in the ext/
@@ -1153,7 +1153,7 @@ rb_str_new2(s) ::
11531153

11541154
char * -> String
11551155

1156-
== Defining Class and Module
1156+
== Defining Classes and Modules
11571157

11581158
VALUE rb_define_class(const char *name, VALUE super) ::
11591159

README.EXT.ja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ var は lvalue である必要があります.
126126
また,StringValuePtr() に類似した StringValueCStr() というマ
127127
クロもあります.StringValueCStr(var) は var を String に置き
128128
換えてから var の文字列表現に対する char* を返します.返され
129-
る文字列の末尾には nul 文字が付加されます.なお,途中に nul
129+
る文字列の末尾には NUL 文字が付加されます.なお,途中に NUL
130130
文字が含まれる場合は ArgumentError が発生します.
131-
一方,StringValuePtr() では,末尾に nul 文字がある保証はなく,
132-
途中に nul 文字が含まれている可能性もあります.
131+
一方,StringValuePtr() では,末尾に NUL 文字がある保証はなく,
132+
途中に NUL 文字が含まれている可能性もあります.
133133

134134
それ以外のデータタイプは対応するCの構造体があります.対応す
135135
る構造体のあるVALUEはそのままキャスト(型変換)すれば構造体の

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#define RUBY_VERSION "2.2.5"
22
#define RUBY_RELEASE_DATE "2016-04-26"
3-
#define RUBY_PATCHLEVEL 318
3+
#define RUBY_PATCHLEVEL 319
44

55
#define RUBY_RELEASE_YEAR 2016
66
#define RUBY_RELEASE_MONTH 4

0 commit comments

Comments
 (0)