ruby_doc_updates-20110513-2043_vbatts.patch

Vincent Batts, 05/14/2011 03:17 PM

Download (29.9 KB)

View differences:

ext/zlib/zlib.c
219 219
static VALUE rb_gzreader_readlines(int, VALUE*, VALUE);
220 220
#endif /* GZIP_SUPPORT */
221 221

  
222

  
222
/* 
223
 * Document-module: Zlib
224
 *
225
 * == Overview
226
 *
227
 * Access to the zlib library.
228
 *
229
 * == Class tree
230
 * 
231
 * - Zlib::Deflate
232
 * - Zlib::Inflate
233
 * - Zlib::ZStream
234
 * - Zlib::Error
235
 *   - Zlib::StreamEnd
236
 *   - Zlib::NeedDict
237
 *   - Zlib::DataError
238
 *   - Zlib::StreamError
239
 *   - Zlib::MemError
240
 *   - Zlib::BufError
241
 *   - Zlib::VersionError
242
 *
243
 * (if you have GZIP_SUPPORT)
244
 * - Zlib::GzipReader
245
 * - Zlib::GzipWriter
246
 * - Zlib::GzipFile
247
 * - Zlib::GzipFile::Error
248
 *   - Zlib::GzipFile::LengthError
249
 *   - Zlib::GzipFile::CRCError
250
 *   - Zlib::GzipFile::NoFooter
251
 *
252
 * see also zlib.h
253
 *
254
 */
223 255
void Init_zlib(void);
224 256

  
225 257
/*--------- Exceptions --------*/
......
285 317
/*-------- module Zlib --------*/
286 318

  
287 319
/*
320
 * Document-method: Zlib.zlib_version
321
 *
288 322
 * Returns the string which represents the version of zlib library.
289 323
 */
290 324
static VALUE
......
347 381
}
348 382

  
349 383
/*
384
 * Document-method: Zlib.adler32
385
 *
350 386
 * call-seq: Zlib.adler32(string, adler)
351 387
 *
352 388
 * Calculates Adler-32 checksum for +string+, and returns updated value of
......
363 399

  
364 400
#ifdef HAVE_ADLER32_COMBINE
365 401
/*
402
 * Document-method: Zlib.adler32_combine
403
 *
366 404
 * call-seq: Zlib.adler32_combine(adler1, adler2, len2)
367 405
 *
368 406
 * Combine two Adler-32 check values in to one.  +alder1+ is the first Adler-32
......
381 419
#endif
382 420

  
383 421
/*
422
 * Document-method: Zlib.crc32
423
 *
384 424
 * call-seq: Zlib.crc32(string, adler)
385 425
 *
386 426
 * Calculates CRC checksum for +string+, and returns updated value of +crc+. If
......
397 437

  
398 438
#ifdef HAVE_CRC32_COMBINE
399 439
/*
440
 * Document-method: Zlib.crc32_combine
441
 *
400 442
 * call-seq: Zlib.crc32_combine(crc1, crc2, len2)
401 443
 *
402 444
 * Combine two CRC-32 check values in to one.  +crc1+ is the first CRC-32
......
415 457
#endif
416 458

  
417 459
/*
460
 * Document-method: Zlib.crc_table
461
 *
418 462
 * Returns the table for calculating CRC checksum as an array.
419 463
 */
420 464
static VALUE
......
1131 1175

  
1132 1176
/*
1133 1177
 * Guesses the type of the data which have been inputed into the stream. The
1134
 * returned value is either <tt>Zlib::BINARY</tt>, <tt>Zlib::ASCII</tt>, or
1135
 * <tt>Zlib::UNKNOWN</tt>.
1178
 * returned value is either <tt>BINARY</tt>, <tt>ASCII</tt>, or
1179
 * <tt>UNKNOWN</tt>.
1136 1180
 */
1137 1181
static VALUE
1138 1182
rb_zstream_data_type(VALUE obj)
......
1175 1219
/*
1176 1220
 * Document-class: Zlib::Deflate
1177 1221
 *
1178
 * Zlib::Deflate is the class for compressing data.  See Zlib::Stream for more
1222
 * Zlib::Deflate is the class for compressing data.  See Zlib::ZStream for more
1179 1223
 * information.
1180 1224
 */
1181 1225

  
......
1197 1241
}
1198 1242

  
1199 1243
/*
1244
 * Document-method: Zlib::Deflate.new
1245
 *
1200 1246
 * call-seq: Zlib::Deflate.new(level=nil, windowBits=nil, memlevel=nil, strategy=nil)
1201 1247
 *
1248
 * == Arguments
1249
 *
1250
 * +level+::
1251
 *   An Integer compression level between
1252
 *   BEST_SPEED and BEST_COMPRESSION
1253
 * +windowBits+::
1254
 *   An Integer for the windowBits size. Should be
1255
 *   in the range 8..15, larger values of this parameter
1256
 *   result in better at the expense of memory usage.
1257
 * +memlevel+::
1258
 *   Specifies how much memory should be allocated for
1259
 *   the internal compression state.
1260
 *   Between DEF_MEM_LEVEL and MAX_MEM_LEVEL
1261
 * +strategy+::
1262
 *   A parameter to tune the compression algorithm. Use the
1263
 *   DEFAULT_STRATEGY for normal data, FILTERED for data produced by a
1264
 *   filter (or predictor), HUFFMAN_ONLY to force Huffman encoding only (no
1265
 *   string match).
1266
 *
1267
 * == Description 
1268
 *
1202 1269
 * Creates a new deflate stream for compression. See zlib.h for details of
1203 1270
 * each argument. If an argument is nil, the default value of that argument is
1204 1271
 * used.
1205 1272
 *
1206
 * TODO: document better!
1273
 *
1274
 * == examples
1275
 *
1276
 * === basic
1277
 *
1278
 *   f = File.new("compressed.file","w+")
1279
 *   #=> #<File:compressed.file> 
1280
 *   f << Zlib::Deflate.new().deflate(File.read("big.file"))
1281
 *   #=> #<File:compressed.file> 
1282
 *   f.close
1283
 *   #=> nil 
1284
 *
1285
 * === a little more robust
1286
 * 
1287
 *   compressed_file = File.open("compressed.file", "w+")
1288
 *   #=> #<File:compressed.file>
1289
 *   zd = Zlib::Deflate.new(Zlib::BEST_COMPRESSION, 15, Zlib::MAX_MEM_LEVEL, Zlib::HUFFMAN_ONLY)
1290
 *   #=> #<Zlib::Deflate:0x000000008610a0>
1291
 *   compressed_file << zd.deflate(File.read("big.file"))
1292
 *   #=> "\xD4z\xC6\xDE\b\xA1K\x1Ej\x8A ..."
1293
 *   compressed_file.close
1294
 *   #=> nil
1295
 *   zd.close
1296
 *   #=> nil
1297
 *
1298
 * (while this example will work, for best optimization the flags need to be reviewed for your specific function)
1299
 *
1207 1300
 */
1208 1301
static VALUE
1209 1302
rb_deflate_initialize(int argc, VALUE *argv, VALUE obj)
......
1227 1320
}
1228 1321

  
1229 1322
/*
1323
 * Document-method: Zlib::Deflate#initialize_copy
1324
 *
1230 1325
 * Duplicates the deflate stream.
1231 1326
 */
1232 1327
static VALUE
......
1261 1356
}
1262 1357

  
1263 1358
/*
1359
 * Document-method: Zlib::Deflate.deflate
1360
 *
1264 1361
 * call-seq: Zlib.deflate(string[, level])
1265 1362
 *           Zlib::Deflate.deflate(string[, level])
1266 1363
 *
1267 1364
 * Compresses the given +string+. Valid values of level are
1268
 * <tt>Zlib::NO_COMPRESSION</tt>, <tt>Zlib::BEST_SPEED</tt>,
1269
 * <tt>Zlib::BEST_COMPRESSION</tt>, <tt>Zlib::DEFAULT_COMPRESSION</tt>, and an
1365
 * <tt>NO_COMPRESSION</tt>, <tt>BEST_SPEED</tt>,
1366
 * <tt>BEST_COMPRESSION</tt>, <tt>DEFAULT_COMPRESSION</tt>, and an
1270 1367
 * integer from 0 to 9 (the default is 6).
1271 1368
 *
1272 1369
 * This method is almost equivalent to the following code:
1273 1370
 *
1274 1371
 *   def deflate(string, level)
1275 1372
 *     z = Zlib::Deflate.new(level)
1276
 *     dst = z.deflate(string, Zlib::FINISH)
1373
 *     dst = z.deflate(string, Zlib::NO_FLUSH)
1277 1374
 *     z.close
1278 1375
 *     dst
1279 1376
 *   end
......
1321 1418
}
1322 1419

  
1323 1420
/*
1421
 * Document-method: Zlib.deflate
1422
 *
1324 1423
 * call-seq: deflate(string[, flush])
1325 1424
 *
1425
 * == Arguments
1426
 * 
1427
 * +string+::
1428
 *   String
1429
 *
1430
 * +flush+::
1431
 *   Integer representing a flush code. Either NO_FLUSH,
1432
 *   SYNC_FLUSH, FULL_FLUSH, or FINISH. See zlib.h for details.
1433
 *   Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
1434
 *   decide how much data to accumualte before producing output, in order to
1435
 *   maximize compression.
1436
 *
1437
 * == Description
1438
 *
1326 1439
 * Inputs +string+ into the deflate stream and returns the output from the
1327 1440
 * stream.  On calling this method, both the input and the output buffers of
1328
 * the stream are flushed. If +string+ is nil, this method finishes the
1441
 * the stream are flushed.
1442
 *
1443
 * If +string+ is nil, this method finishes the
1329 1444
 * stream, just like Zlib::ZStream#finish.
1330 1445
 *
1331
 * The value of +flush+ should be either <tt>Zlib::NO_FLUSH</tt>,
1332
 * <tt>Zlib::SYNC_FLUSH</tt>, <tt>Zlib::FULL_FLUSH</tt>, or
1333
 * <tt>Zlib::FINISH</tt>. See zlib.h for details.
1446
 * == Usage
1447
 *
1448
 *   comp = Zlib.deflate(File.read("big.file"))
1449
 * or 
1450
 *   comp = Zlib.deflate(File.read("big.file"), Zlib::FULL_FLUSH)
1334 1451
 *
1335
 * TODO: document better!
1336 1452
 */
1337 1453
static VALUE
1338 1454
rb_deflate_deflate(int argc, VALUE *argv, VALUE obj)
......
1350 1466
}
1351 1467

  
1352 1468
/*
1469
 * Document-method: Zlib::Deflate.<<
1470
 *
1353 1471
 * call-seq: << string
1354 1472
 *
1355 1473
 * Inputs +string+ into the deflate stream just like Zlib::Deflate#deflate, but
......
1365 1483
}
1366 1484

  
1367 1485
/*
1486
 * Document-method: Zlib::Deflate#flush
1487
 *
1368 1488
 * call-seq: flush(flush)
1369 1489
 *
1370 1490
 * This method is equivalent to <tt>deflate('', flush)</tt>.  If flush is omitted,
1371
 * <tt>Zlib::SYNC_FLUSH</tt> is used as flush.  This method is just provided
1491
 * <tt>SYNC_FLUSH</tt> is used as flush.  This method is just provided
1372 1492
 * to improve the readability of your Ruby program.
1373 1493
 *
1374
 * TODO: document better!
1494
 * Please visit your zlib.h for a deeper detail on NO_FLUSH, SYNC_FLUSH, FULL_FLUSH, and FINISH
1495
 *
1375 1496
 */
1376 1497
static VALUE
1377 1498
rb_deflate_flush(int argc, VALUE *argv, VALUE obj)
......
1392 1513
}
1393 1514

  
1394 1515
/*
1516
 * Document-method: Zlib::Deflate.params
1517
 *
1395 1518
 * call-seq: params(level, strategy)
1396 1519
 *
1397 1520
 * Changes the parameters of the deflate stream. See zlib.h for details. The
1398 1521
 * output from the stream by changing the params is preserved in output
1399 1522
 * buffer.
1400 1523
 *
1401
 * TODO: document better!
1524
 * +level+::
1525
 *   An Integer compression level between
1526
 *   BEST_SPEED and BEST_COMPRESSION
1527
 * +strategy+::
1528
 *   A parameter to tune the compression algorithm. Use the
1529
 *   DEFAULT_STRATEGY for normal data, FILTERED for data produced by a
1530
 *   filter (or predictor), HUFFMAN_ONLY to force Huffman encoding only (no
1531
 *   string match).
1532
 *
1402 1533
 */
1403 1534
static VALUE
1404 1535
rb_deflate_params(VALUE obj, VALUE v_level, VALUE v_strategy)
......
1429 1560
}
1430 1561

  
1431 1562
/*
1563
 * Document-method: Zlib::Deflate.set_dictionary
1564
 *
1432 1565
 * call-seq: set_dictionary(string)
1433 1566
 *
1434 1567
 * Sets the preset dictionary and returns +string+. This method is available
1435 1568
 * just only after Zlib::Deflate.new or Zlib::ZStream#reset method was called.
1436 1569
 * See zlib.h for details.
1437 1570
 *
1438
 * TODO: document better!
1571
 * Can raise errors of Z_STREAM_ERROR if a parameter is invalid (such as
1572
 * NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if
1573
 * the given dictionary doesn't match the expected one (incorrect adler32 value)
1574
 *
1439 1575
 */
1440 1576
static VALUE
1441 1577
rb_deflate_set_dictionary(VALUE obj, VALUE dic)
......
1475 1611
}
1476 1612

  
1477 1613
/*
1614
 * Document-method: Zlib::Inflate.new 
1615
 *
1478 1616
 * call-seq: Zlib::Inflate.new(window_bits)
1479 1617
 *
1618
 * == Arguments
1619
 *
1620
 * +windowBits+::
1621
 *   An Integer for the windowBits size. Should be
1622
 *   in the range 8..15, larger values of this parameter
1623
 *   result in better at the expense of memory usage.
1624
 *
1625
 * == Description
1626
 *
1480 1627
 * Creates a new inflate stream for decompression. See zlib.h for details
1481 1628
 * of the argument.  If +window_bits+ is +nil+, the default value is used.
1482 1629
 *
1483
 * TODO: document better!
1630
 * == Example
1631
 *
1632
 *   cf = File.open("compressed.file")
1633
 *   ucf = File.open("uncompressed.file", "w+")
1634
 *   zi = Zlib::Inflate.new(Zlib::MAX_WBITS)
1635
 *
1636
 *   ucf << zi.inflate(cf.read)
1637
 *
1638
 *   ucf.close
1639
 *   zi.close
1640
 *   cf.close
1641
 *
1642
 * or 
1643
 *
1644
 *   File.open("compressed.file") {|cf|
1645
 *     zi = Zlib::Inflate.new
1646
 *     File.open("uncompressed.file", "w+") {|ucf|
1647
 *       ucf << zi.inflate(cf.read)
1648
 *     }
1649
 *     zi.close
1650
 *   }
1651
 *
1484 1652
 */
1485 1653
static VALUE
1486 1654
rb_inflate_initialize(int argc, VALUE *argv, VALUE obj)
......
1513 1681
}
1514 1682

  
1515 1683
/*
1516
 * call-seq: Zlib.inflate(string)
1517
 *           Zlib::Inflate.inflate(string)
1684
 * Document-method: Zlib::Inflate.inflate
1685
 *
1686
 * call-seq: Zlib::Inflate.inflate(string)
1518 1687
 *
1519 1688
 * Decompresses +string+. Raises a Zlib::NeedDict exception if a preset
1520 1689
 * dictionary is needed for decompression.
......
1569 1738
}
1570 1739

  
1571 1740
/*
1741
 * Document-method: Zlib::Inflate#inflate
1742
 *
1572 1743
 * call-seq: inflate(string)
1573 1744
 *
1574 1745
 * Inputs +string+ into the inflate stream and returns the output from the
......
1580 1751
 * decompress.  Set the dictionary by Zlib::Inflate#set_dictionary and then
1581 1752
 * call this method again with an empty string.  (<i>???</i>)
1582 1753
 *
1583
 * TODO: document better!
1754
 * See also Zlib::Inflate.new
1584 1755
 */
1585 1756
static VALUE
1586 1757
rb_inflate_inflate(VALUE obj, VALUE src)
......
1684 1855
}
1685 1856

  
1686 1857
/*
1858
 * Document-method: Zlib::Inflate#set_dictionary
1859
 *
1687 1860
 * Sets the preset dictionary and returns +string+.  This method is available just
1688 1861
 * only after a Zlib::NeedDict exception was raised.  See zlib.h for details.
1689 1862
 *
1690
 * TODO: document better!
1691 1863
 */
1692 1864
static VALUE
1693 1865
rb_inflate_set_dictionary(VALUE obj, VALUE dic)
......
2003 2175
    rb_exc_raise(exc);
2004 2176
}
2005 2177

  
2178
/*
2179
 * Document-method: Zlib::GzipFile::Error#inspect
2180
 *
2181
 * Constructs a String of the GzipFile Error
2182
 */
2006 2183
static VALUE
2007 2184
gzfile_error_inspect(VALUE error)
2008 2185
{
......
2498 2675
 * Zlib::GzipReader for reading, and Zlib::GzipWriter for writing.
2499 2676
 *
2500 2677
 * GzipReader should be used by associating an IO, or IO-like, object.
2678
 *
2679
 * == Method Catalogue
2680
 *
2681
 * - wrap
2682
 * - open
2683
 * - #close
2684
 * - #closed?
2685
 * - #comment
2686
 * - #comment=
2687
 * - #crc
2688
 * - #eof?
2689
 * - #finish
2690
 * - #level
2691
 * - #lineno
2692
 * - #lineno=
2693
 * - #mtime
2694
 * - #mtime=
2695
 * - #orig_name
2696
 * - #orig_name=
2697
 * - #os_code
2698
 * - #path
2699
 * - #sync
2700
 * - #sync=
2701
 * - #to_io
2702
 * - #total_in
2703
 * - #total_out
2704
 *
2705
 *   (due to internal sturcture, documentation may appear under
2706
 *   Zlib::GzipReader or Zlib::GzipWriter )
2501 2707
 */
2502 2708

  
2503 2709

  
......
2556 2762
}
2557 2763

  
2558 2764
/*
2765
 * Document-method: Zlib::GzipFile.wrap
2766
 *
2559 2767
 * call-seq: Zlib::GzipFile.wrap(io) { |gz| ... }
2560 2768
 *
2561 2769
 * Creates a GzipFile object associated with +io+, and
......
2572 2780
}
2573 2781

  
2574 2782
/*
2783
 * Document-method: Zlib::GzipFile.open
2784
 *
2575 2785
 * See Zlib::GzipReader#open and Zlib::GzipWriter#open.
2576 2786
 */
2577 2787
static VALUE
......
2589 2799
}
2590 2800

  
2591 2801
/*
2802
 * Document-method: Zlib::GzipFile#to_io
2803
 *
2592 2804
 * Same as IO.
2593 2805
 */
2594 2806
static VALUE
......
2598 2810
}
2599 2811

  
2600 2812
/*
2813
 * Document-method: Zlib::GzipFile#crc
2814
 *
2601 2815
 * Returns CRC value of the uncompressed data.
2602 2816
 */
2603 2817
static VALUE
......
2607 2821
}
2608 2822

  
2609 2823
/*
2824
 * Document-method: Zlib::GzipFile#mtime
2825
 *
2610 2826
 * Returns last modification time recorded in the gzip file header.
2611 2827
 */
2612 2828
static VALUE
......
2616 2832
}
2617 2833

  
2618 2834
/*
2835
 * Document-method: Zlib::GzipFile#level
2836
 *
2619 2837
 * Returns compression level.
2620 2838
 */
2621 2839
static VALUE
......
2625 2843
}
2626 2844

  
2627 2845
/*
2846
 * Document-method: Zlib::GzipFile#os_code
2847
 *
2628 2848
 * Returns OS code number recorded in the gzip file header.
2629 2849
 */
2630 2850
static VALUE
......
2634 2854
}
2635 2855

  
2636 2856
/*
2857
 * Document-method: Zlib::GzipFile#orig_name
2858
 *
2637 2859
 * Returns original filename recorded in the gzip file header, or +nil+ if
2638 2860
 * original filename is not present.
2639 2861
 */
......
2649 2871
}
2650 2872

  
2651 2873
/*
2874
 * Document-method: Zlib::GzipFile#comment
2875
 *
2652 2876
 * Returns comments recorded in the gzip file header, or nil if the comments
2653 2877
 * is not present.
2654 2878
 */
......
2664 2888
}
2665 2889

  
2666 2890
/*
2667
 * ???
2891
 * Document-method: Zlib::GzipFile#lineno
2892
 *
2893
 * The line number of the last row read from this file.
2668 2894
 */
2669 2895
static VALUE
2670 2896
rb_gzfile_lineno(VALUE obj)
......
2673 2899
}
2674 2900

  
2675 2901
/*
2676
 * ???
2902
 * Document-method: Zlib::GzipFile#set_lineno
2903
 *
2904
 * Specify line number of the last row read from this file.
2677 2905
 */
2678 2906
static VALUE
2679 2907
rb_gzfile_set_lineno(VALUE obj, VALUE lineno)
......
2684 2912
}
2685 2913

  
2686 2914
/*
2687
 * ???
2915
 * Document-method: Zlib::GzipFile#set_mtime
2916
 *
2917
 * Specify the modification time (+mtime+) in the gzip header.
2918
 * Using a Fixnum or Integer
2688 2919
 */
2689 2920
static VALUE
2690 2921
rb_gzfile_set_mtime(VALUE obj, VALUE mtime)
......
2707 2938
}
2708 2939

  
2709 2940
/*
2710
 * ???
2941
 * Document-method: Zlib::GzipFile#set_orig_name
2942
 *
2943
 * Specify the original name (+str+) in the gzip header.
2711 2944
 */
2712 2945
static VALUE
2713 2946
rb_gzfile_set_orig_name(VALUE obj, VALUE str)
......
2729 2962
}
2730 2963

  
2731 2964
/*
2732
 * ???
2965
 * Document-method: Zlib::GzipFile#set_comment
2966
 *
2967
 * Specify the comment (+str+) in the gzip header.
2733 2968
 */
2734 2969
static VALUE
2735 2970
rb_gzfile_set_comment(VALUE obj, VALUE str)
......
2751 2986
}
2752 2987

  
2753 2988
/*
2989
 * Document-method: Zlib::GzipFile#close
2990
 *
2754 2991
 * Closes the GzipFile object. This method calls close method of the
2755 2992
 * associated IO object. Returns the associated IO object.
2756 2993
 */
......
2766 3003
}
2767 3004

  
2768 3005
/*
3006
 * Document-method: Zlib::GzipFile#finish
3007
 *
2769 3008
 * Closes the GzipFile object. Unlike Zlib::GzipFile#close, this method never
2770 3009
 * calls the close method of the associated IO object. Returns the associated IO
2771 3010
 * object.
......
2782 3021
}
2783 3022

  
2784 3023
/*
2785
 * Same as IO.
3024
 * Document-method: Zlib::GzipFile#closed?
3025
 *
3026
 * Same as IO#closed?
3027
 *
2786 3028
 */
2787 3029
static VALUE
2788 3030
rb_gzfile_closed_p(VALUE obj)
......
2793 3035
}
2794 3036

  
2795 3037
/*
2796
 * ???
3038
 * Document-method: Zlib::GzipFile#eof?
3039
 *
3040
 * Returns +true+ or +false+ whether the stream has reached the end.
2797 3041
 */
2798 3042
static VALUE
2799 3043
rb_gzfile_eof_p(VALUE obj)
......
2803 3047
}
2804 3048

  
2805 3049
/*
2806
 * Same as IO.
3050
 * Document-method: Zlib::GzipFile#sync
3051
 *
3052
 * Same as IO#sync
3053
 *
2807 3054
 */
2808 3055
static VALUE
2809 3056
rb_gzfile_sync(VALUE obj)
......
2812 3059
}
2813 3060

  
2814 3061
/*
3062
 * Document-method: Zlib::GzipFile#set_sync
3063
 *
2815 3064
 * call-seq: sync = flag
2816 3065
 *
2817 3066
 * Same as IO.  If flag is +true+, the associated IO object must respond to the
......
2833 3082
}
2834 3083

  
2835 3084
/*
2836
 * ???
3085
 * Document-method: Zlib::GzipFile#total_in
3086
 *
3087
 * Total number of input bytes read so far.
2837 3088
 */
2838 3089
static VALUE
2839 3090
rb_gzfile_total_in(VALUE obj)
......
2842 3093
}
2843 3094

  
2844 3095
/*
2845
 * ???
3096
 * Document-method: Zlib::GzipFile#total_out
3097
 *
3098
 * Total number of output bytes output so far.
2846 3099
 */
2847 3100
static VALUE
2848 3101
rb_gzfile_total_out(VALUE obj)
......
2852 3105
}
2853 3106

  
2854 3107
/*
2855
 * Document-method: path
3108
 * Document-method: Zlib::GzipFile#path
2856 3109
 *
2857 3110
 * call-seq: path
2858 3111
 *
......
3077 3330
 *     gz.close
3078 3331
 *   end
3079 3332
 *
3080
 *   # TODO: test these.  Are they equivalent?  Can GzipReader.new take a
3081
 *   # block?
3082
 *
3083 3333
 * == Method Catalogue
3084 3334
 *
3085 3335
 * The following methods in Zlib::GzipReader are just like their counterparts
......
3123 3373
}
3124 3374

  
3125 3375
/*
3376
 * Document-method: Zlib::GzipReader.open
3377
 *
3126 3378
 * call-seq: Zlib::GzipReader.open(filename) {|gz| ... }
3127 3379
 *
3128 3380
 * Opens a file specified by +filename+ as a gzipped file, and returns a
......
3136 3388
}
3137 3389

  
3138 3390
/*
3391
 * Document-method: Zlib::GzipReader.new
3392
 *
3139 3393
 * call-seq: Zlib::GzipReader.new(io)
3140 3394
 *
3141 3395
 * Creates a GzipReader object associated with +io+. The GzipReader object reads
......
3174 3428
}
3175 3429

  
3176 3430
/*
3431
 * Document-method: Zlib::GzipReader#rewind
3432
 *
3177 3433
 * Resets the position of the file pointer to the point created the GzipReader
3178 3434
 * object.  The associated IO object needs to respond to the +seek+ method.
3179 3435
 */
......
3186 3442
}
3187 3443

  
3188 3444
/*
3445
 * Document-method: Zlib::GzipReader#unused
3446
 *
3189 3447
 * Returns the rest of the data which had read for parsing gzip format, or
3190 3448
 * +nil+ if the whole gzip file is not parsed yet.
3191 3449
 */
......
3198 3456
}
3199 3457

  
3200 3458
/*
3459
 * Document-method: Zlib::GzipReader#read
3460
 *
3201 3461
 * See Zlib::GzipReader documentation for a description.
3202 3462
 */
3203 3463
static VALUE
......
3220 3480
}
3221 3481

  
3222 3482
/*
3483
 * Document-method: Zlib::GzipReader#readpartial
3484
 *
3223 3485
 *  call-seq:
3224 3486
 *     gzipreader.readpartial(maxlen [, outbuf]) => string, outbuf
3225 3487
 *
......
3248 3510
}
3249 3511

  
3250 3512
/*
3513
 * Document-method: Zlib::GzipReader#getc
3514
 *
3251 3515
 * See Zlib::GzipReader documentation for a description.
3252 3516
 */
3253 3517
static VALUE
......
3259 3523
}
3260 3524

  
3261 3525
/*
3526
 * Document-method: Zlib::GzipReader#readchar
3527
 *
3262 3528
 * See Zlib::GzipReader documentation for a description.
3263 3529
 */
3264 3530
static VALUE
......
3273 3539
}
3274 3540

  
3275 3541
/*
3542
 * Document-method: Zlib::GzipReader#getbyte
3543
 *
3276 3544
 * See Zlib::GzipReader documentation for a description.
3277 3545
 */
3278 3546
static VALUE
......
3289 3557
}
3290 3558

  
3291 3559
/*
3560
 * Document-method: Zlib::GzipReader#readbyte
3561
 *
3292 3562
 * See Zlib::GzipReader documentation for a description.
3293 3563
 */
3294 3564
static VALUE
......
3303 3573
}
3304 3574

  
3305 3575
/*
3576
 * Document-method: Zlib::GzipReader#each_char
3577
 *
3306 3578
 * See Zlib::GzipReader documentation for a description.
3307 3579
 */
3308 3580
static VALUE
......
3319 3591
}
3320 3592

  
3321 3593
/*
3594
 * Document-method: Zlib::GzipReader#each_byte
3595
 *
3322 3596
 * See Zlib::GzipReader documentation for a description.
3323 3597
 */
3324 3598
static VALUE
......
3335 3609
}
3336 3610

  
3337 3611
/*
3612
 * Document-method: Zlib::GzipReader#ungetc
3613
 *
3338 3614
 * See Zlib::GzipReader documentation for a description.
3339 3615
 */
3340 3616
static VALUE
......
3354 3630
}
3355 3631

  
3356 3632
/*
3633
 * Document-method: Zlib::GzipReader#ungetbyte
3634
 *
3357 3635
 * See Zlib::GzipReader documentation for a description.
3358 3636
 */
3359 3637
static VALUE
......
3547 3825
}
3548 3826

  
3549 3827
/*
3828
 * Document-method: Zlib::GzipReader#gets
3829
 *
3550 3830
 * See Zlib::GzipReader documentation for a description.
3551 3831
 */
3552 3832
static VALUE
......
3561 3841
}
3562 3842

  
3563 3843
/*
3844
 * Document-method: Zlib::GzipReader#readline
3845
 *
3564 3846
 * See Zlib::GzipReader documentation for a description.
3565 3847
 */
3566 3848
static VALUE
......
3575 3857
}
3576 3858

  
3577 3859
/*
3860
 * Document-method: Zlib::GzipReader#each
3861
 *
3578 3862
 * See Zlib::GzipReader documentation for a description.
3579 3863
 */
3580 3864
static VALUE
......
3591 3875
}
3592 3876

  
3593 3877
/*
3878
 * Document-method: Zlib::GzipReader#readlines
3879
 *
3594 3880
 * See Zlib::GzipReader documentation for a description.
3595 3881
 */
3596 3882
static VALUE
......
3609 3895

  
3610 3896

  
3611 3897
/*
3898
 * Document-module: Zlib
3899
 *
3612 3900
 * The Zlib module contains several classes for compressing and decompressing
3613 3901
 * streams, and for working with "gzip" files.
3614 3902
 *
......
3713 4001
    rb_define_module_function(mZlib, "crc32_combine", rb_zlib_crc32_combine, 3);
3714 4002
    rb_define_module_function(mZlib, "crc_table", rb_zlib_crc_table, 0);
3715 4003

  
4004
    /* The Ruby/zlib version string. */
3716 4005
    rb_define_const(mZlib, "VERSION", rb_str_new2(RUBY_ZLIB_VERSION));
4006
    /*  The string which represents the version of zlib.h */
3717 4007
    rb_define_const(mZlib, "ZLIB_VERSION", rb_str_new2(ZLIB_VERSION));
3718 4008

  
3719 4009
    cZStream = rb_define_class_under(mZlib, "ZStream", rb_cObject);
......
3736 4026
    rb_define_method(cZStream, "flush_next_in", rb_zstream_flush_next_in, 0);
3737 4027
    rb_define_method(cZStream, "flush_next_out", rb_zstream_flush_next_out, 0);
3738 4028

  
4029
    /* Integer representing date types which
4030
     * ZStream#data_type method returns */ 
3739 4031
    rb_define_const(mZlib, "BINARY", INT2FIX(Z_BINARY));
4032
    /* Integer representing date types which
4033
     * ZStream#data_type method returns */ 
3740 4034
    rb_define_const(mZlib, "ASCII", INT2FIX(Z_ASCII));
4035
    /* Integer representing date types which
4036
     * ZStream#data_type method returns */ 
3741 4037
    rb_define_const(mZlib, "UNKNOWN", INT2FIX(Z_UNKNOWN));
3742 4038

  
3743 4039
    cDeflate = rb_define_class_under(mZlib, "Deflate", cZStream);
......
3763 4059
    rb_define_method(cInflate, "sync_point?", rb_inflate_sync_point_p, 0);
3764 4060
    rb_define_method(cInflate, "set_dictionary", rb_inflate_set_dictionary, 1);
3765 4061

  
4062
    /* compression level 0
4063
     *
4064
     * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
3766 4065
    rb_define_const(mZlib, "NO_COMPRESSION", INT2FIX(Z_NO_COMPRESSION));
4066
    /* compression level 1
4067
     *
4068
     * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
3767 4069
    rb_define_const(mZlib, "BEST_SPEED", INT2FIX(Z_BEST_SPEED));
4070
    /* compression level 9
4071
     *
4072
     * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
3768 4073
    rb_define_const(mZlib, "BEST_COMPRESSION", INT2FIX(Z_BEST_COMPRESSION));
4074
    /* compression level -1
4075
     *
4076
     * Which is an argument for Deflate.new, Deflate#deflate, and so on. */
3769 4077
    rb_define_const(mZlib, "DEFAULT_COMPRESSION",
3770 4078
		    INT2FIX(Z_DEFAULT_COMPRESSION));
3771 4079

  
4080
    /* compression method 1
4081
     *
4082
     * Which is an argument for Deflate.new and Deflate#params. */
3772 4083
    rb_define_const(mZlib, "FILTERED", INT2FIX(Z_FILTERED));
4084
    /* compression method 2
4085
     *
4086
     * Which is an argument for Deflate.new and Deflate#params. */
3773 4087
    rb_define_const(mZlib, "HUFFMAN_ONLY", INT2FIX(Z_HUFFMAN_ONLY));
4088
    /* compression method 0
4089
     *
4090
     * Which is an argument for Deflate.new and Deflate#params. */
3774 4091
    rb_define_const(mZlib, "DEFAULT_STRATEGY", INT2FIX(Z_DEFAULT_STRATEGY));
3775 4092

  
4093
     /* The default value of windowBits which is an argument for
4094
      * Deflate.new and Inflate.new.
4095
      */
3776 4096
    rb_define_const(mZlib, "MAX_WBITS", INT2FIX(MAX_WBITS));
4097
    /* Default value is 8
4098
     *
4099
     * The integer representing memory levels.
4100
     * Which are an argument for Deflate.new, Deflate#params, and so on. */
3777 4101
    rb_define_const(mZlib, "DEF_MEM_LEVEL", INT2FIX(DEF_MEM_LEVEL));
4102
    /* Maximum level is 9
4103
     *
4104
     * The integers representing memory levels which are an argument for
4105
     * Deflate.new, Deflate#params, and so on. */
3778 4106
    rb_define_const(mZlib, "MAX_MEM_LEVEL", INT2FIX(MAX_MEM_LEVEL));
3779 4107

  
4108
    /* Output control - 0
4109
     *
4110
     * The integers to control the output of the deflate stream, which are
4111
     * an argument for Deflate#deflate and so on. */
3780 4112
    rb_define_const(mZlib, "NO_FLUSH", INT2FIX(Z_NO_FLUSH));
4113
    /* Output control - 2
4114
     *
4115
     * The integers to control the output of the deflate stream, which are
4116
     * an argument for Deflate#deflate and so on. */
3781 4117
    rb_define_const(mZlib, "SYNC_FLUSH", INT2FIX(Z_SYNC_FLUSH));
4118
    /* Output control - 3
4119
     *
4120
     * The integers to control the output of the deflate stream, which are
4121
     * an argument for Deflate#deflate and so on. */
3782 4122
    rb_define_const(mZlib, "FULL_FLUSH", INT2FIX(Z_FULL_FLUSH));
4123
    /* Oputput control - 4
4124
     *
4125
     * The integers to control the output of the deflate stream, which are
4126
     * an argument for Deflate#deflate and so on. */
3783 4127
    rb_define_const(mZlib, "FINISH", INT2FIX(Z_FINISH));
3784 4128

  
3785 4129
#if GZIP_SUPPORT
......
3794 4138

  
3795 4139
    cGzipFile = rb_define_class_under(mZlib, "GzipFile", rb_cObject);
3796 4140
    cGzError = rb_define_class_under(cGzipFile, "Error", cZError);
4141
    /* ??? */
3797 4142
    rb_define_attr(cGzError, "input", 1, 0);
3798 4143
    rb_define_method(cGzError, "inspect", gzfile_error_inspect, 0);
3799 4144

  
......
3865 4210
    rb_define_method(cGzipReader, "lines", rb_gzreader_each, -1);
3866 4211
    rb_define_method(cGzipReader, "readlines", rb_gzreader_readlines, -1);
3867 4212

  
4213
    /* From GzipFile#os_code - code of current host */
3868 4214
    rb_define_const(mZlib, "OS_CODE", INT2FIX(OS_CODE));
4215
    /* From GzipFile#os_code - 0x00 */
3869 4216
    rb_define_const(mZlib, "OS_MSDOS", INT2FIX(OS_MSDOS));
4217
    /* From GzipFile#os_code - 0x01 */
3870 4218
    rb_define_const(mZlib, "OS_AMIGA", INT2FIX(OS_AMIGA));
4219
    /* From GzipFile#os_code - 0x02 */
3871 4220
    rb_define_const(mZlib, "OS_VMS", INT2FIX(OS_VMS));
4221
    /* From GzipFile#os_code - 0x03 */
3872 4222
    rb_define_const(mZlib, "OS_UNIX", INT2FIX(OS_UNIX));
4223
    /* From GzipFile#os_code - 0x05 */
3873 4224
    rb_define_const(mZlib, "OS_ATARI", INT2FIX(OS_ATARI));
4225
    /* From GzipFile#os_code - 0x06 */
3874 4226
    rb_define_const(mZlib, "OS_OS2", INT2FIX(OS_OS2));
4227
    /* From GzipFile#os_code - 0x07 */
3875 4228
    rb_define_const(mZlib, "OS_MACOS", INT2FIX(OS_MACOS));
4229
    /* From GzipFile#os_code - 0x0a */
3876 4230
    rb_define_const(mZlib, "OS_TOPS20", INT2FIX(OS_TOPS20));
4231
    /* From GzipFile#os_code - 0x0b */
3877 4232
    rb_define_const(mZlib, "OS_WIN32", INT2FIX(OS_WIN32));
3878 4233

  
4234
    /* From GzipFile#os_code - 0x04 */
3879 4235
    rb_define_const(mZlib, "OS_VMCMS", INT2FIX(OS_VMCMS));
4236
    /* From GzipFile#os_code - 0x08 */
3880 4237
    rb_define_const(mZlib, "OS_ZSYSTEM", INT2FIX(OS_ZSYSTEM));
4238
    /* From GzipFile#os_code - 0x09 */
3881 4239
    rb_define_const(mZlib, "OS_CPM", INT2FIX(OS_CPM));
4240
    /* From GzipFile#os_code - 0x0c */
3882 4241
    rb_define_const(mZlib, "OS_QDOS", INT2FIX(OS_QDOS));
4242
    /* From GzipFile#os_code - 0x0d */
3883 4243
    rb_define_const(mZlib, "OS_RISCOS", INT2FIX(OS_RISCOS));
4244
    /* From GzipFile#os_code - 0xff */
3884 4245
    rb_define_const(mZlib, "OS_UNKNOWN", INT2FIX(OS_UNKNOWN));
3885 4246

  
3886 4247
#endif /* GZIP_SUPPORT */
......
3908 4269
 */
3909 4270

  
3910 4271
/*
4272
 * Document-class: Zlib::StreamEnd
4273
 *
4274
 * Subclass of Zlib::Error
4275
 *
4276
 * When zlib returns a Z_STREAM_END
4277
 * is return if the end of the compressed data has been reached
4278
 * and all uncompressed out put has been produced.
4279
 *
4280
 */
4281

  
4282
/*
4283
 * Document-class: Zlib::NeedDict
4284
 *
4285
 * Subclass of Zlib::Error
4286
 *
4287
 * When zlib returns a Z_NEED_DICT
4288
 * if a preset dictionary is needed at this point.
4289
 *
4290
 * Used by Zlib::Inflate.inflate and <tt>Zlib.inflate</tt>
4291
 */
4292

  
4293
/*
4294
 * Document-class: Zlib::VersionError
4295
 *
4296
 * Subclass of Zlib::Error
4297
 *
4298
 * When zlib returns a Z_VERSION_ERROR,
4299
 * usually if the zlib library version is incompatible with the
4300
 * version assumed by the caller.
4301
 *
4302
 */
4303

  
4304
/*
4305
 * Document-class: Zlib::MemError
4306
 *
4307
 * Subclass of Zlib::Error
4308
 *
4309
 * When zlib returns a Z_MEM_ERROR,
4310
 * usually if there was not enough memory.
4311
 *
4312
 */
4313

  
4314
/*
4315
 * Document-class: Zlib::StreamError
4316
 *
4317
 * Subclass of Zlib::Error
4318
 *
4319
 * When zlib returns a Z_STREAM_ERROR, 
4320
 * usually if the stream state was inconsistent.
4321
 *
4322
 */
4323

  
4324
/*
4325
 * Document-class: Zlib::BufError
4326
 *
4327
 * Subclass of Zlib::Error when zlib returns a Z_BUF_ERROR.
4328
 *
4329
 * Usually if no progress is possible.
4330
 *
4331
 */
4332

  
4333
/*
4334
 * Document-class: Zlib::DataError
4335
 *
4336
 * Subclass of Zlib::Error when zlib returns a Z_DATA_ERROR.
4337
 *
4338
 * Usually if a stream was prematurely freed.
4339
 *
4340
 */
4341

  
4342
/*
3911 4343
 * Document-class: Zlib::GzipFile::Error
3912 4344
 *
3913 4345
 * Base class of errors that occur when processing GZIP files.