summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-05 04:25:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-06-05 04:25:10 +0000
commit99d65b14b4ec3a546a28b6b17b3b4553eaf27b2f (patch)
tree96eef7127faf2419d14216d506c98bae49fd45a5 /pack.c
parentf3dfa40734581b03b1c2565ff1d0a6675c92a213 (diff)
downloadruby-99d65b14b4ec3a546a28b6b17b3b4553eaf27b2f.tar.gz
* compile.c, dir.c, eval.c, eval_jump.h, eval_method.h, numeric.c,
pack.c, parse.y, re.c, thread.c, vm.c, vm_dump.c, call_cfunc.ci, thread_pthread.ci, thread_win32.ci: fixed indentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/pack.c b/pack.c
index 6dd4c1597b..8de08dd996 100644
--- a/pack.c
+++ b/pack.c
@@ -344,13 +344,13 @@ num2i32(VALUE x)
}
#if SIZEOF_LONG == SIZE32
-# define EXTEND32(x)
+# define EXTEND32(x)
#else
/* invariant in modulo 1<<31 */
# define EXTEND32(x) do { if (!natint) {(x) = (((1L<<31)-1-(x))^~(~0L<<31));}} while(0)
#endif
#if SIZEOF_SHORT == SIZE16
-# define EXTEND16(x)
+# define EXTEND16(x)
#else
# define EXTEND16(x) do { if (!natint) {(x) = (short)(((1<<15)-1-(x))^~(~0<<15));}} while(0)
#endif
@@ -371,7 +371,7 @@ static unsigned long utf8_to_uv(const char*,long*);
/*
* call-seq:
* arr.pack ( aTemplateString ) -> aBinaryString
- *
+ *
* Packs the contents of <i>arr</i> into a binary sequence according to
* the directives in <i>aTemplateString</i> (see the table below)
* Directives ``A,'' ``a,'' and ``Z'' may be followed by a count,
@@ -384,13 +384,13 @@ static unsigned long utf8_to_uv(const char*,long*);
* platform's native size for the specified type; otherwise, they use a
* platform-independent size. Spaces are ignored in the template
* string. See also <code>String#unpack</code>.
- *
+ *
* a = [ "a", "b", "c" ]
* n = [ 65, 66, 67 ]
* a.pack("A3A3A3") #=> "a b c "
* a.pack("a3a3a3") #=> "a\000\000b\000\000c\000\000"
* n.pack("ccc") #=> "ABC"
- *
+ *
* Directives for +pack+.
*
* Directive Meaning
@@ -1101,16 +1101,16 @@ static inline int
hex2num(char c)
{
switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
return c - '0';
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
+ case 'a': case 'b': case 'c':
+ case 'd': case 'e': case 'f':
return c - 'a' + 10;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
+ case 'A': case 'B': case 'C':
+ case 'D': case 'E': case 'F':
return c - 'A' + 10;
- default:
+ default:
return -1;
}
}
@@ -1145,11 +1145,11 @@ infected_str_new(const char *ptr, long len, VALUE str)
OBJ_INFECT(s, str);
return s;
}
-
+
/*
* call-seq:
* str.unpack(format) => anArray
- *
+ *
* Decodes <i>str</i> (which may contain binary data) according to the
* format string, returning an array of each value extracted. The
* format string consists of a sequence of single-character directives,
@@ -1162,7 +1162,7 @@ infected_str_new(const char *ptr, long len, VALUE str)
* platform's native size for the specified type; otherwise, it uses a
* platform-independent consistent size. Spaces are ignored in the
* format string. See also <code>Array#pack</code>.
- *
+ *
* "abc \0\0abc \0\0".unpack('A6Z6') #=> ["abc", "abc "]
* "abc \0\0".unpack('a3a3') #=> ["abc", " \000\000"]
* "abc \0abc \0".unpack('Z*Z*') #=> ["abc ", "abc "]
@@ -1174,7 +1174,7 @@ infected_str_new(const char *ptr, long len, VALUE str)
*
* This table summarizes the various formats and the Ruby classes
* returned by each.
- *
+ *
* Format | Returns | Function
* -------+---------+-----------------------------------------
* A | String | with trailing nulls and spaces removed
@@ -1246,17 +1246,17 @@ infected_str_new(const char *ptr, long len, VALUE str)
* p | String | treat sizeof(char *) characters as a
* | | pointer to a null-terminated string
* -------+---------+-----------------------------------------
- * Q | Integer | treat 8 characters as an unsigned
+ * Q | Integer | treat 8 characters as an unsigned
* | | quad word (64 bits)
* -------+---------+-----------------------------------------
- * q | Integer | treat 8 characters as a signed
+ * q | Integer | treat 8 characters as a signed
* | | quad word (64 bits)
* -------+---------+-----------------------------------------
* S | Fixnum | treat two (different if _ used)
* | | successive characters as an unsigned
* | | short in native byte order
* -------+---------+-----------------------------------------
- * s | Fixnum | Treat two (different if _ used)
+ * s | Fixnum | Treat two (different if _ used)
* | | successive characters as a signed short
* | | in native byte order
* -------+---------+-----------------------------------------
@@ -1279,7 +1279,7 @@ infected_str_new(const char *ptr, long len, VALUE str)
* Z | String | with trailing nulls removed
* | | upto first null with *
* -------+---------+-----------------------------------------
- * @ | --- | skip to the offset given by the
+ * @ | --- | skip to the offset given by the
* | | length argument
* -------+---------+-----------------------------------------
*/
@@ -1574,7 +1574,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
PACK_ITEM_ADJUST();
break;
- case 'Q':
+ case 'Q':
PACK_LENGTH_ADJUST_SIZE(QUAD_SIZE);
while (len-- > 0) {
char *tmp = (char*)s;
@@ -1652,7 +1652,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
PACK_ITEM_ADJUST();
break;
-
+
case 'E':
PACK_LENGTH_ADJUST(double,sizeof(double));
while (len-- > 0) {
@@ -1666,7 +1666,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
PACK_ITEM_ADJUST();
break;
-
+
case 'D':
case 'd':
PACK_LENGTH_ADJUST(double,sizeof(double));
@@ -1692,7 +1692,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
PACK_ITEM_ADJUST();
break;
-
+
case 'G':
PACK_LENGTH_ADJUST(double,sizeof(double));
while (len-- > 0) {
@@ -1706,7 +1706,7 @@ pack_unpack(VALUE str, VALUE fmt)
}
PACK_ITEM_ADJUST();
break;
-
+
case 'U':
if (len > send - s) len = send - s;
while (len > 0 && s < send) {