Author Topic: Nested structure  (Read 274 times)

Emil_halim

  • Member
  • **
  • Posts: 111
Nested structure
« on: April 06, 2018, 10:19:49 PM »
Hi All

I started working in new project "SphinxC-- 2 MASM" , that will translate c-- code to masm code.

I have stuck with nested structure , consider next c-- example.

#define DWORD unsigned int     

struct demo
{
   long vv;
   struct _name{
      DWORD   _Short;     // if 0, use LongName
      DWORD   _Long;      // offset into string table
    }Name ;

};

i got this in masm

   demo  STRUC
       vv SDWORD ?
   _name  STRUC
       _Short DWORD ?
       _Long DWORD ?
   _name EndS
       Name _name <>
   demo EndS

but seems that UASM  did not supports nested structure ?

any help please?


AW

  • Member
  • *****
  • Posts: 1347
  • Let's Make ASM Great Again!
Re: Nested structure
« Reply #1 on: April 06, 2018, 10:37:28 PM »
Don't put names on the substructures or define them outside the external structure.
Ah, there is another way, put the name of the substructure after STRUCT:
STRUCT somesubstruct
...
ENDS

Emil_halim

  • Member
  • **
  • Posts: 111
Re: Nested structure
« Reply #2 on: April 07, 2018, 02:29:38 AM »
 
"Don't put names on the substructures"

you mean something like this

    demo  STRUC
       vv SDWORD ?
    STRUC
       _Short DWORD ?
       _Long DWORD ?
    EndS
       Name _name <>         // who to declare the sub structer ?
   demo EndS


"define them outside the external structure."

I did not like that , c-- is like c / c++  can declear a nesting structure.

" put the name of the substructure after STRUCT:"

i will try it soon.

thanks you a lot.

Edited:

even this not work

     demo  STRUC
       vv SDWORD ?
   STRUCT  _name
       _Short DWORD ?
       _Long DWORD ?
   EndS
       Name _name <>
   demo EndS

Emil_halim

  • Member
  • **
  • Posts: 111
Re: Nested structure
« Reply #3 on: April 07, 2018, 06:05:09 PM »

ok i have solved it.