added stix-mac.h and made related changes
This commit is contained in:
parent
6544340db4
commit
f40b5fb0c1
@ -1369,7 +1369,6 @@ static stix_uint8_t ooch_val_tab[] =
|
||||
|
||||
stix_oop_t stix_strtoint (stix_t* stix, const stix_ooch_t* str, stix_oow_t len, int radix)
|
||||
{
|
||||
//int neg = 0;
|
||||
int sign = 1;
|
||||
const stix_ooch_t* ptr, * start, * end;
|
||||
stix_lidw_t w, v;
|
||||
|
@ -126,7 +126,7 @@ void print_object (stix_t* stix, stix_oop_t oop)
|
||||
STIX_ASSERT (STIX_OOP_IS_POINTER(oop));
|
||||
c = (stix_oop_class_t)STIX_OBJ_GET_CLASS(oop); /*STIX_CLASSOF(stix, oop);*/
|
||||
|
||||
if (c == stix->_large_negative_integer)
|
||||
if ((stix_oop_t)c == stix->_large_negative_integer)
|
||||
{
|
||||
stix_oow_t i;
|
||||
printf ("-16r");
|
||||
@ -135,7 +135,7 @@ void print_object (stix_t* stix, stix_oop_t oop)
|
||||
printf ("%0*lX", (int)(STIX_SIZEOF(stix_liw_t) * 2), (unsigned long)((stix_oop_liword_t)oop)->slot[--i]);
|
||||
}
|
||||
}
|
||||
else if (c == stix->_large_positive_integer)
|
||||
else if ((stix_oop_t)c == stix->_large_positive_integer)
|
||||
{
|
||||
stix_oow_t i;
|
||||
printf ("16r");
|
||||
|
@ -1021,7 +1021,7 @@ static int prim_block_new_process (stix_t* stix, stix_ooi_t nargs)
|
||||
|
||||
if (nargs == 1)
|
||||
{
|
||||
stix_oop_oop_t xarg;
|
||||
stix_oop_t xarg;
|
||||
|
||||
xarg = ACTIVE_STACK_GETTOP(stix);
|
||||
if (!STIX_ISTYPEOF(stix,xarg,STIX_OBJ_TYPE_OOP))
|
||||
@ -1438,7 +1438,7 @@ static int prim_ffi_open (stix_t* stix, stix_ooi_t nargs)
|
||||
}
|
||||
|
||||
ACTIVE_STACK_POP (stix);
|
||||
/* TODO: how to hold an address? as an integer???? or a byte array? */
|
||||
/* TODO: how to hold an address? as an integer???? or a byte array? fix this not to loose accuracy*/
|
||||
ACTIVE_STACK_SETTOP (stix, STIX_SMOOI_TO_OOP(handle));
|
||||
|
||||
return 1;
|
||||
@ -1464,7 +1464,7 @@ static int prim_ffi_close (stix_t* stix, stix_ooi_t nargs)
|
||||
|
||||
ACTIVE_STACK_POP (stix);
|
||||
|
||||
handle = STIX_OOP_TO_SMOOI(arg); /* TODO: how to store void* ??? */
|
||||
handle = (void*)STIX_OOP_TO_SMOOI(arg); /* TODO: how to store void* ???. fix this not to loose accuracy */
|
||||
if (stix->vmprim.mod_close) stix->vmprim.mod_close (stix, handle);
|
||||
return 1;
|
||||
}
|
||||
@ -1677,7 +1677,7 @@ printf ("wrong function name...\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sym = stix->vmprim.mod_getsym (stix, STIX_OOP_TO_SMOOI(hnd), ((stix_oop_char_t)fun)->slot);
|
||||
sym = stix->vmprim.mod_getsym (stix, (void*)STIX_OOP_TO_SMOOI(hnd), ((stix_oop_char_t)fun)->slot);
|
||||
if (!sym)
|
||||
{
|
||||
return 0;
|
||||
@ -1876,7 +1876,7 @@ static stix_prim_impl_t query_prim_module (stix_t* stix, const stix_ooch_t* name
|
||||
|
||||
/* i copy-insert 'md' into the table before calling 'load'.
|
||||
* to pass the same address to load(), query(), etc */
|
||||
pair = stix_rbt_insert (&stix->pmtable, name, mod_name_len, &md, STIX_SIZEOF(md));
|
||||
pair = stix_rbt_insert (&stix->pmtable, (void*)name, mod_name_len, &md, STIX_SIZEOF(md));
|
||||
if (pair == STIX_NULL)
|
||||
{
|
||||
stix->errnum = STIX_ENOMEM;
|
||||
@ -2534,6 +2534,7 @@ printf ("]\n");
|
||||
stix_ooi_t prim_name_index;
|
||||
stix_oop_t name;
|
||||
stix_prim_impl_t handler;
|
||||
register stix_oow_t w;
|
||||
|
||||
prim_name_index = STIX_METHOD_GET_PREAMBLE_INDEX(preamble);
|
||||
DBGOUT_EXEC_1 ("METHOD_PREAMBLE_NAMED_PRIMITIVE %d", (int)prim_name_index);
|
||||
@ -2545,8 +2546,9 @@ printf ("]\n");
|
||||
STIX_ASSERT (STIX_CLASSOF(stix,name) == stix->_symbol);
|
||||
|
||||
/* merge two SmallIntegers to get a full pointer */
|
||||
handler = (stix_oow_t)STIX_OOP_TO_SMOOI(newmth->preamble_data[0]) << (STIX_OOW_BITS / 2) |
|
||||
w = (stix_oow_t)STIX_OOP_TO_SMOOI(newmth->preamble_data[0]) << (STIX_OOW_BITS / 2) |
|
||||
(stix_oow_t)STIX_OOP_TO_SMOOI(newmth->preamble_data[1]);
|
||||
handler = (stix_prim_impl_t)w;
|
||||
if (!handler) handler = query_prim_module (stix, ((stix_oop_char_t)name)->slot, STIX_OBJ_GET_SIZE(name));
|
||||
|
||||
if (handler)
|
||||
|
@ -46,6 +46,8 @@
|
||||
# include <os2.h>
|
||||
#elif defined(__DOS__)
|
||||
/* nothing to include */
|
||||
#elif defined(macintosh)
|
||||
/* nothing to include */
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <ltdl.h>
|
||||
|
@ -35,6 +35,8 @@
|
||||
# include "stix-cfg.h"
|
||||
#elif defined(_WIN32)
|
||||
# include "stix-msw.h"
|
||||
#elif defined(macintosh)
|
||||
# include "stix-mac.h" /* class mac os */
|
||||
#else
|
||||
# error UNSUPPORTED SYSTEM
|
||||
#endif
|
||||
|
63
stix/lib/stix-mac.h
Normal file
63
stix/lib/stix-mac.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is for class Mac OS */
|
||||
|
||||
/* Mac OS on PPC and m68k uses the big endian mode */
|
||||
#define STIX_ENDIAN_BIG
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
# define STIX_SIZEOF_CHAR 1
|
||||
# define STIX_SIZEOF_SHORT 2
|
||||
# define STIX_SIZEOF_INT 4
|
||||
# define STIX_SIZEOF_LONG 4
|
||||
# define STIX_SIZEOF_LONG_LONG 8
|
||||
# define STIX_SIZEOF_VOID_P 4
|
||||
# define STIX_SIZEOF_FLOAT 4
|
||||
# define STIX_SIZEOF_DOUBLE 8
|
||||
# define STIX_SIZEOF_LONG_DOUBLE 8
|
||||
# define STIX_SIZEOF_WCHAR_T 2
|
||||
|
||||
# define STIX_SIZEOF___INT8 1
|
||||
# define STIX_SIZEOF___INT16 2
|
||||
# define STIX_SIZEOF___INT32 4
|
||||
# define STIX_SIZEOF___INT64 8
|
||||
# define STIX_SIZEOF___INT128 0
|
||||
|
||||
# define STIX_SIZEOF_OFF64_T 0
|
||||
# define STIX_SIZEOF_OFF_T 8
|
||||
|
||||
# define STIX_SIZEOF_MBSTATE_T STIX_SIZEOF_LONG
|
||||
# define STIX_MBLEN_MAX 16
|
||||
|
||||
/* these two have only to be large enough */
|
||||
# define STIX_SIZEOF_STRUCT_SOCKADDR_IN 32
|
||||
# define STIX_SIZEOF_STRUCT_SOCKADDR_IN6 64
|
||||
# define STIX_SIZEOF_SOCKLEN_T 4
|
||||
|
||||
#else
|
||||
# error Define the size of various data types.
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user