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:
vsc 2003-05-21 13:00:23 +00:00
parent 7a6f4037bd
commit a77ceeac69
5 changed files with 29 additions and 31 deletions

View File

@ -2542,23 +2542,6 @@ p_hidden_predicate(void)
#ifdef LOW_PROF #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 static void
add_code_in_pred(PredEntry *pp) { add_code_in_pred(PredEntry *pp) {
yamop *clcode; yamop *clcode;
@ -2573,7 +2556,7 @@ add_code_in_pred(PredEntry *pp) {
clcode = pp->CodeOfPred; clcode = pp->CodeOfPred;
cl = ClauseCodeToStaticClause(clcode); cl = ClauseCodeToStaticClause(clcode);
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl); 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; return;
} }
clcode = pp->cs.p_code.TrueCodeOfPred; clcode = pp->cs.p_code.TrueCodeOfPred;
@ -2586,7 +2569,7 @@ add_code_in_pred(PredEntry *pp) {
StaticClause *cl = ClauseCodeToStaticClause(clcode); StaticClause *cl = ClauseCodeToStaticClause(clcode);
code_end = (char *)cl + Yap_SizeOfBlock((CODEADDR)cl); 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; clcode = pp->cs.p_code.FirstClause;
if (clcode != NULL) { if (clcode != NULL) {
@ -2602,7 +2585,7 @@ add_code_in_pred(PredEntry *pp) {
cl = (CODEADDR)ClauseCodeToStaticClause(clcode); cl = (CODEADDR)ClauseCodeToStaticClause(clcode);
} }
code_end = cl + Yap_SizeOfBlock((CODEADDR)cl); 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) if (clcode == pp->cs.p_code.LastClause)
break; break;
clcode = NextClause(clcode); clcode = NextClause(clcode);
@ -2619,7 +2602,7 @@ Yap_dump_code_area_for_profiler(void) {
for (i_table = NoOfModules-1; i_table >= 0; --i_table) { for (i_table = NoOfModules-1; i_table >= 0; --i_table) {
PredEntry *pp = ModulePred[i_table]; PredEntry *pp = ModulePred[i_table];
while (pp != NULL) { while (pp != NULL) {
if (pp->ArityOfPE) { /* if (pp->ArityOfPE) {
fprintf(stderr,"%s/%d %p\n", fprintf(stderr,"%s/%d %p\n",
RepAtom(NameOfFunctor(pp->FunctorOfPred))->StrOfAE, RepAtom(NameOfFunctor(pp->FunctorOfPred))->StrOfAE,
pp->ArityOfPE, pp->ArityOfPE,
@ -2628,13 +2611,13 @@ Yap_dump_code_area_for_profiler(void) {
fprintf(stderr,"%s %p\n", fprintf(stderr,"%s %p\n",
RepAtom((Atom)(pp->FunctorOfPred))->StrOfAE, RepAtom((Atom)(pp->FunctorOfPred))->StrOfAE,
pp); pp);
} }*/
add_code_in_pred(pp); add_code_in_pred(pp);
pp = pp->NextPredOfModule; pp = pp->NextPredOfModule;
} }
} }
inform_profiler_of_clause(COMMA_CODE, FAILCODE, RepPredProp(Yap_GetPredPropByFunc(FunctorComma,0))); Yap_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(FAILCODE, FAILCODE+1, RepPredProp(Yap_GetPredPropByAtom(AtomFail,0)));
} }
#endif /* LOW_PROF */ #endif /* LOW_PROF */

View File

@ -108,6 +108,22 @@ STD_PROTO(static Int profres2, (void));
#define TIMER_DEFAULT 1000 #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 static void
prof_alrm(int signo) prof_alrm(int signo)
{ {

View File

@ -10,7 +10,7 @@
* File: Heap.h * * File: Heap.h *
* mods: * * mods: *
* comments: Heap Init Structure * * 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 */ /* information that can be stored in Code Space */
@ -302,7 +302,7 @@ typedef struct various_codes {
struct AliasDescS * file_aliases; struct AliasDescS * file_aliases;
#if LOW_PROF #if LOW_PROF
int profiler_on; int profiler_on;
FILE *f_prof, *f_preds; void *f_prof, *f_preds;
int profiler_pred_count; int profiler_pred_count;
UInt prof_calls; UInt prof_calls;
UInt prof_preds; UInt prof_preds;
@ -526,8 +526,8 @@ typedef struct various_codes {
#define FileAliases heap_regs->file_aliases #define FileAliases heap_regs->file_aliases
#if LOW_PROF #if LOW_PROF
#define ProfilerOn heap_regs->profiler_on #define ProfilerOn heap_regs->profiler_on
#define FProf heap_regs->f_prof #define FProf ((FILE *)heap_regs->f_prof)
#define FPreds heap_regs->f_preds #define FPreds ((FILE *)heap_regs->f_preds)
#define ProfilerPredCount heap_regs->profiler_pred_count #define ProfilerPredCount heap_regs->profiler_pred_count
#define ProfCalls heap_regs->prof_calls #define ProfCalls heap_regs->prof_calls
#define ProfPreds heap_regs->prof_preds #define ProfPreds heap_regs->prof_preds

View File

@ -10,7 +10,7 @@
* File: Yap.proto * * File: Yap.proto *
* mods: * * mods: *
* comments: Function declarations for YAP * * 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 */ /* prototype file for Yap */
@ -299,4 +299,5 @@ void STD_PROTO(Yap_init_optyap_preds,(void));
#if LOW_PROF #if LOW_PROF
void STD_PROTO(Yap_dump_code_area_for_profiler,(void)); 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 */ #endif /* LOW_PROF */

View File

@ -148,6 +148,4 @@ yamop *STD_PROTO(Yap_PredIsIndexable,(PredEntry *));
#if LOW_PROF #if LOW_PROF
/* profiling */ /* profiling */
yamop *Yap_prof_end; yamop *Yap_prof_end;
void STD_PROTO(Yap_inform_profiler_of_clause,(yamop *,yamop *, PredEntry *));
#endif /* LOW_PROF */ #endif /* LOW_PROF */