Exemplo n.º 1
0
ItemIntegerType CCellView::GetCellValue() const
{
  // If the item is being edited in-cell, we'll get the data from the control
  ItemIntegerType rc=0;
  switch(TI(m_hInCell).Type()){
		case CConfigItem::Integer:
      {
        CString strData;
        m_pwndCell->GetWindowText(strData);
        if(!CUtils::StrToItemIntegerType(strData,rc)){
          rc=0;
        }
      }
      break;
    case CConfigItem::Enum:
    /*
    case CConfigItem::Boolean:
    case CConfigItem::Radio:
    //rc=((CTreeComboBox *)m_pwndCell)->GetCurSel();
    rc=((CComboEdit *)m_pwndCell)->GetCurSel();
    break;
      */
    case CConfigItem::String:
    default:
      int type=TI(m_hInCell).Type();
      UNUSED_ALWAYS(type);
      ASSERT(FALSE);
      break;
  }
  return rc;
}
Exemplo n.º 2
0
BOOL CCellView::InCell(HTREEITEM h)
{
  CancelCellEdit();
  if(h && TI(h).IsEnabled()){
    CConfigItem &ti=TI(h);
    // edit cell only if option is both active and modifiable
    const CdlValuable valuable = ti.GetCdlValuable();
    // check packages explicitly because is_modifiable() returns true for a package
    if ((! valuable) || (valuable->is_modifiable () && valuable->is_active () && ! ti.IsPackage ())){
      CRect rcEdit;
      GetItemRect(h,rcEdit);
      rcEdit.bottom++;
      switch(ti.Type()){
        case CConfigItem::Double:
          {
            double d;
            CUtils::StrToDouble(ti.StringValue(),d);
            m_pwndCell=new CDoubleEdit(d);
            m_pwndCell->Create(WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL, rcEdit, this, IDC_CELL);
          }
          break;
        case CConfigItem::Integer:
          {
            ItemIntegerType i;
            CUtils::StrToItemIntegerType(ti.StringValue(),i);
            m_pwndCell=new CIntegerEdit(i);
          }
          m_pwndCell->Create(WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL, rcEdit, this, IDC_CELL);
          break;
        case CConfigItem::String:
          {
            CStringEdit *pStringEdit=new CStringEdit(ti.StringValue());
            m_pwndCell=pStringEdit;
            m_pwndCell->Create(WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL, rcEdit, this, IDC_CELL);
            pStringEdit->EnableDoubleClickEdit(true,IDC_CT_EDIT);
          }

          break;
        case CConfigItem::Enum:
          {
            CStringArray arEnum;
            ti.EvalEnumStrings(arEnum);
            rcEdit.bottom += (2+(int)arEnum.GetSize()-1)*rcEdit.Height();
            m_pwndCell=new CComboEdit(ti.StringValue(),arEnum);
            m_pwndCell->Create(WS_CHILD|WS_VISIBLE|CBS_DROPDOWNLIST, rcEdit, this, IDC_CELL);
          }
          break;
        default:
          return 0;
          break;
      }
      m_hInCell=h;
      m_pwndCell->SetFont(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
      m_pwndCell->SetFocus();
      m_pwndCell->GetWindowText(m_strInitialCell);
    }
  }
  return NULL!=m_hInCell;
}
Exemplo n.º 3
0
	//TestCase
	virtual void start() {
		printf("Testing stores.\n");
		//open, cin
		MAHandle store = maOpenStore("test.store", MAS_CREATE_IF_NECESSARY);
		TI(store);

		//write
		TI(maWriteStore(store, CLIENT_DATA));

		//close
		maCloseStore(store, 0);

		//open
		store = maOpenStore("test.store", 0);
		TI(store);

		//read
		MAHandle data = maCreatePlaceholder();
		maReadStore(store, data);

		//compare
		char storeBuf[DATA_SIZE], clientBuf[DATA_SIZE];
		maReadData(data, storeBuf, 0, DATA_SIZE);
		maReadData(CLIENT_DATA, clientBuf, 0, DATA_SIZE);
		if(memcmp(storeBuf, clientBuf, DATA_SIZE) != 0) {
			assert(name, false);
			suite->runNextCase();
			return;
		}

		//close, delete
		maCloseStore(store, true);
		maDestroyObject(data);

		//open, should fail
		store = maOpenStore("test.store", 0);
		if(store >= 0) {
			maCloseStore(store, true);
			assert(name, false);
			suite->runNextCase();
			return;
		}

		printf("Store test succeded!\n");

		//succeed
		assert(name, true);
		suite->runNextCase();
	}
Exemplo n.º 4
0
bool TerminateThreadsCommand::executeImpl(DebuggerSession* /*session*/,
                                          folly::dynamic* /*responseMsg*/
) {
  if (m_requestId > 0) {
    RequestInfo* ri = m_debugger->getRequestInfo();
    ri->m_flags.terminateRequest = true;
    TI().m_reqInjectionData.setDebuggerIntr(true);
    return true;
  }

  const folly::dynamic& message = getMessage();
  const auto dispatchRequest = [&](request_id_t requestId) {
    m_debugger->sendUserMessage(std::to_string(requestId).c_str());
    if (requestId > 0) {
      m_debugger->dispatchCommandToRequest(
        requestId,
        createInstance(m_debugger, message, requestId));
    }
  };

  try {
    const auto& args = tryGetObject(message, "arguments", s_emptyArgs);
    const auto& val = args["threadIds"];
    if (val.isArray()) {
      for (const auto requestIdVal : val) {
        auto requestId = requestIdVal.isInt() ? requestIdVal.asInt() : -1;
        dispatchRequest(requestId);
      }
    }
  } catch (std::out_of_range& e) {
  }

  // Do not resume target.
  return false;
}
Exemplo n.º 5
0
void CCellView::GetInCellRect(HTREEITEM h, CRect & rect, BOOL bDropped) const
{
	CConfigItem &ti=TI(h);
	GetItemRect(h,rect);
  switch(ti.Type()){
		case CConfigItem::Enum:
			// Using combobox
      if(bDropped) {
        CStringArray arEnum;
        ti.EvalEnumStrings(arEnum);
        rect.bottom += (2+(int)arEnum.GetSize()-1)*rect.Height();
      }
      break;
    case CConfigItem::Integer:  
    case CConfigItem::Double:
    case CConfigItem::String:
			// Using editbox
			//rect.bottom++;
			//rect.DeflateRect(2,2); // To allow room  for the border we draw ourselves
      //rect.InflateRect(2,2);
      break;
    default:
      return;
  }
}
Exemplo n.º 6
0
wwdmDtbis(
    const vd::DynamicsInit& init,
    const vd::InitEventList& evts)
        : DiscreteTimeDyn(init, evts)
{
    SemRecVar.init(this, "SemRecVar", evts);
    SemRec.init(this, "SemRec", evts);
    Eb.init(this, "Eb", evts);
    Eimax.init(this, "Eimax", evts);
    K.init(this, "K", evts);
    Lmax.init(this, "Lmax", evts);
    A.init(this, "A", evts);
    B.init(this, "B", evts);
    TI.init(this, "TI", evts);
    Tmin.init(this, "Tmin", evts);
    Tmax.init(this, "Tmax", evts);
    RG.init(this, "RG", evts);
    ST.init(this, "ST", evts);
    LAI.init(this, "LAI", evts);
    U.init(this, "U", evts);
    Tr.init(this, "Tr", evts);
    Tmean.init(this, "Tmean", evts);
    PAR.init(this, "PAR", evts);
//constructor

Tr.init_value((1 / B()) * std::log(1 + std::exp(A() * TI())));

}
Exemplo n.º 7
0
// Remeber this thread's VM ThreadInfo so we can find it later via
// isThreadDebugging(). This is called when a thread interrupts for
// either session- or request-started, as these each signal the start
// of debugging for request and other threads.
void Debugger::registerThread() {
  TRACE(2, "Debugger::registerThread\n");
  auto const tid = (int64_t)Process::GetThreadId();
  ThreadInfoMap::accessor acc;
  m_threadInfos.insert(acc, tid);
  acc->second = &TI();
}
Exemplo n.º 8
0
void Debugger::unregisterSandbox(const StringData* sandboxId) {
  TRACE(2, "Debugger::unregisterSandbox\n");
  SandboxThreadInfoMap::accessor acc;
  if (m_sandboxThreadInfoMap.find(acc, sandboxId)) {
    acc->second.erase(&TI());
  }
}
Exemplo n.º 9
0
void raise_infinite_recursion_error() {
  if (!RuntimeOption::NoInfiniteRecursionDetection) {
    // Reset profiler otherwise it might recurse further causing segfault.
    TI().m_profiler = nullptr;
    raise_error("infinite recursion detected");
  }
}
Exemplo n.º 10
0
size_t check_request_surprise() {
  auto& info = TI();
  auto& p = info.m_reqInjectionData;

  auto const flags = fetchAndClearSurpriseFlags();
  auto const do_timedout = (flags & TimedOutFlag) && !p.getDebuggerAttached();
  auto const do_memExceeded = flags & MemExceededFlag;
  auto const do_signaled = flags & SignaledFlag;
  auto const do_cpuTimedOut =
    (flags & CPUTimedOutFlag) && !p.getDebuggerAttached();
  auto const do_GC = flags & PendingGCFlag;

  // Start with any pending exception that might be on the thread.
  auto pendingException = info.m_pendingException;
  info.m_pendingException = nullptr;

  if (do_timedout) {
    p.setCPUTimeout(0);  // Stop CPU timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(TimedOutFlag);
    } else {
      pendingException = generate_request_timeout_exception();
    }
  }
  // Don't bother with the CPU timeout if we're already handling a wall timeout.
  if (do_cpuTimedOut && !do_timedout) {
    p.setTimeout(0);  // Stop wall timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(CPUTimedOutFlag);
    } else {
      pendingException = generate_request_cpu_timeout_exception();
    }
  }
  if (do_memExceeded) {
    if (pendingException) {
      setSurpriseFlag(MemExceededFlag);
    } else {
      pendingException = generate_memory_exceeded_exception();
    }
  }
  if (do_GC) {
    if (StickyFlags & PendingGCFlag) {
      clearSurpriseFlag(PendingGCFlag);
    }
    if (RuntimeOption::EvalEnableGC) {
      MM().collect("surprise");
    } else {
      MM().checkHeap("surprise");
    }
  }
  if (do_signaled) {
    HHVM_FN(pcntl_signal_dispatch)();
  }

  if (pendingException) {
    pendingException->throwException();
  }
  return flags;
}
Exemplo n.º 11
0
void CCellView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	switch(lHint)
	{
		case CConfigToolDoc::IntFormatChanged:
      {
			  for(HTREEITEM h=CConfigTool::GetControlView()->GetFirstVisibleItem();h;h=CConfigTool::GetControlView()->GetNextVisibleItem(h)){
				  CConfigItem &ti=TI(h);
          if(ti.Type()==CConfigItem::Integer) {
					  CRect rect;
					  GetItemRect(h,rect);
					  InvalidateRect(rect);
				  }
			  }
        if(m_pwndCell && TI(m_hInCell).Type()==CConfigItem::Integer) {
				  CString strData;
				  m_pwndCell->GetWindowText(strData);
				  ItemIntegerType n;
				  CUtils::StrToItemIntegerType(strData,n);
          m_pwndCell->SetWindowText(CUtils::IntToStr(n,CConfigTool::GetConfigToolDoc()->m_bHex));
			  }
      }
			break;
		case CConfigToolDoc::Clear:	
			deleteZ(m_pwndCell);
			Invalidate();
			UpdateWindow(); // This prevents cell view half of config pane still being displayed
      break;
		case CConfigToolDoc::ValueChanged:
			{
				CConfigItem *pti=(CConfigItem *)pHint;
				CRect rect;
				GetItemRect(pti->HItem(),rect);
				InvalidateRect(rect);
			}
			break;
		case 0:
			Invalidate();
			break;
		default:
			break;
	}	
	UNUSED_ALWAYS(pSender);
}
Exemplo n.º 12
0
main() {

int t[5];
t[1] = 1; t[2] = 2;t[3] = 3;t[4] = 4;
TupleIterator TI(t);

    while(TI.live()){
        printf("%d", *TI);
        TI++;
    }
}
Exemplo n.º 13
0
void CCellView::CancelCellEdit(bool bApplyChanges)
{
  if(m_hInCell){
    CConfigItem &ti=TI(m_hInCell);
    if(bApplyChanges){
      CString strValue;
      m_pwndCell->GetWindowText(strValue);
      // Ignore empty strings in integer or floating cells - these are legal as intermediate values but not now
      if(strValue!=ti.StringValue() && (!strValue.IsEmpty() || (ti.Type()!=CConfigItem::Integer && ti.Type()!=CConfigItem::Double))){
        CConfigTool::GetConfigToolDoc()->SetValue (ti, strValue);
      }
    }

    deleteZ(m_pwndCell);
    m_hInCell=NULL;
  }
}
Exemplo n.º 14
0
vector hermdiag(matrix& PRe,matrix& PIm)
{
    int nsize=PIm.Rows;
    vector eval(nsize);
    vector WK1(nsize);
    vector WK2(nsize);
    vector WK3(nsize);
	matrix TR(nsize,nsize);
	matrix TI(nsize,nsize);
    int IFAIL=0;
	/* f02axf_(PRe.TheMatrix,&nsize,PIm.TheMatrix,&nsize,&nsize,
		eval.TheVector,TR.TheMatrix,&nsize,TI.TheMatrix,&nsize,WK1.TheVector,
		WK2.TheVector, WK3.TheVector,&IFAIL);*/
	cerr<<"hermdiag to be implemented"<<endl;
        exit(1);

	PRe=TR;
	PIm=TI;
	if (IFAIL != 0) cerr <<"error in hermdiag "<<endl;
	if (!eval.TheVector) exit(1);
	return eval;
}
Exemplo n.º 15
0
// Notify the debugger that this thread is executing a request in the given
// sandbox. This ensures that the debugger knows about the sandbox, and adds
// the thread to the set of threads currently active in the sandbox.
void Debugger::registerSandbox(const DSandboxInfo &sandbox) {
  TRACE(2, "Debugger::registerSandbox\n");
  // update sandbox first
  addOrUpdateSandbox(sandbox);

  // add thread to m_sandboxThreadInfoMap
  const StringData* sid = makeStaticString(sandbox.id());
  auto ti = &TI();
  {
    SandboxThreadInfoMap::accessor acc;
    m_sandboxThreadInfoMap.insert(acc, sid);
    acc->second.insert(ti);
  }

  // Find out whether this sandbox is being debugged.
  auto proxy = findProxy(sid);
  if (proxy) {
    if (!DebuggerHook::attach<HphpdHook>(ti)) {
      Logger::Error("Failed to attach to thread: another debugger is "
                    "unexpectedly hooked");
    }
  }
}
Exemplo n.º 16
0
    void compute(const vle::devs::Time& /* t */)
{
PAR = 0.5 * 0.01 * RG();

Tmean = std::max(0.0, (Tmin() + Tmax()) / 2);

if (SemRec() == 2) {
    SemRecVar = 0;
} else if (SemRec() == 1) {
    SemRecVar = 1;
}

if (SemRecVar() == 0) {
    ST = 0;
    LAI = 0;
} else if (SemRecVar() == 1) {
    ST = ST() + Tmean();
    LAI = std::max(0.0, Lmax() * ((1 / (1 + std::exp(-A() * (ST() - TI())))) -
                                  std::exp(B() * (ST() - Tr()))));
}

U = U(-1) + Eb() * Eimax() * (1 - std::exp(-K() * LAI())) * PAR();

}
Exemplo n.º 17
0
size_t check_request_surprise() {
  auto& info = TI();
  auto& p = info.m_reqInjectionData;

  auto const flags = fetchAndClearSurpriseFlags();
  auto const do_timedout = (flags & TimedOutFlag) && !p.getDebuggerAttached();
  auto const do_memExceeded = flags & MemExceededFlag;
  auto const do_memThreshold = flags & MemThresholdFlag;
  auto const do_signaled = flags & SignaledFlag;
  auto const do_cpuTimedOut =
    (flags & CPUTimedOutFlag) && !p.getDebuggerAttached();
  auto const do_GC = flags & PendingGCFlag;

  // Start with any pending exception that might be on the thread.
  auto pendingException = info.m_pendingException;
  info.m_pendingException = nullptr;

  if (do_timedout) {
    p.setCPUTimeout(0);  // Stop CPU timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(TimedOutFlag);
    } else {
      pendingException = generate_request_timeout_exception();
    }
  }
  // Don't bother with the CPU timeout if we're already handling a wall timeout.
  if (do_cpuTimedOut && !do_timedout) {
    p.setTimeout(0);  // Stop wall timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(CPUTimedOutFlag);
    } else {
      pendingException = generate_request_cpu_timeout_exception();
    }
  }
  if (do_memExceeded) {
    if (pendingException) {
      setSurpriseFlag(MemExceededFlag);
    } else {
      pendingException = generate_memory_exceeded_exception();
    }
  }
  if (do_memThreshold) {
    clearSurpriseFlag(MemThresholdFlag);
    if (!g_context->m_memThresholdCallback.isNull()) {
      VMRegAnchor _;
      try {
        vm_call_user_func(g_context->m_memThresholdCallback, empty_array());
      } catch (Object& ex) {
        raise_error("Uncaught exception escaping mem Threshold callback: %s",
                    ex.toString().data());
      }
    }
  }
  if (do_GC) {
    VMRegAnchor _;
    if (RuntimeOption::EvalEnableGC) {
      MM().collect("surprise");
    } else {
      MM().checkHeap("surprise");
    }
  }
  if (do_signaled) {
    HHVM_FN(pcntl_signal_dispatch)();
  }

  if (pendingException) {
    pendingException->throwException();
  }
  return flags;
}
Exemplo n.º 18
0
bool WallTriangle::intersects(const cuboid_t &c) const
{
/* Quick check: does at least one of the triangle corners lie in the cuboid? */
//   point_t g1 = c.corner1;
	if (__isInside(c, m_corners[0]) || __isInside(c, m_corners[1]) || __isInside(c, m_corners[2]))
	  {

// 	    if(g1.x > 16.1 && g1.x < 17.9 &&
// 	     g1.y > 1.6 && g1.y < 3.4 &&
// 	    g1.z > 0.5 && g1.z < 1.625)
// 	  MSG_DEBUG("WallTriangle::intersects(cuboid)", "INSIDE: " << g1);

		return true;
	  }


#if 0


    /* Fixme!!! Quick and dirty and not exact. */
    for (int i = 0; i < SPACE_DIMS; i++) {
        if ((m_corners[0][i] > c.corner2[i]+g_geom_eps &&
             m_corners[1][i] > c.corner2[i]+g_geom_eps &&
             m_corners[2][i] > c.corner2[i]+g_geom_eps) ||
            (m_corners[0][i] < c.corner1[i]-g_geom_eps &&
             m_corners[1][i] < c.corner1[i]-g_geom_eps &&
             m_corners[2][i] < c.corner1[i]-g_geom_eps))
            return false;
    }

// if
//   (g1.x > 16.1 && g1.x < 17.9 &&
//    g1.y > 1.6 && g1.y < 3.4 &&
// 	    g1.z > -1.4 && g1.z < 0.6)
// 	      MSG_DEBUG("WallTriangle::intersects(cuboid)", "END = true" << endl << "corner0 = " << m_corners[0] << endl << "corner1 = " << m_corners[1] << endl << "corner2 = " << m_corners[2]);

//return true;
#endif

//#if 0
    /* Check if one of the edges of the cuboid cuts through
       the triangle. */
	point_t pb, pc, pd, pe, pf, pg, dummy;

    /*   pf         c2
          ----------
         /|        /|              y
        / |       / |
       /  |      /  |              |
    pc ---------- pe|              *- x
      |   /pd    |  |             /
      |  /       |  /pg          z  
      | /        | /           
      |/         |/
       ----------
      c1        pb
     */
	
	pb = pc = pd = pe = pf = pg = c.corner1;
	
	pb.x = c.corner2.x;
	pc.y = c.corner2.y;
	pd.z = c.corner2.z;
	
	pe.x = c.corner2.x;
	pe.y = c.corner2.y;
	pf.y = c.corner2.y;
	pf.z = c.corner2.z;
	pg.x = c.corner2.x;
	pg.z = c.corner2.z;
	
	TI(c.corner1, pb);
	TI(c.corner1, pc);
	TI(c.corner1, pd);
	
	TI(c.corner2, pe);
	TI(c.corner2, pf);
	TI(c.corner2, pg);
	
	TI(pg, pd);
	TI(pg, pb);
	TI(pf, pd);
	TI(pf, pc);
	TI(pe, pb);
	TI(pe, pc);


    /* Check if one of the edges of the triangle cuts
       through the cuboid. */
    if (c.intersects(m_corners[0], m_corners[1]) ||
        c.intersects(m_corners[1], m_corners[2]) ||
        c.intersects(m_corners[2], m_corners[0]))
      {
/*if
  (g1.x > 16.1 && g1.x < 17.9 &&
   g1.y > 1.6 && g1.y < 3.4 &&
	    g1.z > 0.5 && g1.z < 1.625)
  {
	      MSG_DEBUG("WallTriangle::intersects(cuboid)", "END = true" << endl << "corner0 = " << m_corners[0] << endl << "corner1 = " << m_corners[1] << endl << "corner2 = " << m_corners[2]);
	      if(c.intersects(m_corners[0], m_corners[1])) cout << "0_1 true" << endl; 
	      if(c.intersects(m_corners[1], m_corners[2])) cout << "1_2 true" << endl; 
	      if(c.intersects(m_corners[2], m_corners[1])) cout << "2_0 true" << endl; 
}    */
	return true;
      }

	return false;
//#endif
}
Exemplo n.º 19
0
void 
GEOM_WireframeFace:: 
CreateIso_(const TopoDS_Face& theFace,
           GeomAbs_IsoType theIsoType, 
           Standard_Real Par, 
           Standard_Real T1,
           Standard_Real T2,
           const int theDiscret, 
           vtkPolyData* thePolyData,
           vtkPoints* thePts)
{
  Standard_Real U1, U2, V1, V2, stepU=0., stepV=0.;
  Standard_Integer j;
  gp_Pnt P;

  TopLoc_Location aLoc;
  const Handle(Geom_Surface)& S = BRep_Tool::Surface(theFace,aLoc);

  if(!S.IsNull()){
    BRepAdaptor_Surface S(theFace,Standard_False);
      
    GeomAbs_SurfaceType SurfType = S.GetType();

    GeomAbs_CurveType CurvType = GeomAbs_OtherCurve;

    Standard_Integer Intrv, nbIntv;
    Standard_Integer nbUIntv = S.NbUIntervals(GeomAbs_CN);
    Standard_Integer nbVIntv = S.NbVIntervals(GeomAbs_CN);
    TColStd_Array1OfReal TI(1,Max(nbUIntv, nbVIntv)+1);

    if(theIsoType == GeomAbs_IsoU){
      S.VIntervals(TI, GeomAbs_CN);
      V1 = Max(T1, TI(1));
      V2 = Min(T2, TI(2));
      U1 = Par;
      U2 = Par;
      stepU = 0;
      nbIntv = nbVIntv;
    }else{
      S.UIntervals(TI, GeomAbs_CN);
      U1 = Max(T1, TI(1));
      U2 = Min(T2, TI(2));
      V1 = Par;
      V2 = Par;
      stepV = 0;
      nbIntv = nbUIntv;
    }   
        
    S.D0(U1,V1,P);
    MoveTo(P,thePts);

    for(Intrv = 1; Intrv <= nbIntv; Intrv++){
      if(TI(Intrv) <= T1 && TI(Intrv + 1) <= T1)
        continue;
      if(TI(Intrv) >= T2 && TI(Intrv + 1) >= T2)
              continue;
      if(theIsoType == GeomAbs_IsoU){
              V1 = Max(T1, TI(Intrv));
              V2 = Min(T2, TI(Intrv + 1));
              stepV = (V2 - V1) / theDiscret;
      }else{
              U1 = Max(T1, TI(Intrv));
              U2 = Min(T2, TI(Intrv + 1));
              stepU = (U2 - U1) / theDiscret;
      }

      switch (SurfType) {
      case GeomAbs_Plane :
              break;
      case GeomAbs_Cylinder :
      case GeomAbs_Cone :
        if(theIsoType == GeomAbs_IsoV){
                for(j = 1; j < theDiscret; j++){
                  U1 += stepU;
                  V1 += stepV;
                  S.D0(U1,V1,P);
                  DrawTo(P,thePolyData,thePts);
                }
              }
              break;
      case GeomAbs_Sphere :
      case GeomAbs_Torus :
      case GeomAbs_OffsetSurface :
      case GeomAbs_OtherSurface :
        for(j = 1; j < theDiscret; j++){
                U1 += stepU;
                V1 += stepV;
                S.D0(U1,V1,P);
                DrawTo(P,thePolyData,thePts);
              }
              break;
      case GeomAbs_BezierSurface :
      case GeomAbs_BSplineSurface :
        for(j = 1; j <= theDiscret/2; j++){
          Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.;
                CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts);
                U1 += stepU*2.;
                V1 += stepV*2.;
              }
              break;
      case GeomAbs_SurfaceOfExtrusion :
      case GeomAbs_SurfaceOfRevolution :
        if((theIsoType == GeomAbs_IsoV && SurfType == GeomAbs_SurfaceOfRevolution) ||
                 (theIsoType == GeomAbs_IsoU && SurfType == GeomAbs_SurfaceOfExtrusion)) 
        {
                if(SurfType == GeomAbs_SurfaceOfExtrusion) 
            break;
                for(j = 1; j < theDiscret; j++){
                  U1 += stepU;
                  V1 += stepV;
                  S.D0(U1,V1,P);
                  DrawTo(P,thePolyData,thePts);
                }
              }else{
                CurvType = (S.BasisCurve())->GetType();
                switch(CurvType){
                case GeomAbs_Line :
                  break;
                case GeomAbs_Circle :
                case GeomAbs_Ellipse :
                  for (j = 1; j < theDiscret; j++) {
                    U1 += stepU;
                    V1 += stepV;
                    S.D0(U1,V1,P);
                    DrawTo(P,thePolyData,thePts);
                  }
                  break;
                case GeomAbs_Parabola :
                case GeomAbs_Hyperbola :
                case GeomAbs_BezierCurve :
                case GeomAbs_BSplineCurve :
                case GeomAbs_OtherCurve :
                  for(j = 1; j <= theDiscret/2; j++){
              Standard_Real aStep = (theIsoType == GeomAbs_IsoV) ? stepU*2. : stepV*2.;
                  CreateIso__(S, theIsoType, U1, V1, aStep, thePolyData, thePts);
                    U1 += stepU*2.;
                    V1 += stepV*2.;
                  }
                  break;
                }
              }
      }
    }
    S.D0(U2,V2,P);
    DrawTo(P,thePolyData,thePts);
  }  
}
Exemplo n.º 20
0
size_t handle_request_surprise(c_WaitableWaitHandle* wh, size_t mask) {
  auto& info = TI();
  auto& p = info.m_reqInjectionData;

  auto const flags = fetchAndClearSurpriseFlags() & mask;
  auto const debugging = p.getDebuggerAttached();

  // Start with any pending exception that might be on the thread.
  auto pendingException = info.m_pendingException;
  info.m_pendingException = nullptr;

  if ((flags & TimedOutFlag) && !debugging) {
    p.setCPUTimeout(0);  // Stop CPU timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(TimedOutFlag);
    } else {
      pendingException = generate_request_timeout_exception(wh);
    }
  } else if ((flags & CPUTimedOutFlag) && !debugging) {
    // Don't bother with the CPU timeout if we're already handling a wall
    // timeout.
    p.setTimeout(0);  // Stop wall timer so we won't time out twice.
    if (pendingException) {
      setSurpriseFlag(CPUTimedOutFlag);
    } else {
      pendingException = generate_request_cpu_timeout_exception(wh);
    }
  }
  if (flags & MemExceededFlag) {
    if (pendingException) {
      setSurpriseFlag(MemExceededFlag);
    } else {
      pendingException = generate_memory_exceeded_exception(wh);
    }
  }
  if (flags & PendingGCFlag) {
    if (StickyFlags & PendingGCFlag) {
      clearSurpriseFlag(PendingGCFlag);
    }
    if (RuntimeOption::EvalEnableGC) {
      MM().collect("surprise");
    } else {
      MM().checkHeap("surprise");
    }
  }
  if (flags & SignaledFlag) {
    HHVM_FN(pcntl_signal_dispatch)();
  }

  if (flags & PendingPerfEventFlag) {
    if (StickyFlags & PendingPerfEventFlag) {
      clearSurpriseFlag(PendingPerfEventFlag);
    }
    perf_event_consume(record_perf_mem_event);
  }

  if (pendingException) {
    pendingException->throwException();
  }
  return flags;
}
Exemplo n.º 21
0
void CCellView::OnDraw(CDC* pDC)
{
	CTreeCtrl &Tree=CConfigTool::GetControlView()->GetTreeCtrl();

	CConfigToolDoc* pDoc=CConfigTool::GetConfigToolDoc();
	if(pDoc->ItemCount()>0)
	{
		CRect rect;
		Tree.GetItemRect(Tree.GetRootItem(),rect,TRUE);
		m_nFirstVisibleItem=rect.top;

		CRect rcClient;
		GetClientRect(rcClient);
		CPen *pOldPen=pDC->SelectObject(&m_GrayPen);
		CFont *pOldFont=pDC->SelectObject(CConfigTool::GetControlView()->GetFont());
		pDC->SetBkMode(TRANSPARENT);

		CRect rcClip;
		pDC->GetClipBox(rcClip);
		
		CPtrArray arItems;
		int dy=CConfigTool::GetControlView()->GetItemHeight();
		int cy=0;
		for(HTREEITEM h=Tree.GetFirstVisibleItem();h;h=Tree.GetNextVisibleItem(h))
		{
			if(cy>rcClip.bottom){
				break;
			}

			CRect rcEdit(0,cy,rcClient.right,cy+dy);
			cy+=dy;

			pDC->MoveTo(rcClient.left,rcEdit.top);
			pDC->LineTo(rcClient.right,rcEdit.top);

			CConfigItem &ti=TI(h);
			if(h!=m_hInCell){
        switch(ti.Type()){
		      case CConfigItem::Enum:
						// Using combobox
						rcEdit.left+=2;
						rcEdit.top+=2;
            // fall through
          case CConfigItem::Integer:
          case CConfigItem::Double:
          case CConfigItem::String:
						// Using editbox
						rcEdit.top+=2;
						rcEdit.left+=3;
            {
				      CString str(ti.StringValue());
				      // cell contents is greyed if the option is not both active and modifiable
				      // or if a booldata item is not enabled
				      const CdlValuable valuable = ti.GetCdlValuable();
				      // check for a package explicitly because is_modifiable() returns true for a package
				      pDC->SetTextColor (GetSysColor ((! valuable) || (valuable->is_modifiable () && valuable->is_active () && ((! ti.HasBool ()) || ti.IsEnabled ()) && ! ti.IsPackage ()) ? COLOR_WINDOWTEXT : COLOR_GRAYTEXT));
				      pDC->TextOut(rcEdit.left,rcEdit.top,str);
            }
            break;
          default:
            break;
        }
			}
		}
		pDC->MoveTo(rcClient.left,cy);
		pDC->LineTo(rcClient.right,cy);
		pDC->SelectObject(pOldPen);
		pDC->SelectObject(pOldFont);
	}
}