python-adfs

changeset 31:00351d2c0d09

Removed the workings of the "scan_new_map" method.
author David Boddie <david@boddie.org.uk>
date Sat Mar 29 23:03:09 2003 +0100
parents 5c97b1f04969
children ec842aa910f9
files ADFSlib.py
diffstat 1 files changed, 0 insertions(+), 114 deletions(-) [+]
line diff
     1.1 --- a/ADFSlib.py	Sat Mar 29 23:02:07 2003 +0100
     1.2 +++ b/ADFSlib.py	Sat Mar 29 23:03:09 2003 +0100
     1.3 @@ -349,120 +349,6 @@
     1.4      def scan_new_map(self, begin, end):
     1.5      
     1.6          map = {}
     1.7 -    
     1.8 -        a = begin
     1.9 -        
    1.10 -        current = None
    1.11 -        action = "read ID"
    1.12 -        
    1.13 -        while a < end:
    1.14 -        
    1.15 -            if action == "read ID":
    1.16 -            
    1.17 -                # At the start of a block.
    1.18 -                
    1.19 -                value = self.str2num(2, self.sectors[a:a+2])
    1.20 -                
    1.21 -                entry = value & 0x7fff
    1.22 -                
    1.23 -                if entry > 1:
    1.24 -                
    1.25 -                    #print hex(entry), hex(a)
    1.26 -                    if not map.has_key(entry):
    1.27 -                    
    1.28 -                        # Create a new map entry corresponding to this value in
    1.29 -                        # which the address of this entry is stored.
    1.30 -                        map[entry] = [[a]]
    1.31 -                    
    1.32 -                    else:
    1.33 -                    
    1.34 -                        # Add this address to the map dictionary.
    1.35 -                        map[entry].append([a])
    1.36 -                    
    1.37 -                    # Check whether this block finishes immediately.
    1.38 -                    if (value & 0x8000) != 0:
    1.39 -                    
    1.40 -                        #print " immediate end at", hex(a)
    1.41 -                        
    1.42 -                        map[entry][-1].append(a + 2)
    1.43 -                        
    1.44 -                        next = a + 2
    1.45 -                        action = "read ID"
    1.46 -                        current = None
    1.47 -                    
    1.48 -                    else:
    1.49 -                    
    1.50 -                        next = a + 2
    1.51 -                        action = "find end marker"
    1.52 -                        current = entry
    1.53 -                
    1.54 -                else:
    1.55 -                
    1.56 -                    # Space or defect
    1.57 -                    next = a + 1
    1.58 -            
    1.59 -            elif action == "find end marker":
    1.60 -            
    1.61 -                # In a block.
    1.62 -                
    1.63 -                value = ord(self.sectors[a])
    1.64 -                
    1.65 -                if value == 0x80:
    1.66 -                
    1.67 -                    # The next block should start immediately after this
    1.68 -                    # byte.
    1.69 -                    if current is not None:
    1.70 -                    
    1.71 -                        map[current][-1].append(a + 1)
    1.72 -                    
    1.73 -                    next = a + 1
    1.74 -                    action = "read ID"
    1.75 -                    current = None
    1.76 -                
    1.77 -                elif value == 0:
    1.78 -                
    1.79 -                    # Continue reading the block.
    1.80 -                    next = a + 1
    1.81 -                
    1.82 -                else:
    1.83 -                
    1.84 -                    # Unknown data - search for a new block.
    1.85 -                    if current is not None:
    1.86 -                    
    1.87 -                        map[current][-1].append(a)
    1.88 -                    
    1.89 -                    next = a + 1
    1.90 -                    action = "find ID"
    1.91 -                    current = None
    1.92 -            
    1.93 -            elif action == "find ID":
    1.94 -            
    1.95 -                # Possibly in a block, but still looking for the end.
    1.96 -                
    1.97 -                value = ord(self.sectors[a])
    1.98 -                
    1.99 -                if value == 0x80:
   1.100 -                
   1.101 -                    # End of block marker - go back two bytes and look for
   1.102 -                    # a block ID.
   1.103 -                    next = max(begin, a - 2)
   1.104 -                    
   1.105 -                    action = "read ID"
   1.106 -                
   1.107 -                elif value == 0:
   1.108 -                
   1.109 -                    # Space - go back two bytes and look for a block ID.
   1.110 -                    next = max(begin, a - 2)
   1.111 -                    
   1.112 -                    action = "read ID"
   1.113 -                
   1.114 -                else:
   1.115 -                
   1.116 -                    # Other data - keep looking.
   1.117 -                    next = a + 1
   1.118 -            
   1.119 -            a = next
   1.120 -        
   1.121          return map
   1.122      
   1.123