ClangTidyASTConsumerFactory::CheckersList
ClangTidyASTConsumerFactory::getCheckersControlList(GlobList &Filter) {
  CheckersList List;

  bool AnalyzerChecksEnabled = false;
  for (StringRef CheckName : StaticAnalyzerChecks) {
    std::string Checker((AnalyzerCheckNamePrefix + CheckName).str());
    AnalyzerChecksEnabled =
        AnalyzerChecksEnabled ||
        (!CheckName.startswith("debug") && Filter.contains(Checker));
  }

  if (AnalyzerChecksEnabled) {
    // Run our regex against all possible static analyzer checkers.  Note that
    // debug checkers print values / run programs to visualize the CFG and are
    // thus not applicable to clang-tidy in general.
    //
    // Always add all core checkers if any other static analyzer checks are
    // enabled. This is currently necessary, as other path sensitive checks
    // rely on the core checkers.
    for (StringRef CheckName : StaticAnalyzerChecks) {
      std::string Checker((AnalyzerCheckNamePrefix + CheckName).str());

      if (CheckName.startswith("core") ||
          (!CheckName.startswith("debug") && Filter.contains(Checker)))
        List.push_back(std::make_pair(CheckName, true));
    }
  }
  return List;
}
Exemple #2
0
int main(void){
    int N,i,j,num = 0;
    char cards[CARDS][3];
    char Bubble[CARDS][3];
    char Selection[CARDS][3];

    char check[NUMBER][SUIT+1] = {0};
    char Bubblecheck[NUMBER][SUIT+1] = {0};
    char Selectioncheck[NUMBER][SUIT+1] = {0};

    scanf("%d" ,&N);

    for(i = 0;i < N;i++){
        scanf("%s", cards[i]);
    }

    /*copy array*/
    memcpy(Bubble,cards,sizeof cards);
    memcpy(Selection,cards,sizeof cards);

    Checker(cards,check,N);

    BubbleSort(Bubble,N);
    Checker(Bubble,Bubblecheck,N);
    StableChecker(Bubblecheck,check);

    SelectionSort(Selection,N);
    Checker(Selection,Selectioncheck,N);
    StableChecker(Selectioncheck,check);

    return 0;
}
void CLSComplianceChecker::VerifyCLSCompliance(SourceFile * SourceFile)
{
    CLSComplianceChecker Checker(SourceFile);

    Checker.VerifyCLSComplianceForContainerAndNestedTypes(
        SourceFile->GetUnnamedNamespace());
}
bool BaseAI::startTurn()
{
    static bool initialized = false;
    int count = 0;
    count = getPlayerCount(c);
    players.clear();
    players.resize(count);
    for(int i = 0; i < count; i++)
    {
        players[i] = Player(getPlayer(c, i));
    }

    count = getCheckerCount(c);
    checkers.clear();
    checkers.resize(count);
    for(int i = 0; i < count; i++)
    {
        checkers[i] = Checker(getChecker(c, i));
    }

    if(!initialized)
    {
        initialized = true;
        init();
    }
    return run();
}
void scigraphics::sequence::graphViewOrdered::drawOrderedByX( painter &Painter, const pairScales& Scales, sequence::data::iterator Begin, sequence::data::iterator End ) const 
{
  if ( Begin == End )
    return;

  if ( Scales.numberToFractionX((End-1)->x()) < 0 )
    return;
  if ( Scales.numberToFractionX(Begin->x()) > 1 )
    return;

  checkIsLessThan Checker(Scales);
  sequence::data::iterator BeginVisbile = Checker(0,*Begin)   ? Begin : std::lower_bound( Begin,        End, static_cast<fcoord>(0), Checker );
  if ( BeginVisbile != Begin )
    --BeginVisbile;
  sequence::data::iterator EndVisible   = Checker(*(End-1),1) ? End   : std::upper_bound( BeginVisbile, End, static_cast<fcoord>(1), Checker );
  if ( EndVisible != End )
    ++EndVisible;
  drawUnorderedByX( Painter, Scales, BeginVisbile, EndVisible );
}
	QVariantMap TodoItem::DiffWith (const TodoItem_ptr item) const
	{
		return Checker (this, item.get ())
				("Title", &TodoItem::Title_)
				("Comment", &TodoItem::Comment_)
				("Tags", &TodoItem::TagIDs_)
				("Deps", &TodoItem::Deps_)
				("Created", &TodoItem::Created_)
				("Due", &TodoItem::Due_)
				("Percentage", &TodoItem::Percentage_);
	}
int main(int ac, char *av[])
{
	// Lire fichier de conf
	// Générer les checks
	//   -> ip, port à tester
	//   -> Action à effectuer
	//   -> Durée entre chaque check
	// Scheduler
	//   -> loop sur les taches a effectuer
	//       -> si temps est dépassé -> on lance le check et on met à jour le (next) timestamp
	Checker c("127.0.0.1", 80,	"echo toto", 10);
	Scheduler s;
	s.pushChecker(c);
	s.pushChecker(Checker("127.0.0.1", 443, "echo tutu", 21));
	s.run();
	system("PAUSE");
}
const JSONObjectWrapper::Checker
JSONObjectWrapper::get(const std::wstring & key) const
{
  return Checker(object_, object_.find(key));
}
const JSONObjectWrapper::Checker
JSONObjectWrapper::check(const std::wstring & key, bool & valid) const
{
  return Checker(object_, object_.find(key), valid);
}
Exemple #10
0
/*******************************************************************************************

  > BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
  
	Author: 	Stefan_Stoykov (Xara Group Ltd) <*****@*****.**> 
	Created:	24/6/97
	Inputs: 	BrowserOptions - the options for generating the html page
	Purpose:	Generate a html file which includes our bitmap, together with some other optional 
				stuff. Used for browser preview.
				
*******************************************************************************************/
BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)
{
PORTNOTE("other","Removed _R(IDD_TIMAPOPTIONS) - isn't wanted yet")
#ifndef EXCLUDE_FROM_XARALX
	// sanity checks
	
	// check for export options
	
	ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateHTMLStub - need export options");
	if (m_pOptions == NULL) // we need export options
		return FALSE;
	
	// get the path for the exported bitmap from the options
	PathName TempPath = m_pOptions->GetPathName();
	
	// check for exported bitmap
	ERROR3IF((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE), 
		"BitmapPreviewData::GenerateHTMLStub - need exported bitmap");
	if ((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE)) 
		return FALSE;
	
	// delete the previous temp file, if any
	if (m_pTempHTMLPath != NULL)
		FileUtil::DeleteFile(m_pTempHTMLPath);
	else
		m_pTempHTMLPath = new PathName;
	
	// safety check
	if (m_pTempHTMLPath == NULL)
		return FALSE;
	
	// create a new temp file 
	if (FileUtil::GetTemporaryPathName( _T("htm"),m_pTempHTMLPath) == FALSE)
	{
		delete m_pTempHTMLPath;
		m_pTempHTMLPath = NULL;
		
		return FALSE;
	}
	
	// start creating the html page
	
	// create a disk file
	CCDiskFile TempDiskFile(1024, FALSE, TRUE);
	
	// get path name to server, so we can find the logo bitmaps
	CString str;
	AfxGetModuleShortFileName(AfxGetInstanceHandle(), str);
	String_256 strPathName(str.GetBuffer(0));
	
	// create a path name object from the program name
	PathName ProgramPath(strPathName);
	
	try
	{
		// open it for reading
		if (!TempDiskFile.open(*m_pTempHTMLPath, ios::out))
			return FALSE;
		
		// output header
		String_256 s(_R(IDS_HTML_HEAD));
		TempDiskFile.write(s);
		
		// set the background attributes
		switch (BrowserOptions.m_Background)
		{
		case BROWSER_BGR_DOC:
			{
				// set the background from the document page
				if (!SetBackgroundFromPage(TempDiskFile, BrowserOptions.m_pSpread))
					ERROR3("Setting the html background from the document page failed\n");
			}
			break;
			
		case BROWSER_BGR_CHECKER:
			{
				// display the checkered bitmap as background
				
				// get the checkered bitmap name
				String_256 Checker(_R(IDS_HTML_CHECKER));
				
				// set it in the path
				ProgramPath.SetFileNameAndType(Checker);
				
				// set the checkered bitmap as background image
				s.MakeMsg(_R(IDS_CHECK_BACK), (TCHAR *)ProgramPath.GetWebAddress());
				TempDiskFile.write(s);
			}
			break;
			
		case BROWSER_BGR_BITMAP:
			{
				// set our bitmap as background image
				s.MakeMsg(_R(IDS_BITMAPED_BACKGROUND), (TCHAR *)TempPath.GetWebAddress());
				TempDiskFile.write(s);
				
				
			}
			break;
			
		case BROWSER_BGR_NONE:
			{
				String_256 background(_R(IDS_PLAIN_BACKGROUND));
				TempDiskFile.write(background);
			}
			
			break;
			
		default:
			ERROR3("Unknown type of BrowserOptions.m_Background");
			break;
		} // end of switch(BrowserOptions.m_Background) block
		
		// Get a pointer to the actual bitmap so that we can get some details from it.
		//		OILBitmap *pOilBitmap = m_pBitmap->ActualBitmap;
		//		ERROR3IF(pOilBitmap == NULL,"BitmapPreviewData::GenerateBitmapInfoStrings NULL oil bitmap pointer");
		
		// Get the details from the specified bitmap
		//		BitmapInfo BmInfo;
		//		pOilBitmap->GetInfo(&BmInfo);
		
		// output our bitmap, but only if it wasn't already set as background
		String_256 s2(_R(IDS_PAGE_TITLE));
		TempDiskFile.write(s2);
		
		if (BrowserOptions.m_Background != BROWSER_BGR_BITMAP)
		{
			// output the bitmap
			
			if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
			{
				// GIF animation
				s.MakeMsg(_R(IDS_DISPLAY_PIC), (const TCHAR *)TempPath.GetFileName());
			}
			else
			{
				if( m_pOptions->GetFilterNameStrID() == _R(IDN_FILTERNAME_GIF) ||
					m_pOptions->GetFilterNameStrID() == _R(IDS_JPG_EXP_FILTERNAME) ||
					m_pOptions->GetFilterNameStrID() == _R(IDT_FILTERNAME_BMP) )
				{
					s.MakeMsg(_R(IDS_DISPLAY_BMP), (const TCHAR *)TempPath.GetFileName());
				}
				else
				if( m_pOptions->GetFilterNameStrID() == _R(IDS_FILTERNAME_PNG) )
					s.MakeMsg(_R(IDS_DISPLAY_PNG), (const TCHAR *)TempPath.GetFileName());
			}	
			
			TempDiskFile.write(s);
		}
		else
		{
			s.MakeMsg(_R(IDS_EMPTY_BOX));
			TempDiskFile.write(s);
			
		}
		
		switch (m_pOptions->GetFilterNameStrID())
		{
		case _R(IDT_FILTERNAME_BMP):
			s2.MakeMsg(_R(IDS_BMP_MESSAGE));
			s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
			TempDiskFile.write(s);
			break;
		case _R(IDS_FILTERNAME_PNG):
			s2.MakeMsg(_R(IDS_PNG_MESSAGE));
			s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
			TempDiskFile.write(s);
			break;
		} // end of switch(m_pOptions->GetFilterNameStrID())
		
		s.MakeMsg(_R(IDS_DETAILS_BUILD));
		TempDiskFile.write(s);
		
		// output the bitmap info, if requested
		if (BrowserOptions.m_bInfo != FALSE)
		{
			String_64 ImageSize;
			String_64 FileSize;
			BOOL m_bTransparent = FALSE;
			INT32 count;
			count=0;
			// generate the info strings
			
			if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
			{
				// This is actually the export animated GIF using the frame gallery system
				MakeBitmapExportOptions* pMkBOptions = (MakeBitmapExportOptions*)m_pOptions;
				ERROR3IF(!pMkBOptions->IS_KIND_OF(MakeBitmapExportOptions), "pMkBOptions isn't");
				
				PALETTE Palette = PAL_OPTIMISED;
				DITHER DitherType;
				UINT32 colDepth;
				String_64 sPalette;
				String_64 Dither;
				UINT32 NoOfColours;
				
				NoOfColours=m_pOptions->GetNumColsInPalette();
				//						Palette = pMkBOptions->GetPalette();
				DitherType = pMkBOptions->GetDither();
				colDepth = pMkBOptions->GetDepth();
				
				s2.MakeMsg(_R(IDS_ANIMATED_GIF));
				
				if (pMkBOptions->WantTransparent())
				{
					s2.MakeMsg(_R(IDS_TRANSPARENT),"animated GIF");
				}
				
				s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
				TempDiskFile.write(s);
				
				switch (Palette)
				{
				case PAL_OPTIMISED:
					sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
					break;
				case PAL_BROWSER:
				case PAL_STANDARD:
					sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
					break;
				case PAL_GLOBALOPTIMISED:
					sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
					break;
					
				}
				
				if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
				{
					NoOfColours = 216;
				}
				
				switch (colDepth)
				{
				case 32:
				case 24:
					s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
					break;
				case 8:
					{
						// Include the transparent colour in the colour depth check
						UINT32 RealNumberOfColours = NoOfColours;
						if (colDepth <= 8 && pMkBOptions->WantTransparent())
						{
							UINT32 MaxColours = UINT32(pow(2,colDepth));
							RealNumberOfColours++;
							if (RealNumberOfColours > MaxColours)
								RealNumberOfColours = MaxColours;
						}
						// We say 8 but we really mean the number of colours deep
						// We cannot say 2 colours = 2bpp as we save it as 10 colours due
						// to having 1 transparent colour and the usual lets pick 10 as the
						// transparent colour. Cannot allow the user to choose 1 as the code
						// then outputs 8bpp as GRenderOptPalette::GetOptimisedPalette has the
						// test if (ReservedColours < NumColours), which fails.
						/* if (RealNumberOfColours <= 2)
						s2.MakeMsg(_R(IDS_PALETTEINFO),2,NoOfColours,(const TCHAR*)sPalette);
						else */
						if (RealNumberOfColours <= 16)
							s2.MakeMsg(_R(IDS_PALETTEINFO),4,NoOfColours,(const TCHAR*)sPalette);
						else
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						break;
					}
				case 1:
					s2.MakeMsg(_R(IDS_MONO),colDepth);
					break;
				case 4:
				default:
					s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
					break;
				}
				
				TempDiskFile.write(s2); 				
				
				s.MakeMsg(_R(IDS_NODITHER));
				switch (DitherType)
				{
				case XARADITHER_ORDERED:
				case XARADITHER_ORDERED_GREY:
					Dither.MakeMsg(_R(IDS_DITH_ORDER));
					s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
					break;
				case XARADITHER_ERROR_DIFFUSION:
				case XARADITHER_SIMPLE:
					Dither.MakeMsg(_R(IDS_DITH_ERROR));
					s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
					break;
				case XARADITHER_NONE:
					s.MakeMsg(_R(IDS_NODITHER));
					break;
				}
				
				TempDiskFile.write(s);
			} // if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER) block ends
			else
			{
				switch (m_pOptions->GetFilterNameStrID())
				{
				case _R(IDN_FILTERNAME_GIF):
					{
						GIFExportOptions* pGIFOptions = (GIFExportOptions*)m_pOptions;
						ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
						PALETTE Palette = PAL_OPTIMISED;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						//						Palette = pGIFOptions->GetPalette();
						DitherType = pGIFOptions->GetDither();
						colDepth = pGIFOptions->GetDepth();
						
						
						if (pGIFOptions->WantTransparent())
							count=count+1;
						
						if (pGIFOptions->WantInterlaced())
							count=count+2;
						
						s.MakeMsg(_R(IDS_GIF));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						switch (count)
						{
						case 1:
							s2.MakeMsg(_R(IDS_TRANSPARENT),"GIF");
							break;
						case 2:
							s2.MakeMsg(_R(IDS_INTERLACED),"GIF");
							break;
						case 3:
							s2.MakeMsg(_R(IDS_INTER_TRANS),"GIF");
							break;
						case 0:
							break;
						}
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
							
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
						
						
					} // end case _R(IDN_FILTERNAME_GIF)
					break;
				case _R(IDS_JPG_EXP_FILTERNAME): 
					{
						JPEGExportOptions* pJPEGOptions = (JPEGExportOptions *)m_pOptions;
						ERROR3IF(!pJPEGOptions->IS_KIND_OF(JPEGExportOptions), "pJPEGOptions isn't");
						INT32 Quality = pJPEGOptions->GetQuality();	// Default Quality
						BOOL Progressive = pJPEGOptions->DoAsProgressive();
						if (Quality > 100)
							Quality = 100;
						
						
						s.MakeMsg(_R(IDS_JPEG));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						if (Progressive)
							s2.MakeMsg(_R(IDS_PROGRESSIVE));
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						
						s.MakeMsg(_R(IDS_JCOMPRESSION),Quality);
						TempDiskFile.write(s);					
					} // end case _R(IDS_JPG_EXP_FILTERNAME)
					break;
					
				case _R(IDT_FILTERNAME_BMP):
					{
						BMPExportOptions* pBMPOptions = (BMPExportOptions*)m_pOptions;
						ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't");
						PALETTE Palette;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						Palette = pBMPOptions->GetPalette();
						DitherType = pBMPOptions->GetDither();
						colDepth = pBMPOptions->GetDepth();
						
						s.MakeMsg(_R(IDS_BMP));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						if (colDepth == 8 && NoOfColours > 256)
							NoOfColours = 256;
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
					} // end case _R(IDT_FILTERNAME_BMP)
					break;
					
				case _R(IDS_FILTERNAME_PNG):
					{
						PNGExportOptions* pPNGOptions = (PNGExportOptions*)m_pOptions;
						ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
						PALETTE Palette = PAL_OPTIMISED;
						DITHER DitherType;
						UINT32 colDepth;
						String_64 sPalette;
						String_64 Dither;
						UINT32 NoOfColours;
						
						NoOfColours=m_pOptions->GetNumColsInPalette();
						
						//						Palette = pPNGOptions->GetPalette();
						DitherType = pPNGOptions->GetDither();
						colDepth = pPNGOptions->GetDepth();
						
						
						if (pPNGOptions->WantTransparent())
							count=count+1;
						
						if (pPNGOptions->WantInterlaced())
							count=count+2;
						
						s.MakeMsg(_R(IDS_PNG));
						s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
						
						switch (count)
						{
						case 1:
							s2.MakeMsg(_R(IDS_TRANSPARENT),"PNG");
							break;
						case 2:
							s2.MakeMsg(_R(IDS_INTERLACED),"PNG");
							break;
						case 3:
							s2.MakeMsg(_R(IDS_INTER_TRANS),"PNG");
							break;
						case 0:
							break;
						}
						
						s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
						TempDiskFile.write(s);
						
						switch (Palette)
						{
						case PAL_OPTIMISED:
							sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
							break;
						case PAL_BROWSER:
						case PAL_STANDARD:
							sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
							break;
						case PAL_GLOBALOPTIMISED:
							sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
							break;
						}
						
						if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
						{
							NoOfColours = 216;
						}
						
						s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);					
						
						if (colDepth == 8)
							s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
						
						if (colDepth == 1)
							s2.MakeMsg(_R(IDS_MONO),colDepth);
						
						if (colDepth > 8)
							s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
						
						TempDiskFile.write(s2); 				
						
						s.MakeMsg(_R(IDS_NODITHER));
						switch (DitherType)
						{
						case XARADITHER_ORDERED:
						case XARADITHER_ORDERED_GREY:
							Dither.MakeMsg(_R(IDS_DITH_ORDER));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_ERROR_DIFFUSION:
						case XARADITHER_SIMPLE:
							Dither.MakeMsg(_R(IDS_DITH_ERROR));
							s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
							break;
						case XARADITHER_NONE:
							s.MakeMsg(_R(IDS_NODITHER));
							break;
						}
						
						TempDiskFile.write(s);
					} // end case _R(IDS_FILTERNAME_PNG)
					
					break;
				} // end switch (m_pOptions->GetFilterNameStrID())
			} // end else block
			
			GenerateBitmapInfoStrings(ImageSize, FileSize);
			
			// output the bitmap info
			s.MakeMsg(_R(IDS_HTML_INFO1), (TCHAR *)ImageSize);
			TempDiskFile.write(s);
			
			// output the bitmap file size info
			s.MakeMsg(_R(IDS_HTML_INFO2), (TCHAR *)FileSize);
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_CLOSE_CENTER));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TDTR_CLOSE));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_BANNER_BOX));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_SPEED_BUILD));
			TempDiskFile.write(s);
			//			s.MakeMsg(_R(IDS_SPEED_BUILD2));
			//			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			String_64 times;
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"14.4k");
			TempDiskFile.write(s);
			CalculateTime(times,14400.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"28.8k");
			TempDiskFile.write(s);
			CalculateTime(times,28800.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"33.6k");
			TempDiskFile.write(s);
			CalculateTime(times,33600.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"57.6k");
			TempDiskFile.write(s);
			CalculateTime(times,57600.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"64k");
			TempDiskFile.write(s);
			CalculateTime(times,65536.0);
			TempDiskFile.write(times);
			s.MakeMsg(_R(IDS_ES_TR));
			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_TIME_ENTRY),"128k");
			TempDiskFile.write(s);
			CalculateTime(times,131072.0);
			TempDiskFile.write(times);
			
			//			s.MakeMsg(_R(IDS_ES_TR));
			//			TempDiskFile.write(s);
			
			s.MakeMsg(_R(IDS_SPEED_END));
			TempDiskFile.write(s);
			
			TRACE( _T("m_FileSize = %d"), m_FileSize);
		} // end of if (BrowserOptions.m_bInfo != FALSE)
		
		String_64 webaddy(_R(IDS_HTML_URL_PROGRAM));
		//Mark Howitt, 29/10/97. Setup the _R(IDS_HTML_URL_VISITMSG) To be a TCHAR* Also. It likes it that way!
		String_64 webvmess(_R(IDS_HTML_URL_VISITMSG));
		
		s.MakeMsg(_R(IDS_LINK_BOX),(TCHAR *)webaddy,(TCHAR *)webvmess);
		TempDiskFile.write(s);
		
		//end of my stuff
		
		s.MakeMsg(_R(IDS_END_TABLE));
		TempDiskFile.write(s);
		
		s.MakeMsg(_R(IDS_CLOSE_CENTER));
		TempDiskFile.write(s);
		
		// output the "Exported from" string
		
		// get the xara logo file name
		String_256 Logo(_R(IDS_HTML_XARALOGO));
		
		// set it in the path
		ProgramPath.SetFileNameAndType(Logo);
		
		// get the xara link
		String_256 URL(_R(IDS_HTML_URL_XARA));
		
		// output the xara link and the xara logo
		s.MakeMsg(_R(IDS_HTML_XARA), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
		TempDiskFile.write(s);
		
		// Do not display the Xara X logo bottom right...
		/*
		// get the program logo file name
		Logo.Load(_R(IDS_HTML_PROGRAMLOGO));
		
		// set it in the path
		ProgramPath.SetFileNameAndType(Logo);
		
		// output the program link
		URL.Load(_R(IDS_HTML_URL_PROGRAM));
		s.MakeMsg(_R(IDS_HTML_PROGRAM), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
		TempDiskFile.write(s);
		*/
		
		// output the end of the file
		s.Load(_R(IDS_HTML_END));
		TempDiskFile.write(s);
		
		// close the file
		TempDiskFile.close();
		
		// now export the image map, if the option for that is set
		if (BrowserOptions.m_bImagemap != FALSE)
		{
			// export the image map
			ExportImagemap( TempDiskFile, 
				m_pTempHTMLPath, 
				m_pOptions->GetSelectionType(), 
				m_pOptions->GetDPI(),
				BrowserOptions.m_ifoImagemapOptions);
		}
		
		TCHAR *FileWebAddress =  m_pTempHTMLPath->GetWebAddress();
		
		//Graham 17/9/97
		ProgramPath.SetFileNameAndType(PRODUCT_WEBLINKEXENAME);
		
		const TCHAR *PathToWebLink = (const TCHAR *)ProgramPath.GetPath();
		
		String_256 CmdLine = PathToWebLink + String_256(" -f ") + FileWebAddress;
		//TCHAR *CommandLine = (TCHAR *)CmdLine;
		
		if (!InvokeWeblink(CmdLine))
			return FALSE;
		
	} // end of TRY block
	
	catch( CFileException )
	{
		// any disk problems - come here
		
		// not much we can do really - just close the file and return FALSE
		if (TempDiskFile.isOpen())
			TempDiskFile.close();
		
		return FALSE;
	}
#endif
		
	return TRUE;
}
void SystematicD10Builder::Build_Basis_Vectors(int Layer, std::vector<BasisVector>
						 Basis_Vectors)
{
 MIBVGenerator BV_Generator(Extension_Orders().at(Layer), Large_ST_Dimensions());
  if(Layer == 0)
    BV_Generator.Build_Full_Chunks(Initial_Common_Basis_Alphas());
  else
    {
      std::vector<BasisVector> All_Basis_Vectors = Initial_Model().BV_Set();
      for(int a=0; a<Layer; ++a)
	All_Basis_Vectors.push_back(Basis_Vectors.at(a));
      BasisAlphaBuilder BA_Builder(All_Basis_Vectors);
      BA_Builder.Build_Basis_Alphas();
      BA_Builder.Build_Common_Basis_Alphas();
      BV_Generator.Build_Full_Chunks(BA_Builder.Common_Basis_Alphas());
    }

  std::list<Chunk> LMs = BV_Generator.SP_LMs();
  std::list<Chunk> Obs = BV_Generator.RMs_Observable();
  std::list<Chunk> Hid = BV_Generator.RMs_Hidden();

  std::list<Chunk>::iterator itLMs = LMs.begin();
  std::list<Chunk>::iterator itObs = Obs.begin();
  std::list<Chunk>::iterator itHid = Hid.begin();

  std::list<Chunk>::iterator itLMs_End = LMs.end();
  std::list<Chunk>::iterator itObs_End = Obs.end();
  std::list<Chunk>::iterator itHid_End = Hid.end();

  Total_BVs_ += LMs.size()*Obs.size()*Hid.size();

  ChunkConsistencyChecker Checker(FF::LCM(2, Extension_Orders().at(Layer)),
				    Initial_Common_Basis_Alphas().
				    at(0).Denominator());

  for(; itLMs != itLMs_End; ++itLMs)
    {
      for(itObs = Obs.begin(); itObs != itObs_End; ++itObs)
	{
	  for(itHid = Hid.begin(); itHid != itHid_End; ++itHid)
	    {
	      if(Checker.Check_D10_Modular_Invariance(*itLMs, *itObs, *itHid))
		{
		  std::vector<int> New_BV;
		  for(int a=0; a<static_cast<int>(itLMs->BV_Chunk().size()); ++a)
		    New_BV.push_back(itLMs->BV_Chunk().at(a));
		  for(int a=0; a<static_cast<int>(itObs->BV_Chunk().size()); ++a)
		    New_BV.push_back(itObs->BV_Chunk().at(a));
		  for(int a=0; a<static_cast<int>(itHid->BV_Chunk().size()); ++a)
		    New_BV.push_back(itHid->BV_Chunk().at(a));

		  Basis_Vectors.at(Layer) = 
		    (BasisVector(New_BV, Extension_Orders().at(Layer), 
				  Large_ST_Dimensions()));
		  if(Layer == static_cast<int>(Extension_Orders().size())-1)
		    Consistent_BVs_++;
		  Build_Extensions(Layer+1, Basis_Vectors);
		}//Close if statement on modular invariance.
	    }//Close for loop on itHid.
	}//Close for loop on itObs.
    }//Close for loop on LMs.
}//Close Build_Basis_Vectors.
Exemple #12
0
int checker::program(ast::Program* program) {
    return Checker().program(program);
}
Exemple #13
0
void initDeadlocksChecker(Resourse_Allocation_Graph* graph) {
    if (!graph->isCheckerActive) {
        boost::thread threadForDetectingDeadlocks = boost::thread(Checker(graph));
        graph->isCheckerActive = true;
    }
}
Exemple #14
0
int main()
{
	int A, B, C, D;
	int _ret_val_0;
	bool completed[2];
	A=10;
	B=15;
	completed[1]=false;
	completed[0]=false;
	while (completed[1]==false)
	{
		bool check[1];
		while (completed[0]==false)
		{
			bool check[2];
			do
			{
				C=Compute(A, B);
				check[0]=Checker(A);
				if (check[0]==false)
				{
					if (Load(A)==false)
					{
						throw unrecoverable;
					}
				}
				check[1]=Checker(B);
				if (check[1]==false)
				{
					if (Load(B)==false)
					{
						throw unrecoverable;
					}
				}
			}while((check[0]==false)||(check[1]==false));
			
			if ((check[0]==true)&&(check[1]==true))
			{
				completed[0]=true;
			}
		}
		D=7;
		do
		{
			Store(C);
			check[0]=Checker(C);
			if (check[0]==false)
			{
				if (Recovery(C)==false)
				{
					throw unrecoverable;
				}
			}
		}while(check[0]==false);
		
		if (check[0]==true)
		{
			completed[1]=true;
		}
	}
	_ret_val_0=0;
	return _ret_val_0;
}
void MidStartSystematicBuilder::Build_Basis_Vectors(int Layer, 
						       std::vector<BasisVector>
						       Basis_Vectors)
{
  MIBVGenerator BV_Generator(Extension_Orders().at(Layer), Large_ST_Dimensions());
  if(Layer == 0)
  BV_Generator.Build_Full_Chunks(Initial_Common_Basis_Alphas());
  else
    {
      std::vector<BasisVector> All_Basis_Vectors = Initial_Model().BV_Set();
      for(int a=0; a<Layer; ++a)
	All_Basis_Vectors.push_back(Basis_Vectors.at(a));
      BasisAlphaBuilder BA_Builder(All_Basis_Vectors);
      BA_Builder.Build_Basis_Alphas();
      BA_Builder.Build_Common_Basis_Alphas();
      BV_Generator.Build_Full_Chunks(BA_Builder.Common_Basis_Alphas());
    }
  //DEBUG.
  std::cout<<"Layer: "<<Layer<<std::endl;
  //END DEBUG.
  std::list<Chunk> LMs;
  if(Simply_Paired_Layers().at(Layer))
    LMs = BV_Generator.SP_LMs();
  else
    LMs = BV_Generator.NSP_LMs();

  std::list<Chunk> Comp;
  if(Simply_Paired_Layers().at(Layer))
    Comp = BV_Generator.SP_RMs_Compact();
  else
    Comp = BV_Generator.NSP_RMs_Compact();

  std::list<Chunk> Obs = BV_Generator.RMs_Observable();
  std::list<Chunk> Hid = BV_Generator.RMs_Hidden();

  std::list<Chunk>::const_iterator itLMs = LMs.begin();
  std::list<Chunk>::const_iterator itObs = Obs.begin();
  std::list<Chunk>::const_iterator itComp = Comp.begin();
  std::list<Chunk>::const_iterator itHid = Hid.begin();

  if(!Layer_Built().at(Layer)) //If we haven't already built this layer before.
    {
      itLMs = Set_LM_Start_Point(LMs, Starting_Basis_Vectors().at(Layer));
      itComp = Set_Comp_Start_Point(Comp, 
				    Starting_Basis_Vectors().at(Layer));
      itObs = Set_Obs_Start_Point(Obs, Starting_Basis_Vectors().at(Layer));
      itHid = Set_Hid_Start_Point(Hid, Starting_Basis_Vectors().at(Layer));
      Layer_Built_.at(Layer) = true;
      }//Close if statement.

  std::list<Chunk>::const_iterator itLMs_End = LMs.end();
  std::list<Chunk>::const_iterator itObs_End = Obs.end();
  std::list<Chunk>::const_iterator itComp_End = Comp.end();
  std::list<Chunk>::const_iterator itHid_End = Hid.end();

  Total_BVs_ += LMs.size()*Obs.size()*Comp.size()*Hid.size();

  ChunkConsistencyChecker Checker(FF::LCM(2, Extension_Orders().at(Layer)),
				    Initial_Common_Basis_Alphas().at(0).
				    Denominator());

  for(; itLMs != itLMs_End; ++itLMs)
    {
      for(; itComp != itComp_End; ++itComp)
	{
	  for(; itObs != itObs_End; ++itObs)
	    {
	      //Make sure the pairings are good before proceeding.
	      if(!Simply_Paired_Layers().at(Layer) && 
		 !Checker.Check_Simultaneous_Periodic_Modes(*itLMs, *itComp))
		break;

	      for(; itHid != itHid_End; ++itHid)
		{
		  if(Checker.Check_Modular_Invariance(*itLMs, *itObs, 
						      *itComp, *itHid))
		    {
		      std::vector<int> New_BV;
		      for(int a=0; a<static_cast<int>(itLMs->BV_Chunk().size()); ++a)
			New_BV.push_back(itLMs->BV_Chunk().at(a));
		      for(int a=0; a<static_cast<int>(itObs->BV_Chunk().size()); ++a)
			New_BV.push_back(itObs->BV_Chunk().at(a));
		      for(int a=0; a<static_cast<int>(itComp->BV_Chunk().size()); ++a)
			New_BV.push_back(itComp->BV_Chunk().at(a));
		      for(int a=0; a<static_cast<int>(itHid->BV_Chunk().size()); ++a)
			New_BV.push_back(itHid->BV_Chunk().at(a));

		      Basis_Vectors.at(Layer) = 
			(BasisVector(New_BV, Extension_Orders().at(Layer),
				      Large_ST_Dimensions()));
		      if(Layer == static_cast<int>(Extension_Orders().size())-1)
			Consistent_BVs_++;
		      Build_Extensions(Layer+1, Basis_Vectors);
		    }//Close if statement on modular invariance.
		}//Close for loop on itHid.
	      itHid = Hid.begin();
	    }//Close for loop on itObs.
	  itObs = Obs.begin();
	}//Close for loop on itComp.
      itComp = Comp.begin();
    }//Close for loop on itLMs.
}//Close Build_Basis_Vectors.