Ejemplo n.º 1
0
bool
PrefsWindow::QuitRequested(void)
{
	if (fChanges)
		SaveRules("/boot/home/config/settings/FilerRules",fRuleList);
	MakeEmpty();
	be_app->PostMessage(B_QUIT_REQUESTED);
	return true;
}
Ejemplo n.º 2
0
HRESULT CVCAConfigure::DoSave( DWORD dwEngId )
{
	VCA5_APP_ENGINE_CONFIG *pCfg = &(m_EngineConfig[dwEngId]);

//	SquishIds( pCfg );

	SaveZones( dwEngId, &(pCfg->Zones) );
	SaveRules( dwEngId, &(pCfg->Rules) );
	SaveCounters( dwEngId, &(pCfg->Counters) );
	SaveCalibration( dwEngId, &(pCfg->CalibInfo) );
	SaveObjects( dwEngId, &(pCfg->ClsObjects) );
	SaveTamper( dwEngId, &(pCfg->TamperInfo) );
	SaveSceneChange( dwEngId, &(pCfg->SceneChangeInfo) );
	SaveAdvanced( dwEngId, &(pCfg->AdvInfo) );

	return S_OK;
}
Ejemplo n.º 3
0
void GNMGenericNetwork::FlushCache()
{
    SaveRules();

    GNMNetwork::FlushCache();
}
Ejemplo n.º 4
0
PrefsWindow::PrefsWindow(void)
 :	BWindow(BRect(100,100,450,350),"Filer Settings",B_TITLED_WINDOW,
 			B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE),
 	fChanges(false)
{
	fRuleList = new BObjectList<FilerRule>(20,true);
	
	AddShortcut('a',B_COMMAND_KEY,new BMessage(M_SHOW_ADD_WINDOW));
	AddShortcut('e',B_COMMAND_KEY,new BMessage(M_SHOW_EDIT_WINDOW));
	
	BView *top = new BView(Bounds(),"top",B_FOLLOW_ALL,B_WILL_DRAW);
	top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(top);
	
	BRect rect(Bounds().InsetByCopy(10,10));
	rect.right -= B_V_SCROLL_BAR_WIDTH;
	
	fRuleItemList = new BListView(rect,"rulelist",B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL);
	fScrollView = new BScrollView("listscroll",fRuleItemList,
												B_FOLLOW_ALL,0,true,true);
	fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	top->AddChild(fScrollView);
	fRuleItemList->SetSelectionMessage(new BMessage(M_RULE_SELECTED));
	fRuleItemList->SetInvocationMessage(new BMessage(M_SHOW_EDIT_WINDOW));
	fScrollView->ScrollBar(B_HORIZONTAL)->SetRange(0.0,0.0);
	
	fAddButton = new BButton(BRect(0,0,1,1),"addbutton","Add…",
									new BMessage(M_SHOW_ADD_WINDOW),
									B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fAddButton->ResizeToPreferred();
	fAddButton->MoveTo(10,Bounds().bottom - 20 - (fAddButton->Bounds().IntegerHeight() * 2));
	top->AddChild(fAddButton);
	
	fScrollView->ResizeBy(0,(fAddButton->Bounds().IntegerHeight() * -2) - 20 - B_H_SCROLL_BAR_HEIGHT);
	
	fEditButton = new BButton(BRect(0,0,1,1),"editbutton","Edit…",
									new BMessage(M_SHOW_EDIT_WINDOW),
									B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fEditButton->ResizeToPreferred();
	fEditButton->MoveTo((Bounds().Width() - fEditButton->Bounds().Width()) / 2.0,
					fAddButton->Frame().top);
	top->AddChild(fEditButton);
	fEditButton->SetEnabled(false);
	
	
	fRemoveButton = new BButton(BRect(0,0,1,1),"removebutton","Remove",
									new BMessage(M_REMOVE_RULE),
									B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	fRemoveButton->ResizeToPreferred();
	fRemoveButton->MoveTo(Bounds().Width() - fRemoveButton->Bounds().Width() - 10,
					fAddButton->Frame().top);
	top->AddChild(fRemoveButton);
	fRemoveButton->SetEnabled(false);
	
	
	fMoveDownButton = new BButton(BRect(0,0,1,1),"movedownbutton","Move Down",
									new BMessage(M_MOVE_RULE_DOWN),
									B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fMoveDownButton->ResizeToPreferred();
	fMoveDownButton->MoveTo((Bounds().Width() / 2.0) + 10.0,
					fAddButton->Frame().bottom + 10.0);
	
	
	fMoveUpButton = new BButton(BRect(0,0,1,1),"moveupbutton","Move Up",
									new BMessage(M_MOVE_RULE_UP),
									B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	fMoveUpButton->ResizeTo(fMoveDownButton->Bounds().Width(), fMoveDownButton->Bounds().Height());
	fMoveUpButton->MoveTo((Bounds().Width() / 2.0) - fMoveUpButton->Bounds().Width() - 10.0,
					fAddButton->Frame().bottom + 10.0);
	
	top->AddChild(fMoveUpButton);
	top->AddChild(fMoveDownButton);
	
	fMoveUpButton->SetEnabled(false);
	fMoveDownButton->SetEnabled(false);
	
	
	float minwidth = (fRemoveButton->Bounds().Width() * 3.0) + 40;
	SetSizeLimits(minwidth, 30000, 200, 30000);
	
	LoadRules("/boot/home/config/settings/FilerRules",fRuleList);
	
	for (int32 i = 0; i < fRuleList->CountItems(); i++)
		fRuleItemList->AddItem(new RuleItem(fRuleList->ItemAt(i)));
	
	fRuleItemList->MakeFocus();
	if (fRuleItemList->CountItems() > 0)
		fRuleItemList->Select(0L);
	else
	{
		BAlert *alert = new BAlert("Filer","It appears that there aren't any rules for "
											"organizing files. Would you like Filer to "
											"add some basic ones for you?","No","Yes");
		if (alert->Go() == 1)
		{
			FilerRule *rule = new FilerRule();
			
			// NOTE: If actions 
			rule->AddTest(MakeTest("Type","is","text/plain"));
			rule->AddAction(MakeAction("Move it to…","/boot/home/Documents"));
			rule->SetDescription("Store text files in my Documents folder");
			AddRule(rule);
			
			rule = new FilerRule();
			rule->AddTest(MakeTest("Type","contains","x-vnd.gobe.productive"));
			rule->AddAction(MakeAction("Move it to…","/boot/home/Documents"));
			rule->SetDescription("Store Productive files in my Documents folder");
			AddRule(rule);
			
			rule = new FilerRule();
			rule->AddTest(MakeTest("Type","starts with","image/"));
			rule->AddAction(MakeAction("Move it to…","/boot/home/Pictures"));
			rule->SetDescription("Store pictures in my Pictures folder");
			AddRule(rule);
			
			rule = new FilerRule();
			rule->AddTest(MakeTest("Type","starts with","video/"));
			rule->AddAction(MakeAction("Move it to…","/boot/home/Videos"));
			rule->SetDescription("Store movie files in my Videos folder");
			AddRule(rule);
			
			rule = new FilerRule();
			rule->AddTest(MakeTest("Name","ends with",".zip"));
			rule->AddAction(MakeAction("Terminal command…","unzip %FULLPATH% -d /boot/home/Desktop"));
			rule->SetDescription("Extract ZIP files to the Desktop");
			AddRule(rule);
			
//			rule = new FilerRule();
//			rule->AddTest(MakeTest("","",""));
//			rule->AddAction(MakeAction("",""));
//			rule->SetDescription("");
//			AddRule(rule);
		}
		SaveRules("/boot/home/config/settings/FilerRules",fRuleList);
	}
}
Ejemplo n.º 5
0
int main(int argc, char **argv, char **env)
	{
	int i;
	int save_flag=0;
	char *save_file=NULL;


	
	if(sizeof(Term)!=4)
		{
		puts("Compilation error");
		return -1;
		}

	if(argc>1 && strcmp(argv[1],"-exv")==0)
		{
		exv(argc-1,argv+1);
		return 0;
		}

	InitAtoms();
	InitFuncs();
	AlwaysBracets = 0;
	WideWriting = 0;
	signal(SIGINT, stop);
	signal(SIGSEGV, sigsegv);
	signal(SIGUSR1, sigdmp);
	

	for(i=1; i<argc; i++)
		{
		if(strcmp(argv[i],"-v")==0)
			{
			VerbMode=1;
			continue;
			}
		if(strcmp(argv[i],"-vv")==0)
			{
			VerbMode=2;
			continue;
			}
		if(strcmp(argv[i],"-vvv")==0)
			{
			VerbMode=3;
			continue;
			}
		if(strcmp(argv[i],"-c4")==0)
			{
			ChepVersion=4;
			continue;
			}	
		if(strcmp(argv[i],"-c3")==0)
			{
			ChepVersion=3;
			continue;
			}	
		if(strcmp(argv[i],"-mOmega")==0)
			{
			ChepVersion=4;
			MicroOmega=1;
			continue;
			}	
		if(strcmp(argv[i],"-OutDir")==0)
			{
			OutputDirectory=argv[++i];
			continue;
			}
		if(strcmp(argv[i],"-InDir")==0)
			{
			InputDirectory=argv[++i];
			continue;
			}
		if(strcmp(argv[i],"-allvrt")==0)
			{
			write_all_vertices=1;
			continue;
			}
		if(strcmp(argv[i],"-rc")==0)
			{
			InitFile=argv[++i];
			continue;
			}
		if(strcmp(argv[i],"-tex")==0)
			{
			TexOutput=1;
			opSplitCol1=0;
			continue;
			}
		if(strcmp(argv[i],"-feynarts")==0 || strcmp(argv[i],"-FeynArts")==0)
			{
			FAOutput=1;
			opSplitCol1=0;
			opSplitCol2=0;
			continue;
			}
		if(strcmp(argv[i],"-feynarts6")==0 || strcmp(argv[i],"-FeynArts6")==0 ||
				strcmp(argv[i],"-fa6")==0)
			{
			FAOutput=1;
			FAver=6;
			opSplitCol1=0;
			opSplitCol2=0;
			continue;
			}
		if(strcmp(argv[i],"-uf")==0 || strcmp(argv[i],"-UF")==0)
			{
			UFOutput=1;
			opSplitCol1=0;
			opSplitCol2=0;
			continue;
			}
		if(strcmp(argv[i],"-save")==0)
			{
			save_flag=1;
			save_file=argv[++i];
			printf("Feynman rules will be saved in '%s' file.\n",save_file);
			continue;
			}
		if(strcmp(argv[i],"-eval-prm")==0)
			{
			EvalPrm=1;
			continue;
			}
		if(strcmp(argv[i],"-eval-vrt")==0)
			{
			EvalVrt=1;
			continue;
			}
		if(strcmp(argv[i],"-frc")==0)
			{
			ForsedRedCol=1;
			continue;
			}
		if(strcmp(argv[i],"-nocolor")==0)
			{
			NoColors=1;
			continue;
			}
		if(strcmp(argv[i],"-colors")==0)
			{
			WriteColors=1;
			continue;
			}
        if(strcmp(argv[i],"-no4color")==0)
			{
            No4Color=1;
			continue;
            }
		if(strcmp(argv[i],"-nocdot")==0)
			{
			TEX_set_dot=0;
			continue;
			}
		if(strcmp(argv[i],"-v-charges")==0)
			{
			verb_charge=1;
			continue;
			}
		if(strcmp(argv[i],"-v-herm")==0)
			{
			verb_herm=1;
			continue;
			}
		if(strcmp(argv[i],"-v-imprt")==0)
			{
			verb_imprt=1;
			continue;
			}
		if(strcmp(argv[i],"-off-srefine")==0)
			{
			off_srefine=1;
			continue;
			}
		if(strcmp(argv[i],"-chep-srefine")==0)
			{
			ch_sign=1;
			continue;
			}
		if(strcmp(argv[i],"-texLines")==0)
			{
			sscanf(argv[++i],"%d",&TEX_lines);
			continue;
			}
		if(strcmp(argv[i],"-texLineLength")==0)
			{
			sscanf(argv[++i],"%d",&TEX_spec_in_line);
			continue;
			}
		if(strcmp(argv[i],"-texMaxPrtNo")==0)
			{
			sscanf(argv[++i],"%d",&TEX_max_pno);
			continue;
			}
		if(strncmp(argv[i],"-abbr",5)==0)
			{
			if(eval_vrt_len)
				{
				puts("Error: -evl and -abbr options are not compatible");
				continue;
				}
			opAbbrVrt=1;
			opAbbArr=1;
			opEvalVrt=0;
			opTriHeu=0;
			if(argv[i][5]>'1' && argv[i][5]<'9')
				opAbbrVrt=argv[i][5]-'1'+1;
			if(argv[i][5]=='A')
				opAbbArr=0;
			opNoDummies=1;
			continue;
			}
		if(strcmp(argv[i],"-evl")==0)
			{
			if(opAbbrVrt)
			{
				puts("Error: -evl and -abbr options are not compatible");
				i++;
				continue;
			}
			sscanf(argv[++i],"%d",&eval_vrt_len);
			if(eval_vrt_len==2)
			{
				opNoDummies=1;
				eval_vrt_more=1;
				/*kill_gamma_pm=1;*/
			}
			continue;
			}
		if(strcmp(argv[i],"-sleep")==0)
			{
			int sec;
			sscanf(argv[++i],"%d",&sec);
			sleep(sec*60);
			continue;
			}
		if(strcmp(argv[i],"-key")==0)
			{
			SetKeyFromArg(argv[++i]);
			continue;
			}
		if(strcmp(argv[i],"-edbg")==0)
			{
			end_with_tty=1;
			continue;
			}
		if(strcmp(argv[i],"-norc")==0)
			{
			remove_rc=1;
			continue;
			}
		if(argv[i][0]=='-')
			{
			ErrorInfo(0);
			printf(": unknown option %s.\n",argv[i]);
			continue;
			}
		if(InputFile)
			{
			ErrorInfo(0);
			printf(": unknown option %s.\n",argv[i]);
			continue;
			}
		InputFile=argv[i];
		}

	if(!write_all_vertices && !TexOutput)
	{
		if(FAOutput)
			opMaxiLegs=4;
		else
			opMaxiLegs=4;
	}

	if(UFOutput)
	{
		FAOutput=1;
		opAbbrVrt=1;
		opAbbArr=0;
		opEvalVrt=0;
		opTriHeu=0;
		opNoDummies=1;
	}
		
	if(MicroOmega)
		SetKeyFromArg("MicrOmega=1");
	else
		SetKeyFromArg("MicrOmega=0");
	
	if(FAOutput)
		SetKeyFromArg("FeynArts=1");
	else
		SetKeyFromArg("FeynArts=0");
		
	if(InputDirectory==NULL)
		{
		InputDirectory=find_path(argv[0],env);
		if(VerbMode)
			printf("Input directory is '%s'\n",InputDirectory);
		}
	doinitfile=1;	
    ReadFile(InitFile);
	doinitfile=0;
	if(InputFile!=NULL)
		ReadFile(InputFile);
	else
		{
		printf(
"Welcome to LanHEP                                Version 3.1.1  (Nov 08 2010)\n");
		/*
		log_file=fopen("lhep.log","w");
		if(log_file==NULL)
			printf("Warning: can not open file lhep.log for writing.\n");
		*/
		ReadFile(NULL);
		if(log_file!=NULL)
			{
			fclose(log_file);
			log_file=0;
			}
		}

puts("");

/*	AtomStatistics();
	ListStatistics();
*/
	if(save_flag)
		{
		Term t;
		SaveRules(save_file);
		if(itrSetIn("q.sav")==0)
			return 0;

		while((t=itrIn())!=0)
			{
			WriteTerm(t);
			puts("");
			}

		itrCloseIn();

		return 0;
		}

	if(ModelNumber!=0 || InputFile!=NULL)
		{
		if(MicroOmega)
			ModelNumber=1;
		RegisterLine("MAIN: writing lagrangian.");
		WriteLagrFile(ModelNumber,ModelName);
		UnregisterLine();
		RegisterLine("MAIN: writing parameters and particles.");
		WriteParameters(ModelNumber,ModelName);
		WriteParticles(ModelNumber,ModelName);
		if(MicroOmega)
		{
			ModelNumber=2;
			SecondVaFu=1;
			WriteParameters(ModelNumber,ModelName);
		}
		UnregisterLine();
		WriteExtlib(ModelNumber,ModelName);
		WriteCpart(ModelNumber,ModelName);
		
		if(!TexOutput && !FAOutput && C_F_WIDTH<longest_cfline)
		{
			printf("Error: 'Common Factor' field longer than maximum of %d symbols.\n",
					C_F_WIDTH);
			printf("Use the statement 'option chepCFWidth=%d.'\n",longest_cfline+1);
		}
		if(!TexOutput && !FAOutput && L_P_WIDTH<longest_lpline)
		{
			printf("Error: 'Lorentz part' field longer than maximum of %d symbols.\n",
					L_P_WIDTH);
			printf("Use the statement 'option chepLPWidth=%d.'\n",longest_lpline+1);
		}
		if(!TexOutput && !FAOutput && P_D_WIDTH<longest_pdline)
		{
			if(P_D_WIDTH)
			{
			printf("Error: 'Parameter expression' field for '%s' is longer than maximum of %d symbols.\n",
					AtomValue(llparam),P_D_WIDTH);
			printf("Use the statement 'option chepPDWidth=%d.'\n",longest_pdline+1);
			}
			else if(longest_pdline>100)
				printf("Longest parameter expression is %d symbols for '%s'.\n",longest_pdline,
					AtomValue(llparam));
		}
		
		if(!TexOutput && !FAOutput && VerbMode)
			{
			printf("Longest Common factor line is %d symbols (max %d)\n",
											longest_cfline,C_F_WIDTH);
			printf("Longest Lorentz part  line is %d symbols (max %d)\n",
											longest_lpline,L_P_WIDTH);
			printf("Longest Parameter dep line is %d symbols (max %d)\n\n",
											longest_pdline,P_D_WIDTH);
			}
		}
/*
	else
		puts("Model # is zero");
*/
	if(VerbMode)
		{
		int i;
		printf("%5.1fMB of memory used.\n",
			(ListMemory()+TermMemory())*0.001);
		abbr_stat();
		/*AtomStatistics();
		ListStatistics();
		for(i=0;i<10;i++)
			if(inf_removed[i]) printf("%d pwr of inf: %d\n",i,inf_removed[i]);*/
		}

	if(err_cnt)
		puts("!!!!!!!!!!!!! THERE WERE ERRORS DURING PROCESSING !!!!!!!!");
		
		if(end_with_tty)
		{
			ReadFile(NULL);
			puts("");
		}
		
	return 0;
	}