2009-02-25 01:49:48 -05:00
|
|
|
/* all platform-specific includes and defines go in this file */
|
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
|
|
|
/* configurable options */
|
2009-05-04 08:02:16 -04:00
|
|
|
/* select your host type (or do it in the Makefile):
|
|
|
|
* #define UNIX_HOST
|
|
|
|
* #define FLYINGFOX_HOST
|
|
|
|
* #define SURVEYOR_HOST
|
2009-05-05 18:12:59 -04:00
|
|
|
* #define UMON_HOST
|
2009-05-04 08:02:16 -04:00
|
|
|
*/
|
2009-02-25 01:49:48 -05:00
|
|
|
|
|
|
|
#define LARGE_INT_POWER_OF_TEN 1000000000 /* the largest power of ten which fits in an int on this architecture */
|
2009-11-07 12:47:25 -05:00
|
|
|
#ifdef __hppa__
|
|
|
|
#define ALIGN_TYPE double /* the data type to use for alignment */
|
|
|
|
#else
|
2009-11-06 17:34:12 -05:00
|
|
|
#define ALIGN_TYPE void * /* the data type to use for alignment */
|
2009-11-07 12:47:25 -05:00
|
|
|
#endif
|
2009-02-25 01:49:48 -05:00
|
|
|
|
2009-03-11 18:28:42 -04:00
|
|
|
#define GLOBAL_TABLE_SIZE 97 /* global variable table */
|
2009-02-25 01:49:48 -05:00
|
|
|
#define STRING_TABLE_SIZE 97 /* shared string table size */
|
2009-03-11 18:28:42 -04:00
|
|
|
#define STRING_LITERAL_TABLE_SIZE 97 /* string literal table size */
|
2009-02-25 01:49:48 -05:00
|
|
|
#define PARAMETER_MAX 16 /* maximum number of parameters to a function */
|
|
|
|
#define LINEBUFFER_MAX 256 /* maximum number of characters on a line */
|
|
|
|
#define LOCAL_TABLE_SIZE 11 /* size of local variable table (can expand) */
|
|
|
|
#define STRUCT_TABLE_SIZE 11 /* size of struct/union member table (can expand) */
|
|
|
|
|
2009-06-04 03:41:06 -04:00
|
|
|
#define FANCY_ERROR_REPORTING /* optional feature - gives more detailed error messages but uses more memory */
|
|
|
|
|
2009-03-08 19:03:59 -04:00
|
|
|
#define INTERACTIVE_PROMPT_START "starting picoc\n"
|
2009-03-08 20:07:44 -04:00
|
|
|
#define INTERACTIVE_PROMPT_STATEMENT "picoc> "
|
|
|
|
#define INTERACTIVE_PROMPT_LINE " > "
|
2009-03-07 23:26:28 -05:00
|
|
|
|
2009-03-31 07:08:29 -04:00
|
|
|
#define PlatformSetExitPoint() setjmp(ExitBuf)
|
|
|
|
|
2009-05-28 20:12:12 -04:00
|
|
|
/* defines for the optional "fdlibm" maths library */
|
|
|
|
#define _IEEE_LIBM
|
|
|
|
|
2009-02-25 01:49:48 -05:00
|
|
|
/* host platform includes */
|
|
|
|
#ifdef UNIX_HOST
|
2009-11-07 08:44:08 -05:00
|
|
|
# define HEAP_SIZE (128*1024) /* space for the heap and the stack */
|
2009-05-27 00:55:44 -04:00
|
|
|
# include <stdio.h>
|
|
|
|
# include <stdlib.h>
|
|
|
|
# include <ctype.h>
|
|
|
|
# include <string.h>
|
|
|
|
# include <assert.h>
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/stat.h>
|
|
|
|
# include <unistd.h>
|
|
|
|
# include <stdarg.h>
|
|
|
|
# include <setjmp.h>
|
|
|
|
# ifndef NO_FP
|
2009-11-07 13:39:35 -05:00
|
|
|
# include <math.h>
|
|
|
|
# define PICOC_MATH_LIBRARY
|
2009-11-08 06:51:24 -05:00
|
|
|
/*# define NEED_MATH_LIBRARY*/
|
2009-11-07 13:42:20 -05:00
|
|
|
# undef BIG_ENDIAN
|
2009-11-07 13:49:52 -05:00
|
|
|
# if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__)
|
2009-11-07 13:39:35 -05:00
|
|
|
# define BIG_ENDIAN
|
|
|
|
# endif
|
|
|
|
# endif
|
2009-02-25 01:49:48 -05:00
|
|
|
|
2009-03-31 07:08:29 -04:00
|
|
|
extern jmp_buf ExitBuf;
|
|
|
|
|
2009-02-25 01:49:48 -05:00
|
|
|
#else
|
|
|
|
# ifdef FLYINGFOX_HOST
|
2009-11-07 08:44:08 -05:00
|
|
|
# define HEAP_SIZE (16*1024) /* space for the heap and the stack */
|
2009-05-04 08:02:16 -04:00
|
|
|
# define NO_HASH_INCLUDE
|
|
|
|
# include <stdlib.h>
|
|
|
|
# include <ctype.h>
|
|
|
|
# include <string.h>
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <stdarg.h>
|
|
|
|
# include <setjmp.h>
|
|
|
|
# include <math.h>
|
|
|
|
# define assert(x)
|
2009-05-28 20:12:12 -04:00
|
|
|
# undef BIG_ENDIAN
|
2009-06-04 20:55:54 -04:00
|
|
|
# undef FANCY_ERROR_REPORTING
|
2009-02-25 01:49:48 -05:00
|
|
|
|
|
|
|
# else
|
|
|
|
# ifdef SURVEYOR_HOST
|
|
|
|
# define NO_FP
|
|
|
|
# define NO_CTYPE
|
2009-03-12 16:44:50 -04:00
|
|
|
# define NO_HASH_INCLUDE
|
2009-04-18 21:15:01 -04:00
|
|
|
# define NO_MODULUS
|
2009-03-03 02:01:45 -05:00
|
|
|
# include <cdefBF537.h>
|
2009-02-26 22:02:05 -05:00
|
|
|
# include "../string.h"
|
|
|
|
# include "../print.h"
|
2009-03-01 05:07:01 -05:00
|
|
|
# include "../srv.h"
|
2009-02-28 00:43:28 -05:00
|
|
|
# include "../setjmp.h"
|
|
|
|
# include "../stdarg.h"
|
2009-03-04 03:32:24 -05:00
|
|
|
# include "../colors.h"
|
|
|
|
# include "../neural.h"
|
2009-03-15 17:26:03 -04:00
|
|
|
# include "../gps.h"
|
2009-03-04 03:32:24 -05:00
|
|
|
# include "../i2c.h"
|
2009-10-31 10:39:43 -04:00
|
|
|
# include "../jpeg.h"
|
2009-11-08 14:23:50 -05:00
|
|
|
# include "../malloc.h"
|
2009-02-25 01:49:48 -05:00
|
|
|
# define assert(x)
|
2009-03-08 20:07:44 -04:00
|
|
|
# undef INTERACTIVE_PROMPT_STATEMENT
|
|
|
|
# undef INTERACTIVE_PROMPT_LINE
|
|
|
|
# define INTERACTIVE_PROMPT_STATEMENT "> "
|
|
|
|
# define INTERACTIVE_PROMPT_LINE "- "
|
2009-05-28 20:12:12 -04:00
|
|
|
# undef BIG_ENDIAN
|
2009-11-08 14:23:50 -05:00
|
|
|
# define NO_CALLOC
|
|
|
|
# define NO_REALLOC
|
|
|
|
# define BROKEN_FLOAT_CASTS
|
2009-05-05 18:12:59 -04:00
|
|
|
# else
|
|
|
|
# ifdef UMON_HOST
|
2009-11-07 08:44:08 -05:00
|
|
|
# define HEAP_SIZE (128*1024) /* space for the heap and the stack */
|
2009-05-05 18:12:59 -04:00
|
|
|
# define NO_FP
|
|
|
|
# include <stdlib.h>
|
|
|
|
# include <string.h>
|
|
|
|
# include <ctype.h>
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <stdarg.h>
|
|
|
|
# include <math.h>
|
|
|
|
# include "monlib.h"
|
|
|
|
# define assert(x)
|
2009-11-11 14:41:01 -05:00
|
|
|
# define malloc mon_malloc
|
|
|
|
# define calloc(a,b) mon_malloc(a*b)
|
|
|
|
# define realloc mon_realloc
|
|
|
|
# define free mon_free
|
2009-05-05 18:12:59 -04:00
|
|
|
# undef PlatformSetExitPoint
|
|
|
|
# define PlatformSetExitPoint()
|
|
|
|
# endif
|
2009-02-25 01:49:48 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
2009-04-03 23:11:12 -04:00
|
|
|
|
|
|
|
extern int ExitBuf[];
|
|
|
|
|
2009-02-25 01:49:48 -05:00
|
|
|
#endif
|
|
|
|
|
2009-10-29 17:43:36 -04:00
|
|
|
#define math_abs(x) (((x) < 0) ? (-(x)) : (x))
|
2009-05-28 20:12:12 -04:00
|
|
|
#ifdef NEED_MATH_LIBRARY
|
|
|
|
extern double math_sin(double x);
|
|
|
|
extern double math_cos(double x);
|
|
|
|
extern double math_tan(double x);
|
|
|
|
extern double math_asin(double x);
|
|
|
|
extern double math_acos(double x);
|
|
|
|
extern double math_atan(double x);
|
|
|
|
extern double math_sinh(double x);
|
|
|
|
extern double math_cosh(double x);
|
|
|
|
extern double math_tanh(double x);
|
|
|
|
extern double math_asinh(double x);
|
|
|
|
extern double math_acosh(double x);
|
|
|
|
extern double math_atanh(double x);
|
|
|
|
extern double math_exp(double x);
|
|
|
|
extern double math_fabs(double x);
|
|
|
|
extern double math_log(double x);
|
|
|
|
extern double math_log10(double x);
|
|
|
|
extern double math_pow(double x, double y);
|
|
|
|
extern double math_sqrt(double x);
|
|
|
|
extern double math_floor(double x);
|
|
|
|
extern double math_ceil(double x);
|
|
|
|
#else /* NEED_MATH_LIBRARY */
|
|
|
|
#define math_sin(x) sin(x)
|
|
|
|
#define math_cos(x) cos(x)
|
|
|
|
#define math_tan(x) tan(x)
|
|
|
|
#define math_asin(x) asin(x)
|
|
|
|
#define math_acos(x) acos(x)
|
|
|
|
#define math_atan(x) atan(x)
|
|
|
|
#define math_sinh(x) sinh(x)
|
|
|
|
#define math_cosh(x) cosh(x)
|
|
|
|
#define math_tanh(x) tanh(x)
|
|
|
|
#define math_asinh(x) asinh(x)
|
|
|
|
#define math_acosh(x) acosh(x)
|
|
|
|
#define math_atanh(x) atanh(x)
|
|
|
|
#define math_exp(x) exp(x)
|
|
|
|
#define math_fabs(x) fabs(x)
|
|
|
|
#define math_log(x) log(x)
|
|
|
|
#define math_log10(x) log10(x)
|
|
|
|
#define math_pow(x,y) pow(x,y)
|
|
|
|
#define math_sqrt(x) sqrt(x)
|
|
|
|
#define math_floor(x) floor(x)
|
|
|
|
#define math_ceil(x) ceil(x)
|
|
|
|
#endif /* NEED_MATH_LIBRARY */
|
2009-02-25 01:49:48 -05:00
|
|
|
|
2009-05-28 20:12:12 -04:00
|
|
|
#endif /* PLATFORM_H */
|