Exemple #1
0
CXRefreshBHO::CXRefreshBHO():
m_BrowserId(NULL_BROWSER),
m_Logger(NULL_BROWSER),
m_ConnectionManager(this),
m_Paused(false)
{
	InitRoot();
	DT(TRACE_I(FS(_T("BHO[%08X]: constructor"), this)));
}
// CUpgradrHelperbar
CUpgradrHelperbar::CUpgradrHelperbar():
m_BandId(0), 
m_ViewMode(0),
m_BrowserId(NULL_BROWSER),
m_Toolbar(TOOLBARCLASSNAME, this, ALT_MAP_HELPERBAR_TOOLBAR),
m_UnpinButtonIndex(-1)
{
	InitRoot();
	DT(TRACE_I(FS(_T("Helperbar[%08X]: constructor"), this)));
}
// wird für jedes zu öffnende Item gerufen
BOOL CObjectClassStatistics::PopulateItem(HTREEITEM hParent)
{
	if (TVI_ROOT == hParent) 
		return InitRoot();

// Itemspezifische Funktion rufen
CItemCallback *pItemCB = reinterpret_cast<CItemCallback *>(GetItemData(hParent));

	_ASSERTE(NULL != pItemCB);
	return pItemCB->PopulateItem(this, hParent);
}
int main() {
  ChainBinTree *root = NULL;
  char select;
  void (*oper1)(); //指向函数的指针
  oper1 = oper;
  do {

    printf("\n1.设置二叉树根元素    2.添加二叉树结点\n");
    printf("3.前序遍历    4.中序遍历\n");
    printf("5.后序遍历    6.二叉树深度\n");
    printf("0.退出\n");
    printf("你的选择:");
    select = getchar();
    switch (select) {
      case '1':
        root = InitRoot();
        break;
      case '2':
        AddNode(root);
        break;
      case '3':
        printf("------------------------------\n");
        printf("前序遍历的结果:\n");
        BinTree_DLR(root,oper1);

        printf("------------------------------\n");
        break;
      case '4':
        printf("------------------------------\n");
        printf("中序遍历的结果:\n");
        BinTree_LDR(root,oper1);
        printf("------------------------------\n");
        break;
      case '5':
        printf("------------------------------\n");
        printf("后序遍历的结果:\n");
        BinTree_LRD(root,oper1);
        printf("------------------------------\n");
        break;
      case '6':
        printf("------------------------------\n");
        printf("二叉树的深度为:%d\n", Depth(root));
        printf("------------------------------\n");
        break;
      case '0':
        break;
      }
      getchar(); //抵消 \n
    }while(select!='0');
    Clear(root);
    return 0;

}
Exemple #5
0
void BinTreeTest() {
	LinkedBinTree *root=NULL;
	int select;
	void (*oper1)();
	oper1=oper;

	do {
		printf("\n1.设置二叉树根元素    2.添加二叉树结点\n");
		printf("3.先序遍历            4.中序遍历\n");
		printf("5.后序遍历            6.按层遍历\n");
		printf("7.二叉树深度          0.退出\n");
		scanf("%d", &select);
		switch(select){
			case 1: //设置根元素
				 root=InitRoot();
				 break;
			case 2: //添加结点
				 AddNode(root);
				 break;
			case 3://先序遍历
				 printf("\n先序遍历的结果:");
				 BinTree_DLR(root,oper1);
				 printf("\n");
				 break;
			case 4://中序遍历
				 printf("\n中序遍历的结果:");
				 BinTree_LDR(root,oper1);
				 printf("\n");
				 break;
			case 5://后序遍历
				 printf("\n后序遍历的结果:");
				 BinTree_LRD(root,oper1);
				 printf("\n");
				 break;
			case 6://按层遍历
				 printf("\n按层遍历的结果:");
				 BinTree_Level(root,oper1);
				 printf("\n");
				 break;
			case 7://二叉树的深度
				printf("\n二叉树深度为:%d\n",BinTreeDepth(root));
				break;
			case 0:
				 break;
		}
	} while(select!=0);

	BinTreeClear(root);
	root=NULL;
}
Exemple #6
0
BOOL CIndexTreeBlockFile::Init(CDurableFileController* pcDurableFileControl, char* szRootFileName, CMallocator* pcMalloc)
{
	//The DurableFileControl must be begun before .Init is called and should be ended afterwards.

	BOOL	bResult;

	CIndexTreeBlock::Init(pcMalloc, sizeof(CIndexTreeNodeFile), sizeof(SIndexTreeChildFile));

	mpcDurableFileControl = pcDurableFileControl;
	mcIndexFiles.Init(mpcDurableFileControl, "IDAT", "Index.IDX", "_Index.IDX");

	bResult = InitRoot(szRootFileName);
	if (!bResult)
	{
		return FALSE;
	}
	return TRUE;
}
Exemple #7
0
// CXRefreshToolbar
CXRefreshToolbar::CXRefreshToolbar():
m_Toolbar(TOOLBARCLASSNAME, this, ALT_MAP_TB_TOOLBAR),
m_dwBandId(0), 
m_dwViewMode(0), 
m_iToolbarHeight(22)
{
	InitRoot();
	DT(TRACE_I(FS(_T("Toolbar[%08X]: constructor"), this)));

	m_ToolbarBitmap.LoadBitmap(MAKEINTRESOURCE(IDB_ICONS));
	if (m_ToolbarBitmap.IsNull()) throw CXRefreshWindowsError(GetLastError());
	CDPIHelper::ScaleBitmap(m_ToolbarBitmap);

	m_ToolbarMaskBitmap.LoadBitmap(MAKEINTRESOURCE(IDB_ICONS));
	if (m_ToolbarMaskBitmap.IsNull()) throw CXRefreshWindowsError(GetLastError());
	CDPIHelper::ScaleBitmap(m_ToolbarMaskBitmap);

	int width = (int)CDPIHelper::ScaleX(16);
	int height = (int)CDPIHelper::ScaleY(16);
	m_kImageList.Create(width, height, ILC_COLOR24 | ILC_MASK, 3, 3);
	if (m_kImageList.IsNull()) throw CXRefreshWindowsError(GetLastError());
	if (m_kImageList.Add(m_ToolbarBitmap, m_ToolbarMaskBitmap) == -1) throw CXRefreshWindowsError(GetLastError());
}
Exemple #8
0
int main(int argc, char **argv)
{
	CUNICODE_STRING us;
	THREAD *initial_thread = NULL;
	const char *exename;


	ParseOptions( argc, argv );

	if (optind == argc)
	{
		// default to starting smss.exe
		exename = "\\??\\c:\\winnt\\system32\\smss.exe";
	}
	else
	{
		exename = argv[optind];
	}

	// Read debug channels options
	DebugInit();

	// the skas3 patch is deprecated...
	if (0) InitSkas();

	// pass our path so thread tracing can find the client stub
	InitTt( argv[0] );
	if (!pCreateAddressSpace)
		Die("no way to manage address spaces found\n");

	if (!TraceIsEnabled("core"))
	{
		// enable backtraces
		signal(SIGSEGV, SegvHandler);
		signal(SIGABRT, AbortHandler);
	}

	if (RegistryIndex >= 0)
	{
		TRACE("created registry: %s\n",registry_list[RegistryIndex].name);
		Registry = registry_list[RegistryIndex].create();
	}
	else
	{
		TRACE("created registry: xml\n");
		Registry = REGISTRY_XML::Create();
	}

	// quick sanity test
	ALLOCATION_BITMAP::Test();

	// initialize boottime
	SYSTEM_TIME_OF_DAY_INFORMATION dummy;
	GetSystemTimeOfDay( dummy );

	FIBER::FibersInit();
	InitRoot();
	CreateDirectoryObject( (PWSTR) L"\\" );
	CreateDirectoryObject( (PWSTR) L"\\??" );
	CUNICODE_STRING link_name, link_target;
	link_name.Set( L"\\DosDevices" );
	link_target.Copy( L"\\??" );
	CreateSymlink( link_name, link_target );
	CreateDirectoryObject( (PWSTR) L"\\Device" );
	CreateDirectoryObject( (PWSTR) L"\\Device\\MailSlot" );
	CreateDirectoryObject( (PWSTR) L"\\Security" );
	//create_directory_object( (PWSTR) L"\\DosDevices" );
	CreateDirectoryObject( (PWSTR) L"\\BaseNamedObjects" );
	CreateSyncEvent( (PWSTR) L"\\Security\\LSA_AUTHENTICATION_INITIALIZED" );
	CreateSyncEvent( (PWSTR) L"\\SeLsaInitEvent" );
	InitRandom();
	InitPipeDevice();
	// XP
	CreateDirectoryObject( (PWSTR) L"\\KernelObjects" );
	CreateSyncEvent( (PWSTR) L"\\KernelObjects\\CritSecOutOfMemoryEvent" );
	InitDrives();
	InitNtDLL();
	CreateKThread();

	us.Copy( exename );

	int r = CreateInitialProcess( &initial_thread, us );
	if (r < STATUS_SUCCESS)
		Die("create_initial_process() failed (%08x)\n", r);

	// run the main loop
	Schedule();

	NtGdiFini();
	r = initial_thread->Process->ExitStatus;
	//fprintf(stderr, "process exited (%08x)\n", r);
	Release( initial_thread );

	ShutdownKThread();
	DoCleanup();

	FreeRoot();
	FIBER::FibersFinish();
	FreeNtDLL();

	return r;
}
Exemple #9
0
int main(int argc,char * argv[])
{
  try
  {
    InitRoot();
    gStyle->SetOptStat(0);
//    TApplication application("app",&argc,argv);
    Signals::Signal sig(3.125/SignalBinDiv);
    sig.SetSignalLength(3.125*SignalBins);
    sig.SetSignalUnit("fC/0.5ns");
    CreateLSSignal(sig,10,10,15,20,
                   40,8,-0.1);
    std::cout<<"Integral :"<<sig.IntegralAbove(0)*sig.GetSignalBinTime()<<std::endl;
    TGraph * graph=sig.Graph();
    canvas=new TCanvas;
    graph->Draw("AL");
    canvas->Update();
    canvas->Print("CustomSignal.pdf");
    TH2D * charge=new TH2D("charge","charge",10,0,100,10,0,100);
    charge->GetXaxis()->SetTitle("plateau time/ns");
    charge->GetXaxis()->SetTitleOffset(1.5);
    charge->GetYaxis()->SetTitle("plateau amplitude/(fC/0.5ns)");
    charge->GetYaxis()->SetTitleOffset(1.5);
    charge->GetZaxis()->SetTitle("-total charge/pC");
    charge->GetZaxis()->SetTitleOffset(1.2);
    TH2D * toht=new TH2D("toht","toht",10,0,100,10,0,100);
    toht->GetXaxis()->SetTitle("plateau time/ns");
    toht->GetXaxis()->SetTitleOffset(1.5);
    toht->GetYaxis()->SetTitle("plateau amplitude/(fC/0.5ns)");
    toht->GetYaxis()->SetTitleOffset(1.5);
    toht->GetZaxis()->SetTitle("first time over threshold/ns");
    toht->GetZaxis()->SetTitleOffset(1.2);
    TH2D * leading=new TH2D("leading","leading",10,0,100,10,0,100);
    leading->GetXaxis()->SetTitle("plateau time/ns");
    leading->GetXaxis()->SetTitleOffset(1.5);
    leading->GetYaxis()->SetTitle("plateau amplitude/(fC/0.5ns)");
    leading->GetYaxis()->SetTitleOffset(1.5);
    leading->GetZaxis()->SetTitle("Leading high treshold time/ns");
    leading->GetZaxis()->SetTitleOffset(1.2);
    TH2D * trailing=new TH2D("trailing","trailing",10,0,100,10,0,100);
    trailing->GetXaxis()->SetTitle("plateau time/ns");
    trailing->GetXaxis()->SetTitleOffset(1.5);
    trailing->GetYaxis()->SetTitle("plateau amplitude/(fC/0.5ns)");
    trailing->GetYaxis()->SetTitleOffset(1.5);
    trailing->GetZaxis()->SetTitle("trailing high threshold time/ns");
    trailing->GetZaxis()->SetTitleOffset(1.2);
    TH2D * ltoht=new TH2D("ltoht","ltoht",10,0,100,10,0,100);
    ltoht->GetXaxis()->SetTitle("plateau time/ns");
    ltoht->GetXaxis()->SetTitleOffset(1.5);
    ltoht->GetYaxis()->SetTitle("plateau amplitude/(fC/0.5ns)");
    ltoht->GetYaxis()->SetTitleOffset(1.5);
    ltoht->GetZaxis()->SetTitle("last time over threshold/ns");
    ltoht->GetZaxis()->SetTitleOffset(1.2);
    for(unsigned int time=0;time<100;time+=10)
    {
      for(unsigned int amplitude=10;amplitude<100;amplitude+=10)
      {
        CreateLSSignal(sig,10,10,time,20,amplitude,amplitude*0.2,-0.1);
        sig.Scale(-1);
        charge->SetBinContent(time/10+1,amplitude/10+1,-sig.IntegralBelow(0)*sig.GetSignalBinTime()*1E-3);
        unsigned int resulttoht=ProcessSignal(sig,IntToStr(time)+"x"+IntToStr(amplitude));
        std::cout<<"set"<<time<<":"<<amplitude<<":"<<resulttoht<<std::endl;
        toht->SetBinContent(time/10+1,amplitude/10+1,resulttoht);
        leading->SetBinContent(time/10+1,amplitude/10+1,leadingb);
        trailing->SetBinContent(time/10+1,amplitude/10+1,trailingb);
        ltoht->SetBinContent(time/10+1,amplitude/10+1,lastbinblock);
      }
    }
    charge->Draw("lego1");
    canvas->Update();
    canvas->Print("charge.pdf");
    toht->Draw("lego1");
    canvas->Update();
    canvas->Print("toht.pdf");
    leading->Draw("lego1");
    canvas->Update();
    canvas->Print("leading.pdf");
    trailing->Draw("lego1");
    canvas->Update();
    canvas->Print("trailing.pdf");
    ltoht->Draw("lego1");
    canvas->Update();
    canvas->Print("ltoht.pdf");
//    application.Run(kTRUE);
  }
  catch(const char *e)
  {
    std::cout<<e<<std::endl;
    throw;
  }

  return 0;
}