Logo Search packages:      
Sourcecode: sam2p version File versions

Rule::OutputRule * Rule::buildProfile ( MiniPS::VALUE  Profile,
bool  quiet = false 
) [static]

Builds the list of available profiles from the Profile element read from a .job file. To do the task, calls check_rule() of all registered (!) Appliers. Also calls OutputRule::fromDict for each profile element. All returned OutputRules have an Applier which returned OK or MAYBE.

a dict==NULLP-terminated list of OutputRules

Definition at line 580 of file rule.cpp.

References Error::getRecorded(), Error::popPolicy(), Error::pushPolicy(), and Error::sev().

  MiniPS::Array *pary=MiniPS::RARRAY(Profile);
  OutputRule *ret=new OutputRule[pary->getLength()+1], *or_=ret;
  /* ^^^ just enough place; there may be BAD items which won't be stored */
  MiniPS::VALUE *val;
  unsigned c;
    bool lzw_warning=true;
  if (quiet) Error::pushPolicy((Error::level_t)0, Error::WARNING, Error::WARNING_DEFER, (GenBuffer::Writable*)NULLP);
  for (c=0, pary->getFirst(val); val!=NULLP; pary->getNext(val), c++) {
    /* val: each OutputRule of the Profile */
    Applier *p=first;
    // printf("building: %s...\n", p->format);
      if (or_->cache.Compression==or_->cache.CO_LZW && lzw_warning) {
        Error::sev(Error::WARNING) << "buildProfile: please `configure --enable-lzw' for /Compression/LZW support in OutputRule #" << c << (Error*)0;
    while (p!=NULLP) {
      if (p->check_rule!=0/*NULLP*/) switch (p->check_rule(or_)) {
       case Applier::BAD:
        Error::sev(Error::WARNING_DEFER) << "buildProfile: ^^^ thus ignoring impossible OutputRule #" << c << (Error*)0;
        goto end_appliers;
       case Applier::MAYBE: case Applier::OK:
        if (p->work!=0/*NULLP*/) { or_++; goto end_appliers; }
        Error::sev(Error::WARNING_DEFER) << "buildProfile: ^^^ ignoring unimplemented OutputRule #" << c << (Error*)0;
       // case p->DONT_KNOW: ;
      p=p->next; /* continue with other Appliers; hope other than DONT_KNOW */
    Error::sev(Error::WARNING_DEFER) << "buildProfile: ignoring, no handlers for OutputRule #" << c << (Error*)0;
    if (quiet) delete Error::getRecorded();
  if (quiet) { delete Error::getRecorded(); Error::popPolicy(); }
  if (or_==ret) Error::sev(Error::WARNING) << "buildProfile: all OutputRules in the .job file are useless" << (Error*)0;
  or_->dict=or_->dictHints=(MiniPS::Dict*)NULLP; /* end-of-list */
  return ret;

Generated by  Doxygen 1.6.0   Back to index