2009-02-25 01:49:48 -05:00
|
|
|
/* all platform-specific includes and defines go in this file */
|
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
2015-06-10 14:46:49 -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 <stdarg.h>
|
|
|
|
#include <setjmp.h>
|
2015-06-10 14:52:30 -04:00
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
/* configurable options */
|
|
|
|
/* select your host type (or do it in the Makefile):
|
|
|
|
#define UNIX_HOST
|
|
|
|
#define DEBUGGER
|
|
|
|
#define USE_READLINE (defined by default for UNIX_HOST)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* undocumented, but probably useful */
|
|
|
|
#undef DEBUG_HEAP
|
|
|
|
#undef DEBUG_EXPRESSIONS
|
|
|
|
#undef FANCY_ERROR_MESSAGES
|
|
|
|
#undef DEBUG_ARRAY_INITIALIZER
|
|
|
|
#undef DEBUG_LEXER
|
|
|
|
#undef VAR_SCOPE_DEBUG
|
|
|
|
|
|
|
|
/* set based on the platform */
|
|
|
|
#undef BIG_ENDIAN
|
2015-06-10 14:46:49 -04:00
|
|
|
|
2015-06-10 14:38:54 -04:00
|
|
|
|
2015-06-07 01:56:20 -04:00
|
|
|
#define LARGE_INT_POWER_OF_TEN (1000000000) /* the largest power of ten which fits in an int on this architecture */
|
2010-03-02 14:58:08 -05:00
|
|
|
#if defined(__hppa__) || defined(__sparc__)
|
2011-02-15 17:47:28 -05:00
|
|
|
#define ALIGN_TYPE double /* the default data type to use for alignment */
|
2009-11-07 12:47:25 -05:00
|
|
|
#else
|
2011-02-15 17:47:28 -05:00
|
|
|
#define ALIGN_TYPE void * /* the default data type to use for alignment */
|
2009-11-07 12:47:25 -05:00
|
|
|
#endif
|
2009-02-25 01:49:48 -05:00
|
|
|
|
2015-06-10 14:46:49 -04:00
|
|
|
# if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__)
|
|
|
|
# define BIG_ENDIAN
|
|
|
|
# endif
|
|
|
|
|
2015-06-07 01:56:20 -04:00
|
|
|
#define GLOBAL_TABLE_SIZE (97) /* global variable table */
|
|
|
|
#define STRING_TABLE_SIZE (97) /* shared string table size */
|
|
|
|
#define STRING_LITERAL_TABLE_SIZE (97) /* string literal table size */
|
|
|
|
#define RESERVED_WORD_TABLE_SIZE (97) /* reserved word table size */
|
|
|
|
#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-02-25 01:49:48 -05:00
|
|
|
|
2011-02-15 17:47:28 -05:00
|
|
|
#define INTERACTIVE_PROMPT_START "starting picoc " PICOC_VERSION "\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
|
|
|
|
2015-06-07 23:05:17 -04:00
|
|
|
|
|
|
|
|
2009-02-25 01:49:48 -05:00
|
|
|
/* host platform includes */
|
|
|
|
#ifdef UNIX_HOST
|
2015-06-07 23:05:17 -04:00
|
|
|
# include <stdint.h>
|
2015-06-08 00:24:34 -04:00
|
|
|
# include <unistd.h>
|
2015-06-10 14:45:28 -04:00
|
|
|
# define USE_READLINE
|
2015-06-10 14:52:30 -04:00
|
|
|
#elif defined(WIN32) /*(predefined on MSVC)*/
|
2015-06-10 14:46:49 -04:00
|
|
|
|
2015-06-07 21:25:28 -04:00
|
|
|
#else
|
2015-06-07 23:05:17 -04:00
|
|
|
# error ***** A platform must be explicitly defined! *****
|
2015-06-07 21:25:28 -04:00
|
|
|
#endif
|
2009-02-25 01:49:48 -05:00
|
|
|
|
2011-10-05 06:57:24 -04:00
|
|
|
extern jmp_buf ExitBuf;
|
|
|
|
|
2009-05-28 20:12:12 -04:00
|
|
|
#endif /* PLATFORM_H */
|