<!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 5.50.4943.400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>No, that function won't change the value in the 
flag. It just tests it and returns True if that field of a global variable 
(m_nFieldFlags) contains the value "Text_UTF8" and returns&nbsp;False if that 
field contains any of the other 3 values.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>What is it that your own program needs to do with 
this field? Just determine the value? Or do you need to set or change it and 
pass the resulting entire flags word (which possibly includes other fields which 
should not be changed) back to an external process or device?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Brian</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=ross@stationplaylist.com href="mailto:ross@stationplaylist.com">Ross 
  Levis</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@ns3.123.co.nz 
  href="mailto:delphi@ns3.123.co.nz">NZ Borland Developers Group - Delphi 
  List</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 14, 2006 10:41 
AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [DUG] C code help</DIV>
  <DIV><BR></DIV>
  <DIV><FONT face=Arial size=2>Hi Brian</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Thanks for your detailed reply.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I wondered if I should have included the code 
  used to test the value.&nbsp; Here is one such function</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; BOOL GetIsUTF8Text() { return 
  ((m_nFieldFlags &amp; TAG_FIELD_FLAG_DATA_TYPE_MASK) == 
  TAG_FIELD_FLAG_DATA_TYPE_TEXT_UTF8) ? TRUE : FALSE; }</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>I see&nbsp;that it is&nbsp;ANDing the Mask.&nbsp; 
  There are no other flags using the same byte of this 4 byte flag.</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</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&nbsp;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&nbsp; - reserved</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</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&nbsp;0000&nbsp;= Text UTF8</FONT></DIV>
    <DIV><FONT face=Arial size=2>0000&nbsp;0002&nbsp;= binary</FONT></DIV>
    <DIV><FONT face=Arial size=2>0000&nbsp;0004&nbsp;= External 
Info</FONT></DIV>
    <DIV><FONT face=Arial size=2>0000&nbsp;0006&nbsp; - reserved</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
    <DIV>
    <DIV><FONT face=Arial size=2>#define 
    APE_TAG_FLAG_CONTAINS_FOOTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    (1 &lt;&lt; 30)</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; value = (word &amp; 
    TAG_FIELD_FLAG_DATA_TYPE_MASK) &gt;&gt; 1;</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>or, to set the value to, say "External 
    Info":</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; word &amp;= 
    ~TAG_FIELD_FLAG_DATA_TYPE_MASK;</FONT></DIV>
    <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; word |= 
    TAG_FIELD_FLAG_DATA_TYPE_EXTERNAL_INFO;</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Z := X or Y;</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>assigns the value 101101 to Z.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</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>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>The result of a not operation is of the same 
    type as the operand.<BR>&nbsp;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>&nbsp;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>&nbsp;</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>
  <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>