示例#1
0
STATIC RET_T implyMaybePerform( TARGET *targ, TARGET *imptarg, TARGET *cretarg, bool must )
/******************************************************************************************
 * perform cmds if targ is older than imptarg || must
 *
 * targ     is the target to be updated
 * imptarg  is the dependent for target (ie: "targ : imptarg" )
 * cretarg  is the implicit rule to use
 * must     must we do it?
 */
{
    RET_T   ret;
    DEPEND  *newdep;
    time_t  max_time;

    max_time = OLDEST_DATE;
    if( imptarg->error ) {
        /* there was an error making imptarg before, so just abort */
        return( RET_ERROR );
    }
    if( cretarg->attr.always ) {
        must = true;
    }

    if( isOutOfDate( targ, imptarg, &must ) == RET_ERROR ) {
        return( RET_ERROR );
    }

    if( !must && USE_AUTO_DEP( cretarg ) ) {
        if( autoOutOfDate( targ, &max_time ) ) {
            must = true;
        }
    }

    if( must ) {

        /* construct a depend for perform */

        newdep                = DupDepend( cretarg->depend );
        newdep->targs         = NewTList();
        newdep->targs->target = imptarg;

        /* handle implied attributes (.symb/.prec/.multi) */
        TargAttrOrAttr( &targ->attr, cretarg->attr );

        ret = perform( targ, newdep, newdep, max_time );
        FreeDepend( newdep );           /* don't need depend any more */

        if( ret != RET_SUCCESS ) {
            return( RET_ERROR );
        }

        if( Glob.noexec || Glob.query ) {
            targ->executed = true;
            targ->touched = true;
        }
    }

    return( RET_SUCCESS );
}
示例#2
0
unipoly SplitPoincare(TermList theTList, TermList SplitterTList)
{
  unipoly   res;
  int SplTLLen =MTListLen(SplitterTList), n, NewMTLLen =0, DegSum =0;
  eterm   SPL =SPList(theTList);
  TermList NewTL =NewTList(MTListLen(theTList),TListIndetsNo(theTList)),
           *auxTLs =(TermList*)mymalloc((SplTLLen+1)*sizeof(TermList), "*TermList");
  MixedTermList   SMTL =MTList(SplitterTList), NewMTL =MTList(NewTL);
  
  res = NULL;
  for ( n =MTListLen(SplitterTList) ; n>0 ; --n )
  {
    auxTLs[n] = NewTList(MTListLen(theTList),TListIndetsNo(theTList));
    MoveNotCoprime(theTList, auxTLs[n], SMTL[n]);
    eterm_free(SMTL[n]);
  }
  SetMTListLen(SplitterTList, 0);
  for ( n =SplTLLen ; n>0 ; --n )
    if ((MTListLen(auxTLs[n])!=1) ||(IntsGetLen(Indets(SPList(auxTLs[n])))!=0) )
      if ( res == NULL )
        res = BigRecPoincare(auxTLs[n]);
      else
        res = P1TimesP2(res, BigRecPoincare(auxTLs[n]));
    else
    {
      DegSum += eterm_degree((MTList(auxTLs[n]))[1]);
      MTLPutLast(NewMTL, NewMTLLen,(MTList(auxTLs[n]))[1]);
      SetMTListLen(auxTLs[n],0);
      EraseAndFreeTList(auxTLs[n]);
    }
  myfree((SplTLLen+1)*sizeof(TermList), auxTLs, "*TermList");
  if ( UPSize(res) < UPDeg(res) + eterm_degree(SPL) + DegSum )
    res = UnipolyChangeSize(res, UPDeg(res) + eterm_degree(SPL) + DegSum);
  for ( n = IntsGetLen(Indets(SPL)) ; n>0 ; --n )
    MultByOneMinusXExp(res, SPL[(Indets(SPL))[n]]);
  EraseAndFreeTList(theTList);
  for ( n=NewMTLLen ; n>0 ; --n)
    MultByOneMinusXExp(res, eterm_degree((NewMTL)[n]));
  SetMTListLen(NewTL,NewMTLLen);
  EraseAndFreeTList(NewTL);
 
  return res;
}