Annotation of hatari/src/uae-cpu/sysdeps.h, revision 1.1

1.1     ! root        1:  /*
        !             2:   * UAE - The Un*x Amiga Emulator
        !             3:   *
        !             4:   * Try to include the right system headers and get other system-specific
        !             5:   * stuff right & other collected kludges.
        !             6:   *
        !             7:   * If you think about modifying this, think twice. Some systems rely on
        !             8:   * the exact order of the #include statements. That's also the reason
        !             9:   * why everything gets included unconditionally regardless of whether
        !            10:   * it's actually needed by the .c file.
        !            11:   *
        !            12:   * Copyright 1996, 1997 Bernd Schmidt
        !            13:   */
        !            14: 
        !            15: #ifndef UAESYSDEPS
        !            16: #define UAESYSDEPS
        !            17: 
        !            18: 
        !            19: /* FIXME: We should use a test instead: */
        !            20: /* The number of bytes in a short.  */
        !            21: #define SIZEOF_SHORT 2
        !            22: /* The number of bytes in a int.  */
        !            23: #define SIZEOF_INT 4
        !            24: /* The number of bytes in a long.  */
        !            25: #define SIZEOF_LONG 4
        !            26: 
        !            27: #include <stdio.h>
        !            28: #include <stdlib.h>
        !            29: #include <errno.h>
        !            30: #include <assert.h>
        !            31: #include <limits.h>
        !            32: 
        !            33: #ifndef __STDC__
        !            34: #error "Your compiler is not ANSI. Get a real one."
        !            35: #endif
        !            36: 
        !            37: #include <stdarg.h>
        !            38: 
        !            39: #ifdef HAVE_SYS_TYPES_H
        !            40: #include <sys/types.h>
        !            41: #endif
        !            42: 
        !            43: #ifdef HAVE_VALUES_H
        !            44: #include <values.h>
        !            45: #endif
        !            46: 
        !            47: #ifdef HAVE_STRINGS_H
        !            48: #include <strings.h>
        !            49: #endif
        !            50: #ifdef HAVE_STRING_H
        !            51: #include <string.h>
        !            52: #endif
        !            53: 
        !            54: #ifdef HAVE_UNISTD_H
        !            55: #include <unistd.h>
        !            56: #endif
        !            57: #ifdef HAVE_FCNTL_H
        !            58: #include <fcntl.h>
        !            59: #endif
        !            60: 
        !            61: #ifdef HAVE_UTIME_H
        !            62: #include <utime.h>
        !            63: #endif
        !            64: 
        !            65: #ifdef HAVE_SYS_STAT_H
        !            66: #include <sys/stat.h>
        !            67: #endif
        !            68: 
        !            69: #if TIME_WITH_SYS_TIME
        !            70: # include <sys/time.h>
        !            71: # include <time.h>
        !            72: #else
        !            73: # if HAVE_SYS_TIME_H
        !            74: #  include <sys/time.h>
        !            75: # else
        !            76: #  include <time.h>
        !            77: # endif
        !            78: #endif
        !            79: 
        !            80: #if HAVE_DIRENT_H
        !            81: # include <dirent.h>
        !            82: #else
        !            83: # define dirent direct
        !            84: # if HAVE_SYS_NDIR_H
        !            85: #  include <sys/ndir.h>
        !            86: # endif
        !            87: # if HAVE_SYS_DIR_H
        !            88: #  include <sys/dir.h>
        !            89: # endif
        !            90: # if HAVE_NDIR_H
        !            91: #  include <ndir.h>
        !            92: # endif
        !            93: #endif
        !            94: 
        !            95: #ifdef HAVE_SYS_UTIME_H
        !            96: # include <sys/utime.h>
        !            97: #endif
        !            98: 
        !            99: #include <errno.h>
        !           100: #include <assert.h>
        !           101: 
        !           102: #if EEXIST == ENOTEMPTY
        !           103: #define BROKEN_OS_PROBABLY_AIX
        !           104: #endif
        !           105: 
        !           106: #ifdef __NeXT__
        !           107: #define S_IRUSR S_IREAD
        !           108: #define S_IWUSR S_IWRITE
        !           109: #define S_IXUSR S_IEXEC
        !           110: #define S_ISDIR(val) (S_IFDIR & val)
        !           111: struct utimbuf
        !           112: {
        !           113:     time_t actime;
        !           114:     time_t modtime;
        !           115: };
        !           116: #endif
        !           117: 
        !           118: #if defined(__GNUC__) && defined(AMIGA)
        !           119: /* gcc on the amiga need that __attribute((regparm)) must */
        !           120: /* be defined in function prototypes as well as in        */
        !           121: /* function definitions !                                 */
        !           122: #define REGPARAM2 REGPARAM
        !           123: #else /* not(GCC & AMIGA) */
        !           124: #define REGPARAM2
        !           125: #endif
        !           126: 
        !           127: /* sam: some definitions so that SAS/C can compile UAE */
        !           128: #if defined(__SASC) && defined(AMIGA)
        !           129: #define REGPARAM2 
        !           130: #define REGPARAM
        !           131: #define S_IRUSR S_IREAD
        !           132: #define S_IWUSR S_IWRITE
        !           133: #define S_IXUSR S_IEXECUTE
        !           134: #define S_ISDIR(val) (S_IFDIR & val)
        !           135: #define mkdir(x,y) mkdir(x)
        !           136: #define truncate(x,y) 0
        !           137: #define creat(x,y) open("T:creat",O_CREAT|O_TEMP|O_RDWR) /* sam: for zfile.c */
        !           138: #define strcasecmp stricmp
        !           139: #define utime(file,time) 0
        !           140: struct utimbuf
        !           141: {
        !           142:     time_t actime;
        !           143:     time_t modtime;
        !           144: };
        !           145: #endif
        !           146: 
        !           147: #if defined(WARPUP)
        !           148: #include "devices/timer.h"
        !           149: #include "osdep/posixemu.h"
        !           150: #define REGPARAM
        !           151: #define REGPARAM2
        !           152: #define RETSIGTYPE
        !           153: #define USE_ZFILE
        !           154: #define strcasecmp stricmp
        !           155: #define memcpy q_memcpy
        !           156: #define memset q_memset
        !           157: #define strdup my_strdup
        !           158: #define random rand
        !           159: #define creat(x,y) open("T:creat",O_CREAT|O_RDWR|O_TRUNC,777)
        !           160: extern void* q_memset(void*,int,size_t);
        !           161: extern void* q_memcpy(void*,const void*,size_t);
        !           162: #endif
        !           163: 
        !           164: #ifdef __DOS__
        !           165: #include <pc.h>
        !           166: #include <io.h>
        !           167: #endif
        !           168: 
        !           169: /* Acorn specific stuff */
        !           170: #ifdef ACORN
        !           171: 
        !           172: #define S_IRUSR S_IREAD
        !           173: #define S_IWUSR S_IWRITE
        !           174: #define S_IXUSR S_IEXEC
        !           175: 
        !           176: #define strcasecmp stricmp
        !           177: 
        !           178: #endif
        !           179: 
        !           180: #ifndef L_tmpnam
        !           181: #define L_tmpnam 128 /* ought to be safe */
        !           182: #endif
        !           183: 
        !           184: /* If char has more then 8 bits, good night. */
        !           185: typedef unsigned char uae_u8;
        !           186: typedef signed char uae_s8;
        !           187: 
        !           188: typedef struct { uae_u8 RGB[3]; } RGB;
        !           189: 
        !           190: #if SIZEOF_SHORT == 2
        !           191: typedef unsigned short uae_u16;
        !           192: typedef short uae_s16;
        !           193: #elif SIZEOF_INT == 2
        !           194: typedef unsigned int uae_u16;
        !           195: typedef int uae_s16;
        !           196: #else
        !           197: #error No 2 byte type, you lose.
        !           198: #endif
        !           199: 
        !           200: #if SIZEOF_INT == 4
        !           201: typedef unsigned int uae_u32;
        !           202: typedef int uae_s32;
        !           203: #elif SIZEOF_LONG == 4
        !           204: typedef unsigned long uae_u32;
        !           205: typedef long uae_s32;
        !           206: #else
        !           207: #error No 4 byte type, you lose.
        !           208: #endif
        !           209: 
        !           210: typedef uae_u32 uaecptr;
        !           211: 
        !           212: #undef uae_s64
        !           213: #undef uae_u64
        !           214: 
        !           215: #if SIZEOF_LONG_LONG == 8
        !           216: #define uae_s64 long long
        !           217: #define uae_u64 long long
        !           218: #define VAL64(a) (a ## LL)
        !           219: #define UVAL64(a) (a ## uLL)
        !           220: #elif SIZEOF___INT64 == 8
        !           221: #define uae_s64 __int64
        !           222: #define uae_u64 unsigned __int64
        !           223: #define VAL64(a) (a)
        !           224: #define UVAL64(a) (a)
        !           225: #elif SIZEOF_LONG == 8
        !           226: #define uae_s64 long;
        !           227: #define uae_u64 unsigned long;
        !           228: #define VAL64(a) (a ## l)
        !           229: #define UVAL64(a) (a ## ul)
        !           230: #endif
        !           231: 
        !           232: #ifdef HAVE_STRDUP
        !           233: #define my_strdup strdup
        !           234: #else
        !           235: extern char *my_strdup (const char*s);
        !           236: #endif
        !           237: 
        !           238: extern void *xmalloc(size_t);
        !           239: 
        !           240: /* We can only rely on GNU C getting enums right. Mickeysoft VSC++ is known
        !           241:  * to have problems, and it's likely that other compilers choke too. */
        !           242: #ifdef __GNUC__
        !           243: #define ENUMDECL typedef enum
        !           244: #define ENUMNAME(name) name
        !           245: #else
        !           246: #define ENUMDECL enum
        !           247: #define ENUMNAME(name) ; typedef int name
        !           248: #endif
        !           249: 
        !           250: /*
        !           251:  * Porters to weird systems, look! This is the preferred way to get
        !           252:  * filesys.c (and other stuff) running on your system. Define the
        !           253:  * appropriate macros and implement wrappers in a machine-specific file.
        !           254:  *
        !           255:  * I guess the Mac port could use this (Ernesto?)
        !           256:  */
        !           257: 
        !           258: #undef DONT_HAVE_POSIX
        !           259: #undef DONT_HAVE_REAL_POSIX /* define if open+delete doesn't do what it should */
        !           260: #undef DONT_HAVE_STDIO
        !           261: #undef DONT_HAVE_MALLOC
        !           262: 
        !           263: #if defined(WARPUP)
        !           264: #define DONT_HAVE_POSIX
        !           265: #endif
        !           266: 
        !           267: #if defined _WIN32
        !           268: 
        !           269: #if defined __WATCOMC__
        !           270: 
        !           271: #define O_NDELAY 0
        !           272: #include <direct.h>
        !           273: #define dirent direct
        !           274: #define mkdir(a,b) mkdir(a)
        !           275: #define strcasecmp stricmp
        !           276: 
        !           277: #elif defined __MINGW32__
        !           278: 
        !           279: #define O_NDELAY 0
        !           280: #define mkdir(a,b) mkdir(a)
        !           281: 
        !           282: #endif
        !           283: 
        !           284: #endif /* _WIN32 */ 
        !           285: 
        !           286: #ifdef DONT_HAVE_POSIX
        !           287: 
        !           288: #define access posixemu_access
        !           289: extern int posixemu_access (const char *, int);
        !           290: #define open posixemu_open
        !           291: extern int posixemu_open (const char *, int, int);
        !           292: #define close posixemu_close
        !           293: extern void posixemu_close (int);
        !           294: #define read posixemu_read
        !           295: extern int posixemu_read (int, char *, int);
        !           296: #define write posixemu_write
        !           297: extern int posixemu_write (int, const char *, int);
        !           298: #undef lseek
        !           299: #define lseek posixemu_seek
        !           300: extern int posixemu_seek (int, int, int);
        !           301: #define stat(a,b) posixemu_stat ((a), (b))
        !           302: extern int posixemu_stat (const char *, STAT *);
        !           303: #define mkdir posixemu_mkdir
        !           304: extern int mkdir (const char *, int);
        !           305: #define rmdir posixemu_rmdir
        !           306: extern int posixemu_rmdir (const char *);
        !           307: #define unlink posixemu_unlink
        !           308: extern int posixemu_unlink (const char *);
        !           309: #define truncate posixemu_truncate
        !           310: extern int posixemu_truncate (const char *, long int);
        !           311: #define rename posixemu_rename
        !           312: extern int posixemu_rename (const char *, const char *);
        !           313: #define chmod posixemu_chmod
        !           314: extern int posixemu_chmod (const char *, int);
        !           315: #define tmpnam posixemu_tmpnam
        !           316: extern void posixemu_tmpnam (char *);
        !           317: #define utime posixemu_utime
        !           318: extern int posixemu_utime (const char *, struct utimbuf *);
        !           319: #define opendir posixemu_opendir
        !           320: extern DIR * posixemu_opendir (const char *);
        !           321: #define readdir posixemu_readdir
        !           322: extern struct dirent* readdir (DIR *);
        !           323: #define closedir posixemu_closedir
        !           324: extern void closedir (DIR *);
        !           325: 
        !           326: /* This isn't the best place for this, but it fits reasonably well. The logic
        !           327:  * is that you probably don't have POSIX errnos if you don't have the above
        !           328:  * functions. */
        !           329: extern long dos_errno (void);
        !           330: 
        !           331: #endif
        !           332: 
        !           333: #ifdef DONT_HAVE_STDIO
        !           334: 
        !           335: extern FILE *stdioemu_fopen (const char *, const char *);
        !           336: #define fopen(a,b) stdioemu_fopen(a, b)
        !           337: extern int stdioemu_fseek (FILE *, int, int);
        !           338: #define fseek(a,b,c) stdioemu_fseek(a, b, c)
        !           339: extern int stdioemu_fread (char *, int, int, FILE *);
        !           340: #define fread(a,b,c,d) stdioemu_fread(a, b, c, d)
        !           341: extern int stdioemu_fwrite (const char *, int, int, FILE *);
        !           342: #define fwrite(a,b,c,d) stdioemu_fwrite(a, b, c, d)
        !           343: extern int stdioemu_ftell (FILE *);
        !           344: #define ftell(a) stdioemu_ftell(a)
        !           345: extern int stdioemu_fclose (FILE *);
        !           346: #define fclose(a) stdioemu_fclose(a)
        !           347: 
        !           348: #endif
        !           349: 
        !           350: #ifdef DONT_HAVE_MALLOC
        !           351: 
        !           352: #define malloc(a) mallocemu_malloc(a)
        !           353: extern void *mallocemu_malloc (int size);
        !           354: #define free(a) mallocemu_free(a)
        !           355: extern void mallocemu_free (void *ptr);
        !           356: 
        !           357: #endif
        !           358: 
        !           359: #ifdef X86_ASSEMBLY
        !           360: #define ASM_SYM_FOR_FUNC(a) __asm__(a)
        !           361: #else
        !           362: #define ASM_SYM_FOR_FUNC(a)
        !           363: #endif
        !           364: 
        !           365: #if defined USE_COMPILER
        !           366: #undef NO_PREFETCH_BUFFER
        !           367: #undef NO_EXCEPTION_3
        !           368: #define NO_EXCEPTION_3
        !           369: #define NO_PREFETCH_BUFFER
        !           370: #endif
        !           371: 
        !           372: /*#include "target.h"*/
        !           373: 
        !           374: #ifndef O_BINARY
        !           375: #define O_BINARY 0
        !           376: #endif
        !           377: 
        !           378: #ifndef STATIC_INLINE
        !           379: #define STATIC_INLINE static __inline__
        !           380: #endif
        !           381: 
        !           382: /*
        !           383:  * You can specify numbers from 0 to 5 here. It is possible that higher
        !           384:  * numbers will make the CPU emulation slightly faster, but if the setting
        !           385:  * is too high, you will run out of memory while compiling.
        !           386:  * Best to leave this as it is.
        !           387:  */
        !           388: #define CPU_EMU_SIZE 0
        !           389: 
        !           390: #ifndef REGPARAM
        !           391: # define REGPARAM
        !           392: #endif
        !           393: #ifndef REGPARAM2
        !           394: # define REGPARAM2
        !           395: #endif
        !           396: 
        !           397: #endif /* ifndef UAESYSDEPS */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.