From 697ed85e893ab9039bf52a9bcd0ecadf1af9b654 Mon Sep 17 00:00:00 2001 From: guy Decoux Date: Sat, 28 Feb 2009 20:18:11 +0100 Subject: mmap-0.2.4 --- README.en | 1 + docs/mmap.rb | 396 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ extconf.rb | 19 ++- mmap.c | 93 +++++--------- mmap.html | 338 ++++++++++++++++++++++++-------------------------- mmap.rd | 8 +- 6 files changed, 606 insertions(+), 249 deletions(-) create mode 100644 docs/mmap.rb diff --git a/README.en b/README.en index a1e88d9..8aad7e0 100644 --- a/README.en +++ b/README.en @@ -11,6 +11,7 @@ make rd2 make rdoc + make ri See mmap.rd, mmap.html diff --git a/docs/mmap.rb b/docs/mmap.rb new file mode 100644 index 0000000..2c585a0 --- /dev/null +++ b/docs/mmap.rb @@ -0,0 +1,396 @@ +# The Mmap class implement memory-mapped file objects +# +# Most of these methods have the same syntax than the methods of String +# +# === WARNING +# === The variables $' and $` are not available with gsub! and sub! +class Mmap + include Comparable + include Enumerable + class << self + + #disable paging of all pages mapped. flag can be + #Mmap::MCL_CURRENT or Mmap::MCL_FUTURE + # + def lockall(flag) + end + + #create a new Mmap object + # + #* file + # + # Pathname of the file, if nil is given an anonymous map + # is created Mmanp::MAP_ANON + # + #* mode + # + # Mode to open the file, it can be "r", "w", "rw", "a" + # + #* protection + # + # specify the nature of the mapping + # + # * Mmap::MAP_SHARED + # + # Creates a mapping that's shared with all other processes + # mapping the same areas of the file. + # The default value is Mmap::MAP_SHARED + # + # * Mmap::MAP_PRIVATE + # + # Creates a private copy-on-write mapping, so changes to the + # contents of the mmap object will be private to this process + # + #* options + # + # Hash. If one of the options length or offset + # is specified it will not possible to modify the size of + # the mapped file. + # + # length:: maps length bytes from the file + # + # offset:: the mapping begin at offset + # + # advice:: the type of the access (see #madvise) + # + # + def new(file, mode = "r", protection = Mmap::MAP_SHARED, options = {}) + end + + #reenable paging + # + def unlockall + end + end + + #add count bytes to the file (i.e. pre-extend the file) + # + def extend(count) + end + + #advice can have the value Mmap::MADV_NORMAL, + #Mmap::MADV_RANDOM, Mmap::MADV_SEQUENTIAL, + #Mmap::MADV_WILLNEED, Mmap::MADV_DONTNEED + # + def madvise(advice) + end + + #change the mode, value must be "r", "w" or "rw" + # + def mprotect(mode) + end + + #disable paging + # + def mlock + end + + #flush the file + # + def msync + end + #same than msync + def flush + end + + #reenable paging + # + def munlock + end + + #terminate the association + def munmap + end + # + #=== Other methods with the same syntax than for the class String + # + # + + #comparison + # + def ==(other) + end + + #comparison + # + def >(other) + end + + #comparison + # + def >=(other) + end + + #comparison + # + def <(other) + end + + #comparison + # + def <=(other) + end + + #used for case comparison + # + def ===(other) + end + + #append other to self + # + def <<(other) + end + + #return an index of the match + # + def =~(other) + end + + #Element reference - with the following syntax + # + #self[nth] + # + #retrieve the nth character + # + #self[start..last] + # + #return a substring from start to last + # + #self[start, length] + # + #return a substring of lenght characters from start + # + def [](args) + end + + + # Element assignement - with the following syntax + # + # self[nth] = val + # + # change the nth character with val + # + # self[start..last] = val + # + # change substring from start to last with val + # + # self[start, len] = val + # + # replace length characters from start with val. + # + def []=(args) + end + + #comparison : return -1, 0, 1 + # + def self <=> other + end + + # only with ruby >= 1.7.1 + def casecmp(other) + end + + #append the contents of other + # + def concat(other) + end + + #change the first character to uppercase letter + # + def capitalize! + end + + #chop off the last character + # + def chop! + end + + #chop off the line ending character, specified by rs + # + def chomp!(rs = $/) + end + + #each parameter defines a set of character to count + # + def count(o1 [, o2, ...]) + end + + #crypt with salt + # + def crypt(salt) + end + + #delete every characters included in str + # + def delete!(str) + end + + #change all uppercase character to lowercase character + # + def downcase! + end + + #iterate on each byte + # + def each_byte + yield char + end + + #iterate on each line + # + def each(rs = $/) + yield line + end + #same than each + def each_line(rs = $/) + yield line + end + + #return true if the file is empty + # + def empty? + end + + #freeze the current file + # + def freeze + end + + #return true if the file is frozen + # + def frozen + end + + #global substitution + # + #str.gsub!(pattern, replacement) => str or nil + # + #str.gsub!(pattern) {|match| block } => str or nil + # + def gsub!(pattern, replacement = nil) + end + + #return true if other is found + # + def include?(other) + end + + #return the index of substr + # + def index(substr[, pos]) + end + + #insert str at index + # + def insert(index, str) >= 1.7.1 + end + + #return the size of the file + # + def length + end + + #convert pattern to a Regexp and then call + #match on self + def match(pattern) + end + + #reverse the content of the file + # + def reverse! + end + + #return the index of the last occurrence of substr + # + def rindex(substr[, pos]) + end + + #return an array of all occurence matched by pattern + # + def scan(pattern) + end + + #iterate through the file, matching the pattern + # + def scan(pattern) + yield str + end + + #return the size of the file + # + def size + end + + #same than [] + # + def slice + end + + #delete the specified portion of the file + # + def slice! + end + + #splits into a list of strings and return this array + # + def split([sep[, limit]]) + end + + #squeezes sequences of the same characters which is included in str + # + def squeeze!([str]) + end + + #removes leading and trailing whitespace + # + def strip! + end + + #removes leading whitespace + # + def lstrip! + end + + #removes trailing whitespace + # + def rstrip! + end + + #substitution + # + #str.sub!(pattern, replacement) => str or nil + # + #str.sub!(pattern) {|match| block } => str or nil + # + # + def sub!(pattern, replacement = nil) + end + + #return a checksum + # + def sum(bits = 16) + end + + #replaces all lowercase characters to uppercase characters, and vice-versa + # + def swapcase! + end + + #translate the character from search to replace + # + def tr!(search, replace) + end + + #translate the character from search to replace, then + #squeeze sequence of the same characters + # + def tr_s!(search, replace) + end + + #replaces all lowercase characters to downcase characters + # + def upcase! + end + + +end diff --git a/extconf.rb b/extconf.rb index 79bcfae..1a5f9ef 100644 --- a/extconf.rb +++ b/extconf.rb @@ -15,6 +15,12 @@ end dir_config("mmap") +["lstrip", "match", "insert", "casecmp"].each do |func| + if "aa".respond_to?(func) + $CFLAGS += " -DHAVE_RB_STR_#{func.upcase}" + end +end + create_makefile "mmap" begin @@ -30,7 +36,7 @@ begin unknown: $(DLLIB) \t@echo "main() {}" > /tmp/a.c -\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(LIBPATH) $(LIBS) $(LOCAL_LIBS) +\t$(CC) -static /tmp/a.c $(OBJS) $(CPPFLAGS) $(DLDFLAGS) $(LIBS) $(LOCAL_LIBS) \t@-rm /tmp/a.c a.out EOT @@ -43,15 +49,20 @@ EOT make.print "HTML = mmap.html" docs = Dir['docs/*.rd'] docs.each {|x| make.print " \\\n\t#{x.sub(/\.rd$/, '.html')}" } - make.print "\n\nRDOC = mmap.rd" - docs.each {|x| make.print " \\\n\t#{x}" } + make.print "\n\nRDOC = docs/mmap.rb" make.puts make.print <<-EOF rdoc: docs/doc/index.html docs/doc/index.html: $(RDOC) -\t@-(cd docs; $(RUBY) b.rb mmap; rdoc mmap.rb) +\t@-(cd docs; rdoc mmap.rb) + +ri: docs/mmap.rb +\t@-(cd docs; rdoc -r mmap.rb) + +ri-site: docs/mmap.rb +\t@-(cd docs; rdoc -R mmap.rb) rd2: html diff --git a/mmap.c b/mmap.c index e0b9ecc..70fe833 100644 --- a/mmap.c +++ b/mmap.c @@ -7,7 +7,6 @@ #include #include #include -#include "version.h" #include #ifndef StringValue @@ -160,7 +159,7 @@ mm_str(obj, modify) if (!OBJ_TAINTED(ret) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't modify mmap"); } -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_DEFINE_ALLOC_FUNC ret = rb_obj_alloc(rb_cString); if (rb_obj_tainted(obj)) { OBJ_TAINT(ret); @@ -177,7 +176,7 @@ mm_str(obj, modify) RSTRING(ret)->ptr = t_mm->addr; RSTRING(ret)->len = t_mm->real; if (modify & MM_ORIGIN) { -#if RUBY_VERSION_CODE >= 172 +#if HAVE_RB_DEFINE_ALLOC_FUNC RSTRING(ret)->aux.shared = ret; FL_SET(ret, ELTS_SHARED); #else @@ -317,8 +316,16 @@ mm_i_options(arg, obj) return Qnil; } +static VALUE +mm_s_new(argc, argv, obj) + int argc; + VALUE *argv, obj; +{ + VALUE res = rb_funcall2(obj, rb_intern("allocate"), 0, 0); + rb_obj_call_init(res, argc, argv); + return res; +} -#if RUBY_VERSION_CODE >= 172 static VALUE mm_s_alloc(obj) VALUE obj; @@ -330,21 +337,16 @@ mm_s_alloc(obj) t_mm->incr = EXP_INCR_SIZE; return res; } -#endif static VALUE -#if RUBY_VERSION_CODE >= 172 mm_init(argc, argv, obj) -#else -mm_s_new(argc, argv, obj) -#endif VALUE obj, *argv; int argc; { struct stat st; int fd, smode = 0, pmode = 0, vscope, perm, init; MMAP_RETTYPE addr; - VALUE res, fname, fdv, vmode, scope, options; + VALUE fname, fdv, vmode, scope, options; mm_mmap *t_mm; char *path, *mode; size_t size = 0; @@ -450,16 +452,10 @@ mm_s_new(argc, argv, obj) size = NUM2INT(vmode); } } -#if RUBY_VERSION_CODE >= 172 Data_Get_Struct(obj, mm_mmap, t_mm); - res = obj; -#else - res = Data_Make_Struct(obj, mm_mmap, 0, mm_free, t_mm); - t_mm->incr = EXP_INCR_SIZE; -#endif offset = 0; if (options != Qnil) { - rb_iterate(rb_each, options, mm_i_options, res); + rb_iterate(rb_each, options, mm_i_options, obj); if (path && (t_mm->len + t_mm->offset) > st.st_size) { rb_raise(rb_eArgError, "invalid value for length (%d) or offset (%d)", t_mm->len, t_mm->offset); @@ -525,31 +521,17 @@ mm_s_new(argc, argv, obj) t_mm->smode = smode; t_mm->path = (path)?ruby_strdup(path):(char *)-1; if (smode == O_RDONLY) { - res = rb_obj_freeze(res); + obj = rb_obj_freeze(obj); t_mm->flag |= MM_FROZEN; } else { if (smode == O_WRONLY) { t_mm->flag |= MM_FIXED; } - OBJ_TAINT(res); + OBJ_TAINT(obj); } -#if RUBY_VERSION_CODE < 172 - rb_obj_call_init(res, argc, argv); -#endif - return res; -} - -#if RUBY_VERSION_CODE < 171 -static VALUE -mm_init(argc, argv, obj) - int argc; - VALUE *argv, obj; -{ return obj; } -#endif - static VALUE mm_msync(argc, argv, obj) @@ -915,7 +897,7 @@ mm_gsub_bang(argc, argv, obj) static VALUE mm_index __((int, VALUE *, VALUE)); -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_DEFINE_ALLOC_FUNC static void mm_subpat_set(obj, re, offset, val) @@ -980,7 +962,7 @@ mm_aset(str, indx, val) return val; case T_REGEXP: -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_DEFINE_ALLOC_FUNC mm_subpat_set(str, indx, 0, val); #else { @@ -1029,7 +1011,7 @@ mm_aset_m(argc, argv, str) if (argc == 3) { long beg, len; -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_DEFINE_ALLOC_FUNC if (TYPE(argv[0]) == T_REGEXP) { mm_subpat_set(str, argv[0], NUM2INT(argv[1]), argv[2]); } @@ -1048,7 +1030,7 @@ mm_aset_m(argc, argv, str) return mm_aset(str, argv[0], argv[1]); } -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_INSERT static VALUE mm_insert(str, idx, str2) @@ -1090,13 +1072,9 @@ mm_slice_bang(argc, argv, str) } buf[i] = rb_str_new(0,0); result = mm_aref_m(argc, buf, str); -#if RUBY_VERSION_CODE >= 168 if (!NIL_P(result)) { -#endif mm_aset_m(argc+1, buf, str); -#if RUBY_VERSION_CODE >= 168 } -#endif return result; } @@ -1153,7 +1131,7 @@ mm_concat(str1, str2) return str1; } -#if RUBY_VERSION_CODE < 171 +#ifndef HAVE_RB_STR_LSTRIP static VALUE mm_strip_bang(str) @@ -1171,18 +1149,18 @@ mm_strip_bang(str) t++; if (t_mm->real != (t - s) && (t_mm->flag & MM_FIXED)) { - rb_raise(rb_eTypeError, "try to change the size of a fixed map"); + rb_raise(rb_eTypeError, "try to change the size of a fixed map"); } t_mm->real = t-s; if (s > (char *)t_mm->addr) { - memmove(t_mm->addr, s, t_mm->real); - ((char *)t_mm->addr)[t_mm->real] = '\0'; + memmove(t_mm->addr, s, t_mm->real); + ((char *)t_mm->addr)[t_mm->real] = '\0'; } else if (t < e) { - ((char *)t_mm->addr)[t_mm->real] = '\0'; + ((char *)t_mm->addr)[t_mm->real] = '\0'; } else { - return Qnil; + return Qnil; } return str; @@ -1279,7 +1257,7 @@ mm_cmp(a, b) return INT2FIX(result); } -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_CASECMP static VALUE mm_casecmp(a, b) @@ -1415,7 +1393,7 @@ mm_bang_i(obj, flag, id, argc, argv) } -#if RUBY_VERSION_CODE >= 180 +#if HAVE_RB_STR_MATCH static VALUE mm_match_m(a, b) @@ -1750,15 +1728,12 @@ Init_mmap() rb_include_module(mm_cMap, rb_mComparable); rb_include_module(mm_cMap, rb_mEnumerable); -#if RUBY_VERSION_CODE >= 172 -#if RUBY_VERSION_CODE >= 180 +#if HAVE_RB_DEFINE_ALLOC_FUNC rb_define_alloc_func(mm_cMap, mm_s_alloc); #else rb_define_singleton_method(mm_cMap, "allocate", mm_s_alloc, 0); #endif -#else rb_define_singleton_method(mm_cMap, "new", mm_s_new, -1); -#endif rb_define_singleton_method(mm_cMap, "mlockall", mm_mlockall, 1); rb_define_singleton_method(mm_cMap, "lockall", mm_mlockall, 1); rb_define_singleton_method(mm_cMap, "munlockall", mm_munlockall, 0); @@ -1785,16 +1760,14 @@ Init_mmap() rb_define_method(mm_cMap, "extend", mm_extend, 1); rb_define_method(mm_cMap, "freeze", mm_freeze, 0); rb_define_method(mm_cMap, "clone", mm_undefined, -1); -#if RUBY_VERSION_CODE >= 180 rb_define_method(mm_cMap, "initialize_copy", mm_undefined, -1); -#endif rb_define_method(mm_cMap, "dup", mm_undefined, -1); rb_define_method(mm_cMap, "<=>", mm_cmp, 1); rb_define_method(mm_cMap, "==", mm_equal, 1); rb_define_method(mm_cMap, "===", mm_equal, 1); rb_define_method(mm_cMap, "eql?", mm_eql, 1); rb_define_method(mm_cMap, "hash", mm_hash, 0); -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_CASECMP rb_define_method(mm_cMap, "casecmp", mm_casecmp, 1); #endif rb_define_method(mm_cMap, "+", mm_undefined, -1); @@ -1802,7 +1775,7 @@ Init_mmap() rb_define_method(mm_cMap, "%", mm_undefined, -1); rb_define_method(mm_cMap, "[]", mm_aref_m, -1); rb_define_method(mm_cMap, "[]=", mm_aset_m, -1); -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_INSERT rb_define_method(mm_cMap, "insert", mm_insert, 2); #endif rb_define_method(mm_cMap, "length", mm_size, 0); @@ -1810,7 +1783,7 @@ Init_mmap() rb_define_method(mm_cMap, "empty?", mm_empty, 0); rb_define_method(mm_cMap, "=~", mm_match, 1); rb_define_method(mm_cMap, "~", mm_undefined, -1); -#if RUBY_VERSION_CODE >= 180 +#if HAVE_RB_STR_MATCH rb_define_method(mm_cMap, "match", mm_match_m, 1); #endif rb_define_method(mm_cMap, "succ", mm_undefined, -1); @@ -1863,7 +1836,7 @@ Init_mmap() rb_define_method(mm_cMap, "chop", mm_undefined, -1); rb_define_method(mm_cMap, "chomp", mm_undefined, -1); rb_define_method(mm_cMap, "strip", mm_undefined, -1); -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_LSTRIP rb_define_method(mm_cMap, "lstrip", mm_undefined, -1); rb_define_method(mm_cMap, "rstrip", mm_undefined, -1); #endif @@ -1871,7 +1844,7 @@ Init_mmap() rb_define_method(mm_cMap, "sub!", mm_sub_bang, -1); rb_define_method(mm_cMap, "gsub!", mm_gsub_bang, -1); rb_define_method(mm_cMap, "strip!", mm_strip_bang, 0); -#if RUBY_VERSION_CODE >= 171 +#if HAVE_RB_STR_LSTRIP rb_define_method(mm_cMap, "lstrip!", mm_lstrip_bang, 0); rb_define_method(mm_cMap, "rstrip!", mm_rstrip_bang, 0); #endif diff --git a/mmap.html b/mmap.html index 0cf909e..2d78ddc 100644 --- a/mmap.html +++ b/mmap.html @@ -4,286 +4,268 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -mmap.rd +Untitled -

Mmap

+

Mmap

Download

The Mmap class implement memory-mapped file objects

-

WARNING

-

The variables $' and $` are not available with gsub! and sub!

-

SuperClass

+

WARNING

+

The variables $' and $` are not available with gsub! and sub!

+

SuperClass

Object

-

Included Modules

+

Included Modules

  • Comparable
  • Enumerable
-

Class Methods

+

Class Methods

-
lockall(flag)
+
lockall(flag)
-

disable paging of all pages mapped. flag can be -Mmap::MCL_CURRENT or Mmap::MCL_FUTURE

-
new(file, mode = "r", protection = Mmap::MAP_SHARED, options = {}) -
new(nil, length, protection = Mmap::MAP_SHARED, options = {})
+disable paging of all pages mapped. flag can be +Mmap::MCL_CURRENT or Mmap::MCL_FUTURE +
new(file, mode = "r", protection = Mmap::MAP_SHARED, options = {})
+
new(nil, length, protection = Mmap::MAP_SHARED, options = {})
-

create a new Mmap object

+create a new Mmap object
-
file -
+
file
-

Pathname of the file, if nil is given an anonymous map -is created Mmanp::MAP_ANON

+Pathname of the file, if nil is given an anonymous map +is created Mmanp::MAP_ANON
-
mode -
+
mode
-

Mode to open the file, it can be "r", "w", "rw", "a"

+Mode to open the file, it can be "r", "w", "rw", "a"
-
protection -
+
protection
-

specify the nature of the mapping

+specify the nature of the mapping
-
Mmap::MAP_SHARED -
+
Mmap::MAP_SHARED
-

Creates a mapping that's shared with all other processes +Creates a mapping that's shared with all other processes mapping the same areas of the file. -The default value is Mmap::MAP_SHARED

+The default value is Mmap::MAP_SHARED
-
Mmap::MAP_PRIVATE -
+
Mmap::MAP_PRIVATE
-

Creates a private copy-on-write mapping, so changes to the -contents of the mmap object will be private to this process

+Creates a private copy-on-write mapping, so changes to the +contents of the mmap object will be private to this process
-
options -
+
options
-

Hash. If one of the options length or offset +Hash. If one of the options length or offset is specified it will not possible to modify the size of -the mapped file.

+the mapped file.
-
length -
+
length
-

Maps length bytes from the file

+Maps length bytes from the file
-
offset -
+
offset
-

The mapping begin at offset

+The mapping begin at offset
-
advice -
+
advice
-

The type of the access (see #madvise)

+The type of the access (see #madvise)
-
unlockall
+
unlockall
-

reenable paging

+reenable paging
-

Methods

+

Methods

-
extend(count)
+
extend(count)
-

add count bytes to the file (i.e. pre-extend the file)

-
madvise(advice)
+add count bytes to the file (i.e. pre-extend the file) +
madvise(advice)
-

advice can have the value Mmap::MADV_NORMAL, +advice can have the value Mmap::MADV_NORMAL, Mmap::MADV_RANDOM, Mmap::MADV_SEQUENTIAL, -Mmap::MADV_WILLNEED, Mmap::MADV_DONTNEED

-
mprotect(mode)
+Mmap::MADV_WILLNEED, Mmap::MADV_DONTNEED +
mprotect(mode)
-

change the mode, value must be "r", "w" or "rw"

-
mlock
+change the mode, value must be "r", "w" or "rw" +
mlock
-

disable paging

-
msync -
flush
+disable paging +
msync
+
flush
-

flush the file

-
munlock
+flush the file +
munlock
-

reenable paging

-
munmap
+reenable paging +
munmap
-

terminate the association

+terminate the association
-

Other methods with the same syntax than for the class String

+

Other methods with the same syntax than for the class String

-
self == other
+
self == other
-

comparison

-
self > other
+comparison +
self > other
-

comparison

-
self >= other
+comparison +
self >= other
-

comparison

-
self < other
+comparison +
self < other
-

comparison

-
self <= other
+comparison +
self <= other
-

comparison

-
self === other
+comparison +
self === other
-

used for case comparison

-
self << other
+used for case comparison +
self << other
-

append other to self

-
self =~ other
+append other to self +
self =~ other
-

return an index of the match

-
self[nth]
+return an index of the match +
self[nth]
-

retrieve the nth character

-
self[start..last]
+retrieve the nth character +
self[start..last]
-

return a substring from start to last

-
self[start, length]
+return a substring from start to last +
self[start, length]
-

return a substring of lenght characters from start

-
self[nth] = val
+return a substring of lenght characters from start +
self[nth] = val
-

change the nth character with val

-
self[start..last] = val
+change the nth character with val +
self[start..last] = val
-

change substring from start to last with val

-
self[start, len] = val
+change substring from start to last with val +
self[start, len] = val
-

replace length characters from start with val.

-
self <=> other
+replace length characters from start with val. +
self <=> other
-

comparison : return -1, 0, 1

-
casecmp(other) >= 1.7.1 -
concat(other)
+comparison : return -1, 0, 1 +
casecmp(other) >= 1.7.1
+
concat(other)
-

append the contents of other

-
capitalize!
+append the contents of other +
capitalize!
-

change the first character to uppercase letter

-
chop!
+change the first character to uppercase letter +
chop!
-

chop off the last character

-
chomp!([rs])
+chop off the last character +
chomp!([rs])
-

chop off the line ending character, specified by rs

-
count(o1 [, o2, ...])
+chop off the line ending character, specified by rs +
count(o1 [, o2, ...])
-

each parameter defines a set of character to count

-
crypt(salt)
+each parameter defines a set of character to count +
crypt(salt)
-

crypt with salt

-
delete!(str)
+crypt with salt +
delete!(str)
-

delete every characters included in str

-
downcase!
+delete every characters included in str +
downcase!
-

change all uppercase character to lowercase character

-
each_byte {|char|...}
+change all uppercase character to lowercase character +
each_byte {|char|...}
-

iterate on each byte

-
each([rs]) {|line|...} -
each_line([rs]) {|line|...}
+iterate on each byte +
each([rs]) {|line|...}
+
each_line([rs]) {|line|...}
-

iterate on each line

-
empty?
+iterate on each line +
empty?
-

return true if the file is empty

-
freeze
+return true if the file is empty +
freeze
-

freeze the current file

-
frozen
+freeze the current file +
frozen
-

return true if the file is frozen

-
gsub!(pattern, replace)
+return true if the file is frozen +
gsub!(pattern, replace)
-

global substitution

-
gsub!(pattern) {|str|...}
+global substitution +
gsub!(pattern) {|str|...}
-

global substitution

-
include?(other)
+global substitution +
include?(other)
-

return true if other is found

-
index(substr[, pos])
+return true if other is found +
index(substr[, pos])
-

return the index of substr

-
insert(index, str) >= 1.7.1
+return the index of substr +
insert(index, str) >= 1.7.1
-

insert str at index

-
length
+insert str at index +
length
-

return the size of the file

-
reverse!
+return the size of the file +
reverse!
-

reverse the content of the file

-
rindex(substr[, pos])
+reverse the content of the file +
rindex(substr[, pos])
-

return the index of the last occurrence of substr

-
scan(pattern)
+return the index of the last occurrence of substr +
scan(pattern)
-

return an array of all occurence matched by pattern

-
scan(pattern) {|str| ...}
+return an array of all occurence matched by pattern +
scan(pattern) {|str| ...}
-

iterate through the file, matching the pattern

-
size
+iterate through the file, matching the pattern +
size
-

return the size of the file

-
slice
+return the size of the file +
slice
-

same than []

-
slice!
+same than [] +
slice!
-

delete the specified portion of the file

-
split([sep[, limit]])
+delete the specified portion of the file +
split([sep[, limit]])
-

splits into a list of strings and return this array

-
squeeze!([str])
+splits into a list of strings and return this array +
squeeze!([str])
-

squeezes sequences of the same characters which is included in str

-
strip!
+squeezes sequences of the same characters which is included in str +
strip!
-

removes leading and trailing whitespace

-
sub!(pattern, replace)
+removes leading and trailing whitespace +
sub!(pattern, replace)
-

substitution

-
sub!(pattern) {|str| ...}
+substitution +
sub!(pattern) {|str| ...}
-

substitution

-
sum([bits])
+substitution +
sum([bits])
-

return a checksum

-
swapcase!
+return a checksum +
swapcase!
-

replaces all lowercase characters to uppercase characters, and vice-versa

-
tr!(search, replace)
+replaces all lowercase characters to uppercase characters, and vice-versa +
tr!(search, replace)
-

translate the character from search to replace

-
tr_s!(search, replace)
+translate the character from search to replace +
tr_s!(search, replace)
-

translate the character from search to replace, then -squeeze sequence of the same characters

-
upcase!
+translate the character from search to replace, then +squeeze sequence of the same characters +
upcase!
-

replaces all lowercase characters to downcase characters

+replaces all lowercase characters to downcase characters
diff --git a/mmap.rd b/mmap.rd index 7cf978e..622ad89 100644 --- a/mmap.rd +++ b/mmap.rd @@ -3,12 +3,10 @@ (()) -#^ The Mmap class implement memory-mapped file objects === WARNING === The variables $' and $` are not available with gsub! and sub! -#^ == SuperClass @@ -18,10 +16,7 @@ Object * Comparable * Enumerable -# class Mmap -# include Comparable -# include Enumerable -# class << self + == Class Methods --- lockall(flag) @@ -69,7 +64,6 @@ Object --- unlockall reenable paging -# end == Methods --- extend(count) -- cgit v1.1-2-g2b99