sima/autoconf/
sima/hosts/i386/
sima/mudlib/
sima/mudlib/kernel/
sima/mudlib/obj/
sima/mudlib/sys/
sima/synhash/mips/
#include "port.h"
#include "config.h"
#include "alloc.h"

#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_LIBC_H
#include <libc.h>
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
#include <memory.h>
#endif
#ifdef HAVE_VALUES_H
#include <values.h>
#endif
#include <math.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#include <strings.h>
#endif
#include <sys/types.h>
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif

#if (defined(__GNUC__) || defined(inline)) && !defined(DEBUG)
#define INLINE inline
/*
 * gcc 2.5.8 inline is still lacking a lot: it saves registers that are only
 * needed in a conditional once-used inline function in the enclosing
 * function. Sometimes it displaces important values from registers to
 * memory. RISC architectures like SPARC allow more functions to be
 * reasonably inlined.
 */
#if !defined(i386)
#define RISC_INLINE inline
#endif
#endif

#ifndef INLINE
#define INLINE
#endif

#ifndef RISC_INLINE
#define RISC_INLINE
#endif

#if defined(__GNUC__)
#define NORETURN __attribute__ ((noreturn))
#else
#define NORETURN
#endif

#ifdef __GNUC__
#define FORMATDEBUG(f,a,b) __attribute__ ((format (f,a,b)))
#else
#define FORMATDEBUG(f,a,b)
#endif

#define ALIGN(x, type) ((void *)(((p_int)(x) + (sizeof(type)-1) ) & \
							~(sizeof(type)-1) ))
#define ALIGNI(x, type) (((x) + (sizeof(type)-1) ) & ~(sizeof(type)-1) )

#define PTRTYPE char *

#define NUM_LANGUAGES 1
uint8 *language_suffix[NUM_LANGUAGES], language_suffix_length[NUM_LANGUAGES];

struct object;

extern int inter_errno;
svalue error_arg[5];
extern svalue master_name, master_ob, boot_fun, simul_efun_ob;
extern svalue inherit_file;
extern int32 current_time;

svalue alloc(p_int, p_uint);
void *alloc_gen(mp_int);
void free_gen(void *);
char *sstring_copy(char *);
void *x_alloc(mp_int);
void *re_x_alloc(void *, mp_int);
void x_free(void *);
const char *query_host_name(void);
svalue call_hook(svalue hook, svalue object, int numargs);
void yyerror(char *);
void yyerrorn(int, ...);
void error(int, ...);
svalue find_object(svalue, int);

void fatal (char *, ...) FORMATDEBUG(printf, 1, 2) NORETURN;
void debug_message (char *, ...) FORMATDEBUG(printf, 1, 2);


#if 0
int hashblock(unsigned char *, mp_int len, int max);
int hashstr(unsigned char *, mp_int len, int max);
#endif
int32 aphash(char *p, p_int len);
int32 ahash(char *p, p_int len);
int32 uhash(char *p, p_int len);
void bad_efun_arg(int);
void free_defines();
void assert_master_ob_loaded(void);
int legal_path(char *path, mp_int len);
mp_int get_current_time(void);
void schedule(void) NORETURN;
void garbage_collection(void);
void statistics(void);

void initialize_lex(), init_global_strings(), init_alloc(), init_otable(),
	initialize_host_ip_number(), init_comm(), initialize_uids();
void nilframe(), initialize_interpreter();
void fpe_handler();
const char *query_host_ip_number();

/*
 * should make optimized code for amemcpy later: the pointers are 4-aligned,
 * and len may be rounded up to 4-alignment
 */
#define amemcpy(dest, src, len) memcpy(dest, src, len)

#define NELEM(a) (sizeof(a)/sizeof(a)[0])

#define _MCTe 0x01 /* escaped character in save/restore object. */
#define _MCTd 0x02 /* numeric digit             */


#define _MCTs 0x10 /* whitespace EXCLUDING '\n' */

#define _MCTx 0x40 /* hexadecimal               */
#define _MCTa 0x80 /* alphanumeric or '_'       */

#ifdef MAKE_FUNC
#include <ctype.h>
#define isalunum(c) (isascii(c) && (isalnum(c) || (c) == '_' ))
#define lexdigit(c) (isascii(c) && isdigit(c))
#else
extern unsigned char _my_ctype[];
#define isescaped(c) (_my_ctype[(unsigned char)(c)]&_MCTe)
#define isalunum( c) (_my_ctype[(unsigned char)(c)]&_MCTa)
#define lexdigit( c) (_my_ctype[(unsigned char)(c)]&_MCTd)
#endif

extern char escchars[];

typedef enum {
  enum16_0x00, enum16_0x01, enum16_0x02, enum16_0x03,
  enum16_0x04, enum16_0x05, enum16_0x06, enum16_0x07,
  enum16_0x08, enum16_0x09, enum16_0x0a, enum16_0x0b,
  enum16_0x0c, enum16_0x0d, enum16_0x0e, enum16_0x0f,
} enum16;

typedef enum {
  enum25_0x00, enum25_0x01, enum25_0x02, enum25_0x03,
  enum25_0x04, enum25_0x05, enum25_0x06, enum25_0x07,
  enum25_0x08, enum25_0x09, enum25_0x0a, enum25_0x0b,
  enum25_0x0c, enum25_0x0d, enum25_0x0e, enum25_0x0f,
  enum25_0x10, enum25_0x11, enum25_0x12, enum25_0x13,
  enum25_0x14, enum25_0x15, enum25_0x16, enum25_0x17, enum25_0x18
} enum25, freeable_type;

typedef enum {
  enum32_0x00, enum32_0x01, enum32_0x02, enum32_0x03,
  enum32_0x04, enum32_0x05, enum32_0x06, enum32_0x07,
  enum32_0x08, enum32_0x09, enum32_0x0a, enum32_0x0b,
  enum32_0x0c, enum32_0x0d, enum32_0x0e, enum32_0x0f,
  enum32_0x10, enum32_0x11, enum32_0x12, enum32_0x13,
  enum32_0x14, enum32_0x15, enum32_0x16, enum32_0x17,
  enum32_0x18, enum32_0x19, enum32_0x1a, enum32_0x1b,
  enum32_0x1c, enum32_0x1d, enum32_0x1e, enum32_0x1f,
} enum32;

#include "mudlib/sys/errno.h"
#include "mudlib/sys/driver_hook.h"