Board index » cppbuilder » Header from pascal produced in wrong order

Header from pascal produced in wrong order

I have include a pascal vcl unit in my app and C++ build generated the .hpp
in the wrong order.
I generates a typedef to a structure before the structure is declared.
Does anybody know a way around this problem with out editing the generated
.HPP.

Thanks in advance.
    Terry

 

Re:Header from pascal produced in wrong order


Nope.  In Pascal, the typedef is declared first, then the actual structure.
The IDE is simply making a literal translation of the code.  You have to
correct it manually.

Gambit

Quote
"Terry Watts" <AssetA...@bigpond.con> wrote in message

news:3c5f72c3_2@dnews...
Quote
> I have include a pascal vcl unit in my app and C++ build generated
> the .hpp in the wrong order.
> I generates a typedef to a structure before the structure is declared.
> Does anybody know a way around this problem with out editing the
> generated .HPP.

Re:Header from pascal produced in wrong order


Not True.

    The original Pascal source is in  the order :

 TAFileSet = record
  FileSet : Cardinal;
  Name : String;
 end;

 TAFileSets = array of TAFileSet;

 FieldXrefEntry = record
  Fld : TField;
  IsCalculated : Boolean;
 end;

 FieldXref = array of FieldXrefEntry;

Many more declarations
        .....
        .....
        .....

But the resulting HPP file is in the order :

typedef DynamicArray<FieldXrefEntry >  FieldXref;
typedef DynamicArray<TAFileSet >  TAFileSets;

Many more declarations
        .....
        .....
        .....

struct TAFileSet
{
 unsigned FileSet;
 AnsiString Name;

Quote
} ;

struct FieldXrefEntry
{
 Db::TField* Fld;
 bool IsCalculated;
Quote
} ;

Re:Header from pascal produced in wrong order


PS.
    It seem to only happen with dynamic arrays of records.

Re:Header from pascal produced in wrong order


Quote
Terry Watts wrote:

> I have include a pascal vcl unit in my app and C++ build generated the .hpp
> in the wrong order.
> I generates a typedef to a structure before the structure is declared.
> Does anybody know a way around this problem with out editing the generated
> .HPP.

I am not sure why this is happening. However, you might be able to work around the
problem by putting some HPPEMIT commands into the pascal source.

Search the vcl source for hppemit to see how it is used.

Harold Howe [TeamB]
http://www.bcbdev.com

Re:Header from pascal produced in wrong order


Seem to be a good idea but I cannot see how to use it as it
appears to put all the emitted code at the beginning of the header file.

"Harold Howe (TeamB)" <hh...@bcbdev.com> wrote in message
news:3C622435.E4539E00@bcbdev.com...

Quote
> Terry Watts wrote:

> > I have include a pascal vcl unit in my app and C++ build generated the
.hpp
> > in the wrong order.
> > I generates a typedef to a structure before the structure is declared.
> > Does anybody know a way around this problem with out editing the
generated
> > .HPP.

> I am not sure why this is happening. However, you might be able to work
around the
> problem by putting some HPPEMIT commands into the pascal source.

> Search the vcl source for hppemit to see how it is used.

> Harold Howe [TeamB]
> http://www.bcbdev.com

Other Threads