예제 #1
0
// Create C++ lines to get to current state
std::string
CglGMI::generateCpp(FILE * fp) 
{
  CglGMI other;
  fprintf(fp,"0#include \"CglGMI.hpp\"\n");
  fprintf(fp,"3  CglGMI GMI;\n");
  if (param.getMAX_SUPPORT()!=other.param.getMAX_SUPPORT())
    fprintf(fp,"3  GMI.setLimit(%d);\n",param.getMAX_SUPPORT());
  else
    fprintf(fp,"4  GMI.setLimit(%d);\n",param.getMAX_SUPPORT());
  if (param.getAway()!=other.param.getAway())
    fprintf(fp,"3  GMI.setAway(%g);\n",param.getAway());
  else
    fprintf(fp,"4  GMI.setAway(%g);\n",param.getAway());
  if (param.getEPS()!=other.param.getEPS())
    fprintf(fp,"3  GMI.setEPS(%g);\n",param.getEPS());
  else
    fprintf(fp,"4  GMI.setEPS(%g);\n",param.getEPS());
  if (param.getEPS_COEFF()!=other.param.getEPS_COEFF())
    fprintf(fp,"3  GMI.setEPS_COEFF(%g);\n",param.getEPS_COEFF());
  else
    fprintf(fp,"4  GMI.set.EPS_COEFF(%g);\n",param.getEPS_COEFF());
  if (param.getEPS_RELAX_ABS()!=other.param.getEPS_RELAX_ABS())
    fprintf(fp,"3  GMI.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS());
  else
    fprintf(fp,"4  GMI.set.EPS_RELAX(%g);\n",param.getEPS_RELAX_ABS());
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  GMI.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  GMI.setAggressiveness(%d);\n",getAggressiveness());
  return "GMI";
}
예제 #2
0
// Create C++ lines to get to current state
std::string
CglClique::generateCpp( FILE * fp) 
{
  CglClique other;
  fprintf(fp,"0#include \"CglClique.hpp\"\n");
  fprintf(fp,"3  CglClique clique;\n");
  std::string types[] = {"SCL_MIN_DEGREE","SCL_MAX_DEGREE",
			 "SCL_MAX_XJ_MAX_DEG"};
  if (scl_next_node_rule!=other.scl_next_node_rule)
    fprintf(fp,"3  clique.setStarCliqueNextNodeMethod(CglClique::%s);\n",
	    types[scl_next_node_rule].c_str());
  else
    fprintf(fp,"4  clique.setStarCliqueNextNodeMethod(CglClique::%s);\n",
	    types[scl_next_node_rule].c_str());
  if (scl_candidate_length_threshold!=other.scl_candidate_length_threshold)
    fprintf(fp,"3  clique.setStarCliqueCandidateLengthThreshold(%d);\n",
	    scl_candidate_length_threshold);
  else
    fprintf(fp,"4  clique.setStarCliqueCandidateLengthThreshold(%d);\n",
	    scl_candidate_length_threshold);
  if (rcl_candidate_length_threshold!=other.rcl_candidate_length_threshold)
    fprintf(fp,"3  clique.setRowCliqueCandidateLengthThreshold(%d);\n",
	    rcl_candidate_length_threshold);
  else
    fprintf(fp,"4  clique.setRowCliqueCandidateLengthThreshold(%d);\n",
	    rcl_candidate_length_threshold);
  if (scl_report_result!=other.scl_report_result)
    fprintf(fp,"3  clique.setStarCliqueReport(%s);\n",
	    scl_report_result ? "true" : "false");
  else
    fprintf(fp,"4  clique.setStarCliqueReport(%s);\n",
	    scl_report_result ? "true" : "false");
  if (rcl_report_result!=other.rcl_report_result)
    fprintf(fp,"3  clique.setRowCliqueReport(%s);\n",
	    rcl_report_result ? "true" : "false");
  else
    fprintf(fp,"4  clique.setRowCliqueReport(%s);\n",
	    rcl_report_result ? "true" : "false");
  if (do_star_clique!=other.do_star_clique)
    fprintf(fp,"3  clique.setDoStarClique(%s);\n",
	    do_star_clique ? "true" : "false");
  else
    fprintf(fp,"4  clique.setDoStarClique(%s);\n",
	    do_star_clique ? "true" : "false");
  if (do_row_clique!=other.do_row_clique)
    fprintf(fp,"3  clique.setDoRowClique(%s);\n",
	    do_row_clique ? "true" : "false");
  else
    fprintf(fp,"4  clique.setDoRowClique(%s);\n",
	    do_row_clique ? "true" : "false");
  if (petol!=other.petol)
    fprintf(fp,"3  clique.setMinViolation(%g);\n",petol);
  else
    fprintf(fp,"4  clique.setMinViolation(%g);\n",petol);
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  clique.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  clique.setAggressiveness(%d);\n",getAggressiveness());
  return "clique";
}
예제 #3
0
// Create C++ lines to get to current state
std::string
CglZeroHalf::generateCpp( FILE * fp) 
{
  CglZeroHalf other;
  fprintf(fp,"0#include \"CglZeroHalf.hpp\"\n");
  fprintf(fp,"3  CglZeroHalf zeroHalf;\n");
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  zeroHalf.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  zeroHalf.setAggressiveness(%d);\n",getAggressiveness());
  return "zeroHalf";
}
예제 #4
0
// Create C++ lines to get to current state
std::string
CglFlowCover::generateCpp( FILE * fp)
{
  CglFlowCover other;
  fprintf(fp,"0#include \"CglFlowCover.hpp\"\n");
  fprintf(fp,"3  CglFlowCover flowCover;\n");
  if (maxNumCuts_!=other.maxNumCuts_)
    fprintf(fp,"3  flowCover.setMaxNumCuts(%d);\n",maxNumCuts_);
  else
    fprintf(fp,"4  flowCover.setMaxNumCuts(%d);\n",maxNumCuts_);
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  flowCover.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  flowCover.setAggressiveness(%d);\n",getAggressiveness());
  return "flowCover";
}
예제 #5
0
// Create C++ lines to get to current state
std::string
CglLiftAndProject::generateCpp( FILE * fp) 
{
  CglLiftAndProject other;
  fprintf(fp,"0#include \"CglLiftAndProject.hpp\"\n");
  fprintf(fp,"3  CglLiftAndProject liftAndProject;\n");
  if (beta_!=other.beta_)
    fprintf(fp,"3  liftAndProject.setBeta(%d);\n",static_cast<int> (beta_));
  else
    fprintf(fp,"4  liftAndProject.setBeta(%d);\n",static_cast<int> (beta_));
  fprintf(fp,"3  liftAndProject.setAggressiveness(%d);\n",getAggressiveness());
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  liftAndProject.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  liftAndProject.setAggressiveness(%d);\n",getAggressiveness());
  return "liftAndProject";
}
예제 #6
0
// Create C++ lines to get to current state
std::string
CglAllDifferent::generateCpp( FILE * fp)
{
  CglAllDifferent other;
  fprintf(fp,"0#include \"CglAllDifferent.hpp\"\n");
  fprintf(fp,"3  CglAllDifferent allDifferent;\n");
  if (logLevel_!=other.logLevel_)
    fprintf(fp,"3  allDifferent.setLogLevel(%d);\n",logLevel_);
  else
    fprintf(fp,"4  allDifferent.setLogLevel(%d);\n",logLevel_);
  if (maxLook_!=other.maxLook_)
    fprintf(fp,"3  allDifferent.setMaxLook(%d);\n",maxLook_);
  else
    fprintf(fp,"4  allDifferent.setMaxLook(%d);\n",maxLook_);
  if (getAggressiveness()!=other.getAggressiveness())
    fprintf(fp,"3  allDifferent.setAggressiveness(%d);\n",getAggressiveness());
  else
    fprintf(fp,"4  allDifferent.setAggressiveness(%d);\n",getAggressiveness());
  return "allDifferent";
}
void IOEthernetInterface::reportInterfaceWakeFlags( IONetworkController * ctr )
{
    ifnet_t                 ifnet;
    OSNumber *              number;
    unsigned long           wakeSetting = 0;
    uint32_t                disabled    = 0;
    uint32_t                filters     = 0;
    uint32_t                linkStatus  = 0;

    ifnet = getIfnet();

    if (!ifnet || !ctr)
        return;

    // Across system sleep/wake, link down is expected, this should
    // not trigger a wake flags changed.

    if (_controllerLostPower)
    {
        DLOG("en%u: controllerLostPower\n", getUnitNumber());
        return;
    }

    do {
        // Report negative if controller is disabled or does not support WOL.

        if (!_ctrEnabled ||
            ((_supportedWakeFilters & kIOEthernetWakeOnMagicPacket) == 0))
        {
            DLOG("en%u: ctrEnabled = %x, WakeFilters = %x\n",
                getUnitNumber(), _ctrEnabled, _supportedWakeFilters);
            break;
        }

        // Poll for disabled WOL filters, which is allowed to change
        // after every link and WOL changed event.

        if (_disabledWakeFilters)
        {
            if ( ctr->getPacketFilters(
                    gIOEthernetDisabledWakeOnLANFilterGroup,
                    (UInt32 *) &disabled ) != kIOReturnSuccess )
            {
                disabled = 0;
            }
            _disabledWakeFilters->setValue( disabled );
        }

        // Check if network wake option is enabled,
        // that also implies system is on AC power.

        getAggressiveness(kPMEthernetWakeOnLANSettings, &wakeSetting);
        filters = wakeSetting & _supportedWakeFilters & ~disabled;
        DLOG("en%u: WakeSetting = %lx, WakeFilters = %x, disabled = %x\n",
            getUnitNumber(), wakeSetting, _supportedWakeFilters, disabled);
        
        if ((kIOEthernetWakeOnMagicPacket & filters) == 0)
            break;

        // Check driver is reporting valid link.

        number = OSDynamicCast(OSNumber, ctr->getProperty(kIOLinkStatus));
        if (!number)
        {
            filters = 0;
            break;
        }

        linkStatus = number->unsigned32BitValue();
        if ((linkStatus & (kIONetworkLinkValid | kIONetworkLinkActive)) ==
            kIONetworkLinkValid)
        {
            filters = 0;
        }
    }
    while (false);

    filters &= IFNET_WAKE_ON_MAGIC_PACKET;
    if (filters != (ifnet_get_wake_flags(ifnet) & IFNET_WAKE_ON_MAGIC_PACKET))
    {
        ifnet_set_wake_flags(ifnet, filters, IFNET_WAKE_ON_MAGIC_PACKET);
        DLOG("en%u: ifnet_set_wake_flags = %x\n", getUnitNumber(), filters);

        // Lazy create of kernel assertion
        if (kIOPMUndefinedDriverAssertionID == _wompEnabledAssertionID)
        {
            _wompEnabledAssertionID = getPMRootDomain()->createPMAssertion(
                kIOPMDriverAssertionMagicPacketWakeEnabledBit,
                (filters & IFNET_WAKE_ON_MAGIC_PACKET) ?
                    kIOPMDriverAssertionLevelOn : kIOPMDriverAssertionLevelOff,
                this, getName());
        }
        else
        {
            getPMRootDomain()->setPMAssertionLevel(_wompEnabledAssertionID,
                (filters & IFNET_WAKE_ON_MAGIC_PACKET) ?
                    kIOPMDriverAssertionLevelOn : kIOPMDriverAssertionLevelOff);
        }
    }
}