sourcepawn/compiler/sclinux.h
author Asher Baker <asherkin@gmail.com>
Fri Apr 05 07:03:43 2013 +0100 (2013-04-05)
changeset 3885 bb6de8c6c2d5
parent 2783 5f333027ef04
permissions -rw-r--r--
Support emscripten for compiling spcomp (r=dvander).
     1 /*
     2  * Things needed to compile under linux.
     3  *
     4  * Should be reworked totally to use GNU's 'configure'
     5  */
     6 #ifndef SCLINUX_H
     7 #define SCLINUX_H
     8 
     9 /* getchar() is not a 'cool' replacement for MSDOS getch: Linux/unix depends on the features activated or not about the
    10  * controlling terminal's tty. This means that ioctl(2) calls must be performed, for instance to have the controlling 
    11  * terminal tty's in 'raw' mode, if we want to be able to fetch a single character. This also means that everything must 
    12  * be put back correctly when the function ends. See GETCH.C for an implementation.
    13  *
    14  * For interactive use of SRUN/SDBG if would be much better to use GNU's readline package: the user would be able to 
    15  * have a complete emacs/vi like line editing system.
    16  */
    17 #include "getch.h"
    18 
    19 /*
    20  * WinWorld wants '\'. Unices do not.
    21  */
    22 #define	DIRECTORY_SEP_CHAR      '/'
    23 #define	DIRECTORY_SEP_STR       "/"
    24 
    25 /*
    26  * SC assumes that a computer is Little Endian unless told otherwise. It uses
    27  * (and defines) the macros BYTE_ORDER and BIG_ENDIAN.
    28  * For Linux, we must overrule these settings with those defined in glibc.
    29  */
    30 #if !defined __BYTE_ORDER
    31 # if defined EMSCRIPTEN
    32 #  include <endian.h>
    33 # else
    34 #  include <stdlib.h>
    35 # endif
    36 #endif
    37 
    38 #if defined __OpenBSD__ || defined __FreeBSD__ || defined __APPLE__
    39 # define __BYTE_ORDER    BYTE_ORDER
    40 # define __LITTLE_ENDIAN LITTLE_ENDIAN
    41 # define __BIG_ENDIAN    BIG_ENDIAN
    42 #endif
    43 
    44 #if !defined __BYTE_ORDER
    45 # error	"Can't figure computer byte order (__BYTE_ORDER macro not found)"
    46 #endif
    47 
    48 #endif /* SCLINUX_H */