<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi Brian</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks for your detailed reply.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I wondered if I should have included the code used
to test the value. Here is one such function</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> BOOL GetIsUTF8Text() { return
((m_nFieldFlags & TAG_FIELD_FLAG_DATA_TYPE_MASK) ==
TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8) ? TRUE : FALSE; }</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I see that it is ANDing the Mask.
There are no other flags using the same byte of this 4 byte flag.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Does this affect the value that will be
found/stored in this flag for a Binary type?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>Ross.</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=Arial size=2>It's a two-bit field by the look of it, using
bits 1 and 2 of the word (numbering from bit 0 = least significant to 31
= most significant).</FONT></DIV>
<DIV><FONT face=Arial size=2>6 (bit pattern 110) is the mask, ie it's used
with a bitwise AND to select just those two bits from the word.</FONT></DIV>
<DIV><FONT face=Arial size=2>the four values of the two-bit field are
apparently:</FONT></DIV>
<DIV><FONT face=Arial size=2>0 = Text UTF8</FONT></DIV>
<DIV><FONT face=Arial size=2>1 = binary</FONT></DIV>
<DIV><FONT face=Arial size=2>2 = External Info</FONT></DIV>
<DIV><FONT face=Arial size=2>3 - reserved</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>So not just a simple 1-bit flag like I thought
from what you posted in the first message.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>With the various values of that field the whole
word might look like:</FONT></DIV>
<DIV>
<DIV><FONT face=Arial size=2>0000 0000 = Text UTF8</FONT></DIV>
<DIV><FONT face=Arial size=2>0000 0002 = binary</FONT></DIV>
<DIV><FONT face=Arial size=2>0000 0004 = External Info</FONT></DIV>
<DIV><FONT face=Arial size=2>0000 0006 - reserved</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Except, we don't know what might be in the rest
of the word. Probably not zeroes, so the values you are interested in will be
combined with other fields. Possibly even, that 3-bit field is repeated
several times in the word, with additional masking and shifting being used to
pick fields out. In your first message, you also showed:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>#define
APE_TAG_FLAG_CONTAINS_FOOTER
(1 << 30)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>which suggests bit 30 is also used as a one-bit
flag. But whether this is in the same word or not can't necessarily be
determined from the #defines. You'll probably need to find the code that
masks, sets and tests these fields to be sure how they're used, for example
look for something like:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> value = (word &
TAG_FIELD_FLAG_DATA_TYPE_MASK) >> 1;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>to extract the value of the field from the
word;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>or, to set the value to, say "External
Info":</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> word &=
~TAG_FIELD_FLAG_DATA_TYPE_MASK;</FONT></DIV>
<DIV><FONT face=Arial size=2> word |=
TAG_FIELD_FLAG_DATA_TYPE_EXTERNAL_INFO;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>To achieve the same operations in Delphi, use the
bitwise logical operators not, and, or, xor, shl and shr. Snipped from the
help screen:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<DIV>
<HR>
</DIV>The following logical operators perform bitwise manipulation on integer
operands. For example, if the value stored in X (in binary) is 001101 and the
value stored in Y is 100001, the statement</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Z := X or Y;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>assigns the value 101101 to Z.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>
<TABLE>
<TBODY>
<TR>
<TH>Operator
<TH>Operation
<TH>Operand types
<TH>Result type
<TH>Examples
<TR>
<TD>not
<TD>bitwise negation
<TD>integer
<TD>integer
<TD>not X
<TR>
<TD>and
<TD>bitwise and
<TD>integer
<TD>integer
<TD>X and Y
<TR>
<TD>or
<TD>bitwise or
<TD>integer
<TD>integer
<TD>X or Y
<TR>
<TD>xor
<TD>bitwise xor
<TD>integer
<TD>integer
<TD>X xor Y
<TR>
<TD>shl
<TD>bitwise shift left
<TD>integer
<TD>integer
<TD>X shl 2
<TR>
<TD>shr
<TD>bitwise shift right
<TD>integer
<TD>integer
<TD>Y shl I</TD></TR></TBODY></TABLE><BR>The following rules apply to bitwise
operators.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The result of a not operation is of the same type
as the operand.<BR> If the operands of an and, or, or xor operation are
both integers, the result is of the predefined integer type with the smallest
range that includes all possible values of both types.<BR> The operations
x shl y and x shr y shift the value of x to the left or right by y bits, which
is equivalent to multiplying or dividing x by 2^y; the result is of the same
type as x<BR>. For example, if N stores the value 01101 (decimal 13), then N
shl 1 returns 11010 (decimal 26).</FONT></DIV>
<DIV>
<HR>
</DIV></DIV></DIV>
<P> </P>
<P>Hope some of this helps clarify things a bit and doesn't just muddy it
further,</P>
<P>Brian</P>
<P>
<HR>
<P></P>_______________________________________________<BR>Delphi mailing
list<BR>Delphi@ns3.123.co.nz<BR>http://ns3.123.co.nz/mailman/listinfo/delphi<BR></BLOCKQUOTE></BODY></HTML>