doc/classes/AppleCPM.src/M000029.html in ripxplore-0.17.0 vs doc/classes/AppleCPM.src/M000029.html in ripxplore-0.17.1
- old
+ new
@@ -3,21 +3,38 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>set_block (AppleCPM)</title>
+ <title>files (AppleCPM)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
- <pre><span class="ruby-comment cmt"># File lib/file_systems/AppleCPM.rb, line 39</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set_block</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-identifier">block_no</span>,<span class="ruby-identifier">contents</span>)
- <span class="ruby-identifier">raise</span> <span class="ruby-node">"invalid block #{block_no} - length was #{contents.length}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">contents</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">==</span><span class="ruby-constant">BLOCK_SIZE</span>
- <span class="ruby-identifier">track_no</span>=(<span class="ruby-identifier">block_no</span><span class="ruby-operator">/</span><span class="ruby-value">4</span>)<span class="ruby-operator">+</span><span class="ruby-value">3</span>
- <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-value">3</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
- <span class="ruby-identifier">sector_no</span>=<span class="ruby-constant">SECTORS_IN_BLOCK</span>[<span class="ruby-identifier">block_no</span><span class="ruby-operator">%</span><span class="ruby-value">4</span>][<span class="ruby-identifier">i</span>]
- <span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">set_sector</span>(<span class="ruby-identifier">track_no</span>,<span class="ruby-identifier">sector_no</span>,<span class="ruby-identifier">contents</span>[(<span class="ruby-identifier">i</span><span class="ruby-operator">*</span><span class="ruby-value">256</span>),<span class="ruby-value">256</span>])
- <span class="ruby-keyword kw">end</span>
- <span class="ruby-keyword kw">end</span></pre>
+ <pre><span class="ruby-comment cmt"># File lib/file_systems/AppleCPM.rb, line 81</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">files</span>(<span class="ruby-identifier">file_system_image</span>)
+ <span class="ruby-identifier">files</span>=<span class="ruby-constant">FileContainer</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-identifier">catalog</span>=<span class="ruby-identifier">get_block</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-value">0</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">get_block</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-value">1</span>)
+ <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-value">63</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dir_entry_no</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">dir_entry_start</span>=<span class="ruby-identifier">dir_entry_no</span><span class="ruby-operator">*</span><span class="ruby-value">0x20</span>
+ <span class="ruby-identifier">dir_entry</span>=<span class="ruby-identifier">catalog</span>[<span class="ruby-identifier">dir_entry_start</span><span class="ruby-operator">..</span><span class="ruby-identifier">dir_entry_start</span><span class="ruby-operator">+</span><span class="ruby-value">0x1</span><span class="ruby-constant">F</span>]
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">dir_entry</span>[<span class="ruby-value">0</span>]<span class="ruby-operator"><</span><span class="ruby-value">0x10</span>) <span class="ruby-keyword kw">then</span>
+ <span class="ruby-identifier">file_name</span>=<span class="ruby-identifier">dir_entry</span>[<span class="ruby-value">0x01</span><span class="ruby-operator">..</span><span class="ruby-value">0x08</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">' '</span>,<span class="ruby-value str">''</span>)
+ <span class="ruby-identifier">file_ext</span>=<span class="ruby-identifier">dir_entry</span>[<span class="ruby-value">0x09</span><span class="ruby-operator">..</span><span class="ruby-value">0x0</span><span class="ruby-constant">B</span>].<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">' '</span>,<span class="ruby-value str">''</span>)
+ <span class="ruby-identifier">full_filename</span>=<span class="ruby-node">"#{file_name}.#{file_ext}"</span>
+ <span class="ruby-identifier">files</span><span class="ruby-operator"><<</span><span class="ruby-constant">NativeFileType</span>.<span class="ruby-identifier">best_fit</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-identifier">full_filename</span>,<span class="ruby-value str">''</span>,<span class="ruby-identifier">file_ext</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">files</span>[<span class="ruby-identifier">full_filename</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">then</span>
+ <span class="ruby-identifier">files</span><span class="ruby-operator"><<</span><span class="ruby-identifier">file</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">s</span>=<span class="ruby-value str">""</span>
+ <span class="ruby-value">0x10</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-value">0x1f</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">block</span>=<span class="ruby-identifier">dir_entry</span>[<span class="ruby-identifier">i</span>]
+ <span class="ruby-identifier">s</span><span class="ruby-operator">+=</span><span class="ruby-identifier">get_block</span>(<span class="ruby-identifier">file_system_image</span>,<span class="ruby-identifier">block</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">records_allocated</span>=<span class="ruby-identifier">dir_entry</span>[<span class="ruby-value">0x0</span><span class="ruby-constant">F</span>]
+ <span class="ruby-identifier">files</span>[<span class="ruby-identifier">full_filename</span>].<span class="ruby-identifier">contents</span><span class="ruby-operator">+=</span><span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>,(<span class="ruby-identifier">records_allocated</span><span class="ruby-operator">*</span><span class="ruby-value">128</span>)]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">files</span>
+<span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file