; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "BSD 2-clause" license."          |
;|_______________________________________________________________________________________|
;
;  Description: Macro to make complex data structures.
;
;  Target OS: Any
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________

macro struct name {
  macro name@struct \{
    virtual at 0
      name name
      sizeof.#name = $
    end virtual
  \}
  struc name \{
}


macro rstruct name {
  macro name@struct \{
    \local ..start, ..size
    virtual at -..size
      ..start:
      name name
      ..size = $ - ..start
      sizeof.#name = ..size
    end virtual
  \}
  struc name \{
}


ends fix } struct_helper


macro struct_helper {
  name@struct
  purge name@struc
}

