--- SheepShaver/src/include/ether_defs.h 2004/05/10 15:42:35 1.4 +++ SheepShaver/src/include/ether_defs.h 2005/12/04 15:58:52 1.8 @@ -1,7 +1,7 @@ /* * ether_defs.h - Definitions for DLPI Ethernet Driver * - * SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer + * SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,11 +22,16 @@ #define ETHER_DEFS_H -#if __BEOS__ && __POWERPC__ +#if __MWERKS__ && __POWERPC__ #define PRAGMA_ALIGN_SUPPORTED 1 #define PACKED__ -#else +#elif defined __GNUC__ #define PACKED__ __attribute__ ((packed)) +#elif defined __sgi +#define PRAGMA_PACK_SUPPORTED 1 +#define PACKED__ +#else +#error "Packed attribute or pragma shall be supported" #endif @@ -209,7 +214,7 @@ typedef int32 nw_int32; typedef uint8 nw_uint8; typedef uint16 nw_uint16; typedef uint32 nw_uint32; -typedef bool nw_bool; +typedef int nw_bool; typedef uint8 * nw_uint8_p; typedef void * nw_void_p; typedef datab * nw_datab_p; @@ -248,13 +253,13 @@ class nw_scalar_member_helper { uint8 _pad[sizeof(type)]; public: operator public_type () const { - return (public_type)nw_memory_helper::load((void *)this); + return (public_type)(uintptr)nw_memory_helper::load((void *)this); } public_type operator -> () const { return this->operator public_type (); } nw_scalar_member_helper & operator = (public_type val) { - nw_memory_helper::store((void *)this, (type)val); + nw_memory_helper::store((void *)this, (type)(uintptr)val); return *this; } nw_scalar_member_helper & operator += (int val) { @@ -512,6 +517,10 @@ union DL_primitives { #pragma options align=mac68k #endif +#ifdef PRAGMA_PACK_SUPPORTED +#pragma pack(1) +#endif + // Packet headers struct EnetPacketHeader { uint8 fDestAddr[6]; @@ -543,6 +552,10 @@ struct T8022AddressStruct { uint8 fSNAP[k8022SNAPLength]; } PACKED__; +#ifdef PRAGMA_PACK_SUPPORTED +#pragma pack(0) +#endif + #ifdef PRAGMA_ALIGN_SUPPORTED #pragma options align=reset #endif