Does ecpg understand forward declarations?

"Sam Liapis" <[email protected]> Wed, 1 Aug 2018 17:10:51 +1000
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
This is a multipart message in MIME format.

------=_NextPart_000_0193_01D429BA.99B5A060
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

[Retransmitting from MS mail client in the hope message is well formatted]

 

I'm a newbie to postgresql and ecpg in particular.

 

My brief is to 'convert' Oracle pro*C files ready for ecpg preprocessing.

 

I've so far struck what appears to be ecpg limitation such as multi-dim
arrays, function pointers and void type.

But the one that's biting hard right now is ecpg seems to be unaware of or
ignores forward declarations.

Take the classic scenario of mutually dependent structs A & B shown below.

 

ECPG keeps bailing with "ERROR: unrecognized data type name struct B" (at
line 100)

If I remove the forward declaration its the same error for line 110 (struct
B* ptr;)

 

100  struct B;

101

102 struct A {

         ...

110      struct B* ptr;

111  };

112

113  struct B {

         ...

120      struct A* ptr;

121 };

 

Can someone confirm this indeed is a shortcoming of ecpg and suggest any way
around it?

 

Thanks,

Sam


------=_NextPart_000_0193_01D429BA.99B5A060
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 15 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-AU =
link=3D"#0563C1" vlink=3D"#954F72"><div class=3DWordSection1><p =
class=3DMsoNormal>[Retransmitting from MS mail client in the hope =
message is well formatted]<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>I'm a newbie =
to postgresql and ecpg in particular.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>My brief is =
to 'convert' Oracle pro*C files ready for ecpg =
preprocessing.<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>I've so far =
struck what appears to be ecpg limitation such as multi-dim arrays, =
function pointers and void type.<o:p></o:p></p><p class=3DMsoNormal>But =
the one that's biting hard right now is ecpg seems to be unaware of or =
ignores forward declarations.<o:p></o:p></p><p class=3DMsoNormal>Take =
the classic scenario of mutually dependent structs A &amp; B shown =
below.<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>ECPG keeps bailing with &quot;ERROR: unrecognized data =
type name struct B&quot; (at line 100)<o:p></o:p></p><p =
class=3DMsoNormal>If I remove the forward declaration its the same error =
for line 110 (struct B* ptr;)<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>100 =
&nbsp;struct B;<o:p></o:p></p><p class=3DMsoNormal>101<o:p></o:p></p><p =
class=3DMsoNormal>102 struct A {<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...<o:p></o:p></p><p =
class=3DMsoNormal>110 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct B* =
ptr;<o:p></o:p></p><p class=3DMsoNormal>111 &nbsp;};<o:p></o:p></p><p =
class=3DMsoNormal>112<o:p></o:p></p><p class=3DMsoNormal>113 =
&nbsp;struct B {<o:p></o:p></p><p =
class=3DMsoNormal>&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;...<o:p></o:p></p><p =
class=3DMsoNormal>120&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;struct A* =
ptr;<o:p></o:p></p><p class=3DMsoNormal>121 };<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>Can someone =
confirm this indeed is a shortcoming of ecpg and suggest any way around =
it?<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
class=3DMsoNormal>Thanks,<o:p></o:p></p><p =
class=3DMsoNormal>Sam<o:p></o:p></p></div></body></html>
------=_NextPart_000_0193_01D429BA.99B5A060--