<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Convert pascal to C in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893403#M35078</link>
    <description>What is the problem you're hitting?&lt;BR /&gt;&lt;BR /&gt;From the Pascal I got a size of 202 bytes (layout attached). The array of BOOLEAN is 64 bytes so its going to be confusing to map. At a guess I would go:&lt;BR /&gt;&lt;BR /&gt;X0 char&lt;BR /&gt;X1 uint64&lt;BR /&gt;X2 byte&lt;BR /&gt;X3 uint64[16]&lt;BR /&gt;X4 uint[16]&lt;BR /&gt;&lt;BR /&gt;No idea where you've got the additional field from (unless I've missed something obvious).</description>
    <pubDate>Tue, 07 Nov 2006 08:11:32 GMT</pubDate>
    <dc:creator>Brian Reiter</dc:creator>
    <dc:date>2006-11-07T08:11:32Z</dc:date>
    <item>
      <title>Convert pascal to C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893401#M35076</link>
      <description>I need to convert some legacy pascal program to C on my Alpha, somehow I didn't get this right.  What is wrong with my C code?  Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;-Ivan&lt;BR /&gt;&lt;BR /&gt;=======================================&lt;BR /&gt;&lt;BR /&gt;(* convert this pascal code to C  *)&lt;BR /&gt;&lt;BR /&gt;_UQUAD = [QUAD,UNSAFE] PACKED RECORD&lt;BR /&gt;         L0,&lt;BR /&gt;         L1 : UNSIGNED;&lt;BR /&gt;         END;&lt;BR /&gt;&lt;BR /&gt;Tel = [aligned] PACKED RECORD&lt;BR /&gt;      X0 : [BIT(3)] 0..7;&lt;BR /&gt;      X1 : _UQUAD;&lt;BR /&gt;      X2 : BOOLEAN;&lt;BR /&gt;      X3 : ARRAY [1..16] OF _UQUAD;&lt;BR /&gt;      X4 : ARRAY [1..16] OF BOOLEAN;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;======================================&lt;BR /&gt;// This is my C code&lt;BR /&gt;&lt;BR /&gt;struct tel {&lt;BR /&gt; unsigned       X0 : 3;&lt;BR /&gt; uint64         X1;&lt;BR /&gt; uint64         X2;&lt;BR /&gt; bool           X3;&lt;BR /&gt; uint64         X4[16];&lt;BR /&gt; bool           X5[16];&lt;BR /&gt;};</description>
      <pubDate>Mon, 06 Nov 2006 18:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893401#M35076</guid>
      <dc:creator>Ivan_118</dc:creator>
      <dc:date>2006-11-06T18:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Convert pascal to C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893402#M35077</link>
      <description>Well, I don't pretend to remember the PASCAL allignment rules vs C rules, but what you show has simple miscounts/mislabels.&lt;BR /&gt;&lt;BR /&gt;Should the C not be:&lt;BR /&gt;&lt;BR /&gt;struct tel {&lt;BR /&gt;unsigned X0 : 3;&lt;BR /&gt;uint64 X1;&lt;BR /&gt;bool X2;&lt;BR /&gt;uint64 X3[16];&lt;BR /&gt;bool X4[16];&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;Now what does that 'bool' map to through your includes? Is every bool becoming an int thus taking 64 bytes? The array of boolean in Pascal is probably a bit-array taking 2 bytes.&lt;BR /&gt;&lt;BR /&gt;Be sure to write a trivial test program allocating this structure in both languages and compile with full listing showing the variable allocations.&lt;BR /&gt;&lt;BR /&gt;Is the structure just use in runtime by a single language, or exchanged between languages, or stored on disk where you need to use an old file? For the first case you can just pick your favourite C constructs. For the other you'll need to control aligment down to the bit.&lt;BR /&gt;&lt;BR /&gt;Hope this helps a little,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Nov 2006 19:31:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893402#M35077</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-11-06T19:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert pascal to C</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893403#M35078</link>
      <description>What is the problem you're hitting?&lt;BR /&gt;&lt;BR /&gt;From the Pascal I got a size of 202 bytes (layout attached). The array of BOOLEAN is 64 bytes so its going to be confusing to map. At a guess I would go:&lt;BR /&gt;&lt;BR /&gt;X0 char&lt;BR /&gt;X1 uint64&lt;BR /&gt;X2 byte&lt;BR /&gt;X3 uint64[16]&lt;BR /&gt;X4 uint[16]&lt;BR /&gt;&lt;BR /&gt;No idea where you've got the additional field from (unless I've missed something obvious).</description>
      <pubDate>Tue, 07 Nov 2006 08:11:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/convert-pascal-to-c/m-p/3893403#M35078</guid>
      <dc:creator>Brian Reiter</dc:creator>
      <dc:date>2006-11-07T08:11:32Z</dc:date>
    </item>
  </channel>
</rss>

