doc/classes/AppleDos.src/M000245.html in ripxplore-0.11.0 vs doc/classes/AppleDos.src/M000245.html in ripxplore-0.12.0

- old
+ new

@@ -3,16 +3,71 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>vtoc_sector_no (AppleDos)</title> + <title>files (AppleDos)</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/AppleDos.rb, line 110</span> -<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">vtoc_sector_no</span> - <span class="ruby-value">0</span> + <pre><span class="ruby-comment cmt"># File lib/file_systems/AppleDos.rb, line 114</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">vtoc_sector</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">vtoc_track_no</span>,<span class="ruby-identifier">vtoc_sector_no</span>) + <span class="ruby-identifier">catalog_sector</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">vtoc_sector</span>[<span class="ruby-value">01</span>],<span class="ruby-identifier">vtoc_sector</span>[<span class="ruby-value">02</span>]) + <span class="ruby-identifier">done</span>=<span class="ruby-keyword kw">false</span> + <span class="ruby-identifier">visited_sectors</span>={} + <span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">done</span> + <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">catalog_sector</span>.<span class="ruby-identifier">nil?</span> + (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">6</span>).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">file_number</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">file_descriptive_entry_start</span>=<span class="ruby-value">11</span><span class="ruby-operator">+</span><span class="ruby-identifier">file_number</span><span class="ruby-operator">*</span><span class="ruby-value">35</span> + <span class="ruby-identifier">file_descriptive_entry</span>=<span class="ruby-identifier">catalog_sector</span>[<span class="ruby-identifier">file_descriptive_entry_start</span>,<span class="ruby-value">36</span>] + <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-value">0x</span><span class="ruby-constant">FF</span>) <span class="ruby-comment cmt"># skip deleted files </span> + <span class="ruby-identifier">filename</span>=<span class="ruby-value str">&quot;&quot;</span> + <span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">3</span><span class="ruby-operator">..</span><span class="ruby-value">32</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">each_byte</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">filename</span><span class="ruby-operator">+=</span>(<span class="ruby-identifier">b</span>.<span class="ruby-operator">%</span><span class="ruby-value">128</span>).<span class="ruby-identifier">chr</span>} + <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/ *$/</span>,<span class="ruby-value str">&quot;&quot;</span>) <span class="ruby-comment cmt">#strip off trailing spaces </span> + <span class="ruby-identifier">filename</span>.<span class="ruby-identifier">tr!</span>(<span class="ruby-value str">&quot;\x00-\x1f&quot;</span>,<span class="ruby-value str">&quot;\x40-\x5f&quot;</span>) <span class="ruby-comment cmt">#convert non-printable chars to corresponding uppercase letter </span> + <span class="ruby-identifier">locked</span>=(<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">&gt;=</span><span class="ruby-value">0x80</span>) + <span class="ruby-identifier">sector_count</span>=<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">0x21</span>]<span class="ruby-operator">+</span><span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">0x22</span>]<span class="ruby-operator">*</span><span class="ruby-value">256</span> + + <span class="ruby-identifier">file_type_code</span>=<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">%</span><span class="ruby-value">0x80</span> +<span class="ruby-comment cmt"># puts &quot;filename #{filename} sector count #{sector_count}&quot; </span> + <span class="ruby-identifier">contents</span>=<span class="ruby-value str">&quot;&quot;</span> + <span class="ruby-identifier">ts_list_track_no</span>=<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">0</span>] + <span class="ruby-identifier">ts_list_sector_no</span>=<span class="ruby-identifier">file_descriptive_entry</span>[<span class="ruby-value">1</span>] + <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">ts_list_track_no</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">ts_list_track_no</span><span class="ruby-operator">&lt;=</span><span class="ruby-value">0</span><span class="ruby-constant">X22</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">ts_list_sector_no</span><span class="ruby-operator">&lt;=</span><span class="ruby-value">0x0f</span>) + <span class="ruby-identifier">ts_list_sector</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">ts_list_track_no</span>,<span class="ruby-identifier">ts_list_sector_no</span>) + <span class="ruby-identifier">ts_list_track_no</span>=<span class="ruby-identifier">ts_list_sector</span>[<span class="ruby-value">1</span>] + <span class="ruby-identifier">ts_list_sector_no</span>=<span class="ruby-identifier">ts_list_sector</span>[<span class="ruby-value">2</span>] + + <span class="ruby-value">0x0</span><span class="ruby-constant">C</span>.<span class="ruby-identifier">step</span>(<span class="ruby-value">0xff</span>,<span class="ruby-value">2</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">data_track_no</span>=<span class="ruby-identifier">ts_list_sector</span>[<span class="ruby-identifier">i</span>] + <span class="ruby-identifier">data_sector_no</span>=<span class="ruby-identifier">ts_list_sector</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>] + <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">data_track_no</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">data_track_no</span><span class="ruby-operator">&lt;=</span><span class="ruby-value">0</span><span class="ruby-constant">X22</span>) <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">data_sector_no</span><span class="ruby-operator">&lt;=</span><span class="ruby-value">0x0f</span>) <span class="ruby-keyword kw">then</span> + <span class="ruby-identifier">contents</span><span class="ruby-operator">+=</span><span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">data_track_no</span>,<span class="ruby-identifier">data_sector_no</span>) + <span class="ruby-keyword kw">end</span> + } + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">contents</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">&gt;</span><span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> + <span class="ruby-identifier">files</span><span class="ruby-operator">&lt;&lt;</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">filename</span>,<span class="ruby-identifier">contents</span>,<span class="ruby-identifier">file_type_code</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + } + <span class="ruby-identifier">next_track</span>=<span class="ruby-identifier">catalog_sector</span>[<span class="ruby-value">1</span>] + <span class="ruby-identifier">next_sector</span>=<span class="ruby-identifier">catalog_sector</span>[<span class="ruby-value">2</span>]<span class="ruby-operator">%</span><span class="ruby-value">0x10</span> + <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">next_track</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>) <span class="ruby-operator">&amp;&amp;</span>( <span class="ruby-identifier">next_sector</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>) <span class="ruby-keyword kw">then</span> + <span class="ruby-identifier">done</span>=<span class="ruby-keyword kw">true</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-comment cmt">#check we haven't got into an endless loop </span> + <span class="ruby-identifier">s</span>=<span class="ruby-node">&quot;#{next_track}/#{next_sector}&quot;</span> + <span class="ruby-comment cmt"># puts s </span> + <span class="ruby-keyword kw">if</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">visited_sectors</span>[<span class="ruby-identifier">s</span>].<span class="ruby-identifier">nil?</span>) <span class="ruby-keyword kw">then</span> + <span class="ruby-identifier">done</span>=<span class="ruby-keyword kw">true</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">visited_sectors</span>[<span class="ruby-identifier">s</span>]=<span class="ruby-keyword kw">true</span> + <span class="ruby-identifier">catalog_sector</span>=<span class="ruby-identifier">file_system_image</span>.<span class="ruby-identifier">get_sector</span>(<span class="ruby-identifier">next_track</span>,<span class="ruby-identifier">next_sector</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