void MarkingDataSetupWidget::setupTree()
{
    ui->treeWidget->clear();
    for (int i=0; i<markingItemDefinitions->count(); i++)
    {
        QTreeWidgetItem *twi = new QTreeWidgetItem;
        twi->setData(0,Qt::UserRole,i);
        twi->setText(0,markingItemDefinitions->at(i)->title);
        twi->setText(1,YesNo(markingItemDefinitions->at(i)->text));
        twi->setText(2,YesNo(markingItemDefinitions->at(i)->bullets));
        twi->setText(3,YesNo(markingItemDefinitions->at(i)->mark));
        if (markingItemDefinitions->at(i)->mark)
        {
            twi->setText(4,QString(tr("%1").arg(markingItemDefinitions->at(i)->markMax)));
            twi->setText(5,QString(tr("%1").arg(markingItemDefinitions->at(i)->weight)));
        }
        else
        {
            twi->setText(4,"");
            twi->setText(5,"");
        }

        ui->treeWidget->addTopLevelItem(twi);
    }

}
NATraceList
ElemDDLConstraint::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailTextList.append(displayLabel1());   // constraint name
  detailTextList.append(displayLabel2());   // constraint type (e.g., Not Null)

  detailText = "Constraint kind: ";
  if (getConstraintKind() EQU ElemDDLConstraint::COLUMN_CONSTRAINT_DEF)
  {
    detailText += "Column";
  }
  else
  {
    detailText += "Table";
  }
  detailTextList.append(detailText);

  detailText = "is deferrable? ";
  detailText += YesNo(isDeferrable());
  detailTextList.append(detailText);

  detailText = "is droppable?  ";
  detailText += YesNo(isDroppable());
  detailTextList.append(detailText);

  detailText = "is enforced?  ";
  detailText += YesNo(isEnforced());
  detailTextList.append(detailText);

  return detailTextList;

} // ElemDDLConstraint::getDetailInfo()
Exemplo n.º 3
0
void Placebo()
{
	int i;
	
  ir_transmit_off();
  fAssertEnable = YesNo("Debug");
  kill_process(ipMotor);
  if (YesNo("Start Light"))
    start_machine(START_LIGHT_PORT);
  ipMotor = start_process(MotorDriver());
  CompeteInit(0);
  Orient();

	FindLine();

  while (1)
  	{
  	Hard(90);
  	Move(-100, -100);
  	Move(80, 80);
  	Hard(90);
  	Move(-200, -200);
  	msleep(1000L);
  	Chop(3);
  	Move(50, 50);
  	Wheelie();
  	}
}
NATraceList
StmtDDLSchGrant::getDetailInfo() const
{
    NAString        detailText;
    NATraceList detailTextList;

    //
    // object name
    //

    detailTextList.append(displayLabel1());   // object name

    //
    // privileges
    //

    StmtDDLSchGrant * localThis = (StmtDDLSchGrant *)this;

    detailTextList.append(localThis->getChild(INDEX_PRIVILEGES)
                          ->castToElemDDLNode()
                          ->castToElemDDLPrivileges()
                          ->getDetailInfo());

    //
    // grantee list
    //

    const ElemDDLGranteeArray & granteeArray = getGranteeArray();

    detailText = "Grantee list [";
    detailText += LongToNAString((Lng32)granteeArray.entries());
    detailText += " element(s)]";
    detailTextList.append(detailText);

    for (CollIndex i = 0; i < granteeArray.entries(); i++)
    {
        detailText = "[grantee ";
        detailText += LongToNAString((Lng32)i);
        detailText += "]";
        detailTextList.append(detailText);

        ComASSERT(granteeArray[i] NEQ NULL AND
                  granteeArray[i]->castToElemDDLGrantee() NEQ NULL);
        detailTextList.append("    ", granteeArray[i]->castToElemDDLGrantee()
                              ->getDetailInfo());
    }

    //
    // with grant option
    //

    detailText = "is with grant option? ";
    detailText += YesNo(localThis->getChild(INDEX_WITH_GRANT_OPTION) NEQ NULL);
    detailTextList.append(detailText);

    return detailTextList;

} // StmtDDLGrant::getDetailInfo
Exemplo n.º 5
0
void Recorder()
{
  while (YesNo("Record next"))
    {
    if (iRecNext >= 100) { printf("Buffer Full\n"); return;}
    xRec[iRecNext] = read_encoder(0);
    yRec[iRecNext] = read_encoder(1);
    iRecNext++;
    }
}
Exemplo n.º 6
0
int UpdateNPCQuestWindow(HUDInfo *self,int pressID)
{
  int c;
  char text[80];
  int i;
  int fail;
  Progress *p;
  NPC *npc;
  npc = (NPC *)self->ib;
  c = GetQuestCount(npc);
  switch(pressID)
  {
    case 0:
      PopWindow(self->Handle);
      return 1;
      break;
  }
  if((pressID >= 1)&&(pressID <= c))
  {
    /*if already complete, thank the player for it again*/
    p = GetProgressByNameIndexMap(level.name,npc->quests[pressID - 1].name,self->state);
    if((p != NULL)&&(strcmp(p->value,"complete") == 0))
    {
      NewMsg("Yes, you were very helpful with that one, thank you.");
      return 1;
    }
    /*check for fail condiitions*/
    /*if player has met the win conditions, give player reward and mark complete*/
    if(p != NULL)
    {
      fail = 0;
      for(i = 0; i < 4;i++)
      {
        if(!IsConditionMet(npc->quests[pressID - 1].wincond[i]))fail =1;
      }
      if(!fail)
      {
        sprintf(text,"Complete Quest %s?",npc->quests[pressID - 1].name);
        QuestID = pressID - 1;
        NPCID = self->state;
        QuestNPC = npc;
        YesNo(text,CompleteQuest,NULL);
        return 1;
      }
    }
    /*otherwise the the player about it*/
    TextBlockWindow(npc->quests[pressID - 1].desc);
    SetPlayerProgress(level.name,npc->quests[pressID - 1].name, self->state,"offered");
    return 1;
  }
  return 0;
}
Exemplo n.º 7
0
NATraceList
ElemDDLUdfFinalCall::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailText = "finalCall? ";
  detailText += YesNo(getFinalCall());
  detailTextList.append(detailText);

  return detailTextList;

}
Exemplo n.º 8
0
void Compete()
{
  int i;

  ir_transmit_off();
  fAssertEnable = YesNo("Debug");
  kill_process(ipMotor);
  if (YesNo("Start Light"))
    start_machine(START_LIGHT_PORT);
  ipMotor = start_process(MotorDriver());
  CompeteInit(0);
  Orient();
  while (1)
    {
    FindLine();
    CollectBalls();
    /* BUG: We don't really know if we have a ball here */
    DumpBall();
    ReturnForMore();
    }
  printf("C1");
}
NATraceList
ElemDDLPartitionSystem::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailTextList.append(displayLabel1());  // add or drop
  detailTextList.append(displayLabel2());  // location name
  detailTextList.append(displayLabel3());  // location name type

  //
  // file attributes for this partition
  //

  detailTextList.append("File attributes:");

  detailText = "    max size spec? ";
  detailText += YesNo(isMaxSizeSpecified());
  detailTextList.append(detailText);

  detailText = "    maxsizunbound? ";
  detailText += YesNo(isMaxSizeUnbounded());
  detailTextList.append(detailText);

  detailText = "    max size:      ";
  detailText += LongToNAString((Lng32)getMaxSize());
  detailTextList.append(detailText);

#pragma nowarn(1506)   // warning elimination 
  ElemDDLFileAttrMaxSize maxSizeFileAttr(getMaxSize(), 
                                         getMaxSizeUnit());
#pragma warn(1506)  // warning elimination

  detailText = "    max size unit: ";
  detailText += maxSizeFileAttr.getMaxSizeUnitAsNAString();;
  detailTextList.append(detailText);

  return detailTextList;
}
Exemplo n.º 10
0
NATraceList
ElemDDLUdfParallelism::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailText = "canBeParallel? ";
  detailText += YesNo(getCanBeParallel());
  detailTextList.append(detailText);

  return detailTextList;

}
Exemplo n.º 11
0
NATraceList
ElemDDLUdrDeterministic::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailText = "deterministic? ";
  detailText += YesNo(getDeterministic());
  detailTextList.append(detailText);

  return detailTextList;

}
Exemplo n.º 12
0
NATraceList
ElemDDLUdrIsolate::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailText = "isolate? ";
  detailText += YesNo(getIsolate());
  detailTextList.append(detailText);

  return detailTextList;

}
Exemplo n.º 13
0
NATraceList StmtDDLRevokeComponentPrivilege::getDetailInfo() const
{
    NAString        detailText;
    NATraceList detailTextList;

    //
    // component name
    //

    detailTextList.append(displayLabel1());   // component name

    //
    // user role name
    //

    detailTextList.append(displayLabel2());   // user role name

    //
    // component privilege name list
    //

    const ConstStringList & privs = getComponentPrivilegeNameList();

    detailText = "Component Privilege Name List [";
    detailText += LongToNAString((Lng32)privs.entries());
    detailText += " element(s)]";
    detailTextList.append(detailText);

    for (CollIndex i = 0; i < privs.entries(); i++)
    {
        detailText = "[";
        detailText += LongToNAString((Lng32)i);
        detailText += "] ";
        detailText += *privs[i];
        detailTextList.append(detailText);
    }

    //
    // with revoke option
    //

    detailText = "is Grant Option For clause specified? ";
    detailText += YesNo(isGrantOptionForSpecified());
    detailTextList.append(detailText);

    return detailTextList;

} // StmtDDLRevokeComponentPrivilege::getDetailInfo
Exemplo n.º 14
0
int ChangeDirectory(int arg) {
ArgVal   *v;
AtomType  at;
char txt[128], fname[128], *cp;
int n, earg;

   arg++;
   for (earg=arg; earg<pcnt; earg++) {
      v = &(vals[earg]);
      if ((v->Type == Close)
      ||  (v->Type == Terminator)) break;
   }

   v = &(vals[arg]);
   at = v->Type;
   if ((v->Type != Close)
   &&  (v->Type != Terminator)) {

      bzero((void *) fname, 128);

      n = 0;
      cp = &(cmdbuf[v->Pos]);
      do {
	 at = atomhash[(int) (*cp)];
	 if ((at != Seperator)
	 &&  (at != Close)
	 &&  (at != Terminator))
	    fname[n++] = *cp;
	 fname[n] = 0;
	 cp++;
      } while ((at != Close) && (at != Terminator));

      strcpy(localconfigpath,fname);
      strcat(localconfigpath,"/vmeiotest.config");
      if (YesNo("Change vmeiotest config to:",localconfigpath))
	 configpath = localconfigpath;
      else
	 configpath = NULL;
   }

   cp = GetFile(editor);
   sprintf(txt,"%s %s",cp,configpath);
   printf("\n%s\n",txt);
   system(txt);
   printf("\n");
   return(arg);
}
Exemplo n.º 15
0
void CalibrateTurn(int fHard, int rgc[])
{
  int i;
  int fContinue = 1;

  while (fContinue)
    {
    i = WSetting("Left 90's", 1, 4);
    rgc[i] = CalibrateSetting(rgc[i], "Ticks");
    if (fHard)
      Move(-rgc[i], rgc[i]);
    else
		{
		Move(0, rgc[i]);
		Move(200, 200);
		StartPress();
		Move(rgc[i], 0);
		}
    Move(200, 200);
    fContinue = YesNo("Continue");
    }
}
Exemplo n.º 16
0
    // Add addresses / update labels that we've sent to to the address book
    foreach(const SendCoinsRecipient &rcp, recipients)
    {
        std::string strAddress = rcp.address.toStdString();
        CTxDestination dest = CBitcoinAddress(strAddress).Get();
        std::string strLabel = rcp.label.toStdString();
        {
            LOCK(wallet->cs_wallet);

            std::map<CTxDestination, std::string>::iterator mi = wallet->mapAddressBook.find(dest);

            // Check if we have a new address or an updated label
            if (mi == wallet->mapAddressBook.end() || mi->second != strLabel)
            {
                wallet->SetAddressBookName(dest, strLabel);
            }
        }
		//12-8-2014 :: R Halford :: Implement SQL Coin Confirm
		std::string sFrom = DefaultWalletAddress();
		//wtxIn.GetHash().ToString().c_str()
		if (txid.length() > 3 && rcp.CoinTracking)
		{
			//If Coin tracking enabled, Insert the SQL record into the P2P SQL Database
			std::string Narr = "Sending " + RoundToString(rcp.amount,4) + "GRC from " + sFrom + " to " + strAddress + " with tracking " 
				+ YesNo(rcp.CoinTracking) + " for TXID " + txid + " with hashBoinc " 
				+ hashBoinc + ".";
			//Insert via Boinc P2P SQL Server
			printf("%s",Narr.c_str());
			#if defined(WIN32) && defined(QT_GUI)
					qtInsertConfirm((double)total,sFrom,strAddress,txid);
			#endif

			printf("Tracked ");
			
		}

    }
const NAString
ElemDDLFileAttrInsertLog::displayLabel1() const
{
        return NAString("INSERTLOG?    ") + YesNo(isInsertLog());
}
const NAString 
ElemDDLFileAttrLockOnRefresh::displayLabel1() const
{
	return NAString("LOCKONREFRESH?    ") + YesNo(isLockOnRefresh());	
}
const NAString
ElemDDLFileAttrICompress::displayLabel1() const
{
  return NAString("Is i-compress? ") + YesNo(getIsICompress());
}
const NAString
ElemDDLFileAttrClearOnPurge::displayLabel1() const
{
  return NAString("Is clear-on-purge? ") + YesNo(getIsClearOnPurge());
}
const NAString
ElemDDLFileAttrBuffered::displayLabel1() const
{
  return NAString("Is buffered? ") + YesNo(getIsBuffered());
}
const NAString
ElemDDLFileAttrAuditCompress::displayLabel1() const
{
  return NAString("Is audit-compress? ") + YesNo(getIsAuditCompress());
}
const NAString
ElemDDLFileAttrAudit::displayLabel1() const
{
  return NAString("Is audited? ") + YesNo(getIsAudit());
}
const NAString
ElemDDLFileAttrNoLabelUpdate::displayLabel1() const
{
  return NAString("Is no-label-update? ") + YesNo(getIsNoLabelUpdate());
}
const NAString
ElemDDLFileAttrMaxSize::displayLabel1() const
{
  return NAString("Is unbounded? ") + YesNo(isUnbounded());
}
Exemplo n.º 26
0
void Drive::Mount(HWND hwnd)
{
	// check drive empty or require a new drive
	while (GetDriveType(mnt) != DRIVE_NO_ROOT_DIR) {
		char drive = SelectFreeDrive(hwnd);
		if (!drive)
			return;
		_stprintf(mnt, _T("%c:\\"), drive);
		Save();
	}

	// check directory existence
	if (!isDirectory(wchar_to_utf8_cstr(dir.c_str()).c_str())) {
		if (YesNo(hwnd, _T("Directory does not exists. Remove from list?")))
			Drives::Delete(shared_from_this());
		return;
	}

	// TODO check configuration still exists ?? ... no can cause recursion problem

	// search if executable is present
	TCHAR executable[MAX_PATH];
	if (!SearchPath(NULL, _T("encfs.exe"), NULL, LENGTH(executable), executable, NULL))
		throw truntime_error(_T("Unable to find encfs.exe file"));

	// ask a password to mount
	TCHAR pass[128+2];
	if (!GetPassword(hwnd, pass, LENGTH(pass)-2))
		return;
	_tcscat(pass, _T("\r\n"));

	// mount using a sort of popen
	TCHAR cmd[2048];
	_sntprintf(cmd, LENGTH(cmd), _T("\"%s\" -S \"%s\" %c:"), executable, dir.c_str(), mnt[0]);
	boost::shared_ptr<SubProcessInformations> proc(new SubProcessInformations);
	proc->creationFlags = CREATE_NEW_PROCESS_GROUP|CREATE_NO_WINDOW;
	if (!CreateSubProcess(cmd, proc.get())) {
		DWORD err = GetLastError();
		memset(pass, 0, sizeof(pass));
		_sntprintf(cmd, LENGTH(cmd), _T("Error: %s (%u)"), proc->errorPart, (unsigned) err);
		throw truntime_error(cmd);
	}
	subProcess = proc;

	// send the password
	std::string pwd = wchar_to_utf8_cstr(pass);
	DWORD written;
	WriteFile(proc->hIn, pwd.c_str(), pwd.length(), &written, NULL);
	CloseHandle(proc->hIn);	// close input so sub process does not any more
	proc->hIn = NULL;
	memset(pass, 0, sizeof(pass));
	memset((char*) pwd.c_str(), 0, pwd.length());

	mounted = false;

	// wait for mount, read error and give feedback
	for (unsigned n = 0; n < 5*10; ++n) {
		// drive appeared
		if (GetDriveType(mnt) != DRIVE_NO_ROOT_DIR) {
			if (Drives::autoShow)
				Show(hwnd);
			break;
		}

		// process terminated
		DWORD readed;
		char output[2048];
		switch (WaitForSingleObject(subProcess->hProcess, 200)) {
		case WAIT_OBJECT_0:
		case WAIT_ABANDONED:
			if (ReadFile(proc->hOut, output, sizeof(output)-1, &readed, NULL)) {
				output[readed] = 0;
				utf8_to_wchar_buf(output, cmd, LENGTH(cmd));
			} else {
				_stprintf(cmd, _T("Unknown error mounting drive %c:"), mnt[0]);
			}
			subProcess.reset();
			throw truntime_error(cmd);
		}
	}
	if (subProcess)
		mounted = true;
	Save(); // save for resume
}
Exemplo n.º 27
0
int ModeHandler(int mode, char *textIn, int argc, char **argv)
{
	LcdSpi *lcd;
	Spi *spiBus0;
	ScreenData *screenBg;
	int result = 0;
	Fonts font;
	iconv_t ic;
	size_t res;
	char text[MAX_ISO8859_LEN] = "";
	
	memset(&font, 0, sizeof(Fonts));
	spiBus0 = SpiCreate(0);
	if (spiBus0 == NULL) {
		printf("SPI-Error\n");
		exit(EXITCODE_ERROR);
	}
	lcd = LcdOpen(spiBus0);
	if (!lcd) {
		printf("LCD-Error\n");
		exit(EXITCODE_ERROR);
	}
	if (gConfig.mIsInit == 1) {
		LcdInit(lcd);
	} else if (gConfig.mIsInit == 2) {
		LcdUninit(lcd);
		exit(EXITCODE_OK);
	}
	if (gConfig.mIsBgLight) {
		LcdSetBgLight(lcd, gConfig.mBgLight & 1, gConfig.mBgLight & 2, gConfig.mBgLight & 4);
	}
	screenBg = ScreenInit(LCD_X, LCD_Y);
	if (!screenBg) {
		printf("Screen-Error\n");
		exit(EXITCODE_ERROR);
	}
	ScreenClear(screenBg);
	if (gConfig.mBgFilename) {
		if (ScreenLoadImage(screenBg, gConfig.mBgFilename, gConfig.mBgOffX, gConfig.mBgOffY) != 0) {
			ScreenClear(screenBg);
		}
	}
	
	if (textIn) {
		int testInLen = strlen(textIn);
		char **inPtr = &textIn;
		char *outPtr = &text[0];
		
		ic = iconv_open("ISO-8859-1", "UTF-8");
		if (ic != (iconv_t)(-1)) {
			size_t inBytesLeft = testInLen;
			size_t outBytesLeft = sizeof(text) - 1;
		   
			res = iconv(ic, inPtr, &inBytesLeft, &outPtr, &outBytesLeft);
			if ((int)res != -1 && outBytesLeft) {
				outPtr[0] = 0;
			} else {
				strncpy(text, textIn, sizeof(text) - 1);
				text[sizeof(text) - 1] = 0;
			}
			iconv_close(ic);
		}
	}
	
	//printf("Mode: %i\n", mode);
	switch (mode) {
	case OPT_YESNO:
		LoadFonts(&font);
		result = YesNo(lcd, &font, text, screenBg);
		break;
	case OPT_OK:
		LoadFonts(&font);
		result = Ok(lcd, &font, text, screenBg);
		break;
	case OPT_MENU:
		LoadFonts(&font);
		result = Menu(lcd, &font, screenBg, optind, argc, argv);
		break;
	case OPT_IPV4:
		LoadFonts(&font);
		result = Ipv4(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_SUBNETMASK:
		LoadFonts(&font);
		result = Subnetmask(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_INFO:
		LoadFonts(&font);
		result = Info(lcd, &font, text, screenBg);
		break;
	case OPT_BUTTONWAIT:
		result = ButtonWait();
		break;
	case OPT_INTINPUT:
		LoadFonts(&font);
		result = IntInput(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_PROGRESS:
		LoadFonts(&font);
		result = Progress(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_PERCENT:
		LoadFonts(&font);
		result = Percent(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	default:
		break;
	}
	
	if (font.mSystem) {
		//FontDestroy(font.mSystem);
	}
	if (font.mInternal) {
		//FontDestroy(font.mInternal);
	}

	if (gConfig.mIsClear) {
		LcdCls(lcd);
	}
	ScreenDestroy(screenBg);
	LcdCleanup(lcd);
	SpiDestroy(spiBus0);
	
	return result;
}
Exemplo n.º 28
0
NATraceList
StmtDDLSchRevoke::getDetailInfo() const
{
    NAString        detailText;
    NATraceList detailTextList;

    //
    // object name
    //

    detailTextList.append(displayLabel1());   // object name

    //
    // privileges
    //

    StmtDDLSchRevoke * localThis = (StmtDDLSchRevoke *)this;

    detailTextList.append(localThis->getChild(INDEX_PRIVILEGES)
                          ->castToElemDDLNode()
                          ->castToElemDDLPrivileges()
                          ->getDetailInfo());

    //
    // grantee list
    //

    const ElemDDLGranteeArray & granteeArray = getGranteeArray();

    detailText = "Grantee list [";
    detailText += LongToNAString((Lng32)granteeArray.entries());
    detailText += " element(s)]";
    detailTextList.append(detailText);

    for (CollIndex i = 0; i < granteeArray.entries(); i++)
    {
        detailText = "[grantee ";
        detailText += LongToNAString((Lng32)i);
        detailText += "]";
        detailTextList.append(detailText);

        ComASSERT(granteeArray[i] NEQ NULL AND
                  granteeArray[i]->castToElemDDLGrantee() NEQ NULL);
        detailTextList.append("    ", granteeArray[i]->castToElemDDLGrantee()
                              ->getDetailInfo());
    }

    //
    // grant option for
    //

    detailText = "is grant option for? ";
    detailText += YesNo(isGrantOptionForSpecified());
    detailTextList.append(detailText);

    //
    // drop behavior
    //

    detailTextList.append(displayLabel2());   // drop behavior


    return detailTextList;

} // StmtDDLSchRevoke::getDetailInfo
NATraceList
ElemDDLSGOptions::getDetailInfo() const
{
  NAString        detailText;
  NATraceList detailTextList;

  detailTextList.append("Sequence Generator Options:");
  detailText = "    SG Type:      ";

  if (isInternalSG())
    detailText = "INTERNAL ";
  else if (isExternalSG())
    detailText = "EXTERNAL ";
  else
    detailText = "UNKNOWN ";
  detailTextList.append(detailText);

  detailText = "    Start Value specified?   ";
  detailText += YesNo(isStartValueSpecified());
  detailTextList.append(detailText);

  detailText = "    Start Value:      ";
  detailText += Int64ToNAString(getStartValue());
  detailTextList.append(detailText);

  detailText = "    Increment specified?   ";
  detailText += YesNo(isIncrementSpecified());
  detailTextList.append(detailText);

  detailText = "    Increment:      ";
  detailText += Int64ToNAString(getIncrement());
  detailTextList.append(detailText);

  detailText = "    MaxValue specified?   ";
  detailText += YesNo(isMaxValueSpecified());
  detailTextList.append(detailText);

  if (isNoMaxValue())
  {
    detailText = "    Max Value:  NO MAXVAL      ";
    detailTextList.append(detailText);
  }
  else
  {
    detailText = "    Max Value:      ";
    detailText += Int64ToNAString(getMaxValue());
    detailTextList.append(detailText);
  }

  detailText = "    MinValue specified?   ";
  detailText += YesNo(isMinValueSpecified());
  detailTextList.append(detailText);

  if (isNoMinValue())
  {
    detailText = "    Min Value:  NO MINVAL      ";
    detailTextList.append(detailText);
  }
  else
  {
    detailText = "    Min Value:      ";
    detailText += Int64ToNAString(getMinValue());
    detailTextList.append(detailText);
  }

  detailText = "    Cycle specified?   ";
  detailText += YesNo(isCycleSpecified());
  detailTextList.append(detailText);

  if (isNoCycle())
  {
    detailText = "    Cycle Option:  NO CYCLE      ";
    detailTextList.append(detailText);
  }
  else
  {
    detailText = "    Cycle Option:  CYCLE      ";
    detailTextList.append(detailText);
  }

  detailText = "    Cache specified?   ";
  detailText += YesNo(isCacheSpecified());
  detailTextList.append(detailText);

  if (isNoCache())
  {
    detailText = "    Cache Option:  NO CACHE      ";
    detailTextList.append(detailText);
  }
  else
  {
    detailText = "    Cache Option:  CACHE      ";
    detailTextList.append(detailText);
  }

  return detailTextList;
}
Exemplo n.º 30
0
int main(int argc,char *argv[]) {

char *cp, *ep;
char host[49];
char tmpb[CMD_BUF_SIZE];
int tmo;

#if NEWS
   printf("amptest: See <news> command\n");
   printf("amptest: Type h for help\n");
#endif

   pname = argv[0];
   printf("%s: Compiled %s %s\n",pname,__DATE__,__TIME__);
   printf("%s: %s\n",pname, git_version);

   tmo = 0;
   while (AmpIsBlocked()) {
      usleep(100000);
      if (tmo++ > 50) {
	 printf("Amplifier is blocked by another program\n");
	 if (YesNo("Force","Reservation")) AmpUnBlock();
	 else exit(1);
      }
   }
   AmpBlock();
   printf("Amplifier reservation taken, all other programs blocked\n");


   amp = AmpOpen();
   if (amp == 0) {
      printf("\nWARNING: Could not open driver");
      printf("\n\n");
   } else {
      printf("Driver opened OK\n\n");
   }

   bzero((void *) host,49);
   gethostname(host,48);

   while (True) {

      if (amp) sprintf(prompt,"%s:Amp[%02d]",host,cmdindx+1);
      else     sprintf(prompt,"%s:NoDriver:Amp[%02d]",host,cmdindx+1);

      cmdbuf = &(history[cmdindx][0]);
      if (strlen(cmdbuf)) printf("{%s} ",cmdbuf);
      printf("%s",prompt);

      bzero((void *) tmpb,CMD_BUF_SIZE);
      if (gets(tmpb)==NULL) exit(1);

      cp = &(tmpb[0]);
      if (*cp == '!') {
	 cmdindx = strtoul(++cp,&ep,0) -1; cp = ep;
	 if (cmdindx >= HISTORIES) cmdindx = 0;
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '.') {
	 printf("Execute:%s\n",cmdbuf); fflush(stdout);
      } else if ((*cp == '\n') || (*cp == '\0')) {
	 cmdindx++;
	 if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 cmdbuf = &(history[cmdindx][0]);
	 continue;
      } else if (*cp == '?') {
	 printf("History:\n");
	 printf("\t!<1..24> Goto command\n");
	 printf("\tCR       Goto next command\n");
	 printf("\t.        Execute current command\n");
	 printf("\this      Show command history\n");
	 continue;
      } else {
	 cmdindx++; if (cmdindx >= HISTORIES) { printf("\n"); cmdindx = 0; }
	 strcpy(cmdbuf,tmpb);
      }
      bzero((void *) val_bufs,sizeof(val_bufs));
      GetAtoms(cmdbuf);
      DoCmd(0);
   }
}