Annotation of uae/src/include/sysdeps.h, revision 1.1.1.2

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.
                      6:   *
                      7:   * Copyright 1996 Bernd Schmidt
                      8:   */
                      9: 
                     10: #include <stdio.h>
                     11: #include <stdlib.h>
                     12: #include <errno.h>
                     13: #include <assert.h>
                     14: 
                     15: #ifdef HAVE_SYS_TYPES_H
                     16: #include <sys/types.h>
                     17: #endif
                     18: 
                     19: #ifdef HAVE_VALUES_H
                     20: #include <values.h>
                     21: #endif
                     22: 
                     23: #ifdef HAVE_STRINGS_H
                     24: #include <strings.h>
                     25: #endif
                     26: #ifdef HAVE_STRING_H
                     27: #include <string.h>
                     28: #endif
                     29: 
                     30: #ifdef HAVE_UNISTD_H
                     31: #include <unistd.h>
                     32: #endif
                     33: #ifdef HAVE_FCNTL_H
                     34: #include <fcntl.h>
                     35: #endif
                     36: 
                     37: #ifdef HAVE_UTIME_H
                     38: #include <utime.h>
                     39: #endif
                     40: 
                     41: #ifdef HAVE_SYS_PARAM_H
                     42: #include <sys/param.h>
                     43: #endif
                     44: 
                     45: #ifdef HAVE_SYS_SELECT_H
                     46: #include <sys/select.h>
                     47: #endif
                     48: 
                     49: #ifdef HAVE_SYS_VFS_H
                     50: #include <sys/vfs.h>
                     51: #endif
                     52: 
                     53: #ifdef HAVE_SYS_STAT_H
                     54: #include <sys/stat.h>
                     55: #endif
                     56: 
                     57: #ifdef HAVE_SYS_MOUNT_H
                     58: #include <sys/mount.h>
                     59: #endif
                     60: 
                     61: #ifdef HAVE_SYS_STATFS_H
                     62: #include <sys/statfs.h>
                     63: #endif
                     64: 
                     65: #ifdef HAVE_SYS_STATVFS_H
                     66: #include <sys/statvfs.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: #include <errno.h>
                     96: #include <assert.h>
                     97: 
                     98: #if EEXIST == ENOTEMPTY
                     99: #define BROKEN_OS_PROBABLY_AIX
                    100: #endif
                    101: 
                    102: #ifdef HAVE_LINUX_JOYSTICK_H
                    103: #if BROKEN_JOYSTICK_H == 1
                    104: #include "joystick.h"
                    105: #else
                    106: #include <linux/joystick.h>
                    107: #endif
                    108: #endif
                    109: 
                    110: #ifdef __NeXT__
                    111: #define S_IRUSR S_IREAD
                    112: #define S_IWUSR S_IWRITE
                    113: #define S_IXUSR S_IEXEC
                    114: #define S_ISDIR(val) (S_IFDIR & val)
                    115: struct utimbuf
                    116: {
                    117:     time_t actime;
                    118:     time_t modtime;
                    119: };
                    120: #endif
                    121: 
1.1.1.2 ! root      122: /* sam: SAS/C code removed */
1.1       root      123: 
1.1.1.2 ! root      124: #if defined(__GNUC__) && defined(AMIGA)
        !           125: /* 
        !           126:  * sam: GCC has a bad feature ("bug" would a better word) for uae in 
        !           127:  * libamiga.a: bltsize, bltcon0, ... are defined as absolute address
        !           128:  * in memory, causing real customchip registers being modified when
        !           129:  * UAE is running. (I hate this feature... It makes  me lost lots of 
        !           130:  * time looking for a bug on my side =:-( ).
        !           131:  *
        !           132:  * This cures the problem (I hope, since I don't exactly know which 
        !           133:  * variables need to be redefined for UAE):
        !           134:  */
        !           135: /* 0.6.1 */
        !           136: #define bltsize my_bltsize
        !           137: #define bltcon0 my_bltcon0
        !           138: #define bltcon1 my_bltcon1
        !           139: #define bltapt  my_bltapt
        !           140: #define bltbpt  my_bltbpt
        !           141: #define bltcpt  my_bltcpt
        !           142: #define bltdpt  my_bltdpt
        !           143: #define adkcon  my_adkcon
        !           144: /* 0.6.3 */
        !           145: #define serdat  my_serdat
        !           146: #define dmacon  my_dmacon
        !           147: #define intena  my_intena
        !           148: #define intreq  my_intreq
        !           149: 
        !           150: #define AMIGALIB_NEED_TO_BE_REALLY_SURE
        !           151: /*
        !           152:  * Those are here is case of doubt (they are all absolute address
        !           153:  * in libamiga.a, defining CUSTOM_NEED_TO_BE_REALLY_SURE will prevent
        !           154:  * uae from using any absolute variable.
        !           155:  */
        !           156: #ifdef AMIGALIB_NEED_TO_BE_REALLY_SURE 
        !           157: #define bootrom my_bootrom
        !           158: #define cartridge my_cartridge
        !           159: #define romend my_romend
        !           160: #define romstart my_romstart
        !           161: #define adkcon my_adkcon
        !           162: #define adkconr my_adkconr
        !           163: #define aud my_aud
        !           164: #define bltadat my_bltadat
        !           165: #define bltafwm my_bltafwm
        !           166: #define bltalwm my_bltalwm
        !           167: #define bltamod my_bltamod
        !           168: #define bltapt my_bltapt
        !           169: #define bltbdat my_bltbdat
        !           170: #define bltbmod my_bltbmod
        !           171: #define bltbpt my_bltbpt
        !           172: #define bltcdat my_bltcdat
        !           173: #define bltcmod my_bltcmod
        !           174: #define bltcon0 my_bltcon0
        !           175: #define bltcon1 my_bltcon1
        !           176: #define bltcpt my_bltcpt
        !           177: #define bltddat my_bltddat
        !           178: #define bltdmod my_bltdmod
        !           179: #define bltdpt my_bltdpt
        !           180: #define bltsize my_bltsize
        !           181: #define bpl1mod my_bpl1mod
        !           182: #define bpl2mod my_bpl2mod
        !           183: #define bplcon0 my_bplcon0
        !           184: #define bplcon1 my_bplcon1
        !           185: #define bplcon2 my_bplcon2
        !           186: #define bpldat my_bpldat
        !           187: #define bplpt my_bplpt
        !           188: #define clxcon my_clxcon
        !           189: #define clxdat my_clxdat
        !           190: /* Oh look ! libamiga.a does not allow you to define a shared
        !           191:    variable caled color.... This is quite annoying :-/ */
        !           192: #define color my_color
        !           193: #define cop1lc my_cop1lc
        !           194: #define cop2lc my_cop2lc
        !           195: #define copcon my_copcon
        !           196: #define copins my_copins
        !           197: #define copjmp1 my_copjmp1
        !           198: #define copjmp2 my_copjmp2
        !           199: #define custom my_custom
        !           200: #define ddfstop my_ddfstop
        !           201: #define ddfstrt my_ddfstrt
        !           202: #define diwstop my_diwstop
        !           203: #define diwstrt my_diwstrt
        !           204: #define dmacon my_dmacon
        !           205: #define dmaconr my_dmaconr
        !           206: #define dskbytr my_dskbytr
        !           207: #define dskdat my_dskdat
        !           208: #define dskdatr my_dskdatr
        !           209: #define dsklen my_dsklen
        !           210: #define dskpt my_dskpt
        !           211: #define intena my_intena
        !           212: #define intenar my_intenar
        !           213: #define intreq my_intreq
        !           214: #define intreqr my_intreqr
        !           215: #define joy0dat my_joy0dat
        !           216: #define joy1dat my_joy1dat
        !           217: #define joytest my_joytest
        !           218: #define pot0dat my_pot0dat
        !           219: #define pot1dat my_pot1dat
        !           220: #define potgo my_potgo
        !           221: #define potinp my_potinp
        !           222: #define refptr my_refptr
        !           223: #define serdat my_serdat
        !           224: #define serdatr my_serdatr
        !           225: #define serper my_serper
        !           226: #define spr my_spr
        !           227: #define sprpt my_sprpt
        !           228: #define vhposr my_vhposr
        !           229: #define vhposw my_vhposw
        !           230: #define vposr my_vposr
        !           231: #define vposw my_vposw
        !           232: #define ciaa my_ciaa
        !           233: #define ciaacra my_ciaacra
        !           234: #define ciaacrb my_ciaacrb
        !           235: #define ciaaddra my_ciaaddra
        !           236: #define ciaaddrb my_ciaaddrb
        !           237: #define ciaaicr my_ciaaicr
        !           238: #define ciaapra my_ciaapra
        !           239: #define ciaaprb my_ciaaprb
        !           240: #define ciaasdr my_ciaasdr
        !           241: #define ciaatahi my_ciaatahi
        !           242: #define ciaatalo my_ciaatalo
        !           243: #define ciaatbhi my_ciaatbhi
        !           244: #define ciaatblo my_ciaatblo
        !           245: #define ciaatodhi my_ciaatodhi
        !           246: #define ciaatodlow my_ciaatodlow
        !           247: #define ciaatodmid my_ciaatodmid
        !           248: #define ciab my_ciab
        !           249: #define ciabcra my_ciabcra
        !           250: #define ciabcrb my_ciabcrb
        !           251: #define ciabddra my_ciabddra
        !           252: #define ciabddrb my_ciabddrb
        !           253: #define ciabicr my_ciabicr
        !           254: #define ciabpra my_ciabpra
        !           255: #define ciabprb my_ciabprb
        !           256: #define ciabsdr my_ciabsdr
        !           257: #define ciabtahi my_ciabtahi
        !           258: #define ciabtalo my_ciabtalo
        !           259: #define ciabtbhi my_ciabtbhi
        !           260: #define ciabtblo my_ciabtblo
        !           261: #define ciabtodhi my_ciabtodhi
        !           262: #define ciabtodlow my_ciabtodlow
        !           263: #define ciabtodmid my_ciabtodmid
        !           264: #endif /* AMIGALIB_NEED_TO_BE_REALLY_SURE */
        !           265: 
        !           266: /* gcc on the amiga need that __attribute((regparm)) must */
        !           267: /* be defined in function prototypes as well as in        */
        !           268: /* function definitions !                                 */
        !           269: #define REGPARAM2 REGPARAM
        !           270: #else /* not(GCC & AMIGA) */
        !           271: #define REGPARAM2
1.1       root      272: #endif
                    273: 
                    274: #ifdef __DOS__
                    275: #include <pc.h>
                    276: #include <io.h>
                    277: #else
                    278: #undef O_BINARY
                    279: #define O_BINARY 0
                    280: #endif
                    281: 
1.1.1.2 ! root      282: #ifndef EXEC_TYPES_H /* sam: to prevent re-definition in amiga.c! */
1.1       root      283: /* If char has more then 8 bits, good night. */
                    284: typedef unsigned char UBYTE;
                    285: typedef signed char BYTE;
                    286: typedef struct {UBYTE RGB[3];} RGB;
                    287: 
                    288: #if SIZEOF_SHORT == 2
                    289: typedef unsigned short UWORD;
                    290: typedef short WORD;
                    291: #elif SIZEOF_INT == 2
                    292: typedef unsigned int UWORD;
                    293: typedef int WORD;
                    294: #else
                    295: #error No 2 byte type, you lose.
                    296: #endif
                    297: 
                    298: #if SIZEOF_INT == 4
                    299: typedef unsigned int ULONG;
                    300: typedef int LONG;
                    301: #elif SIZEOF_LONG == 4
                    302: typedef unsigned long ULONG;
                    303: typedef long LONG;
                    304: #else
                    305: #error No 4 byte type, you lose.
                    306: #endif
                    307: typedef ULONG CPTR;
                    308: 
                    309: #undef INT_64BIT
                    310: 
                    311: #if SIZEOF_LONG_LONG == 8
                    312: #define INT_64BIT long long
                    313: #elif SIZEOF_LONG == 8
                    314: #define INT_64BIT long
                    315: #endif
1.1.1.2 ! root      316: #endif

unix.superglobalmegacorp.com

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