I’m trying to read what is referred to in this Python code as “weird
Microsoft Format” it is some sort of MicroSoft Real format. Anyway, I’ve no
problem reading in this data with my Ruby code, but I can’t make the math
work. I don’t understand how lamba or reduce work, for instance. I also
have examples of it in Pascal but it is no clearer? Anyone have any ideas?
while (1): L=f.read(5) # Read an entry if L=='': return index L=map(lambda x: ord(x), L[0:4]) L.reverse() n=reduce(lambda x,y: x*256+y, L, 0L) # Index values are stored in a weird Microsoft format; the # following lines convert to something more reasonable. shift=24-((n>>24) & 0x7f) n=(n & 0x00ffffffL) | 0x00800000L index.append((n >>shift)-1) return index
NOTICE: This e-mail and any attachment(s) may contain confidential and
proprietary information of Goss International Corporation and/or its
subsidiaries and may be legally privileged. This e-mail is intended solely
for the addressee. If you are not the addressee, dissemination, copying or
other use of this e-mail or any of its content is strictly prohibited and
may be unlawful. If you are not the intended recipient please inform the
sender immediately and destroy the e-mail and any copies. All liability for
viruses is excluded to the fullest extent permitted by law. Any views
expressed in this message are those of the individual sender. No contract
may be construed by this e-mail.