get rid of stdio.h
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@831 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
7a6f4037bd
commit
a77ceeac69
31
C/cdmgr.c
31
C/cdmgr.c
@ -2542,23 +2542,6 @@ p_hidden_predicate(void)
|
||||
|
||||
#ifdef LOW_PROF
|
||||
|
||||
static void
|
||||
inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe) {
|
||||
/*
|
||||
I can only open once, otherwise I'll have heaps of trouble
|
||||
whenever Yap changes directory
|
||||
*/
|
||||
ProfPreds++;
|
||||
if (FPreds != NULL) {
|
||||
fprintf(FPreds,"+%p %p %p %ld\n",code_start,code_end, pe, ProfCalls);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Yap_inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe) {
|
||||
inform_profiler_of_clause(code_start, code_end, pe);
|
||||
}
|
||||
|
||||
static void
|
||||
add_code_in_pred(PredEntry *pp) {
|
||||
yamop *clcode;
|
||||
@ -2573,7 +2556,7 @@ add_code_in_pred(PredEntry *pp) {
|
||||
clcode = pp->CodeOfPred;
|
||||
cl = ClauseCodeToStaticClause(clcode);
|
||||
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl);
|
||||
inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
Yap_inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
return;
|
||||
}
|
||||
clcode = pp->cs.p_code.TrueCodeOfPred;
|
||||
@ -2586,7 +2569,7 @@ add_code_in_pred(PredEntry *pp) {
|
||||
StaticClause *cl = ClauseCodeToStaticClause(clcode);
|
||||
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl);
|
||||
}
|
||||
inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
Yap_inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
}
|
||||
clcode = pp->cs.p_code.FirstClause;
|
||||
if (clcode != NULL) {
|
||||
@ -2602,7 +2585,7 @@ add_code_in_pred(PredEntry *pp) {
|
||||
cl = (CODEADDR)ClauseCodeToStaticClause(clcode);
|
||||
}
|
||||
code_end = cl + Yap_SizeOfBlock((CODEADDR)cl);
|
||||
inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
Yap_inform_profiler_of_clause(clcode, (yamop *)code_end, pp);
|
||||
if (clcode == pp->cs.p_code.LastClause)
|
||||
break;
|
||||
clcode = NextClause(clcode);
|
||||
@ -2619,7 +2602,7 @@ Yap_dump_code_area_for_profiler(void) {
|
||||
for (i_table = NoOfModules-1; i_table >= 0; --i_table) {
|
||||
PredEntry *pp = ModulePred[i_table];
|
||||
while (pp != NULL) {
|
||||
if (pp->ArityOfPE) {
|
||||
/* if (pp->ArityOfPE) {
|
||||
fprintf(stderr,"%s/%d %p\n",
|
||||
RepAtom(NameOfFunctor(pp->FunctorOfPred))->StrOfAE,
|
||||
pp->ArityOfPE,
|
||||
@ -2628,13 +2611,13 @@ Yap_dump_code_area_for_profiler(void) {
|
||||
fprintf(stderr,"%s %p\n",
|
||||
RepAtom((Atom)(pp->FunctorOfPred))->StrOfAE,
|
||||
pp);
|
||||
}
|
||||
}*/
|
||||
add_code_in_pred(pp);
|
||||
pp = pp->NextPredOfModule;
|
||||
}
|
||||
}
|
||||
inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)));
|
||||
inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)));
|
||||
Yap_inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0)));
|
||||
Yap_inform_profiler_of_clause(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)));
|
||||
}
|
||||
|
||||
#endif /* LOW_PROF */
|
||||
|
16
C/stdpreds.c
16
C/stdpreds.c
@ -108,6 +108,22 @@ STD_PROTO(static Int profres2, (void));
|
||||
|
||||
#define TIMER_DEFAULT 1000
|
||||
|
||||
typedef struct prof_files {
|
||||
FILE *f_prof, *f_preds;
|
||||
};
|
||||
|
||||
void
|
||||
Yap_inform_profiler_of_clause(yamop *code_start, yamop *code_end, PredEntry *pe) {
|
||||
/*
|
||||
I can only open once, otherwise I'll have heaps of trouble
|
||||
whenever Yap changes directory
|
||||
*/
|
||||
ProfPreds++;
|
||||
if (FPreds != NULL) {
|
||||
fprintf(FPreds,"+%p %p %p %ld\n",code_start,code_end, pe, ProfCalls);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prof_alrm(int signo)
|
||||
{
|
||||
|
8
H/Heap.h
8
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.41 2003-05-20 19:11:59 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.42 2003-05-21 13:00:23 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -302,7 +302,7 @@ typedef struct various_codes {
|
||||
struct AliasDescS * file_aliases;
|
||||
#if LOW_PROF
|
||||
int profiler_on;
|
||||
FILE *f_prof, *f_preds;
|
||||
void *f_prof, *f_preds;
|
||||
int profiler_pred_count;
|
||||
UInt prof_calls;
|
||||
UInt prof_preds;
|
||||
@ -526,8 +526,8 @@ typedef struct various_codes {
|
||||
#define FileAliases heap_regs->file_aliases
|
||||
#if LOW_PROF
|
||||
#define ProfilerOn heap_regs->profiler_on
|
||||
#define FProf heap_regs->f_prof
|
||||
#define FPreds heap_regs->f_preds
|
||||
#define FProf ((FILE *)heap_regs->f_prof)
|
||||
#define FPreds ((FILE *)heap_regs->f_preds)
|
||||
#define ProfilerPredCount heap_regs->profiler_pred_count
|
||||
#define ProfCalls heap_regs->prof_calls
|
||||
#define ProfPreds heap_regs->prof_preds
|
||||
|
@ -10,7 +10,7 @@
|
||||
* File: Yap.proto *
|
||||
* mods: *
|
||||
* comments: Function declarations for YAP *
|
||||
* version: $Id: Yapproto.h,v 1.35 2003-05-20 19:11:59 vsc Exp $ *
|
||||
* version: $Id: Yapproto.h,v 1.36 2003-05-21 13:00:23 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* prototype file for Yap */
|
||||
@ -299,4 +299,5 @@ void STD_PROTO(Yap_init_optyap_preds,(void));
|
||||
|
||||
#if LOW_PROF
|
||||
void STD_PROTO(Yap_dump_code_area_for_profiler,(void));
|
||||
void STD_PROTO(Yap_inform_profiler_of_clause,(yamop *,yamop *, struct pred_entry *));
|
||||
#endif /* LOW_PROF */
|
||||
|
@ -148,6 +148,4 @@ yamop *STD_PROTO(Yap_PredIsIndexable,(PredEntry *));
|
||||
#if LOW_PROF
|
||||
/* profiling */
|
||||
yamop *Yap_prof_end;
|
||||
|
||||
void STD_PROTO(Yap_inform_profiler_of_clause,(yamop *,yamop *, PredEntry *));
|
||||
#endif /* LOW_PROF */
|
||||
|
Reference in New Issue
Block a user