2004-07-16 02:26:21 -04:00
|
|
|
#ifndef __FACTOR_H__
|
|
|
|
#define __FACTOR_H__
|
|
|
|
|
2005-03-14 13:20:57 -05:00
|
|
|
#include "platform.h"
|
2004-11-08 22:36:51 -05:00
|
|
|
|
2004-12-13 16:17:05 -05:00
|
|
|
#if defined(WIN32)
|
|
|
|
#define DLLEXPORT __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define DLLEXPORT
|
|
|
|
#endif
|
|
|
|
|
2004-11-08 22:36:51 -05:00
|
|
|
typedef unsigned long int CELL;
|
|
|
|
#define CELLS ((signed)sizeof(CELL))
|
|
|
|
|
|
|
|
/* raw pointer to datastack bottom */
|
|
|
|
CELL ds_bot;
|
|
|
|
|
|
|
|
/* raw pointer to datastack top */
|
2005-02-19 23:25:21 -05:00
|
|
|
#if defined(FACTOR_X86)
|
2005-02-17 20:11:20 -05:00
|
|
|
register CELL ds asm("esi");
|
2005-02-19 23:25:21 -05:00
|
|
|
#elif defined(FACTOR_PPC)
|
|
|
|
register CELL ds asm("r14");
|
2005-02-17 16:10:35 -05:00
|
|
|
#else
|
|
|
|
CELL ds;
|
|
|
|
#endif
|
2004-11-08 22:36:51 -05:00
|
|
|
|
|
|
|
/* raw pointer to callstack bottom */
|
|
|
|
CELL cs_bot;
|
|
|
|
|
|
|
|
/* raw pointer to callstack top */
|
2005-09-04 17:07:59 -04:00
|
|
|
#if defined(FACTOR_X86)
|
|
|
|
register CELL cs asm("ebx");
|
|
|
|
#elif defined(FACTOR_PPC)
|
2005-02-19 23:25:21 -05:00
|
|
|
register CELL cs asm("r15");
|
|
|
|
#else
|
2005-09-04 17:07:59 -04:00
|
|
|
CELL cs;
|
2005-02-19 23:25:21 -05:00
|
|
|
#endif
|
2004-11-08 22:36:51 -05:00
|
|
|
|
2005-02-09 19:58:53 -05:00
|
|
|
/* TAGGED currently executing quotation */
|
2005-05-30 00:21:17 -04:00
|
|
|
CELL callframe;
|
2005-02-19 23:25:21 -05:00
|
|
|
|
|
|
|
/* TAGGED pointer to currently executing word */
|
2005-05-30 00:21:17 -04:00
|
|
|
CELL executing;
|
2005-02-09 19:58:53 -05:00
|
|
|
|
2004-07-18 22:14:36 -04:00
|
|
|
#include <errno.h>
|
2004-07-24 00:54:57 -04:00
|
|
|
#include <fcntl.h>
|
2004-07-27 22:52:35 -04:00
|
|
|
#include <limits.h>
|
2004-08-06 18:40:44 -04:00
|
|
|
#include <math.h>
|
2005-02-08 17:05:08 -05:00
|
|
|
#include <stdbool.h>
|
2004-07-16 02:26:21 -04:00
|
|
|
#include <setjmp.h>
|
2004-08-16 21:05:38 -04:00
|
|
|
#include <signal.h>
|
2004-07-16 02:26:21 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2004-12-11 15:02:34 -05:00
|
|
|
#include <time.h>
|
2004-12-10 21:39:45 -05:00
|
|
|
|
2005-03-21 20:59:30 -05:00
|
|
|
typedef unsigned char u8;
|
|
|
|
typedef unsigned short u16;
|
|
|
|
typedef unsigned int u32;
|
|
|
|
typedef unsigned long long u64;
|
|
|
|
typedef signed char s8;
|
|
|
|
typedef signed short s16;
|
|
|
|
typedef signed int s32;
|
|
|
|
typedef signed long long s64;
|
2005-03-19 16:55:28 -05:00
|
|
|
|
2005-05-19 18:33:02 -04:00
|
|
|
#include <sys/param.h>
|
|
|
|
|
2004-12-10 21:39:45 -05:00
|
|
|
#ifdef WIN32
|
|
|
|
#include <windows.h>
|
2005-10-05 00:02:24 -04:00
|
|
|
#include <ctype.h>
|
2004-12-11 15:02:34 -05:00
|
|
|
|
|
|
|
/* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
|
|
|
|
#define EPOCH_OFFSET 0x019db1ded53e8000LL
|
2004-12-10 21:39:45 -05:00
|
|
|
#else
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-25 03:33:33 -04:00
|
|
|
#if !defined(WIN32)
|
2004-09-18 18:15:01 -04:00
|
|
|
#include <dlfcn.h>
|
2005-04-25 03:33:33 -04:00
|
|
|
#endif
|
2004-09-18 18:15:01 -04:00
|
|
|
|
2005-02-08 17:05:08 -05:00
|
|
|
#define INLINE inline static
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-10-12 23:49:43 -04:00
|
|
|
#define FIXNUM_MAX (LONG_MAX >> TAG_BITS)
|
|
|
|
#define FIXNUM_MIN (LONG_MIN >> TAG_BITS)
|
|
|
|
|
2004-12-10 21:46:42 -05:00
|
|
|
#define F_FIXNUM long int /* unboxed */
|
2004-10-12 23:49:43 -04:00
|
|
|
|
2004-09-03 16:54:58 -04:00
|
|
|
#define WORD_SIZE (CELLS*8)
|
2004-09-03 18:37:25 -04:00
|
|
|
#define HALF_WORD_SIZE (CELLS*4)
|
|
|
|
#define HALF_WORD_MASK (((unsigned long)1<<HALF_WORD_SIZE)-1)
|
2004-09-03 16:54:58 -04:00
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
/* must always be 16 bits */
|
2005-03-21 20:59:30 -05:00
|
|
|
#define CHARS ((signed)sizeof(u16))
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-09-02 22:53:50 -04:00
|
|
|
/* must always be 8 bits */
|
|
|
|
typedef unsigned char BYTE;
|
|
|
|
|
2004-08-23 02:15:10 -04:00
|
|
|
#include "error.h"
|
2005-05-13 00:09:49 -04:00
|
|
|
#include "cards.h"
|
|
|
|
#include "memory.h"
|
2004-11-28 19:07:24 -05:00
|
|
|
#include "gc.h"
|
2004-11-08 22:36:51 -05:00
|
|
|
#include "boolean.h"
|
2004-08-05 15:18:31 -04:00
|
|
|
#include "word.h"
|
|
|
|
#include "run.h"
|
2004-10-17 19:01:16 -04:00
|
|
|
#include "signal.h"
|
2004-12-24 02:52:02 -05:00
|
|
|
#include "cons.h"
|
2004-07-24 15:11:55 -04:00
|
|
|
#include "fixnum.h"
|
2004-08-27 02:09:24 -04:00
|
|
|
#include "array.h"
|
2004-08-24 23:46:55 -04:00
|
|
|
#include "s48_bignumint.h"
|
|
|
|
#include "s48_bignum.h"
|
2004-07-27 21:12:22 -04:00
|
|
|
#include "bignum.h"
|
2004-08-04 22:43:58 -04:00
|
|
|
#include "ratio.h"
|
2004-08-05 16:49:55 -04:00
|
|
|
#include "float.h"
|
2004-08-05 20:29:52 -04:00
|
|
|
#include "complex.h"
|
2004-12-17 12:22:16 -05:00
|
|
|
#include "string.h"
|
2004-08-04 03:12:55 -04:00
|
|
|
#include "misc.h"
|
2004-08-12 23:40:28 -04:00
|
|
|
#include "sbuf.h"
|
2004-08-20 01:50:59 -04:00
|
|
|
#include "io.h"
|
2004-07-24 00:54:57 -04:00
|
|
|
#include "file.h"
|
2004-07-16 02:26:21 -04:00
|
|
|
#include "image.h"
|
|
|
|
#include "primitives.h"
|
|
|
|
#include "vector.h"
|
2005-01-27 20:06:10 -05:00
|
|
|
#include "hashtable.h"
|
2004-07-16 02:26:21 -04:00
|
|
|
#include "stack.h"
|
2004-09-06 02:32:04 -04:00
|
|
|
#include "compiler.h"
|
2004-12-25 02:55:03 -05:00
|
|
|
#include "relocate.h"
|
2005-04-09 18:30:46 -04:00
|
|
|
#include "alien.h"
|
|
|
|
#include "dll.h"
|
2005-08-03 23:56:28 -04:00
|
|
|
#include "wrapper.h"
|
2004-12-28 00:04:20 -05:00
|
|
|
#include "debug.h"
|
2004-07-16 02:26:21 -04:00
|
|
|
|
|
|
|
#endif /* __FACTOR_H__ */
|