コード例 #1
0
ファイル: Source.c プロジェクト: Goryudyuma/Minesweeper
int main(){
	zyunbi();
	te();
	bomb_haiti();
	hantei();
	do{
		hyouzi();
		te();
	} while (endflag != 1);
}
コード例 #2
0
/** Wakeup all threads in list and have them wait for the barrier.
 * This method wakes up all thread without aquiring the lock first.
 * This method must only be used if the thread list is locked otherwise!
 * @param barrier Barrier to wait for after loop
 */
void
ThreadList::wakeup_unlocked(Barrier *barrier)
{
  Exception *exc = NULL;
  unsigned int count = 1;
  for (iterator i = begin(); i != end(); ++i) {
    if ( ! (*i)->flagged_bad() ) {
      try {
        (*i)->wakeup(barrier);
      } catch (Exception &e) {
        if (! exc) {
          exc = new Exception(e);
        } else {
          exc->append(e);
        }
      }
      ++count;
    }
  }
  if (exc) {
    Exception te(*exc);
    delete exc;
    throw te;
  }
  if (count != barrier->count()) {
    throw Exception("ThreadList(%s)::wakeup(): barrier has count (%u) different "
		    "from number of unflagged threads (%u)", __name, barrier->count(), count);
  }
}
コード例 #3
0
ファイル: main.cpp プロジェクト: fujiisoup/MyLibrary
int main(){
	size_t tnum = 200, nnum = 202;
	std::vector<double> te(tnum), ne(nnum);
	std::vector<std::vector<double>> rate_ii(tnum, std::vector<double>(nnum));
	std::vector<std::vector<double>> rate_ie(tnum, std::vector<double>(nnum));
	std::vector<std::vector<double>> rate_ei(tnum, std::vector<double>(nnum));
	std::vector<std::vector<double>> rate_ee(tnum, std::vector<double>(nnum));

	plasmaFormulary::IonProperty proton(myconst::pmass, 1);

	for (size_t i = 0; i < tnum; ++i){
		te[i] = 0.1 * exp(log(1.0e4 / 0.1) / (tnum - 1) * i);
		for (size_t j = 0; j < nnum; ++j){
			ne[j] = 1.0e17 * exp(log(1.0e22 / 1.0e17) / (nnum - 1) * j);
			rate_ii[i][j] = plasmaFormulary::nu_ii_slow(ne[j], te[i], ne[j], te[i], proton, ne[j], te[i], proton)/ne[j];
			rate_ie[i][j] = plasmaFormulary::nu_ie_slow(ne[j], te[i], ne[j], te[i], proton) / ne[j];
			rate_ei[i][j] = plasmaFormulary::nu_ei_slow(ne[j], te[i], ne[j], te[i], proton) / ne[j];
			rate_ee[i][j] = plasmaFormulary::nu_ee_slow(ne[j], te[i]) / ne[j];
		}
	}
	IGORdata::write_itx(rate_ii, "rate_coef_ii.itx", "rate_coef_ii");
	IGORdata::write_itx(rate_ie, "rate_coef_ie.itx", "rate_coef_ie");
	IGORdata::write_itx(rate_ei, "rate_coef_ei.itx", "rate_coef_ei");
	IGORdata::write_itx(rate_ee, "rate_coef_ee.itx", "rate_coef_ee");
	IGORdata::write_edgeVector(te, "te.itx", "te");
	IGORdata::write_edgeVector(ne, "ne.itx", "ne");
}
コード例 #4
0
ファイル: typecheck.c プロジェクト: KimRuneSolstad/TDT4205
data_type_t typecheck_expression(node_t* root)
{
	data_type_t toReturn;

	if(outputStage == 10)
		fprintf( stderr, "Type checking expression %s\n", root->expression_type.text);

	toReturn = te(root);
		
	//Insert additional checking here
	switch(root->expression_type.index)
	{
		case FUNC_CALL_E:
			/* check number of arguments */
			fprintf(stderr, "");	/*hack to avoid some wierd error */
			function_symbol_t *func = malloc(sizeof(function_symbol_t));
			func = function_get(root->children[0]->label);
			if(root->children[1] != NULL && func->nArguments != root->children[1]->n_children)
				type_error(root);
			else
				for(int i = 0; i < func->nArguments; i++)
					if(root->children[1] != NULL && !equal_types(func->argument_types[i], root->children[1]->children[i]->data_type))
						type_error(root);
			return func->return_type;
		break;
		
		case CLASS_FIELD_E: 	/* add code to compute the 
					 * type of class_field_access
					 * expressions
					 */
			return root->children[1]->data_type;
		break;
	}
}
コード例 #5
0
ファイル: Camera.cpp プロジェクト: patrickhartling/vrkit
void Camera::setPosition(const OSG::Matrix& camPos)
{
#if OSG_MAJOR_VERSION < 2
   OSG::CPEditor te(mTransform, OSG::Transform::MatrixFieldMask);
#endif
   mTransform->setMatrix(camPos);
}
コード例 #6
0
void UILineTextEdit::edit()
{
    UITextEditor te(this);
    te.setText(m_strText);
    if (te.exec() == QDialog::Accepted)
        m_strText = te.text();
}
コード例 #7
0
ファイル: EdgeTest.cpp プロジェクト: BrandonLi622/Dissent
  TEST(EdgeTest, TcpFail)
  {
    Timer::GetInstance().UseRealTime();

    const TcpAddress addr("127.0.0.1", 33347);
    TcpEdgeListener te(addr);
    te.Start();
    MockEdgeHandler meh(&te);
    SignalCounter sc(1);
    QObject::connect(&te, SIGNAL(EdgeCreationFailure(const Address &, const QString &)),
        &sc, SLOT(Counter()));

    TcpAddress any;
    te.CreateEdgeTo(any);
    MockExecLoop(sc);
    EXPECT_EQ(sc.GetCount(), 1);
    sc.Reset();

    TcpAddress other_addr("255.255.255.255.", 1111);
    te.CreateEdgeTo(other_addr);
    MockExecLoop(sc);
    EXPECT_EQ(sc.GetCount(), 1);
    sc.Reset();

    TcpAddress bad_addr(QUrl("tcp://ha!"));
    te.CreateEdgeTo(bad_addr);
    MockExecLoop(sc);
    EXPECT_EQ(sc.GetCount(), 1);
    sc.Reset();

    TcpAddress another_addr("5.5.5.5", 12345);
    te.CreateEdgeTo(another_addr);
    MockExecLoop(sc);
    EXPECT_EQ(sc.GetCount(), 1);
  }
コード例 #8
0
bool QEventDispatcherWin32::event(QEvent *e)
{
    Q_D(QEventDispatcherWin32);
    if (e->type() == QEvent::ZeroTimerEvent) {
        QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e);
        WinTimerInfo *t = d->timerDict.value(zte->timerId());
        if (t) {
            t->inTimerEvent = true;

            QTimerEvent te(zte->timerId());
            QCoreApplication::sendEvent(t->obj, &te);

            t = d->timerDict.value(zte->timerId());
            if (t) {
                if (t->interval == 0 && t->inTimerEvent) {
                    // post the next zero timer event as long as the timer was not restarted
                    QCoreApplication::postEvent(this, new QZeroTimerEvent(zte->timerId()));
                }

                t->inTimerEvent = false;
            }
        }
        return true;
    } else if (e->type() == QEvent::Timer) {
        QTimerEvent *te = static_cast<QTimerEvent*>(e);
        d->sendTimerEvent(te->timerId());
    }
    return QAbstractEventDispatcher::event(e);
}
コード例 #9
0
ファイル: Timer.cpp プロジェクト: ASchurman/Dissent
 TimerEvent Timer::QueueCallback(const QSharedPointer<TimerCallback> &callback,
     int due_time, int period)
 {
   TimerEvent te(callback, due_time, period);
   QueueEvent(te);
   return te;
 }
コード例 #10
0
ファイル: rep_set.cpp プロジェクト: 4tXJ7f/CVC4
bool RepSet::complete( TypeNode t ){
  std::map< TypeNode, bool >::iterator it = d_type_complete.find( t );
  if( it==d_type_complete.end() ){
    //remove all previous
    for( unsigned i=0; i<d_type_reps[t].size(); i++ ){
      d_tmap.erase( d_type_reps[t][i] );
    }
    d_type_reps[t].clear();
    //now complete the type
    d_type_complete[t] = true;
    TypeEnumerator te(t);
    while( !te.isFinished() ){
      Node n = *te;
      if( std::find( d_type_reps[t].begin(), d_type_reps[t].end(), n )==d_type_reps[t].end() ){
        add( t, n );
      }
      ++te;
    }
    for( size_t i=0; i<d_type_reps[t].size(); i++ ){
      Trace("reps-complete") << d_type_reps[t][i] << " ";
    }
    Trace("reps-complete") << std::endl;
    return true;
  }else{
    return it->second;
  }
}
コード例 #11
0
int ControlPacket::makePacket(char *final_packet)
{
  if (!m_type || !m_extendedtype || !m_timestamp || !m_subsequence || !m_controlInfo)
    return -1;

  // set the type as data; make the first bit of the packet 1
  // make the next 15 bits the type
  // set the next 16 bits as the extended user defined extended type
  // set the next bit as don't care; the next 31 bits as ACK sub-sequence number
  // set the next 32 bits as timestamp
  // issue the next 32 bits as control information

  // make a temporary string for the first row of the control packet
  uint32_t *temp_1 = (uint32_t *)malloc(sizeof(uint32_t));
  uint32_t *temp_2 = (uint32_t *)malloc(sizeof(uint32_t));
  *temp_1 = (*m_type << 16) | 0x80000000;

  *temp_2 = *m_extendedtype & 0x0000FFFF;
  *temp_1 = *temp_1 | *temp_2;
  layers[0] = *temp_1;
  layers[1] = *m_subsequence;
  layers[2] = *m_timestamp;
  layers[3] = *m_controlInfo;
  std::bitset <32> te (layers[0]);
  std::cout << te << std::endl;
  free(temp_1);
  free(temp_2);

  std::bitset <128> tempo_1 (layers[0]);
  std::bitset <128> tempo_2 (layers[1]);
  std::bitset <128> tempo_3 (layers[2]);
  std::bitset <128> tempo_4 (layers[3]);
  std::cout << *m_type << std::endl;
  std::cout << *m_extendedtype << std::endl;
  std::cout << tempo_1 << std::endl;
  tempo_1 <<= 96;
  tempo_2 <<= 64;
  tempo_3 <<= 32;
  packet = tempo_1 | tempo_2 | tempo_3 | tempo_4;
  int length = 0;
  std::cout << tempo_1 << std::endl;
  std::cout << tempo_2 << std::endl;
  std::cout << tempo_3 << std::endl;
  std::cout << tempo_4 << std::endl;

  std::cout << packet << std::endl;
  for (int i = 0; i < 16; i++)
  {
    std::bitset<8> c;
    int q = i*8;
    for (int j = 0; j < 8; j++)
      c[j] = packet[q++];
    m_packet[length] = char(c.to_ulong());
    length++;
  }
  for (int i = 0; i < length; i++)
    *(final_packet + i) = *(m_packet + i);
  return 1;
}
コード例 #12
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
///Time for a task
///An estimated duration for the task, set by users.
void CTaskModel::SetEstimatedDuration(unsigned __int64 duration) 
{
	StringBuffer buf(32);
	SetAttribute(ESTIMATE, ModelUtils::toHexString(duration, buf));
	SetModifiedDate(ModelUtils::CurrentUTC());
	TaskEvent te(TaskEvent::EstimatedDuration, m_id);
	notifyTaskListeners(&te);
}
コード例 #13
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
//limited security model
//group and password
void CTaskModel::SetGroup(const TCHAR *pGroup) 
{
	SetAttribute(GROUP, pGroup? pGroup: XMLHelper::EMPTY_STR);
	if(m_bstrs[BSTRGroup])SysFreeString(m_bstrs[BSTRGroup]);
	m_bstrs[BSTRGroup] = 0;
	TaskEvent te(TaskEvent::Group, m_id);
	notifyTaskListeners(&te);
}
コード例 #14
0
ファイル: main.cpp プロジェクト: CCJY/coliru
int main(void)
{
    TestCondition te(NOERROR, TestCategory());
    std::cout << te << std::endl;

    // segfault
    std::cout << returnTest(1) << std::endl;
}
コード例 #15
0
ファイル: Enum_GTest.cpp プロジェクト: airguider/OpenStudio
TEST(Enum, Enum7Test)
{
  // Test OPENSTUDIO_ENUM7 which is used for the very large enumerations
  {
    openstudio::enums::Test7Enum te("one");
    EXPECT_EQ("first", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(1), te.value());
    EXPECT_EQ("one", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te(2);
    EXPECT_EQ("second", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(2), te.value());
    EXPECT_EQ("second", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te("third");
    EXPECT_EQ("third", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(3), te.value());
    EXPECT_EQ("third", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te("FouRtH");
    EXPECT_EQ("fourth", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(4), te.value());
    EXPECT_EQ("fourth", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te("fifth");
    EXPECT_EQ("fifth", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(5), te.value());
    EXPECT_EQ("fifth", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te(6);
    EXPECT_EQ("sixth", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(6), te.value());
    EXPECT_EQ("sixth", te.valueDescription());
  }

  {
    openstudio::enums::Test7Enum te("bob");
    EXPECT_EQ("seventh", te.valueName());
    EXPECT_EQ("Test7Enum", te.enumName());
    EXPECT_EQ(static_cast<openstudio::enums::Test7Enum::domain>(7), te.value());
    EXPECT_EQ("bob", te.valueDescription());
  }

}
コード例 #16
0
void Tracer::trace(int event, int name, int value, int id)
{
    QMutexLocker locker(&mMutex);
    if(!mEnabled)
        return;
    TraceElement te(timestamp(), event, name, value, id);
    void* data = &te;
    mCurrentTrace->append((char*)data, sizeof(TraceElement));
}
コード例 #17
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
void CTaskModel::SetAttributes(unsigned __int64 parentID, const TCHAR *pTitle, const TCHAR *pDesc, int priority, 
		unsigned __int64 start, unsigned __int64 due, const TCHAR *pOwner, TASK_STATE state, 
		unsigned __int64 estimate, const TCHAR *pAssignee, unsigned __int64 assigned, unsigned __int64 modified, 
		const TCHAR *pGroup)
{
	if(!m_pNode)DebugBreak();
	StringBuffer temp(32);
	SetAttribute(PARENTID, ModelUtils::toHexString(parentID, temp));
	temp.flush();
	if(pTitle)
	{
		SetTitle(pTitle);
	}
	if(pDesc)
	{
		SetDescription(pDesc, false);
	}
	if(pOwner)
	{
		//TODO: review setting of pOwner, is there a reason not to set this value?
		SetOwner(pOwner);
	}
	temp.appendInt(priority);
	SetAttribute(PRIORITY, temp);
	temp.flush();
	temp.appendInt(static_cast<int>(state));
	SetAttribute(STATE, temp);
	temp.flush();
	SetAttribute(ESTIMATE, ModelUtils::toHexString(estimate, temp));
	temp.flush();
	SetAttribute(DUE, ModelUtils::toHexString(due, temp));
	temp.flush();
	SetAttribute(START, ModelUtils::toHexString(start, temp));
	temp.flush();
	SetAttribute(ASSIGNED, ModelUtils::toHexString(assigned, temp));
	temp.flush();
	//TODO: figure out what this is doing...
	TaskEvent::ChangeType ct = TaskEvent::AllAttributesNoNetwork;
	if(modified)
	{
		SetAttribute(MODIFIED, modified);
	}
	else
	{
		ct = TaskEvent::AllAttributes;
		SetAttribute(MODIFIED, ModelUtils::CurrentUTC());
	}
	SetAttribute(GROUP, pGroup? pGroup: XMLHelper::EMPTY_STR);
	if(pAssignee)
	{
		SetAttribute(ASSIGNEE, pAssignee);
	}

//TODO: what is the no network value for??
	TaskEvent te(TaskEvent::AllAttributes, m_id);
	notifyTaskListeners(&te);
}
コード例 #18
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
/// State is internal maintenance flag.
void CTaskModel::SetState(TASK_STATE state)
{
	StringBuffer sb;
	sb.appendInt(static_cast<int>(state));
	SetAttribute(STATE, sb);
	SetModifiedDate(ModelUtils::CurrentUTC());
	TaskEvent te(TaskEvent::PercentComplete, m_id);
	notifyTaskListeners(&te);
}
コード例 #19
0
ファイル: UILineTextEdit.cpp プロジェクト: jeppeter/vbox
void UILineTextEdit::edit()
{
    UITextEditor te(this);
    te.setText(m_strText);
    if (te.exec() == QDialog::Accepted)
    {
        m_strText = te.text();
        /* Notify listener(s) about we finished: */
        emit sigFinished(this);
    }
}
コード例 #20
0
void HalfEdgeSelector_Radiance<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
{
	MAP& m = this->m_map ;

	Dart stop = m.phi2(m.phi_1(d2));

	recomputeQuadric(d2);
	Dart it = dd2;
	do
	{
		recomputeQuadric(m.phi1(it));
		it = m.phi2(m.phi_1(it));
	} while (it != stop);

	DartMarkerStore<MAP> dm(m);

	Traversor2VVaE<MAP> tv(m, d2);
	for (Dart v = tv.begin() ; v != tv.end() ; v = tv.next())
	{
		dm.mark(v);
		updateHalfEdgeInfo(v, true);
	}
	it = dd2;
	do
	{
		Traversor2VVaE<MAP> tv2(m, m.phi1(it));
		for (Dart v = tv2.begin() ; v != tv2.end() ; v = tv2.next())
		{
			dm.mark(v);
			updateHalfEdgeInfo(v, true);
		}
		it = m.phi2(m.phi_1(it));
	} while (it != stop);

	Traversor2VE<MAP> te(m, d2);
	for (Dart v = te.begin() ; v != te.end() ; v = te.next())
	{
		if (!dm.isMarked(v))
			updateHalfEdgeInfo(v, false);
	}
	it = dd2;
	do
	{
		Traversor2VE<MAP> te2(m, m.phi1(it));
		for (Dart v = te2.begin() ; v != te2.end() ; v = te2.next())
		{
			if (!dm.isMarked(v))
				updateHalfEdgeInfo(v, false);
		}
		it = m.phi2(m.phi_1(it));
	} while (it != stop);

	cur = halfEdges.begin() ; // set the current edge to the first one
}
コード例 #21
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
void CTaskModel::SetDescription(const TCHAR *pDescription, bool notify)
{
	SetChildText(DESCRIPTION, pDescription);
	if(m_bstrs[BSTRDesc])SysFreeString(m_bstrs[BSTRDesc]);
	m_bstrs[BSTRDesc] = 0;
	SetModifiedDate(ModelUtils::CurrentUTC());
	if(notify)
	{
		TaskEvent te(TaskEvent::Description, m_id);
		notifyTaskListeners(&te);
	}
}
コード例 #22
0
ファイル: Input.cpp プロジェクト: oxygine/oxygine-framework
    void Input::sendPointerWheelEvent(spStage stage, const Vector2& dir, PointerState* ps)
    {
        TouchEvent me(dir.y > 0 ? TouchEvent::WHEEL_UP : TouchEvent::WHEEL_DOWN, true, ps->getPosition());
        me.index = ps->getIndex();
        stage->handleEvent(&me);


        TouchEvent te(TouchEvent::WHEEL_DIR, true, ps->getPosition());
        te.index = ps->getIndex();
        te.wheelDirection = dir;
        stage->handleEvent(&te);
    }
コード例 #23
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
///
/// Ability to establish cahin of events
///
/// Use parent-child relationship for chain of event, or workflow activities.
///
///
void CTaskModel::SetParentID(unsigned __int64 pid)
{
	StringBuffer buf(32);
	SetAttribute(PARENTID, ModelUtils::toHexString(pid, buf));
	SetModifiedDate(ModelUtils::CurrentUTC());

#ifdef _DEBUG
	TCHAR out[1024];
	_stprintf_s(out, _T("Set Task: %0.16I64x -Parent: %0.16x \r\n"), m_id, pid);
	OutputDebugString(out);
#endif

	TaskEvent te(TaskEvent::Parent, m_id);
	notifyTaskListeners(&te);
}
コード例 #24
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
/// Conceptual start, set by users.
void CTaskModel::SetScheduledStart(unsigned __int64 start) 
{
	StringBuffer buf(32);
	SetAttribute(START, ModelUtils::toHexString(start, buf));
	SetModifiedDate(ModelUtils::CurrentUTC());
	#ifdef _DEBUG
	
	TCHAR out[1024];
	_stprintf_s(out, _T("Set Task: %0.16x -Start: %0.16x\r\n"), m_id, start);
	OutputDebugString(out);

#endif

	TaskEvent te(TaskEvent::StartDate, m_id);
	notifyTaskListeners(&te);
}
コード例 #25
0
ファイル: typecheck.c プロジェクト: stianjensen/tdt4205
data_type_t typecheck_expression(node_t* root)
{
    data_type_t toReturn;

    if(outputStage == 10)
        fprintf( stderr, "Type checking expression %s\n", root->expression_type.text);

    toReturn = te(root);

    //Insert additional checking here

    if (root->expression_type.index == FUNC_CALL_E || root->expression_type.index == METH_CALL_E) {
        function_symbol_t *function_symbol = root->function_entry;
        node_t *argument_list = root->children[root->n_children-1];
        if (argument_list != NULL) {
            if (function_symbol->nArguments != argument_list->n_children) {
                type_error(root);
            }
            for (int i=0; i < argument_list->n_children; i++) {
                data_type_t param_type = argument_list->children[i]->data_type;
                if (param_type.base_type == NO_TYPE) {
                    param_type = argument_list->children[i]->typecheck(argument_list->children[i]);
                }
                if (!equal_types(
                            function_symbol->argument_types[i],
                            param_type
                        )) {
                    type_error(root);
                }
            }
        } else if (function_symbol->nArguments != 0) {
            type_error(root);
        }

        // Set return type on root node
        // so it can be checked easily from print statements
        root->data_type = root->function_entry->return_type;

        toReturn = function_symbol->return_type;
    } else if (root->expression_type.index == CLASS_FIELD_E) {
        data_type_t right = root->children[1]->typecheck(root->children[1]);
        root->children[1]->data_type = right;
        toReturn = right;
    }
    return toReturn;
}
コード例 #26
0
ファイル: ScorebotInput.cpp プロジェクト: cdrttn/fragmon
void ScorebotInput::OnOptClick( wxCommandEvent &event )
{
    GameRule *gr = (GameRule *) event.GetClientData();
    if (gr)
    {
        wxTextEntryDialog te(this, "Change value for " + gr->key);
        te.SetValue(gr->value);

        if (te.ShowModal() != wxID_OK)
            return;

        gr->value = te.GetValue();

        int sel = event.GetSelection();
        GetSbsOptsLst()->SetString(sel, gr->key + " = " + gr->value);
    }
}
コード例 #27
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
/// Completion date of the task.
void CTaskModel::SetDueDate(unsigned __int64 due) 
{
	StringBuffer buf(32);
	SetAttribute(DUE, ModelUtils::toHexString(due, buf));
	SetModifiedDate(ModelUtils::CurrentUTC());

#ifdef _DEBUG
	
	TCHAR out[1024];
	_stprintf_s(out, _T("Set Task: %0.16x -Due: %0.16x\r\n"), m_id, due);
	OutputDebugString(out);

#endif

	TaskEvent te(TaskEvent::DueDate, m_id);
	notifyTaskListeners(&te);
}
コード例 #28
0
ファイル: TaskModel.cpp プロジェクト: jaylauffer/loadngo
///
/// Arbitrary integer set by user.
///
void CTaskModel::SetPriority(int pri)
{
	StringBuffer sb;
	sb.appendInt(pri);
	SetAttribute(PRIORITY, sb);
	SetModifiedDate(ModelUtils::CurrentUTC());
	
	#ifdef _DEBUG
	
	TCHAR out[1024];
	_stprintf_s(out, _T("Set Task: %0.16I64x -Priority: %d\r\n"), m_id, pri);
	OutputDebugString(out);

	#endif
	
	TaskEvent te(TaskEvent::Priority, m_id);
	notifyTaskListeners(&te);
}
コード例 #29
0
int64_t AddHilbertReviewSortOrderOp::_calculateHilbertValue(const ConstOsmMapPtr &map,
  const set<ElementId> eids)
{
  auto_ptr<Envelope> env;
  for (set<ElementId>::const_iterator it = eids.begin(); it != eids.end(); ++it)
  {
    Envelope::AutoPtr te(map->getElement(*it)->getEnvelope(map));
    if (env.get() == 0)
    {
      env.reset(new Envelope(*te));
    }
    else
    {
      env->expandToInclude(te.get());
    }
  }

  if (_mapEnvelope.get() == 0)
  {
    _mapEnvelope.reset(new Envelope(map->calculateEnvelope()));
  }

  Coordinate center;
  env->centre(center);

  Meters cellSize = 10.0;
  int xorder = max(1.0, ceil(log(_mapEnvelope->getWidth() / cellSize) / log(2.0)));
  int yorder = max(1.0, ceil(log(_mapEnvelope->getHeight() / cellSize) / log(2.0)));

  // 31 bits is the most supported for 2 dimensions.
  int order = min(31, max(xorder, yorder));
  // always 2 dimensions.
  Tgs::HilbertCurve c(2, order);
  int64_t maxRange = 1 << order;
  int point[2];

  point[0] = max<int64_t>(0, min<int64_t>(maxRange - 1,
    round((center.x - _mapEnvelope->getMinX()) / cellSize)));
  point[1] = max<int64_t>(0, min<int64_t>(maxRange - 1,
    round((center.y - _mapEnvelope->getMinY()) / cellSize)));

  // pad with zeros to make sorting a little easier.
  return c.encode(point);
}
コード例 #30
0
ファイル: terminal.c プロジェクト: thigley/THOS
int runCommand(){
	int i = 0;
	int argc = splitString(textBuffer, ' ');
	for(i =0;i<argc;i++){argv[i]=stringArray[i];}
	
	if(k_strcmp(argv[0], "")==0){}
	else if(k_strcmp(argv[0], "clear")==0){ clearScreen(); typeOffset = 0;}
	else if(k_strcmp(argv[0], "history")==0){ printHistory();}
	else if(k_strcmp(argv[0], "pong")==0){ pong();}
	else if(k_strcmp(argv[0], "help")==0){ listCommands();}
	else if(k_strcmp(argv[0], "welcome")==0){ welcome();}
	else if(k_strcmp(argv[0], "splash")==0){ splash();}
	else if(k_strcmp(argv[0], "ls")==0){ ls(argc, argv); }
	else if(k_strcmp(argv[0], "cat")==0){ cat(argc, argv); }
	else if(k_strcmp(argv[0], "rm")==0){ rm(argc, argv); }
	else if(k_strcmp(argv[0], "chmod")==0){ chmod(argc, argv); }
	else if(k_strcmp(argv[0], "te")==0){ te(argc, argv); }
	else if(k_strcmp(argv[0], "cp")==0){ cp(argc, argv); }
	else if(k_strcmp(argv[0], "diff")==0){ diff(argc, argv); }
	else if(k_strcmp(argv[0], "wc")==0){ wc(argc, argv); }
	else if(k_strcmp(argv[0], "su")==0){ su(argc, argv); }
	else if(k_strcmp(argv[0], "chown")==0){ chown(argc, argv); }
	else if(k_strcmp(argv[0], "echo")==0){ echo(argc, argv); }
	else if(k_strcmp(argv[0], "adduser")==0){ adduser(argc, argv); }
	else if(k_strcmp(argv[0], "deluser")==0){ deluser(argc, argv); }
	else if(k_strcmp(argv[0], "listus")==0){ listus(); }
	else if(k_strcmp(argv[0], "passwd")==0){ passwd(argc, argv); }

	else if(k_strcmp(argv[0], "mkdir")==0){ mkdir(argc, argv); }
	else if(k_strcmp(argv[0], "rmdir")==0){ rmdir(argc, argv); }
	else if(k_strcmp(argv[0], "cd")==0){ cd(argc, argv); }
	else if(k_strcmp(argv[0], "pwd")==0){ pwd(argc, argv); }
	else if(k_strcmp(argv[0], "mv")==0){ mv(argc, argv); }

	// else check files
	else {
		printToConsole("Error: Unknown command '");
		printToConsole(argv[0]);
		printToConsole("'\n");
	}

	return 0;
}