some changes for an old borland compiler

This commit is contained in:
hyunghwan.chung 2018-10-30 06:02:36 +00:00
parent f3f77ae9f2
commit 1200203eba
5 changed files with 35 additions and 31 deletions

View File

@ -857,7 +857,7 @@ static int add_to_oow_pool (moo_t* moo, moo_oow_pool_t* pool, moo_oow_t v)
do { if (add_token_str(moo, s, l) <= -1) return -1; } while (0) do { if (add_token_str(moo, s, l) <= -1) return -1; } while (0)
#define ADD_TOKEN_CHAR(moo,c) \ #define ADD_TOKEN_CHAR(moo,c) \
do { if (add_token_char(moo, c) <= -1) return -1; } while (0) do { if (add_token_char(moo, (moo_ooch_t)c) <= -1) return -1; } while (0)
#define CLEAR_TOKEN_NAME(moo) ((moo)->c->tok.name.len = 0) #define CLEAR_TOKEN_NAME(moo) ((moo)->c->tok.name.len = 0)
#define SET_TOKEN_TYPE(moo,tv) ((moo)->c->tok.type = (tv)) #define SET_TOKEN_TYPE(moo,tv) ((moo)->c->tok.type = (tv))
@ -1121,7 +1121,7 @@ static int get_ident (moo_t* moo, moo_ooci_t char_read_ahead)
if (char_read_ahead != MOO_OOCI_EOF) if (char_read_ahead != MOO_OOCI_EOF)
{ {
ADD_TOKEN_CHAR(moo, char_read_ahead); ADD_TOKEN_CHAR (moo, char_read_ahead);
} }
/* while() instead of do..while() because when char_read_ahead is not EOF /* while() instead of do..while() because when char_read_ahead is not EOF
@ -1353,7 +1353,7 @@ static int get_numlit (moo_t* moo, int negated)
radix = rv; radix = rv;
} }
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (c == '_') if (c == '_')
{ {
@ -1383,7 +1383,7 @@ static int get_numlit (moo_t* moo, int negated)
return -1; return -1;
} }
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (CHAR_TO_NUM(c, radix) >= radix) if (CHAR_TO_NUM(c, radix) >= radix)
@ -1395,7 +1395,7 @@ static int get_numlit (moo_t* moo, int negated)
do do
{ {
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (c == '_') if (c == '_')
{ {
@ -1442,7 +1442,7 @@ static int get_charlit (moo_t* moo)
} }
SET_TOKEN_TYPE (moo, MOO_IOTOK_CHARLIT); SET_TOKEN_TYPE (moo, MOO_IOTOK_CHARLIT);
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
return 0; return 0;
} }
@ -1758,7 +1758,7 @@ retry:
case '^': case '^':
SET_TOKEN_TYPE (moo, MOO_IOTOK_RETURN); SET_TOKEN_TYPE (moo, MOO_IOTOK_RETURN);
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (c == '^') if (c == '^')
@ -1803,25 +1803,25 @@ retry:
case '%': case '%':
SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCENT); SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCENT);
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (c == '(') if (c == '(')
{ {
/* %( - array expression */ /* %( - array expression */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCPAREN); SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCPAREN);
} }
else if (c == '[') else if (c == '[')
{ {
/* %[ - byte-array expression */ /* %[ - byte-array expression */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCBRACK); SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCBRACK);
} }
else if (c == '{') else if (c == '{')
{ {
/* %{ - dictionary expression */ /* %{ - dictionary expression */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCBRACE); SET_TOKEN_TYPE (moo, MOO_IOTOK_PERCBRACE);
} }
else else
@ -1835,7 +1835,7 @@ retry:
break; break;
case '#': case '#':
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
switch (c) switch (c)
{ {
@ -1845,19 +1845,19 @@ retry:
case '(': case '(':
/* #( - array literal */ /* #( - array literal */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHPAREN); SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHPAREN);
break; break;
case '[': case '[':
/* #[ - byte array literal */ /* #[ - byte array literal */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHBRACK); SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHBRACK);
break; break;
case '{': case '{':
/* #[ - dictionary literal */ /* #[ - dictionary literal */
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHBRACE); SET_TOKEN_TYPE (moo, MOO_IOTOK_HASHBRACE);
break; break;
@ -1868,23 +1868,23 @@ retry:
break; break;
case '\\': case '\\':
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (c == 'E' || c == 'e') if (c == 'E' || c == 'e')
{ {
/* #\eNNN - error literal - #\e0, #\e1234, etc */ /* #\eNNN - error literal - #\e0, #\e1234, etc */
SET_TOKEN_TYPE(moo, MOO_IOTOK_ERRLIT); SET_TOKEN_TYPE(moo, MOO_IOTOK_ERRLIT);
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (!is_digitchar(c)) if (!is_digitchar(c))
{ {
ADD_TOKEN_CHAR(moo, c); /* to include it to the error messsage */ ADD_TOKEN_CHAR (moo, c); /* to include it to the error messsage */
moo_setsynerr (moo, MOO_SYNERR_ERRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); moo_setsynerr (moo, MOO_SYNERR_ERRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
do do
{ {
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
} }
while (is_digitchar(c) || c == '_'); while (is_digitchar(c) || c == '_');
@ -1893,25 +1893,25 @@ retry:
{ {
/* #\pXXX - smptr literal - #\p0, #\p100, etc */ /* #\pXXX - smptr literal - #\p0, #\p100, etc */
SET_TOKEN_TYPE(moo, MOO_IOTOK_SMPTRLIT); SET_TOKEN_TYPE(moo, MOO_IOTOK_SMPTRLIT);
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
if (!is_xdigitchar(c)) if (!is_xdigitchar(c))
{ {
ADD_TOKEN_CHAR(moo, c); /* to include it to the error messsage */ ADD_TOKEN_CHAR (moo, c); /* to include it to the error messsage */
moo_setsynerr (moo, MOO_SYNERR_SMPTRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); moo_setsynerr (moo, MOO_SYNERR_SMPTRLITINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
do do
{ {
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
GET_CHAR_TO (moo, c); GET_CHAR_TO (moo, c);
} }
while (is_xdigitchar(c) || c == '_'); while (is_xdigitchar(c) || c == '_');
} }
else else
{ {
ADD_TOKEN_CHAR(moo, c); /* to include it to the error messsage */ ADD_TOKEN_CHAR (moo, c); /* to include it to the error messsage */
moo_setsynerr (moo, MOO_SYNERR_HBSLPINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo)); moo_setsynerr (moo, MOO_SYNERR_HBSLPINVAL, TOKEN_LOC(moo), TOKEN_NAME(moo));
return -1; return -1;
} }
@ -2103,7 +2103,7 @@ retry:
break; break;
single_char_token: single_char_token:
ADD_TOKEN_CHAR(moo, c); ADD_TOKEN_CHAR (moo, c);
break; break;
} }
@ -7279,7 +7279,7 @@ static int make_defined_class (moo_t* moo)
moo_cunit_class_t* cc = (moo_cunit_class_t*)moo->c->cunit; moo_cunit_class_t* cc = (moo_cunit_class_t*)moo->c->cunit;
moo_oop_t tmp; moo_oop_t tmp;
moo_oow_t spec, self_spec; moo_ooi_t spec, self_spec;
int just_made = 0, flags; int just_made = 0, flags;
flags = 0; flags = 0;

View File

@ -195,6 +195,7 @@ static const moo_ooch_t* synerr_to_errstr (moo_synerrnum_t errnum)
#if defined(_WIN32) #if defined(_WIN32)
# include <windows.h> # include <windows.h>
# include <errno.h>
#elif defined(__OS2__) #elif defined(__OS2__)
# define INCL_DOSPROCESS # define INCL_DOSPROCESS
# define INCL_DOSFILEMGR # define INCL_DOSFILEMGR

View File

@ -127,6 +127,8 @@ static MOO_INLINE const char* proc_state_to_string (int state)
# define __PRIMITIVE_NAME__ "<<primitive>>" # define __PRIMITIVE_NAME__ "<<primitive>>"
#elif defined(_SCO_DS) #elif defined(_SCO_DS)
# define __PRIMITIVE_NAME__ "<<primitive>>" # define __PRIMITIVE_NAME__ "<<primitive>>"
#elif defined(__BORLANDC__) && (__BORLANDC__ <= 0x520)
# define __PRIMITIVE_NAME__ "<<primitive>>"
#else #else
# define __PRIMITIVE_NAME__ (&__FUNCTION__[0]) # define __PRIMITIVE_NAME__ (&__FUNCTION__[0])
#endif #endif

View File

@ -1278,7 +1278,7 @@ static int _del_poll_fd (moo_t* moo, int fd)
ev.revents = 0; ev.revents = 0;
if (write (xtn->ep, &ev, MOO_SIZEOF(ev)) != MOO_SIZEOF(ev)) if (write (xtn->ep, &ev, MOO_SIZEOF(ev)) != MOO_SIZEOF(ev))
{ {
moo_syserr_to_errnum (errno); moo_seterrwithsyserr (moo, errno);
MOO_DEBUG2 (moo, "Cannot remove file descriptor %d from devpoll - %hs\n", fd, strerror(errno)); MOO_DEBUG2 (moo, "Cannot remove file descriptor %d from devpoll - %hs\n", fd, strerror(errno));
return -1; return -1;
} }
@ -1293,7 +1293,7 @@ static int _del_poll_fd (moo_t* moo, int fd)
memset (&ev, 0, MOO_SIZEOF(ev)); memset (&ev, 0, MOO_SIZEOF(ev));
if (epoll_ctl (xtn->ep, EPOLL_CTL_DEL, fd, &ev) == -1) if (epoll_ctl (xtn->ep, EPOLL_CTL_DEL, fd, &ev) == -1)
{ {
moo_syserr_to_errnum (errno); moo_seterrwithsyserr (moo, errno);
MOO_DEBUG2 (moo, "Cannot remove file descriptor %d from epoll - %hs\n", fd, strerror(errno)); MOO_DEBUG2 (moo, "Cannot remove file descriptor %d from epoll - %hs\n", fd, strerror(errno));
return -1; return -1;
} }
@ -1456,7 +1456,7 @@ static int vm_startup (moo_t* moo)
xtn->ep = open ("/dev/poll", O_RDWR); xtn->ep = open ("/dev/poll", O_RDWR);
if (xtn->ep == -1) if (xtn->ep == -1)
{ {
moo_syserr_to_errnum (errno); moo_seterrwithsyserr (moo, errno);
MOO_DEBUG1 (moo, "Cannot create devpoll - %hs\n", strerror(errno)); MOO_DEBUG1 (moo, "Cannot create devpoll - %hs\n", strerror(errno));
goto oops; goto oops;
} }
@ -1472,7 +1472,7 @@ static int vm_startup (moo_t* moo)
#endif #endif
if (xtn->ep == -1) if (xtn->ep == -1)
{ {
moo_syserr_to_errnum (errno); moo_seterrwithsyserr (moo, errno);
MOO_DEBUG1 (moo, "Cannot create epoll - %hs\n", strerror(errno)); MOO_DEBUG1 (moo, "Cannot create epoll - %hs\n", strerror(errno));
goto oops; goto oops;
} }
@ -1498,7 +1498,7 @@ static int vm_startup (moo_t* moo)
#if defined(USE_THREAD) #if defined(USE_THREAD)
if (pipe(xtn->p) == -1) if (pipe(xtn->p) == -1)
{ {
moo_syserr_to_errnum (errno); moo_seterrwithsyserr (moo, errno);
MOO_DEBUG1 (moo, "Cannot create pipes - %hs\n", strerror(errno)); MOO_DEBUG1 (moo, "Cannot create pipes - %hs\n", strerror(errno));
goto oops; goto oops;
} }

View File

@ -89,7 +89,8 @@ typedef struct _IO_STATUS_BLOCK
DWORD Status; DWORD Status;
PVOID Pointer; PVOID Pointer;
} u; } u;
ULONG_PTR Information; /*ULONG_PTR Information;*/
ULONG* Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
typedef enum _FILE_INFORMATION_CLASS typedef enum _FILE_INFORMATION_CLASS