int CCheckRuleMgr::AddCheckRule(const CheckRule &checkRule)
{
	CheckRule newCheckRule = checkRule;
	newCheckRule.nID = GetNewID();
	m_arrCheckRule.Add(newCheckRule);
	return (int)m_arrCheckRule.GetSize()-1;
}
CSSVertex* CSSolid::AddVertex(int* piNewIndex)
{
	m_Vertices.SetCount(++m_nVertices);
	if(piNewIndex)
		piNewIndex[0] = m_nVertices-1;
	CSSVertex *pVertex = & m_Vertices[m_nVertices-1];
	pVertex->id = GetNewID();
	return pVertex;
}
CSSEdge* CSSolid::AddEdge(int* piNewIndex)
{
	m_Edges.SetCount(++m_nEdges);
	if(piNewIndex)
		piNewIndex[0] = m_nEdges-1;
	CSSEdge *pEdge = & m_Edges[m_nEdges-1];
	pEdge->id = GetNewID();
	return pEdge;
}
CSSFace* CSSolid::AddFace(int* piNewIndex)
{
	m_Faces.SetCount(++m_nFaces);
	if(piNewIndex)
		piNewIndex[0] = m_nFaces-1;
	CSSFace *pFace = & m_Faces[m_nFaces-1];
	pFace->id = GetNewID();
	return pFace;
}
void CLibInfoMapObjectData::Add(PCInfoBase pInfo)
{
    PCInfoMapObjectData pInfoMapObjectData;

    pInfoMapObjectData = (PCInfoMapObjectData)pInfo;
    if (pInfoMapObjectData->m_dwDataID == 0) {
        pInfoMapObjectData->m_dwDataID = GetNewID ();
    }
    m_paInfo->Add (pInfoMapObjectData);
}
void CLibInfoMapEvent::Add(PCInfoBase pInfo)
{
	PCInfoMapEventBase pInfoMapEvent;

	pInfoMapEvent = (PCInfoMapEventBase)pInfo;
	if (pInfoMapEvent->m_dwMapEventID == 0) {
		pInfoMapEvent->m_dwMapEventID = GetNewID ();
	}
	m_paInfo->Add (pInfoMapEvent);
}
void CLibInfoMapShadow::Add(PCInfoBase pInfo)
{
	PCInfoMapShadow pMapShadowInfo;

	pMapShadowInfo = (PCInfoMapShadow)pInfo;
	if (pMapShadowInfo->m_dwShadowID == 0) {
		pMapShadowInfo->m_dwShadowID = GetNewID ();
	}

	m_paInfo->Add (pMapShadowInfo);
	m_mapIDPtr.insert (pair<DWORD, PVOID>(pMapShadowInfo->m_dwShadowID, (PVOID)pMapShadowInfo));
}
void*
JMemoryManager::New
	(
	const size_t      size,
	const JCharacter* file,
	const JUInt32     line,
	const JBoolean    isArray
	)
{
	if (theAbortUnknownAllocFlag && line == 0)
		{
		cout << "Memory allocated by unknown code, aborting...\n" << endl;
		abort();
		}

	const size_t trueSize = size ? size : 1;
	void* newBlock = malloc(trueSize);

	if (newBlock == NULL)
		{
		cout << "failed to allocate block of size " << trueSize << endl;
		}

	assert(newBlock != NULL);
	if (theInitializeFlag)
		{
		memset(newBlock, theAllocateGarbage, trueSize);
		}

	const JBoolean isManager = JI2B(theConstructingFlag || Instance()->itsRecursionDepth > 0 || theInternalFlag);
	JMMRecord newRecord(GetNewID(), newBlock, trueSize, file, line, isArray, isManager);

	if (theConstructingFlag || Instance()->itsRecursionDepth > 0)
		{
		assert(theAllocStackSize < theStackMax);
		theAllocStack[theAllocStackSize] = newRecord;
		theAllocStackSize++;
		}
	else
		{
		Instance()->AddNewRecord(newRecord);
		}

	return newBlock;
}
Exemple #9
0
dxTextField::dxTextField (const TCHAR *text, dxRect _rct, D3DCOLOR _fontColor) {
	
	// Create a D3DX font object
	if (pD3DDevice) {
		hFont = CreateFont (20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PROOF_QUALITY, 0, _T("Comic Sans MS"));
		if (S_OK != D3DXCreateFont (pD3DDevice, hFont, &Font)) {
			trace (_T ("Font did not created."));
		}
	} else trace (_T ("Direct3D device is bad."));

	_stprintf_s (textBuffer, _T("%s"), text);

	// Create a colour for the text - in this case blue
	fontColor = D3DCOLOR_ARGB (255,0,0,255);    

	// Create a rectangle to indicate where on the screen it should be drawn
	rct = _rct;

	ID = GetNewID ();

	textFields.push_back (this);
}
Exemple #10
0
int FinalTest(int crateNum, uint32_t slotMask, uint32_t testMask, int skip)
{

  int updateDB = 1;
  lprintf("*** Starting Final Test ****************\n");

  JsonNode *ftDocs[16];
  char comments[1000];
  memset(comments,'\0',1000);
  int errors;
  // initialize the crate
  errors = CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);
  if (errors){
    lprintf("Problem initializing the crate, exiting final test\n");
    return -1;
  }

  errors = MTCInit(1); 
  if (errors){
    lprintf("Problem intializing the mtcd, exiting final test\n");
  }

  lprintf("----------------------------------------\n");
  lprintf("If any boards could not initialize properly, type \"quit\" now "
      "to exit the test.\n Otherwise hit enter to continue.\n");
  contConnection->GetInput(comments,1000);
  if (strncmp("quit",comments,4) == 0){
    lprintf("Exiting final test\n");
    lprintf("****************************************\n");
    return 0;
  }

  for (int i=0;i<16;i++){
    if ((0x1<<i) & slotMask){
      GetNewID(finalTestIDs[crateNum][i]);
      ftDocs[i] = json_mkobject();
    }
  }

  lprintf("Now starting board_id\n");
  BoardID(crateNum,slotMask);
  lprintf("----------------------------------------\n");

  if (!skip && updateDB){
    for (int i=0;i<16;i++){
      if ((0x1<<i) & slotMask){
        lprintf("Please enter any comments for slot %i motherboard now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"fec_comments",json_mkstring(comments));
        lprintf("Has this slot been refurbished? (y/n)\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"refurbished",json_mkbool(comments[0] == 'y'));
        lprintf("Has this slot been cleaned? (y/n)\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"cleaned",json_mkbool(comments[0] == 'y'));
        lprintf("Time to measure resistance across analog outs and cmos address lines. For the cmos address lines"
            "it's easier if you do it during the fifo mod\n");
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"analog_out_res",json_mkstring(comments));
        lprintf("Please enter any comments for slot %i db 0 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db0_comments",json_mkstring(comments));
        lprintf("Please enter any comments for slot %i db 1 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db1_comments",json_mkstring(comments));
        lprintf("Please enter any comments for slot %i db 2 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db2_comments",json_mkstring(comments));
        lprintf("Please enter any comments for slot %i db 3 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db3_comments",json_mkstring(comments));
        lprintf("Please enter dark matter measurements for slot %i db 0 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db0_dark_matter",json_mkstring(comments));
        lprintf("Please enter dark matter measurements for slot %i db 1 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db1_dark_matter",json_mkstring(comments));
        lprintf("Please enter dark matter measurements for slot %i db 2 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db2_dark_matter",json_mkstring(comments));
        lprintf("Please enter dark matter measurements for slot %i db 3 now.\n",i);
        contConnection->GetInput(comments);
        json_append_member(ftDocs[i],"db3_dark_matter",json_mkstring(comments));
      }
    }


    lprintf("Enter N100 DC offset\n");
    contConnection->GetInput(comments);
    for (int i=0;i<16;i++){
      if ((0x1<<i) & slotMask){
        json_append_member(ftDocs[i],"dc_offset_n100",json_mkstring(comments));
      }
    }
    lprintf("Enter N20 DC offset\n");
    contConnection->GetInput(comments);
    for (int i=0;i<16;i++){
      if ((0x1<<i) & slotMask){
        json_append_member(ftDocs[i],"dc_offset_n20",json_mkstring(comments));
      }
    }
    lprintf("Enter esum hi DC offset\n");
    contConnection->GetInput(comments);
    for (int i=0;i<16;i++){
      if ((0x1<<i) & slotMask){
        json_append_member(ftDocs[i],"dc_offset_esumhi",json_mkstring(comments));
      }
    }
    lprintf("Enter esum lo DC offset\n");
    contConnection->GetInput(comments);
    for (int i=0;i<16;i++){
      if ((0x1<<i) & slotMask){
        json_append_member(ftDocs[i],"dc_offset_esumlo",json_mkstring(comments));
      }
    }

    lprintf("Thank you. Please hit enter to continue with the rest of final test. This may take a while.\n");
    contConnection->GetInput(comments);
  }

  // update the database
  if (updateDB){
  for (int i=0;i<16;i++){
    if ((0x1<<i) & slotMask){
      json_append_member(ftDocs[i],"type",json_mkstring("final_test"));
      PostDebugDocWithID(crateNum, i, finalTestIDs[crateNum][i], ftDocs[i]);
    }
  }
  }

  lprintf("----------------------------------------\n");

  int testCounter = 0;

  if ((0x1<<testCounter) & testMask)
    FECTest(crateNum,slotMask,updateDB,1);
  testCounter++;

  if ((0x1<<testCounter) & testMask)
    VMon(crateNum,slotMask,updateDB,1);
  testCounter++;
  if ((0x1<<testCounter) & testMask)
    CGTTest(crateNum,slotMask,0xFFFFFFFF,updateDB,1);
  testCounter++;
  CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);
  if ((0x1<<testCounter) & testMask)
    PedRun(crateNum,slotMask,0xFFFFFFFF,0,DEFAULT_GT_DELAY,DEFAULT_PED_WIDTH,50,1000,300,updateDB,0,1);
  testCounter++;
  CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);
  MTCInit(1);
  if ((0x1<<testCounter) & testMask)
    CrateCBal(crateNum,slotMask,0xFFFFFFFF,updateDB,1);
  testCounter++;

  lprintf("----------------------------------------\n");

  // load cbal values now
  CrateInit(crateNum,slotMask,0,1,0,0,0,0,0,0,0);

  if ((0x1<<testCounter) & testMask)
    PedRun(crateNum,slotMask,0xFFFFFFFF,0,DEFAULT_GT_DELAY,DEFAULT_PED_WIDTH,50,1000,300,updateDB,1,1);
  testCounter++;

  if ((0x1<<testCounter) & testMask)
    ChinjScan(crateNum,slotMask,0xFFFFFFFF,0,DEFAULT_GT_DELAY,DEFAULT_PED_WIDTH,10,5000,400,1,1,updateDB,1);
  testCounter++;
  if ((0x1<<testCounter) & testMask)
    SetTTot(crateNum,slotMask,400,updateDB,1);
  testCounter++;

  // load cbal and ttot values now
  CrateInit(crateNum,slotMask,0,1,0,1,0,0,0,0,0);

  if ((0x1<<testCounter) & testMask)
    GetTTot(crateNum,slotMask,390,updateDB,1);
  testCounter++;
  if ((0x1<<testCounter) & testMask)
    DiscCheck(crateNum,slotMask,500000,updateDB,1);
  testCounter++;
  uint32_t slotMasks[MAX_XL3_CON];
  for (int ic=0;ic<MAX_XL3_CON;ic++)
    slotMasks[ic] = slotMask;
  if ((0x1<<testCounter) & testMask)
    GTValidTest((0x1)<<crateNum,slotMasks,0xFFFFFFFF,400,0,0,updateDB,0,1);
  testCounter++;

  CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);
  
  if ((0x1<<testCounter) & testMask)
    ZDisc(crateNum,slotMask,10000,0,updateDB,0,1,0);
  testCounter++;

  MTCInit(0);
  CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);

  if ((0x1<<testCounter) & testMask)
    MbStabilityTest(crateNum,slotMask,50,updateDB,1);
  testCounter++;
  if ((0x1<<testCounter) & testMask)
    FifoTest(crateNum,slotMask,updateDB,1);
  testCounter++;

  // load alternate xilinx
  CrateInit(crateNum,slotMask,2,0,0,0,0,0,0,0,0);

  if ((0x1<<testCounter) & testMask)
    CaldTest(crateNum,slotMask,3500,750,200,1,updateDB,1);
  testCounter++;

  for (int i=0;i<16;i++){
    if ((0x1<<i) & slotMask){
      CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0); 
      if ((0x1<<testCounter) & testMask)
        MemTest(crateNum,i,updateDB,1);
    }
  }
  testCounter++;

  CrateInit(crateNum,slotMask,1,0,0,0,0,0,0,0,0);

  if ((0x1<<testCounter) & testMask){
    lprintf("Ready for see_refl test. Hit enter to enable triggers and continue or quit to skip and finish.\n\a");

    contConnection->GetInput(comments);
    if (strncmp("quit",comments,4) != 0){
      SeeReflection(crateNum,slotMask,0xFFFFFFFF,255,1000,updateDB,0,1);
    }
  }

  CrateInit(crateNum,slotMask,0,0,0,0,0,0,0,0);

  lprintf("----------------------------------------\n");
  lprintf("Final Test finished!\n");
  lprintf("****************************************\n");
  return 0;
}