diff --git a/C/absmi.c b/C/absmi.c index a2ed0d8cc..919bb9eaf 100755 --- a/C/absmi.c +++ b/C/absmi.c @@ -602,19 +602,18 @@ check_alarm_fail_int(int CONT USES_REGS) } UNLOCK(LOCAL_SignalLock); #endif - if (LOCAL_ActiveSignals & (YAP_FAIL_SIGNAL|YAP_INT_SIGNAL)) { - /* these should fail, INT should go up to top-level */ - if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) { + if (Yap_has_signals( YAP_INT_SIGNAL, YAP_FAIL_SIGNAL ) ) { + if (Yap_undo_signal( YAP_INT_SIGNAL ) ) { Yap_Error(PURE_ABORT, TermNil, "abort from console"); - } - LOCAL_ActiveSignals &= ~(YAP_FAIL_SIGNAL|YAP_INT_SIGNAL); - if (!LOCAL_ActiveSignals) { - /* no need to look into GC */ - CalculateStackGap( PASS_REGS1 ); } - // fail even if there are more signals, they will have to be dealt later. + (void)Yap_undo_signal( YAP_FAIL_SIGNAL ); return FALSE; } + if (!Yap_has_a_signal()) { + /* no need to look into GC */ + CalculateStackGap( PASS_REGS1 ); + } + // fail even if there are more signals, they will have to be dealt later. return -1; } @@ -622,8 +621,7 @@ static int stack_overflow( CELL *env, yamop *cp USES_REGS ) { if ((Int)(Unsigned(YREG) - Unsigned(HR)) < StackGap( PASS_REGS1 ) || - LOCAL_ActiveSignals & YAP_STOVF_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_STOVF_SIGNAL; + Yap_undo_signal( YAP_STOVF_SIGNAL )) { if (!Yap_gc(((PredEntry *)(S))->ArityOfPE, env, cp)) { Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); return 0; @@ -636,10 +634,9 @@ stack_overflow( CELL *env, yamop *cp USES_REGS ) static int code_overflow( CELL *yenv USES_REGS ) { - if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { + if (Yap_undo_signal( YAP_CDOVF_SIGNAL )) { CELL cut_b = LCL0-(CELL *)(S[E_CB]); - LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL; /* do a garbage collection first to check if we can recover memory */ if (!Yap_growheap(FALSE, 0, NULL)) { Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage); @@ -709,12 +706,9 @@ interrupt_handler( USES_REGS1 ) ARG1 = (Term) AbsPair(HR); HR += 2; - LOCK(LOCAL_SignalLock); #ifdef COROUTINING - if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) { + if (Yap_undo_signal( YAP_WAKEUP_SIGNAL )) { CalculateStackGap( PASS_REGS1 ); - LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL; - UNLOCK(LOCAL_SignalLock); ARG2 = Yap_ListOfWokenGoals(); pe = WakeUpCode; /* no more goals to wake up */ @@ -724,7 +718,6 @@ interrupt_handler( USES_REGS1 ) { CalculateStackGap( PASS_REGS1 ); pe = CreepCode; - UNLOCK(LOCAL_SignalLock); } P = pe->CodeOfPred; #ifdef LOW_LEVEL_TRACER @@ -797,23 +790,23 @@ interrupt_handler_either( USES_REGS1 ) //#define DEBUG_INTERRUPTS 1 #ifdef DEBUG_INTERRUPTS -static int trace_interrupts; +static int trace_interrupts = TRUE; #endif static int interrupt_fail( USES_REGS1 ) { #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif check_alarm_fail_int( FALSE PASS_REGS ); /* don't do debugging and stack expansion here: space will be recovered. automatically by fail, so better wait. */ - if (!LOCAL_ActiveSignals || - (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL))) { + if (!Yap_has_a_signal() || + Yap_has_signals( YAP_CDOVF_SIGNAL, YAP_CREEP_SIGNAL )) { return FALSE; } S = (CELL *)RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)); @@ -829,13 +822,13 @@ interrupt_execute( USES_REGS1 ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) return v; PP = P->u.pp.p0; - if ((PP->ExtraPredFlags & NoDebugPredFlag) && (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)) + if ((PP->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag)) && Yap_only_has_signal(YAP_CREEP_SIGNAL)) return 2; S = (CELL *) P->u.pp.p; SET_ASP(YENV, E_CB*sizeof(CELL)); @@ -850,14 +843,14 @@ interrupt_call( USES_REGS1 ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) return v; - // printf("%lx %p %p %lx\n", LOCAL_ActiveSignals, P->u.Osbpp.p, P->u.Osbpp.p0, P->u.Osbpp.p0->ExtraPredFlags); PP = P->u.Osbpp.p0; - if ((PP->ExtraPredFlags & NoDebugPredFlag) && (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL)) + if (Yap_only_has_signal(YAP_CREEP_SIGNAL) && + PP->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag) ) return 2; S = (CELL *) P->u.Osbpp.p; SET_ASP(YENV, P->u.Osbpp.s); @@ -872,13 +865,13 @@ interrupt_pexecute( PredEntry *pen USES_REGS ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; PP = NULL; - if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL) + if (Yap_only_has_signal(YAP_CREEP_SIGNAL)) return 2; /* keep on creeping */ S = (CELL *) pen; ASP = YENV; @@ -902,15 +895,15 @@ interrupt_deallocate( USES_REGS1 ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( TRUE PASS_REGS )) >= 0) return v; /* don't do a creep here; also, if our instruction is followed by a execute_c, just wait a bit more */ - if ( (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL) || + if ( Yap_only_has_signal( YAP_CREEP_SIGNAL ) || /* keep on going if there is something else */ (P->opc != Yap_opcode(_procceed) && P->opc != Yap_opcode(_cut_e))) { @@ -927,7 +920,7 @@ interrupt_deallocate( USES_REGS1 ) if (ASP > (CELL *)PROTECT_FROZEN_B(B)) ASP = (CELL *)PROTECT_FROZEN_B(B); if ((v = code_overflow(YENV PASS_REGS)) >= 0) return v; - if (LOCAL_ActiveSignals) { + if (Yap_has_a_signal()) { if (Yap_op_from_opcode(P->opc) == _cut_e) { /* followed by a cut */ ARG1 = MkIntegerTerm(LCL0-(CELL *)S[E_CB]); @@ -951,12 +944,13 @@ interrupt_cut( USES_REGS1 ) { int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; - if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) { + if (!Yap_has_a_signal() + || Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) { return 2; } /* find something to fool S */ @@ -971,12 +965,13 @@ interrupt_cut_t( USES_REGS1 ) { int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; - if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) { + if (!Yap_has_a_signal() + || Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) { return 2; } /* find something to fool S */ @@ -991,11 +986,15 @@ interrupt_commit_y( USES_REGS1 ) { int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; + if (!Yap_has_a_signal() + || Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) { + return 2; + } /* find something to fool S */ S = (CELL *)PredRestoreRegs; XREGS[0] = YENV[P->u.yps.y]; @@ -1008,12 +1007,13 @@ interrupt_commit_x( USES_REGS1 ) { int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; - if (!LOCAL_ActiveSignals || (LOCAL_ActiveSignals & (YAP_CDOVF_SIGNAL|YAP_CREEP_SIGNAL)) == LOCAL_ActiveSignals) { + if (!Yap_has_a_signal() + || Yap_only_has_signals(YAP_CDOVF_SIGNAL , YAP_CREEP_SIGNAL )) { return 2; } PP = P->u.xps.p0; @@ -1040,12 +1040,12 @@ interrupt_either( USES_REGS1 ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s:%d: (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif if ((v = check_alarm_fail_int( 2 PASS_REGS )) >= 0) return v; - if (LOCAL_ActiveSignals == YAP_CREEP_SIGNAL) + if (Yap_only_has_signal(YAP_CREEP_SIGNAL)) return 2; PP = P->u.Osblp.p0; /* find something to fool S */ @@ -1064,12 +1064,12 @@ interrupt_dexecute( USES_REGS1 ) int v; #ifdef DEBUG_INTERRUPTS - if (trace_interrupts) fprintf(stderr,"[%d] %s:%d: INTERRUPT %lx (YENV=%p ENV=%p ASP=%p)\n", (int)pthread_self(), \ - __FUNCTION__, __LINE__,LOCAL_ActiveSignals,YENV,ENV,ASP); + if (trace_interrupts) fprintf(stderr,"[%d] %lu--%lu %s/%d (YENV=%p ENV=%p ASP=%p)\n", worker_id, LOCAL_FirstActiveSignal, LOCAL_LastActiveSignal, \ + __FUNCTION__, __LINE__,YENV,ENV,ASP); #endif PP = P->u.pp.p0; - if ((LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) && - (PP->ExtraPredFlags & NoDebugPredFlag)) { + if (Yap_has_signal(YAP_CREEP_SIGNAL) && + (PP->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag))) { return 2; } /* set S for next instructions */ @@ -7400,7 +7400,7 @@ Yap_absmi(int inp) BOp(call_cpred, Osbpp); check_trail(TR); if (!(PREG->u.Osbpp.p->PredFlags & (SafePredFlag)) && - !(PREG->u.Osbpp.p0->ExtraPredFlags & (NoDebugPredFlag))) { + !(PREG->u.Osbpp.p0->ExtraPredFlags & (NoDebugPredFlag|HiddenPredFlag))) { CACHE_Y_AS_ENV(YREG); check_stack(NoStackCCall, HR); ENDCACHE_Y_AS_ENV(); @@ -8016,7 +8016,6 @@ Yap_absmi(int inp) FAIL(); } d0 = pe->ArityOfPE; - UNLOCKPE(19,pe); if (d0 == 0) { HR[1] = MkAtomTerm((Atom)(pe->FunctorOfPred)); } diff --git a/C/agc.c b/C/agc.c old mode 100644 new mode 100755 index 08a580d82..c966f3b3d --- a/C/agc.c +++ b/C/agc.c @@ -481,9 +481,9 @@ atom_gc(USES_REGS1) GLOBAL_agc_collected = 0; if (gc_trace) { - fprintf(GLOBAL_stderr, "%% agc:\n"); + fprintf(stderr, "%% agc:\n"); } else if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% Start of atom garbage collection %d:\n", GLOBAL_agc_calls); + fprintf(stderr, "%% Start of atom garbage collection %d:\n", GLOBAL_agc_calls); } time_start = Yap_cputime(); /* get the number of active registers */ @@ -499,11 +499,11 @@ atom_gc(USES_REGS1) GLOBAL_tot_agc_recovered += GLOBAL_agc_collected; if (gc_verbose) { #ifdef _WIN32 - fprintf(GLOBAL_stderr, "%% Collected %I64d bytes.\n", GLOBAL_agc_collected); + fprintf(stderr, "%% Collected %I64d bytes.\n", GLOBAL_agc_collected); #else - fprintf(GLOBAL_stderr, "%% Collected %lld bytes.\n", GLOBAL_agc_collected); + fprintf(stderr, "%% Collected %lld bytes.\n", GLOBAL_agc_collected); #endif - fprintf(GLOBAL_stderr, "%% GC %d took %g sec, total of %g sec doing GC so far.\n", GLOBAL_agc_calls, (double)agc_time/1000, (double)GLOBAL_tot_agc_time/1000); + fprintf(stderr, "%% GC %d took %g sec, total of %g sec doing GC so far.\n", GLOBAL_agc_calls, (double)agc_time/1000, (double)GLOBAL_tot_agc_time/1000); } } diff --git a/C/c_interface.c b/C/c_interface.c old mode 100644 new mode 100755 index b5dbed23e..0f8b3874b --- a/C/c_interface.c +++ b/C/c_interface.c @@ -893,7 +893,7 @@ YAP_LookupAtom(char *c) while (TRUE) { a = Yap_LookupAtom(c); - if (a == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) { + if (a == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) { if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage); } @@ -911,7 +911,7 @@ YAP_LookupWideAtom(wchar_t *c) while (TRUE) { a = Yap_LookupWideAtom(c); - if (a == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) { + if (a == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) { if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage); } @@ -929,7 +929,7 @@ YAP_FullLookupAtom(char *c) while (TRUE) { at = Yap_FullLookupAtom(c); - if (at == NIL || (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL)) { + if (at == NIL || Yap_has_signal(YAP_CDOVF_SIGNAL)) { if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage); } @@ -2949,7 +2949,7 @@ YAP_CompileClause(Term t) } YAPLeaveCriticalSection(); - if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { + if (Yap_has_signal( YAP_CDOVF_SIGNAL ) ) { if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage); } diff --git a/C/dbase.c b/C/dbase.c index 56c42f7b1..020a9b9bf 100755 --- a/C/dbase.c +++ b/C/dbase.c @@ -2515,7 +2515,7 @@ GetDBTerm(DBTerm *DBSP, int src USES_REGS) if (HR+NOf > ASP-EventFlag/sizeof(CELL)) { if (LOCAL_PrologMode & InErrorMode) { if (HR+NOf > ASP) - fprintf(GLOBAL_stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n"); + fprintf(stderr, "\n\n [ FATAL ERROR: No Stack for Error Handling ]\n"); Yap_exit( 1); } else { LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; @@ -4093,7 +4093,7 @@ MyEraseClause(DynamicClause *clau USES_REGS) Yap_FreeCodeSpace((char *)clau); #ifdef DEBUG if (ref->NOfRefsTo) - fprintf(GLOBAL_stderr, "Error: references to dynamic clause\n"); + fprintf(stderr, "Error: references to dynamic clause\n"); #endif RemoveDBEntry(ref PASS_REGS); } diff --git a/C/errors.c b/C/errors.c old mode 100644 new mode 100755 index c6abc4d64..9790dd765 --- a/C/errors.c +++ b/C/errors.c @@ -166,7 +166,7 @@ legal_env (CELL *ep USES_REGS) static int YapPutc(int sno, wchar_t ch) { - return (putc(ch, GLOBAL_stderr)); + return (putc(ch, stderr)); } static void @@ -1976,7 +1976,7 @@ E); } if (serious) { /* disable active signals at this point */ - LOCAL_ActiveSignals = 0; + LOCAL_FirstActiveSignal = LOCAL_LastActiveSignal = 0; CalculateStackGap( PASS_REGS1 ); LOCAL_PrologMode &= ~InErrorMode; LOCK(LOCAL_SignalLock); diff --git a/C/exec.c b/C/exec.c old mode 100644 new mode 100755 index 11052121e..597fbcd9b --- a/C/exec.c +++ b/C/exec.c @@ -159,15 +159,15 @@ do_execute(Term t, Term mod USES_REGS) /* first do predicate expansion, even before you process signals. This way you don't get to spy goal_expansion(). */ if (PRED_GOAL_EXPANSION_ALL) { - LOCK(LOCAL_SignalLock); /* disable creeping when we do goal expansion */ - if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) { - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); + if (!LOCAL_InterruptsDisabled && + Yap_undo_signal( YAP_CREEP_SIGNAL ) ) { CalculateStackGap( PASS_REGS1 ); } UNLOCK(LOCAL_SignalLock); return CallMetaCall(ARG1, mod PASS_REGS); - } else if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled && + } else if (Yap_has_a_signal() && + !LOCAL_InterruptsDisabled && !(LOCAL_PrologMode & (AbortMode|InterruptMode|SystemMode))) { return EnterCreepMode(t, mod PASS_REGS); } @@ -332,16 +332,16 @@ do_execute_n(Term t, Term mod, unsigned int n USES_REGS) return CallError(TYPE_ERROR_CALLABLE, t0, mod PASS_REGS); } if (PRED_GOAL_EXPANSION_ALL) { - LOCK(LOCAL_SignalLock); /* disable creeping when we do goal expansion */ - if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) { - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); + if (Yap_has_signal( YAP_CREEP_SIGNAL ) && + !LOCAL_InterruptsDisabled) { + Yap_undo_signal( YAP_CREEP_SIGNAL ); CalculateStackGap( PASS_REGS1 ); } - UNLOCK(LOCAL_SignalLock); t = copy_execn_to_heap(f, pt, n, arity, mod PASS_REGS); return CallMetaCall(t, mod PASS_REGS); - } else if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) { + } else if (Yap_has_a_signal() && + !LOCAL_InterruptsDisabled) { return EnterCreepMode(copy_execn_to_heap(f, pt, n, arity, CurrentModule PASS_REGS), mod PASS_REGS); } if (arity > MaxTemps) { @@ -379,12 +379,12 @@ static Int EnterCreepMode(Term t, Term mod USES_REGS) { PredEntry *PredCreep; - if (LOCAL_ActiveSignals & YAP_CDOVF_SIGNAL) { + if (Yap_has_signal( YAP_CDOVF_SIGNAL ) ) { ARG1 = t; if (!Yap_growheap(FALSE, 0, NULL)) { Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap at meta-call"); } - if (!LOCAL_ActiveSignals) { + if (!Yap_has_a_signal()) { return do_execute(ARG1, mod PASS_REGS); } } @@ -636,8 +636,7 @@ p_execute_clause( USES_REGS1 ) } else { code = Yap_ClauseFromTerm(clt)->ClCode; } - if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL)) { - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); + if (Yap_undo_signal(YAP_CREEP_SIGNAL)) { Yap_signal(YAP_CREEP_SIGNAL); } return CallPredicate(RepPredProp(pe), cut_cp, code PASS_REGS); @@ -652,18 +651,14 @@ p_execute_in_mod( USES_REGS1 ) static Int p_do_goal_expansion( USES_REGS1 ) { - Int creeping = LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL); + Int creeping = Yap_has_signal(YAP_CREEP_SIGNAL); Int out = FALSE; PredEntry *pe; Term cmod = Deref(ARG2); ARG2 = ARG3; - /* disable creeping */ - LOCK(LOCAL_SignalLock); - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); - if (!LOCAL_ActiveSignals) - CalculateStackGap( PASS_REGS1 ); - UNLOCK(LOCAL_SignalLock); + if (creeping) + Yap_undo_signal(YAP_CREEP_SIGNAL); /* CurMod:goal_expansion(A,B) */ if ( (pe = RepPredProp(Yap_GetPredPropByFunc(FunctorGoalExpansion2, cmod) ) ) && @@ -704,28 +699,23 @@ p_do_goal_expansion( USES_REGS1 ) out = TRUE; } complete: - LOCK(LOCAL_SignalLock); if (creeping) { - LOCAL_ActiveSignals |= YAP_CREEP_SIGNAL; + Yap_signal( YAP_CREEP_SIGNAL ); } - UNLOCK(LOCAL_SignalLock); return out; } static Int p_do_term_expansion( USES_REGS1 ) { - Int creeping = LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL); + Int creeping = Yap_has_signal(YAP_CREEP_SIGNAL); Int out = FALSE; PredEntry *pe; Term cmod = CurrentModule; /* disable creeping */ - LOCK(LOCAL_SignalLock); - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); - if (!LOCAL_ActiveSignals) - CalculateStackGap( PASS_REGS1 ); - UNLOCK(LOCAL_SignalLock); + if (creeping) + Yap_undo_signal(YAP_CREEP_SIGNAL); /* CurMod:term_expansion(A,B) */ if ( (pe = RepPredProp(Yap_GetPredPropByFunc(FunctorTermExpansion, cmod) ) ) && @@ -752,11 +742,9 @@ p_do_term_expansion( USES_REGS1 ) out = TRUE; } complete: - LOCK(LOCAL_SignalLock); if (creeping) { - LOCAL_ActiveSignals |= YAP_CREEP_SIGNAL; + Yap_signal(YAP_CREEP_SIGNAL); } - UNLOCK(LOCAL_SignalLock); return out; } @@ -768,7 +756,8 @@ p_execute0( USES_REGS1 ) unsigned int arity; Prop pe; - if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) { + if (Yap_has_a_signal() && + !LOCAL_InterruptsDisabled) { return EnterCreepMode(t, mod PASS_REGS); } restart_exec: @@ -898,8 +887,8 @@ p_execute_nonstop( USES_REGS1 ) /* N = arity; */ /* call may not define new system predicates!! */ if (RepPredProp(pe)->PredFlags & SpiedPredFlag) { - if (LOCAL_ActiveSignals & (YAP_CREEP_SIGNAL) && !LOCAL_InterruptsDisabled) { - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); + if (!LOCAL_InterruptsDisabled && + Yap_undo_signal(YAP_CREEP_SIGNAL)) { Yap_signal(YAP_CREEP_SIGNAL); } #if defined(YAPOR) || defined(THREADS) @@ -909,7 +898,7 @@ p_execute_nonstop( USES_REGS1 ) } #endif return CallPredicate(RepPredProp(pe), B, RepPredProp(pe)->cs.p_code.TrueCodeOfPred PASS_REGS); - } else { if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && + } else { if (Yap_has_signal( YAP_CREEP_SIGNAL ) && !LOCAL_InterruptsDisabled && (!(RepPredProp(pe)->PredFlags & (AsmPredFlag|CPredFlag)) || RepPredProp(pe)->OpcodeOfPred == Yap_opcode(_call_bfunc_xx))) { @@ -1087,7 +1076,7 @@ exec_absmi(int top USES_REGS) ASP = (CELL *)PROTECT_FROZEN_B(B); LOCK(LOCAL_SignalLock); /* forget any signals active, we're reborne */ - LOCAL_ActiveSignals = 0; + LOCAL_FirstActiveSignal = LOCAL_LastActiveSignal; CalculateStackGap( PASS_REGS1 ); LOCAL_PrologMode = UserMode; UNLOCK(LOCAL_SignalLock); @@ -1120,8 +1109,8 @@ exec_absmi(int top USES_REGS) YENV[E_CB] = Unsigned (B); out = Yap_absmi(0); /* make sure we don't leave a FAIL signal hanging around */ - LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; - if (!LOCAL_ActiveSignals) + Yap_undo_signal( YAP_FAIL_SIGNAL ); + if (!Yap_has_a_signal()) CalculateStackGap( PASS_REGS1 ); return out; } diff --git a/C/grow.c b/C/grow.c index 783b3e5c7..a4febce8f 100755 --- a/C/grow.c +++ b/C/grow.c @@ -92,7 +92,7 @@ static void SetHeapRegs(int copying_threads USES_REGS) { #ifdef undf7 - fprintf(GLOBAL_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, LOCAL_GlobalBase, H, LCL0, ASP); + Sfprintf(GLOBAL_stderr,"HeapBase = %x\tHeapTop=%x\nGlobalBase=%x\tGlobalTop=%x\nLocalBase=%x\tLocatTop=%x\n", Yap_HeapBase, HeapTop, LOCAL_GlobalBase, H, LCL0, ASP); #endif /* The old stack pointers */ LOCAL_OldLCL0 = LCL0; @@ -355,7 +355,7 @@ AdjustAppl(register CELL t0 USES_REGS) #ifdef DEBUG else { /* strange cell */ - /* fprintf(GLOBAL_stderr,"% garbage appl %lx found in stacks by stack shifter\n", t0);*/ + /* Sfprintf(GLOBAL_stderr,"% garbage appl %lx found in stacks by stack shifter\n", t0);*/ } #endif return(t0); @@ -373,7 +373,7 @@ AdjustPair(register CELL t0 USES_REGS) else if (IsHeapP(t)) return (AbsPair(CellPtoHeapAdjust(t))); #ifdef DEBUG - /* fprintf(GLOBAL_stderr,"% garbage pair %lx found in stacks by stack shifter\n", t0);*/ + /* Sfprintf(GLOBAL_stderr,"% garbage pair %lx found in stacks by stack shifter\n", t0);*/ #endif return(t0); } @@ -812,13 +812,13 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o LOCAL_heap_overflows++; if (gc_verbose) { #if defined(YAPOR_THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Database Overflow %d\n", LOCAL_heap_overflows); - fprintf(GLOBAL_stderr, "%% growing the heap %ld bytes\n", size); + Sfprintf(GLOBAL_stderr, "%% Database Overflow %d\n", LOCAL_heap_overflows); + Sfprintf(GLOBAL_stderr, "%% growing the heap %ld bytes\n", size); } /* CreepFlag is set to force heap expansion */ - if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { + if ( Yap_only_has_signal( YAP_CDOVF_SIGNAL) ) { LOCK(LOCAL_SignalLock); CalculateStackGap( PASS_REGS1 ); UNLOCK(LOCAL_SignalLock); @@ -858,8 +858,8 @@ static_growheap(long size, int fix_code, struct intermediates *cip, tr_fr_ptr *o growth_time = Yap_cputime()-start_growth_time; LOCAL_total_heap_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding Database\n", (double)LOCAL_total_heap_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding Database\n", (double)LOCAL_total_heap_overflow_time/1000); } return(TRUE); } @@ -958,10 +958,10 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) vb_msg2 = "Delay"; } #if defined(YAPOR_THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, LOCAL_delay_overflows); - fprintf(GLOBAL_stderr, "%% %cO growing the stacks %ld bytes\n", vb_msg1, size); + Sfprintf(GLOBAL_stderr, "%% %cO %s Overflow %d\n", vb_msg1, vb_msg2, LOCAL_delay_overflows); + Sfprintf(GLOBAL_stderr, "%% %cO growing the stacks %ld bytes\n", vb_msg1, size); } ASP -= 256; YAPEnterCriticalSection(); @@ -1042,8 +1042,8 @@ static_growglobal(long request, CELL **ptr, CELL *hsplit USES_REGS) growth_time = Yap_cputime()-start_growth_time; LOCAL_total_delay_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% %cO took %g sec\n", vb_msg1, (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% %cO Total of %g sec expanding stacks \n", vb_msg1, (double)LOCAL_total_delay_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% %cO took %g sec\n", vb_msg1, (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% %cO Total of %g sec expanding stacks \n", vb_msg1, (double)LOCAL_total_delay_overflow_time/1000); } LeaveGrowMode(GrowStackMode); if (hsplit) { @@ -1318,11 +1318,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol fix_tabling_info( PASS_REGS1 ); #endif /* TABLING */ if (sz >= sizeof(CELL) * K16) { - LOCK(LOCAL_SignalLock); - LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL; - if (!LOCAL_ActiveSignals) - CalculateStackGap( PASS_REGS1 ); - UNLOCK(LOCAL_SignalLock); + Yap_undo_signal( YAP_CDOVF_SIGNAL ); return TRUE; } /* failed */ @@ -1375,12 +1371,7 @@ growatomtable( USES_REGS1 ) if (nsize -AtomHashTableSize > 4*1024*1024) nsize = AtomHashTableSize+4*1024*1024+7919; - LOCK(LOCAL_SignalLock); - if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { - CalculateStackGap( PASS_REGS1 ); - } - LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL; - UNLOCK(LOCAL_SignalLock); + Yap_undo_signal( YAP_CDOVF_SIGNAL ); while ((ntb = (AtomHashEntry *)Yap_AllocCodeSpace(nsize*sizeof(AtomHashEntry))) == NULL) { /* leave for next time */ #if !USE_SYSTEM_MALLOC @@ -1391,10 +1382,10 @@ growatomtable( USES_REGS1 ) LOCAL_atom_table_overflows ++; if (gc_verbose) { #if defined(YAPOR_THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Atom Table Overflow %d\n", LOCAL_atom_table_overflows ); - fprintf(GLOBAL_stderr, "%% growing the atom table to %ld entries\n", (long int)(nsize)); + Sfprintf(GLOBAL_stderr, "%% Atom Table Overflow %d\n", LOCAL_atom_table_overflows ); + Sfprintf(GLOBAL_stderr, "%% growing the atom table to %ld entries\n", (long int)(nsize)); } YAPEnterCriticalSection(); init_new_table(ntb, nsize); @@ -1406,8 +1397,8 @@ growatomtable( USES_REGS1 ) growth_time = Yap_cputime()-start_growth_time; LOCAL_total_atom_table_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding atom table \n", (double)LOCAL_total_atom_table_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding atom table \n", (double)LOCAL_total_atom_table_overflow_time/1000); } #if USE_SYSTEM_MALLOC return TRUE; @@ -1435,14 +1426,9 @@ Yap_growheap(int fix_code, size_t in_size, void *cip) #if (THREADS) || YAPOR res = FALSE; if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) { - LOCK(LOCAL_SignalLock); - if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { - CalculateStackGap( PASS_REGS1 ); - } - LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL; - UNLOCK(LOCAL_SignalLock); - return TRUE; - } + Yap_undo_signal( YAP_CDOVF_SIGNAL ); + return TRUE; + } #else if (NOfAtoms > 2*AtomHashTableSize || blob_overflow) { UInt n = NOfAtoms; @@ -1455,12 +1441,7 @@ Yap_growheap(int fix_code, size_t in_size, void *cip) NOfAtoms+1 > 2*AtomHashTableSize)) { res = growatomtable( PASS_REGS1 ); } else { - LOCK(LOCAL_SignalLock); - if (LOCAL_ActiveSignals == YAP_CDOVF_SIGNAL) { - CalculateStackGap( PASS_REGS1 ); - } - LOCAL_ActiveSignals &= ~YAP_CDOVF_SIGNAL; - UNLOCK(LOCAL_SignalLock); + Yap_undo_signal( YAP_CDOVF_SIGNAL ); return TRUE; } LeaveGrowMode(GrowHeapMode); @@ -1660,22 +1641,22 @@ growstack(size_t size USES_REGS) LOCAL_stack_overflows++; if (gc_verbose) { #if defined(YAPOR) || defined(THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); - fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR); - fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); - fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", + Sfprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); + Sfprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR); + Sfprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); + Sfprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); - fprintf(GLOBAL_stderr, "%% Growing the stacks " UInt_FORMAT " bytes\n", (UInt) size); + Sfprintf(GLOBAL_stderr, "%% Growing the stacks " UInt_FORMAT " bytes\n", (UInt) size); } if (!execute_growstack(size, FALSE, FALSE, NULL, NULL, NULL PASS_REGS)) return FALSE; growth_time = Yap_cputime()-start_growth_time; LOCAL_total_stack_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); } return TRUE; } @@ -1698,14 +1679,14 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep) LOCAL_stack_overflows++; if (gc_verbose) { #if defined(YAPOR) || defined(THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); - fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR); - fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); - fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", + Sfprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); + Sfprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,HR); + Sfprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); + Sfprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); - fprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", (unsigned long int)size); + Sfprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", (unsigned long int)size); } if (!execute_growstack(size, FALSE, TRUE, old_trp, tksp, vep PASS_REGS)) { LeaveGrowMode(GrowStackMode); @@ -1714,8 +1695,8 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep) growth_time = Yap_cputime()-start_growth_time; LOCAL_total_stack_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); } LeaveGrowMode(GrowStackMode); return TRUE; @@ -1746,16 +1727,16 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr LOCAL_trail_overflows++; if (gc_verbose) { #if defined(YAPOR) || defined(THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Trail Overflow %d\n", LOCAL_trail_overflows); + Sfprintf(GLOBAL_stderr, "%% Trail Overflow %d\n", LOCAL_trail_overflows); #if USE_SYSTEM_MALLOC - fprintf(GLOBAL_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,HR); - fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); - fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", + Sfprintf(GLOBAL_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(HR-(CELL *)LOCAL_GlobalBase),(CELL *)LOCAL_GlobalBase,HR); + Sfprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); + Sfprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); #endif - fprintf(GLOBAL_stderr, "%% growing the trail %ld bytes\n", size); + Sfprintf(GLOBAL_stderr, "%% growing the trail %ld bytes\n", size); } LOCAL_ErrorMessage = NULL; if (!GLOBAL_AllowTrailExpansion) { @@ -1788,15 +1769,10 @@ static int do_growtrail(long size, int contiguous_only, int in_parser, tr_fr_ptr growth_time = Yap_cputime()-start_growth_time; LOCAL_total_trail_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding trail \n", (double)LOCAL_total_trail_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding trail \n", (double)LOCAL_total_trail_overflow_time/1000); } - LOCK(LOCAL_SignalLock); - if (LOCAL_ActiveSignals == YAP_TROVF_SIGNAL) { - CalculateStackGap( PASS_REGS1 ); - } - LOCAL_ActiveSignals &= ~YAP_TROVF_SIGNAL; - UNLOCK(LOCAL_SignalLock); + Yap_undo_signal( YAP_TROVF_SIGNAL ); return TRUE; } @@ -1923,13 +1899,13 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental) LOCAL_stack_overflows++; if (gc_verbose) { #if defined(YAPOR) || defined(THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + Sfprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); - fprintf(GLOBAL_stderr, "%% Stack: %8ld cells (%p-%p)\n", (unsigned long int)(LCL0-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,LCL0); - fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", + Sfprintf(GLOBAL_stderr, "%% Stack Overflow %d\n", LOCAL_stack_overflows); + Sfprintf(GLOBAL_stderr, "%% Stack: %8ld cells (%p-%p)\n", (unsigned long int)(LCL0-(CELL *)LOCAL_GlobalBase),LOCAL_GlobalBase,LCL0); + Sfprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); - fprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", diff); + Sfprintf(GLOBAL_stderr, "%% Growing the stacks %ld bytes\n", diff); } LOCAL_GDiff = LOCAL_GDiff0 = LOCAL_DelayDiff = LOCAL_BaseDiff = (newq-oldq); LOCAL_TrDiff = LOCAL_LDiff = diff + LOCAL_GDiff; @@ -1955,8 +1931,8 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, int incremental) growth_time = Yap_cputime()-start_growth_time; LOCAL_total_stack_overflow_time += growth_time; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); - fprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); + Sfprintf(GLOBAL_stderr, "%% took %g sec\n", (double)growth_time/1000); + Sfprintf(GLOBAL_stderr, "%% Total of %g sec expanding stacks \n", (double)LOCAL_total_stack_overflow_time/1000); } } diff --git a/C/heapgc.c b/C/heapgc.c old mode 100644 new mode 100755 index a1d29d0b4..247b41253 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -1021,17 +1021,17 @@ inc_vars_of_type(CELL *curr,gc_types val) { static void put_type_info(unsigned long total) { - fprintf(GLOBAL_stderr,"%% type info for %lu cells\n", total); - fprintf(GLOBAL_stderr,"%% %lu vars\n", vars[gc_var]); - fprintf(GLOBAL_stderr,"%% %lu refs\n", vars[gc_ref]); - fprintf(GLOBAL_stderr,"%% %lu references from env\n", env_vars); - fprintf(GLOBAL_stderr,"%% %lu atoms\n", vars[gc_atom]); - fprintf(GLOBAL_stderr,"%% %lu small ints\n", vars[gc_int]); - fprintf(GLOBAL_stderr,"%% %lu other numbers\n", vars[gc_num]); - fprintf(GLOBAL_stderr,"%% %lu lists\n", vars[gc_list]); - fprintf(GLOBAL_stderr,"%% %lu compound terms\n", vars[gc_appl]); - fprintf(GLOBAL_stderr,"%% %lu functors\n", vars[gc_func]); - fprintf(GLOBAL_stderr,"%% %lu suspensions\n", vars[gc_susp]); + fprintf(stderr,"%% type info for %lu cells\n", total); + fprintf(stderr,"%% %lu vars\n", vars[gc_var]); + fprintf(stderr,"%% %lu refs\n", vars[gc_ref]); + fprintf(stderr,"%% %lu references from env\n", env_vars); + fprintf(stderr,"%% %lu atoms\n", vars[gc_atom]); + fprintf(stderr,"%% %lu small ints\n", vars[gc_int]); + fprintf(stderr,"%% %lu other numbers\n", vars[gc_num]); + fprintf(stderr,"%% %lu lists\n", vars[gc_list]); + fprintf(stderr,"%% %lu compound terms\n", vars[gc_appl]); + fprintf(stderr,"%% %lu functors\n", vars[gc_func]); + fprintf(stderr,"%% %lu suspensions\n", vars[gc_susp]); } static void @@ -1269,7 +1269,7 @@ mark_variable(CELL_PTR current USES_REGS) goto begin; #ifdef DEBUG } else if (next < (CELL *)LOCAL_GlobalBase || next > (CELL *)LOCAL_TrailTop) { - fprintf(GLOBAL_stderr, "OOPS in GC: marking, current=%p, *current=" UInt_FORMAT " next=%p\n", current, ccur, next); + fprintf(stderr, "OOPS in GC: marking, current=%p, *current=" UInt_FORMAT " next=%p\n", current, ccur, next); #endif } else { #ifdef COROUTING @@ -1576,7 +1576,7 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap USES_REGS) // printf("MARK %p--%p\n", gc_ENV, gc_ENV-size); #ifdef DEBUG if (size < 0 || size > 512) - fprintf(GLOBAL_stderr,"OOPS in GC: env size for %p is " UInt_FORMAT "\n", gc_ENV, (CELL)size); + fprintf(stderr,"OOPS in GC: env size for %p is " UInt_FORMAT "\n", gc_ENV, (CELL)size); #endif mark_db_fixed((CELL *)gc_ENV[E_CP] PASS_REGS); /* for each saved variable */ @@ -1654,14 +1654,14 @@ mark_environments(CELL_PTR gc_ENV, OPREG size, CELL *pvbmap USES_REGS) PredEntry *pe = EnvPreg(gc_ENV[E_CP]); op_numbers op = Yap_op_from_opcode(ENV_ToOp(gc_ENV[E_CP])); #if defined(ANALYST) || defined(DEBUG) - fprintf(GLOBAL_stderr,"ENV %p-%p(%d) %s\n", gc_ENV, pvbmap, size-EnvSizeInCells, Yap_op_names[op]); + fprintf(stderr,"ENV %p-%p(%d) %s\n", gc_ENV, pvbmap, size-EnvSizeInCells, Yap_op_names[op]); #else - fprintf(GLOBAL_stderr,"ENV %p-%p(%d) %d\n", gc_ENV, pvbmap, size-EnvSizeInCells, (int)op); + fprintf(stderr,"ENV %p-%p(%d) %d\n", gc_ENV, pvbmap, size-EnvSizeInCells, (int)op); #endif if (pe->ArityOfPE) - fprintf(GLOBAL_stderr," %s/%d\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE); + fprintf(stderr," %s/%d\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE); else - fprintf(GLOBAL_stderr," %s\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE); + fprintf(stderr," %s\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE); } #endif gc_ENV = (CELL_PTR) gc_ENV[E_E]; /* link to prev @@ -1791,7 +1791,7 @@ mark_trail(tr_fr_ptr trail_ptr, tr_fr_ptr trail_base, CELL *gc_H, choiceptr gc_B } #ifdef DEBUG else - fprintf(GLOBAL_stderr,"OOPS in GC: weird trail entry at %p:" UInt_FORMAT "\n", &TrailTerm(trail_base), (CELL)cptr); + fprintf(stderr,"OOPS in GC: weird trail entry at %p:" UInt_FORMAT "\n", &TrailTerm(trail_base), (CELL)cptr); #endif } } @@ -2031,19 +2031,19 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose PredEntry *pe = Yap_PredForChoicePt(gc_B); #if defined(ANALYST) || DEBUG if (pe == NULL) { - fprintf(GLOBAL_stderr,"%% marked " UInt_FORMAT " (%s)\n", LOCAL_total_marked, Yap_op_names[opnum]); + fprintf(stderr,"%% marked " UInt_FORMAT " (%s)\n", LOCAL_total_marked, Yap_op_names[opnum]); } else if (pe->ArityOfPE) { - fprintf(GLOBAL_stderr,"%% %s/" UInt_FORMAT " marked " UInt_FORMAT " (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]); + fprintf(stderr,"%% %s/" UInt_FORMAT " marked " UInt_FORMAT " (%s)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, pe->ArityOfPE, LOCAL_total_marked, Yap_op_names[opnum]); } else { - fprintf(GLOBAL_stderr,"%% %s marked " UInt_FORMAT " (%s)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, Yap_op_names[opnum]); + fprintf(stderr,"%% %s marked " UInt_FORMAT " (%s)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, Yap_op_names[opnum]); } #else if (pe == NULL) { - fprintf(GLOBAL_stderr,"%% marked " Int_FORMAT " (%u)\n", LOCAL_total_marked, (unsigned int)opnum); + fprintf(stderr,"%% marked " Int_FORMAT " (%u)\n", LOCAL_total_marked, (unsigned int)opnum); } else if (pe->ArityOfPE) { - fprintf(GLOBAL_stderr,"%% %s/%lu marked " Int_FORMAT " (%u)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, (unsigned long int)pe->ArityOfPE, LOCAL_total_marked, (unsigned int)opnum); + fprintf(stderr,"%% %s/%lu marked " Int_FORMAT " (%u)\n", RepAtom(NameOfFunctor(pe->FunctorOfPred))->StrOfAE, (unsigned long int)pe->ArityOfPE, LOCAL_total_marked, (unsigned int)opnum); } else { - fprintf(GLOBAL_stderr,"%% %s marked " Int_FORMAT " (%u)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, (unsigned int)opnum); + fprintf(stderr,"%% %s marked " Int_FORMAT " (%u)\n", RepAtom((Atom)(pe->FunctorOfPred))->StrOfAE, LOCAL_total_marked, (unsigned int)opnum); } #endif } @@ -2378,7 +2378,7 @@ mark_choicepoints(register choiceptr gc_B, tr_fr_ptr saved_TR, int very_verbose nargs = rtp->u.Otapl.s; break; default: - fprintf(GLOBAL_stderr, "OOPS in GC: Unexpected opcode: %d\n", opnum); + fprintf(stderr, "OOPS in GC: Unexpected opcode: %d\n", opnum); nargs = 0; #else default: @@ -2842,27 +2842,27 @@ sweep_trail(choiceptr gc_B, tr_fr_ptr old_TR USES_REGS) LOCAL_new_TR = dest; if (is_gc_verbose()) { if (old_TR != (tr_fr_ptr)LOCAL_TrailBase) - fprintf(GLOBAL_stderr, + fprintf(stderr, "%% Trail: discarded %d (%ld%%) cells out of %ld\n", LOCAL_discard_trail_entries, (unsigned long int)(LOCAL_discard_trail_entries*100/(old_TR-(tr_fr_ptr)LOCAL_TrailBase)), (unsigned long int)(old_TR-(tr_fr_ptr)LOCAL_TrailBase)); #ifdef DEBUG if (hp_entrs > 0) - fprintf(GLOBAL_stderr, + fprintf(stderr, "%% Trail: unmarked %ld dbentries (%ld%%) out of %ld\n", (long int)hp_not_in_use, (long int)(hp_not_in_use*100/hp_entrs), (long int)hp_entrs); if (hp_in_use_erased > 0 && hp_erased > 0) - fprintf(GLOBAL_stderr, + fprintf(stderr, "%% Trail: deleted %ld dbentries (%ld%%) out of %ld\n", (long int)hp_erased, (long int)(hp_erased*100/(hp_erased+hp_in_use_erased)), (long int)(hp_erased+hp_in_use_erased)); #endif if (OldHeapUsed) { - fprintf(GLOBAL_stderr, + fprintf(stderr, "%% Heap: recovered %ld bytes (%ld%%) out of %ld\n", (unsigned long int)(OldHeapUsed-HeapUsed), (unsigned long int)((OldHeapUsed-HeapUsed)/(OldHeapUsed/100)), @@ -3030,7 +3030,7 @@ sweep_choicepoints(choiceptr gc_B USES_REGS) restart_cp: /* - * fprintf(GLOBAL_stderr,"sweeping cps: %x, %x, %x\n", + * fprintf(stderr,"sweeping cps: %x, %x, %x\n", * *gc_B,CP_Extra(gc_B),CP_Nargs(gc_B)); */ /* any choice point */ @@ -3521,12 +3521,12 @@ compact_heap( USES_REGS1 ) #ifdef DEBUG if (dest != start_from-1) - fprintf(GLOBAL_stderr,"%% Bad Dest (%lu): %p should be %p\n", + fprintf(stderr,"%% Bad Dest (%lu): %p should be %p\n", (unsigned long int)LOCAL_GcCalls, dest, start_from-1); if (LOCAL_total_marked != found_marked) - fprintf(GLOBAL_stderr,"%% Upward (%lu): %lu total against %lu found\n", + fprintf(stderr,"%% Upward (%lu): %lu total against %lu found\n", (unsigned long int)LOCAL_GcCalls, (unsigned long int)LOCAL_total_marked, (unsigned long int)found_marked); @@ -3595,7 +3595,7 @@ compact_heap( USES_REGS1 ) } #ifdef DEBUG if (LOCAL_total_marked != found_marked) - fprintf(GLOBAL_stderr,"%% Downward (%lu): %lu total against %lu found\n", + fprintf(stderr,"%% Downward (%lu): %lu total against %lu found\n", (unsigned long int)LOCAL_GcCalls, (unsigned long int)LOCAL_total_marked, (unsigned long int)found_marked); @@ -3704,12 +3704,12 @@ icompact_heap( USES_REGS1 ) #ifdef DEBUG if (dest != H0-1) - fprintf(GLOBAL_stderr,"%% Bad Dest (%lu): %p should be %p\n", + fprintf(stderr,"%% Bad Dest (%lu): %p should be %p\n", (unsigned long int)LOCAL_GcCalls, dest, H0-1); if (LOCAL_total_marked != found_marked) - fprintf(GLOBAL_stderr,"%% Upward (%lu): %lu total against %lu found\n", + fprintf(stderr,"%% Upward (%lu): %lu total against %lu found\n", (unsigned long int)LOCAL_GcCalls, (unsigned long int)LOCAL_total_marked, (unsigned long int)found_marked); @@ -3767,12 +3767,12 @@ icompact_heap( USES_REGS1 ) } #ifdef DEBUG if (H0+LOCAL_total_marked != dest) - fprintf(GLOBAL_stderr,"%% Downward (%lu): %p total against %p found\n", + fprintf(stderr,"%% Downward (%lu): %p total against %p found\n", (unsigned long int)LOCAL_GcCalls, H0+LOCAL_total_marked, dest); if (LOCAL_total_marked != found_marked) - fprintf(GLOBAL_stderr,"%% Downward (%lu): %lu total against %lu found\n", + fprintf(stderr,"%% Downward (%lu): %lu total against %lu found\n", (unsigned long int)LOCAL_GcCalls, (unsigned long int)LOCAL_total_marked, (unsigned long int)found_marked); @@ -3895,12 +3895,12 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS) -LOCAL_total_smarked #endif != LOCAL_iptop-(CELL_PTR *)H && LOCAL_iptop < (CELL_PTR *)ASP -1024) - fprintf(GLOBAL_stderr,"%% Oops on LOCAL_iptop-H (%ld) vs %ld\n", (unsigned long int)(LOCAL_iptop-(CELL_PTR *)HR), LOCAL_total_marked); + fprintf(stderr,"%% Oops on LOCAL_iptop-H (%ld) vs %ld\n", (unsigned long int)(LOCAL_iptop-(CELL_PTR *)HR), LOCAL_total_marked); */ #endif #if DEBUGX int effectiveness = (((H-H0)-LOCAL_total_marked)*100)/(H-H0); - fprintf(GLOBAL_stderr,"%% using pointers (%d)\n", effectiveness); + fprintf(stderr,"%% using pointers (%d)\n", effectiveness); #endif if (CurrentH0) { H0 = CurrentH0; @@ -3978,15 +3978,15 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) if (Yap_GetValue(AtomGcTrace) != TermNil) gc_trace = 1; if (gc_trace) { - fprintf(GLOBAL_stderr, "%% gc\n"); + fprintf(stderr, "%% gc\n"); } else if (gc_verbose) { #if defined(YAPOR) || defined(THREADS) - fprintf(GLOBAL_stderr, "%% Worker Id %d:\n", worker_id); + fprintf(stderr, "%% Worker Id %d:\n", worker_id); #endif - fprintf(GLOBAL_stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls); - fprintf(GLOBAL_stderr, "%% Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,HR); - fprintf(GLOBAL_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); - fprintf(GLOBAL_stderr, "%% Trail:%8ld cells (%p-%p)\n", + fprintf(stderr, "%% Start of garbage collection %lu:\n", (unsigned long int)LOCAL_GcCalls); + fprintf(stderr, "%% Global: %8ld cells (%p-%p)\n", (long int)heap_cells,H0,HR); + fprintf(stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP); + fprintf(stderr, "%% Trail:%8ld cells (%p-%p)\n", (unsigned long int)(TR-(tr_fr_ptr)LOCAL_TrailBase),LOCAL_TrailBase,TR); } #if !USE_SYSTEM_MALLOC @@ -4105,21 +4105,21 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) } else effectiveness = 0; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% Mark: Marked %ld cells of %ld (efficiency: %ld%%) in %g sec\n", + fprintf(stderr, "%% Mark: Marked %ld cells of %ld (efficiency: %ld%%) in %g sec\n", (long int)tot, (long int)heap_cells, (long int)effectiveness, (double)(m_time-time_start)/1000); if (LOCAL_HGEN-H0) - fprintf(GLOBAL_stderr,"%% previous generation has size " UInt_FORMAT ", with " UInt_FORMAT " (" UInt_FORMAT "%%) unmarked\n", (UInt)(LOCAL_HGEN-H0), (UInt)((LOCAL_HGEN-H0)-LOCAL_total_oldies), (UInt)(100*((LOCAL_HGEN-H0)-LOCAL_total_oldies)/(LOCAL_HGEN-H0))); + fprintf(stderr,"%% previous generation has size " UInt_FORMAT ", with " UInt_FORMAT " (" UInt_FORMAT "%%) unmarked\n", (UInt)(LOCAL_HGEN-H0), (UInt)((LOCAL_HGEN-H0)-LOCAL_total_oldies), (UInt)(100*((LOCAL_HGEN-H0)-LOCAL_total_oldies)/(LOCAL_HGEN-H0))); #ifdef INSTRUMENT_GC { int i; for (i=0; i<16; i++) { if (chain[i]) { - fprintf(GLOBAL_stderr, "%% chain[%d]=%lu\n", i, chain[i]); + fprintf(stderr, "%% chain[%d]=%lu\n", i, chain[i]); } } put_type_info((unsigned long int)tot); - fprintf(GLOBAL_stderr,"%% %lu/%ld before and %lu/%ld after\n", old_vars, (unsigned long int)(B->cp_h-H0), new_vars, (unsigned long int)(H-B->cp_h)); - fprintf(GLOBAL_stderr,"%% %ld choicepoints\n", num_bs); + fprintf(stderr,"%% %lu/%ld before and %lu/%ld after\n", old_vars, (unsigned long int)(B->cp_h-H0), new_vars, (unsigned long int)(H-B->cp_h)); + fprintf(stderr,"%% %ld choicepoints\n", num_bs); } #endif } @@ -4128,7 +4128,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) TR = old_TR; pop_registers(predarity, nextop PASS_REGS); TR = LOCAL_new_TR; - /* fprintf(GLOBAL_stderr,"NEW LOCAL_HGEN %ld (%ld)\n", H-H0, LOCAL_HGEN-H0);*/ + /* fprintf(stderr,"NEW LOCAL_HGEN %ld (%ld)\n", H-H0, LOCAL_HGEN-H0);*/ { Term t = MkVarTerm(); Yap_UpdateTimedVar(LOCAL_GcGeneration, t); @@ -4136,14 +4136,14 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS) Yap_UpdateTimedVar(LOCAL_GcPhase, MkIntegerTerm(LOCAL_GcCurrentPhase)); c_time = Yap_cputime(); if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% Compress: took %g sec\n", (double)(c_time-time_start)/1000); + fprintf(stderr, "%% Compress: took %g sec\n", (double)(c_time-time_start)/1000); } gc_time += (c_time-time_start); LOCAL_TotGcTime += gc_time; LOCAL_TotGcRecovered += heap_cells-tot; if (gc_verbose) { - fprintf(GLOBAL_stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000); - fprintf(GLOBAL_stderr, "%% Left %ld cells free in stacks.\n", + fprintf(stderr, "%% GC %lu took %g sec, total of %g sec doing GC so far.\n", (unsigned long int)LOCAL_GcCalls, (double)gc_time/1000, (double)LOCAL_TotGcTime/1000); + fprintf(stderr, "%% Left %ld cells free in stacks.\n", (unsigned long int)(ASP-HR)); } check_global(); diff --git a/C/iopreds.c b/C/iopreds.c index b35405a26..314dd5114 100755 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -195,8 +195,8 @@ int Yap_DebugPutc(int sno, wchar_t ch) { if (GLOBAL_Option['l' - 96]) - (void) putc(ch, GLOBAL_logfile); - return (putc(ch, GLOBAL_stderr)); + (void) Sputc(ch, GLOBAL_logfile); + return (Sputc(ch, GLOBAL_stderr)); } void diff --git a/C/parser.c b/C/parser.c old mode 100644 new mode 100755 index eb8ba1e95..7c920c530 --- a/C/parser.c +++ b/C/parser.c @@ -128,7 +128,7 @@ Yap_LookupVar(char *var) /* lookup variable in variables table */ #if DEBUG if (GLOBAL_Option[4]) - fprintf(GLOBAL_stderr,"[LookupVar %s]", var); + fprintf(stderr,"[LookupVar %s]", var); #endif if (var[0] != '_' || var[1] != '\0') { VarEntry **op = &LOCAL_VarTable; diff --git a/C/pl-yap.c b/C/pl-yap.c index 36f76eb25..d6211cc8d 100755 --- a/C/pl-yap.c +++ b/C/pl-yap.c @@ -1173,7 +1173,7 @@ PL_w32thread_raise(DWORD id, int sig) handling in the Win32 platform. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -static int thread_highest_id = 1; +static int thread_highest_id = 0; X_API int PL_w32thread_raise(DWORD id, int sig) @@ -1182,18 +1182,20 @@ PL_w32thread_raise(DWORD id, int sig) if ( sig < 0 || sig > MAXSIGNAL ) return FALSE; /* illegal signal */ - LOCK(); - for(i = 1; i <= thread_highest_id; i++) - { PL_thread_info_t *info = GD->thread.threads[i]; + LOCK(); + for(i = 0; i <= thread_highest_id; i++) + { PL_thread_info_t *info = GD->thread.threads[i]; - if ( info && info->w32id == id && info->thread_data ) - { Yap_signal(sig); //raiseSignal(info->thread_data, sig); - if ( info->w32id ) - PostThreadMessage(info->w32id, WM_SIGNALLED, 0, 0L); - UNLOCK(); - DEBUG(1, Sdprintf("Signalled %d to thread %d\n", sig, i)); - return TRUE; - } + if ( info && info->w32id == id && info->thread_data ) + { + Sfprintf(GLOBAL_stderr, "post %d %d\n\n\n",i, sig); + Yap_external_signal(i, sig); //raiseSignal(info->thread_data, sig); + if ( info->w32id ) + PostThreadMessage(info->w32id, WM_SIGNALLED, 0, 0L); + UNLOCK(); + DEBUG(1, Sdprintf("Signalled %d to thread %d\n", sig, i)); + return TRUE; + } } UNLOCK(); @@ -1514,7 +1516,7 @@ PL_thread_info_t * SWI_thread_info(int tid, PL_thread_info_t *info) { if (info) - REMOTE_PL_local_data_p(tid)->thread.info = info; + GD->thread.threads[tid] = REMOTE_PL_local_data_p(tid)->thread.info = info; return REMOTE_PL_local_data_p(tid)->thread.info; } diff --git a/C/scanner.c b/C/scanner.c old mode 100644 new mode 100755 index 22a2fe641..4c9e428ea --- a/C/scanner.c +++ b/C/scanner.c @@ -1452,12 +1452,12 @@ Yap_tokenizer(IOSTREAM *inp_stream, int store_comments, Term *tposp, void *rd0) default: #if DEBUG - fprintf(GLOBAL_stderr, "\n++++ token: wrong char type %c %d\n", ch, chtype(ch)); + fprintf(stderr, "\n++++ token: wrong char type %c %d\n", ch, chtype(ch)); #endif t->Tok = Ord(kind = eot_tok); } #if DEBUG - if(GLOBAL_Option[2]) fprintf(GLOBAL_stderr,"[Token %d %ld]",Ord(kind),(unsigned long int)t->TokInfo); + if(GLOBAL_Option[2]) fprintf(stderr,"[Token %d %ld]",Ord(kind),(unsigned long int)t->TokInfo); #endif if (LOCAL_ErrorMessage) { /* insert an error token to inform the system of what happened */ diff --git a/C/signals.c b/C/signals.c old mode 100644 new mode 100755 index f7fff7044..c237765e2 --- a/C/signals.c +++ b/C/signals.c @@ -38,27 +38,67 @@ static char SccsId[] = "%W% %G%"; #include inline static void -do_signal(yap_signals sig USES_REGS) +do_signal(int wid, yap_signals sig USES_REGS) { - LOCK(LOCAL_SignalLock); - if (!LOCAL_InterruptsDisabled) { - CreepFlag = Unsigned(LCL0); + LOCK(REMOTE_SignalLock(wid)); + if (!REMOTE_InterruptsDisabled(wid)) { + REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ = + Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_); if (sig != YAP_CREEP_SIGNAL) - EventFlag = Unsigned(LCL0); + REMOTE_ThreadHandle(wid).current_yaam_regs->EventFlag_ = + Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_); } - LOCAL_ActiveSignals |= sig; - UNLOCK(LOCAL_SignalLock); + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig == LOCAL_ActiveSignals[i]) { + UNLOCK(REMOTE_SignalLock(wid)); + return; + } + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } + LOCAL_ActiveSignals[i] = sig; + LOCAL_LastActiveSignal++; + if (LOCAL_LastActiveSignal == LOCAL_MaxActiveSignals) + LOCAL_LastActiveSignal = 0; + UNLOCK(REMOTE_SignalLock(wid)); + } -inline static void +inline static int undo_signal(yap_signals sig USES_REGS) { LOCK(LOCAL_SignalLock); - if ((LOCAL_ActiveSignals & ~(YAP_CREEP_SIGNAL)) == sig) { + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig == LOCAL_ActiveSignals[i]) + break; + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } + if (i == LOCAL_LastActiveSignal) { + UNLOCK(LOCAL_SignalLock); + return FALSE; + } + while ((i+1) % LOCAL_MaxActiveSignals != LOCAL_LastActiveSignal) { + LOCAL_ActiveSignals[i] = LOCAL_ActiveSignals[(i+1) % LOCAL_MaxActiveSignals]; + i++; + } + if (LOCAL_LastActiveSignal == 0) + LOCAL_LastActiveSignal = LOCAL_MaxActiveSignals-1; + else + LOCAL_LastActiveSignal--; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { CalculateStackGap( PASS_REGS1 ); } - LOCAL_ActiveSignals &= ~sig; UNLOCK(LOCAL_SignalLock); + return TRUE; } static Int @@ -70,7 +110,7 @@ p_creep( USES_REGS1 ) at = AtomCreep; pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0)); CreepCode = pred; - do_signal(YAP_CREEP_SIGNAL PASS_REGS); + do_signal(worker_id, YAP_CREEP_SIGNAL PASS_REGS); return TRUE; } @@ -83,19 +123,14 @@ p_creep_fail( USES_REGS1 ) at = AtomCreep; pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 1),0)); CreepCode = pred; - do_signal(YAP_CREEP_SIGNAL PASS_REGS); + do_signal(worker_id, YAP_CREEP_SIGNAL PASS_REGS); return FALSE; } static Int p_stop_creeping( USES_REGS1 ) { - LOCK(LOCAL_SignalLock); - LOCAL_ActiveSignals &= ~(YAP_CREEP_SIGNAL); - if (!LOCAL_ActiveSignals) { - CalculateStackGap( PASS_REGS1 ); - } - UNLOCK(LOCAL_SignalLock); + undo_signal( YAP_CREEP_SIGNAL PASS_REGS ); return TRUE; } @@ -103,10 +138,10 @@ static Int p_creep_allowed( USES_REGS1 ) { if (PP != NULL) { + undo_signal(YAP_CREEP_SIGNAL PASS_REGS); LOCK(LOCAL_SignalLock); - if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL && !LOCAL_InterruptsDisabled) { - LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL; - if (!LOCAL_ActiveSignals) + if (!LOCAL_InterruptsDisabled) { + if (LOCAL_FirstActiveSignal == LOCAL_LastActiveSignal) CalculateStackGap( PASS_REGS1 ); UNLOCK(LOCAL_SignalLock); } else { @@ -114,6 +149,7 @@ p_creep_allowed( USES_REGS1 ) } return TRUE; } + UNLOCK(LOCAL_SignalLock); return FALSE; } @@ -121,14 +157,109 @@ void Yap_signal(yap_signals sig) { CACHE_REGS - do_signal(sig PASS_REGS); + do_signal(worker_id, sig PASS_REGS); } void -Yap_undo_signal(yap_signals sig) +Yap_external_signal(int wid, yap_signals sig) { - CACHE_REGS - undo_signal(sig PASS_REGS); + REGSTORE *regcache = REMOTE_ThreadHandle(wid).current_yaam_regs; + do_signal(wid, sig PASS_REGS); +} + +int +Yap_undo_signal__(yap_signals sig USES_REGS) +{ + return undo_signal(sig PASS_REGS); +} + +int +Yap_has_signal__(yap_signals sig USES_REGS) +{ + LOCK(LOCAL_SignalLock); + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig == LOCAL_ActiveSignals[i]) { + UNLOCK(LOCAL_SignalLock); + return TRUE; + } + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } + UNLOCK(LOCAL_SignalLock); + return FALSE; +} + +int +Yap_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) +{ + LOCK(LOCAL_SignalLock); + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig1 == LOCAL_ActiveSignals[i] || + sig2 == LOCAL_ActiveSignals[i]) { + UNLOCK(LOCAL_SignalLock); + return TRUE; + } + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } + UNLOCK(LOCAL_SignalLock); + return FALSE; +} + + +int +Yap_only_has_signal__(yap_signals sig USES_REGS) +{ + LOCK(LOCAL_SignalLock); + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig != LOCAL_ActiveSignals[i]) { + UNLOCK(LOCAL_SignalLock); + return FALSE; + } + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } else { + UNLOCK(LOCAL_SignalLock); + return FALSE; + } + UNLOCK(LOCAL_SignalLock); + return TRUE; +} + +int +Yap_only_has_signals__(yap_signals sig1, yap_signals sig2 USES_REGS) +{ + LOCK(LOCAL_SignalLock); + UInt i = LOCAL_FirstActiveSignal; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + do { + if (sig1 != LOCAL_ActiveSignals[i] && + sig2 != LOCAL_ActiveSignals[i]) { + UNLOCK(LOCAL_SignalLock); + return FALSE; + } + i++; + if (i == LOCAL_MaxActiveSignals) + i = 0; + } while (i != LOCAL_LastActiveSignal); + } else { + UNLOCK(LOCAL_SignalLock); + return FALSE; + } + UNLOCK(LOCAL_SignalLock); + return TRUE; } #ifdef DEBUG @@ -146,155 +277,100 @@ p_debug( USES_REGS1 ) static Int p_first_signal( USES_REGS1 ) { + Atom at; + yap_signals sig; + LOCK(LOCAL_SignalLock); MUTEX_LOCK(&(LOCAL_ThreadHandle.tlock)); /* always do wakeups first, because you don't want to keep the non-backtrackable variable bad */ - if (LOCAL_ActiveSignals & YAP_WAKEUP_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_WAKEUP_SIGNAL; + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + sig = LOCAL_ActiveSignals[LOCAL_FirstActiveSignal]; + LOCAL_FirstActiveSignal++; + if (LOCAL_FirstActiveSignal == LOCAL_MaxActiveSignals) + LOCAL_FirstActiveSignal = 0; + } else { + sig = YAP_NO_SIGNAL; + } + switch (sig) { + case YAP_INT_SIGNAL: + at = AtomSigInt; + break; + case YAP_CREEP_SIGNAL: + at = AtomSigCreep; + break; + case YAP_TRACE_SIGNAL: + at = AtomSigTrace; + break; + case YAP_DEBUG_SIGNAL: + at = AtomSigDebug; + break; + case YAP_BREAK_SIGNAL: + at = AtomSigBreak; + break; + case YAP_FAIL_SIGNAL: + at = AtomFail; + break; + case YAP_STACK_DUMP_SIGNAL: + at = AtomSigStackDump; + break; + case YAP_STATISTICS_SIGNAL: + at = AtomSigStatistics; + break; +#ifdef SIGALRM + case YAP_ALARM_SIGNAL: +#endif + case YAP_WINTIMER_SIGNAL: + at = AtomSigAlarm; + break; +#ifdef SIGVTALRM + case YAP_VTALARM_SIGNAL: + at = AtomSigVTAlarm; + break; +#endif + case YAP_WAKEUP_SIGNAL: + at = AtomSigWakeUp; + break; + case YAP_ITI_SIGNAL: + at = AtomSigIti; + break; +#ifdef SIGPIPE + case YAP_PIPE_SIGNAL: + at = AtomSigPipe; + break; +#endif +#ifdef SIGHUP + case YAP_HUP_SIGNAL: + at = AtomSigHup; + break; +#endif +#ifdef SIGUSR1 + case YAP_USR1_SIGNAL: + at = AtomSigUsr1; + break; +#endif +#ifdef SIGUSR2 + case YAP_USR2_SIGNAL: + at = AtomSigUsr2; + break; +#endif + default: MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigWakeUp)); + return FALSE; } - if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_ITI_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigIti)); - } - if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_INT_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigInt)); - } - if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_USR2_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr2)); - } - if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_USR1_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigUsr1)); - } - if (LOCAL_ActiveSignals & YAP_PIPE_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_PIPE_SIGNAL; -#ifdef THREADS - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); -#endif - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigPipe)); - } - if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_HUP_SIGNAL; -#ifdef THREADS - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); -#endif - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigHup)); - } - if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_ALARM_SIGNAL; - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigAlarm)); - } - if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_VTALARM_SIGNAL; - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigVTAlarm)); - } - if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_CREEP_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigCreep)); - } - if (LOCAL_ActiveSignals & YAP_TRACE_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_TRACE_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigTrace)); - } - if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_DEBUG_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigDebug)); - } - if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_BREAK_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigBreak)); - } - if (LOCAL_ActiveSignals & YAP_STACK_DUMP_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_STACK_DUMP_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigStackDump)); - } - if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_STATISTICS_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomSigStatistics)); - } - if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { - LOCAL_ActiveSignals &= ~YAP_FAIL_SIGNAL; - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); - UNLOCK(LOCAL_SignalLock); - return Yap_unify(ARG1, MkAtomTerm(AtomFail)); - } - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); UNLOCK(LOCAL_SignalLock); - return FALSE; + return Yap_unify(ARG1, MkAtomTerm(at)); } static Int p_continue_signals( USES_REGS1 ) { + yap_signals sig; /* hack to force the signal anew */ - if (LOCAL_ActiveSignals & YAP_ITI_SIGNAL) { - Yap_signal(YAP_ITI_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_INT_SIGNAL) { - Yap_signal(YAP_INT_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_USR2_SIGNAL) { - Yap_signal(YAP_USR2_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_USR1_SIGNAL) { - Yap_signal(YAP_USR1_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_HUP_SIGNAL) { - Yap_signal(YAP_HUP_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_ALARM_SIGNAL) { - Yap_signal(YAP_ALARM_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_VTALARM_SIGNAL) { - Yap_signal(YAP_VTALARM_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_CREEP_SIGNAL) { - Yap_signal(YAP_CREEP_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_DEBUG_SIGNAL) { - Yap_signal(YAP_DEBUG_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_BREAK_SIGNAL) { - Yap_signal(YAP_BREAK_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_STACK_DUMP_SIGNAL) { - Yap_signal(YAP_STACK_DUMP_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_STATISTICS_SIGNAL) { - Yap_signal(YAP_STATISTICS_SIGNAL); - } - if (LOCAL_ActiveSignals & YAP_FAIL_SIGNAL) { - Yap_signal(YAP_FAIL_SIGNAL); + if (LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal) { + sig = LOCAL_ActiveSignals[LOCAL_FirstActiveSignal]; + Yap_signal(sig); } MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); return TRUE; @@ -314,3 +390,8 @@ Yap_InitSignalCPreds(void) Yap_InitCPred("$debug", 1, p_debug, SafePredFlag|SyncPredFlag); #endif } + +void Yap_InitSignals(int wid) +{ + REMOTE_ActiveSignals(wid) = (UInt *)malloc(sizeof(UInt)*REMOTE_MaxActiveSignals(wid)); +} diff --git a/C/stdpreds.c b/C/stdpreds.c old mode 100644 new mode 100755 index 04396deb1..b55e06595 --- a/C/stdpreds.c +++ b/C/stdpreds.c @@ -1298,21 +1298,21 @@ Yap_show_statistics(void) #endif frag = (100.0*(heap_space_taken-HeapUsed))/heap_space_taken; - fprintf(GLOBAL_stderr, "Code Space: %ld (%ld bytes needed, %ld bytes used, fragmentation %.3f%%).\n", + Sfprintf(GLOBAL_stderr, "Code Space: %ld (%ld bytes needed, %ld bytes used, fragmentation %.3f%%).\n", (unsigned long int)(Unsigned (H0) - Unsigned (Yap_HeapBase)), (unsigned long int)(Unsigned(HeapTop)-Unsigned(Yap_HeapBase)), (unsigned long int)(HeapUsed), frag); - fprintf(GLOBAL_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n", + Sfprintf(GLOBAL_stderr, "Stack Space: %ld (%ld for Global, %ld for local).\n", (unsigned long int)(sizeof(CELL)*(LCL0-H0)), (unsigned long int)(sizeof(CELL)*(HR-H0)), (unsigned long int)(sizeof(CELL)*(LCL0-ASP))); - fprintf(GLOBAL_stderr, "Trail Space: %ld (%ld used).\n", + Sfprintf(GLOBAL_stderr, "Trail Space: %ld (%ld used).\n", (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(LOCAL_TrailTop)-Unsigned(LOCAL_TrailBase))), (unsigned long int)(sizeof(tr_fr_ptr)*(Unsigned(TR)-Unsigned(LOCAL_TrailBase)))); - fprintf(GLOBAL_stderr, "Runtime: %lds.\n", (unsigned long int)(runtime ( PASS_REGS1 ))); - fprintf(GLOBAL_stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime ())); - fprintf(GLOBAL_stderr, "Walltime: %lds.\n", (unsigned long int)(Yap_walltime ())); + Sfprintf(GLOBAL_stderr, "Runtime: %lds.\n", (unsigned long int)(runtime ( PASS_REGS1 ))); + Sfprintf(GLOBAL_stderr, "Cputime: %lds.\n", (unsigned long int)(Yap_cputime ())); + Sfprintf(GLOBAL_stderr, "Walltime: %lds.\n", (unsigned long int)(Yap_walltime ())); } static Int diff --git a/C/sysbits.c b/C/sysbits.c index 4a7f9abb4..cd9997def 100755 --- a/C/sysbits.c +++ b/C/sysbits.c @@ -2303,7 +2303,18 @@ static Int p_shell ( USES_REGS1 ) { /* '$shell'(+SystCommand) */ #if _MSC_VER || defined(__MINGW32__) - Yap_Error(SYSTEM_ERROR,TermNil,"shell not available in this configuration"); +/** shell(+Command:text, -Status:integer) is det. + +Run an external command and wait for its completion. +*/ + char *cmd; + term_t A1 = Yap_InitSlot(ARG1 PASS_REGS); + if ( PL_get_chars(A1, &cmd, CVT_ALL|REP_FN|CVT_EXCEPTION) ) + { int rval = System(cmd); + + return rval == 0; + } + return FALSE; #else #if HAVE_SYSTEM @@ -2945,7 +2956,7 @@ p_enable_interrupts( USES_REGS1 ) LOCAL_InterruptsDisabled--; if (LOCAL_ActiveSignals && !LOCAL_InterruptsDisabled) { CreepFlag = Unsigned(LCL0); - if ( LOCAL_ActiveSignals != YAP_CREEP_SIGNAL ) + if ( !Yap_only_has_signal( YAP_CREEP_SIGNAL ) ) EventFlag = Unsigned( LCL0 ); } UNLOCK(LOCAL_SignalLock); @@ -3188,7 +3199,7 @@ Yap_InitSysPreds(void) InitLastWtime(); Yap_InitCPred ("srandom", 1, p_srandom, SafePredFlag); Yap_InitCPred ("sh", 0, p_sh, SafePredFlag|SyncPredFlag); - Yap_InitCPred ("$shell", 1, p_shell, SafePredFlag|SyncPredFlag); + Yap_InitCPred ("$shell", 1, p_shell, SafePredFlag|SyncPredFlag|UserCPredFlag); Yap_InitCPred ("system", 1, p_system, SafePredFlag|SyncPredFlag); Yap_InitCPred ("rename", 2, p_mv, SafePredFlag|SyncPredFlag); Yap_InitCPred ("$yap_home", 1, p_yap_home, SafePredFlag); diff --git a/C/threads.c b/C/threads.c index 46825326e..8d0174fc4 100755 --- a/C/threads.c +++ b/C/threads.c @@ -73,6 +73,23 @@ set_system_thread_id(int wid, PL_thread_info_t *info) #endif } +int +Yap_ThreadID( void ) +{ + int new_worker_id = 0; + pthread_t self = pthread_self(); + while(new_worker_id < MAX_THREADS && + Yap_local[new_worker_id] && + (REMOTE_ThreadHandle(new_worker_id).in_use == TRUE || + REMOTE_ThreadHandle(new_worker_id).zombie == TRUE) ) { + if (pthread_equal(self , REMOTE_ThreadHandle(new_worker_id).pthread_handle) ) { + return new_worker_id; + } + new_worker_id++; + } + return -1; +} + static int allocate_new_tid(void) { @@ -87,6 +104,7 @@ allocate_new_tid(void) new_worker_id = -1; } else if (!Yap_local[new_worker_id]) { if (!Yap_InitThread(new_worker_id)) { + UNLOCK(GLOBAL_ThreadHandlesLock); return -1; } MUTEX_LOCK(&(REMOTE_ThreadHandle(new_worker_id).tlock)); @@ -451,9 +469,7 @@ p_thread_zombie_self( USES_REGS1 ) /* make sure the lock is available */ if (pthread_getspecific(Yap_yaamregs_key) == NULL) return Yap_unify(MkIntegerTerm(-1), ARG1); - MUTEX_LOCK(&(LOCAL_ThreadHandle.tlock)); - if (LOCAL_ActiveSignals &= YAP_ITI_SIGNAL) { - MUTEX_UNLOCK(&(LOCAL_ThreadHandle.tlock)); + if (Yap_has_signal( YAP_ITI_SIGNAL )) { return FALSE; } // fprintf(stderr," -- %d\n", worker_id); @@ -752,8 +768,12 @@ p_lock_mutex( USES_REGS1 ) { SWIMutex *mut = (SWIMutex*)IntegerOfTerm(Deref(ARG1)); +#if DEBUG_LOCKS + MUTEX_LOCK(&mut->m); +#else if (MUTEX_LOCK(&mut->m) < 0) return FALSE; +#endif mut->owners++; mut->tid_own = worker_id; return TRUE; @@ -915,13 +935,7 @@ p_thread_signal( USES_REGS1 ) MUTEX_UNLOCK(&(REMOTE_ThreadHandle(wid).tlock)); return TRUE; } - LOCK(REMOTE_SignalLock(wid)); - REMOTE_ThreadHandle(wid).current_yaam_regs->CreepFlag_ = - REMOTE_ThreadHandle(wid).current_yaam_regs->EventFlag_ = - Unsigned(REMOTE_ThreadHandle(wid).current_yaam_regs->LCL0_); - REMOTE_ActiveSignals(wid) |= YAP_ITI_SIGNAL; - UNLOCK(REMOTE_SignalLock(wid)); - MUTEX_UNLOCK(&(REMOTE_ThreadHandle(wid).tlock)); + Yap_external_signal( wid, YAP_ITI_SIGNAL ); return TRUE; } diff --git a/C/tracer.c b/C/tracer.c old mode 100644 new mode 100755 index c9f44cb29..688db4ff3 --- a/C/tracer.c +++ b/C/tracer.c @@ -25,6 +25,7 @@ #include "yapio.h" #include "clause.h" #include "tracer.h" +#include "SWI-Stream.h" static void send_tracer_message(char *, char *, Int, char *, CELL *); @@ -33,32 +34,32 @@ send_tracer_message(char *start, char *name, Int arity, char *mname, CELL *args) { if (name == NULL) { #ifdef YAPOR - fprintf(GLOBAL_stderr, "(%d)%s", worker_id, start); + Sfprintf(GLOBAL_stderr, "(%d)%s", worker_id, start); #else - fprintf(GLOBAL_stderr, "%s", start); + Sfprintf(GLOBAL_stderr, "%s", start); #endif } else { int i; if (arity) { if (args) - fprintf(GLOBAL_stderr, "%s %s:%s(", start, mname, name); + Sfprintf(GLOBAL_stderr, "%s %s:%s(", start, mname, name); else - fprintf(GLOBAL_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity); + Sfprintf(GLOBAL_stderr, "%s %s:%s/%lu", start, mname, name, (unsigned long int)arity); } else { - fprintf(GLOBAL_stderr, "%s %s:%s", start, mname, name); + Sfprintf(GLOBAL_stderr, "%s %s:%s", start, mname, name); } if (args) { for (i= 0; i < arity; i++) { - if (i > 0) fprintf(GLOBAL_stderr, ","); - Yap_plwrite(args[i], NULL, 15, Handle_vars_f|AttVar_Portray_f, 1200); + if (i > 0) Sfprintf(GLOBAL_stderr, ","); + Yap_plwrite(args[i], GLOBAL_stderr, 15, Handle_vars_f|AttVar_Portray_f, 1200); } if (arity) { - fprintf(GLOBAL_stderr, ")"); + Sfprintf(GLOBAL_stderr, ")"); } } } - fprintf(GLOBAL_stderr, "\n"); + Sfprintf(GLOBAL_stderr, "\n"); } #if defined(__GNUC__) @@ -120,7 +121,7 @@ check_area(void) first = i; found = TRUE; } - fprintf(stderr,"%lld changed %d\n",vsc_count,i); + Sfprintf(stderr,"%lld changed %d\n",vsc_count,i); } array[i] = ((CELL *)0x187a800)[i]; } @@ -146,12 +147,12 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) LOCK(Yap_heap_regs->low_level_trace_lock); sc = Yap_heap_regs; //if (vsc_count == 54) jmp_deb(1); - // fprintf(stderr,"B=%p ", B); + // Sfprintf(stderr,"B=%p ", B); #ifdef THREADS LOCAL_ThreadHandle.thread_inst_count++; #endif #ifdef COMMENTED - fprintf(stderr,"in %p\n"); + Sfprintf(stderr,"in %p\n"); CELL * gc_ENV = ENV; while (gc_ENV != NULL) { /* no more environments */ fprintf(stderr,"%ld\n", LCL0-gc_ENV); @@ -180,7 +181,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) if (vsc_count % 1LL == 0) { UInt sz = Yap_regp->H0_[17]; UInt end = sizeof(MP_INT)/sizeof(CELL)+sz+1; - fprintf(stderr,"VAL %lld %d %x/%x\n",vsc_count,sz,H0[16],H0[16+end]); + Sfprintf(GLOBAL_stderr,"VAL %lld %d %x/%x\n",vsc_count,sz,H0[16],H0[16+end]); } } else return; @@ -292,9 +293,9 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) printf("\n"); } #endif - fprintf(GLOBAL_stderr,"%lld ",vsc_count); + Sfprintf(GLOBAL_stderr,"%lld ",vsc_count); #if defined(THREADS) || defined(YAPOR) - fprintf(GLOBAL_stderr,"(%d)", worker_id); + Sfprintf(GLOBAL_stderr,"(%d)", worker_id); #endif /* check_trail_consistency(); */ if (pred == NULL) { @@ -377,6 +378,7 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args) } break; } + Sflush(GLOBAL_stderr); fflush(NULL); UNLOCK(Yap_heap_regs->low_level_trace_lock); } @@ -389,6 +391,7 @@ toggle_low_level_trace(void) static Int p_start_low_level_trace( USES_REGS1 ) { + GLOBAL_stderr = Sopen_file("LOG", "w"); Yap_do_low_level_trace = TRUE; return(TRUE); } @@ -406,7 +409,7 @@ static Int p_reset_total_choicepoints( USES_REGS1 ) static Int p_show_low_level_trace( USES_REGS1 ) { - fprintf(stderr,"Call counter=%lld\n",vsc_count); + Sfprintf(GLOBAL_stderr,"Call counter=%lld\n",vsc_count); return(TRUE); } @@ -425,6 +428,7 @@ static Int p_stop_low_level_trace( USES_REGS1 ) { Yap_do_low_level_trace = FALSE; LOCAL_do_trace_primitives = TRUE; + debug_locks = TRUE; return(TRUE); } diff --git a/H/Yap.h b/H/Yap.h index 2fdc930dc..8ecfe0b32 100755 --- a/H/Yap.h +++ b/H/Yap.h @@ -379,30 +379,6 @@ typedef enum INDEX_MODE_MAX = 4 } index_mode_options; -typedef enum -{ - YAP_CREEP_SIGNAL = 0x1, /* received a creep */ - YAP_WAKEUP_SIGNAL = 0x2, /* goals to wake up */ - YAP_ALARM_SIGNAL = 0x4, /* received an alarm */ - YAP_HUP_SIGNAL = 0x8, /* received SIGHUP */ - YAP_USR1_SIGNAL = 0x10, /* received SIGUSR1 */ - YAP_USR2_SIGNAL = 0x20, /* received SIGUSR2 */ - YAP_INT_SIGNAL = 0x40, /* received SIGINT (unused for now) */ - YAP_ITI_SIGNAL = 0x80, /* received inter thread signal */ - YAP_TROVF_SIGNAL = 0x100, /* received trail overflow */ - YAP_CDOVF_SIGNAL = 0x200, /* received code overflow */ - YAP_STOVF_SIGNAL = 0x400, /* received stack overflow */ - YAP_TRACE_SIGNAL = 0x800, /* received start trace */ - YAP_DEBUG_SIGNAL = 0x1000, /* received start debug */ - YAP_BREAK_SIGNAL = 0x2000, /* received break signal */ - YAP_STACK_DUMP_SIGNAL = 0x4000, /* received stack dump signal */ - YAP_STATISTICS_SIGNAL = 0x8000, /* received statistics */ - YAP_AGC_SIGNAL = 0x20000, /* call atom garbage collector asap */ - YAP_PIPE_SIGNAL = 0x40000, /* call atom garbage collector asap */ - YAP_VTALARM_SIGNAL = 0x80000, /* received SIGVTALARM */ - YAP_FAIL_SIGNAL = 0x100000 /* P = FAILCODE */ -} yap_signals; - typedef enum { GPROF_NO_EVENT, @@ -750,5 +726,10 @@ extern struct worker_local Yap_local; #include "YapHandles.h" +// take care of signal handling within YAP + +#include "YapSignals.h" + + #endif /* YAP_H */ diff --git a/H/YapHeap.h b/H/YapHeap.h old mode 100644 new mode 100755 diff --git a/H/YapSignals.h b/H/YapSignals.h new file mode 100755 index 000000000..c9f044c3c --- /dev/null +++ b/H/YapSignals.h @@ -0,0 +1,88 @@ +/************************************************************************* +* * +* YAP Prolog * +* * +* Yap Prolog was developed at NCCUP - Universidade do Porto * +* * +* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * +* * +************************************************************************** +* * +* File: YapSignals.h * +* comments: YAP signal handling interface * +* * +* Last rev: $Date * +* $Log $ * +* * +* * +*************************************************************************/ + +#if HAVE_SIGNAL_H +#include +#endif + +typedef enum +{ + YAP_NO_SIGNAL = 0, /* received an alarm */ +#ifdef SIGALRM + YAP_ALARM_SIGNAL = SIGALRM, /* received an alarm */ +#endif +#ifdef SIGHUP + YAP_HUP_SIGNAL = SIGHUP, /* received SIGHUP */ +#endif +#ifdef SIGUSR1 + YAP_USR1_SIGNAL = SIGUSR1, /* received SIGUSR1 */ +#endif +#ifdef SIGUSR2 + YAP_USR2_SIGNAL = SIGUSR2, /* received SIGUSR2 */ +#endif +#ifdef SIGINT + YAP_INT_SIGNAL = SIGINT, /* received SIGINT (unused for now) */ +#endif +#ifdef SIGPIPE + YAP_PIPE_SIGNAL = SIGPIPE, /* call atom garbage collector asap */ +#endif +#ifdef SIGVTALRM + YAP_VTALARM_SIGNAL = SIGVTALRM, /* received SIGVTALARM */ +#endif + YAP_CREEP_SIGNAL = NSIG+1, /* received a creep */ + YAP_WAKEUP_SIGNAL = NSIG+2, /* goals to wake up */ + YAP_ITI_SIGNAL = NSIG+3, /* received inter thread signal */ + YAP_TROVF_SIGNAL = NSIG+4, /* received trail overflow */ + YAP_CDOVF_SIGNAL = NSIG+5, /* received code overflow */ + YAP_STOVF_SIGNAL = NSIG+6, /* received stack overflow */ + YAP_TRACE_SIGNAL = NSIG+7, /* received start trace */ + YAP_DEBUG_SIGNAL = NSIG+8, /* received start debug */ + YAP_BREAK_SIGNAL = NSIG+9, /* received break signal */ + YAP_STACK_DUMP_SIGNAL = NSIG+10, /* received stack dump signal */ + YAP_STATISTICS_SIGNAL = NSIG+11, /* received statistics */ + YAP_AGC_SIGNAL = NSIG+12, /* call atom garbage collector asap */ + YAP_WINTIMER_SIGNAL = NSIG+13, /* windows alarm */ + YAP_FAIL_SIGNAL = NSIG+14 /* P = FAILCODE */ +} yap_signals; + +#define Yap_undo_signal(S) Yap_undo_signal__(S PASS_REGS) +#define Yap_has_a_signal() Yap_has_a_signal__(PASS_REGS1) +#define Yap_has_signal(S) Yap_has_signal__(S PASS_REGS) +#define Yap_has_signals(S1, S2) Yap_has_signals__(S1, S2 PASS_REGS) +#define Yap_only_has_signal(S) Yap_only_has_signal__(S PASS_REGS) +#define Yap_only_has_signals(S1, S2) Yap_only_has_signals__(S1, S2 PASS_REGS) + + +INLINE_ONLY inline EXTERN int Yap_has_a_signal__ ( USES_REGS1 ); + +INLINE_ONLY inline EXTERN int +Yap_has_a_signal__ (USES_REGS1) +{ + return LOCAL_FirstActiveSignal != LOCAL_LastActiveSignal; +} + + +void Yap_signal(yap_signals); +void Yap_external_signal(int, yap_signals); +int Yap_undo_signal__(yap_signals USES_REGS); +int Yap_has_a_signal__( USES_REGS1 ); +int Yap_has_signal__(yap_signals USES_REGS); +int Yap_has_signals__(yap_signals,yap_signals USES_REGS); +int Yap_only_has_signal__(yap_signals USES_REGS); +int Yap_only_has_signals__(yap_signals,yap_signals USES_REGS); diff --git a/H/Yapproto.h b/H/Yapproto.h old mode 100644 new mode 100755 index ab653d805..10b2ef9e5 --- a/H/Yapproto.h +++ b/H/Yapproto.h @@ -332,8 +332,6 @@ void Yap_InitSavePreds(void); /* scanner.c */ /* signals.c */ -void Yap_signal(yap_signals); -void Yap_undo_signal(yap_signals); void Yap_InitSignalCPreds(void); /* sort.c */ diff --git a/H/Yatom.h b/H/Yatom.h old mode 100644 new mode 100755 index 163bdce6d..4621777a0 --- a/H/Yatom.h +++ b/H/Yatom.h @@ -655,41 +655,41 @@ don;t forget to also add in qly.h */ typedef enum { - NoDebugPredFlag = ((UInt)0x00000004L << EXTRA_FLAG_BASE), /* cannot trace this preducate */ - NoTracePredFlag = ((UInt)0x00000002L << EXTRA_FLAG_BASE), /* cannot trace this preducate */ - QuasiQuotationPredFlag = ((UInt)0x00000001L << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */ - MegaClausePredFlag = 0x80000000L, /* predicate is implemented as a mega-clause */ - ThreadLocalPredFlag = 0x40000000L, /* local to a thread */ - MultiFileFlag = 0x20000000L, /* is multi-file */ - UserCPredFlag = 0x10000000L, /* CPred defined by the user */ - LogUpdatePredFlag = 0x08000000L, /* dynamic predicate with log. upd. sem. */ - InUsePredFlag = 0x04000000L, /* count calls to pred */ - CountPredFlag = 0x02000000L, /* count calls to pred */ - HiddenPredFlag = 0x01000000L, /* invisible predicate */ - CArgsPredFlag = 0x00800000L, /* SWI-like C-interface pred. */ - SourcePredFlag = 0x00400000L, /* static predicate with source declaration */ - MetaPredFlag = 0x00200000L, /* predicate subject to a meta declaration */ - SyncPredFlag = 0x00100000L, /* has to synch before it can execute */ - NumberDBPredFlag = 0x00080000L, /* entry for a number key */ - AtomDBPredFlag = 0x00040000L, /* entry for an atom key */ - GoalExPredFlag = 0x00020000L, /* predicate that is called by goal_expand */ - TestPredFlag = 0x00010000L, /* is a test (optim. comit) */ - AsmPredFlag = 0x00008000L, /* inline */ - StandardPredFlag = 0x00004000L, /* system predicate */ - DynamicPredFlag = 0x00002000L, /* dynamic predicate */ - CPredFlag = 0x00001000L, /* written in C */ - SafePredFlag = 0x00000800L, /* does not alter arguments */ - CompiledPredFlag = 0x00000400L, /* is static */ - IndexedPredFlag = 0x00000200L, /* has indexing code */ - SpiedPredFlag = 0x00000100L, /* is a spy point */ - BinaryPredFlag = 0x00000080L, /* test predicate */ - TabledPredFlag = 0x00000040L, /* is tabled */ - SequentialPredFlag = 0x00000020L, /* may not create parallel choice points! */ - ProfiledPredFlag = 0x00000010L, /* pred is being profiled */ - BackCPredFlag = 0x00000008L, /* Myddas Imported pred */ - ModuleTransparentPredFlag = 0x00000004L, /* ModuleTransparent pred */ - SWIEnvPredFlag = 0x00000002L, /* new SWI interface */ - UDIPredFlag = 0x00000001L /* User Defined Indexing */ + NoDebugPredFlag = ((UInt)0x00000004 << EXTRA_FLAG_BASE), /* cannot trace this preducate */ + NoTracePredFlag = ((UInt)0x00000002 << EXTRA_FLAG_BASE), /* cannot trace this preducate */ + QuasiQuotationPredFlag = ((UInt)0x00000001 << EXTRA_FLAG_BASE), /* SWI-like quasi quotations */ + MegaClausePredFlag = (UInt)0x80000000, /* predicate is implemented as a mega-clause */ + ThreadLocalPredFlag = (UInt)0x40000000, /* local to a thread */ + MultiFileFlag = (UInt)0x20000000, /* is multi-file */ + UserCPredFlag = (UInt)0x10000000, /* CPred defined by the user */ + LogUpdatePredFlag = (UInt)0x08000000, /* dynamic predicate with log. upd. sem. */ + InUsePredFlag = (UInt)0x04000000, /* count calls to pred */ + CountPredFlag = (UInt)0x02000000, /* count calls to pred */ + HiddenPredFlag = (UInt)0x01000000, /* invisible predicate */ + CArgsPredFlag = (UInt)0x00800000, /* SWI-like C-interface pred. */ + SourcePredFlag = (UInt)0x00400000, /* static predicate with source declaration */ + MetaPredFlag = (UInt)0x00200000, /* predicate subject to a meta declaration */ + SyncPredFlag = (UInt)0x00100000, /* has to synch before it can execute */ + NumberDBPredFlag = (UInt)0x00080000, /* entry for a number key */ + AtomDBPredFlag = (UInt)0x00040000, /* entry for an atom key */ + GoalExPredFlag = (UInt)0x00020000, /* predicate that is called by goal_expand */ + TestPredFlag = (UInt)0x00010000, /* is a test (optim. comit) */ + AsmPredFlag = (UInt)0x00008000, /* inline */ + StandardPredFlag = (UInt)0x00004000, /* system predicate */ + DynamicPredFlag = (UInt)0x00002000, /* dynamic predicate */ + CPredFlag = (UInt)0x00001000, /* written in C */ + SafePredFlag = (UInt)0x00000800, /* does not alter arguments */ + CompiledPredFlag = (UInt)0x00000400, /* is static */ + IndexedPredFlag = (UInt)0x00000200, /* has indexing code */ + SpiedPredFlag = (UInt)0x00000100, /* is a spy point */ + BinaryPredFlag = (UInt)0x00000080, /* test predicate */ + TabledPredFlag = (UInt)0x00000040, /* is tabled */ + SequentialPredFlag = (UInt)0x00000020, /* may not create parallel choice points! */ + ProfiledPredFlag = (UInt)0x00000010, /* pred is being profiled */ + BackCPredFlag = (UInt)0x00000008, /* Myddas Imported pred */ + ModuleTransparentPredFlag = (UInt)0x00000004, /* ModuleTransparent pred */ + SWIEnvPredFlag = (UInt)0x00000002, /* new SWI interface */ + UDIPredFlag = (UInt)0x00000001 /* User Defined Indexing */ } pred_flag; /* profile data */ diff --git a/H/dglobals.h b/H/dglobals.h index ddbafb562..b63ecb9ef 100644 --- a/H/dglobals.h +++ b/H/dglobals.h @@ -1,119 +1,119 @@ - - /* This file, dglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - - - -#define GLOBAL_Initialised Yap_global->Initialised_ -#define GLOBAL_InitialisedFromPL Yap_global->InitialisedFromPL_ -#define GLOBAL_PL_Argc Yap_global->PL_Argc_ -#define GLOBAL_PL_Argv Yap_global->PL_Argv_ - -#define GLOBAL_HaltHooks Yap_global->HaltHooks_ - -#define GLOBAL_AllowLocalExpansion Yap_global->AllowLocalExpansion_ -#define GLOBAL_AllowGlobalExpansion Yap_global->AllowGlobalExpansion_ -#define GLOBAL_AllowTrailExpansion Yap_global->AllowTrailExpansion_ -#define GLOBAL_SizeOfOverflow Yap_global->SizeOfOverflow_ - -#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_ -#define GLOBAL_AGCHook Yap_global->AGCHook_ - -#if THREADS - -#define GLOBAL_NOfThreads Yap_global->NOfThreads_ - -#define GLOBAL_NOfThreadsCreated Yap_global->NOfThreadsCreated_ - -#define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ - -#define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ -#endif -#if defined(YAPOR) || defined(THREADS) - -#define GLOBAL_BGL Yap_global->BGL_ -#endif -#if defined(YAPOR) || defined(TABLING) -#define GLOBAL_optyap_data Yap_global->optyap_data_ -#endif /* YAPOR || TABLING */ - -#define GLOBAL_PrologShouldHandleInterrupts Yap_global->PrologShouldHandleInterrupts_ - -#if defined(THREADS) -#define GLOBAL_master_thread Yap_global->master_thread_ -#endif /* THREADS */ - -#define GLOBAL_stdout Yap_global->stdout_ -#define GLOBAL_stderr Yap_global->stderr_ - -#define GLOBAL_argv Yap_global->argv_ -#define GLOBAL_argc Yap_global->argc_ - -#ifdef COROUTINING - -#define GLOBAL_attas Yap_global->attas_ -#endif - -#define GLOBAL_agc_calls Yap_global->agc_calls_ -#define GLOBAL_agc_collected Yap_global->agc_collected_ - -#define GLOBAL_tot_agc_time Yap_global->tot_agc_time_ - -#define GLOBAL_tot_agc_recovered Yap_global->tot_agc_recovered_ - -#if HAVE_MMAP -#define GLOBAL_mmap_arrays Yap_global->mmap_arrays_ -#endif -#ifdef DEBUG - -#define GLOBAL_Option Yap_global->Option_ -#define GLOBAL_logfile Yap_global->logfile_ - - -#endif -#if defined(COFF) || defined(A_OUT) - -#define GLOBAL_Executable Yap_global->Executable_ -#endif -#define GLOBAL_OpaqueHandlersCount Yap_global->OpaqueHandlersCount_ -#define GLOBAL_OpaqueHandlers Yap_global->OpaqueHandlers_ -#if __simplescalar__ -#define GLOBAL_pwd Yap_global->pwd_ -#endif - - -#define GLOBAL_RestoreFile Yap_global->RestoreFile_ - -#define GLOBAL_ProfCalls Yap_global->ProfCalls_ -#define GLOBAL_ProfGCs Yap_global->ProfGCs_ -#define GLOBAL_ProfHGrows Yap_global->ProfHGrows_ -#define GLOBAL_ProfSGrows Yap_global->ProfSGrows_ -#define GLOBAL_ProfMallocs Yap_global->ProfMallocs_ -#define GLOBAL_ProfIndexing Yap_global->ProfIndexing_ -#define GLOBAL_ProfOn Yap_global->ProfOn_ -#define GLOBAL_ProfOns Yap_global->ProfOns_ -#define GLOBAL_ProfilerRoot Yap_global->ProfilerRoot_ -#define GLOBAL_ProfilerNil Yap_global->ProfilerNil_ -#define GLOBAL_DIRNAME Yap_global->DIRNAME_ -#if LOW_PROF -#define GLOBAL_ProfilerOn Yap_global->ProfilerOn_ -#define GLOBAL_FProf Yap_global->FProf_ -#define GLOBAL_FPreds Yap_global->FPreds_ -#endif /* LOW_PROF */ - + + /* This file, dglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + + + +#define GLOBAL_Initialised Yap_global->Initialised_ +#define GLOBAL_InitialisedFromPL Yap_global->InitialisedFromPL_ +#define GLOBAL_PL_Argc Yap_global->PL_Argc_ +#define GLOBAL_PL_Argv Yap_global->PL_Argv_ + +#define GLOBAL_HaltHooks Yap_global->HaltHooks_ + +#define GLOBAL_AllowLocalExpansion Yap_global->AllowLocalExpansion_ +#define GLOBAL_AllowGlobalExpansion Yap_global->AllowGlobalExpansion_ +#define GLOBAL_AllowTrailExpansion Yap_global->AllowTrailExpansion_ +#define GLOBAL_SizeOfOverflow Yap_global->SizeOfOverflow_ + +#define GLOBAL_AGcThreshold Yap_global->AGcThreshold_ +#define GLOBAL_AGCHook Yap_global->AGCHook_ + +#if THREADS + +#define GLOBAL_NOfThreads Yap_global->NOfThreads_ + +#define GLOBAL_NOfThreadsCreated Yap_global->NOfThreadsCreated_ + +#define GLOBAL_ThreadsTotalTime Yap_global->ThreadsTotalTime_ + +#define GLOBAL_ThreadHandlesLock Yap_global->ThreadHandlesLock_ +#endif +#if defined(YAPOR) || defined(THREADS) + +#define GLOBAL_BGL Yap_global->BGL_ +#endif +#if defined(YAPOR) || defined(TABLING) +#define GLOBAL_optyap_data Yap_global->optyap_data_ +#endif /* YAPOR || TABLING */ + +#define GLOBAL_PrologShouldHandleInterrupts Yap_global->PrologShouldHandleInterrupts_ + +#if defined(THREADS) +#define GLOBAL_master_thread Yap_global->master_thread_ +#endif /* THREADS */ + +#define GLOBAL_stdout Yap_global->stdout_ +#define GLOBAL_stderr Yap_global->stderr_ + +#define GLOBAL_argv Yap_global->argv_ +#define GLOBAL_argc Yap_global->argc_ + +#ifdef COROUTINING + +#define GLOBAL_attas Yap_global->attas_ +#endif + +#define GLOBAL_agc_calls Yap_global->agc_calls_ +#define GLOBAL_agc_collected Yap_global->agc_collected_ + +#define GLOBAL_tot_agc_time Yap_global->tot_agc_time_ + +#define GLOBAL_tot_agc_recovered Yap_global->tot_agc_recovered_ + +#if HAVE_MMAP +#define GLOBAL_mmap_arrays Yap_global->mmap_arrays_ +#endif +#ifdef DEBUG + +#define GLOBAL_Option Yap_global->Option_ +#define GLOBAL_logfile Yap_global->logfile_ + + +#endif +#if defined(COFF) || defined(A_OUT) + +#define GLOBAL_Executable Yap_global->Executable_ +#endif +#define GLOBAL_OpaqueHandlersCount Yap_global->OpaqueHandlersCount_ +#define GLOBAL_OpaqueHandlers Yap_global->OpaqueHandlers_ +#if __simplescalar__ +#define GLOBAL_pwd Yap_global->pwd_ +#endif + + +#define GLOBAL_RestoreFile Yap_global->RestoreFile_ + +#define GLOBAL_ProfCalls Yap_global->ProfCalls_ +#define GLOBAL_ProfGCs Yap_global->ProfGCs_ +#define GLOBAL_ProfHGrows Yap_global->ProfHGrows_ +#define GLOBAL_ProfSGrows Yap_global->ProfSGrows_ +#define GLOBAL_ProfMallocs Yap_global->ProfMallocs_ +#define GLOBAL_ProfIndexing Yap_global->ProfIndexing_ +#define GLOBAL_ProfOn Yap_global->ProfOn_ +#define GLOBAL_ProfOns Yap_global->ProfOns_ +#define GLOBAL_ProfilerRoot Yap_global->ProfilerRoot_ +#define GLOBAL_ProfilerNil Yap_global->ProfilerNil_ +#define GLOBAL_DIRNAME Yap_global->DIRNAME_ +#if LOW_PROF +#define GLOBAL_ProfilerOn Yap_global->ProfilerOn_ +#define GLOBAL_FProf Yap_global->FProf_ +#define GLOBAL_FPreds Yap_global->FPreds_ +#endif /* LOW_PROF */ + diff --git a/H/dlocals.h b/H/dlocals.h index f9d49d498..2337a46e8 100644 --- a/H/dlocals.h +++ b/H/dlocals.h @@ -1,422 +1,428 @@ - - /* This file, dlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - - - -#define LOCAL_c_input_stream LOCAL->c_input_stream_ -#define REMOTE_c_input_stream(wid) REMOTE(wid)->c_input_stream_ -#define LOCAL_c_output_stream LOCAL->c_output_stream_ -#define REMOTE_c_output_stream(wid) REMOTE(wid)->c_output_stream_ -#define LOCAL_c_error_stream LOCAL->c_error_stream_ -#define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_ - -#define LOCAL_OldASP LOCAL->OldASP_ -#define REMOTE_OldASP(wid) REMOTE(wid)->OldASP_ -#define LOCAL_OldLCL0 LOCAL->OldLCL0_ -#define REMOTE_OldLCL0(wid) REMOTE(wid)->OldLCL0_ -#define LOCAL_OldTR LOCAL->OldTR_ -#define REMOTE_OldTR(wid) REMOTE(wid)->OldTR_ -#define LOCAL_OldGlobalBase LOCAL->OldGlobalBase_ -#define REMOTE_OldGlobalBase(wid) REMOTE(wid)->OldGlobalBase_ -#define LOCAL_OldH LOCAL->OldH_ -#define REMOTE_OldH(wid) REMOTE(wid)->OldH_ -#define LOCAL_OldH0 LOCAL->OldH0_ -#define REMOTE_OldH0(wid) REMOTE(wid)->OldH0_ -#define LOCAL_OldTrailBase LOCAL->OldTrailBase_ -#define REMOTE_OldTrailBase(wid) REMOTE(wid)->OldTrailBase_ -#define LOCAL_OldTrailTop LOCAL->OldTrailTop_ -#define REMOTE_OldTrailTop(wid) REMOTE(wid)->OldTrailTop_ -#define LOCAL_OldHeapBase LOCAL->OldHeapBase_ -#define REMOTE_OldHeapBase(wid) REMOTE(wid)->OldHeapBase_ -#define LOCAL_OldHeapTop LOCAL->OldHeapTop_ -#define REMOTE_OldHeapTop(wid) REMOTE(wid)->OldHeapTop_ -#define LOCAL_ClDiff LOCAL->ClDiff_ -#define REMOTE_ClDiff(wid) REMOTE(wid)->ClDiff_ -#define LOCAL_GDiff LOCAL->GDiff_ -#define REMOTE_GDiff(wid) REMOTE(wid)->GDiff_ -#define LOCAL_HDiff LOCAL->HDiff_ -#define REMOTE_HDiff(wid) REMOTE(wid)->HDiff_ -#define LOCAL_GDiff0 LOCAL->GDiff0_ -#define REMOTE_GDiff0(wid) REMOTE(wid)->GDiff0_ -#define LOCAL_GSplit LOCAL->GSplit_ -#define REMOTE_GSplit(wid) REMOTE(wid)->GSplit_ -#define LOCAL_LDiff LOCAL->LDiff_ -#define REMOTE_LDiff(wid) REMOTE(wid)->LDiff_ -#define LOCAL_TrDiff LOCAL->TrDiff_ -#define REMOTE_TrDiff(wid) REMOTE(wid)->TrDiff_ -#define LOCAL_XDiff LOCAL->XDiff_ -#define REMOTE_XDiff(wid) REMOTE(wid)->XDiff_ -#define LOCAL_DelayDiff LOCAL->DelayDiff_ -#define REMOTE_DelayDiff(wid) REMOTE(wid)->DelayDiff_ -#define LOCAL_BaseDiff LOCAL->BaseDiff_ -#define REMOTE_BaseDiff(wid) REMOTE(wid)->BaseDiff_ - -#define LOCAL_ReductionsCounter LOCAL->ReductionsCounter_ -#define REMOTE_ReductionsCounter(wid) REMOTE(wid)->ReductionsCounter_ -#define LOCAL_PredEntriesCounter LOCAL->PredEntriesCounter_ -#define REMOTE_PredEntriesCounter(wid) REMOTE(wid)->PredEntriesCounter_ -#define LOCAL_RetriesCounter LOCAL->RetriesCounter_ -#define REMOTE_RetriesCounter(wid) REMOTE(wid)->RetriesCounter_ -#define LOCAL_ReductionsCounterOn LOCAL->ReductionsCounterOn_ -#define REMOTE_ReductionsCounterOn(wid) REMOTE(wid)->ReductionsCounterOn_ -#define LOCAL_PredEntriesCounterOn LOCAL->PredEntriesCounterOn_ -#define REMOTE_PredEntriesCounterOn(wid) REMOTE(wid)->PredEntriesCounterOn_ -#define LOCAL_RetriesCounterOn LOCAL->RetriesCounterOn_ -#define REMOTE_RetriesCounterOn(wid) REMOTE(wid)->RetriesCounterOn_ - - -#define LOCAL_ConsultSp LOCAL->ConsultSp_ -#define REMOTE_ConsultSp(wid) REMOTE(wid)->ConsultSp_ - -#define LOCAL_ConsultCapacity LOCAL->ConsultCapacity_ -#define REMOTE_ConsultCapacity(wid) REMOTE(wid)->ConsultCapacity_ - -#define LOCAL_ConsultBase LOCAL->ConsultBase_ -#define REMOTE_ConsultBase(wid) REMOTE(wid)->ConsultBase_ - -#define LOCAL_ConsultLow LOCAL->ConsultLow_ -#define REMOTE_ConsultLow(wid) REMOTE(wid)->ConsultLow_ - -#define LOCAL_GlobalArena LOCAL->GlobalArena_ -#define REMOTE_GlobalArena(wid) REMOTE(wid)->GlobalArena_ -#define LOCAL_GlobalArenaOverflows LOCAL->GlobalArenaOverflows_ -#define REMOTE_GlobalArenaOverflows(wid) REMOTE(wid)->GlobalArenaOverflows_ -#define LOCAL_ArenaOverflows LOCAL->ArenaOverflows_ -#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_ -#define LOCAL_DepthArenas LOCAL->DepthArenas_ -#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_ -#define LOCAL_ArithError LOCAL->ArithError_ -#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_ -#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_ -#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_ -#define LOCAL_ScannerStack LOCAL->ScannerStack_ -#define REMOTE_ScannerStack(wid) REMOTE(wid)->ScannerStack_ -#define LOCAL_ScannerExtraBlocks LOCAL->ScannerExtraBlocks_ -#define REMOTE_ScannerExtraBlocks(wid) REMOTE(wid)->ScannerExtraBlocks_ -#define LOCAL_BallTerm LOCAL->BallTerm_ -#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_ -#define LOCAL_ActiveSignals LOCAL->ActiveSignals_ -#define REMOTE_ActiveSignals(wid) REMOTE(wid)->ActiveSignals_ -#define LOCAL_IPredArity LOCAL->IPredArity_ -#define REMOTE_IPredArity(wid) REMOTE(wid)->IPredArity_ -#define LOCAL_ProfEnd LOCAL->ProfEnd_ -#define REMOTE_ProfEnd(wid) REMOTE(wid)->ProfEnd_ -#define LOCAL_UncaughtThrow LOCAL->UncaughtThrow_ -#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_ -#define LOCAL_DoingUndefp LOCAL->DoingUndefp_ -#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_ -#define LOCAL_StartLine LOCAL->StartLine_ -#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_ -#define LOCAL_ScratchPad LOCAL->ScratchPad_ -#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_ -#ifdef COROUTINING -#define LOCAL_WokenGoals LOCAL->WokenGoals_ -#define REMOTE_WokenGoals(wid) REMOTE(wid)->WokenGoals_ -#define LOCAL_AttsMutableList LOCAL->AttsMutableList_ -#define REMOTE_AttsMutableList(wid) REMOTE(wid)->AttsMutableList_ -#endif - -#define LOCAL_GcGeneration LOCAL->GcGeneration_ -#define REMOTE_GcGeneration(wid) REMOTE(wid)->GcGeneration_ -#define LOCAL_GcPhase LOCAL->GcPhase_ -#define REMOTE_GcPhase(wid) REMOTE(wid)->GcPhase_ -#define LOCAL_GcCurrentPhase LOCAL->GcCurrentPhase_ -#define REMOTE_GcCurrentPhase(wid) REMOTE(wid)->GcCurrentPhase_ -#define LOCAL_GcCalls LOCAL->GcCalls_ -#define REMOTE_GcCalls(wid) REMOTE(wid)->GcCalls_ -#define LOCAL_TotGcTime LOCAL->TotGcTime_ -#define REMOTE_TotGcTime(wid) REMOTE(wid)->TotGcTime_ -#define LOCAL_TotGcRecovered LOCAL->TotGcRecovered_ -#define REMOTE_TotGcRecovered(wid) REMOTE(wid)->TotGcRecovered_ -#define LOCAL_LastGcTime LOCAL->LastGcTime_ -#define REMOTE_LastGcTime(wid) REMOTE(wid)->LastGcTime_ -#define LOCAL_LastSSTime LOCAL->LastSSTime_ -#define REMOTE_LastSSTime(wid) REMOTE(wid)->LastSSTime_ -#define LOCAL_OpenArray LOCAL->OpenArray_ -#define REMOTE_OpenArray(wid) REMOTE(wid)->OpenArray_ - -#define LOCAL_total_marked LOCAL->total_marked_ -#define REMOTE_total_marked(wid) REMOTE(wid)->total_marked_ -#define LOCAL_total_oldies LOCAL->total_oldies_ -#define REMOTE_total_oldies(wid) REMOTE(wid)->total_oldies_ -#define LOCAL_current_B LOCAL->current_B_ -#define REMOTE_current_B(wid) REMOTE(wid)->current_B_ -#define LOCAL_prev_HB LOCAL->prev_HB_ -#define REMOTE_prev_HB(wid) REMOTE(wid)->prev_HB_ -#define LOCAL_HGEN LOCAL->HGEN_ -#define REMOTE_HGEN(wid) REMOTE(wid)->HGEN_ -#define LOCAL_iptop LOCAL->iptop_ -#define REMOTE_iptop(wid) REMOTE(wid)->iptop_ -#if defined(GC_NO_TAGS) -#define LOCAL_bp LOCAL->bp_ -#define REMOTE_bp(wid) REMOTE(wid)->bp_ -#endif -#define LOCAL_sTR LOCAL->sTR_ -#define REMOTE_sTR(wid) REMOTE(wid)->sTR_ -#define LOCAL_sTR0 LOCAL->sTR0_ -#define REMOTE_sTR0(wid) REMOTE(wid)->sTR0_ -#define LOCAL_new_TR LOCAL->new_TR_ -#define REMOTE_new_TR(wid) REMOTE(wid)->new_TR_ -#define LOCAL_cont_top0 LOCAL->cont_top0_ -#define REMOTE_cont_top0(wid) REMOTE(wid)->cont_top0_ -#define LOCAL_cont_top LOCAL->cont_top_ -#define REMOTE_cont_top(wid) REMOTE(wid)->cont_top_ -#define LOCAL_discard_trail_entries LOCAL->discard_trail_entries_ -#define REMOTE_discard_trail_entries(wid) REMOTE(wid)->discard_trail_entries_ -#define LOCAL_gc_ma_hash_table LOCAL->gc_ma_hash_table_ -#define REMOTE_gc_ma_hash_table(wid) REMOTE(wid)->gc_ma_hash_table_ -#define LOCAL_gc_ma_h_top LOCAL->gc_ma_h_top_ -#define REMOTE_gc_ma_h_top(wid) REMOTE(wid)->gc_ma_h_top_ -#define LOCAL_gc_ma_h_list LOCAL->gc_ma_h_list_ -#define REMOTE_gc_ma_h_list(wid) REMOTE(wid)->gc_ma_h_list_ -#define LOCAL_gc_timestamp LOCAL->gc_timestamp_ -#define REMOTE_gc_timestamp(wid) REMOTE(wid)->gc_timestamp_ -#define LOCAL_db_vec LOCAL->db_vec_ -#define REMOTE_db_vec(wid) REMOTE(wid)->db_vec_ -#define LOCAL_db_vec0 LOCAL->db_vec0_ -#define REMOTE_db_vec0(wid) REMOTE(wid)->db_vec0_ -#define LOCAL_db_root LOCAL->db_root_ -#define REMOTE_db_root(wid) REMOTE(wid)->db_root_ -#define LOCAL_db_nil LOCAL->db_nil_ -#define REMOTE_db_nil(wid) REMOTE(wid)->db_nil_ -#define LOCAL_gc_restore LOCAL->gc_restore_ -#define REMOTE_gc_restore(wid) REMOTE(wid)->gc_restore_ -#define LOCAL_extra_gc_cells LOCAL->extra_gc_cells_ -#define REMOTE_extra_gc_cells(wid) REMOTE(wid)->extra_gc_cells_ -#define LOCAL_extra_gc_cells_base LOCAL->extra_gc_cells_base_ -#define REMOTE_extra_gc_cells_base(wid) REMOTE(wid)->extra_gc_cells_base_ -#define LOCAL_extra_gc_cells_top LOCAL->extra_gc_cells_top_ -#define REMOTE_extra_gc_cells_top(wid) REMOTE(wid)->extra_gc_cells_top_ -#define LOCAL_extra_gc_cells_size LOCAL->extra_gc_cells_size_ -#define REMOTE_extra_gc_cells_size(wid) REMOTE(wid)->extra_gc_cells_size_ -#define LOCAL_DynamicArrays LOCAL->DynamicArrays_ -#define REMOTE_DynamicArrays(wid) REMOTE(wid)->DynamicArrays_ -#define LOCAL_StaticArrays LOCAL->StaticArrays_ -#define REMOTE_StaticArrays(wid) REMOTE(wid)->StaticArrays_ -#define LOCAL_GlobalVariables LOCAL->GlobalVariables_ -#define REMOTE_GlobalVariables(wid) REMOTE(wid)->GlobalVariables_ -#define LOCAL_AllowRestart LOCAL->AllowRestart_ -#define REMOTE_AllowRestart(wid) REMOTE(wid)->AllowRestart_ - -#define LOCAL_CMemFirstBlock LOCAL->CMemFirstBlock_ -#define REMOTE_CMemFirstBlock(wid) REMOTE(wid)->CMemFirstBlock_ -#define LOCAL_CMemFirstBlockSz LOCAL->CMemFirstBlockSz_ -#define REMOTE_CMemFirstBlockSz(wid) REMOTE(wid)->CMemFirstBlockSz_ - -#define LOCAL_nperm LOCAL->nperm_ -#define REMOTE_nperm(wid) REMOTE(wid)->nperm_ - -#define LOCAL_LabelFirstArray LOCAL->LabelFirstArray_ -#define REMOTE_LabelFirstArray(wid) REMOTE(wid)->LabelFirstArray_ -#define LOCAL_LabelFirstArraySz LOCAL->LabelFirstArraySz_ -#define REMOTE_LabelFirstArraySz(wid) REMOTE(wid)->LabelFirstArraySz_ - -#define LOCAL_PL_local_data_p LOCAL->PL_local_data_p_ -#define REMOTE_PL_local_data_p(wid) REMOTE(wid)->PL_local_data_p_ -#ifdef THREADS -#define LOCAL_ThreadHandle LOCAL->ThreadHandle_ -#define REMOTE_ThreadHandle(wid) REMOTE(wid)->ThreadHandle_ -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) -#define LOCAL_optyap_data LOCAL->optyap_data_ -#define REMOTE_optyap_data(wid) REMOTE(wid)->optyap_data_ -#endif /* YAPOR || TABLING */ -#define LOCAL_InterruptsDisabled LOCAL->InterruptsDisabled_ -#define REMOTE_InterruptsDisabled(wid) REMOTE(wid)->InterruptsDisabled_ -#define LOCAL_execution LOCAL->execution_ -#define REMOTE_execution(wid) REMOTE(wid)->execution_ -#if LOW_LEVEL_TRACER -#define LOCAL_total_choicepoints LOCAL->total_choicepoints_ -#define REMOTE_total_choicepoints(wid) REMOTE(wid)->total_choicepoints_ -#endif -#define LOCAL_consult_level LOCAL->consult_level_ -#define REMOTE_consult_level(wid) REMOTE(wid)->consult_level_ -#if defined(YAPOR) || defined(THREADS) -#define LOCAL_SignalLock LOCAL->SignalLock_ -#define REMOTE_SignalLock(wid) REMOTE(wid)->SignalLock_ -#endif - -#define LOCAL_LocalBase LOCAL->LocalBase_ -#define REMOTE_LocalBase(wid) REMOTE(wid)->LocalBase_ -#define LOCAL_GlobalBase LOCAL->GlobalBase_ -#define REMOTE_GlobalBase(wid) REMOTE(wid)->GlobalBase_ -#define LOCAL_TrailBase LOCAL->TrailBase_ -#define REMOTE_TrailBase(wid) REMOTE(wid)->TrailBase_ -#define LOCAL_TrailTop LOCAL->TrailTop_ -#define REMOTE_TrailTop(wid) REMOTE(wid)->TrailTop_ -#define LOCAL_ErrorMessage LOCAL->ErrorMessage_ -#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_ -#define LOCAL_Error_Term LOCAL->Error_Term_ -#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_ -#ifdef THREADS -#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ -#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ -#else -#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ -#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ -#endif -#define LOCAL_Error_Size LOCAL->Error_Size_ -#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_ -#define LOCAL_ErrorSay LOCAL->ErrorSay_ -#define REMOTE_ErrorSay(wid) REMOTE(wid)->ErrorSay_ -#define LOCAL_IOBotch LOCAL->IOBotch_ -#define REMOTE_IOBotch(wid) REMOTE(wid)->IOBotch_ -#define LOCAL_tokptr LOCAL->tokptr_ -#define REMOTE_tokptr(wid) REMOTE(wid)->tokptr_ -#define LOCAL_toktide LOCAL->toktide_ -#define REMOTE_toktide(wid) REMOTE(wid)->toktide_ -#define LOCAL_VarTable LOCAL->VarTable_ -#define REMOTE_VarTable(wid) REMOTE(wid)->VarTable_ -#define LOCAL_AnonVarTable LOCAL->AnonVarTable_ -#define REMOTE_AnonVarTable(wid) REMOTE(wid)->AnonVarTable_ -#define LOCAL_Comments LOCAL->Comments_ -#define REMOTE_Comments(wid) REMOTE(wid)->Comments_ -#define LOCAL_CommentsTail LOCAL->CommentsTail_ -#define REMOTE_CommentsTail(wid) REMOTE(wid)->CommentsTail_ -#define LOCAL_CommentsNextChar LOCAL->CommentsNextChar_ -#define REMOTE_CommentsNextChar(wid) REMOTE(wid)->CommentsNextChar_ -#define LOCAL_CommentsBuff LOCAL->CommentsBuff_ -#define REMOTE_CommentsBuff(wid) REMOTE(wid)->CommentsBuff_ -#define LOCAL_CommentsBuffPos LOCAL->CommentsBuffPos_ -#define REMOTE_CommentsBuffPos(wid) REMOTE(wid)->CommentsBuffPos_ -#define LOCAL_CommentsBuffLim LOCAL->CommentsBuffLim_ -#define REMOTE_CommentsBuffLim(wid) REMOTE(wid)->CommentsBuffLim_ -#define LOCAL_RestartEnv LOCAL->RestartEnv_ -#define REMOTE_RestartEnv(wid) REMOTE(wid)->RestartEnv_ -#define LOCAL_FileNameBuf LOCAL->FileNameBuf_ -#define REMOTE_FileNameBuf(wid) REMOTE(wid)->FileNameBuf_ -#define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ -#define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ - -#define LOCAL_PrologMode LOCAL->PrologMode_ -#define REMOTE_PrologMode(wid) REMOTE(wid)->PrologMode_ -#define LOCAL_CritLocks LOCAL->CritLocks_ -#define REMOTE_CritLocks(wid) REMOTE(wid)->CritLocks_ - - -#ifdef ANALYST -#define LOCAL_opcount LOCAL->opcount_ -#define REMOTE_opcount(wid) REMOTE(wid)->opcount_ -#define LOCAL_2opcount LOCAL->2opcount_ -#define REMOTE_2opcount(wid) REMOTE(wid)->2opcount_ -#endif /* ANALYST */ - -#define LOCAL_s_dbg LOCAL->s_dbg_ -#define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_ - -#define LOCAL_matherror LOCAL->matherror_ -#define REMOTE_matherror(wid) REMOTE(wid)->matherror_ -#define LOCAL_CurrentError LOCAL->CurrentError_ -#define REMOTE_CurrentError(wid) REMOTE(wid)->CurrentError_ - -#define LOCAL_heap_overflows LOCAL->heap_overflows_ -#define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_ -#define LOCAL_total_heap_overflow_time LOCAL->total_heap_overflow_time_ -#define REMOTE_total_heap_overflow_time(wid) REMOTE(wid)->total_heap_overflow_time_ -#define LOCAL_stack_overflows LOCAL->stack_overflows_ -#define REMOTE_stack_overflows(wid) REMOTE(wid)->stack_overflows_ -#define LOCAL_total_stack_overflow_time LOCAL->total_stack_overflow_time_ -#define REMOTE_total_stack_overflow_time(wid) REMOTE(wid)->total_stack_overflow_time_ -#define LOCAL_delay_overflows LOCAL->delay_overflows_ -#define REMOTE_delay_overflows(wid) REMOTE(wid)->delay_overflows_ -#define LOCAL_total_delay_overflow_time LOCAL->total_delay_overflow_time_ -#define REMOTE_total_delay_overflow_time(wid) REMOTE(wid)->total_delay_overflow_time_ -#define LOCAL_trail_overflows LOCAL->trail_overflows_ -#define REMOTE_trail_overflows(wid) REMOTE(wid)->trail_overflows_ -#define LOCAL_total_trail_overflow_time LOCAL->total_trail_overflow_time_ -#define REMOTE_total_trail_overflow_time(wid) REMOTE(wid)->total_trail_overflow_time_ -#define LOCAL_atom_table_overflows LOCAL->atom_table_overflows_ -#define REMOTE_atom_table_overflows(wid) REMOTE(wid)->atom_table_overflows_ -#define LOCAL_total_atom_table_overflow_time LOCAL->total_atom_table_overflow_time_ -#define REMOTE_total_atom_table_overflow_time(wid) REMOTE(wid)->total_atom_table_overflow_time_ - -#ifdef LOAD_DYLD -#define LOCAL_dl_errno LOCAL->dl_errno_ -#define REMOTE_dl_errno(wid) REMOTE(wid)->dl_errno_ -#endif - -#ifdef LOW_LEVEL_TRACER -#define LOCAL_do_trace_primitives LOCAL->do_trace_primitives_ -#define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_ -#endif - -#define LOCAL_ExportAtomHashChain LOCAL->ExportAtomHashChain_ -#define REMOTE_ExportAtomHashChain(wid) REMOTE(wid)->ExportAtomHashChain_ -#define LOCAL_ExportAtomHashTableSize LOCAL->ExportAtomHashTableSize_ -#define REMOTE_ExportAtomHashTableSize(wid) REMOTE(wid)->ExportAtomHashTableSize_ -#define LOCAL_ExportAtomHashTableNum LOCAL->ExportAtomHashTableNum_ -#define REMOTE_ExportAtomHashTableNum(wid) REMOTE(wid)->ExportAtomHashTableNum_ -#define LOCAL_ExportFunctorHashChain LOCAL->ExportFunctorHashChain_ -#define REMOTE_ExportFunctorHashChain(wid) REMOTE(wid)->ExportFunctorHashChain_ -#define LOCAL_ExportFunctorHashTableSize LOCAL->ExportFunctorHashTableSize_ -#define REMOTE_ExportFunctorHashTableSize(wid) REMOTE(wid)->ExportFunctorHashTableSize_ -#define LOCAL_ExportFunctorHashTableNum LOCAL->ExportFunctorHashTableNum_ -#define REMOTE_ExportFunctorHashTableNum(wid) REMOTE(wid)->ExportFunctorHashTableNum_ -#define LOCAL_ExportPredEntryHashChain LOCAL->ExportPredEntryHashChain_ -#define REMOTE_ExportPredEntryHashChain(wid) REMOTE(wid)->ExportPredEntryHashChain_ -#define LOCAL_ExportPredEntryHashTableSize LOCAL->ExportPredEntryHashTableSize_ -#define REMOTE_ExportPredEntryHashTableSize(wid) REMOTE(wid)->ExportPredEntryHashTableSize_ -#define LOCAL_ExportPredEntryHashTableNum LOCAL->ExportPredEntryHashTableNum_ -#define REMOTE_ExportPredEntryHashTableNum(wid) REMOTE(wid)->ExportPredEntryHashTableNum_ -#define LOCAL_ExportDBRefHashChain LOCAL->ExportDBRefHashChain_ -#define REMOTE_ExportDBRefHashChain(wid) REMOTE(wid)->ExportDBRefHashChain_ -#define LOCAL_ExportDBRefHashTableSize LOCAL->ExportDBRefHashTableSize_ -#define REMOTE_ExportDBRefHashTableSize(wid) REMOTE(wid)->ExportDBRefHashTableSize_ -#define LOCAL_ExportDBRefHashTableNum LOCAL->ExportDBRefHashTableNum_ -#define REMOTE_ExportDBRefHashTableNum(wid) REMOTE(wid)->ExportDBRefHashTableNum_ -#define LOCAL_ImportAtomHashChain LOCAL->ImportAtomHashChain_ -#define REMOTE_ImportAtomHashChain(wid) REMOTE(wid)->ImportAtomHashChain_ -#define LOCAL_ImportAtomHashTableSize LOCAL->ImportAtomHashTableSize_ -#define REMOTE_ImportAtomHashTableSize(wid) REMOTE(wid)->ImportAtomHashTableSize_ -#define LOCAL_ImportAtomHashTableNum LOCAL->ImportAtomHashTableNum_ -#define REMOTE_ImportAtomHashTableNum(wid) REMOTE(wid)->ImportAtomHashTableNum_ -#define LOCAL_ImportFunctorHashChain LOCAL->ImportFunctorHashChain_ -#define REMOTE_ImportFunctorHashChain(wid) REMOTE(wid)->ImportFunctorHashChain_ -#define LOCAL_ImportFunctorHashTableSize LOCAL->ImportFunctorHashTableSize_ -#define REMOTE_ImportFunctorHashTableSize(wid) REMOTE(wid)->ImportFunctorHashTableSize_ -#define LOCAL_ImportFunctorHashTableNum LOCAL->ImportFunctorHashTableNum_ -#define REMOTE_ImportFunctorHashTableNum(wid) REMOTE(wid)->ImportFunctorHashTableNum_ -#define LOCAL_ImportOPCODEHashChain LOCAL->ImportOPCODEHashChain_ -#define REMOTE_ImportOPCODEHashChain(wid) REMOTE(wid)->ImportOPCODEHashChain_ -#define LOCAL_ImportOPCODEHashTableSize LOCAL->ImportOPCODEHashTableSize_ -#define REMOTE_ImportOPCODEHashTableSize(wid) REMOTE(wid)->ImportOPCODEHashTableSize_ -#define LOCAL_ImportPredEntryHashChain LOCAL->ImportPredEntryHashChain_ -#define REMOTE_ImportPredEntryHashChain(wid) REMOTE(wid)->ImportPredEntryHashChain_ -#define LOCAL_ImportPredEntryHashTableSize LOCAL->ImportPredEntryHashTableSize_ -#define REMOTE_ImportPredEntryHashTableSize(wid) REMOTE(wid)->ImportPredEntryHashTableSize_ -#define LOCAL_ImportPredEntryHashTableNum LOCAL->ImportPredEntryHashTableNum_ -#define REMOTE_ImportPredEntryHashTableNum(wid) REMOTE(wid)->ImportPredEntryHashTableNum_ -#define LOCAL_ImportDBRefHashChain LOCAL->ImportDBRefHashChain_ -#define REMOTE_ImportDBRefHashChain(wid) REMOTE(wid)->ImportDBRefHashChain_ -#define LOCAL_ImportDBRefHashTableSize LOCAL->ImportDBRefHashTableSize_ -#define REMOTE_ImportDBRefHashTableSize(wid) REMOTE(wid)->ImportDBRefHashTableSize_ -#define LOCAL_ImportDBRefHashTableNum LOCAL->ImportDBRefHashTableNum_ -#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_ -#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_ -#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_ -#define LOCAL_FunctorVar LOCAL->FunctorVar_ -#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_ - -#define LOCAL_ibnds LOCAL->ibnds_ -#define REMOTE_ibnds(wid) REMOTE(wid)->ibnds_ -#define LOCAL_exo_it LOCAL->exo_it_ -#define REMOTE_exo_it(wid) REMOTE(wid)->exo_it_ -#define LOCAL_exo_base LOCAL->exo_base_ -#define REMOTE_exo_base(wid) REMOTE(wid)->exo_base_ -#define LOCAL_exo_arity LOCAL->exo_arity_ -#define REMOTE_exo_arity(wid) REMOTE(wid)->exo_arity_ -#define LOCAL_exo_arg LOCAL->exo_arg_ -#define REMOTE_exo_arg(wid) REMOTE(wid)->exo_arg_ - -#define LOCAL_search_atoms LOCAL->search_atoms_ -#define REMOTE_search_atoms(wid) REMOTE(wid)->search_atoms_ - -#define LOCAL_CurSlot LOCAL->CurSlot_ -#define REMOTE_CurSlot(wid) REMOTE(wid)->CurSlot_ -#define LOCAL_SourceModule LOCAL->SourceModule_ -#define REMOTE_SourceModule(wid) REMOTE(wid)->SourceModule_ -#define LOCAL_MAX_SIZE LOCAL->MAX_SIZE_ -#define REMOTE_MAX_SIZE(wid) REMOTE(wid)->MAX_SIZE_ - + + /* This file, dlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + + + +#define LOCAL_c_input_stream LOCAL->c_input_stream_ +#define REMOTE_c_input_stream(wid) REMOTE(wid)->c_input_stream_ +#define LOCAL_c_output_stream LOCAL->c_output_stream_ +#define REMOTE_c_output_stream(wid) REMOTE(wid)->c_output_stream_ +#define LOCAL_c_error_stream LOCAL->c_error_stream_ +#define REMOTE_c_error_stream(wid) REMOTE(wid)->c_error_stream_ + +#define LOCAL_OldASP LOCAL->OldASP_ +#define REMOTE_OldASP(wid) REMOTE(wid)->OldASP_ +#define LOCAL_OldLCL0 LOCAL->OldLCL0_ +#define REMOTE_OldLCL0(wid) REMOTE(wid)->OldLCL0_ +#define LOCAL_OldTR LOCAL->OldTR_ +#define REMOTE_OldTR(wid) REMOTE(wid)->OldTR_ +#define LOCAL_OldGlobalBase LOCAL->OldGlobalBase_ +#define REMOTE_OldGlobalBase(wid) REMOTE(wid)->OldGlobalBase_ +#define LOCAL_OldH LOCAL->OldH_ +#define REMOTE_OldH(wid) REMOTE(wid)->OldH_ +#define LOCAL_OldH0 LOCAL->OldH0_ +#define REMOTE_OldH0(wid) REMOTE(wid)->OldH0_ +#define LOCAL_OldTrailBase LOCAL->OldTrailBase_ +#define REMOTE_OldTrailBase(wid) REMOTE(wid)->OldTrailBase_ +#define LOCAL_OldTrailTop LOCAL->OldTrailTop_ +#define REMOTE_OldTrailTop(wid) REMOTE(wid)->OldTrailTop_ +#define LOCAL_OldHeapBase LOCAL->OldHeapBase_ +#define REMOTE_OldHeapBase(wid) REMOTE(wid)->OldHeapBase_ +#define LOCAL_OldHeapTop LOCAL->OldHeapTop_ +#define REMOTE_OldHeapTop(wid) REMOTE(wid)->OldHeapTop_ +#define LOCAL_ClDiff LOCAL->ClDiff_ +#define REMOTE_ClDiff(wid) REMOTE(wid)->ClDiff_ +#define LOCAL_GDiff LOCAL->GDiff_ +#define REMOTE_GDiff(wid) REMOTE(wid)->GDiff_ +#define LOCAL_HDiff LOCAL->HDiff_ +#define REMOTE_HDiff(wid) REMOTE(wid)->HDiff_ +#define LOCAL_GDiff0 LOCAL->GDiff0_ +#define REMOTE_GDiff0(wid) REMOTE(wid)->GDiff0_ +#define LOCAL_GSplit LOCAL->GSplit_ +#define REMOTE_GSplit(wid) REMOTE(wid)->GSplit_ +#define LOCAL_LDiff LOCAL->LDiff_ +#define REMOTE_LDiff(wid) REMOTE(wid)->LDiff_ +#define LOCAL_TrDiff LOCAL->TrDiff_ +#define REMOTE_TrDiff(wid) REMOTE(wid)->TrDiff_ +#define LOCAL_XDiff LOCAL->XDiff_ +#define REMOTE_XDiff(wid) REMOTE(wid)->XDiff_ +#define LOCAL_DelayDiff LOCAL->DelayDiff_ +#define REMOTE_DelayDiff(wid) REMOTE(wid)->DelayDiff_ +#define LOCAL_BaseDiff LOCAL->BaseDiff_ +#define REMOTE_BaseDiff(wid) REMOTE(wid)->BaseDiff_ + +#define LOCAL_ReductionsCounter LOCAL->ReductionsCounter_ +#define REMOTE_ReductionsCounter(wid) REMOTE(wid)->ReductionsCounter_ +#define LOCAL_PredEntriesCounter LOCAL->PredEntriesCounter_ +#define REMOTE_PredEntriesCounter(wid) REMOTE(wid)->PredEntriesCounter_ +#define LOCAL_RetriesCounter LOCAL->RetriesCounter_ +#define REMOTE_RetriesCounter(wid) REMOTE(wid)->RetriesCounter_ +#define LOCAL_ReductionsCounterOn LOCAL->ReductionsCounterOn_ +#define REMOTE_ReductionsCounterOn(wid) REMOTE(wid)->ReductionsCounterOn_ +#define LOCAL_PredEntriesCounterOn LOCAL->PredEntriesCounterOn_ +#define REMOTE_PredEntriesCounterOn(wid) REMOTE(wid)->PredEntriesCounterOn_ +#define LOCAL_RetriesCounterOn LOCAL->RetriesCounterOn_ +#define REMOTE_RetriesCounterOn(wid) REMOTE(wid)->RetriesCounterOn_ + + +#define LOCAL_ConsultSp LOCAL->ConsultSp_ +#define REMOTE_ConsultSp(wid) REMOTE(wid)->ConsultSp_ + +#define LOCAL_ConsultCapacity LOCAL->ConsultCapacity_ +#define REMOTE_ConsultCapacity(wid) REMOTE(wid)->ConsultCapacity_ + +#define LOCAL_ConsultBase LOCAL->ConsultBase_ +#define REMOTE_ConsultBase(wid) REMOTE(wid)->ConsultBase_ + +#define LOCAL_ConsultLow LOCAL->ConsultLow_ +#define REMOTE_ConsultLow(wid) REMOTE(wid)->ConsultLow_ + +#define LOCAL_GlobalArena LOCAL->GlobalArena_ +#define REMOTE_GlobalArena(wid) REMOTE(wid)->GlobalArena_ +#define LOCAL_GlobalArenaOverflows LOCAL->GlobalArenaOverflows_ +#define REMOTE_GlobalArenaOverflows(wid) REMOTE(wid)->GlobalArenaOverflows_ +#define LOCAL_ArenaOverflows LOCAL->ArenaOverflows_ +#define REMOTE_ArenaOverflows(wid) REMOTE(wid)->ArenaOverflows_ +#define LOCAL_DepthArenas LOCAL->DepthArenas_ +#define REMOTE_DepthArenas(wid) REMOTE(wid)->DepthArenas_ +#define LOCAL_ArithError LOCAL->ArithError_ +#define REMOTE_ArithError(wid) REMOTE(wid)->ArithError_ +#define LOCAL_LastAssertedPred LOCAL->LastAssertedPred_ +#define REMOTE_LastAssertedPred(wid) REMOTE(wid)->LastAssertedPred_ +#define LOCAL_ScannerStack LOCAL->ScannerStack_ +#define REMOTE_ScannerStack(wid) REMOTE(wid)->ScannerStack_ +#define LOCAL_ScannerExtraBlocks LOCAL->ScannerExtraBlocks_ +#define REMOTE_ScannerExtraBlocks(wid) REMOTE(wid)->ScannerExtraBlocks_ +#define LOCAL_BallTerm LOCAL->BallTerm_ +#define REMOTE_BallTerm(wid) REMOTE(wid)->BallTerm_ +#define LOCAL_ActiveSignals LOCAL->ActiveSignals_ +#define REMOTE_ActiveSignals(wid) REMOTE(wid)->ActiveSignals_ +#define LOCAL_MaxActiveSignals LOCAL->MaxActiveSignals_ +#define REMOTE_MaxActiveSignals(wid) REMOTE(wid)->MaxActiveSignals_ +#define LOCAL_FirstActiveSignal LOCAL->FirstActiveSignal_ +#define REMOTE_FirstActiveSignal(wid) REMOTE(wid)->FirstActiveSignal_ +#define LOCAL_LastActiveSignal LOCAL->LastActiveSignal_ +#define REMOTE_LastActiveSignal(wid) REMOTE(wid)->LastActiveSignal_ +#define LOCAL_IPredArity LOCAL->IPredArity_ +#define REMOTE_IPredArity(wid) REMOTE(wid)->IPredArity_ +#define LOCAL_ProfEnd LOCAL->ProfEnd_ +#define REMOTE_ProfEnd(wid) REMOTE(wid)->ProfEnd_ +#define LOCAL_UncaughtThrow LOCAL->UncaughtThrow_ +#define REMOTE_UncaughtThrow(wid) REMOTE(wid)->UncaughtThrow_ +#define LOCAL_DoingUndefp LOCAL->DoingUndefp_ +#define REMOTE_DoingUndefp(wid) REMOTE(wid)->DoingUndefp_ +#define LOCAL_StartLine LOCAL->StartLine_ +#define REMOTE_StartLine(wid) REMOTE(wid)->StartLine_ +#define LOCAL_ScratchPad LOCAL->ScratchPad_ +#define REMOTE_ScratchPad(wid) REMOTE(wid)->ScratchPad_ +#ifdef COROUTINING +#define LOCAL_WokenGoals LOCAL->WokenGoals_ +#define REMOTE_WokenGoals(wid) REMOTE(wid)->WokenGoals_ +#define LOCAL_AttsMutableList LOCAL->AttsMutableList_ +#define REMOTE_AttsMutableList(wid) REMOTE(wid)->AttsMutableList_ +#endif + +#define LOCAL_GcGeneration LOCAL->GcGeneration_ +#define REMOTE_GcGeneration(wid) REMOTE(wid)->GcGeneration_ +#define LOCAL_GcPhase LOCAL->GcPhase_ +#define REMOTE_GcPhase(wid) REMOTE(wid)->GcPhase_ +#define LOCAL_GcCurrentPhase LOCAL->GcCurrentPhase_ +#define REMOTE_GcCurrentPhase(wid) REMOTE(wid)->GcCurrentPhase_ +#define LOCAL_GcCalls LOCAL->GcCalls_ +#define REMOTE_GcCalls(wid) REMOTE(wid)->GcCalls_ +#define LOCAL_TotGcTime LOCAL->TotGcTime_ +#define REMOTE_TotGcTime(wid) REMOTE(wid)->TotGcTime_ +#define LOCAL_TotGcRecovered LOCAL->TotGcRecovered_ +#define REMOTE_TotGcRecovered(wid) REMOTE(wid)->TotGcRecovered_ +#define LOCAL_LastGcTime LOCAL->LastGcTime_ +#define REMOTE_LastGcTime(wid) REMOTE(wid)->LastGcTime_ +#define LOCAL_LastSSTime LOCAL->LastSSTime_ +#define REMOTE_LastSSTime(wid) REMOTE(wid)->LastSSTime_ +#define LOCAL_OpenArray LOCAL->OpenArray_ +#define REMOTE_OpenArray(wid) REMOTE(wid)->OpenArray_ + +#define LOCAL_total_marked LOCAL->total_marked_ +#define REMOTE_total_marked(wid) REMOTE(wid)->total_marked_ +#define LOCAL_total_oldies LOCAL->total_oldies_ +#define REMOTE_total_oldies(wid) REMOTE(wid)->total_oldies_ +#define LOCAL_current_B LOCAL->current_B_ +#define REMOTE_current_B(wid) REMOTE(wid)->current_B_ +#define LOCAL_prev_HB LOCAL->prev_HB_ +#define REMOTE_prev_HB(wid) REMOTE(wid)->prev_HB_ +#define LOCAL_HGEN LOCAL->HGEN_ +#define REMOTE_HGEN(wid) REMOTE(wid)->HGEN_ +#define LOCAL_iptop LOCAL->iptop_ +#define REMOTE_iptop(wid) REMOTE(wid)->iptop_ +#if defined(GC_NO_TAGS) +#define LOCAL_bp LOCAL->bp_ +#define REMOTE_bp(wid) REMOTE(wid)->bp_ +#endif +#define LOCAL_sTR LOCAL->sTR_ +#define REMOTE_sTR(wid) REMOTE(wid)->sTR_ +#define LOCAL_sTR0 LOCAL->sTR0_ +#define REMOTE_sTR0(wid) REMOTE(wid)->sTR0_ +#define LOCAL_new_TR LOCAL->new_TR_ +#define REMOTE_new_TR(wid) REMOTE(wid)->new_TR_ +#define LOCAL_cont_top0 LOCAL->cont_top0_ +#define REMOTE_cont_top0(wid) REMOTE(wid)->cont_top0_ +#define LOCAL_cont_top LOCAL->cont_top_ +#define REMOTE_cont_top(wid) REMOTE(wid)->cont_top_ +#define LOCAL_discard_trail_entries LOCAL->discard_trail_entries_ +#define REMOTE_discard_trail_entries(wid) REMOTE(wid)->discard_trail_entries_ +#define LOCAL_gc_ma_hash_table LOCAL->gc_ma_hash_table_ +#define REMOTE_gc_ma_hash_table(wid) REMOTE(wid)->gc_ma_hash_table_ +#define LOCAL_gc_ma_h_top LOCAL->gc_ma_h_top_ +#define REMOTE_gc_ma_h_top(wid) REMOTE(wid)->gc_ma_h_top_ +#define LOCAL_gc_ma_h_list LOCAL->gc_ma_h_list_ +#define REMOTE_gc_ma_h_list(wid) REMOTE(wid)->gc_ma_h_list_ +#define LOCAL_gc_timestamp LOCAL->gc_timestamp_ +#define REMOTE_gc_timestamp(wid) REMOTE(wid)->gc_timestamp_ +#define LOCAL_db_vec LOCAL->db_vec_ +#define REMOTE_db_vec(wid) REMOTE(wid)->db_vec_ +#define LOCAL_db_vec0 LOCAL->db_vec0_ +#define REMOTE_db_vec0(wid) REMOTE(wid)->db_vec0_ +#define LOCAL_db_root LOCAL->db_root_ +#define REMOTE_db_root(wid) REMOTE(wid)->db_root_ +#define LOCAL_db_nil LOCAL->db_nil_ +#define REMOTE_db_nil(wid) REMOTE(wid)->db_nil_ +#define LOCAL_gc_restore LOCAL->gc_restore_ +#define REMOTE_gc_restore(wid) REMOTE(wid)->gc_restore_ +#define LOCAL_extra_gc_cells LOCAL->extra_gc_cells_ +#define REMOTE_extra_gc_cells(wid) REMOTE(wid)->extra_gc_cells_ +#define LOCAL_extra_gc_cells_base LOCAL->extra_gc_cells_base_ +#define REMOTE_extra_gc_cells_base(wid) REMOTE(wid)->extra_gc_cells_base_ +#define LOCAL_extra_gc_cells_top LOCAL->extra_gc_cells_top_ +#define REMOTE_extra_gc_cells_top(wid) REMOTE(wid)->extra_gc_cells_top_ +#define LOCAL_extra_gc_cells_size LOCAL->extra_gc_cells_size_ +#define REMOTE_extra_gc_cells_size(wid) REMOTE(wid)->extra_gc_cells_size_ +#define LOCAL_DynamicArrays LOCAL->DynamicArrays_ +#define REMOTE_DynamicArrays(wid) REMOTE(wid)->DynamicArrays_ +#define LOCAL_StaticArrays LOCAL->StaticArrays_ +#define REMOTE_StaticArrays(wid) REMOTE(wid)->StaticArrays_ +#define LOCAL_GlobalVariables LOCAL->GlobalVariables_ +#define REMOTE_GlobalVariables(wid) REMOTE(wid)->GlobalVariables_ +#define LOCAL_AllowRestart LOCAL->AllowRestart_ +#define REMOTE_AllowRestart(wid) REMOTE(wid)->AllowRestart_ + +#define LOCAL_CMemFirstBlock LOCAL->CMemFirstBlock_ +#define REMOTE_CMemFirstBlock(wid) REMOTE(wid)->CMemFirstBlock_ +#define LOCAL_CMemFirstBlockSz LOCAL->CMemFirstBlockSz_ +#define REMOTE_CMemFirstBlockSz(wid) REMOTE(wid)->CMemFirstBlockSz_ + +#define LOCAL_nperm LOCAL->nperm_ +#define REMOTE_nperm(wid) REMOTE(wid)->nperm_ + +#define LOCAL_LabelFirstArray LOCAL->LabelFirstArray_ +#define REMOTE_LabelFirstArray(wid) REMOTE(wid)->LabelFirstArray_ +#define LOCAL_LabelFirstArraySz LOCAL->LabelFirstArraySz_ +#define REMOTE_LabelFirstArraySz(wid) REMOTE(wid)->LabelFirstArraySz_ + +#define LOCAL_PL_local_data_p LOCAL->PL_local_data_p_ +#define REMOTE_PL_local_data_p(wid) REMOTE(wid)->PL_local_data_p_ +#ifdef THREADS +#define LOCAL_ThreadHandle LOCAL->ThreadHandle_ +#define REMOTE_ThreadHandle(wid) REMOTE(wid)->ThreadHandle_ +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) +#define LOCAL_optyap_data LOCAL->optyap_data_ +#define REMOTE_optyap_data(wid) REMOTE(wid)->optyap_data_ +#endif /* YAPOR || TABLING */ +#define LOCAL_InterruptsDisabled LOCAL->InterruptsDisabled_ +#define REMOTE_InterruptsDisabled(wid) REMOTE(wid)->InterruptsDisabled_ +#define LOCAL_execution LOCAL->execution_ +#define REMOTE_execution(wid) REMOTE(wid)->execution_ +#if LOW_LEVEL_TRACER +#define LOCAL_total_choicepoints LOCAL->total_choicepoints_ +#define REMOTE_total_choicepoints(wid) REMOTE(wid)->total_choicepoints_ +#endif +#define LOCAL_consult_level LOCAL->consult_level_ +#define REMOTE_consult_level(wid) REMOTE(wid)->consult_level_ +#if defined(YAPOR) || defined(THREADS) +#define LOCAL_SignalLock LOCAL->SignalLock_ +#define REMOTE_SignalLock(wid) REMOTE(wid)->SignalLock_ +#endif + +#define LOCAL_LocalBase LOCAL->LocalBase_ +#define REMOTE_LocalBase(wid) REMOTE(wid)->LocalBase_ +#define LOCAL_GlobalBase LOCAL->GlobalBase_ +#define REMOTE_GlobalBase(wid) REMOTE(wid)->GlobalBase_ +#define LOCAL_TrailBase LOCAL->TrailBase_ +#define REMOTE_TrailBase(wid) REMOTE(wid)->TrailBase_ +#define LOCAL_TrailTop LOCAL->TrailTop_ +#define REMOTE_TrailTop(wid) REMOTE(wid)->TrailTop_ +#define LOCAL_ErrorMessage LOCAL->ErrorMessage_ +#define REMOTE_ErrorMessage(wid) REMOTE(wid)->ErrorMessage_ +#define LOCAL_Error_Term LOCAL->Error_Term_ +#define REMOTE_Error_Term(wid) REMOTE(wid)->Error_Term_ +#ifdef THREADS +#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ +#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ +#else +#define LOCAL_Error_TYPE LOCAL->Error_TYPE_ +#define REMOTE_Error_TYPE(wid) REMOTE(wid)->Error_TYPE_ +#endif +#define LOCAL_Error_Size LOCAL->Error_Size_ +#define REMOTE_Error_Size(wid) REMOTE(wid)->Error_Size_ +#define LOCAL_ErrorSay LOCAL->ErrorSay_ +#define REMOTE_ErrorSay(wid) REMOTE(wid)->ErrorSay_ +#define LOCAL_IOBotch LOCAL->IOBotch_ +#define REMOTE_IOBotch(wid) REMOTE(wid)->IOBotch_ +#define LOCAL_tokptr LOCAL->tokptr_ +#define REMOTE_tokptr(wid) REMOTE(wid)->tokptr_ +#define LOCAL_toktide LOCAL->toktide_ +#define REMOTE_toktide(wid) REMOTE(wid)->toktide_ +#define LOCAL_VarTable LOCAL->VarTable_ +#define REMOTE_VarTable(wid) REMOTE(wid)->VarTable_ +#define LOCAL_AnonVarTable LOCAL->AnonVarTable_ +#define REMOTE_AnonVarTable(wid) REMOTE(wid)->AnonVarTable_ +#define LOCAL_Comments LOCAL->Comments_ +#define REMOTE_Comments(wid) REMOTE(wid)->Comments_ +#define LOCAL_CommentsTail LOCAL->CommentsTail_ +#define REMOTE_CommentsTail(wid) REMOTE(wid)->CommentsTail_ +#define LOCAL_CommentsNextChar LOCAL->CommentsNextChar_ +#define REMOTE_CommentsNextChar(wid) REMOTE(wid)->CommentsNextChar_ +#define LOCAL_CommentsBuff LOCAL->CommentsBuff_ +#define REMOTE_CommentsBuff(wid) REMOTE(wid)->CommentsBuff_ +#define LOCAL_CommentsBuffPos LOCAL->CommentsBuffPos_ +#define REMOTE_CommentsBuffPos(wid) REMOTE(wid)->CommentsBuffPos_ +#define LOCAL_CommentsBuffLim LOCAL->CommentsBuffLim_ +#define REMOTE_CommentsBuffLim(wid) REMOTE(wid)->CommentsBuffLim_ +#define LOCAL_RestartEnv LOCAL->RestartEnv_ +#define REMOTE_RestartEnv(wid) REMOTE(wid)->RestartEnv_ +#define LOCAL_FileNameBuf LOCAL->FileNameBuf_ +#define REMOTE_FileNameBuf(wid) REMOTE(wid)->FileNameBuf_ +#define LOCAL_FileNameBuf2 LOCAL->FileNameBuf2_ +#define REMOTE_FileNameBuf2(wid) REMOTE(wid)->FileNameBuf2_ + +#define LOCAL_PrologMode LOCAL->PrologMode_ +#define REMOTE_PrologMode(wid) REMOTE(wid)->PrologMode_ +#define LOCAL_CritLocks LOCAL->CritLocks_ +#define REMOTE_CritLocks(wid) REMOTE(wid)->CritLocks_ + + +#ifdef ANALYST +#define LOCAL_opcount LOCAL->opcount_ +#define REMOTE_opcount(wid) REMOTE(wid)->opcount_ +#define LOCAL_2opcount LOCAL->2opcount_ +#define REMOTE_2opcount(wid) REMOTE(wid)->2opcount_ +#endif /* ANALYST */ + +#define LOCAL_s_dbg LOCAL->s_dbg_ +#define REMOTE_s_dbg(wid) REMOTE(wid)->s_dbg_ + +#define LOCAL_matherror LOCAL->matherror_ +#define REMOTE_matherror(wid) REMOTE(wid)->matherror_ +#define LOCAL_CurrentError LOCAL->CurrentError_ +#define REMOTE_CurrentError(wid) REMOTE(wid)->CurrentError_ + +#define LOCAL_heap_overflows LOCAL->heap_overflows_ +#define REMOTE_heap_overflows(wid) REMOTE(wid)->heap_overflows_ +#define LOCAL_total_heap_overflow_time LOCAL->total_heap_overflow_time_ +#define REMOTE_total_heap_overflow_time(wid) REMOTE(wid)->total_heap_overflow_time_ +#define LOCAL_stack_overflows LOCAL->stack_overflows_ +#define REMOTE_stack_overflows(wid) REMOTE(wid)->stack_overflows_ +#define LOCAL_total_stack_overflow_time LOCAL->total_stack_overflow_time_ +#define REMOTE_total_stack_overflow_time(wid) REMOTE(wid)->total_stack_overflow_time_ +#define LOCAL_delay_overflows LOCAL->delay_overflows_ +#define REMOTE_delay_overflows(wid) REMOTE(wid)->delay_overflows_ +#define LOCAL_total_delay_overflow_time LOCAL->total_delay_overflow_time_ +#define REMOTE_total_delay_overflow_time(wid) REMOTE(wid)->total_delay_overflow_time_ +#define LOCAL_trail_overflows LOCAL->trail_overflows_ +#define REMOTE_trail_overflows(wid) REMOTE(wid)->trail_overflows_ +#define LOCAL_total_trail_overflow_time LOCAL->total_trail_overflow_time_ +#define REMOTE_total_trail_overflow_time(wid) REMOTE(wid)->total_trail_overflow_time_ +#define LOCAL_atom_table_overflows LOCAL->atom_table_overflows_ +#define REMOTE_atom_table_overflows(wid) REMOTE(wid)->atom_table_overflows_ +#define LOCAL_total_atom_table_overflow_time LOCAL->total_atom_table_overflow_time_ +#define REMOTE_total_atom_table_overflow_time(wid) REMOTE(wid)->total_atom_table_overflow_time_ + +#ifdef LOAD_DYLD +#define LOCAL_dl_errno LOCAL->dl_errno_ +#define REMOTE_dl_errno(wid) REMOTE(wid)->dl_errno_ +#endif + +#ifdef LOW_LEVEL_TRACER +#define LOCAL_do_trace_primitives LOCAL->do_trace_primitives_ +#define REMOTE_do_trace_primitives(wid) REMOTE(wid)->do_trace_primitives_ +#endif + +#define LOCAL_ExportAtomHashChain LOCAL->ExportAtomHashChain_ +#define REMOTE_ExportAtomHashChain(wid) REMOTE(wid)->ExportAtomHashChain_ +#define LOCAL_ExportAtomHashTableSize LOCAL->ExportAtomHashTableSize_ +#define REMOTE_ExportAtomHashTableSize(wid) REMOTE(wid)->ExportAtomHashTableSize_ +#define LOCAL_ExportAtomHashTableNum LOCAL->ExportAtomHashTableNum_ +#define REMOTE_ExportAtomHashTableNum(wid) REMOTE(wid)->ExportAtomHashTableNum_ +#define LOCAL_ExportFunctorHashChain LOCAL->ExportFunctorHashChain_ +#define REMOTE_ExportFunctorHashChain(wid) REMOTE(wid)->ExportFunctorHashChain_ +#define LOCAL_ExportFunctorHashTableSize LOCAL->ExportFunctorHashTableSize_ +#define REMOTE_ExportFunctorHashTableSize(wid) REMOTE(wid)->ExportFunctorHashTableSize_ +#define LOCAL_ExportFunctorHashTableNum LOCAL->ExportFunctorHashTableNum_ +#define REMOTE_ExportFunctorHashTableNum(wid) REMOTE(wid)->ExportFunctorHashTableNum_ +#define LOCAL_ExportPredEntryHashChain LOCAL->ExportPredEntryHashChain_ +#define REMOTE_ExportPredEntryHashChain(wid) REMOTE(wid)->ExportPredEntryHashChain_ +#define LOCAL_ExportPredEntryHashTableSize LOCAL->ExportPredEntryHashTableSize_ +#define REMOTE_ExportPredEntryHashTableSize(wid) REMOTE(wid)->ExportPredEntryHashTableSize_ +#define LOCAL_ExportPredEntryHashTableNum LOCAL->ExportPredEntryHashTableNum_ +#define REMOTE_ExportPredEntryHashTableNum(wid) REMOTE(wid)->ExportPredEntryHashTableNum_ +#define LOCAL_ExportDBRefHashChain LOCAL->ExportDBRefHashChain_ +#define REMOTE_ExportDBRefHashChain(wid) REMOTE(wid)->ExportDBRefHashChain_ +#define LOCAL_ExportDBRefHashTableSize LOCAL->ExportDBRefHashTableSize_ +#define REMOTE_ExportDBRefHashTableSize(wid) REMOTE(wid)->ExportDBRefHashTableSize_ +#define LOCAL_ExportDBRefHashTableNum LOCAL->ExportDBRefHashTableNum_ +#define REMOTE_ExportDBRefHashTableNum(wid) REMOTE(wid)->ExportDBRefHashTableNum_ +#define LOCAL_ImportAtomHashChain LOCAL->ImportAtomHashChain_ +#define REMOTE_ImportAtomHashChain(wid) REMOTE(wid)->ImportAtomHashChain_ +#define LOCAL_ImportAtomHashTableSize LOCAL->ImportAtomHashTableSize_ +#define REMOTE_ImportAtomHashTableSize(wid) REMOTE(wid)->ImportAtomHashTableSize_ +#define LOCAL_ImportAtomHashTableNum LOCAL->ImportAtomHashTableNum_ +#define REMOTE_ImportAtomHashTableNum(wid) REMOTE(wid)->ImportAtomHashTableNum_ +#define LOCAL_ImportFunctorHashChain LOCAL->ImportFunctorHashChain_ +#define REMOTE_ImportFunctorHashChain(wid) REMOTE(wid)->ImportFunctorHashChain_ +#define LOCAL_ImportFunctorHashTableSize LOCAL->ImportFunctorHashTableSize_ +#define REMOTE_ImportFunctorHashTableSize(wid) REMOTE(wid)->ImportFunctorHashTableSize_ +#define LOCAL_ImportFunctorHashTableNum LOCAL->ImportFunctorHashTableNum_ +#define REMOTE_ImportFunctorHashTableNum(wid) REMOTE(wid)->ImportFunctorHashTableNum_ +#define LOCAL_ImportOPCODEHashChain LOCAL->ImportOPCODEHashChain_ +#define REMOTE_ImportOPCODEHashChain(wid) REMOTE(wid)->ImportOPCODEHashChain_ +#define LOCAL_ImportOPCODEHashTableSize LOCAL->ImportOPCODEHashTableSize_ +#define REMOTE_ImportOPCODEHashTableSize(wid) REMOTE(wid)->ImportOPCODEHashTableSize_ +#define LOCAL_ImportPredEntryHashChain LOCAL->ImportPredEntryHashChain_ +#define REMOTE_ImportPredEntryHashChain(wid) REMOTE(wid)->ImportPredEntryHashChain_ +#define LOCAL_ImportPredEntryHashTableSize LOCAL->ImportPredEntryHashTableSize_ +#define REMOTE_ImportPredEntryHashTableSize(wid) REMOTE(wid)->ImportPredEntryHashTableSize_ +#define LOCAL_ImportPredEntryHashTableNum LOCAL->ImportPredEntryHashTableNum_ +#define REMOTE_ImportPredEntryHashTableNum(wid) REMOTE(wid)->ImportPredEntryHashTableNum_ +#define LOCAL_ImportDBRefHashChain LOCAL->ImportDBRefHashChain_ +#define REMOTE_ImportDBRefHashChain(wid) REMOTE(wid)->ImportDBRefHashChain_ +#define LOCAL_ImportDBRefHashTableSize LOCAL->ImportDBRefHashTableSize_ +#define REMOTE_ImportDBRefHashTableSize(wid) REMOTE(wid)->ImportDBRefHashTableSize_ +#define LOCAL_ImportDBRefHashTableNum LOCAL->ImportDBRefHashTableNum_ +#define REMOTE_ImportDBRefHashTableNum(wid) REMOTE(wid)->ImportDBRefHashTableNum_ +#define LOCAL_ImportFAILCODE LOCAL->ImportFAILCODE_ +#define REMOTE_ImportFAILCODE(wid) REMOTE(wid)->ImportFAILCODE_ +#define LOCAL_FunctorVar LOCAL->FunctorVar_ +#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_ + +#define LOCAL_ibnds LOCAL->ibnds_ +#define REMOTE_ibnds(wid) REMOTE(wid)->ibnds_ +#define LOCAL_exo_it LOCAL->exo_it_ +#define REMOTE_exo_it(wid) REMOTE(wid)->exo_it_ +#define LOCAL_exo_base LOCAL->exo_base_ +#define REMOTE_exo_base(wid) REMOTE(wid)->exo_base_ +#define LOCAL_exo_arity LOCAL->exo_arity_ +#define REMOTE_exo_arity(wid) REMOTE(wid)->exo_arity_ +#define LOCAL_exo_arg LOCAL->exo_arg_ +#define REMOTE_exo_arg(wid) REMOTE(wid)->exo_arg_ + +#define LOCAL_search_atoms LOCAL->search_atoms_ +#define REMOTE_search_atoms(wid) REMOTE(wid)->search_atoms_ + +#define LOCAL_CurSlot LOCAL->CurSlot_ +#define REMOTE_CurSlot(wid) REMOTE(wid)->CurSlot_ +#define LOCAL_SourceModule LOCAL->SourceModule_ +#define REMOTE_SourceModule(wid) REMOTE(wid)->SourceModule_ +#define LOCAL_MAX_SIZE LOCAL->MAX_SIZE_ +#define REMOTE_MAX_SIZE(wid) REMOTE(wid)->MAX_SIZE_ + diff --git a/H/hglobals.h b/H/hglobals.h index 44536c45e..b9274c30b 100644 --- a/H/hglobals.h +++ b/H/hglobals.h @@ -1,119 +1,119 @@ - - /* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -typedef struct global_data { - - int Initialised_; - int InitialisedFromPL_; - int PL_Argc_; - char** PL_Argv_; - - struct halt_hook* HaltHooks_; - - int AllowLocalExpansion_; - int AllowGlobalExpansion_; - int AllowTrailExpansion_; - UInt SizeOfOverflow_; - - UInt AGcThreshold_; - Agc_hook AGCHook_; - -#if THREADS - - UInt NOfThreads_; - - UInt NOfThreadsCreated_; - - UInt ThreadsTotalTime_; - - lockvar ThreadHandlesLock_; -#endif -#if defined(YAPOR) || defined(THREADS) - - lockvar BGL_; -#endif -#if defined(YAPOR) || defined(TABLING) - struct global_optyap_data optyap_data_; -#endif /* YAPOR || TABLING */ - - int PrologShouldHandleInterrupts_; - -#if defined(THREADS) - pthread_t master_thread_; -#endif /* THREADS */ - - YP_FILE* stdout_; - YP_FILE* stderr_; - - char** argv_; - int argc_; - -#ifdef COROUTINING - - ext_op attas_[attvars_ext+1]; -#endif - - int agc_calls_; - YAP_ULONG_LONG agc_collected_; - - Int tot_agc_time_; - - Int tot_agc_recovered_; - -#if HAVE_MMAP - struct MMAP_ARRAY_BLOCK* mmap_arrays_; -#endif -#ifdef DEBUG - - char Option_[20]; - YP_FILE* logfile_; - - -#endif -#if defined(COFF) || defined(A_OUT) - - char Executable_[YAP_FILENAME_MAX]; -#endif - int OpaqueHandlersCount_; - struct opaque_handler_struct* OpaqueHandlers_; -#if __simplescalar__ - char pwd_[YAP_FILENAME_MAX]; -#endif - - - char* RestoreFile_; - - Int ProfCalls_; - Int ProfGCs_; - Int ProfHGrows_; - Int ProfSGrows_; - Int ProfMallocs_; - Int ProfIndexing_; - Int ProfOn_; - Int ProfOns_; - struct RB_red_blk_node* ProfilerRoot_; - struct RB_red_blk_node* ProfilerNil_; - char* DIRNAME_; -#if LOW_PROF - int ProfilerOn_; - FILE* FProf_; - FILE* FPreds_; -#endif /* LOW_PROF */ -} w_shared; + + /* This file, hglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +typedef struct global_data { + + int Initialised_; + int InitialisedFromPL_; + int PL_Argc_; + char** PL_Argv_; + + struct halt_hook* HaltHooks_; + + int AllowLocalExpansion_; + int AllowGlobalExpansion_; + int AllowTrailExpansion_; + UInt SizeOfOverflow_; + + UInt AGcThreshold_; + Agc_hook AGCHook_; + +#if THREADS + + UInt NOfThreads_; + + UInt NOfThreadsCreated_; + + UInt ThreadsTotalTime_; + + lockvar ThreadHandlesLock_; +#endif +#if defined(YAPOR) || defined(THREADS) + + lockvar BGL_; +#endif +#if defined(YAPOR) || defined(TABLING) + struct global_optyap_data optyap_data_; +#endif /* YAPOR || TABLING */ + + int PrologShouldHandleInterrupts_; + +#if defined(THREADS) + pthread_t master_thread_; +#endif /* THREADS */ + + struct io_stream* stdout_; + struct io_stream* stderr_; + + char** argv_; + int argc_; + +#ifdef COROUTINING + + ext_op attas_[attvars_ext+1]; +#endif + + int agc_calls_; + YAP_ULONG_LONG agc_collected_; + + Int tot_agc_time_; + + Int tot_agc_recovered_; + +#if HAVE_MMAP + struct MMAP_ARRAY_BLOCK* mmap_arrays_; +#endif +#ifdef DEBUG + + char Option_[20]; + YP_FILE* logfile_; + + +#endif +#if defined(COFF) || defined(A_OUT) + + char Executable_[YAP_FILENAME_MAX]; +#endif + int OpaqueHandlersCount_; + struct opaque_handler_struct* OpaqueHandlers_; +#if __simplescalar__ + char pwd_[YAP_FILENAME_MAX]; +#endif + + + char* RestoreFile_; + + Int ProfCalls_; + Int ProfGCs_; + Int ProfHGrows_; + Int ProfSGrows_; + Int ProfMallocs_; + Int ProfIndexing_; + Int ProfOn_; + Int ProfOns_; + struct RB_red_blk_node* ProfilerRoot_; + struct RB_red_blk_node* ProfilerNil_; + char* DIRNAME_; +#if LOW_PROF + int ProfilerOn_; + FILE* FProf_; + FILE* FPreds_; +#endif /* LOW_PROF */ +} w_shared; diff --git a/H/hlocals.h b/H/hlocals.h index c0c7409eb..48ffeb3fa 100644 --- a/H/hlocals.h +++ b/H/hlocals.h @@ -1,239 +1,242 @@ - - /* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -typedef struct worker_local { - - int c_input_stream_; - int c_output_stream_; - int c_error_stream_; - - CELL* OldASP_; - CELL* OldLCL0_; - tr_fr_ptr OldTR_; - CELL* OldGlobalBase_; - CELL* OldH_; - CELL* OldH0_; - ADDR OldTrailBase_; - ADDR OldTrailTop_; - ADDR OldHeapBase_; - ADDR OldHeapTop_; - Int ClDiff_; - Int GDiff_; - Int HDiff_; - Int GDiff0_; - CELL* GSplit_; - Int LDiff_; - Int TrDiff_; - Int XDiff_; - Int DelayDiff_; - Int BaseDiff_; - - YAP_ULONG_LONG ReductionsCounter_; - YAP_ULONG_LONG PredEntriesCounter_; - YAP_ULONG_LONG RetriesCounter_; - int ReductionsCounterOn_; - int PredEntriesCounterOn_; - int RetriesCounterOn_; - - - union CONSULT_OBJ* ConsultSp_; - - UInt ConsultCapacity_; - - union CONSULT_OBJ* ConsultBase_; - - union CONSULT_OBJ* ConsultLow_; - - Term GlobalArena_; - UInt GlobalArenaOverflows_; - Int ArenaOverflows_; - Int DepthArenas_; - int ArithError_; - struct pred_entry* LastAssertedPred_; - char* ScannerStack_; - struct scanner_extra_alloc* ScannerExtraBlocks_; - struct DB_TERM* BallTerm_; - UInt ActiveSignals_; - UInt IPredArity_; - yamop* ProfEnd_; - int UncaughtThrow_; - int DoingUndefp_; - Int StartLine_; - scratch_block ScratchPad_; -#ifdef COROUTINING - Term WokenGoals_; - Term AttsMutableList_; -#endif - - Term GcGeneration_; - Term GcPhase_; - UInt GcCurrentPhase_; - UInt GcCalls_; - Int TotGcTime_; - YAP_ULONG_LONG TotGcRecovered_; - Int LastGcTime_; - Int LastSSTime_; - CELL* OpenArray_; - - Int total_marked_; - Int total_oldies_; - struct choicept* current_B_; - CELL* prev_HB_; - CELL* HGEN_; - CELL** iptop_; -#if defined(GC_NO_TAGS) - char* bp_; -#endif - tr_fr_ptr sTR_; - tr_fr_ptr sTR0_; - tr_fr_ptr new_TR_; - struct gc_mark_continuation* cont_top0_; - struct gc_mark_continuation* cont_top_; - int discard_trail_entries_; - gc_ma_hash_entry gc_ma_hash_table_[GC_MAVARS_HASH_SIZE]; - gc_ma_hash_entry* gc_ma_h_top_; - gc_ma_hash_entry* gc_ma_h_list_; - UInt gc_timestamp_; - ADDR db_vec_; - ADDR db_vec0_; - struct RB_red_blk_node* db_root_; - struct RB_red_blk_node* db_nil_; - sigjmp_buf gc_restore_; - CELL* extra_gc_cells_; - CELL* extra_gc_cells_base_; - CELL* extra_gc_cells_top_; - UInt extra_gc_cells_size_; - struct array_entry* DynamicArrays_; - struct static_array_entry* StaticArrays_; - struct global_entry* GlobalVariables_; - int AllowRestart_; - - struct mem_blk* CMemFirstBlock_; - UInt CMemFirstBlockSz_; - - int nperm_; - - Int* LabelFirstArray_; - UInt LabelFirstArraySz_; - - struct PL_local_data* PL_local_data_p_; -#ifdef THREADS - struct thandle ThreadHandle_; -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - struct local_optyap_data optyap_data_; -#endif /* YAPOR || TABLING */ - int InterruptsDisabled_; - struct open_query_struct* execution_; -#if LOW_LEVEL_TRACER - Int total_choicepoints_; -#endif - int consult_level_; -#if defined(YAPOR) || defined(THREADS) - lockvar SignalLock_; -#endif - - ADDR LocalBase_; - ADDR GlobalBase_; - ADDR TrailBase_; - ADDR TrailTop_; - char* ErrorMessage_; - Term Error_Term_; -#ifdef THREADS - Term Error_TYPE_; -#else - yap_error_number Error_TYPE_; -#endif - UInt Error_Size_; - char ErrorSay_[MAX_ERROR_MSG_SIZE]; - jmp_buf IOBotch_; - TokEntry* tokptr_; - TokEntry* toktide_; - VarEntry* VarTable_; - VarEntry* AnonVarTable_; - Term Comments_; - CELL* CommentsTail_; - CELL* CommentsNextChar_; - wchar_t* CommentsBuff_; - size_t CommentsBuffPos_; - size_t CommentsBuffLim_; - sigjmp_buf RestartEnv_; - char FileNameBuf_[YAP_FILENAME_MAX]; - char FileNameBuf2_[YAP_FILENAME_MAX]; - - Int PrologMode_; - int CritLocks_; - - -#ifdef ANALYST - YAP_ULONG_LONG opcount_[_std_top+1]; - YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1]_; -#endif /* ANALYST */ - - struct db_globs* s_dbg_; - - yap_error_number matherror_; - yap_error_number CurrentError_; - - int heap_overflows_; - Int total_heap_overflow_time_; - int stack_overflows_; - Int total_stack_overflow_time_; - int delay_overflows_; - Int total_delay_overflow_time_; - int trail_overflows_; - Int total_trail_overflow_time_; - int atom_table_overflows_; - Int total_atom_table_overflow_time_; - -#ifdef LOAD_DYLD - int dl_errno_; -#endif - -#ifdef LOW_LEVEL_TRACER - int do_trace_primitives_; -#endif - - struct export_atom_hash_entry_struct *ExportAtomHashChain_; - UInt ExportAtomHashTableSize_; - UInt ExportAtomHashTableNum_; - struct export_functor_hash_entry_struct *ExportFunctorHashChain_; - UInt ExportFunctorHashTableSize_; - UInt ExportFunctorHashTableNum_; - struct export_pred_entry_hash_entry_struct *ExportPredEntryHashChain_; - UInt ExportPredEntryHashTableSize_; - UInt ExportPredEntryHashTableNum_; - struct export_dbref_hash_entry_struct *ExportDBRefHashChain_; - UInt ExportDBRefHashTableSize_; - UInt ExportDBRefHashTableNum_; - struct import_atom_hash_entry_struct **ImportAtomHashChain_; - UInt ImportAtomHashTableSize_; - UInt ImportAtomHashTableNum_; - struct import_functor_hash_entry_struct **ImportFunctorHashChain_; - UInt ImportFunctorHashTableSize_; - UInt ImportFunctorHashTableNum_; - struct import_opcode_hash_entry_struct **ImportOPCODEHashChain_; - UInt ImportOPCODEHashTableSize_; - struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain_; - UInt ImportPredEntryHashTableSize_; - UInt ImportPredEntryHashTableNum_; - struct import_dbref_hash_entry_struct **ImportDBRefHashChain_; - UInt ImportDBRefHashTableSize_; - UInt ImportDBRefHashTableNum_; - yamop *ImportFAILCODE_; - Functor FunctorVar_; - - UInt ibnds_[256]; - struct index_t* exo_it_; - CELL* exo_base_; - UInt exo_arity_; - UInt exo_arg_; - - struct scan_atoms* search_atoms_; - - Int CurSlot_; - Term SourceModule_; - size_t MAX_SIZE_; -} w_local; + + /* This file, hlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +typedef struct worker_local { + + int c_input_stream_; + int c_output_stream_; + int c_error_stream_; + + CELL* OldASP_; + CELL* OldLCL0_; + tr_fr_ptr OldTR_; + CELL* OldGlobalBase_; + CELL* OldH_; + CELL* OldH0_; + ADDR OldTrailBase_; + ADDR OldTrailTop_; + ADDR OldHeapBase_; + ADDR OldHeapTop_; + Int ClDiff_; + Int GDiff_; + Int HDiff_; + Int GDiff0_; + CELL* GSplit_; + Int LDiff_; + Int TrDiff_; + Int XDiff_; + Int DelayDiff_; + Int BaseDiff_; + + YAP_ULONG_LONG ReductionsCounter_; + YAP_ULONG_LONG PredEntriesCounter_; + YAP_ULONG_LONG RetriesCounter_; + int ReductionsCounterOn_; + int PredEntriesCounterOn_; + int RetriesCounterOn_; + + + union CONSULT_OBJ* ConsultSp_; + + UInt ConsultCapacity_; + + union CONSULT_OBJ* ConsultBase_; + + union CONSULT_OBJ* ConsultLow_; + + Term GlobalArena_; + UInt GlobalArenaOverflows_; + Int ArenaOverflows_; + Int DepthArenas_; + int ArithError_; + struct pred_entry* LastAssertedPred_; + char* ScannerStack_; + struct scanner_extra_alloc* ScannerExtraBlocks_; + struct DB_TERM* BallTerm_; + UInt* ActiveSignals_; + UInt MaxActiveSignals_; + UInt FirstActiveSignal_; + UInt LastActiveSignal_; + UInt IPredArity_; + yamop* ProfEnd_; + int UncaughtThrow_; + int DoingUndefp_; + Int StartLine_; + scratch_block ScratchPad_; +#ifdef COROUTINING + Term WokenGoals_; + Term AttsMutableList_; +#endif + + Term GcGeneration_; + Term GcPhase_; + UInt GcCurrentPhase_; + UInt GcCalls_; + Int TotGcTime_; + YAP_ULONG_LONG TotGcRecovered_; + Int LastGcTime_; + Int LastSSTime_; + CELL* OpenArray_; + + Int total_marked_; + Int total_oldies_; + struct choicept* current_B_; + CELL* prev_HB_; + CELL* HGEN_; + CELL** iptop_; +#if defined(GC_NO_TAGS) + char* bp_; +#endif + tr_fr_ptr sTR_; + tr_fr_ptr sTR0_; + tr_fr_ptr new_TR_; + struct gc_mark_continuation* cont_top0_; + struct gc_mark_continuation* cont_top_; + int discard_trail_entries_; + gc_ma_hash_entry gc_ma_hash_table_[GC_MAVARS_HASH_SIZE]; + gc_ma_hash_entry* gc_ma_h_top_; + gc_ma_hash_entry* gc_ma_h_list_; + UInt gc_timestamp_; + ADDR db_vec_; + ADDR db_vec0_; + struct RB_red_blk_node* db_root_; + struct RB_red_blk_node* db_nil_; + sigjmp_buf gc_restore_; + CELL* extra_gc_cells_; + CELL* extra_gc_cells_base_; + CELL* extra_gc_cells_top_; + UInt extra_gc_cells_size_; + struct array_entry* DynamicArrays_; + struct static_array_entry* StaticArrays_; + struct global_entry* GlobalVariables_; + int AllowRestart_; + + struct mem_blk* CMemFirstBlock_; + UInt CMemFirstBlockSz_; + + int nperm_; + + Int* LabelFirstArray_; + UInt LabelFirstArraySz_; + + struct PL_local_data* PL_local_data_p_; +#ifdef THREADS + struct thandle ThreadHandle_; +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + struct local_optyap_data optyap_data_; +#endif /* YAPOR || TABLING */ + int InterruptsDisabled_; + struct open_query_struct* execution_; +#if LOW_LEVEL_TRACER + Int total_choicepoints_; +#endif + int consult_level_; +#if defined(YAPOR) || defined(THREADS) + lockvar SignalLock_; +#endif + + ADDR LocalBase_; + ADDR GlobalBase_; + ADDR TrailBase_; + ADDR TrailTop_; + char* ErrorMessage_; + Term Error_Term_; +#ifdef THREADS + Term Error_TYPE_; +#else + yap_error_number Error_TYPE_; +#endif + UInt Error_Size_; + char ErrorSay_[MAX_ERROR_MSG_SIZE]; + jmp_buf IOBotch_; + TokEntry* tokptr_; + TokEntry* toktide_; + VarEntry* VarTable_; + VarEntry* AnonVarTable_; + Term Comments_; + CELL* CommentsTail_; + CELL* CommentsNextChar_; + wchar_t* CommentsBuff_; + size_t CommentsBuffPos_; + size_t CommentsBuffLim_; + sigjmp_buf RestartEnv_; + char FileNameBuf_[YAP_FILENAME_MAX]; + char FileNameBuf2_[YAP_FILENAME_MAX]; + + Int PrologMode_; + int CritLocks_; + + +#ifdef ANALYST + YAP_ULONG_LONG opcount_[_std_top+1]; + YAP_ULONG_LONG 2opcount[_std_top+1][_std_top+1]_; +#endif /* ANALYST */ + + struct db_globs* s_dbg_; + + yap_error_number matherror_; + yap_error_number CurrentError_; + + int heap_overflows_; + Int total_heap_overflow_time_; + int stack_overflows_; + Int total_stack_overflow_time_; + int delay_overflows_; + Int total_delay_overflow_time_; + int trail_overflows_; + Int total_trail_overflow_time_; + int atom_table_overflows_; + Int total_atom_table_overflow_time_; + +#ifdef LOAD_DYLD + int dl_errno_; +#endif + +#ifdef LOW_LEVEL_TRACER + int do_trace_primitives_; +#endif + + struct export_atom_hash_entry_struct *ExportAtomHashChain_; + UInt ExportAtomHashTableSize_; + UInt ExportAtomHashTableNum_; + struct export_functor_hash_entry_struct *ExportFunctorHashChain_; + UInt ExportFunctorHashTableSize_; + UInt ExportFunctorHashTableNum_; + struct export_pred_entry_hash_entry_struct *ExportPredEntryHashChain_; + UInt ExportPredEntryHashTableSize_; + UInt ExportPredEntryHashTableNum_; + struct export_dbref_hash_entry_struct *ExportDBRefHashChain_; + UInt ExportDBRefHashTableSize_; + UInt ExportDBRefHashTableNum_; + struct import_atom_hash_entry_struct **ImportAtomHashChain_; + UInt ImportAtomHashTableSize_; + UInt ImportAtomHashTableNum_; + struct import_functor_hash_entry_struct **ImportFunctorHashChain_; + UInt ImportFunctorHashTableSize_; + UInt ImportFunctorHashTableNum_; + struct import_opcode_hash_entry_struct **ImportOPCODEHashChain_; + UInt ImportOPCODEHashTableSize_; + struct import_pred_entry_hash_entry_struct **ImportPredEntryHashChain_; + UInt ImportPredEntryHashTableSize_; + UInt ImportPredEntryHashTableNum_; + struct import_dbref_hash_entry_struct **ImportDBRefHashChain_; + UInt ImportDBRefHashTableSize_; + UInt ImportDBRefHashTableNum_; + yamop *ImportFAILCODE_; + Functor FunctorVar_; + + UInt ibnds_[256]; + struct index_t* exo_it_; + CELL* exo_base_; + UInt exo_arity_; + UInt exo_arg_; + + struct scan_atoms* search_atoms_; + + Int CurSlot_; + Term SourceModule_; + size_t MAX_SIZE_; +} w_local; diff --git a/H/iglobals.h b/H/iglobals.h index a3ce0f444..dace17994 100644 --- a/H/iglobals.h +++ b/H/iglobals.h @@ -1,119 +1,119 @@ - - /* This file, iglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -static void InitGlobal(void) { - - GLOBAL_Initialised = FALSE; - GLOBAL_InitialisedFromPL = FALSE; - GLOBAL_PL_Argc = 0; - GLOBAL_PL_Argv = NULL; - - GLOBAL_HaltHooks = NULL; - - GLOBAL_AllowLocalExpansion = TRUE; - GLOBAL_AllowGlobalExpansion = TRUE; - GLOBAL_AllowTrailExpansion = TRUE; - GLOBAL_SizeOfOverflow = 0; - - GLOBAL_AGcThreshold = 10000; - GLOBAL_AGCHook = NULL; - -#if THREADS - - GLOBAL_NOfThreads = 1; - - GLOBAL_NOfThreadsCreated = 1; - - GLOBAL_ThreadsTotalTime = 0L; - - INIT_LOCK(GLOBAL_ThreadHandlesLock); -#endif -#if defined(YAPOR) || defined(THREADS) - - INIT_LOCK(GLOBAL_BGL); -#endif -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - - -#if defined(THREADS) - -#endif /* THREADS */ - - GLOBAL_stdout = stdout; - GLOBAL_stderr = stderr; - - - - -#ifdef COROUTINING - - -#endif - - - - - GLOBAL_tot_agc_time = 0; - - GLOBAL_tot_agc_recovered = 0; - -#if HAVE_MMAP - GLOBAL_mmap_arrays = NULL; -#endif -#ifdef DEBUG - - - - - -#endif -#if defined(COFF) || defined(A_OUT) - - -#endif - GLOBAL_OpaqueHandlersCount = 0; - GLOBAL_OpaqueHandlers = NULL; -#if __simplescalar__ - -#endif - - - - - - - - - - - - - - - GLOBAL_DIRNAME = NULL; -#if LOW_PROF - GLOBAL_ProfilerOn = FALSE; - GLOBAL_FProf = NULL; - GLOBAL_FPreds = NULL; -#endif /* LOW_PROF */ -} + + /* This file, iglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +static void InitGlobal(void) { + + GLOBAL_Initialised = FALSE; + GLOBAL_InitialisedFromPL = FALSE; + GLOBAL_PL_Argc = 0; + GLOBAL_PL_Argv = NULL; + + GLOBAL_HaltHooks = NULL; + + GLOBAL_AllowLocalExpansion = TRUE; + GLOBAL_AllowGlobalExpansion = TRUE; + GLOBAL_AllowTrailExpansion = TRUE; + GLOBAL_SizeOfOverflow = 0; + + GLOBAL_AGcThreshold = 10000; + GLOBAL_AGCHook = NULL; + +#if THREADS + + GLOBAL_NOfThreads = 1; + + GLOBAL_NOfThreadsCreated = 1; + + GLOBAL_ThreadsTotalTime = 0L; + + INIT_LOCK(GLOBAL_ThreadHandlesLock); +#endif +#if defined(YAPOR) || defined(THREADS) + + INIT_LOCK(GLOBAL_BGL); +#endif +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + + +#if defined(THREADS) + +#endif /* THREADS */ + + GLOBAL_stdout = Soutput; + GLOBAL_stderr = Serror; + + + + +#ifdef COROUTINING + + +#endif + + + + + GLOBAL_tot_agc_time = 0; + + GLOBAL_tot_agc_recovered = 0; + +#if HAVE_MMAP + GLOBAL_mmap_arrays = NULL; +#endif +#ifdef DEBUG + + + + + +#endif +#if defined(COFF) || defined(A_OUT) + + +#endif + GLOBAL_OpaqueHandlersCount = 0; + GLOBAL_OpaqueHandlers = NULL; +#if __simplescalar__ + +#endif + + + + + + + + + + + + + + + GLOBAL_DIRNAME = NULL; +#if LOW_PROF + GLOBAL_ProfilerOn = FALSE; + GLOBAL_FProf = NULL; + GLOBAL_FPreds = NULL; +#endif /* LOW_PROF */ +} diff --git a/H/ilocals.h b/H/ilocals.h old mode 100644 new mode 100755 index cd620833b..e28616ede --- a/H/ilocals.h +++ b/H/ilocals.h @@ -1,239 +1,242 @@ - - /* This file, ilocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -static void InitWorker(int wid) { - - REMOTE_c_input_stream(wid) = 0; - REMOTE_c_output_stream(wid) = 1; - REMOTE_c_error_stream(wid) = 2; - - REMOTE_OldASP(wid) = NULL; - REMOTE_OldLCL0(wid) = NULL; - REMOTE_OldTR(wid) = NULL; - REMOTE_OldGlobalBase(wid) = NULL; - REMOTE_OldH(wid) = NULL; - REMOTE_OldH0(wid) = NULL; - REMOTE_OldTrailBase(wid) = NULL; - REMOTE_OldTrailTop(wid) = NULL; - REMOTE_OldHeapBase(wid) = NULL; - REMOTE_OldHeapTop(wid) = NULL; - REMOTE_ClDiff(wid) = 0L; - REMOTE_GDiff(wid) = 0L; - REMOTE_HDiff(wid) = 0L; - REMOTE_GDiff0(wid) = 0L; - REMOTE_GSplit(wid) = NULL; - REMOTE_LDiff(wid) = 0L; - REMOTE_TrDiff(wid) = 0L; - REMOTE_XDiff(wid) = 0L; - REMOTE_DelayDiff(wid) = 0L; - REMOTE_BaseDiff(wid) = 0L; - - REMOTE_ReductionsCounter(wid) = 0L; - REMOTE_PredEntriesCounter(wid) = 0L; - REMOTE_RetriesCounter(wid) = 0L; - REMOTE_ReductionsCounterOn(wid) = 0L; - REMOTE_PredEntriesCounterOn(wid) = 0L; - REMOTE_RetriesCounterOn(wid) = 0L; - - - REMOTE_ConsultSp(wid) = NULL; - - - - REMOTE_ConsultBase(wid) = NULL; - - REMOTE_ConsultLow(wid) = NULL; - - REMOTE_GlobalArena(wid) = 0L; - REMOTE_GlobalArenaOverflows(wid) = 0L; - REMOTE_ArenaOverflows(wid) = 0L; - REMOTE_DepthArenas(wid) = 0; - REMOTE_ArithError(wid) = FALSE; - REMOTE_LastAssertedPred(wid) = NULL; - REMOTE_ScannerStack(wid) = NULL; - REMOTE_ScannerExtraBlocks(wid) = NULL; - REMOTE_BallTerm(wid) = NULL; - REMOTE_ActiveSignals(wid) = 0L; - REMOTE_IPredArity(wid) = 0L; - REMOTE_ProfEnd(wid) = NULL; - REMOTE_UncaughtThrow(wid) = FALSE; - REMOTE_DoingUndefp(wid) = FALSE; - REMOTE_StartLine(wid) = 0L; - InitScratchPad(wid); -#ifdef COROUTINING - REMOTE_WokenGoals(wid) = 0L; - REMOTE_AttsMutableList(wid) = 0L; -#endif - - REMOTE_GcGeneration(wid) = 0L; - REMOTE_GcPhase(wid) = 0L; - REMOTE_GcCurrentPhase(wid) = 0L; - REMOTE_GcCalls(wid) = 0L; - REMOTE_TotGcTime(wid) = 0L; - REMOTE_TotGcRecovered(wid) = 0L; - REMOTE_LastGcTime(wid) = 0L; - REMOTE_LastSSTime(wid) = 0L; - REMOTE_OpenArray(wid) = NULL; - - REMOTE_total_marked(wid) = 0L; - REMOTE_total_oldies(wid) = 0L; - REMOTE_current_B(wid) = NULL; - REMOTE_prev_HB(wid) = NULL; - REMOTE_HGEN(wid) = NULL; - REMOTE_iptop(wid) = NULL; -#if defined(GC_NO_TAGS) - REMOTE_bp(wid) = NULL; -#endif - REMOTE_sTR(wid) = NULL; - REMOTE_sTR0(wid) = NULL; - REMOTE_new_TR(wid) = NULL; - REMOTE_cont_top0(wid) = NULL; - REMOTE_cont_top(wid) = NULL; - REMOTE_discard_trail_entries(wid) = 0; - - REMOTE_gc_ma_h_top(wid) = NULL; - REMOTE_gc_ma_h_list(wid) = NULL; - REMOTE_gc_timestamp(wid) = 0L; - REMOTE_db_vec(wid) = NULL; - REMOTE_db_vec0(wid) = NULL; - REMOTE_db_root(wid) = NULL; - REMOTE_db_nil(wid) = NULL; - - - - - REMOTE_extra_gc_cells_size(wid) = 256; - REMOTE_DynamicArrays(wid) = NULL; - REMOTE_StaticArrays(wid) = NULL; - REMOTE_GlobalVariables(wid) = NULL; - REMOTE_AllowRestart(wid) = FALSE; - - REMOTE_CMemFirstBlock(wid) = NULL; - REMOTE_CMemFirstBlockSz(wid) = 0L; - - REMOTE_nperm(wid) = 0L; - - REMOTE_LabelFirstArray(wid) = NULL; - REMOTE_LabelFirstArraySz(wid) = 0L; - - REMOTE_PL_local_data_p(wid) = Yap_InitThreadIO(wid); -#ifdef THREADS - InitThreadHandle(wid); -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - Yap_init_local_optyap_data(wid); -#endif /* YAPOR || TABLING */ - REMOTE_InterruptsDisabled(wid) = FALSE; - REMOTE_execution(wid) = NULL; -#if LOW_LEVEL_TRACER - REMOTE_total_choicepoints(wid) = 0; -#endif - REMOTE_consult_level(wid) = 0; -#if defined(YAPOR) || defined(THREADS) - INIT_LOCK(REMOTE_SignalLock(wid)); -#endif - - - - - - - -#ifdef THREADS - -#else - -#endif - - - - - - - - - - - - - - - - - - REMOTE_PrologMode(wid) = BootMode; - REMOTE_CritLocks(wid) = 0; - - -#ifdef ANALYST - - -#endif /* ANALYST */ - - - - REMOTE_matherror(wid) = YAP_NO_ERROR; - REMOTE_CurrentError(wid) = YAP_NO_ERROR; - - REMOTE_heap_overflows(wid) = 0; - REMOTE_total_heap_overflow_time(wid) = 0; - REMOTE_stack_overflows(wid) = 0; - REMOTE_total_stack_overflow_time(wid) = 0; - REMOTE_delay_overflows(wid) = 0; - REMOTE_total_delay_overflow_time(wid) = 0; - REMOTE_trail_overflows(wid) = 0; - REMOTE_total_trail_overflow_time(wid) = 0; - REMOTE_atom_table_overflows(wid) = 0; - REMOTE_total_atom_table_overflow_time(wid) = 0; - -#ifdef LOAD_DYLD - REMOTE_dl_errno(wid) = 0; -#endif - -#ifdef LOW_LEVEL_TRACER - REMOTE_do_trace_primitives(wid) = TRUE; -#endif - - REMOTE_ExportAtomHashChain(wid) = NULL; - REMOTE_ExportAtomHashTableSize(wid) = 0; - REMOTE_ExportAtomHashTableNum(wid) = 0; - REMOTE_ExportFunctorHashChain(wid) = NULL; - REMOTE_ExportFunctorHashTableSize(wid) = 0; - REMOTE_ExportFunctorHashTableNum(wid) = 0; - REMOTE_ExportPredEntryHashChain(wid) = NULL; - REMOTE_ExportPredEntryHashTableSize(wid) = 0; - REMOTE_ExportPredEntryHashTableNum(wid) = 0; - REMOTE_ExportDBRefHashChain(wid) = NULL; - REMOTE_ExportDBRefHashTableSize(wid) = 0; - REMOTE_ExportDBRefHashTableNum(wid) = 0; - REMOTE_ImportAtomHashChain(wid) = NULL; - REMOTE_ImportAtomHashTableSize(wid) = 0; - REMOTE_ImportAtomHashTableNum(wid) = 0; - REMOTE_ImportFunctorHashChain(wid) = NULL; - REMOTE_ImportFunctorHashTableSize(wid) = 0; - REMOTE_ImportFunctorHashTableNum(wid) = 0; - REMOTE_ImportOPCODEHashChain(wid) = NULL; - REMOTE_ImportOPCODEHashTableSize(wid) = 0; - REMOTE_ImportPredEntryHashChain(wid) = NULL; - REMOTE_ImportPredEntryHashTableSize(wid) = 0; - REMOTE_ImportPredEntryHashTableNum(wid) = 0; - REMOTE_ImportDBRefHashChain(wid) = NULL; - REMOTE_ImportDBRefHashTableSize(wid) = 0; - REMOTE_ImportDBRefHashTableNum(wid) = 0; - REMOTE_ImportFAILCODE(wid) = NULL; - REMOTE_FunctorVar(wid) = FunctorVar; - - - REMOTE_exo_it(wid) = NULL; - REMOTE_exo_base(wid) = NULL; - REMOTE_exo_arity(wid) = 0; - REMOTE_exo_arg(wid) = 0; - - - - REMOTE_CurSlot(wid) = 0; - REMOTE_SourceModule(wid) = 0; - REMOTE_MAX_SIZE(wid) = 1024L; -} + + /* This file, ilocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +static void InitWorker(int wid) { + + REMOTE_c_input_stream(wid) = 0; + REMOTE_c_output_stream(wid) = 1; + REMOTE_c_error_stream(wid) = 2; + + REMOTE_OldASP(wid) = NULL; + REMOTE_OldLCL0(wid) = NULL; + REMOTE_OldTR(wid) = NULL; + REMOTE_OldGlobalBase(wid) = NULL; + REMOTE_OldH(wid) = NULL; + REMOTE_OldH0(wid) = NULL; + REMOTE_OldTrailBase(wid) = NULL; + REMOTE_OldTrailTop(wid) = NULL; + REMOTE_OldHeapBase(wid) = NULL; + REMOTE_OldHeapTop(wid) = NULL; + REMOTE_ClDiff(wid) = 0L; + REMOTE_GDiff(wid) = 0L; + REMOTE_HDiff(wid) = 0L; + REMOTE_GDiff0(wid) = 0L; + REMOTE_GSplit(wid) = NULL; + REMOTE_LDiff(wid) = 0L; + REMOTE_TrDiff(wid) = 0L; + REMOTE_XDiff(wid) = 0L; + REMOTE_DelayDiff(wid) = 0L; + REMOTE_BaseDiff(wid) = 0L; + + REMOTE_ReductionsCounter(wid) = 0L; + REMOTE_PredEntriesCounter(wid) = 0L; + REMOTE_RetriesCounter(wid) = 0L; + REMOTE_ReductionsCounterOn(wid) = 0L; + REMOTE_PredEntriesCounterOn(wid) = 0L; + REMOTE_RetriesCounterOn(wid) = 0L; + + + REMOTE_ConsultSp(wid) = NULL; + + + + REMOTE_ConsultBase(wid) = NULL; + + REMOTE_ConsultLow(wid) = NULL; + + REMOTE_GlobalArena(wid) = 0L; + REMOTE_GlobalArenaOverflows(wid) = 0L; + REMOTE_ArenaOverflows(wid) = 0L; + REMOTE_DepthArenas(wid) = 0; + REMOTE_ArithError(wid) = FALSE; + REMOTE_LastAssertedPred(wid) = NULL; + REMOTE_ScannerStack(wid) = NULL; + REMOTE_ScannerExtraBlocks(wid) = NULL; + REMOTE_BallTerm(wid) = NULL; + REMOTE_MaxActiveSignals(wid) = 64L; + REMOTE_FirstActiveSignal(wid) = 0L; + REMOTE_LastActiveSignal(wid) = 0L; + REMOTE_ActiveSignals(wid) = Yap_InitSignals(wid); + REMOTE_IPredArity(wid) = 0L; + REMOTE_ProfEnd(wid) = NULL; + REMOTE_UncaughtThrow(wid) = FALSE; + REMOTE_DoingUndefp(wid) = FALSE; + REMOTE_StartLine(wid) = 0L; + InitScratchPad(wid); +#ifdef COROUTINING + REMOTE_WokenGoals(wid) = 0L; + REMOTE_AttsMutableList(wid) = 0L; +#endif + + REMOTE_GcGeneration(wid) = 0L; + REMOTE_GcPhase(wid) = 0L; + REMOTE_GcCurrentPhase(wid) = 0L; + REMOTE_GcCalls(wid) = 0L; + REMOTE_TotGcTime(wid) = 0L; + REMOTE_TotGcRecovered(wid) = 0L; + REMOTE_LastGcTime(wid) = 0L; + REMOTE_LastSSTime(wid) = 0L; + REMOTE_OpenArray(wid) = NULL; + + REMOTE_total_marked(wid) = 0L; + REMOTE_total_oldies(wid) = 0L; + REMOTE_current_B(wid) = NULL; + REMOTE_prev_HB(wid) = NULL; + REMOTE_HGEN(wid) = NULL; + REMOTE_iptop(wid) = NULL; +#if defined(GC_NO_TAGS) + REMOTE_bp(wid) = NULL; +#endif + REMOTE_sTR(wid) = NULL; + REMOTE_sTR0(wid) = NULL; + REMOTE_new_TR(wid) = NULL; + REMOTE_cont_top0(wid) = NULL; + REMOTE_cont_top(wid) = NULL; + REMOTE_discard_trail_entries(wid) = 0; + + REMOTE_gc_ma_h_top(wid) = NULL; + REMOTE_gc_ma_h_list(wid) = NULL; + REMOTE_gc_timestamp(wid) = 0L; + REMOTE_db_vec(wid) = NULL; + REMOTE_db_vec0(wid) = NULL; + REMOTE_db_root(wid) = NULL; + REMOTE_db_nil(wid) = NULL; + + + + + REMOTE_extra_gc_cells_size(wid) = 256; + REMOTE_DynamicArrays(wid) = NULL; + REMOTE_StaticArrays(wid) = NULL; + REMOTE_GlobalVariables(wid) = NULL; + REMOTE_AllowRestart(wid) = FALSE; + + REMOTE_CMemFirstBlock(wid) = NULL; + REMOTE_CMemFirstBlockSz(wid) = 0L; + + REMOTE_nperm(wid) = 0L; + + REMOTE_LabelFirstArray(wid) = NULL; + REMOTE_LabelFirstArraySz(wid) = 0L; + + REMOTE_PL_local_data_p(wid) = Yap_InitThreadIO(wid); +#ifdef THREADS + InitThreadHandle(wid); +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + Yap_init_local_optyap_data(wid); +#endif /* YAPOR || TABLING */ + REMOTE_InterruptsDisabled(wid) = FALSE; + REMOTE_execution(wid) = NULL; +#if LOW_LEVEL_TRACER + REMOTE_total_choicepoints(wid) = 0; +#endif + REMOTE_consult_level(wid) = 0; +#if defined(YAPOR) || defined(THREADS) + INIT_LOCK(REMOTE_SignalLock(wid)); +#endif + + + + + + + +#ifdef THREADS + +#else + +#endif + + + + + + + + + + + + + + + + + + REMOTE_PrologMode(wid) = BootMode; + REMOTE_CritLocks(wid) = 0; + + +#ifdef ANALYST + + +#endif /* ANALYST */ + + + + REMOTE_matherror(wid) = YAP_NO_ERROR; + REMOTE_CurrentError(wid) = YAP_NO_ERROR; + + REMOTE_heap_overflows(wid) = 0; + REMOTE_total_heap_overflow_time(wid) = 0; + REMOTE_stack_overflows(wid) = 0; + REMOTE_total_stack_overflow_time(wid) = 0; + REMOTE_delay_overflows(wid) = 0; + REMOTE_total_delay_overflow_time(wid) = 0; + REMOTE_trail_overflows(wid) = 0; + REMOTE_total_trail_overflow_time(wid) = 0; + REMOTE_atom_table_overflows(wid) = 0; + REMOTE_total_atom_table_overflow_time(wid) = 0; + +#ifdef LOAD_DYLD + REMOTE_dl_errno(wid) = 0; +#endif + +#ifdef LOW_LEVEL_TRACER + REMOTE_do_trace_primitives(wid) = TRUE; +#endif + + REMOTE_ExportAtomHashChain(wid) = NULL; + REMOTE_ExportAtomHashTableSize(wid) = 0; + REMOTE_ExportAtomHashTableNum(wid) = 0; + REMOTE_ExportFunctorHashChain(wid) = NULL; + REMOTE_ExportFunctorHashTableSize(wid) = 0; + REMOTE_ExportFunctorHashTableNum(wid) = 0; + REMOTE_ExportPredEntryHashChain(wid) = NULL; + REMOTE_ExportPredEntryHashTableSize(wid) = 0; + REMOTE_ExportPredEntryHashTableNum(wid) = 0; + REMOTE_ExportDBRefHashChain(wid) = NULL; + REMOTE_ExportDBRefHashTableSize(wid) = 0; + REMOTE_ExportDBRefHashTableNum(wid) = 0; + REMOTE_ImportAtomHashChain(wid) = NULL; + REMOTE_ImportAtomHashTableSize(wid) = 0; + REMOTE_ImportAtomHashTableNum(wid) = 0; + REMOTE_ImportFunctorHashChain(wid) = NULL; + REMOTE_ImportFunctorHashTableSize(wid) = 0; + REMOTE_ImportFunctorHashTableNum(wid) = 0; + REMOTE_ImportOPCODEHashChain(wid) = NULL; + REMOTE_ImportOPCODEHashTableSize(wid) = 0; + REMOTE_ImportPredEntryHashChain(wid) = NULL; + REMOTE_ImportPredEntryHashTableSize(wid) = 0; + REMOTE_ImportPredEntryHashTableNum(wid) = 0; + REMOTE_ImportDBRefHashChain(wid) = NULL; + REMOTE_ImportDBRefHashTableSize(wid) = 0; + REMOTE_ImportDBRefHashTableNum(wid) = 0; + REMOTE_ImportFAILCODE(wid) = NULL; + REMOTE_FunctorVar(wid) = FunctorVar; + + + REMOTE_exo_it(wid) = NULL; + REMOTE_exo_base(wid) = NULL; + REMOTE_exo_arity(wid) = 0; + REMOTE_exo_arg(wid) = 0; + + + + REMOTE_CurSlot(wid) = 0; + REMOTE_SourceModule(wid) = 0; + REMOTE_MAX_SIZE(wid) = 1024L; +} diff --git a/H/pl-global.h b/H/pl-global.h index a28161e84..2fd1625f5 100755 --- a/H/pl-global.h +++ b/H/pl-global.h @@ -222,7 +222,7 @@ typedef struct { #endif counting_mutex *mutexes; /* Registered mutexes */ int thread_max; /* Maximum # threads */ - PL_thread_info_t **threads; /* Pointers to thread-info */ + PL_thread_info_t *threads[MAX_THREADS]; /* Pointers to thread-info */ } thread; #endif /*O_PLMT*/ diff --git a/H/pl-incl.h b/H/pl-incl.h index 1eb809639..b67561602 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -102,6 +102,16 @@ typedef int Char; /* char that can pass EOF */ #define exception_term (LD->exception.term) +#ifdef Suser_input +#undef Suser_input +#endif +#ifdef Suser_output +#undef Suser_output +#endif +#ifdef Suser_error +#undef Suser_error +#endif + #define Suser_input (LD->IO.streams[0]) #define Suser_output (LD->IO.streams[1]) #define Suser_error (LD->IO.streams[2]) @@ -882,6 +892,7 @@ void PlMessage(const char *fm, ...); const char *WinError(void); word pl_win_exec(term_t cmd, term_t how); foreign_t pl_win_module_file(term_t module, term_t file); +int PL_w32_wrap_ansi_console(void); #ifdef EMULATE_DLOPEN /* file is in UTF-8, POSIX path */ @@ -911,6 +922,7 @@ extern const PL_extension PL_predicates_from_write[]; extern const PL_extension PL_predicates_from_prologflag[]; extern const PL_extension PL_predicates_from_win[]; extern const PL_extension PL_predicates_from_locale[]; +extern const PL_extension PL_predicates_from_system[]; #define enableThreads(val) FALSE diff --git a/H/rglobals.h b/H/rglobals.h index 324058da0..17fec3237 100644 --- a/H/rglobals.h +++ b/H/rglobals.h @@ -1,119 +1,119 @@ - - /* This file, rglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/GLOBALS instead */ - - - - - - - - - - - - - - - - - -static void RestoreGlobal(void) { - - - - - - - - - - - - - - - - -#if THREADS - - - - - - - - REINIT_LOCK(GLOBAL_ThreadHandlesLock); -#endif -#if defined(YAPOR) || defined(THREADS) - - REINIT_LOCK(GLOBAL_BGL); -#endif -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - - -#if defined(THREADS) - -#endif /* THREADS */ - - - - - - - -#ifdef COROUTINING - - -#endif - - - - - - - - -#if HAVE_MMAP - -#endif -#ifdef DEBUG - - - - - -#endif -#if defined(COFF) || defined(A_OUT) - - -#endif - - -#if __simplescalar__ - -#endif - - - - - - - - - - - - - - - -#if LOW_PROF - - - -#endif /* LOW_PROF */ -} + + /* This file, rglobals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/GLOBALS instead */ + + + + + + + + + + + + + + + + + +static void RestoreGlobal(void) { + + + + + + + + + + + + + + + + +#if THREADS + + + + + + + + REINIT_LOCK(GLOBAL_ThreadHandlesLock); +#endif +#if defined(YAPOR) || defined(THREADS) + + REINIT_LOCK(GLOBAL_BGL); +#endif +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + + +#if defined(THREADS) + +#endif /* THREADS */ + + + + + + + +#ifdef COROUTINING + + +#endif + + + + + + + + +#if HAVE_MMAP + +#endif +#ifdef DEBUG + + + + + +#endif +#if defined(COFF) || defined(A_OUT) + + +#endif + + +#if __simplescalar__ + +#endif + + + + + + + + + + + + + + + +#if LOW_PROF + + + +#endif /* LOW_PROF */ +} diff --git a/H/rlocals.h b/H/rlocals.h index 794712f59..a2ec6bb63 100644 --- a/H/rlocals.h +++ b/H/rlocals.h @@ -1,239 +1,242 @@ - - /* This file, rlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" - please do not update, update misc/LOCALS instead */ - - -static void RestoreWorker(int wid USES_REGS) { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid)); - - - - - - - - RestoreBallTerm(wid); - - - - - - - -#ifdef COROUTINING - REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid)); - REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid)); -#endif - - REMOTE_GcGeneration(wid) = TermToGlobalAdjust(REMOTE_GcGeneration(wid)); - REMOTE_GcPhase(wid) = TermToGlobalAdjust(REMOTE_GcPhase(wid)); - - - - - - - - - - - - - - -#if defined(GC_NO_TAGS) - -#endif - - - - - - - - - - - - - - - - - - - - REMOTE_DynamicArrays(wid) = PtoArrayEAdjust(REMOTE_DynamicArrays(wid)); - REMOTE_StaticArrays(wid) = PtoArraySAdjust(REMOTE_StaticArrays(wid)); - REMOTE_GlobalVariables(wid) = PtoGlobalEAdjust(REMOTE_GlobalVariables(wid)); - - - - - - - - - - - -#ifdef THREADS - -#endif /* THREADS */ -#if defined(YAPOR) || defined(TABLING) - -#endif /* YAPOR || TABLING */ - - -#if LOW_LEVEL_TRACER - -#endif - -#if defined(YAPOR) || defined(THREADS) - REINIT_LOCK(REMOTE_SignalLock(wid)); -#endif - - - - - - - -#ifdef THREADS - -#else - -#endif - - - - - - - - - - - - - - - - - - - - - -#ifdef ANALYST - - -#endif /* ANALYST */ - - - - - - - - - - - - - - - - - -#ifdef LOAD_DYLD - -#endif - -#ifdef LOW_LEVEL_TRACER - -#endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} + + /* This file, rlocals.h, was generated automatically by "yap -L misc/buildlocalglobal" + please do not update, update misc/LOCALS instead */ + + +static void RestoreWorker(int wid USES_REGS) { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + REMOTE_GlobalArena(wid) = TermToGlobalOrAtomAdjust(REMOTE_GlobalArena(wid)); + + + + + + + + RestoreBallTerm(wid); + + + + + + + + + + +#ifdef COROUTINING + REMOTE_WokenGoals(wid) = TermToGlobalAdjust(REMOTE_WokenGoals(wid)); + REMOTE_AttsMutableList(wid) = TermToGlobalAdjust(REMOTE_AttsMutableList(wid)); +#endif + + REMOTE_GcGeneration(wid) = TermToGlobalAdjust(REMOTE_GcGeneration(wid)); + REMOTE_GcPhase(wid) = TermToGlobalAdjust(REMOTE_GcPhase(wid)); + + + + + + + + + + + + + + +#if defined(GC_NO_TAGS) + +#endif + + + + + + + + + + + + + + + + + + + + REMOTE_DynamicArrays(wid) = PtoArrayEAdjust(REMOTE_DynamicArrays(wid)); + REMOTE_StaticArrays(wid) = PtoArraySAdjust(REMOTE_StaticArrays(wid)); + REMOTE_GlobalVariables(wid) = PtoGlobalEAdjust(REMOTE_GlobalVariables(wid)); + + + + + + + + + + + +#ifdef THREADS + +#endif /* THREADS */ +#if defined(YAPOR) || defined(TABLING) + +#endif /* YAPOR || TABLING */ + + +#if LOW_LEVEL_TRACER + +#endif + +#if defined(YAPOR) || defined(THREADS) + REINIT_LOCK(REMOTE_SignalLock(wid)); +#endif + + + + + + + +#ifdef THREADS + +#else + +#endif + + + + + + + + + + + + + + + + + + + + + +#ifdef ANALYST + + +#endif /* ANALYST */ + + + + + + + + + + + + + + + + + +#ifdef LOAD_DYLD + +#endif + +#ifdef LOW_LEVEL_TRACER + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/Makefile.in b/Makefile.in index e97a6c6a9..f04307d7e 100755 --- a/Makefile.in +++ b/Makefile.in @@ -72,7 +72,8 @@ C_PARSER_FLAGS= @YAPLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS) ARCH=@ARCH@ AWK=@AWK@ CPP=@CPP@ -DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 +RC=windres +DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"$(DESTDIR)\" LIBS=@LIBS@ DLL_LIBS=@LIBS@ @EXTRA_LIBS_FOR_DLLS@ LDFLAGS=@LDFLAGS@ @@ -191,6 +192,7 @@ HEADERS = \ H/tracer.h \ H/trim_trail.h \ H/yapio.h \ + H/YapSignals.h \ H/YapText.h \ H/cut_c.h \ H/iatoms.h H/ratoms.h H/tatoms.h \ @@ -289,7 +291,9 @@ PLCONS_SOURCES = \ console/LGPL/pl-nt.c \ console/LGPL/pl-ntcon.c \ console/LGPL/pl-ntconsole.c \ - console/LGPL/pl-ntmain.c + console/LGPL/pl-ntmain.c \ + console/LGPL/yap.rc \ + console/LGPL/manifest.xml PL_SOURCES= \ pl/arith.yap \ @@ -334,6 +338,11 @@ PL_SOURCES= \ pl/swi.yap \ pl/yapor.yap pl/yio.yap +# need these files to construct the initial saved state. +SWI_LIB_SOURCES= \ + swi/library/menu.pl \ + swi/library/predopts.pl + YAPDOCS=docs/yap.tex docs/chr.tex \ docs/clpr.tex docs/swi.tex @@ -402,7 +411,8 @@ OBJECTS = yap.o $(LIB_OBJECTS) PLCONS_OBJECTS = \ pl-ntcon.o \ pl-ntconsole.o \ - pl-ntmain.o + pl-ntmain.o \ + yapres.o all: startup.yss @WINDOWS@ yap-win@EXEC_SUFFIX@ @@ -422,7 +432,7 @@ yap.o: console/yap.c config.h c_interface.o: C/c_interface.c include/c_interface.h config.h $(CC) $(C_INTERF_FLAGS) -c $< -o c_interface.o -yap-argss.o: C/yap-args.c include/c_interface.h config.h +yap-args.o: C/yap-args.c include/c_interface.h config.h $(CC) $(C_INTERF_FLAGS) -c $< -o yap-args.o clause_list.o: C/clause_list.c include/clause_list.h config.h @@ -441,7 +451,7 @@ udi.o: C/udi.c config.h $(CC) -c $(CFLAGS) $< -o $@ sys.o: library/system/sys.c config.h - $(CC) -c $(CFPLAGS) -I$(srcdir)/include $< -o $@ + $(CC) -c $(CFPLAGS) -I$(srcdir)/include -I. $< -o $@ yap_random.o: library/random/yap_random.c config.h $(CC) -c $(CFLAGS) -I$(srcdir)/include $< -o $@ @@ -462,10 +472,13 @@ pl-ntcon.o: console/LGPL/pl-ntcon.c config.h $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include $< -o $@ pl-ntconsole.o: console/LGPL/pl-ntconsole.c config.h - $(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ + $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ pl-ntmain.o: console/LGPL/pl-ntmain.c config.h - $(CC) -municode -DUNICODE -D_UNICODE -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ + $(CC) -c $(CFLAGS) -DPL_CONSOLE=1 -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ + +yapres.o: console/LGPL/yap.rc console/LGPL/manifest.xml config.h + $(RC) -DUNICODE -D_UNICODE -DPL_CONSOLE=1 -I. -I$(srcdir)/include -I$(srcdir) -I$(srcdir)/os -I$(srcdir)/console/LGPL @EXTRA_INCLUDES_FOR_WIN32@ -i $< -o $@ uxnt.o: os/windows/uxnt.c config.h $(CC) -c $(CFLAGS) -I$(srcdir)/include -I$(srcdir) -Ios @EXTRA_INCLUDES_FOR_WIN32@ $< -o $@ @@ -540,7 +553,7 @@ all: startup.yss if [ -r $$p/Makefile ]; then $(MAKE) -C $$p || exit 1; fi; \ done -startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES) +startup.yss: yap@EXEC_SUFFIX@ $(PL_SOURCES) $(SWI_LIB_SOURCES) -rm -f startup.yss echo "bootstrap('$(srcdir)/pl/init.yap'). module(user). qsave_program('startup.yss')." | @PRE_INSTALL_ENV@ ./yap@EXEC_SUFFIX@ -b $(srcdir)/pl/boot.yap @@ -553,7 +566,7 @@ yapwin: yap-win@EXEC_SUFFIX@ yap-win@EXEC_SUFFIX@: $(PLCONS_OBJECTS) $(HEADERS) @YAPLIB@ (cd swi/console; $(MAKE)) - $(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win@EXEC_SUFFIX@ $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) @MPILDF@ + $(MPI_CC) -municode -DUNICODE -D_UNICODE $(EXECUTABLE_CFLAGS) $(LDFLAGS) -Wl,-subsystem,windows -o yap-win@EXEC_SUFFIX@ $(PLCONS_OBJECTS) plterm.dll @YAPLIB@ $(LIBS) -lgdi32 @MPILDF@ libYap.a: $(LIB_OBJECTS) -rm -f libYap.a @@ -571,7 +584,9 @@ install: @INSTALL_COMMAND@ install_unix: startup.yss @YAPLIB@ mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(YAPLIBDIR) + mkdir -p $(DESTDIR)$(SHAREDIR)/PrologCommons mkdir -p $(DESTDIR)$(SHAREDIR)/Yap + mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/icons mkdir -p $(DESTDIR)$(SHAREDIR)/Yap/pl mkdir -p $(DESTDIR)$(DOCSDIR) mkdir -p $(DESTDIR)$(INCLUDEDIR) @@ -598,7 +613,9 @@ install_unix: startup.yss @YAPLIB@ install_win32: startup.yss @WINDOWS@ yap-win@EXEC_SUFFIX@ install_unix $(INSTALL_PROGRAM) -m 755 yap.dll $(DESTDIR)$(BINDIR)/yap.dll @WINDOWS@ $(INSTALL_PROGRAM) -m 755 yap-win.exe $(DESTDIR)$(BINDIR)/yap-win.exe + @WINDOWS@ $(INSTALL_PROGRAM) -m 755 yap.exe $(DESTDIR)$(BINDIR)/yap.exe @WINDOWS@ $(INSTALL_PROGRAM) -m 755 plterm.dll $(DESTDIR)$(BINDIR)/plterm.dll + $(INSTALL_DATA) $(srcdir)/misc/icons/yap.ico $(DESTDIR)$(SHAREDIR)/Yap/icons install_library: @YAPLIB@ mkdir -p $(DESTDIR)$(INCLUDEDIR) @@ -632,10 +649,10 @@ clean_local: distclean: distclean_docs clean_local for p in $(PACKAGES); do \ - echo " ============== DISTCLEAN " $$p; \ + echo " ============== DISTCLEAN " $$p; \ if [ -r $$p/Makefile ]; then $(MAKE) -C $$p distclean || exit 1; fi; \ done - rm -f yap@EXEC_SUFFIX@ startup.yss libYap.* Makefile packages/Makefile.defs packages/Dialect.defs + rm -f yap* startup.yss libYap.* Makefile packages/Makefile.defs packages/Dialect.defs dist: @@ -693,28 +710,28 @@ install_docs: info: yap.info -yap.info: $(YAPDOCS) - $(MAKEINFO) docs/yap.tex +yap.info: docs/yap.tex + $(MAKEINFO) $< html: yap.html yap.html: docs/yap.tex - $(TEXI2HTML) docs/yap.tex + $(TEXI2HTML) $< dvi: yap.dvi -yap.dvi: $(YAPDOCS) - $(TEXI2DVI) docs/yap.tex +yap.dvi: docs/yap.tex + $(TEXI2DVI) $< ps: yap.ps -yap.ps: $(YAPDOCS) - dvips -o yap.ps docs/yap +yap.ps: docs/yap.tex + dvips -o yap.ps $< pdf: yap.pdf -yap.pdf: $(YAPDOCS) - $(TEXI2PDF) docs/yap.tex +yap.pdf: docs/yap.tex + $(TEXI2PDF) $< clean_docs: rm -f *.aux *.ca *.cas *.cn *.cns *.cp *.cps *.cy *.cys *.dvi *.fn *.fns *.ky *.log *.sa *.sas *.sn *.sns *.sy *.sys *~ *.tp *.vr *.toc *.pg diff --git a/OPTYap/locks_pthread.h b/OPTYap/locks_pthread.h old mode 100644 new mode 100755 index cbac968ed..f4d75cd97 --- a/OPTYap/locks_pthread.h +++ b/OPTYap/locks_pthread.h @@ -17,16 +17,20 @@ #include +#define DEBUG_LOCKS 1 + +#if DEBUG_LOCKS +int Yap_ThreadID( void ); +extern int debug_locks; +#endif + #define INIT_LOCK(LOCK_VAR) pthread_mutex_init(&(LOCK_VAR), NULL) #define DESTROY_LOCK(LOCK_VAR) pthread_mutex_destroy(&(LOCK_VAR)) #define TRY_LOCK(LOCK_VAR) pthread_mutex_trylock(&(LOCK_VAR)) #if DEBUG_LOCKS -#define LOCK(LOCK_VAR) if (debug_locks) fprintf(stderr,"[%d] %s:%d: LOCK(%p)\n", (int)pthread_self(), \ - __BASE_FILE__, __LINE__,&(LOCK_VAR)); \ - pthread_mutex_lock(&(LOCK_VAR)) -#define UNLOCK(LOCK_VAR) if (debug_locks) fprintf(stderr,"[%d] %s:%d: UNLOCK(%p)\n", (int)pthread_self(), \ - __BASE_FILE__, __LINE__,&(LOCK_VAR)); \ - pthread_mutex_unlock(&(LOCK_VAR)) +#define LOCK(LOCK_VAR) (void)(debug_locks && fprintf(stderr,"[%d] %s:%d: LOCK(%p)\n", Yap_ThreadID(), \ + __BASE_FILE__, __LINE__,&(LOCK_VAR)) && pthread_mutex_lock(&(LOCK_VAR)) ) +#define UNLOCK(LOCK_VAR) (void)( debug_locks && fprintf(stderr,"[%d] %s:%d: UNLOCK(%p)\n", Yap_ThreadID(),__BASE_FILE__, __LINE__,&(LOCK_VAR)) && pthread_mutex_unlock(&(LOCK_VAR)) ) #else #define LOCK(LOCK_VAR) pthread_mutex_lock(&(LOCK_VAR)) #define UNLOCK(LOCK_VAR) pthread_mutex_unlock(&(LOCK_VAR)) @@ -64,13 +68,13 @@ xIS_UNLOCKED(pthread_mutex_t *LOCK_VAR) { #if DEBUG_LOCKS -#define MUTEX_LOCK(LOCK_VAR) if (debug_locks) fprintf(stderr,"[%d] %s:%d: MULOCK(%p)\n", (int)pthread_self(), \ - __BASE_FILE__, __LINE__,(LOCK_VAR)); \ - pthread_mutex_lock((LOCK_VAR)) -#define MUTEX_TRYLOCK(LOCK_VAR) pthread_mutex_TRYlock((LOCK_VAR)) -#define MUTEX_UNLOCK(LOCK_VAR) if (debug_locks) fprintf(stderr,"[%d] %s:%d: UNMULOCK(%p)\n", (int)pthread_self(), \ - __BASE_FILE__, __LINE__,(LOCK_VAR)); \ - pthread_mutex_unlock((LOCK_VAR)) +#define MUTEX_LOCK(LOCK_VAR) (void)( debug_locks && fprintf(stderr,"[%d] %s:%d: MULOCK(%p)\n", Yap_ThreadID(), \ + __BASE_FILE__, __LINE__,(LOCK_VAR)) && \ + pthread_mutex_lock((LOCK_VAR)) ) +#define MUTEX_TRYLOCK(LOCK_VAR) pthread_mutex_trylock((LOCK_VAR)) +#define MUTEX_UNLOCK(LOCK_VAR) (void)( debug_locks && fprintf(stderr,"[%d] %s:%d: UNMULOCK(%p)\n", Yap_ThreadID(), \ + __BASE_FILE__, __LINE__,(LOCK_VAR)) && \ + pthread_mutex_unlock((LOCK_VAR))) #else #define MUTEX_LOCK(LOCK_VAR) pthread_mutex_lock((LOCK_VAR)) #define MUTEX_TRYLOCK(LOCK_VAR) pthread_mutex_trylock((LOCK_VAR)) diff --git a/config.guess b/config.guess index e3a2116a7..72625d40c 100644 --- a/config.guess +++ b/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2009-06-10' +timestamp='2014-02-12' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -17,26 +15,22 @@ timestamp='2009-06-10' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -56,8 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -180,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -201,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -223,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -269,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -333,6 +354,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -391,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -477,8 +501,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -491,7 +515,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -548,7 +572,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[456]) + *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -591,52 +615,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -727,22 +751,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -766,14 +790,14 @@ EOF exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -785,34 +809,39 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in + *:Interix*:*) + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd | genuineintel) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -845,45 +874,81 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo cris-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo frv-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -901,123 +966,65 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1025,11 +1032,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1061,7 +1068,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1089,13 +1096,13 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp - exit ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1130,8 +1137,8 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ @@ -1174,10 +1181,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -1203,11 +1210,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1220,6 +1227,9 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1246,9 +1256,31 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) @@ -1262,7 +1294,10 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NSE-?:NONSTOP_KERNEL:*:*) + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1307,13 +1342,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1331,159 +1366,11 @@ EOF i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 <. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -72,8 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -120,13 +115,18 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -149,12 +149,12 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; - -bluegene*) - os=-cnk + -bluegene*) + os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= @@ -170,10 +170,10 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -hiux*) os=-hiuxwe2 ;; @@ -218,6 +218,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -242,20 +248,28 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ + | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -273,32 +287,45 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ - | nios | nios2 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | or32 \ + | open8 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ + | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -308,6 +335,21 @@ case $basic_machine in basic_machine=mt-unknown ;; + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. @@ -322,25 +364,31 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | be32-* | be64-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -358,28 +406,34 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ - | nios-* | nios2-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ | tron-* \ - | v850-* | v850e-* | vax-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) @@ -404,7 +458,7 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; - abacus) + abacus) basic_machine=abacus-unknown ;; adobe68k) @@ -474,11 +528,20 @@ case $basic_machine in basic_machine=powerpc-ibm os=-cnk ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; - cegcc) + cegcc) basic_machine=arm-unknown os=-cegcc ;; @@ -510,7 +573,7 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16) + cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; @@ -668,7 +731,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -726,8 +788,15 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -762,10 +831,18 @@ case $basic_machine in ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -830,6 +907,12 @@ case $basic_machine in np1) basic_machine=np1-gould ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -912,9 +995,10 @@ case $basic_machine in ;; power) basic_machine=power-ibm ;; - ppc) basic_machine=powerpc-unknown + ppc | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -939,7 +1023,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1008,6 +1096,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -1064,20 +1155,8 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; tile*) - basic_machine=tile-unknown + basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) @@ -1147,6 +1226,9 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -1244,9 +1326,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1268,21 +1353,22 @@ case $os in # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1290,7 +1376,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1329,7 +1415,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1378,7 +1464,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1414,15 +1500,14 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; + -nacl*) + ;; -none) ;; *) @@ -1445,10 +1530,10 @@ else # system, and we'll never get to this point. case $basic_machine in - score-*) + score-*) os=-elf ;; - spu-*) + spu-*) os=-elf ;; *-acorn) @@ -1460,8 +1545,23 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1481,14 +1581,11 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; - mep-*) + mep-*) os=-elf ;; mips*-cisco) @@ -1497,6 +1594,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; @@ -1515,7 +1615,7 @@ case $basic_machine in *-ibm) os=-aix ;; - *-knuth) + *-knuth) os=-mmixware ;; *-wec) diff --git a/configure b/configure index 09d2cfb47..a8e9bd2b2 100755 --- a/configure +++ b/configure @@ -623,9 +623,10 @@ ac_includes_default="\ ac_subst_vars='PKG_ODBC PKG_LIBARCHIVE -GECODE_EXTRALIBS -GECODE_VERSION GECODE_MAJOR +GECODE_VERSION +GECODE_INCLUDES +GECODE_EXTRALIBS PKG_GECODE CUDA_LDFLAGS CUDA_CPPFLAGS @@ -834,6 +835,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_tabling +enable_abi enable_or_parallelism enable_depth_limit enable_wam_profile @@ -1510,6 +1512,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-tabling support tabling + --enable-abi support tabling --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads --enable-depth-limit support depth-bound computation --enable-wam-profile support low level profiling of abstract machine @@ -4206,6 +4209,15 @@ else tabling=yes fi +# Check whether --enable-abi was given. +if test "${enable_abi+set}" = set; then : + enableval=$enable_abi; yap_cv_abi="$enableval" + CC="$CC -m$abi" + CXX="$CXX -m$abi" +else + yap_cv_abi="" +fi + # Check whether --enable-or-parallelism was given. if test "${enable_or_parallelism+set}" = set; then : enableval=$enable_or_parallelism; orparallelism="$enableval" @@ -6946,6 +6958,7 @@ fi if test "$have_dl" = "yes" then SO="so" + SOPATH="LD_LIBRARY_PATH" SHLIB_LD="$CC -shared -export-dynamic" SHLIB_CXX_LD="$CXX -shared -export-dynamic" DO_SECOND_LD="" @@ -7113,6 +7126,7 @@ else fi SO="so" + SOPATH="LD_LIBRARY_PATH" SHLIB_LD="ld -shared -expect_unresolved '*'" DO_SECOND_LD="" fi @@ -7127,6 +7141,7 @@ fi SHLIB_CFLAGS="$CFLAGS" SHLIB_CXXFLAGS="$CXXFLAGS" SO="so" + SOPATH="LD_LIBRARY_PATH" DO_SECOND_LD="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_CXX_LD="$SHLIB_LD" @@ -7190,6 +7205,7 @@ fi fi fi SO="dylib" + SOPATH="DYLD_LIBRARY_PATH" DO_SECOND_LD="" if test "$dynamic_loading" = "yes" then @@ -7224,6 +7240,7 @@ fi SHLIB_CFLAGS="$CFLAGS" SHLIB_CXXFLAGS="$CXXFLAGS" SO="o" + SOPATH="LD_AOUT_LIBRARY_PATH" else #an elf system LDFLAGS="-Wl,--export-dynamic $LDFLAGS" @@ -7233,6 +7250,7 @@ fi SHLIB_CXX_LD="$CXX -shared -export-dynamic" DO_SECOND_LD="" SO="so" + SOPATH="LD_LIBRARY_PATH" INSTALL_DLLS="yes" fi LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR)" @@ -7252,6 +7270,7 @@ fi SHLIB_CXX_LD="$CXX -shared" DO_SECOND_LD="" SO="so" + SOPATH="LD_LIBRARY_PATH" INSTALL_DLLS="yes" LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)" DYNYAPLIB=libYap."$SO" @@ -7284,6 +7303,7 @@ fi SHLIB_LD="\$(CC) -shared -Wl,--export-all-symbols" SHLIB_CXX_LD="\$(CXX) -shared -Wl,--export-all-symbols" SO="dll" + SOPATH="PATH" C_PARSER_FLAGS="$C_INTERF_FLAGS" EXEC_SUFFIX=".exe" INSTALL_DLLS="yes" @@ -7341,6 +7361,7 @@ fi if test "$have_dl" = yes then SO="o" + SOPATH="LD_LIBRARY_PATH" LIBS="$LIBS -ldl" INSTALL_DLLS="yes" if test "$GCC" = "yes" @@ -8924,6 +8945,17 @@ _ACEOF fi done +for ac_func in LoadLibrary +do : + ac_fn_c_check_func "$LINENO" "LoadLibrary" "ac_cv_func_LoadLibrary" +if test "x$ac_cv_func_LoadLibrary" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LOADLIBRARY 1 +_ACEOF + +fi +done + for ac_func in localeconv localtime lstat mallinfo do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -12057,7 +12089,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 12060 "configure" */ +/* #line 12092 "configure" */ public class Test { } EOF @@ -12233,7 +12265,7 @@ EOF if uudecode$EXEEXT Test.uue; then ac_cv_prog_uudecode_base64=yes else - echo "configure: 12236: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 + echo "configure: 12268: uudecode had trouble decoding base 64 file 'Test.uue'" >&5 echo "configure: failed file was:" >&5 cat Test.uue >&5 ac_cv_prog_uudecode_base64=no @@ -12364,7 +12396,7 @@ else JAVA_TEST=Test.java CLASS_TEST=Test.class cat << \EOF > $JAVA_TEST -/* #line 12367 "configure" */ +/* #line 12399 "configure" */ public class Test { } EOF @@ -12399,7 +12431,7 @@ JAVA_TEST=Test.java CLASS_TEST=Test.class TEST=Test cat << \EOF > $JAVA_TEST -/* [#]line 12402 "configure" */ +/* [#]line 12434 "configure" */ public class Test { public static void main (String args[]) { System.exit (0); @@ -12784,9 +12816,6 @@ while test $found = no; do fi done -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: _JTOPDIR=\"$_JTOPDIR\"" >&5 -$as_echo "_JTOPDIR=\"$_JTOPDIR\"" >&6; } - # get the likely subdirectories for system specific java includes case "$host_os" in bsdi*) _JNI_INC_SUBDIRS="bsdos";; @@ -14902,28 +14931,30 @@ test -n "$PYTHON" || PYTHON=""none"" else PYTHON="$yap_cv_python" fi - if test $i_am_cross_compiling = yes + if test "$i_am_cross_compiling" = yes then #mingw - PYTHON_DIR=`dirname "$PYTHON"` + PYTHON_DIR=`which "$PYTHON"` + PYTHON_DIR=`dirname "$PYTHON_DIR"` PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll` PYTHON_LIBS="\"$PYTHON_DLL\"" PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include" else - PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` - PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[:3])"` - if test -d "$PYTHONHOME/libs"; then - PYTHONV=`echo "$PYTHONVERSION"|sed -e 's/\.//g'` - PYTHON_LIBS="-L $PYTHONHOME/libs" - elif test -d "$PYTHONHOME/lib"; then - PYTHON_LIBS="-L $PYTHONHOME/lib" - else - echo "Could not find libraries for Python" - PKG_PYTHON="" - fi - OLIBS=$LIBS - LIBS=$PYTHON_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing Py_Initialize" >&5 + PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` + PYTHONHOME=`(cd "$PYTHONHOME" && pwd)` + PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[:3])"` + if test -d "$PYTHONHOME/libs"; then + #mingw + PYTHON_DIR="$PYTHONHOME" + PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll` + PYTHON_LIBS="\"$PYTHON_DLL\"" + PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include" + elif test -d "$PYTHONHOME/lib"; then + # unix, mac + PYTHON_LIBS="-L $PYTHONHOME/lib" + OLIBS=$LIBS + LIBS=$PYTHON_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing Py_Initialize" >&5 $as_echo_n "checking for library containing Py_Initialize... " >&6; } if ${ac_cv_search_Py_Initialize+:} false; then : $as_echo_n "(cached) " >&6 @@ -14979,33 +15010,38 @@ if test "$ac_res" != no; then : else echo "Could not find libraries for Python"; - PKG_PYTHON="" + PKG_PYTHON="" fi - PYTHON_LIBS=$LIBS - LIBS=$OLIBS - if test -d "$PYTHONHOME/include/python$PYTHONVERSION"; then - PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" - elif test -d "$PYTHONHOME/include/python$PYTHONVERSION"m; then - PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"m - elif test -d "$PYTHONHOME/include"; then - PYTHON_INCLUDES="-I $PYTHONHOME/include" - else - echo "Could not find includes for Python" - PKG_PYTHON="" - fi + PYTHON_LIBS=$LIBS + LIBS=$OLIBS + if test -d "$PYTHONHOME/include/python$PYTHONVERSION"; then + PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" + elif test -d "$PYTHONHOME/include/python$PYTHONVERSION"m; then + PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"m + elif test -d "$PYTHONHOME/include"; then + PYTHON_INCLUDES="-I $PYTHONHOME/include" + else + echo "Could not find includes for Python" + PKG_PYTHON="" + fi + else + echo "Could not find libraries for Python" + PKG_PYTHON="" + fi fi else PYTHON_TARGET="dummy" PKG_PYTHON="" fi - - - - - if test "$PKG_PYTHON" != ""; then + + + + + + ac_config_files="$ac_config_files packages/python/Makefile" fi @@ -15160,34 +15196,20 @@ mkdir -p packages/cuda +# Check whether --enable-gecode was given. +if test "${enable_gecode+set}" = set; then : + enableval=$enable_gecode; use_gecode="$enableval" +else + use_gecode=no +fi + + if test -d /usr/local/include/gecode; then CFLAGS="$CFLAGS -I/usr/local/include" SHLIB_CXXFLAGS="$SHLIB_CXXFLAGS -I/usr/local/include" GECODE_EXTRALIBS="-L/usr/local/lib" fi -ac_fn_c_check_header_mongrel "$LINENO" "gecode/support/config.hpp" "ac_cv_header_gecode_support_config_hpp" "$ac_includes_default" -if test "x$ac_cv_header_gecode_support_config_hpp" = xyes; then : - have_gecode=yes -else - have_gecode=no -fi - - - -# Check whether --enable-gecode was given. -if test "${enable_gecode+set}" = set; then : - enableval=$enable_gecode; use_gecode="$enableval" - if test "$use_gecode" = yes; then - if test "$have_gecode" = no; then - as_fn_error $? "cannot enable gecode: gecode library not found" "$LINENO" 5 - fi - fi -else - use_gecode=$have_gecode -fi - - if test "$use_gecode" = no; then PKG_GECODE="" else @@ -15234,7 +15256,32 @@ if test "$use_gecode" = yes; then if test $i_am_cross_compiling = yes then GECODE_VERSION=4.2.1 - else + elif test x"$WINDOWS" = x; then + if test $ac_cv_sizeof_int_p = 8; then + GECODE_ARCH=x64 + else + GECODE_ARCH=i386 + fi + GECODE_PATH=`which fzn-gecode` + GECODE_PATH=`dirname "$GECODE_PATH"` + GECODE_PATH=`dirname "$GECODE_PATH"` + GECODE_INCLUDES="$GECODE_PATH"/include + GECODE_LIBDIR="\"$GECODE_PATH\""/lib + GECODE_BINDIR="\"$GECODE_PATH\""/bin + GECODE_TVERSION=`echo "$GECODE_PATH"/lib/GecodeDriver-*-d-"$GECODE_ARCH".lib | cut -d'-' -f 2-4` + GECODE_VERSION=`echo "$GECODE_TVERSION"|sed 's/-/\./g'` + GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` + GE_SUF="-$GECODE_TVERSION-r-$GECODE_ARCH.dll" + GECODE_EXTRALIBS="$GECODE_BINDIR/GecodeDriver$GE_SUF \ + $GECODE_BINDIR/GecodeSupport$GE_SUF \ + $GECODE_BINDIR/GecodeKernel$GE_SUF \ + $GECODE_BINDIR/GecodeInt$GE_SUF \ + $GECODE_BINDIR/GecodeSet$GE_SUF \ + $GECODE_BINDIR/GecodeSearch$GE_SUF" + if test "$GECODE_MAJOR" = "4"; then + GECODE_EXTRALIBS="$GECODE_EXTRALIBS $GECODE_BINDIR/GecodeFloat$GE_SUF" + fi + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking gecode version" >&5 $as_echo_n "checking gecode version... " >&6; } if test "$cross_compiling" = yes; then : @@ -15319,21 +15366,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CXXFLAGS="$saved_CXXFLAGS" ;; esac + + GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` + if test "$GECODE_MAJOR" = "3"; then + GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch" + else + GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch" + fi + fi fi -GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I \"$GECODE_INCLUDES\"" +ac_fn_c_check_header_mongrel "$LINENO" "gecode/support/config.hpp" "ac_cv_header_gecode_support_config_hpp" "$ac_includes_default" +if test "x$ac_cv_header_gecode_support_config_hpp" = xyes; then : - -if test "$GECODE_MAJOR" = "3"; then - GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch" -else - GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch" fi +CPPFLAGS="$saved_CPPFLAGS" + + + + + + if test "$PKG_GECODE" = "packages/gecode"; then ac_config_files="$ac_config_files packages/gecode/Makefile" @@ -15389,7 +15449,7 @@ _ACEOF cat >>confdefs.h <<_ACEOF -#define SO_PATH "$YAPLIBDIR" +#define SO_PATH "$SOPATH" _ACEOF @@ -15653,6 +15713,11 @@ ac_config_files="$ac_config_files packages/prism/src/prolog/Makefile" fi +if test "$PKG_WINCONSOLE" != ""; then +ac_config_files="$ac_config_files swi/console/Makefile" + +fi + ac_config_files="$ac_config_files packages/yap-lbfgs/Makefile" @@ -16410,6 +16475,7 @@ do "packages/CLPBN/horus/Makefile") CONFIG_FILES="$CONFIG_FILES packages/CLPBN/horus/Makefile" ;; "packages/prism/src/c/Makefile") CONFIG_FILES="$CONFIG_FILES packages/prism/src/c/Makefile" ;; "packages/prism/src/prolog/Makefile") CONFIG_FILES="$CONFIG_FILES packages/prism/src/prolog/Makefile" ;; + "swi/console/Makefile") CONFIG_FILES="$CONFIG_FILES swi/console/Makefile" ;; "packages/yap-lbfgs/Makefile") CONFIG_FILES="$CONFIG_FILES packages/yap-lbfgs/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/configure.in b/configure.in index 559b5eb5b..f25f81914 100755 --- a/configure.in +++ b/configure.in @@ -101,6 +101,11 @@ AC_DEFINE(ALIGN_LONGS, 1, [longs should be in addresses that are multiple of fou AC_ARG_ENABLE(tabling, [ --enable-tabling support tabling ], tabling="$enableval", tabling=yes) +AC_ARG_ENABLE(abi, + [ --enable-abi support tabling ], + [yap_cv_abi="$enableval" + CC="$CC -m$abi" + CXX="$CXX -m$abi"], yap_cv_abi="") AC_ARG_ENABLE(or-parallelism, [ --enable-or-parallelism support or-parallelism as: copy,sba,a-cow,threads ], orparallelism="$enableval", orparallelism=no) @@ -794,6 +799,7 @@ fi if test "$have_dl" = "yes" then SO="so" + SOPATH="LD_LIBRARY_PATH" SHLIB_LD="$CC -shared -export-dynamic" SHLIB_CXX_LD="$CXX -shared -export-dynamic" DO_SECOND_LD="" @@ -889,7 +895,7 @@ fi DYNYAPLIB=libYap."$SO" SONAMEFLAG="" EXTRA_LIBS_FOR_DLLS="$EXTRA_LIBS_FOR_DLLS -L\$(abs_top_builddir) -lYap -Wl,-R,\$(YAPLIBDIR) -Wl,-R,\$(LIBDIR)" - PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir):\$(abs_top_builddir)/library/system:$LD_LIBRARY_PATH" + PRE_INSTALL_ENV="LD_LIBRARY_PATH=\$(abs_top_builddir) YAPLIBDIR=\$(abs_top_builddir):\$(abs_top_builddir)/library/system" INSTALL_ENV="LD_LIBRARY_PATH=\$(DESTDIR)\$(LIBDIR):\$(DESTDIR)\$(YAPLIBDIR): YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)" ;; *aix*) @@ -915,6 +921,7 @@ dnl Linux has both elf and a.out, in this case we found elf , have_dl=no) SO="so" + SOPATH="LD_LIBRARY_PATH" SHLIB_LD="ld -shared -expect_unresolved '*'" DO_SECOND_LD="" fi @@ -929,6 +936,7 @@ dnl Linux has both elf and a.out, in this case we found elf SHLIB_CFLAGS="$CFLAGS" SHLIB_CXXFLAGS="$CXXFLAGS" SO="so" + SOPATH="LD_LIBRARY_PATH" DO_SECOND_LD="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_CXX_LD="$SHLIB_LD" @@ -953,6 +961,7 @@ dnl Linux has both elf and a.out, in this case we found elf fi fi SO="dylib" + SOPATH="DYLD_LIBRARY_PATH" DO_SECOND_LD="" if test "$dynamic_loading" = "yes" then @@ -987,6 +996,7 @@ dnl Linux has both elf and a.out, in this case we found elf SHLIB_CFLAGS="$CFLAGS" SHLIB_CXXFLAGS="$CXXFLAGS" SO="o" + SOPATH="LD_AOUT_LIBRARY_PATH" else #an elf system LDFLAGS="-Wl,--export-dynamic $LDFLAGS" @@ -996,6 +1006,7 @@ dnl Linux has both elf and a.out, in this case we found elf SHLIB_CXX_LD="$CXX -shared -export-dynamic" DO_SECOND_LD="" SO="so" + SOPATH="LD_LIBRARY_PATH" INSTALL_DLLS="yes" fi LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR)" @@ -1015,6 +1026,7 @@ dnl Linux has both elf and a.out, in this case we found elf SHLIB_CXX_LD="$CXX -shared" DO_SECOND_LD="" SO="so" + SOPATH="LD_LIBRARY_PATH" INSTALL_DLLS="yes" LDFLAGS="$LDFLAGS -L\$(abs_top_builddir) -Wl,-R,\$(LIBDIR) -Wl,-R,\$(YAPLIBDIR)" DYNYAPLIB=libYap."$SO" @@ -1047,6 +1059,7 @@ dnl Linux has both elf and a.out, in this case we found elf SHLIB_LD="\$(CC) -shared -Wl,--export-all-symbols" SHLIB_CXX_LD="\$(CXX) -shared -Wl,--export-all-symbols" SO="dll" + SOPATH="PATH" C_PARSER_FLAGS="$C_INTERF_FLAGS" EXEC_SUFFIX=".exe" INSTALL_DLLS="yes" @@ -1065,6 +1078,7 @@ dnl Linux has both elf and a.out, in this case we found elf if test "$have_dl" = yes then SO="o" + SOPATH="LD_LIBRARY_PATH" LIBS="$LIBS -ldl" INSTALL_DLLS="yes" if test "$GCC" = "yes" @@ -1535,6 +1549,7 @@ AC_CHECK_FUNCS(gethostbyname gethostent gethostid gethostname) AC_CHECK_FUNCS(gethrtime getpagesize getpid) AC_CHECK_FUNCS(getpwnam getrlimit getrusage gettimeofday getwd) AC_CHECK_FUNCS(isatty isnan isfinite isinf kill labs link lgamma) +AC_CHECK_FUNCS(LoadLibrary) AC_CHECK_FUNCS(localeconv localtime lstat mallinfo) AC_CHECK_FUNCS(mbscoll) AC_CHECK_FUNCS(mbscasecoll) @@ -1916,7 +1931,7 @@ AC_DEFINE_UNQUOTED( C_LDFLAGS, [ "$LDFLAGS" ], [linking flags]) AC_DEFINE_UNQUOTED( C_LIBS, [ "$LIBS" ], [main libs for YAP]) AC_DEFINE_UNQUOTED( C_LIBPLSO, [ "$LIBS $EXTRA_LIBS_FOR_DLLS" ], [libs for linking with DLLs]) AC_DEFINE_UNQUOTED( SO_EXT, [ "$SO" ], [relocable objects]) -AC_DEFINE_UNQUOTED( SO_PATH, [ "$YAPLIBDIR" ], [libraries]) +AC_DEFINE_UNQUOTED( SO_PATH, [ "$SOPATH" ], [library search variable]) AC_DEFINE_UNQUOTED( YAP_ARCH, [ "$ARCH" ], [architecture]) AC_DEFINE_UNQUOTED( YAP_BINDIR, [ "$prefix/bin" ], [where the yap executable lives]) AC_DEFINE_UNQUOTED( YAP_FULL_VERSION, [ "YAP $YAP_VERSION ($ARCH): $yap_timestamp" ], [YAP version string]) @@ -2093,6 +2108,10 @@ AC_CONFIG_FILES([packages/prism/src/c/Makefile]) AC_CONFIG_FILES([packages/prism/src/prolog/Makefile]) fi +if test "$PKG_WINCONSOLE" != ""; then +AC_CONFIG_FILES([swi/console/Makefile]) +fi + AC_CONFIG_FILES([packages/yap-lbfgs/Makefile]) AC_OUTPUT() diff --git a/console/LGPL/pl-ntconsole.c b/console/LGPL/pl-ntconsole.c index 9fce92955..401736036 100755 --- a/console/LGPL/pl-ntconsole.c +++ b/console/LGPL/pl-ntconsole.c @@ -77,7 +77,7 @@ Message(const char *fm, ...) va_start(args, fm); vsprintf(buf, fm, args); - MessageBox(NULL, buf, "SWI-Prolog", MB_OK|MB_TASKMODAL); + MessageBox(NULL, buf, "YAP-Prolog", MB_OK|MB_TASKMODAL); va_end(args); } diff --git a/console/LGPL/pl-ntmain.c b/console/LGPL/pl-ntmain.c index a52d06d6a..fcc30ee93 100755 --- a/console/LGPL/pl-ntmain.c +++ b/console/LGPL/pl-ntmain.c @@ -24,13 +24,23 @@ #define _UNICODE 1 #define UNICODE 1 +#ifdef _YAP_NOT_INSTALLED_ +#define MAX_FILE_NAME 1024 +#include "config.h" +#include "console/LGPL/resource.h" +#ifdef THREADSx +#define O_PLMT 1 +#endif +#else #ifdef WIN64 #include "config/win64.h" #else #include "config/win32.h" #endif +#endif #include +#include #include #include #include @@ -57,6 +67,8 @@ typedef wint_t _TINT; #endif +int win32main(rlc_console c, int argc, TCHAR **argv); + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Main program for running SWI-Prolog from a window. The window provides X11-xterm like features: scrollback for a predefined number of lines, @@ -77,6 +89,129 @@ static int get_chars_arg_ex(int a, term_t t, TCHAR **v); #define RLC_PROLOG_ERROR RLC_VALUE(3) /* Error stream (IOSTREAM*) */ #define RLC_REGISTER RLC_VALUE(4) /* Trap destruction */ + /******************************* + * EXTRA YAP * + *******************************/ +#if __YAP_PROLOG__ +static int +build_filter( term_t list, size_t space, TCHAR *fil ) +{ + term_t a = PL_new_term_ref(); + term_t head = PL_new_term_ref(); + int n; + size_t len; + TCHAR *s; + + while (PL_is_pair( list )) { + if (!PL_get_list( list, head, list)) + return FALSE; + for (n=1; n<=2; n++) { + if ( !PL_get_arg(n, head, a) ) + return FALSE; + if ( !PL_get_wchars(a, &len, &s, CVT_ATOM|BUF_DISCARDABLE) ) + return FALSE; + if (len >= space) + return FALSE; + space -= len+1; + while ((*fil++ = *s++)); + } + } + *fil++ = '\0'; + return TRUE; +} + + +// a another memory buffer to contain the file name +static foreign_t +pl_win_file_name( term_t mode, term_t list, term_t tit, term_t cwd, term_t hwnd, term_t file ) +{ +#if 1 + // open a file name + OPENFILENAME ofn ; + + TCHAR *szFile = (TCHAR *)malloc(sizeof(TCHAR)*(MAX_FILE_NAME+1)); + TCHAR *filter = (TCHAR *)malloc(sizeof(TCHAR)*(MAX_FILE_NAME+1)); + // TCHAR *file = (TCHAR *)malloc(sizeof(TCHAR)*(MAX_FILE_NAME+1)); + TCHAR *title, *dir; + void *owner; + size_t len; + + ZeroMemory( &ofn , sizeof( ofn)); + ofn.lStructSize = sizeof ( ofn ); + if (!PL_get_pointer(hwnd, &owner)) + return FALSE; + ofn.hwndOwner = owner ; + ofn.lpstrFile = szFile ; + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = MAX_FILE_NAME; + if (!build_filter( list, MAX_FILE_NAME, filter )) + return FALSE; + ofn.lpstrFilter = filter; + ofn.nFilterIndex =1; + if ( !PL_get_wchars(tit, &len, &title, CVT_ATOM|BUF_RING) ) + return FALSE; + ofn.lpstrTitle = title ; + ofn.lpstrFileTitle = NULL ; + ofn.nMaxFileTitle = 0 ; + if ( !PL_get_wchars(cwd, &len, &dir, CVT_ATOM|BUF_RING) ) + return FALSE; + ofn.lpstrInitialDir=dir ; + ofn.Flags = OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST ; + + GetOpenFileName( &ofn ); + return PL_unify_wchars( file, PL_ATOM, wcslen(ofn.lpstrFile), ofn.lpstrFile); + + // Now simpley display the file name + // MessageBox ( NULL , ofn.lpstrFile , "File Name" , MB_OK); + + +#else + // CoCreate the dialog object. + HRESULT hr = CoCreateInstance(CLSID_FileOpenDialog, + NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARGS(&pfd)); + + if (SUCCEEDED(hr)) + { + DWORD dwOptions; + // Specify multiselect. + hr = pfd->GetOptions(&dwOptions); + + if (SUCCEEDED(hr)) + { + hr = pfd->SetOptions(dwOptions | FOS_ALLOWMULTISELECT); + } + + if (SUCCEEDED(hr)) + { + // Show the Open dialog. + hr = pfd->Show(NULL); + + if (SUCCEEDED(hr)) + { + // Obtain the result of the user interaction. + IShellItemArray *psiaResults; + hr = pfd->GetResults(&psiaResults); + + if (SUCCEEDED(hr)) + { + // + // You can add your own code here to handle the results. + // + psiaResults->Release(); + } + } + } + pfd->Release(); + } + // Now simpley display the file name + MessageBox ( NULL , ofn.lpstrFile , "File Name" , MB_OK); +#endif + return TRUE; +} +#endif + /******************************* * CONSOLE ADMIN * *******************************/ @@ -135,7 +270,7 @@ registerConsole(rlc_console c) } -void +static void closeConsoles(void) { int i; rlc_console *p; @@ -561,7 +696,7 @@ PL_set_menu_thread(void) } -foreign_t +static foreign_t pl_window_title(term_t old, term_t new) { TCHAR buf[256]; TCHAR *n; @@ -611,7 +746,7 @@ get_bool_arg_ex(int a, term_t t, int *v) } -foreign_t +static foreign_t pl_window_pos(term_t options) { int x = 0, y = 0, w = 0, h = 0; HWND z = HWND_TOP; @@ -695,8 +830,8 @@ call_menu(const TCHAR *name) } -foreign_t -pl_win_insert_menu_item(foreign_t menu, foreign_t label, foreign_t before) +static foreign_t +pl_win_insert_menu_item(term_t menu, term_t label, term_t before) { TCHAR *m, *l, *b; if ( !PL_get_wchars(menu, NULL, &m, CVT_ATOM) || @@ -713,8 +848,8 @@ pl_win_insert_menu_item(foreign_t menu, foreign_t label, foreign_t before) } -foreign_t -pl_win_insert_menu(foreign_t label, foreign_t before) +static foreign_t +pl_win_insert_menu(term_t label, term_t before) { TCHAR *l, *b; if ( !PL_get_wchars(label, NULL, &l, CVT_ATOM) || @@ -759,7 +894,7 @@ run_interactor(void *closure) static void -create_interactor() +create_interactor(void) { pthread_attr_t attr; pthread_t child; @@ -796,24 +931,27 @@ pl_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static TCHAR * -HiddenFrameClass() +HiddenFrameClass(void) { static TCHAR winclassname[32]; static WNDCLASS wndClass; HINSTANCE instance = rlc_hinstance(); if ( !winclassname[0] ) { snwprintf(winclassname, sizeof(winclassname)/sizeof(TCHAR), - _T("SWI-Prolog-hidden-win%d"), instance); + _T("YAP-Prolog-hidden-win%d"), instance); wndClass.style = 0; wndClass.lpfnWndProc = (LPVOID) pl_wnd_proc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hInstance = instance; - wndClass.hIcon = NULL; + wndClass.hIcon = (HICON) LoadImage(instance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_SHARED); + // wndClass.hIconSm = (HICON) LoadImage(instance, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, + // GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), + // LR_DEFAULTCOLOR | LR_SHARED); wndClass.hCursor = NULL; wndClass.hbrBackground = GetStockObject(WHITE_BRUSH); - wndClass.lpszMenuName = NULL; + wndClass.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU); wndClass.lpszClassName = winclassname; RegisterClass(&wndClass); @@ -878,7 +1016,7 @@ fatalSignal(int sig) static void -initSignals() +initSignals(void) { signal(SIGABRT, fatalSignal); signal(SIGFPE, fatalSignal); signal(SIGILL, fatalSignal); @@ -962,7 +1100,7 @@ set_window_title(rlc_console c) #endif snwprintf(title, sizeof(title)/sizeof(TCHAR), - _T("SWI-Prolog (%s%sversion %d.%d.%d)"), + _T("YAP-Prolog (%s%sversion %d.%d.%d)"), w64, mt, major, minor, patch); rlc_title(c, title, NULL, 0); @@ -977,6 +1115,9 @@ PL_extension extensions[] = { "$win_insert_menu_item", 3, pl_win_insert_menu_item, 0 }, { "win_insert_menu", 2, pl_win_insert_menu, 0 }, { "win_window_pos", 1, pl_window_pos, 0 }, +#if __YAP_PROLOG__ + { "win_file_name", 6, pl_win_file_name, 0 }, +#endif { NULL, 0, NULL, 0 } }; @@ -1049,6 +1190,23 @@ win32main(rlc_console c, int argc, TCHAR **argv) set_window_title(c); rlc_bind_terminal(c); + if ( argc > MAX_ARGC ) + argc = MAX_ARGC; + for(i=0; i MAX_ARGC ) - argc = MAX_ARGC; - for(i=0; ivalue.a = textToAtom(&text); /* registered: ok */ + PL_free_text(&text); break; @@ -855,7 +856,9 @@ unify_prolog_flag_value(Module m, atom_t key, prolog_flag *f, term_t val) { case FT_BOOL: if ( f->index >= 0 ) { unsigned int mask = (unsigned int)1 << (f->index-1); - + char *s; + s=PL_atom_chars(key); + Sprintf(GLOBAL_stderr," here it is %s\n",s); return PL_unify_bool_ex(val, truePrologFlag(mask) != FALSE); } /*FALLTHROUGH*/ @@ -1101,11 +1104,7 @@ initPrologFlags(void) #else setPrologFlag("dialect", FT_ATOM|FF_READONLY, "yap"); setPrologFlag("home", FT_ATOM|FF_READONLY, YAP_ROOTDIR); - if (GLOBAL_argv && GLOBAL_argv[0]) { - Yap_TrueFileName (GLOBAL_argv[0], LOCAL_FileNameBuf, FALSE); - setPrologFlag("executable", FT_ATOM|FF_READONLY, LOCAL_FileNameBuf); - } else - setPrologFlag("executable", FT_ATOM|FF_READONLY, Yap_FindExecutable()); + setPrologFlag("executable", FT_ATOM|FF_READONLY, Yap_FindExecutable()); #endif #if defined(HAVE_GETPID) || defined(EMULATE_GETPID) setPrologFlag("pid", FT_INTEGER|FF_READONLY, getpid()); @@ -1133,7 +1132,7 @@ initPrologFlags(void) setPrologFlag("agc_margin",FT_INTEGER, GD->atoms.margin); #endif #endif -#if defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD) || defined(EMULATE_DLOPEN) +#if defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD) || defined(EMULATE_DLOPEN) || defined(HAVE_LOAD_LIBRARY) setPrologFlag("open_shared_object", FT_BOOL|FF_READONLY, TRUE, 0); setPrologFlag("shared_object_extension", FT_ATOM|FF_READONLY, SO_EXT); setPrologFlag("shared_object_search_path", FT_ATOM|FF_READONLY, SO_PATH); diff --git a/os/windows/uxnt.c b/os/windows/uxnt.c old mode 100644 new mode 100755 index 9df64ac64..b5632b9f3 --- a/os/windows/uxnt.c +++ b/os/windows/uxnt.c @@ -267,6 +267,36 @@ _xos_os_filenameW(const char *cname, wchar_t *osname, size_t len) *s++ = '\\'; } +#if __MINGW32__ + if ( q == cname && q[0] == '/' ) /* deal with /host/share in mingw32 */ + { + UINT is_drive; + + q++; + while (*q && *q != '/') { + if ( s+3 >= e ) + { errno = ENAMETOOLONG; + return NULL; + } + *s++ = *q++; + } + s[0] = ':'; + s[1] = '\\'; + s[2] = '\0'; + q++; + is_drive = GetDriveType( osname ); + if ( is_drive != DRIVE_UNKNOWN && + is_drive != DRIVE_NO_ROOT_DIR ) { + // we actually found a drive + s+=2; + } else { + // restart + q = cname; + s = osname; + } + } +#endif + while( *q ) /* map / --> \, delete multiple '\' */ { if ( *q == '/' || *q == '\\' ) { if ( s+1 >= e ) @@ -495,7 +525,42 @@ _xos_absolute_filename(const char *local, char *absolute, size_t len) int _xos_same_file(const char *p1, const char *p2) -{ if ( strcmp(p1, p2) == 0 ) +{ + TCHAR buf1[PATH_MAX]; + TCHAR buf2[PATH_MAX]; + int rc = FALSE, found = FALSE; + if ( !_xos_os_filenameW(p1, buf1, PATH_MAX) ) + return FALSE; + if ( !_xos_os_filenameW(p2, buf2, PATH_MAX) ) + return FALSE; + + HANDLE hFile1 = CreateFile(buf1, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile2 = CreateFile(buf2, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (hFile1 != INVALID_HANDLE_VALUE && + hFile2 != INVALID_HANDLE_VALUE) { + BY_HANDLE_FILE_INFORMATION f1, f2; + if (GetFileInformationByHandle(hFile1, &f1) && + GetFileInformationByHandle(hFile2, &f2) ) { + rc = + f1.dwVolumeSerialNumber == f2.dwVolumeSerialNumber && + f1.nFileIndexLow == f2.nFileIndexLow && + f1.nFileIndexLow == f2.nFileIndexLow; + found = TRUE; + } + } + if ( hFile1 != INVALID_HANDLE_VALUE ) + CloseHandle(hFile1); + if ( hFile2 != INVALID_HANDLE_VALUE ) + CloseHandle(hFile2); + + if (found) + return rc; + + // compare by string names + // old SWI code + + if ( strcmp(p1, p2) == 0 ) { return TRUE; } else { TCHAR osp1[PATH_MAX], osp2[PATH_MAX]; diff --git a/packages/gecode/Makefile.in b/packages/gecode/Makefile.in old mode 100644 new mode 100755 index 41087a409..7a8ac9451 --- a/packages/gecode/Makefile.in +++ b/packages/gecode/Makefile.in @@ -23,7 +23,7 @@ SHAREDIR=$(ROOTDIR)/share # # CXX=@CXX@ -CXXFLAGS= @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -I. -I$(srcdir) -I../.. -I$(srcdir)/../../include -I$(srcdir)/../../os +CXXFLAGS= @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -I. -I$(srcdir) -I../.. -I$(srcdir)/../../include -I$(srcdir)/../../os -I "@GECODE_INCLUDES@" # # # You shouldn't need to change what follows. diff --git a/packages/gecode/configure.in b/packages/gecode/configure.in old mode 100644 new mode 100755 index d1b75c6a6..a3fa90a1a --- a/packages/gecode/configure.in +++ b/packages/gecode/configure.in @@ -1,5 +1,9 @@ dnl Gecode support +AC_ARG_ENABLE(gecode, + [ --enable-gecode install gecode library], + [use_gecode="$enableval"], use_gecode=no) + dnl gecode is usually in /usr/local if test -d /usr/local/include/gecode; then CFLAGS="$CFLAGS -I/usr/local/include" @@ -7,18 +11,6 @@ if test -d /usr/local/include/gecode; then GECODE_EXTRALIBS="-L/usr/local/lib" fi -AC_CHECK_HEADER(gecode/support/config.hpp, - have_gecode=yes, have_gecode=no) - -AC_ARG_ENABLE(gecode, - [ --enable-gecode install gecode library], - [use_gecode="$enableval" - if test "$use_gecode" = yes; then - if test "$have_gecode" = no; then - AC_MSG_ERROR([cannot enable gecode: gecode library not found]) - fi - fi], use_gecode=$have_gecode) - if test "$use_gecode" = no; then PKG_GECODE="" else @@ -44,7 +36,32 @@ if test "$use_gecode" = yes; then if test $i_am_cross_compiling = yes then GECODE_VERSION=4.2.1 - else + elif test x"$WINDOWS" = x; then + if test $ac_cv_sizeof_int_p = 8; then + GECODE_ARCH=x64 + else + GECODE_ARCH=i386 + fi + GECODE_PATH=`which fzn-gecode` + GECODE_PATH=`dirname "$GECODE_PATH"` + GECODE_PATH=`dirname "$GECODE_PATH"` + GECODE_INCLUDES="$GECODE_PATH"/include + GECODE_LIBDIR="\"$GECODE_PATH\""/lib + GECODE_BINDIR="\"$GECODE_PATH\""/bin + GECODE_TVERSION=`echo "$GECODE_PATH"/lib/GecodeDriver-*-d-"$GECODE_ARCH".lib | cut -d'-' -f 2-4` + GECODE_VERSION=`echo "$GECODE_TVERSION"|sed 's/-/\./g'` + GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` + GE_SUF="-$GECODE_TVERSION-r-$GECODE_ARCH.dll" + GECODE_EXTRALIBS="$GECODE_BINDIR/GecodeDriver$GE_SUF \ + $GECODE_BINDIR/GecodeSupport$GE_SUF \ + $GECODE_BINDIR/GecodeKernel$GE_SUF \ + $GECODE_BINDIR/GecodeInt$GE_SUF \ + $GECODE_BINDIR/GecodeSet$GE_SUF \ + $GECODE_BINDIR/GecodeSearch$GE_SUF" + if test "$GECODE_MAJOR" = "4"; then + GECODE_EXTRALIBS="$GECODE_EXTRALIBS $GECODE_BINDIR/GecodeFloat$GE_SUF" + fi + else AC_MSG_CHECKING([gecode version]) AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include "gecode/support/config.hpp" @@ -75,21 +92,29 @@ return 0; CXXFLAGS="$saved_CXXFLAGS" ;; esac + + GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` + if test "$GECODE_MAJOR" = "3"; then + GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch" + else + GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch" + fi + fi fi -GECODE_MAJOR=`echo $GECODE_VERSION| sed 's/\(^.\).*/\1/'` +saved_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I \"$GECODE_INCLUDES\"" +AC_CHECK_HEADER(gecode/support/config.hpp) + +CPPFLAGS="$saved_CPPFLAGS" + +AC_SUBST(GECODE_EXTRALIBS) +AC_SUBST(GECODE_INCLUDES) +AC_SUBST(GECODE_VERSION) AC_SUBST(GECODE_MAJOR) -if test "$GECODE_MAJOR" = "3"; then - GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodeint -lgecodeset -lgecodesearch" -else - GECODE_EXTRALIBS="$GECODE_EXTRALIBS -lgecodesupport -lgecodekernel -lgecodefloat -lgecodeint -lgecodeset -lgecodesearch" -fi - -AC_SUBST(GECODE_VERSION) -AC_SUBST(GECODE_EXTRALIBS) if test "$PKG_GECODE" = "packages/gecode"; then AC_CONFIG_FILES([packages/gecode/Makefile]) diff --git a/packages/gecode/gecode4-common.icc b/packages/gecode/gecode4-common.icc old mode 100644 new mode 100755 index 678a61957..69c3160e8 --- a/packages/gecode/gecode4-common.icc +++ b/packages/gecode/gecode4-common.icc @@ -19,6 +19,16 @@ #ifndef GECODE_COMMON #define GECODE_COMMON +#if defined(_MSC_VER) || defined(__MINGW32__) +#define __i386__ 1 +#if __x86_64__ +#define _WIN64 1 +#define _AMD64_ 1 +#endif +#include +#endif + + #include "gecode/driver.hh" #include "gecode/int.hh" #include "gecode/set.hh" diff --git a/packages/python/configure.in b/packages/python/configure.in index f5adf8143..b54948578 100755 --- a/packages/python/configure.in +++ b/packages/python/configure.in @@ -21,54 +21,60 @@ elif test -e "$srcdir"/packages/python/Makefile.in ; then else PYTHON="$yap_cv_python" fi - if test $i_am_cross_compiling = yes + if test "$i_am_cross_compiling" = yes then #mingw - PYTHON_DIR=`dirname "$PYTHON"` + PYTHON_DIR=`which "$PYTHON"` + PYTHON_DIR=`dirname "$PYTHON_DIR"` PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll` PYTHON_LIBS="\"$PYTHON_DLL\"" PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include" else - PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` - PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[[:3]])"` - if test -d "$PYTHONHOME/libs"; then - dnl windows - PYTHONV=`echo "$PYTHONVERSION"|sed -e 's/\.//g'` - PYTHON_LIBS="-L $PYTHONHOME/libs" - elif test -d "$PYTHONHOME/lib"; then - PYTHON_LIBS="-L $PYTHONHOME/lib" - else - echo "Could not find libraries for Python" - PKG_PYTHON="" - fi - OLIBS=$LIBS - LIBS=$PYTHON_LIBS - AC_SEARCH_LIBS(Py_Initialize, [python"$PYTHONVERSION" python"$PYTHONVERSION"m],,[echo "Could not find libraries for Python"; - PKG_PYTHON=""],"$OLIBS") - PYTHON_LIBS=$LIBS - LIBS=$OLIBS - if test -d "$PYTHONHOME/include/python$PYTHONVERSION"; then - PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" - elif test -d "$PYTHONHOME/include/python$PYTHONVERSION"m; then - PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"m - elif test -d "$PYTHONHOME/include"; then - PYTHON_INCLUDES="-I $PYTHONHOME/include" - else - echo "Could not find includes for Python" - PKG_PYTHON="" - fi + PYTHONHOME=`$PYTHON -c'import sys; sys.stdout.write(sys.prefix)'` + PYTHONHOME=`(cd "$PYTHONHOME" && pwd)` + PYTHONVERSION=`"$PYTHON" -c "import sys; sys.stdout.write(sys.version[[:3]])"` + if test -d "$PYTHONHOME/libs"; then + #mingw + PYTHON_DIR="$PYTHONHOME" + PYTHON_DLL=`echo "$PYTHON_DIR"/python*.dll` + PYTHON_LIBS="\"$PYTHON_DLL\"" + PYTHON_INCLUDES="-I \"$PYTHON_DIR\"/include" + elif test -d "$PYTHONHOME/lib"; then + # unix, mac + PYTHON_LIBS="-L $PYTHONHOME/lib" + OLIBS=$LIBS + LIBS=$PYTHON_LIBS + AC_SEARCH_LIBS(Py_Initialize, [python"$PYTHONVERSION" python"$PYTHONVERSION"m],,[echo "Could not find libraries for Python"; + PKG_PYTHON=""],"$OLIBS") + PYTHON_LIBS=$LIBS + LIBS=$OLIBS + if test -d "$PYTHONHOME/include/python$PYTHONVERSION"; then + PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION" + elif test -d "$PYTHONHOME/include/python$PYTHONVERSION"m; then + PYTHON_INCLUDES="-I $PYTHONHOME/include/python$PYTHONVERSION"m + elif test -d "$PYTHONHOME/include"; then + PYTHON_INCLUDES="-I $PYTHONHOME/include" + else + echo "Could not find includes for Python" + PKG_PYTHON="" + fi + else + echo "Could not find libraries for Python" + PKG_PYTHON="" + fi fi else PYTHON_TARGET="dummy" PKG_PYTHON="" fi +if test "$PKG_PYTHON" != ""; then + AC_SUBST(PYTHON_TARGET) AC_SUBST(PKG_PYTHON) AC_SUBST(PYTHON_INCLUDES) AC_SUBST(PYTHON_LIBS) -if test "$PKG_PYTHON" != ""; then AC_CONFIG_FILES([ packages/python/Makefile ]) fi diff --git a/pl/absf.yap b/pl/absf.yap index 63e16ecd9..a138100e2 100755 --- a/pl/absf.yap +++ b/pl/absf.yap @@ -258,6 +258,9 @@ absolute_file_name(File,Opts,TrueFileName) :- '$system_library_directories'(library, Dir) :- getenv('YAPSHAREDIR', Dirs), '$split_by_sep'(0, 0, Dirs, Dir). +'$system_library_directories'(foreign, Dir) :- + getenv('YAPLIBDIR', Dirs), + '$split_by_sep'(0, 0, Dirs, Dir). '$system_commons_directories'(commons, Dir) :- getenv('YAPCOMMONSDIR', Dirs), '$split_by_sep'(0, 0, Dirs, Dir). @@ -308,8 +311,8 @@ absolute_file_name(File,Opts,TrueFileName) :- '$split_by_sep'(Start, Next, Dirs, Dir) :- - '$swi_current_prolog_flag'(windows, true), !, - '$split_by_sep'(Start, Next, Dirs, ';', Dir). + '$swi_current_prolog_flag'(windows, true), + '$split_by_sep'(Start, Next, Dirs, ';', Dir), !. '$split_by_sep'(Start, Next, Dirs, Dir) :- '$split_by_sep'(Start, Next, Dirs, ':', Dir). diff --git a/pl/boot.yap b/pl/boot.yap index e3bb9d4ef..a85c01f79 100755 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -122,8 +122,7 @@ true :- true. '$init_win_graphics' :- '$undefined'(window_title(_,_), system), !. '$init_win_graphics' :- - load_files([library(win_menu)], [silent(true)]), - ( win_menu:init_win_menus -> true ; true ), + load_files([library(win_menu)], [silent(true),if(not_loaded)]), fail. '$init_win_graphics'. diff --git a/pl/control.yap b/pl/control.yap old mode 100644 new mode 100755 index d000525cc..bab051dec --- a/pl/control.yap +++ b/pl/control.yap @@ -21,6 +21,19 @@ forall(Cond, Action) :- \+((Cond, \+(Action))). ignore(Goal) :- (Goal->true;true). +notrace(G) :- + strip_module(G, M, G1), + ( '$$save_by'(CP), + '$debug_stop'( State ), + '$call'(G1, CP, G, M), + '$$save_by'(CP2), + (CP == CP2 -> ! ; '$debug_state'( NState ), ( true ; '$debug_restart'(NStart), fail ) ), + '$debug_restart'( State ) + ; + '$debug_restart'( State ), + fail + ). + if(X,Y,Z) :- yap_hacks:env_choice_point(CP0), ( @@ -244,6 +257,32 @@ b_getval(GlobalVariable, Val) :- it saves the importante data about current streams and debugger state */ +'$debug_state'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :- + '$init_debugger', + nb_getval('$trace',Trace), + nb_getval('$debug_jump',Jump), + nb_getval('$debug_run',Run), + '$swi_current_prolog_flag'(debug, Debug), + nb_getval('$spy_gn',SPY_GN), + b_getval('$spy_glist',GList). + + +'$debug_stop'( State ) :- + '$debug_state'( State ), + b_setval('$trace',off), + '$swi_set_prolog_flag'(debug, false), + b_setval('$spy_glist',[]), + '$disable_debugging'. + +'$debug_restart'(state(Trace, Debug, Jump, Run, SPY_GN, GList)) :- + b_setval('$spy_glist',GList), + b_setval('$spy_gn',SPY_GN), + '$swi_set_prolog_flag'(debug, Debug), + b_setval('$debug_jump',Jump), + b_setval('$debug_run',Run), + b_setval('$trace',Trace), + '$enable_debugging'. + break :- '$init_debugger', nb_getval('$trace',Trace), diff --git a/pl/modules.yap b/pl/modules.yap old mode 100644 new mode 100755 index c2922e900..bfb28bc1e --- a/pl/modules.yap +++ b/pl/modules.yap @@ -611,6 +611,7 @@ source_module(Mod) :- multifile(:), nospy(:), not(0), + notrace(0), once(0), phrase(2,?), phrase(2,?,+),