News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Nested structure

Started by Emil_halim, April 06, 2018, 10:19:49 PM

Previous topic - Next topic

Emil_halim

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?


aw27

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

 
"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