<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Well,<br>
    <br>
    h2pas gives you:<br>
    {$packrecords c}<br>
    <br>
      type<br>
        VkFlags = uint32_t;<br>
    <br>
        VkSparseImageFormatFlagBits =
    (VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT := $00000001,<br>
          VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT := $00000002,<br>
          VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT := $00000004<br>
          );<br>
    <br>
        VkSparseImageFormatFlags = VkFlags;<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 01-Apr-16 10:01 PM, Alcom wrote:<br>
    </div>
    <blockquote
cite="mid:CAMKgGNwqyKzL5bVK4rOzp0o17Zm5tnntEF_F7WqGLwSN=mibcQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_default" style="font-size:small"><br>
          I'm working on some translated C headers for Vulkan for use in
          FPC.<br>
          <br>
          In the vulkan.h header file, we have the following:<br>
          <br>
              typedef uint32_t VkFlags;<br>
              typedef enum VkSparseImageFormatFlagBits {<br>
                  VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT =
          0x00000001,<br>
                  VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT =
          0x00000002,<br>
                  VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT =
          0x00000004,<br>
              } VkSparseImageFormatFlagBits;<br>
              typedef VkFlags VkSparseImageFormatFlags;<br>
          <br>
          For code maintenance purposes, it is desirable to have a
          header translation that is as close as possible to the source.
          A reasonable translation to Pascal of this might be:<br>
          <br>
              TVkFlags = Cardinal;<br>
              TVkSparseImageFormatFlagBits = <br>
              (<br>
                  VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = $00000001,<br>
                  VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT =
          $00000002,<br>
                  VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT =
          $00000004<br>
              );<br>
              TVkSparseImageFormatFlags = TVkFlags;<br>
          <br>
              <br>
          However, this solution has only the *illusion* of being
          strongly typed -- nothing about which the compiler is aware
          links TVkImageCreateFlags with the TVkImageCreateFlagBits.<br>
          <br>
          A seemingly better solution (albeit incorrect) would be the
          following:<br>
          <br>
              {$packset 4}<br>
              TVkSparseImageFormatFlagBits = <br>
              (<br>
                  VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = $00000001,<br>
                  VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT =
          $00000002,<br>
                  VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT =
          $00000004<br>
              );<br>
              TVkSparseImageFormatFlags = set of
          TVkSparseImageFormatFlagBits;<br>
              <br>
          This will not give the expected results, because FPC
          interprets the enum constant as an exponent (or bit position,
          if you prefer).<br>
          <br>
          <br>
          <br>
          My question is this: Is there currently a modifier for the set
          declaration that instructs the compiler to accept the enum
          values as literal constants, instead of interpreting them as
          exponents?<br>
          <br>
          e.g. something like this:<br>
              {$EnumConstantsUseLiteral}<br>
              --or--<br>
              TVkSparseImageFormatFlags = literalset of
          TVkSparseImageFormatFlagBits;<br>
              --or--<br>
              TVkSparseImageFormatFlags = set of
          TVkSparseImageFormatFlagBits; literal;<br>
              --or--<br>
              TVkSparseImageFormatFlags = set of literal
          TVkSparseImageFormatFlagBits;<br>
              <br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>