fix error handling

configure should not allow max-memory and use-malloc at same time
some extensions for jpl


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1289 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-05-25 18:18:02 +00:00
parent 72b037275f
commit 7e06e3fa36
7 changed files with 78 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $Id: jpl.yap,v 1.4 2005-05-12 03:36:33 vsc Exp $
/* $Id: jpl.yap,v 1.5 2005-05-25 18:18:00 vsc Exp $
Part of JPL -- SWI-Prolog/Java interface
@ -68,11 +68,13 @@
jpl_array_to_length/2,
jpl_array_to_list/2,
jpl_datums_to_array/2,
jpl_datums_to_array/3,
jpl_enumeration_element/2,
jpl_enumeration_to_list/2,
jpl_hashtable_pair/2,
jpl_iterator_element/2,
jpl_list_to_array/2,
jpl_list_to_array/3,
jpl_map_element/2,
jpl_set_element/2
]).
@ -3910,6 +3912,11 @@ jpl_datums_to_array(Ds, A) :-
jpl_datums_to_most_specific_common_ancestor_type(Ds, T),
jpl_new(array(T), Ds, A).
jpl_datums_to_array(Ds, Type, A) :-
ground(Ds),
ground(Type),
jpl_new(array(Type), Ds, A).
%------------------------------------------------------------------------------
%type jpl_enumeration_element(object, datum)
@ -3979,6 +3986,9 @@ jpl_iterator_element(I, E) :-
jpl_list_to_array(Ds, A) :-
jpl_datums_to_array(Ds, A).
jpl_list_to_array(Ds, Type, A) :-
jpl_datums_to_array(Ds, Type, A).
%------------------------------------------------------------------------------
%type jpl_map_element(object, pair(datum,datum))

View File

@ -1,4 +1,4 @@
/* $Id: jpl.c,v 1.7 2005-05-12 03:36:33 vsc Exp $
/* $Id: jpl.c,v 1.8 2005-05-25 18:18:00 vsc Exp $
Part of JPL -- SWI-Prolog/Java interface
@ -2955,9 +2955,14 @@ jni_func_1_plc(
switch ( n )
{
case 6:
r = JNI_term_to_charP(ta1,&c1)
&& JNI_jobject_to_term((*env)->FindClass(env,(char*)c1),tr);
break;
{
jobject jobj;
r = JNI_term_to_charP(ta1,&c1);
jobj = (*env)->FindClass(env,(char*)c1);
r &= JNI_jobject_to_term(jobj,tr);
}
break;
case 10:
r = JNI_term_to_jclass(env,ta1,&p1)
&& JNI_jobject_to_term((*env)->GetSuperclass(env,(jclass)p1),tr);

9
configure vendored
View File

@ -13433,6 +13433,15 @@ _ACEOF
fi
if test "$use_malloc" = "yes" -a "$maxmemory" = "yes"
then
echo ****************************************
echo Malloc and Max Memory are not compatible
echo Please use different options
echo ****************************************
exit 1
fi
echo "$as_me:$LINENO: checking if fflush(NULL) clobbers input pipes" >&5
echo $ECHO_N "checking if fflush(NULL) clobbers input pipes... $ECHO_C" >&6
if test "${yap_cv_broken_fflush_null+set}" = set; then

View File

@ -1004,6 +1004,15 @@ else
AC_DEFINE(HAVE_MPZ_XOR,0)
fi
if test "$use_malloc" = "yes" -a "$maxmemory" = "yes"
then
echo ****************************************
echo Malloc and Max Memory are not compatible
echo Please use different options
echo ****************************************
exit 1
fi
dnl On some systems doing a fflush(NULL) to flush all output streams
dnl has the side-effect of makeing all charactes waiting in input
dnl pipes disapear.

View File

@ -106,23 +106,23 @@ extern X_API YAP_Bool PROTO(YAP_IsPairTerm,(YAP_Term));
/* YAP_Bool IsApplTerm(YAP_Term) */
extern X_API YAP_Bool PROTO(YAP_IsApplTerm,(YAP_Term));
/* Term MkIntTerm(long int) */
extern X_API YAP_Term PROTO(YAP_MkIntTerm,(long int));
/* Term MkIntTerm(YAP_Int) */
extern X_API YAP_Term PROTO(YAP_MkIntTerm,(YAP_Int));
/* Term MkBigNumTerm(void *) */
extern X_API YAP_Term PROTO(YAP_MkBigNumTerm,(void *));
/* long int IntOfTerm(Term) */
extern X_API long int PROTO(YAP_IntOfTerm,(YAP_Term));
/* YAP_Int IntOfTerm(Term) */
extern X_API YAP_Int PROTO(YAP_IntOfTerm,(YAP_Term));
/* long int BigNumOfTerm(Term) */
/* void * BigNumOfTerm(Term) */
extern X_API void *PROTO(YAP_BigNumOfTerm,(YAP_Term));
/* Term MkFloatTerm(double) */
extern X_API YAP_Term PROTO(YAP_MkFloatTerm,(double));
/* Term MkFloatTerm(YAP_Float) */
extern X_API YAP_Term PROTO(YAP_MkFloatTerm,(YAP_Float));
/* double FloatOfTerm(YAP_Term) */
extern X_API double PROTO(YAP_FloatOfTerm,(YAP_Term));
/* YAP_Float FloatOfTerm(YAP_Term) */
extern X_API YAP_Float PROTO(YAP_FloatOfTerm,(YAP_Term));
/* Term MkAtomTerm(Atom) */
extern X_API YAP_Term PROTO(YAP_MkAtomTerm,(YAP_Atom));
@ -151,11 +151,11 @@ extern X_API YAP_Term PROTO(YAP_HeadOfTerm,(YAP_Term));
/* Term TailOfTerm(Term) */
extern X_API YAP_Term PROTO(YAP_TailOfTerm,(YAP_Term));
/* YAP_Term MkApplTerm(YAP_Functor f, unsigned long int n, YAP_Term[] args) */
extern X_API YAP_Term PROTO(YAP_MkApplTerm,(YAP_Functor,int,YAP_Term *));
/* YAP_Term MkApplTerm(YAP_Functor f, unsigned int n, YAP_Term[] args) */
extern X_API YAP_Term PROTO(YAP_MkApplTerm,(YAP_Functor,unsigned int,YAP_Term *));
/* YAP_Term MkNewApplTerm(YAP_Functor f, unsigned long int n) */
extern X_API YAP_Term PROTO(YAP_MkNewApplTerm,(YAP_Functor,unsigned long int));
/* YAP_Term MkNewApplTerm(YAP_Functor f, unsigned int n) */
extern X_API YAP_Term PROTO(YAP_MkNewApplTerm,(YAP_Functor,unsigned int));
/* YAP_Functor YAP_FunctorOfTerm(Term) */
extern X_API YAP_Functor PROTO(YAP_FunctorOfTerm,(YAP_Term));
@ -164,13 +164,13 @@ extern X_API YAP_Functor PROTO(YAP_FunctorOfTerm,(YAP_Term));
extern X_API YAP_Term PROTO(YAP_ArgOfTerm,(unsigned int,YAP_Term));
/* YAP_Functor MkFunctor(YAP_Atom a,int arity) */
extern X_API YAP_Functor PROTO(YAP_MkFunctor,(YAP_Atom,unsigned long int));
extern X_API YAP_Functor PROTO(YAP_MkFunctor,(YAP_Atom,unsigned int));
/* YAP_Atom NameOfFunctor(Functor) */
extern X_API YAP_Atom PROTO(YAP_NameOfFunctor,(YAP_Functor));
/* unsigned long int YAP_ArityOfFunctor(Functor) */
extern X_API unsigned long int PROTO(YAP_ArityOfFunctor,(YAP_Functor));
/* unsigned unsigned int YAP_ArityOfFunctor(Functor) */
extern X_API unsigned int PROTO(YAP_ArityOfFunctor,(YAP_Functor));
/* void ExtraSpace(void) */
extern X_API void *PROTO(YAP_ExtraSpace,(void));
@ -182,14 +182,14 @@ extern X_API void *PROTO(YAP_ExtraSpace,(void));
extern X_API YAP_Bool PROTO(YAP_Unify,(YAP_Term, YAP_Term));
/* void UserCPredicate(char *name, int *fn(), int arity) */
extern X_API void PROTO(YAP_UserCPredicate,(char *, YAP_Bool (*)(void), unsigned long int));
extern X_API void PROTO(YAP_UserCPredicate,(char *, YAP_Bool (*)(void), unsigned int));
/* void UserCPredicateWithArgs(char *name, int *fn(), long int arity) */
extern X_API void PROTO(YAP_UserCPredicateWithArgs,(char *, YAP_Bool (*)(void), long int,long int));
/* void UserCPredicateWithArgs(char *name, int *fn(), unsigned int arity) */
extern X_API void PROTO(YAP_UserCPredicateWithArgs,(char *, YAP_Bool (*)(void), unsigned int,unsigned int));
/* void UserBackCPredicate(char *name, int *init(), int *cont(), int
arity, int extra) */
extern X_API void PROTO(YAP_UserBackCPredicate,(char *, YAP_Bool (*)(void), YAP_Bool (*)(void), unsigned long int, unsigned int));
extern X_API void PROTO(YAP_UserBackCPredicate,(char *, YAP_Bool (*)(void), YAP_Bool (*)(void), unsigned int, unsigned int));
/* void CallProlog(YAP_Term t) */
extern X_API YAP_Bool PROTO(YAP_CallProlog,(YAP_Term t));

View File

@ -40,6 +40,10 @@ typedef struct FunctorEntry *YAP_Functor;
typedef struct AtomEntry *YAP_Atom;
typedef long int YAP_Int;
typedef double YAP_Float;
#ifndef TRUE
#define TRUE 1
#endif

View File

@ -11,8 +11,11 @@
* File: errors.yap *
* comments: error messages for YAP *
* *
* Last rev: $Date: 2005-04-20 20:06:26 $,$Author: vsc $ *
* Last rev: $Date: 2005-05-25 18:18:02 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.63 2005/04/20 20:06:26 vsc
* try to improve error handling and warnings from within consults.
*
* Revision 1.62 2005/04/07 17:55:05 ricroc
* Adding tabling support for mixed strategy evaluation (batched and local scheduling)
* UPDATE: compilation flags -DTABLING_BATCHED_SCHEDULING and -DTABLING_LOCAL_SCHEDULING removed. To support tabling use -DTABLING in the Makefile or --enable-tabling in configure.
@ -113,10 +116,10 @@ print_message(Level, Mss) :-
( var(Msg) ; var(Info) ), !,
format(user_error,'% YAP: no handler for error ~w~n', [error(Msg,Info)]).
'$print_message'(error,error(syntax_error(A,B,C,D,E,F),_)) :- !,
'$output_error_location',
'$output_error_location'('\%'),
'$output_error_message'(syntax_error(A,B,C,D,E,F), 'SYNTAX ERROR').
'$print_message'(error,error(Msg,[Info|local_sp(Where,Envs,CPs)])) :-
'$output_error_location',
'$output_error_location'('\% ERROR:'),
'$prepare_loc'(Info,Where,Location),
'$output_error_message'(Msg, Location), !,
'$do_stack_dump'(Envs, CPs).
@ -131,26 +134,27 @@ print_message(Level, Mss) :-
true
).
'$print_message'(warning,M) :-
'$output_error_location',
format(user_error, '% ', []),
'$output_error_location'('!! WARNING:'),
format(user_error, '!! ', []),
'$do_print_message'(M),
format(user_error, '~n', []).
'$print_message'(help,M) :-
'$do_print_message'(M),
format(user_error, '~n', []).
'$output_error_location' :-
'$output_error_location'(MsgCodes) :-
get_value('$consulting_file',FileName),
FileName \= [],
FileName \= [], !,
'$start_line'(LN),
'$show_consult_level'(LC),
'$output_file_pos'(FileName,LN,LC),
'$output_file_pos'(FileName,LN,LC,MsgCodes),
format(user_error, '~*|', [LC]).
'$output_error_location'(_).
'$output_file_pos'(user_input,LN,LC) :- !,
format(user_error,'~*|% In user_input near line ~d,~n',[LC,LN]).
'$output_file_pos'(FileName,LN,LC) :-
format(user_error,'~*|% In file ~a, near line ~d,~n',[LC,FileName,LN]).
'$output_file_pos'(user_input,LN,LC,MsgCodes) :- !,
format(user_error,'~*|~a at user_input near line ~d,~n',[LC,MsgCodes,LN]).
'$output_file_pos'(FileName,LN,LC,MsgCodes) :-
format(user_error,'~*|~a at file ~a, near line ~d,~n',[LC,MsgCodes,FileName,LN]).
'$do_informational_message'(halt) :- !,
format(user_error, '% YAP execution halted~n', []).