update to latest SWI.
This commit is contained in:
parent
616ae30138
commit
ad9e1d8ea4
@ -85,6 +85,9 @@ typedef uintptr_t word; /* Anonymous 4 byte object */
|
|||||||
#define WORDS_PER_DOUBLE 2
|
#define WORDS_PER_DOUBLE 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define allocForeignState(size) ((void *)Yap_AllocCodeSpace(size))
|
||||||
|
#define freeForeignState(ptr, size) Yap_FreeCodeSpace((void*)(ptr))
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
34
os/pl-cstack.h
Normal file
34
os/pl-cstack.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* $Id$
|
||||||
|
|
||||||
|
Part of SWI-Prolog
|
||||||
|
|
||||||
|
Author: Jan Wielemaker
|
||||||
|
E-mail: J.Wielemaker@uva.nl
|
||||||
|
WWW: http://www.swi-prolog.org
|
||||||
|
Copyright (C): 1985-2011, University of Amsterdam
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PL_CSTACK_H_INCLUDED
|
||||||
|
#define PL_CSTACK_H_INCLUDED
|
||||||
|
|
||||||
|
COMMON(void) save_backtrace(const char *why);
|
||||||
|
COMMON(void) btrace_destroy(struct btrace *bt);
|
||||||
|
COMMON(void) print_backtrace(int last); /* 1..SAVE_TRACES */
|
||||||
|
COMMON(void) print_backtrace_named(const char *why);
|
||||||
|
COMMON(void) initBackTrace(void);
|
||||||
|
|
||||||
|
#endif /*PL_CSTACK_H_INCLUDED*/
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pl-incl.h"
|
#include "pl-incl.h"
|
||||||
@ -54,7 +54,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{ int current; /* current character */
|
{ int current; /* current character */
|
||||||
const char_type *class; /* current class */
|
const char_type *class; /* current class */
|
||||||
int do_enum; /* what to enumerate */
|
int do_enum; /* what to enumerate */
|
||||||
} generator;
|
} generator;
|
||||||
|
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ do_char_type(term_t chr, term_t class, control_t h, int how)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gen = allocHeap(sizeof(*gen));
|
gen = allocForeignState(sizeof(*gen));
|
||||||
gen->do_enum = do_enum;
|
gen->do_enum = do_enum;
|
||||||
|
|
||||||
if ( do_enum & ENUM_CHAR )
|
if ( do_enum & ENUM_CHAR )
|
||||||
@ -385,10 +385,11 @@ do_char_type(term_t chr, term_t class, control_t h, int how)
|
|||||||
case FRG_CUTTED:
|
case FRG_CUTTED:
|
||||||
gen = ForeignContextPtr(h);
|
gen = ForeignContextPtr(h);
|
||||||
if ( gen )
|
if ( gen )
|
||||||
freeHeap(gen, sizeof(*gen));
|
freeForeignState(gen, sizeof(*gen));
|
||||||
default:
|
default:
|
||||||
succeed;
|
succeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !(fid = PL_open_foreign_frame()) )
|
if ( !(fid = PL_open_foreign_frame()) )
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -411,9 +412,9 @@ do_char_type(term_t chr, term_t class, control_t h, int how)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( advanceGen(gen) ) /* ok, found one */
|
if ( advanceGen(gen) ) /* ok, found one */
|
||||||
ForeignRedoPtr(gen);
|
{ ForeignRedoPtr(gen);
|
||||||
else
|
} else
|
||||||
{ freeHeap(gen, sizeof(*gen)); /* the only one */
|
{ freeForeignState(gen, sizeof(*gen)); /* the only one */
|
||||||
succeed;
|
succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -425,7 +426,7 @@ do_char_type(term_t chr, term_t class, control_t h, int how)
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
freeHeap(gen, sizeof(*gen));
|
freeForeignState(gen, sizeof(*gen));
|
||||||
fail;
|
fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +452,7 @@ PRED_IMPL("iswctype", 2, iswctype, 0)
|
|||||||
wctype_t t;
|
wctype_t t;
|
||||||
|
|
||||||
if ( !PL_get_char_ex(A1, &chr, FALSE) ||
|
if ( !PL_get_char_ex(A1, &chr, FALSE) ||
|
||||||
!PL_get_chars_ex(A2, &s, CVT_ATOM) )
|
!PL_get_chars(A2, &s, CVT_ATOM|CVT_EXCEPTION) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( !(t=wctype(s)) )
|
if ( !(t=wctype(s)) )
|
||||||
@ -725,11 +726,11 @@ PRED_IMPL("setlocale", 3, setlocale, 0)
|
|||||||
const lccat *lcp;
|
const lccat *lcp;
|
||||||
|
|
||||||
|
|
||||||
if ( !PL_get_chars_ex(A1, &what, CVT_ATOM) )
|
if ( !PL_get_chars(A1, &what, CVT_ATOM|CVT_EXCEPTION) )
|
||||||
fail;
|
fail;
|
||||||
if ( PL_is_variable(A3) )
|
if ( PL_is_variable(A3) )
|
||||||
locale = NULL;
|
locale = NULL;
|
||||||
else if ( !PL_get_chars_ex(A3, &locale, CVT_ATOM) )
|
else if ( !PL_get_chars(A3, &locale, CVT_ATOM|CVT_EXCEPTION) )
|
||||||
fail;
|
fail;
|
||||||
|
|
||||||
for ( lcp = lccats; lcp->name; lcp++ )
|
for ( lcp = lccats; lcp->name; lcp++ )
|
||||||
@ -748,8 +749,7 @@ PRED_IMPL("setlocale", 3, setlocale, 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PL_error(NULL, 0, NULL, ERR_DOMAIN,
|
return PL_domain_error("category", A1);
|
||||||
PL_new_atom("category"), A1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -784,7 +784,7 @@ EndPredDefs
|
|||||||
|
|
||||||
const char _PL_char_types[] = {
|
const char _PL_char_types[] = {
|
||||||
/* ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O 0-15 */
|
/* ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O 0-15 */
|
||||||
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
CT, CT, CT, CT, CT, CT, CT, CT, CT, SP, SP, SP, SP, SP, CT, CT,
|
||||||
/* ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_ 16-31 */
|
/* ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_ 16-31 */
|
||||||
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
||||||
/* sp ! " # $ % & ' ( ) * + , - . / 32-47 */
|
/* sp ! " # $ % & ' ( ) * + , - . / 32-47 */
|
||||||
@ -803,13 +803,14 @@ const char _PL_char_types[] = {
|
|||||||
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
||||||
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, CT,
|
||||||
/* 160-255 (G1 graphics) */
|
/* 160-255 (G1 graphics) */
|
||||||
/* ISO Latin 1 is assumed */
|
/* ISO Latin 1 (=Unicode) is assumed */
|
||||||
SP, SO, SO, SO, SO, SO, SO, SO, SO, SO, LC, SO, SO, SO, SO, SO,
|
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
|
||||||
SO, SO, SO, SO, SO, SO, SO, SO, SO, SO, LC, SO, SO, SO, SO, SO,
|
SP, SY, SY, SY, SY, SY, SY, SY, SY, SY, LC, SY, SY, SO, SY, SY, /*00AX*/
|
||||||
UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC,
|
SY, SY, SO, SO, SY, LC, SY, SY, SY, SO, LC, SY, SO, SO, SO, SY, /*00BX*/
|
||||||
UC, UC, UC, UC, UC, UC, UC, SO, UC, UC, UC, UC, UC, UC, UC, LC,
|
UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, UC, /*00CX*/
|
||||||
LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC,
|
UC, UC, UC, UC, UC, UC, UC, SY, UC, UC, UC, UC, UC, UC, UC, LC, /*00DX*/
|
||||||
LC, LC, LC, LC, LC, LC, LC, SO, LC, LC, LC, LC, LC, LC, LC, LC
|
LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, LC, /*00EX*/
|
||||||
|
LC, LC, LC, LC, LC, LC, LC, SY, LC, LC, LC, LC, LC, LC, LC, LC /*00FX*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -841,14 +842,9 @@ initEncoding(void)
|
|||||||
} else if ( (enc = setlocale(LC_CTYPE, NULL)) )
|
} else if ( (enc = setlocale(LC_CTYPE, NULL)) )
|
||||||
{ LD->encoding = ENC_ANSI; /* text encoding */
|
{ LD->encoding = ENC_ANSI; /* text encoding */
|
||||||
|
|
||||||
/* this does not work on the mac for some reason */
|
if ( (enc = strchr(enc, '.')) )
|
||||||
if (strchr(enc, '.')) {
|
|
||||||
enc = strchr(enc, '.');
|
|
||||||
/* skip '.' */
|
|
||||||
enc++;
|
|
||||||
}
|
|
||||||
if ( enc )
|
|
||||||
{ const enc_map *m;
|
{ const enc_map *m;
|
||||||
|
enc++; /* skip '.' */
|
||||||
|
|
||||||
for ( m=map; m->name; m++ )
|
for ( m=map; m->name; m++ )
|
||||||
{ if ( strcmp(enc, m->name) == 0 )
|
{ if ( strcmp(enc, m->name) == 0 )
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern const char _PL_char_types[]; /* array of character types */
|
extern const char _PL_char_types[]; /* array of character types */
|
||||||
@ -37,7 +37,8 @@ extern const char _PL_char_types[]; /* array of character types */
|
|||||||
#define DI 10 /* Digit */
|
#define DI 10 /* Digit */
|
||||||
|
|
||||||
#define isControl(c) (_PL_char_types[(unsigned)(c) & 0xff] == CT)
|
#define isControl(c) (_PL_char_types[(unsigned)(c) & 0xff] == CT)
|
||||||
#define isBlank(c) (_PL_char_types[(unsigned)(c) & 0xff] <= SP)
|
#define isBlank(c) (_PL_char_types[(unsigned)(c) & 0xff] == SP)
|
||||||
|
#define isGraph(c) (_PL_char_types[(unsigned)(c) & 0xff] > SP)
|
||||||
#define isDigit(c) (_PL_char_types[(unsigned)(c) & 0xff] == DI)
|
#define isDigit(c) (_PL_char_types[(unsigned)(c) & 0xff] == DI)
|
||||||
#define isLower(c) (_PL_char_types[(unsigned)(c) & 0xff] == LC)
|
#define isLower(c) (_PL_char_types[(unsigned)(c) & 0xff] == LC)
|
||||||
#define isUpper(c) (_PL_char_types[(unsigned)(c) & 0xff] == UC)
|
#define isUpper(c) (_PL_char_types[(unsigned)(c) & 0xff] == UC)
|
||||||
@ -68,7 +69,7 @@ extern const char _PL_char_types[]; /* array of character types */
|
|||||||
((unsigned)(c) <= 0xff ? (_PL_char_types[(unsigned char)(c)] t) : w)
|
((unsigned)(c) <= 0xff ? (_PL_char_types[(unsigned char)(c)] t) : w)
|
||||||
|
|
||||||
#define isControlW(c) PlCharType(c, == CT, iswcntrl((wint_t)c))
|
#define isControlW(c) PlCharType(c, == CT, iswcntrl((wint_t)c))
|
||||||
#define isBlankW(c) PlCharType(c, <= SP, iswspace((wint_t)c))
|
#define isBlankW(c) PlCharType(c, == SP, iswspace((wint_t)c))
|
||||||
#define isDigitW(c) PlCharType(c, == DI, FALSE)
|
#define isDigitW(c) PlCharType(c, == DI, FALSE)
|
||||||
#define isLowerW(c) PlCharType(c, == LC, iswlower((wint_t)c))
|
#define isLowerW(c) PlCharType(c, == LC, iswlower((wint_t)c))
|
||||||
#define isUpperW(c) PlCharType(c, == UC, iswupper((wint_t)c))
|
#define isUpperW(c) PlCharType(c, == UC, iswupper((wint_t)c))
|
||||||
|
Reference in New Issue
Block a user