Subversion Repositories freemyipod

Rev

Rev 604 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 604 Rev 607
Line 118... Line 118...
118
    def __setstate__(self, state):
118
    def __setstate__(self, state):
119
        self.update(state)
119
        self.update(state)
120
        self.__dict__ = self
120
        self.__dict__ = self
121
 
121
 
122
 
122
 
-
 
123
class remote_pointer(dict):
-
 
124
    """
-
 
125
        This points to a (remote) location.
-
 
126
        Otherwise it behaves like a Bunch.
-
 
127
        The second argument must be a Bunch object
-
 
128
    """
-
 
129
    def __init__(self, address, bunch):
-
 
130
        dict.__init__(self, bunch.__dict__)
-
 
131
        self.__dict__ = self
-
 
132
        self._address_ = address
-
 
133
    
-
 
134
    def __getstate__(self):
-
 
135
        return self
-
 
136
    
-
 
137
    def __setstate__(self, state):
-
 
138
        self.update(state)
-
 
139
        self.__dict__ = self
-
 
140
    
-
 
141
    def __str__(self):
-
 
142
        return "<remote_pointer object with address 0x%X>" % (self._address_)
-
 
143
    
-
 
144
    def __int__(self):
-
 
145
        return self._address_
-
 
146
    
-
 
147
    def __repr__(self):
-
 
148
        return self.__str__()
-
 
149
 
-
 
150
 
123
class c_enum(_SimpleCData):
151
class c_enum(_SimpleCData):
124
    """
152
    """
125
        Resembles the enum datatype from C with an 8 bit size.
153
        Resembles the enum datatype from C with an 8 bit size.
126
        Returns the associated string of a value with c_enum[i]
154
        Returns the associated string of a value with c_enum[i]
127
        Returns the current value of the associated value as c_enum.__repr__()
155
        Returns the current value of the associated value as c_enum.__repr__()
Line 224... Line 252...
224
    
252
    
225
    def _to_string(self):
253
    def _to_string(self):
226
        return string_at(addressof(self), sizeof(self))
254
        return string_at(addressof(self), sizeof(self))
227
 
255
 
228
 
256
 
-
 
257
def getthread(address, threads):
-
 
258
    """
-
 
259
        Returns the thread at <address> from the list of threads <threads>.
-
 
260
        Returns an empty thread if not found
-
 
261
    """
-
 
262
    for thread in threads:
-
 
263
        if address == thread.addr:
-
 
264
            return thread
-
 
265
    thread = scheduler_thread()._to_bunch()
-
 
266
    thread.name = "[Invalid Thread %08X]" % address
-
 
267
    return thread
-
 
268
 
-
 
269
 
229
def gethwname(id):
270
def gethwname(id):
230
    try:
271
    try:
231
        from libemcoredata import hwtypes
272
        from libemcoredata import hwtypes
232
        hwtype = hwtypes[id][1]
273
        hwtype = hwtypes[id][1]
233
    except KeyError:
274
    except KeyError: