rbcdio 0.01

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/AUTHORS +1 -0
  2. data/COPYING +340 -0
  3. data/ChangeLog +315 -0
  4. data/INSTALL +236 -0
  5. data/Makefile.am +163 -0
  6. data/Makefile.in +557 -0
  7. data/NEWS +5 -0
  8. data/README +75 -0
  9. data/Rakefile +234 -0
  10. data/THANKS +3 -0
  11. data/VERSION +1 -0
  12. data/VERSION.in +1 -0
  13. data/config.guess +1473 -0
  14. data/config.sub +1576 -0
  15. data/configure +4802 -0
  16. data/configure.ac +158 -0
  17. data/data/copying.iso +0 -0
  18. data/data/isofs-m1.bin +0 -0
  19. data/data/isofs-m1.cue +3 -0
  20. data/doc/created.rid +1 -0
  21. data/doc/fr_class_index.html +42 -0
  22. data/doc/fr_file_index.html +40 -0
  23. data/doc/fr_method_index.html +133 -0
  24. data/doc/index.html +24 -0
  25. data/doc/rdoc-style.css +208 -0
  26. data/example/COPYING +340 -0
  27. data/example/README +47 -0
  28. data/example/audio.rb +186 -0
  29. data/example/cd-read.rb +167 -0
  30. data/example/copying +340 -0
  31. data/example/device.rb +91 -0
  32. data/example/drivers.rb +63 -0
  33. data/example/drives.rb +63 -0
  34. data/example/eject.rb +69 -0
  35. data/example/iso1.rb +89 -0
  36. data/example/iso2.rb +106 -0
  37. data/example/iso3.rb +111 -0
  38. data/example/tracks.rb +83 -0
  39. data/ext/cdio/Makefile +139 -0
  40. data/ext/cdio/extconf.rb +9 -0
  41. data/ext/cdio/rubycdio_wrap.c +3410 -0
  42. data/ext/iso9660/Makefile +139 -0
  43. data/ext/iso9660/extconf.rb +10 -0
  44. data/ext/iso9660/rubyiso9660_wrap.c +3005 -0
  45. data/install-sh +323 -0
  46. data/lib/Makefile +7 -0
  47. data/lib/cdio.rb +1000 -0
  48. data/lib/iso9660.rb +566 -0
  49. data/missing +360 -0
  50. data/rubycdio.m4 +14 -0
  51. data/swig/Makefile +7 -0
  52. data/swig/audio.swg +63 -0
  53. data/swig/compat.swg +104 -0
  54. data/swig/device.swg +513 -0
  55. data/swig/device_const.swg +144 -0
  56. data/swig/disc.swg +96 -0
  57. data/swig/read.swg +164 -0
  58. data/swig/rubycdio.swg +86 -0
  59. data/swig/rubyiso9660.swg +827 -0
  60. data/swig/track.swg +206 -0
  61. data/swig/types.swg +65 -0
  62. data/test/Makefile +7 -0
  63. data/test/Rakefile +8 -0
  64. data/test/cdda.bin +0 -0
  65. data/test/cdda.cue +7 -0
  66. data/test/cdda.toc +14 -0
  67. data/test/cdiotest.rb +228 -0
  68. data/test/isocopy.rb +394 -0
  69. data/test/isotest.rb +187 -0
  70. metadata +116 -0
data/test/isocopy.rb ADDED
@@ -0,0 +1,394 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: isocopy.rb,v 1.4 2006/12/09 09:59:49 rocky Exp $
3
+
4
+ # Unit test of ISO 9660 file extraction.
5
+
6
+ require "test/unit"
7
+ mypath = File.expand_path(File.dirname(__FILE__))
8
+ $: << mypath + '/../lib'
9
+ $: << mypath + '/../ext/cdio'
10
+ $: << mypath + '/../ext/iso9660'
11
+
12
+ require "cdio"
13
+ require "iso9660"
14
+
15
+ # The test CD image
16
+ CD_IMAGE_PATH = mypath + "/../data"
17
+
18
+ class ISO9660Tests < Test::Unit::TestCase
19
+
20
+ def test_fs()
21
+
22
+ local_filename="COPYING"
23
+ cd_image_fname = CD_IMAGE_PATH + "/isofs-m1.cue"
24
+ cd = ISO9660::FS::new(cd_image_fname)
25
+ assert(cd != nil, "Open CD image %s" % cd_image_fname)
26
+ statbuf = cd.stat("/" + local_filename)
27
+
28
+ good_stat = { 'lsn' => 26, 'filename' => 'COPYING', 'type' => 1,
29
+ 'secsize' => 9, 'size' => 17992 }
30
+
31
+ assert_equal(statbuf, good_stat, 'CD 9660 file stats')
32
+
33
+ # Get file
34
+ buf_all =[]
35
+ blocks = (statbuf['size'].to_f / Rubycdio::ISO_BLOCKSIZE).ceil()
36
+ for i in 0 .. blocks - 1
37
+ lsn = statbuf['lsn'] + i
38
+ size, buf = cd.read_data_blocks(lsn)
39
+
40
+ assert_equal( true, size >= 0,
41
+ "Error reading ISO 9660 file %d" % lsn )
42
+ buf_all << buf
43
+ end
44
+
45
+ length=statbuf['size'];
46
+ test_file_contents=buf_all.join('')[0..length-1]
47
+ assert_equal(FILE_CONTENTS, test_file_contents,
48
+ 'File contents comparison')
49
+ cd.close()
50
+ end
51
+ end
52
+
53
+ FILE_CONTENTS=<<EOF
54
+ GNU GENERAL PUBLIC LICENSE
55
+ Version 2, June 1991
56
+
57
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
58
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
59
+ Everyone is permitted to copy and distribute verbatim copies
60
+ of this license document, but changing it is not allowed.
61
+
62
+ Preamble
63
+
64
+ The licenses for most software are designed to take away your
65
+ freedom to share and change it. By contrast, the GNU General Public
66
+ License is intended to guarantee your freedom to share and change free
67
+ software--to make sure the software is free for all its users. This
68
+ General Public License applies to most of the Free Software
69
+ Foundation's software and to any other program whose authors commit to
70
+ using it. (Some other Free Software Foundation software is covered by
71
+ the GNU Library General Public License instead.) You can apply it to
72
+ your programs, too.
73
+
74
+ When we speak of free software, we are referring to freedom, not
75
+ price. Our General Public Licenses are designed to make sure that you
76
+ have the freedom to distribute copies of free software (and charge for
77
+ this service if you wish), that you receive source code or can get it
78
+ if you want it, that you can change the software or use pieces of it
79
+ in new free programs; and that you know you can do these things.
80
+
81
+ To protect your rights, we need to make restrictions that forbid
82
+ anyone to deny you these rights or to ask you to surrender the rights.
83
+ These restrictions translate to certain responsibilities for you if you
84
+ distribute copies of the software, or if you modify it.
85
+
86
+ For example, if you distribute copies of such a program, whether
87
+ gratis or for a fee, you must give the recipients all the rights that
88
+ you have. You must make sure that they, too, receive or can get the
89
+ source code. And you must show them these terms so they know their
90
+ rights.
91
+
92
+ We protect your rights with two steps: (1) copyright the software, and
93
+ (2) offer you this license which gives you legal permission to copy,
94
+ distribute and/or modify the software.
95
+
96
+ Also, for each author's protection and ours, we want to make certain
97
+ that everyone understands that there is no warranty for this free
98
+ software. If the software is modified by someone else and passed on, we
99
+ want its recipients to know that what they have is not the original, so
100
+ that any problems introduced by others will not reflect on the original
101
+ authors' reputations.
102
+
103
+ Finally, any free program is threatened constantly by software
104
+ patents. We wish to avoid the danger that redistributors of a free
105
+ program will individually obtain patent licenses, in effect making the
106
+ program proprietary. To prevent this, we have made it clear that any
107
+ patent must be licensed for everyone's free use or not licensed at all.
108
+
109
+ The precise terms and conditions for copying, distribution and
110
+ modification follow.
111
+
112
+ GNU GENERAL PUBLIC LICENSE
113
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
114
+
115
+ 0. This License applies to any program or other work which contains
116
+ a notice placed by the copyright holder saying it may be distributed
117
+ under the terms of this General Public License. The "Program", below,
118
+ refers to any such program or work, and a "work based on the Program"
119
+ means either the Program or any derivative work under copyright law:
120
+ that is to say, a work containing the Program or a portion of it,
121
+ either verbatim or with modifications and/or translated into another
122
+ language. (Hereinafter, translation is included without limitation in
123
+ the term "modification".) Each licensee is addressed as "you".
124
+
125
+ Activities other than copying, distribution and modification are not
126
+ covered by this License; they are outside its scope. The act of
127
+ running the Program is not restricted, and the output from the Program
128
+ is covered only if its contents constitute a work based on the
129
+ Program (independent of having been made by running the Program).
130
+ Whether that is true depends on what the Program does.
131
+
132
+ 1. You may copy and distribute verbatim copies of the Program's
133
+ source code as you receive it, in any medium, provided that you
134
+ conspicuously and appropriately publish on each copy an appropriate
135
+ copyright notice and disclaimer of warranty; keep intact all the
136
+ notices that refer to this License and to the absence of any warranty;
137
+ and give any other recipients of the Program a copy of this License
138
+ along with the Program.
139
+
140
+ You may charge a fee for the physical act of transferring a copy, and
141
+ you may at your option offer warranty protection in exchange for a fee.
142
+
143
+ 2. You may modify your copy or copies of the Program or any portion
144
+ of it, thus forming a work based on the Program, and copy and
145
+ distribute such modifications or work under the terms of Section 1
146
+ above, provided that you also meet all of these conditions:
147
+
148
+ a) You must cause the modified files to carry prominent notices
149
+ stating that you changed the files and the date of any change.
150
+
151
+ b) You must cause any work that you distribute or publish, that in
152
+ whole or in part contains or is derived from the Program or any
153
+ part thereof, to be licensed as a whole at no charge to all third
154
+ parties under the terms of this License.
155
+
156
+ c) If the modified program normally reads commands interactively
157
+ when run, you must cause it, when started running for such
158
+ interactive use in the most ordinary way, to print or display an
159
+ announcement including an appropriate copyright notice and a
160
+ notice that there is no warranty (or else, saying that you provide
161
+ a warranty) and that users may redistribute the program under
162
+ these conditions, and telling the user how to view a copy of this
163
+ License. (Exception: if the Program itself is interactive but
164
+ does not normally print such an announcement, your work based on
165
+ the Program is not required to print an announcement.)
166
+
167
+ These requirements apply to the modified work as a whole. If
168
+ identifiable sections of that work are not derived from the Program,
169
+ and can be reasonably considered independent and separate works in
170
+ themselves, then this License, and its terms, do not apply to those
171
+ sections when you distribute them as separate works. But when you
172
+ distribute the same sections as part of a whole which is a work based
173
+ on the Program, the distribution of the whole must be on the terms of
174
+ this License, whose permissions for other licensees extend to the
175
+ entire whole, and thus to each and every part regardless of who wrote it.
176
+
177
+ Thus, it is not the intent of this section to claim rights or contest
178
+ your rights to work written entirely by you; rather, the intent is to
179
+ exercise the right to control the distribution of derivative or
180
+ collective works based on the Program.
181
+
182
+ In addition, mere aggregation of another work not based on the Program
183
+ with the Program (or with a work based on the Program) on a volume of
184
+ a storage or distribution medium does not bring the other work under
185
+ the scope of this License.
186
+
187
+ 3. You may copy and distribute the Program (or a work based on it,
188
+ under Section 2) in object code or executable form under the terms of
189
+ Sections 1 and 2 above provided that you also do one of the following:
190
+
191
+ a) Accompany it with the complete corresponding machine-readable
192
+ source code, which must be distributed under the terms of Sections
193
+ 1 and 2 above on a medium customarily used for software interchange; or,
194
+
195
+ b) Accompany it with a written offer, valid for at least three
196
+ years, to give any third party, for a charge no more than your
197
+ cost of physically performing source distribution, a complete
198
+ machine-readable copy of the corresponding source code, to be
199
+ distributed under the terms of Sections 1 and 2 above on a medium
200
+ customarily used for software interchange; or,
201
+
202
+ c) Accompany it with the information you received as to the offer
203
+ to distribute corresponding source code. (This alternative is
204
+ allowed only for noncommercial distribution and only if you
205
+ received the program in object code or executable form with such
206
+ an offer, in accord with Subsection b above.)
207
+
208
+ The source code for a work means the preferred form of the work for
209
+ making modifications to it. For an executable work, complete source
210
+ code means all the source code for all modules it contains, plus any
211
+ associated interface definition files, plus the scripts used to
212
+ control compilation and installation of the executable. However, as a
213
+ special exception, the source code distributed need not include
214
+ anything that is normally distributed (in either source or binary
215
+ form) with the major components (compiler, kernel, and so on) of the
216
+ operating system on which the executable runs, unless that component
217
+ itself accompanies the executable.
218
+
219
+ If distribution of executable or object code is made by offering
220
+ access to copy from a designated place, then offering equivalent
221
+ access to copy the source code from the same place counts as
222
+ distribution of the source code, even though third parties are not
223
+ compelled to copy the source along with the object code.
224
+
225
+ 4. You may not copy, modify, sublicense, or distribute the Program
226
+ except as expressly provided under this License. Any attempt
227
+ otherwise to copy, modify, sublicense or distribute the Program is
228
+ void, and will automatically terminate your rights under this License.
229
+ However, parties who have received copies, or rights, from you under
230
+ this License will not have their licenses terminated so long as such
231
+ parties remain in full compliance.
232
+
233
+ 5. You are not required to accept this License, since you have not
234
+ signed it. However, nothing else grants you permission to modify or
235
+ distribute the Program or its derivative works. These actions are
236
+ prohibited by law if you do not accept this License. Therefore, by
237
+ modifying or distributing the Program (or any work based on the
238
+ Program), you indicate your acceptance of this License to do so, and
239
+ all its terms and conditions for copying, distributing or modifying
240
+ the Program or works based on it.
241
+
242
+ 6. Each time you redistribute the Program (or any work based on the
243
+ Program), the recipient automatically receives a license from the
244
+ original licensor to copy, distribute or modify the Program subject to
245
+ these terms and conditions. You may not impose any further
246
+ restrictions on the recipients' exercise of the rights granted herein.
247
+ You are not responsible for enforcing compliance by third parties to
248
+ this License.
249
+
250
+ 7. If, as a consequence of a court judgment or allegation of patent
251
+ infringement or for any other reason (not limited to patent issues),
252
+ conditions are imposed on you (whether by court order, agreement or
253
+ otherwise) that contradict the conditions of this License, they do not
254
+ excuse you from the conditions of this License. If you cannot
255
+ distribute so as to satisfy simultaneously your obligations under this
256
+ License and any other pertinent obligations, then as a consequence you
257
+ may not distribute the Program at all. For example, if a patent
258
+ license would not permit royalty-free redistribution of the Program by
259
+ all those who receive copies directly or indirectly through you, then
260
+ the only way you could satisfy both it and this License would be to
261
+ refrain entirely from distribution of the Program.
262
+
263
+ If any portion of this section is held invalid or unenforceable under
264
+ any particular circumstance, the balance of the section is intended to
265
+ apply and the section as a whole is intended to apply in other
266
+ circumstances.
267
+
268
+ It is not the purpose of this section to induce you to infringe any
269
+ patents or other property right claims or to contest validity of any
270
+ such claims; this section has the sole purpose of protecting the
271
+ integrity of the free software distribution system, which is
272
+ implemented by public license practices. Many people have made
273
+ generous contributions to the wide range of software distributed
274
+ through that system in reliance on consistent application of that
275
+ system; it is up to the author/donor to decide if he or she is willing
276
+ to distribute software through any other system and a licensee cannot
277
+ impose that choice.
278
+
279
+ This section is intended to make thoroughly clear what is believed to
280
+ be a consequence of the rest of this License.
281
+
282
+ 8. If the distribution and/or use of the Program is restricted in
283
+ certain countries either by patents or by copyrighted interfaces, the
284
+ original copyright holder who places the Program under this License
285
+ may add an explicit geographical distribution limitation excluding
286
+ those countries, so that distribution is permitted only in or among
287
+ countries not thus excluded. In such case, this License incorporates
288
+ the limitation as if written in the body of this License.
289
+
290
+ 9. The Free Software Foundation may publish revised and/or new versions
291
+ of the General Public License from time to time. Such new versions will
292
+ be similar in spirit to the present version, but may differ in detail to
293
+ address new problems or concerns.
294
+
295
+ Each version is given a distinguishing version number. If the Program
296
+ specifies a version number of this License which applies to it and "any
297
+ later version", you have the option of following the terms and conditions
298
+ either of that version or of any later version published by the Free
299
+ Software Foundation. If the Program does not specify a version number of
300
+ this License, you may choose any version ever published by the Free Software
301
+ Foundation.
302
+
303
+ 10. If you wish to incorporate parts of the Program into other free
304
+ programs whose distribution conditions are different, write to the author
305
+ to ask for permission. For software which is copyrighted by the Free
306
+ Software Foundation, write to the Free Software Foundation; we sometimes
307
+ make exceptions for this. Our decision will be guided by the two goals
308
+ of preserving the free status of all derivatives of our free software and
309
+ of promoting the sharing and reuse of software generally.
310
+
311
+ NO WARRANTY
312
+
313
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
314
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
315
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
316
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
317
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
318
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
319
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
320
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
321
+ REPAIR OR CORRECTION.
322
+
323
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
324
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
325
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
326
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
327
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
328
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
329
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
330
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
331
+ POSSIBILITY OF SUCH DAMAGES.
332
+
333
+ END OF TERMS AND CONDITIONS
334
+
335
+ How to Apply These Terms to Your New Programs
336
+
337
+ If you develop a new program, and you want it to be of the greatest
338
+ possible use to the public, the best way to achieve this is to make it
339
+ free software which everyone can redistribute and change under these terms.
340
+
341
+ To do so, attach the following notices to the program. It is safest
342
+ to attach them to the start of each source file to most effectively
343
+ convey the exclusion of warranty; and each file should have at least
344
+ the "copyright" line and a pointer to where the full notice is found.
345
+
346
+ <one line to give the program's name and a brief idea of what it does.>
347
+ Copyright (C) <year> <name of author>
348
+
349
+ This program is free software; you can redistribute it and/or modify
350
+ it under the terms of the GNU General Public License as published by
351
+ the Free Software Foundation; either version 2 of the License, or
352
+ (at your option) any later version.
353
+
354
+ This program is distributed in the hope that it will be useful,
355
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
356
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
357
+ GNU General Public License for more details.
358
+
359
+ You should have received a copy of the GNU General Public License
360
+ along with this program; if not, write to the Free Software
361
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
362
+
363
+
364
+ Also add information on how to contact you by electronic and paper mail.
365
+
366
+ If the program is interactive, make it output a short notice like this
367
+ when it starts in an interactive mode:
368
+
369
+ Gnomovision version 69, Copyright (C) year name of author
370
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
371
+ This is free software, and you are welcome to redistribute it
372
+ under certain conditions; type `show c' for details.
373
+
374
+ The hypothetical commands `show w' and `show c' should show the appropriate
375
+ parts of the General Public License. Of course, the commands you use may
376
+ be called something other than `show w' and `show c'; they could even be
377
+ mouse-clicks or menu items--whatever suits your program.
378
+
379
+ You should also get your employer (if you work as a programmer) or your
380
+ school, if any, to sign a "copyright disclaimer" for the program, if
381
+ necessary. Here is a sample; alter the names:
382
+
383
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
384
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
385
+
386
+ <signature of Ty Coon>, 1 April 1989
387
+ Ty Coon, President of Vice
388
+
389
+ This General Public License does not permit incorporating your program into
390
+ proprietary programs. If your program is a subroutine library, you may
391
+ consider it more useful to permit linking proprietary applications with the
392
+ library. If this is what you want to do, use the GNU Library General
393
+ Public License instead of this License.
394
+ EOF
data/test/isotest.rb ADDED
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: isotest.rb,v 1.7 2006/12/14 12:55:02 rocky Exp $
3
+ # Unit test for iso9660
4
+
5
+ # Test some low-level ISO9660 routines
6
+ # This is basically the same thing as libcdio's testiso9660.c
7
+
8
+ require "test/unit"
9
+ Mypath = File.expand_path(File.dirname(__FILE__))
10
+ $: << Mypath + '/../lib'
11
+ $: << Mypath + '/../ext/cdio'
12
+ $: << Mypath + '/../ext/iso9660'
13
+
14
+ require "iso9660"
15
+
16
+ def eq?(a, b)
17
+ if a.length() != b.length() then return false end
18
+
19
+ for i in 0 .. a.length() - 1
20
+ if a[i] != b[i]
21
+ puts "position %d: %d != %d\n" % [i, a[i], b[i]]
22
+ return false
23
+ end
24
+ end
25
+ return true
26
+ end
27
+
28
+ class ISO9660Tests < Test::Unit::TestCase
29
+
30
+ @@achars = ['!', '"', '%', '&', '(', ')', '*', '+', ',', '-', '.',
31
+ '/', '?', '<', '=', '>']
32
+
33
+ # ACHAR and DCHAR
34
+ def test_chars()
35
+ bad = 0
36
+ c = ?A
37
+ while c<= ?Z
38
+ if not ISO9660.dchar?(c)
39
+ puts "Failed ISO9660.achar? test on %c" % c
40
+ bad += 1
41
+ end
42
+ if not ISO9660.achar?(c):
43
+ puts "Failed ISO9660.achar? test on %c" % c
44
+ bad += 1
45
+ end
46
+ c += 1
47
+ end
48
+
49
+ assert_equal(true, bad==0, 'dchar? & achar? A..Z')
50
+ bad=0
51
+ c= ?0
52
+ while c<= ?9
53
+ if not ISO9660.dchar?(c)
54
+ puts "Failed ISO9660.dchar? test on %c" % c
55
+ bad += 1
56
+ end
57
+ if not ISO9660.achar?(c)
58
+ puts "Failed ISO9660.achar? test on %c" % c
59
+ bad += 1
60
+ end
61
+ c += 1
62
+ end
63
+ assert_equal(true, bad==0, 'dchar? & achar? 0..9')
64
+
65
+ bad=0
66
+ i=0
67
+ while i<=13
68
+ c = @@achars[i][0]
69
+ if ISO9660.dchar?(c)
70
+ puts "Should not pass dchar? test on %c" % c
71
+ bad += 1
72
+ end
73
+ if not ISO9660.achar?(c)
74
+ puts "Failed achar? test on symbol %c" % c
75
+ bad += 1
76
+ end
77
+ i += 1
78
+ end
79
+
80
+ assert_equal(true, bad==0, 'dchar? & achar? symbols')
81
+ end # test_chars
82
+
83
+ # Test ISO9660.strncpy_pad
84
+ def test_strncpy_pad()
85
+
86
+ dst = ISO9660.strncpy_pad("1_3", 5, :dchars)
87
+ assert_equal(dst, "1_3 ", "strncpy_pad DCHARS")
88
+
89
+ dst = ISO9660.strncpy_pad("ABC!123", 2, :achars)
90
+ assert_equal(dst, "AB", "strncpy_pad ACHARS truncation")
91
+ end
92
+
93
+ # Test ISO9660.dirname_valid?
94
+ def test_dirname()
95
+
96
+ assert_equal(false, ISO9660.dirname_valid?("/NOGOOD"),
97
+ "dirname_valid? - /NOGOOD is no good.")
98
+
99
+ assert_equal(false,
100
+ ISO9660.dirname_valid?("LONGDIRECTORY/NOGOOD"),
101
+ "pyiso9660.dirname_valid? - too long directory")
102
+
103
+ assert_equal(true, ISO9660.dirname_valid?("OKAY/DIR"),
104
+ "dirname_valid? - OKAY/DIR should pass ")
105
+
106
+ assert_equal(false, ISO9660.dirname_valid?("OKAY/FILE.EXT"),
107
+ "dirname_valid? - OKAY/FILENAME.EXT")
108
+ end # test_dirname
109
+
110
+ # Test retrieving image information
111
+ def test_image_info()
112
+
113
+ # The test ISO 9660 image
114
+ image_path= Mypath + "/../data"
115
+ image_fname=image_path + "/copying.iso"
116
+ iso = ISO9660::IFS::new(image_fname)
117
+ assert(iso != nil, "Opening %s" % image_fname)
118
+
119
+ assert_equal(iso.application_id(),
120
+ "MKISOFS ISO 9660/HFS FILESYSTEM BUILDER & CDRECORD CD-R/DVD CREATOR (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING",
121
+ "get_application_id()")
122
+
123
+ assert_equal(iso.system_id(), "LINUX",
124
+ "get_system_id() eq 'LINUX'")
125
+ assert_equal(iso.volume_id(), "CDROM",
126
+ "get_volume_id() eq 'CDROM'")
127
+
128
+ file_stats = iso.readdir('/')
129
+
130
+ okay_stats = [
131
+ {"size"=>2048, "type"=>2, "secsize"=>1, "lsn"=>23,
132
+ "filename"=>"."},
133
+ {"size"=>2048, "type"=>2, "secsize"=>1, "lsn"=>23,
134
+ "filename"=>".."},
135
+ {"size"=>17992, "type"=>1, "secsize"=>9, "lsn"=>24,
136
+ "filename"=>"COPYING.;1"}
137
+ ]
138
+ assert_equal(file_stats, okay_stats, "file stat info")
139
+ end # test_image_info
140
+
141
+ # Test pathname_valid?
142
+ def test_pathname_valid()
143
+ # require "debug"
144
+ assert_equal(true, ISO9660.pathname_valid?("OKAY/FILE.EXT"),
145
+ "pyiso9660.dirname_valid? - OKAY/FILE.EXT ")
146
+ assert_equal(false,
147
+ ISO9660.pathname_valid?("OKAY/FILENAMELONG.EXT"),
148
+ 'invalid pathname, long basename')
149
+
150
+ assert_equal(false,
151
+ ISO9660.pathname_valid?("OKAY/FILE.LONGEXT"),
152
+ "pathname_valid? - long extension" )
153
+
154
+ dst = ISO9660.pathname_isofy("this/file.ext", 1)
155
+ assert(dst != "this/file.ext1", "ISO9660.pathname_isofy")
156
+ end # test_pathname_valid
157
+
158
+ # # Test time
159
+ # def test_time()
160
+ # import time
161
+
162
+ # tm = time.localtime(0)
163
+ # dtime = set_dtime(tm[0], tm[1], tm[2], tm[3], tm[4], tm[5])
164
+ # new_tm = dtime(dtime, true)
165
+
166
+ # ### FIXME Don't know why the discrepancy, but there is an hour
167
+ # ### difference, perhaps daylight savings time.
168
+ # ### Versions before 0.77 have other bugs.
169
+ # if new_tm
170
+ # # if Rubyiso9660::VERSION_NUM < 77 then new_tm[3] = tm[3] end
171
+ # new_tm[3] = tm[3]
172
+ # assert_equal(true, eq?(new_tm, tm), 'get_dtime(set_dtime())')
173
+ # else
174
+ # assert_equal(true, false, 'get_dtime is None')
175
+ # end
176
+
177
+ # # if Rubyiso9660::VERSION_NUM >= 77:
178
+ # # tm = time.gmtime(0)
179
+ # # ltime = set_ltime(tm[0], tm[1], tm[2], tm[3], tm[4],
180
+ # # tm[5])
181
+ # # new_tm = get_ltime(ltime)
182
+ # # assert_equal(true, eq?(new_tm, tm),
183
+ # # 'get_ltime(set_ltime())')
184
+ # end
185
+
186
+ end # ISO9660Tests
187
+
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: rbcdio
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.01"
7
+ date: 2006-12-21 19:32:52 -05:00
8
+ summary: Ruby to libcdio (CD Input and Control library)
9
+ require_paths:
10
+ - lib
11
+ email: rocky@gnu.org
12
+ homepage: http://rubyforge.org/projects/rbcdio/
13
+ rubyforge_project: rbcdio
14
+ description: A library for CD-ROM and CD image access. Applications wishing to be oblivious of the OS- and device-dependent properties of a CD-ROM or of the specific details of various CD-image formats may benefit from using this library. A library for working with ISO-9660 filesystems is included.
15
+ autorequire: rubycdio
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.2
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Rocky Bernstein
30
+ files:
31
+ - AUTHORS
32
+ - COPYING
33
+ - ChangeLog
34
+ - INSTALL
35
+ - Makefile.am
36
+ - Makefile.in
37
+ - NEWS
38
+ - README
39
+ - Rakefile
40
+ - THANKS
41
+ - VERSION
42
+ - VERSION.in
43
+ - config.guess
44
+ - config.sub
45
+ - configure
46
+ - configure.ac
47
+ - data/copying.iso
48
+ - data/isofs-m1.bin
49
+ - data/isofs-m1.cue
50
+ - doc/files
51
+ - doc/index.html
52
+ - doc/rdoc-style.css
53
+ - doc/fr_method_index.html
54
+ - doc/fr_class_index.html
55
+ - doc/fr_file_index.html
56
+ - doc/created.rid
57
+ - doc/classes
58
+ - example/device.rb
59
+ - example/audio.rb
60
+ - example/copying
61
+ - example/drives.rb
62
+ - example/README
63
+ - example/cd-read.rb
64
+ - example/drivers.rb
65
+ - example/eject.rb
66
+ - example/COPYING
67
+ - example/tracks.rb
68
+ - example/iso1.rb
69
+ - example/iso2.rb
70
+ - example/iso3.rb
71
+ - ext/cdio/rubycdio_wrap.c
72
+ - ext/iso9660/rubyiso9660_wrap.c
73
+ - ext/cdio/Makefile
74
+ - ext/iso9660/Makefile
75
+ - ext/cdio/extconf.rb
76
+ - ext/iso9660/extconf.rb
77
+ - install-sh
78
+ - lib/iso9660.rb
79
+ - lib/cdio.rb
80
+ - lib/Makefile
81
+ - missing
82
+ - rubycdio.m4
83
+ - swig/compat.swg
84
+ - swig/device.swg
85
+ - swig/disc.swg
86
+ - swig/types.swg
87
+ - swig/audio.swg
88
+ - swig/rubycdio.swg
89
+ - swig/rubyiso9660.swg
90
+ - swig/read.swg
91
+ - swig/track.swg
92
+ - swig/device_const.swg
93
+ - swig/Makefile
94
+ - test/cdiotest.rb
95
+ - test/isocopy.rb
96
+ - test/isotest.rb
97
+ - test/Makefile
98
+ - test/Rakefile
99
+ - test/cdda.bin
100
+ - test/cdda.cue
101
+ - test/cdda.toc
102
+ test_files: []
103
+
104
+ rdoc_options: []
105
+
106
+ extra_rdoc_files: []
107
+
108
+ executables: []
109
+
110
+ extensions:
111
+ - ext/cdio/extconf.rb
112
+ - ext/iso9660/extconf.rb
113
+ requirements: []
114
+
115
+ dependencies: []
116
+