python-adfs

changeset 81:1fe7233fb898

Removed commented out code.
author David Boddie <david@boddie.org.uk>
date Mon Oct 10 22:46:16 2011 +0200
parents 4b095fed28a0
children fe806064ace5
files ADFSlib.py
diffstat 1 files changed, 0 insertions(+), 97 deletions(-) [+]
line diff
     1.1 --- a/ADFSlib.py	Mon Oct 10 22:40:00 2011 +0200
     1.2 +++ b/ADFSlib.py	Mon Oct 10 22:46:16 2011 +0200
     1.3 @@ -168,7 +168,6 @@
     1.4              self.disc_type = 'ads'
     1.5              self.dir_markers = ('Hugo',)
     1.6          
     1.7 -        #if string.lower(adf_file[-4:])==(suffix+"adf"):
     1.8          elif length == 327680:
     1.9              self.ntracks = 80
    1.10              self.nsectors = 16
    1.11 @@ -177,7 +176,6 @@
    1.12              self.disc_type = 'adm'
    1.13              self.dir_markers = ('Hugo',)
    1.14          
    1.15 -        #elif string.lower(adf_file[-4:])==(suffix+"adl"):
    1.16          elif length == 655360:
    1.17              self.ntracks = 160
    1.18              self.nsectors = 16        # per track
    1.19 @@ -228,9 +226,6 @@
    1.20          # Close the ADF file
    1.21          adf.close()
    1.22          
    1.23 -        #open('dump', 'wb').write(self.sectors)
    1.24 -        #sys.exit()
    1.25 -        
    1.26          # Set the default disc name.
    1.27          self.disc_name = 'Untitled'
    1.28          
    1.29 @@ -352,8 +347,6 @@
    1.30          # Seek to the end of the disc image.
    1.31          adf.seek(0, 2)
    1.32          
    1.33 -        #print hex(record["disc size"]), hex(adf.tell())
    1.34 -        
    1.35          if record["disc size"] == adf.tell():
    1.36          
    1.37              # The record (if is exists) does not provide a consistent value
    1.38 @@ -363,8 +356,6 @@
    1.39          
    1.40          # Check the sector size of the disc.
    1.41          
    1.42 -        #print hex(record["sector size"])
    1.43 -        
    1.44          if record["sector size"] == 1024:
    1.45          
    1.46              # These should be equal if the disc record is valid.
    1.47 @@ -373,8 +364,6 @@
    1.48          
    1.49          # Check the density of the disc.
    1.50          
    1.51 -        #print record["density"]
    1.52 -        
    1.53          if record["density"] == "double":
    1.54          
    1.55              # This should be a double density disc if the disc record is valid.
    1.56 @@ -382,7 +371,6 @@
    1.57          
    1.58          
    1.59          # Check the data at the root directory location.
    1.60 -        #print hex(record["root dir"])
    1.61          
    1.62          adf.seek((record["root dir"] * record["sector size"]) + 1, 0)
    1.63          word = adf.read(4)
    1.64 @@ -392,7 +380,6 @@
    1.65              # A valid directory identifier was found.
    1.66              checklist["Root directory at location given"] = 1
    1.67          
    1.68 -        
    1.69          if self.verify:
    1.70          
    1.71              self.verify_log.append(
    1.72 @@ -640,11 +627,6 @@
    1.73                  # the disc address and hence the file number.
    1.74                  # i.e.the top bit of the file number cannot be set.
    1.75                  
    1.76 -                #if entry == 1:
    1.77 -                #
    1.78 -                #    # File number 1 (defect)
    1.79 -                #    next = a + 2
    1.80 -                #
    1.81                  if entry >= 1:
    1.82                  
    1.83                      # Defects (1), files or directories (greater than 1)
    1.84 @@ -734,10 +716,6 @@
    1.85              # Move to the next relevant byte.
    1.86              a = next
    1.87          
    1.88 -        #for k, v in disc_map.items():
    1.89 -        #
    1.90 -        #    print hex(k), map(lambda x: map(hex, x), v)
    1.91 -        
    1.92          return disc_map
    1.93      
    1.94      def _read_free_space(self, header, begin, end):
    1.95 @@ -810,8 +788,6 @@
    1.96              # beginning of the next zone.
    1.97              a = next_zone
    1.98          
    1.99 -        #print map(lambda x: (hex(x[0]), hex(x[1])), free_space)
   1.100 -        
   1.101          # Return the free space list.
   1.102          return free_space
   1.103      
   1.104 @@ -984,7 +960,6 @@
   1.105      def _read_old_catalogue(self, base):
   1.106      
   1.107          head = base
   1.108 -    #    base = sector_size*2
   1.109          p = 0
   1.110          
   1.111          dir_seq = self.sectors[head + p]
   1.112 @@ -1030,21 +1005,9 @@
   1.113              
   1.114              olddirobseq = self._read_unsigned_byte(self.sectors[head+p+25])
   1.115              
   1.116 -            #print string.expandtabs(
   1.117 -            #   "%s\t%s\t%s\t%s" % (
   1.118 -            #       name, "("+self._binary(8, olddirobseq)+")",
   1.119 -            #       "("+self._binary(8, load)+")",
   1.120 -            #       "("+self._binary(8, exe)+")"
   1.121 -            #   ) )
   1.122 -            #print string.expandtabs(
   1.123 -            #   "%s\t%02x\t%08x\t%08x" % (
   1.124 -            #       name, olddirobseq, load, exe
   1.125 -            #   ) )
   1.126 -            
   1.127              if self.disc_type == 'adD':
   1.128              
   1.129                  # Old format 800K discs.
   1.130 -                #if olddirobseq == 0xc:
   1.131                  if (olddirobseq & 0x8) == 0x8:
   1.132                  
   1.133                      # A directory has been found.
   1.134 @@ -1137,9 +1100,6 @@
   1.135              # Note that the title may contain spaces.
   1.136              self.disc_name = self._safe(dir_title, with_space = 1)
   1.137          
   1.138 -        #print "Directory title", dir_title
   1.139 -        #print "Directory name ", dir_name
   1.140 -        
   1.141          endseq = self.sectors[tail+self.sector_size-6]
   1.142          if endseq != dir_seq:
   1.143          
   1.144 @@ -1173,16 +1133,10 @@
   1.145          # The top 16 bits are the file number
   1.146          file_no = value >> 8
   1.147          
   1.148 -        #print "File number:", hex(file_no)
   1.149 -        #self.verify_log.append("File number: %s" % hex(file_no))
   1.150 -        
   1.151          # The pieces of the object are returned as a list of pairs of
   1.152          # addresses.
   1.153 -        #pieces = self._find_in_new_map(self.map_start, self.map_end, file_no)
   1.154          pieces = self._find_in_new_map(file_no)
   1.155          
   1.156 -        #print map(lambda x: map(hex, x), pieces)
   1.157 -        
   1.158          if pieces == []:
   1.159          
   1.160              return -1
   1.161 @@ -1200,8 +1154,6 @@
   1.162          head = base
   1.163          p = 0
   1.164          
   1.165 -        #print "Head:", hex(head)
   1.166 -        
   1.167          dir_seq = self.sectors[head + p]
   1.168          dir_start = self.sectors[head+p+1:head+p+5]
   1.169          if dir_start not in self.dir_markers:
   1.170 @@ -1211,7 +1163,6 @@
   1.171                  self.verify_log.append(
   1.172                      (WARNING, 'Not a directory: %s' % hex(head))
   1.173                      )
   1.174 -                #print 'Not a directory: %s' % hex(head)
   1.175              
   1.176              return '', []
   1.177          
   1.178 @@ -1231,16 +1182,10 @@
   1.179              
   1.180              name = self._safe(self.sectors[head+p:head+p+10])
   1.181              
   1.182 -            #print hex(head+p), name
   1.183 -            
   1.184              load = self._read_unsigned_word(self.sectors[head+p+10:head+p+14])
   1.185              exe = self._read_unsigned_word(self.sectors[head+p+14:head+p+18])
   1.186              length = self._read_unsigned_word(self.sectors[head+p+18:head+p+22])
   1.187              
   1.188 -            #print hex(ord(self.sectors[head+p+22])), \
   1.189 -            #        hex(ord(self.sectors[head+p+23])), \
   1.190 -            #        hex(ord(self.sectors[head+p+24]))
   1.191 -            
   1.192              inddiscadd = self._read_new_address(
   1.193                  self.sectors[head+p+22:head+p+25]
   1.194                  )
   1.195 @@ -1290,31 +1235,16 @@
   1.196                      # Store a zero length file. This appears to be the
   1.197                      # standard behaviour for storing empty files.
   1.198                      files.append(ADFSfile(name, "", load, exe, length))
   1.199 -                    
   1.200 -                    #print hex(head+p), hex(head+p+22)
   1.201              
   1.202              else:
   1.203              
   1.204                  if (newdiratts & 0x8) != 0:
   1.205                  
   1.206 -                    #print '%s -> %s' % (name, hex(inddiscadd))
   1.207 -                    
   1.208                      # Remember that inddiscadd will be a sequence of
   1.209                      # pairs of addresses.
   1.210                      
   1.211 -                    #print
   1.212 -                    #print hex(head+p+22),
   1.213 -                    #print name, hex(load), hex(exe), hex(length)
   1.214 -                    #print hex(ord(self.sectors[head+p+22])), \
   1.215 -                    #        hex(ord(self.sectors[head+p+23])), \
   1.216 -                    #        hex(ord(self.sectors[head+p+24]))
   1.217 -                    #print "addrs:", map(lambda x: map(hex, x), inddiscadd),
   1.218 -                    #print "atts:", hex(newdiratts)
   1.219 -                    
   1.220                      for start, end in inddiscadd:
   1.221                      
   1.222 -                        #print hex(start), hex(end), "-->"
   1.223 -                        
   1.224                          # Try to interpret the data at the referenced address
   1.225                          # as a directory.
   1.226                          
   1.227 @@ -1332,10 +1262,6 @@
   1.228                      file = ""
   1.229                      remaining = length
   1.230                      
   1.231 -                    #print hex(head+p+22), name
   1.232 -                    #print "addrs:", map(lambda x: map(hex, x), inddiscadd),
   1.233 -                    #print "atts:", hex(newdiratts)
   1.234 -                    
   1.235                      for start, end in inddiscadd:
   1.236                      
   1.237                          amount = min(remaining, end - start)
   1.238 @@ -1369,18 +1295,9 @@
   1.239              self.sectors[tail+self.sector_size-16:tail+self.sector_size-6]
   1.240              )
   1.241          
   1.242 -        #parent = self._read_new_address(
   1.243 -        #    self.sectors[tail+self.sector_size-38:tail+self.sector_size-35], dir = 1
   1.244 -        #    )
   1.245 -        #print "This directory:", hex(head), "Parent:", hex(parent)
   1.246 -        
   1.247          parent = \
   1.248              self.sectors[tail+self.sector_size-38:tail+self.sector_size-35]
   1.249          
   1.250 -        #256*self._str2num(
   1.251 -        #   3, self.sectors[tail+self.sector_size-38:tail+self.sector_size-35]
   1.252 -        #)
   1.253 -        
   1.254          dir_title = \
   1.255              self.sectors[tail+self.sector_size-35:tail+self.sector_size-16]
   1.256          
   1.257 @@ -1402,23 +1319,9 @@
   1.258              
   1.259              return dir_name, files
   1.260          
   1.261 -        #print '<--'
   1.262 -        #print
   1.263 -        
   1.264          return dir_name, files
   1.265      
   1.266      
   1.267 -    def _read_leafname(self, path):
   1.268 -    
   1.269 -        # Unused
   1.270 -        
   1.271 -        pos = string.rfind(path, os.sep)
   1.272 -        if pos != -1:
   1.273 -            return path[pos+1:]
   1.274 -        else:
   1.275 -            return path
   1.276 -    
   1.277 -    
   1.278      def print_catalogue(self, files = None, path = "$", filetypes = 0):
   1.279      
   1.280          """Prints the contents of the disc catalogue to standard output.