Annotation of MiNT/src/mint.h, revision 1.1.1.6

1.1       root        1: /*
                      2: 
1.1.1.3   root        3: Copyright 1990,1991,1992 Eric R. Smith.
                      4: 
1.1.1.5   root        5: Copyright 1992,1993,1994 Atari Corporation.
1.1.1.3   root        6: 
                      7: All rights reserved.
1.1       root        8: 
                      9: */
                     10: 
                     11: 
                     12: 
1.1.1.3   root       13: #ifndef GENMAGIC
                     14: 
                     15: /* use our own library: strongly recommended */
1.1       root       16: 
1.1.1.3   root       17: #define OWN_LIB
1.1       root       18: 
                     19: #endif
                     20: 
                     21: 
                     22: 
1.1.1.2   root       23: #ifdef OWN_LIB
1.1       root       24: 
1.1.1.2   root       25: #include "ctype.h"
1.1       root       26: 
1.1.1.2   root       27: #else
1.1       root       28: 
1.1.1.2   root       29: #include <ctype.h>
1.1       root       30: 
1.1.1.2   root       31: #include <string.h>
1.1       root       32: 
                     33: #endif
                     34: 
1.1.1.2   root       35: #include <osbind.h>
1.1       root       36: 
                     37: 
                     38: 
                     39: /* configuration options */
                     40: 
                     41: 
                     42: 
                     43: /* make real processor exceptions (bus error, etc.) raise a signal */
                     44: 
                     45: #define EXCEPTION_SIGS
                     46: 
                     47: 
                     48: 
                     49: /* deliberately fill memory with junk when allocating: used for testing */
                     50: 
                     51: #undef JUNK_MEM
                     52: 
                     53: 
                     54: 
1.1.1.3   root       55: #if 0
                     56: 
                     57: /* other options best set in the makefile */
                     58: 
                     59: #define MULTITOS       /* make a MultiTOS kernel */
                     60: 
                     61: #define ONLY030                /* make a 68030 only version */
                     62: 
1.1.1.6 ! root       63: #define DEBUG_INFO     /* include debugging info */
1.1.1.3   root       64: 
1.1.1.6 ! root       65: #define FASTTEXT       /* include the fast text device (do NOT do this on Falcons!) */
1.1.1.3   root       66: 
                     67: #endif
                     68: 
                     69: 
                     70: 
1.1       root       71: /* PATH_MAX is the maximum path allowed. The kernel uses this in lots of
                     72: 
                     73:  * places, so there isn't much point in file systems allowing longer
                     74: 
                     75:  * paths (they can restrict paths to being shorter if they want).
                     76: 
1.1.1.3   root       77:  * (This is slowly changing, actually... fewer and fewer places use
                     78: 
                     79:  *  PATH_MAX, and eventually we should get rid of it)
                     80: 
1.1       root       81:  */
                     82: 
                     83: #define PATH_MAX 128
                     84: 
                     85: 
                     86: 
                     87: /* maximum length of a string passed to ksprintf: this should be
                     88: 
                     89:  * no more than PATH_MAX
                     90: 
                     91:  */
                     92: 
                     93: #define SPRINTF_MAX    PATH_MAX
                     94: 
                     95: 
                     96: 
                     97: /* NOTE: NAME_MAX is a "suggested" maximum name length only. Individual
                     98: 
                     99:  * file systems may choose a longer or shorter NAME_MAX, so do _not_
                    100: 
                    101:  * use this in the kernel for anything!
                    102: 
                    103:  */
                    104: 
                    105: #define NAME_MAX 14
                    106: 
                    107: 
                    108: 
                    109: /*
                    110: 
                    111:  * configuration section: put compiler specific stuff here
                    112: 
                    113:  */
                    114: 
                    115: 
                    116: 
                    117: #ifdef __GNUC__
                    118: 
1.1.1.6 ! root      119: # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
        !           120: 
        !           121: #  define NORETURN __attribute__ ((noreturn))
        !           122: 
        !           123: # else
        !           124: 
        !           125: #  define EXITING volatile     /* function never returns */
        !           126: 
        !           127: #endif
        !           128: 
        !           129: #endif
        !           130: 
1.1       root      131: 
1.1.1.6 ! root      132: 
        !           133: #ifndef EXITING
1.1       root      134: 
                    135: #define EXITING
                    136: 
                    137: #endif
                    138: 
                    139: 
                    140: 
1.1.1.6 ! root      141: #ifndef NORETURN
        !           142: 
        !           143: #define NORETURN
        !           144: 
        !           145: #endif
        !           146: 
        !           147: 
        !           148: 
1.1       root      149: #ifdef dLibs
                    150: 
                    151: #define fullpath full_path
                    152: 
                    153: #define SHORT_NAMES
                    154: 
                    155: #endif
                    156: 
                    157: 
                    158: 
1.1.1.2   root      159: /* define to indicate unused variables */
                    160: 
                    161: #ifdef __TURBOC__
                    162: 
                    163: #define UNUSED(x)      (void)x
                    164: 
                    165: #else
                    166: 
                    167: #define UNUSED(x)
                    168: 
                    169: #endif
                    170: 
                    171: 
                    172: 
                    173: /* define how to call functions with stack parameter passing */
                    174: 
                    175: #ifdef __TURBOC__
                    176: 
                    177: #define ARGS_ON_STACK cdecl
                    178: 
                    179: #else
                    180: 
                    181: #define ARGS_ON_STACK
                    182: 
                    183: #endif
                    184: 
                    185: 
                    186: 
1.1.1.6 ! root      187: /* define to mark a function as inline */
        !           188: 
        !           189: #ifdef __GNUC__
        !           190: 
        !           191: #define INLINE inline
        !           192: 
        !           193: #else
        !           194: 
        !           195: #define INLINE
        !           196: 
        !           197: #endif
        !           198: 
        !           199: 
        !           200: 
1.1.1.2   root      201: /* WARNING: Bconmap is defined incorrectly
                    202: 
                    203:  * in the MiNT library osbind.h at patchlevel
                    204: 
                    205:  * <= 19 and in early versions of the GNU C
                    206: 
                    207:  * library. So use this binding for safety's sake.
                    208: 
                    209:  */
                    210: 
                    211: 
                    212: 
                    213: #ifdef __GNUC__
                    214: 
                    215: #undef Bconmap
                    216: 
                    217: #define Bconmap(dev) (long)trap_14_ww(0x2c, dev)
                    218: 
1.1.1.6 ! root      219: #ifndef Fcntl
        !           220: 
        !           221: #ifndef trap_1_wwlw
        !           222: 
        !           223: 
        !           224: 
        !           225: /* see osbind.h for __extension__ and AND_MEMORY */
        !           226: 
        !           227: 
        !           228: 
        !           229: #define trap_1_wwlw(n, a, b, c)                                                \
        !           230: 
        !           231: __extension__                                                          \
        !           232: 
        !           233: ({                                                                     \
        !           234: 
        !           235:        register long retvalue __asm__("d0");                           \
        !           236: 
        !           237:        short _a = (short)(a);                                          \
        !           238: 
        !           239:        long  _b = (long) (b);                                          \
        !           240: 
        !           241:        short  _c = (short) (c);                                        \
        !           242: 
        !           243:                                                                        \
        !           244: 
        !           245:        __asm__ volatile                                                \
        !           246: 
        !           247:        ("\
        !           248: 
        !           249:                movw    %4,sp@-; \
        !           250: 
        !           251:                movl    %3,sp@-; \
        !           252: 
        !           253:                movw    %2,sp@-; \
        !           254: 
        !           255:                movw    %1,sp@-; \
        !           256: 
        !           257:                trap    #1;     \
        !           258: 
        !           259:                lea     sp@(10),sp " \
        !           260: 
        !           261:        : "=r"(retvalue)                        /* outputs */           \
        !           262: 
        !           263:        : "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */           \
        !           264: 
        !           265:        : "d0", "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */    \
        !           266: 
        !           267:          AND_MEMORY                                                    \
        !           268: 
        !           269:        );                                                              \
        !           270: 
        !           271:        retvalue;                                                       \
        !           272: 
        !           273: })
        !           274: 
        !           275: #endif
        !           276: 
        !           277: 
        !           278: 
        !           279: #define Fcntl(f, arg, cmd)                                     \
        !           280: 
        !           281:                trap_1_wwlw(0x104, (short)(f), (long)(arg), (short)(cmd))
        !           282: 
        !           283: #endif
        !           284: 
1.1.1.2   root      285: #endif
                    286: 
                    287: 
                    288: 
                    289: #ifndef __TURBOC__
                    290: 
                    291: #ifndef Bconmap
                    292: 
                    293: extern long xbios();
                    294: 
                    295: #define Bconmap(dev) xbios(0x2c, dev)
                    296: 
                    297: #endif
                    298: 
                    299: #endif
                    300: 
                    301: 
                    302: 
                    303: /* Binding for Flock */
                    304: 
                    305: #ifndef __TURBOC__
                    306: 
                    307: #ifndef Flock
                    308: 
                    309: extern long gemdos();
                    310: 
                    311: /* this may need to be adjusted for your compiler/library */
                    312: 
                    313: #define Flock(handle, mode, start, len) gemdos(0x5c, handle, mode, start, len)
                    314: 
                    315: #endif
                    316: 
1.1.1.6 ! root      317: /* ..and Fcntl */
        !           318: 
        !           319: #ifndef Fcntl
        !           320: 
        !           321: extern long gemdos();
        !           322: 
        !           323: #define Fcntl(f, arg, cmd) gemdos(0x104, (short)(f), (long)(arg), (short)(cmd))
        !           324: 
        !           325: #endif
        !           326: 
1.1.1.2   root      327: #endif
                    328: 
                    329: 
                    330: 
1.1       root      331: #ifdef OWN_LIB
                    332: 
                    333: /* Sigh. Some compilers are too clever for their
                    334: 
                    335:  * own good; gcc 2.1 now makes strcpy() and some
                    336: 
                    337:  * other string functions built-in; the built-in
                    338: 
                    339:  * definitions disagree with ours. So we redefine
                    340: 
                    341:  * them here. This also helps us to avoid conflict
                    342: 
                    343:  * with any library stuff, in the event that we
                    344: 
                    345:  * have to link in a library.
                    346: 
                    347:  */
                    348: 
                    349: 
                    350: 
                    351: #define strlen MS_len
                    352: 
                    353: #define strcpy MS_cpy
                    354: 
                    355: #define strncpy        MS_ncpy
                    356: 
                    357: #define strcat MS_cat
                    358: 
                    359: #define strncat        MS_ncat
                    360: 
                    361: #define strcmp MS_cmp
                    362: 
                    363: #define strncmp        MS_ncmp
                    364: 
                    365: #define strnicmp       MS_nicmp
                    366: 
                    367: #define stricmp        MS_icmp
                    368: 
                    369: #define strlwr MS_lwr
                    370: 
                    371: #define strupr MS_upr
                    372: 
                    373: #define sleep  M_sleep
                    374: 
1.1.1.6 ! root      375: #define memcpy quickmovb
        !           376: 
1.1       root      377: #endif
                    378: 
                    379: 
                    380: 
                    381: #ifdef SHORT_NAMES
                    382: 
                    383: #define dispose_fileptr ds_fileptr
                    384: 
                    385: #define dispose_region ds_region
                    386: 
                    387: #define dispose_proc ds_proc
                    388: 
                    389: #endif
                    390: 
                    391: 
                    392: 
                    393: /* prototype macro thingy */
                    394: 
                    395: #ifdef __STDC__
                    396: 
                    397: #define P_(x) x
                    398: 
                    399: #else
                    400: 
                    401: #define P_(x) ()
                    402: 
                    403: #define const
                    404: 
1.1.1.2   root      405: #define volatile
                    406: 
1.1       root      407: #endif
                    408: 
                    409: 
                    410: 
1.1.1.2   root      411: #ifndef GENMAGIC
                    412: 
1.1       root      413: #include "assert.h"
                    414: 
1.1.1.2   root      415: #endif
                    416: 
1.1       root      417: #include "atarierr.h"
                    418: 
                    419: #include "basepage.h"
                    420: 
                    421: #include "types.h"
                    422: 
                    423: #include "signal.h"
                    424: 
                    425: #include "mem.h"
                    426: 
                    427: #include "proc.h"
                    428: 
1.1.1.2   root      429: 
                    430: 
                    431: #ifndef GENMAGIC
                    432: 
1.1       root      433: #include "proto.h"
                    434: 
                    435: #include "sproto.h"
                    436: 
1.1.1.2   root      437: #endif
                    438: 
1.1       root      439: 
                    440: 
1.1.1.6 ! root      441: #ifndef offsetof
1.1       root      442: 
1.1.1.6 ! root      443: #include <stddef.h>
1.1       root      444: 
                    445: #endif
                    446: 
                    447: 
                    448: 
1.1.1.6 ! root      449: #ifndef NULL
1.1       root      450: 
1.1.1.6 ! root      451: #define NULL ((void *)0)
1.1       root      452: 
                    453: #endif
                    454: 
                    455: 
                    456: 
1.1.1.6 ! root      457: #ifndef TRUE
1.1.1.2   root      458: 
1.1.1.6 ! root      459: #define TRUE 1
1.1.1.2   root      460: 
1.1.1.6 ! root      461: #define FALSE 0
1.1.1.2   root      462: 
                    463: #endif
                    464: 
                    465: 
                    466: 
1.1.1.6 ! root      467: #include "debug.h"
1.1.1.2   root      468: 
                    469: 
                    470: 
1.1       root      471: #define check_addr(x) 0
                    472: 
                    473: #define yield() sleep(READY_Q, 0L)
                    474: 
                    475: 
                    476: 
                    477: #define CTRL(x) ((x) & 0x1f)
                    478: 
                    479: 
                    480: 
1.1.1.2   root      481: #ifndef GENMAGIC
                    482: 
                    483: 
                    484: 
1.1       root      485: extern short timestamp, datestamp;     /* in timeout.c */
                    486: 
                    487: 
                    488: 
                    489: typedef struct kbdvbase {
                    490: 
                    491:        long midivec;
                    492: 
                    493:        long vkbderr;
                    494: 
                    495:        long vmiderr;
                    496: 
                    497:        long statvec;
                    498: 
                    499:        long mousevec;
                    500: 
                    501:        long clockvec;
                    502: 
                    503:        long joyvec;
                    504: 
                    505:        long midisys;
                    506: 
                    507:        long ikbdsys;
                    508: 
                    509: } KBDVEC;
                    510: 
                    511: 
                    512: 
                    513: extern KBDVEC *syskey;
                    514: 
                    515: 
                    516: 
                    517: #define ST     0
                    518: 
                    519: #define STE    0x00010000L
                    520: 
                    521: #define MEGASTE 0x00010010L
                    522: 
                    523: #define TT     0x00020000L
                    524: 
1.1.1.5   root      525: #define FALCON 0x00030000L
                    526: 
1.1       root      527: 
                    528: 
                    529: extern long mch;
                    530: 
                    531: 
                    532: 
                    533: extern int has_bconmap;        /* set in main() */
                    534: 
                    535: extern int curbconmap;  /* see xbios.c */
                    536: 
1.1.1.2   root      537: 
                    538: 
1.1.1.4   root      539: #define MAXLANG 6      /* languages supported */
                    540: 
                    541: extern int gl_lang;    /* set in main.c */
                    542: 
                    543: 
                    544: 
1.1.1.2   root      545: /*
                    546: 
                    547:  * load some inline functions, perhaps
                    548: 
                    549:  */
                    550: 
                    551: #include "inline.h"
                    552: 
                    553: 
                    554: 
                    555: #endif /* GENMAGIC */
                    556: 

unix.superglobalmegacorp.com

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