Пример #1
0
void Cmd_NameFlag(ITEM *i)
{
	short n=(short)GetNumber();
	char *c=WordBuffer;
	if(n==-1)
	{
		SendItem(i,"Which flag number ?\n");
		return;
	}
	GetAll();
	if(!strlen(c))
	{
		SendItem(i,"You must specify a name for the flag.\n");
		return;
	}
	if(*c!='@')
	{
		SendItem(i,"Flags must start with the '@' character.\n");
		return;
	}
	if(GetFlagByName(c)!=-1)
	{
		SendItem(i,"But flag %d is already called '%s'.\n",
			GetFlagByName(c),c);
		return;
	}
	if((n<0)||(n>511))
	{
		SendItem(i,"Flag numbers are from 0-511 inclusive.\n");
		return;
	}
	SetFlagName(n,c);
	SendItem(i,"Flag %d is now called %s.\n",n,c);
}
Пример #2
0
 Block* Container::DropAfterDamage(bool* const delete_block) {
     Block* const pile = new Box(DIFFERENT);
     Inventory* const pile_inv = pile->HasInventory();
     GetAll(pile_inv);
     *delete_block = not pile_inv->Get(this);
     return pile;
 }
JXSharedPrefsManager::JXSharedPrefsManager()
{
	itsFile = NULL;

	if (JExpandHomeDirShortcut(kSignalFileName, &itsSignalFileName))
		{
		JString path, name;
		JSplitPathAndName(itsSignalFileName, &path, &name);
		if (JCreateDirectory(path, 0700) != kJNoError)
			{
			itsSignalFileName.Clear();
			}
		}
	else
		{
		itsSignalFileName.Clear();
		}

	GetAll(&itsWasNewFlag);

	itsUpdateTask = new JXTimerTask(kUpdateInterval);
	assert( itsUpdateTask != NULL );
	itsUpdateTask->Start();
	ListenTo(itsUpdateTask);
}
Пример #4
0
//
// Copies the working access spec to a spot in the application's test spec structure.
// (Saves the changes the user has made to the access spec.)
//
BOOL CAccessDialog::SaveList()
{
	int line_index;

	// Abort if we encounter an error.
	if (spec == NULL) {
		ErrorMessage("Unexpectedly found spec == NULL in CAccessDialog::SaveList()");
		CDialog::OnOK();
	}
	// Check to make sure the spec is filled in correctly.
	if (!CheckAccess())
		return FALSE;

	// Update the spec's name with the name edit box's contents.
	m_EName.GetWindowText(spec->name, MAX_WORKER_NAME);

	// Store the default assignment setting.
	spec->default_assignment = m_CDefaultAssignment.GetCurSel();

	// Fill in the access spec from the entries in the GUI list.
	for (line_index = 0; line_index < m_LAccess.GetItemCount(); line_index++) {
		item_being_changed = line_index;
		GetAll(&(spec->access[line_index]));
	}

	// If all the spec's lines have not been filled, mark
	// the last one as the end.
	if (line_index < MAX_ACCESS_SPECS)
		spec->access[line_index].of_size = IOERROR;

	// Indicate that the access was saved properly.
	return TRUE;
}
Пример #5
0
//
// Insert a new line into the access spec after or before the current one.
//
void CAccessDialog::InsertWrapper(BOOL after)
{
	int current_line;
	Access_Spec *spec = NULL;

	if (!(spec = new Access_Spec)) {
		ErrorMessage("Unable to allocate memory to insert new access " "spec line.");
		return;
	}
	// Get the first selected line.
	if (item_being_changed == -1) {
		// Nothing is selected. Create a default entry.
		item_being_changed = 0;
		spec->of_size = 100;
		spec->reads = 67;
		spec->random = 100;
		spec->delay = 0;
		spec->burst = 1;
		spec->align = 0;
		spec->reply = 0;
		spec->size = 2048;
	} else {
		// If we're inserting after the current selection, we need to find the
		// last selected line.
		current_line = m_LAccess.GetNextItem(-1, LVNI_SELECTED);
		if (after) {
			// Find the last selected line number.
			while (current_line != -1) {
				item_being_changed = current_line;
				current_line = m_LAccess.GetNextItem(current_line, LVNI_SELECTED);
			}

			// Get the last selected line's information.
			GetAll(spec);
			item_being_changed++;
		} else {
			// We're inserting before the first selected line.
			if (current_line != -1)
				item_being_changed = current_line;
			GetAll(spec);
		}
	}

	// Insert the new line.
	InsertLine(spec, item_being_changed);
}
Пример #6
0
/*--------------------------------------------------------------------------------*/
std::string AudioObjectParameters::ToString(bool pretty) const
{
  ParameterSet params;

  GetAll(params);

  return params.ToString(pretty);
}
Пример #7
0
GameObject* Collider2d::Get(vec3 pos) /// GetAll.first()
{
    vector<GameObject*> val = GetAll(pos);
    if(!val.empty())
        return val.front();
    else
        return nullptr;
}
Пример #8
0
	static std::string get(etcd::Client<etcd_reply::RapidReply>& etcd, std::string path) {

		auto reply = etcd.Get(path);

		etcd_reply::RapidReply::KvPairs pairs;
		reply.GetAll(pairs);

		return pairs[path];
	}
Пример #9
0
/**
 * Read the current value of the solenoid.
 * 
 * @return The current value of the solenoid.
 */
DoubleSolenoid::Value DoubleSolenoid::Get()
{
	if (StatusIsFatal()) return kOff;
	uint8_t value = GetAll();

	if (value & m_forwardMask) return kForward;
	if (value & m_reverseMask) return kReverse;
	return kOff;
}
Пример #10
0
 /******************Common Functions***************/
void UpdateDatabase( VECTOR n[DATABASE_SIZE],float A[3][3] )
{
	int idata i;
	for (i=0; i<DATABASE_SIZE; i++)
	{	
		GetAll(&n[i].a, &n[i].b, &n[i].c);
		SpaceTrans(n+i,A);
		delay(2);
	}
}
Пример #11
0
int main(int argc, char* argv[])
{
	GetAll();
	Game* game = Game::Instance();

	game->Init(GAME_TITLE, WIN_WIDTH, WIN_HEIGHT, argc, argv);
	game->Start();

	return 0;
}
Пример #12
0
static int navigaFromRisorsa(char *proxyIP, int proxyport, char *currentURL, int *pnumerrori, int *pnumfiles)
{
	 
	char ch; int ris;

	do {
		/* download e visualizzazione di ciascuna risorsa */
		MDV mdv;
		++*pnumfiles;

		clrscr();
		printf("%s Fetching %s%s\n", GIALLO, currentURL, WHITE ); 

		ris=GetAll(proxyIP, proxyport, currentURL, &mdv);

		if(ris!=1) { 
			++*pnumerrori; 
			VisualizzaErrore(currentURL); 
			if(accettaInputTastiera==1) { /* user input, ammesso solo q */
				/* se input non accettabile ripeto */
				ch=accettaInputDaTastiera(&mdv);
			}
			else { /* termina uso di questa risorsa */
				sleep(2); 
				ch='q';
			}
		}
		else { 
			Visualizza(currentURL,&mdv);
			sleep(2); /* in ogni caso aspetta un secondo */

			if(accettaInputTastiera==1) { /* user input */
				/* se input non accettabile ripeto */
				ch=accettaInputDaTastiera(&mdv);
			}
			else if(accettaInputTastiera==2) { /* random input */
				/* se input non accettabile esco restituendo 'q' */
				ch=accettaInputRandom(&mdv);
			}
			else { /* termina uso di questa risorsa */
				ch='q';
			}
			if(ch!='q') {
				int j;
				for(j=0;j<mdv.L.numlinks;j++) {
					if(mdv.L.idxs[j]==((int)ch)) {
						strcpy(currentURL,mdv.L.links[j]);
						break;
					}
				}
			}
		}
	} while(ch!='q');
	return(1);	
}
void EntitySystem::Reset()
{
	AUDynArray<AUEntityId> entities;
	GetAll(entities);
	for (size_t i = 0; i < entities.Size(); ++i)
	{
		Destroy(entities[i]);
	}

	assert(m_Entities.size() == 0);
}
Пример #14
0
/**
 * Read the current value of the solenoid.
 *
 * @return The current value of the solenoid.
 */
DoubleSolenoid::Value DoubleSolenoid::Get()
{
    if (StatusIsFatal()) {
	printf("DoubleSolenoid[%d][%d-%d]::Get"
		" status is FATAL, returning kOff\n",
		(int)m_moduleNumber, (int)m_forwardChannel,
		(int)m_reverseChannel);
	return kOff;
    }

    UINT8 value = GetAll();
    if (value & m_forwardMask) return kForward;
    if (value & m_reverseMask) return kReverse;
    return kOff;
}
void ribi::CanvasColorSystems::Test() noexcept
{
  {
    static bool is_tested = false;
    if (is_tested) return;
    is_tested = true;
  }
  const std::vector<CanvasColorSystem> v = GetAll();
  const std::size_t sz = v.size();
  for (std::size_t i=0; i!=sz; ++i)
  {
    assert(i < v.size());
    const CanvasColorSystem t = v[i];
    const std::string s = ToStr(t);
    assert(!s.empty());
    const CanvasColorSystem u = ToType(s);
    assert(u == t);
  }
}
Пример #16
0
	std::string etcd_get(std::string path, bool abs = false) {

		std::string abs_path;

		if (!abs)
			abs_path = boost::str(boost::format("%s/%s") % basep_ % path);
		else
			abs_path = path;

		std::cout << "GET: " << abs_path << std::endl;

		auto reply = etcd_.Get(abs_path);

		etcd_reply::RapidReply::KvPairs pairs;
		reply.GetAll(pairs);

		std::cout << "RESULT: " << pairs[abs_path] << std::endl;

		return pairs[abs_path];
	};
Пример #17
0
void  cElXMLTree::StdGenCppGlob
(
    const std::string & aNameCpp,
    const std::string & aNameH,
    const std::string & aNameSpace
)
{
    FILE * aFileCpp = ElFopen(aNameCpp.c_str(),"w");
    ELISE_ASSERT
    (
        aFileCpp!=0,
        "Cannot open .cpp file in cElXMLTree::GenCpp"
    );

    FILE * aFileH = ElFopen(aNameH.c_str(),"w");
    ELISE_ASSERT
    (
        aFileH!=0,
        "Cannot open .h file in cElXMLTree::GenCpp"
    );
    // fprintf(aFileH,"#include \"general/all.h\"\n");
    // fprintf(aFileH,"#include \"private/all.h\"\n\n\n");
    // fprintf(aFileCpp,"#include \"%s\"\n\n\n",NameWithoutDir(aNameH).c_str());



    std::list<cElXMLTree *>  aLFilsCpp = GetAll("GenCpp");

    for
    (
        std::list<cElXMLTree *>::iterator itF=aLFilsCpp.begin();
        itF != aLFilsCpp.end();
        itF++
    )
    {
        (*itF)->GenOneCppNameSpace(aFileCpp,aFileH,aNameSpace);
    }

    ElFclose(aFileH);
    ElFclose(aFileCpp);
}
JBoolean
JXSharedPrefsManager::Update()
{
	time_t t;
	if (!itsSignalFileName.IsEmpty() &&
		JGetModificationTime(itsSignalFileName, &t) == kJNoError &&
		t != itsSignalModTime)
		{
		JBoolean isNew;
		return GetAll(&isNew);
		}
	else
		{
		// This exists because JCore values cannot update themsevles,
		// and it seems easier to toss them all in here.

		if ((itsOrigFocusInDockFlag    != JXWindow::WillFocusFollowCursorInDock() ||
			 itsOrigCopyWhenSelectFlag != JTextEditor::WillCopyWhenSelect()       ||
			 itsOrigMiddleClickWillPasteFlag != JXTEBase::MiddleButtonWillPaste() ||
			 itsOrigPWMod              != JXTEBase::GetPartialWordModifier()      ||
			 itsOrigCaretScrollFlag    != JXTEBase::CaretWillFollowScroll()       ||
			 itsOrigWindowsHomeEndFlag != JXTEBase::WillUseWindowsHomeEnd()       ||
			 itsOrigAllowSpaceFlag     != JXSaveFileInput::WillAllowSpace()       ||
			 itsOrigMenuDisplayStyle   != JXMenu::GetDisplayStyle()) &&
			Open())
			{
			PrivateSetFocusFollowsCursorInDock();
			PrivateSetCopyWhenSelectFlag();
			PrivateSetMiddleClickWillPasteFlag();
			PrivateSetPartialWordModifier();
			PrivateSetCaretFollowsScroll();
			PrivateSetWindowsHomeEnd();
			PrivateSetAllowSpaceFlag();
			PrivateSetMenuDisplayStyle();
			Close(kJTrue);
			}

		return kJFalse;
		}
}
Пример #19
0
void Cmd_ListFlags(ITEM *i)
{
/*
 *	LISTFLAG lists all flags, LISTFLAG @NAME lists flag 'name'
 *	LISTFLAG n lists flag n
 */
	int v;
	GetAll();
	if(!strlen(WordBuffer))
	{
		short c=0;
		while(c<512)
		{
			if(FlagName[c])
				SendItem(i,"%-3d   %s\n",c,GetFlagName(c)+1);
			c++;
		}
		return;
	}
	if(sscanf(WordBuffer,"%d",&v)==0)
	{
		if(*WordBuffer=='@')
		{
			if(GetFlagByName(WordBuffer))
				SendItem(i,"%-3d     %s\n",
					GetFlagByName(WordBuffer),WordBuffer);
			return;
		}
		else
			SendItem(i,"Flag names always start with '@'.\n");
	}
	else
	{
		if(FlagName[v])
		{
			SendItem(i,"%-3d     %s\n",v,GetFlagName((short)v));
		}
	}
}
Пример #20
0
int  Stream::_Get16() {
	word w;
	return GetAll(&w, 2) ? w : -1;
}
Пример #21
0
 /******************坐标系***************/
void SpaceCreate(float A[3][3])
{
	int idata i,a,b,c,ap,bp,cp;
	VECTOR idata test[3];
	float idata temp;
	GetAll(&ap,&bp,&cp);
	for(i=0;i<3;i++)
	{
		GetAll(&a,&b,&c);
		delay(70);
		if( abs(ap-a)<10 && abs(bp-b)<10 && abs(cp-c)<10 )
		{
			 test[i].a=a;
			 test[i].b=b;
			 test[i].c=c;
		}
		else
			i--;
		ap=a;
		bp=b;
		cp=c;
	}
	//x暂时借作为临时变量,算标准化过的z
	A[0][0]=-(test[0].a+test[1].a+test[2].a)/3;
	A[0][1]=-(test[0].b+test[1].b+test[2].b)/3;
	A[0][2]=-(test[0].c+test[1].c+test[2].c)/3;
	temp=sqrt(A[0][0]*A[0][0]+A[0][1]*A[0][1]+A[0][2]*A[0][2]);
	A[2][0]=A[0][0]/temp;
	A[2][1]=A[0][1]/temp;
	A[2][2]=A[0][2]/temp;

	GetAll(&a,&b,&c);
	i=0;
	test[0].a=0;
	test[0].b=0;
	test[0].c=0;
	while( 1 )
	{
		if( i<10
			&& abs(a-ap)<20 && abs(b-bp)<20 && abs(c-cp)<20 
			&& (abs(a+A[0][0])>130 || abs(b+A[0][1])>130 || abs(c+A[0][2])>130)
			)
		{
			test[0].a+=a;
			test[0].b+=b;
			test[0].c+=c;
			i++;
		}
		if(i==10)
			break;	
		ap=a;	bp=b;	cp=c;
		GetAll(&a,&b,&c);
		delay(50);
	}

	//第一下变化方向
	A[1][0]=test[0].a/10+A[0][0];
	A[1][1]=test[0].b/10+A[0][1];
	A[1][2]=test[0].c/10+A[0][2];
	//X轴正向
	A[0][0]=A[1][1]*A[2][2]-A[2][1]*A[1][2];
	A[0][1]=A[1][2]*A[2][0]-A[2][2]*A[1][0];
	A[0][2]=A[1][0]*A[2][1]-A[2][0]*A[1][1];
	//X轴标准化
	temp=sqrt(A[0][0]*A[0][0]+A[0][1]*A[0][1]+A[0][2]*A[0][2]);
	A[0][0]=A[0][0]/temp;
	A[0][1]=A[0][1]/temp;
	A[0][2]=A[0][2]/temp;
	//Y轴标准化
	A[1][0]=A[2][1]*A[0][2]-A[0][1]*A[2][2];
	A[1][1]=A[0][2]*A[2][2]-A[2][0]*A[0][2];
	A[1][2]=A[2][0]*A[0][1]-A[0][0]*A[2][1];
	SendByte('K');
}
Пример #22
0
int  Stream::_Get32() {
	int l;
	return GetAll(&l, 4) ? l : -1;
}
Пример #23
0
/**
 * Read the current value of the solenoid.
 * 
 * @return The current value of the solenoid.
 */
bool Solenoid::Get()
{
	if (StatusIsFatal()) return false;
	UINT8 value = GetAll() & ( 1 << (m_channel - 1));
	return (value != 0);
}
Пример #24
0
bool QmitkNodeTableViewKeyFilter::eventFilter(QObject *obj, QEvent *event)
{
  if (m_DataStorage.IsExpired())
  {
    // standard event processing
    return QObject::eventFilter(obj, event);
  }

  auto dataStorage = m_DataStorage.Lock();

  QmitkDataManagerView *dataManagerView = qobject_cast<QmitkDataManagerView *>(this->parent());
  if (event->type() == QEvent::KeyPress && dataManagerView)
  {
    berry::IPreferences::Pointer nodeTableKeyPrefs =
      m_PreferencesService->GetSystemPreferences()->Node("/DataManager/Hotkeys");

    QKeySequence makeAllInvisible = QKeySequence(nodeTableKeyPrefs->Get("Make all nodes invisible", "Ctrl+V"));
    QKeySequence toggleVisibility = QKeySequence(nodeTableKeyPrefs->Get("Toggle visibility of selected nodes", "V"));
    QKeySequence deleteSelectedNodes = QKeySequence(nodeTableKeyPrefs->Get("Delete selected nodes", "Del"));
    QKeySequence reinit = QKeySequence(nodeTableKeyPrefs->Get("Reinit selected nodes", "R"));
    QKeySequence globalReinit = QKeySequence(nodeTableKeyPrefs->Get("Global reinit", "Ctrl+R"));
    QKeySequence showInfo = QKeySequence(nodeTableKeyPrefs->Get("Show node information", "Ctrl+I"));

    QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
    QKeySequence keySequence = QKeySequence(keyEvent->modifiers() + keyEvent->key());
    // if no modifier was pressed the sequence is now empty
    if (keySequence.isEmpty())
    {
      keySequence = QKeySequence(keyEvent->key());
    }

    auto selectedNodes = AbstractDataNodeAction::GetSelectedNodes(dataManagerView->GetSite());
    if (keySequence == makeAllInvisible)
    {
      if (selectedNodes.empty())
      {
        // if no nodes are selected, hide all nodes of the data storage
        auto nodeset = dataStorage->GetAll();
        for (auto it = nodeset->Begin(); it != nodeset->End(); ++it)
        {
          mitk::DataNode* node = it->Value();
          if (nullptr != node)
          {
            selectedNodes.push_back(node);
          }
        }
      }

      HideAllAction::Run(selectedNodes);
      return true;
    }
    if (keySequence == deleteSelectedNodes)
    {
      RemoveAction::Run(dataManagerView->GetSite(), dataStorage, selectedNodes);
      return true;
    }
    if (keySequence == toggleVisibility)
    {
      ToggleVisibilityAction::Run(dataManagerView->GetSite(), dataStorage, selectedNodes);
      return true;
    }
    if (keySequence == reinit)
    {
      ReinitAction::Run(dataManagerView->GetSite(), dataStorage, selectedNodes);
      return true;
    }
    if (keySequence == globalReinit)
    {
      GlobalReinitAction::Run(dataManagerView->GetSite(), dataStorage);
      return true;
    }
    if (keySequence == showInfo)
    {
      ShowDetailsAction::Run(selectedNodes);
      return true;
    }
  }
  // standard event processing
  return QObject::eventFilter(obj, event);
}
Пример #25
0
int64  Stream::_Get64() {
	int64 l;
	return GetAll(&l, 8) ? l : -1;
}
Пример #26
0
/**
 * Read the current value of the solenoid.
 *
 * @return The current value of the solenoid.
 */
bool Solenoid::Get() const {
  if (StatusIsFatal()) return false;
  uint8_t value = GetAll(m_moduleNumber) & (1 << m_channel);
  return (value != 0);
}