This is the open source Pawn interpreter ported to mbed. See here: http://www.compuphase.com/pawn/pawn.htm and here: http://code.google.com/p/pawnscript/

Dependents:   Pawn4Test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers osdefs.h Source File

osdefs.h

00001 /*
00002  * Platform
00003  *   __MSDOS__    set when compiling for DOS (not Windows)
00004  *   _Windows     set when compiling for any version of Microsoft Windows
00005  *   __WIN32__    set when compiling for Windows95 or WindowsNT (32 bit mode)
00006  *   __32BIT__    set when compiling in 32-bit "flat" mode (DOS, Windows, ARM)
00007  *   __64BIT__    set when compiling in 64-bit mode
00008  *   __ECOS__     set if Pawn was included with the eCos with configtool
00009  *   __LINUX__    set when compiling for Linux
00010  *
00011  * Copyright 1998-2011, ITB CompuPhase, The Netherlands.
00012  * No usage restrictions, no warranties.
00013  */
00014 
00015 #ifndef _OSDEFS_H
00016 #define _OSDEFS_H
00017 
00018 /* Every compiler uses different "default" macros to indicate the mode
00019  * it is in. Throughout the source, we use the Borland C++ macros, so
00020  * the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to
00021  * those of Borland C++.
00022  */
00023 #if defined(__WATCOMC__)
00024   #if defined(__WINDOWS__) || defined(__NT__)
00025     #define _Windows    1
00026   #endif
00027   #if defined(__386__) || defined(__NT__)
00028     #define __32BIT__   1
00029   #endif
00030   #if defined(_Windows) && defined(__32BIT__)
00031     #define __WIN32__   1
00032   #endif
00033 #elif defined(_MSC_VER)
00034   #if defined(_WINDOWS) || defined(_WIN32)
00035     #define _Windows    1
00036   #endif
00037   #if defined(_WIN32)
00038     #define __WIN32__   1
00039     #define __32BIT__   1
00040   #endif
00041 #elif defined __arm__
00042   #define __32BIT__     1
00043 #elif defined __AVR__
00044   #define __16BIT__     1
00045 #endif
00046 #if !defined __16BIT__ && !defined __32BIT__ && !defined __64BIT__
00047   #define __32BIT__     1
00048 #endif
00049 
00050 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24)
00051     // no Unicode support, so force only ANSI
00052     #define AMX_ANSIONLY 1
00053     // No dynamically loaded module
00054     #define AMX_NODYNALOAD 1
00055     // use the simplest Console I/O type - serial terminal
00056     #define AMX_TERMINAL 1
00057     // If we get the core VM working with RVDS assember, this will speed things up
00058 //    #define AMX_ASM 1
00059     // for the amxtime module. On Linux, stime is the standard set time call. On mbed,
00060     // it is set_time. Fortunately, they both take the same param - seconds since 01/01/70 
00061     #define stime(x) set_time(x)
00062 #endif
00063 
00064 #if (defined __linux || defined __linux__) && !defined __LINUX__
00065   #define __LINUX__
00066 #endif
00067 /* To be able to eventually set __ECOS__, we have to find a symbol
00068  * defined in a common place (so including the header file won't break
00069  * anything for other platforms). <sys/types.h> includes
00070  * <pkgconf/system.h> and in this later file we can find CYGPKG_PAWN
00071  * if the Pawn package was included with configtool and so we know
00072  * that we are compiling for eCos.
00073  */
00074 #if defined CCSINFO
00075   #include <sys/types.h>
00076 #endif
00077 #if defined CYGPKG_PAWN
00078   #define __ECOS__      1
00079   #define HAVE_ALLOCA_H 0
00080 #endif
00081 
00082 
00083 #if defined __FreeBSD__
00084   #include <sys/endian.h>
00085 #elif defined __LINUX__
00086   #include <endian.h>
00087 #elif defined __ECOS__
00088   #include <cyg/hal/hal_endian.h>
00089   #define BIG_ENDIAN    4321
00090   #define LITTLE_ENDIAN 1234
00091   #if (CYG_BYTEORDER == CYG_LSBFIRST)
00092   #define BYTE_ORDER  LITTLE_ENDIAN
00093   #else
00094     #define BYTE_ORDER  BIG_ENDIAN
00095   #endif
00096    /*
00097     * eCos option management.
00098     */
00099   #include <pkgconf/pawn.h>
00100   #if CYGPKG_PAWN_AMX_ANSIONLY==1
00101     #define AMX_ANSIONLY
00102   #endif
00103   #define PAWN_CELL_SIZE CYGPKG_PAWN_AMX_CELLSIZE
00104   #if CYGPKG_PAWN_CORE_RANDOM==0
00105     #define AMX_NORANDOM
00106   #endif
00107   #if CYGPKG_PAWN_CORE_PROPERTY==0
00108     #define AMX_NOPROPLIST
00109   #endif
00110   #if CYGPKG_PAWN_AMX_CONS_FIXEDPOINT==1
00111     #define FIXEDPOINT
00112   #endif
00113   #if CYGPKG_PAWN_AMX_CONS_FLOATPOINT==1
00114     #define FLOATPOINT
00115   #endif
00116 #endif
00117 
00118 /* Linux now has these */
00119 #if !defined BIG_ENDIAN
00120   #define BIG_ENDIAN    4321
00121 #endif
00122 #if !defined LITTLE_ENDIAN
00123   #define LITTLE_ENDIAN 1234
00124 #endif
00125 
00126 /* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
00127 #if !defined BYTE_ORDER
00128   #if defined UCLINUX
00129     #define BYTE_ORDER BIG_ENDIAN
00130   #else
00131     #define BYTE_ORDER LITTLE_ENDIAN
00132   #endif
00133 #endif
00134 
00135 #if defined __MSDOS__ || defined __WIN32__ || defined _Windows
00136   #define DIRSEP_CHAR '\\'
00137 #elif defined macintosh || defined __APPLE__
00138   #define DIRSEP_CHAR ':'
00139 #else
00140   #define DIRSEP_CHAR '/'   /* directory separator character */
00141 #endif
00142 
00143 /* _MAX_PATH is sometimes called differently and it may be in limits.h or
00144  * stdlib.h instead of stdio.h.
00145  */
00146 #if !defined _MAX_PATH
00147   /* not defined, perhaps stdio.h was not included */
00148   #if !defined PATH_MAX
00149     #include <stdio.h>
00150   #endif
00151   #if !defined _MAX_PATH && !defined PATH_MAX
00152     /* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
00153     #include <limits.h>
00154   #endif
00155   #if !defined _MAX_PATH && !defined PATH_MAX
00156     /* no _MAX_PATH and no MAX_PATH, perhaps it is in stdlib.h */
00157     #include <stdlib.h>
00158   #endif
00159   /* if _MAX_PATH is undefined, try common alternative names */
00160   #if !defined _MAX_PATH
00161     #if defined MAX_PATH
00162       #define _MAX_PATH    MAX_PATH
00163     #elif defined _POSIX_PATH_MAX
00164       #define _MAX_PATH  _POSIX_PATH_MAX
00165     #else
00166       /* everything failed, actually we have a problem here... */
00167       #define _MAX_PATH  1024
00168     #endif
00169   #endif
00170 #endif
00171 
00172 #endif  /* _OSDEFS_H */