init.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
fcode_env_t *initial_env = 0;
int stack_size = 0x200;
void *
safe_malloc(size_t n, char *f, int l)
{
void *p;
#if defined(__sparcv9)
/*
* For Ultrasparc, we must force addresses to be less than 4Gb,
* since Fcode assumes that addresses can be stored in 32 bits.
* To get around this would require turning all addresses into
* cookies, which is a lot of work.
*/
if (((uint64_t)p) >= 0x100000000) {
}
#endif /* __sparcv9 */
if (p) {
} else
(uint64_t)n);
return (p);
}
void *
safe_realloc(void *p, size_t n, char *f, int l)
{
void *newp;
p, n);
safe_free(p, f, l);
return (NULL);
}
if (p) {
safe_free(p, f, l);
}
return (newp);
}
void
safe_free(void *p, char *f, int l)
{
if (p) {
free(p);
}
}
char *
safe_strdup(char *s, char *f, int l)
{
char *p = strdup(s);
return (p);
}
static void
_init(void)
{
int i;
fcode_impl_count = 0;
/* Setup the initial forth environment */
initial_env = env;
/*
* Need to define this early because it is the default for
* all unimpl, FCODE functions
*/
for (i = 0; i <= MAX_FCODE; i++) {
}
fcode_impl_count = 0;
}