/* Run-time utilities used by starters and generators */ #include "common.h" #include "corefunc.h" #include "stagen.h" #define NumSing (stagen->ProcFuncNum-1) /* 0-th is a default processor */ /* Checks active parameter(s) */ Entry(Int2) CheckParameters(CharPtr Active, Int2 ParNum, Int2Ptr Indices, Int2 ActiveNum) { Int2 i,a; CharPtr sfx; if (ActiveNum) { sfx=ActiveNum==1 ? "" : "s"; if (ActiveNum>ParNum) { Message(MSG_OK,"The system does not depend on at least %i parameter%s", (int)ActiveNum,sfx); return 2; } for (a=ActiveNum,i=0; i0) *Indices++=i; a--; } if (a) { Message(MSG_OK,"There must be exactly %i active parameter%s", (int)ActiveNum,sfx); return 3; } } else for (i=0; i Active test functions */ Entry(void) ActivateTestFuns(StagenDataPtr stagen, BoolPtr asg, BoolPtr atf) { Int2 i,j; MemSet(atf,FALSE,stagen->TestFuncNum); /* FALSE by default */ for (i=0; iTestFuncNum; i++) /* test func */ for (j=0; jTestSingMap+j*stagen->TestFuncNum+i)!=-1) { atf[i]=TRUE; break; } } /* Test functions -> index of processing function */ Entry(void) IndProcFunc(StagenDataPtr stagen, BoolPtr asg, Int1Ptr itf, BoolPtr cs) { Int2 i,j; Boolean res; for (i=0; iTestFuncNum; j++) switch (*(stagen->TestSingMap+i*stagen->TestFuncNum+j)) { case 0: /* zero test function */ res&=itf[j]<=0; break; case 1: /* non-zero test function */ res&=itf[j]>0; break; case -1:; /* irrelevant test function */ /* nothing to do */ } cs[i]=res; } else cs[i]=FALSE; }