/* ---------------------------------------------------------------------- */
/*                   Copyright (C) 1991 by Natrlich!                     */
/*                      This file is copyrighted!                         */
/*                Refer to the documentation for details.                 */
/* ---------------------------------------------------------------------- */
/********** ANY CHANGE HERE NECESSITATES CHANGES IN flip_structs **********/
#ifndef _OBJECT_
# define _OBJECT_

# ifndef _STRUCTS_
#  include "structs.h"
# endif

# define OBJMAGIC     0xCEC1D3CDL  /* spells NASM (what else... )   */
# define SIGNIFICANT  32           /* symbol length for linking     */
# define FSIGNIFICANT 32           /* filename length for libraries */

/* ---------------------------------------------------------- */
/*     Stuff that gets put in front of every object file      */
/* if you are porting this... Don't mess with the XXXSIZE     */
/* #defines they are handcoded for checking compatibility!!   */
/* ---------------------------------------------------------- */          
typedef struct
{
   lword    magic;         /*  0 +4 */
   word     version,       /*  4 +2 */
            revision,      /*  6 +2 */
            alignment,     /*  8 +2 */
            codesize;      /* 10 +2 */
   lword    segsize,       /* 12 +4 */
            immsize,       /* 16 +4 */
            relsize,       /* 20 +4 */
            expsize,       /* 24 +4 */
            symsize,       /* 28 +4 */
            fixsize,       /* 32 +4 */
            aux1;          /* 36 +4 */
} obj_h;
#define OBJHSIZE  (size_t) 40

/* ----------------------------------------------------------
   output form of Symbol table. Changed this since app. some
   (stupid IMO) compilers like to 32-bit align pointers
   ---------------------------------------------------------- */
typedef struct
{
   word     val, 
            no, 
            type,
            dummy;               /* Hi there */
   ref huge *refs;               /* got to be long for some LINK trickery */
   char     name[ SIGNIFICANT];
} linksymbol;
#define LSYMSIZE  (size_t) (12 + SIGNIFICANT)

typedef struct
{
   word     val,           /*  0 +2 */
            aux,           /*  2 +2 */
            label;         /*  4 +2 */
   byte     op,            /*  6 +1 */
            fix;           /*  7 +1 */
   word     t,             /*  8 +2 */
            l,             /* 10 +2 */
            r;             /* 12 +2 */
} e_dropped;
#define EDROPSIZE (size_t) 14

typedef struct
{
   word     block,
            type,
            offset,
            val;
} i_dropped;
#define IDROPSIZE (size_t) 8

typedef struct
{
   word     type,
            index,
            size;
} s_dropped;
#define SDROPSIZE (size_t) 6

typedef struct
{
   word     poof,
            imm,
            index;
} f_dropped;
#define FDROPSIZE (size_t) 6

typedef word   r_dropped;
#define RDROPSIZE (size_t) 2

#endif
