Пример #1
0
void Tablero::Update(){


	for(unsigned int i=0;i<m_pLogics.size();++i)
		m_pLogics[i]->Update();

	CheckRules();
}
bool CommandMenu::LoadFromKeyValuesInternal(KeyValues * key, int depth)
{
	char text[255];
	KeyValues * subkey = NULL;

	if ( depth > 100 )
	{
		Msg("CommandMenu::LoadFromKeyValueInternal: depth > 100.\n");
		return false;
	}

	V_strncpy( text,  key->GetString("custom"), sizeof(text) );	 // get type

	if  ( text[0] ) 
	{
		AddMenuCustomItem( key ); // do whatever custom item wants to
		return true;
	}
	
	if ( !CheckRules( key->GetString("rule"), key->GetString("ruledata") ) )
	{	
		return true;
	}

	// rules OK add subkey
	V_strncpy( text,  key->GetString("toggle"), sizeof(text) );	 // get type

	if ( text[0] )
	{
		AddMenuToggleItem( key );
		return true;
	}

	V_strncpy( text,  key->GetString("command"), sizeof(text) );	 // get type

	if ( text[0] )
	{
		AddMenuCommandItem( key );
		return true;
	}

	// not a command, nor a toggle. Must be a submenu:
		
	StartNewSubMenu( key );	// create submenu

	// iterate through all subkeys

	subkey = key->GetFirstSubKey();

	while ( subkey )
	{
		if ( subkey->GetDataType() == KeyValues::TYPE_NONE )
		{
			LoadFromKeyValuesInternal( subkey, depth+1 ); // recursive call
		}

		subkey = subkey->GetNextKey();
	}

	FinishSubMenu(); // go one level back
	
	return true;
}
Пример #3
0
void
slice_wizard(Disk *d)
{
    Disk *db;
    char myprompt[BUFSIZ];
    char input[BUFSIZ];
    char *p,*q=0;
    char **cp,*cmds[200];
    int ncmd,i;

    systemSuspendDialog();
    sprintf(myprompt,"%s> ", d->name);
    while(1) {
	printf("--==##==--\n");
	Debug_Disk(d);
	p = CheckRules(d);
	if (p) {
	    printf("%s",p);
	    free(p);
	}
	printf("%s", myprompt);
	fflush(stdout);
	q = p = fgets(input,sizeof(input),stdin);
	if(!p)
	    break;
	for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;)
	    if (**cp != '\0')
		cp++;
	ncmd = cp - cmds;
	if(!ncmd)
	    continue;
	if (!strcasecmp(*cmds,"quit")) { break; }
	if (!strcasecmp(*cmds,"exit")) { break; }
	if (!strcasecmp(*cmds,"q")) { break; }
	if (!strcasecmp(*cmds,"x")) { break; }
	if (!strcasecmp(*cmds,"delete") && ncmd == 2) {
	    printf("delete = %d\n",
		   Delete_Chunk(d,
				(struct chunk *)strtol(cmds[1],0,0)));
	    continue;
	}
	if (!strcasecmp(*cmds,"allfreebsd")) {
	    All_FreeBSD(d, 0);
	    continue;
	}
	if (!strcasecmp(*cmds,"dedicate")) {
	    All_FreeBSD(d, 1);
	    continue;
	}
	if (!strcasecmp(*cmds,"bios") && ncmd == 4) {
	    Set_Bios_Geom(d,
			  strtol(cmds[1],0,0),
			  strtol(cmds[2],0,0),
			  strtol(cmds[3],0,0));
	    continue;
	}
	if (!strcasecmp(*cmds,"list")) {
	    cp = Disk_Names();
	    printf("Disks:");
	    for(i=0;cp[i];i++) {
		printf(" %s",cp[i]);
		free(cp[i]);
	    }
	    free(cp);
	    continue;
	}
#ifdef PC98
	if (!strcasecmp(*cmds,"create") && ncmd == 7) {
	    printf("Create=%d\n",
		   Create_Chunk(d,
				strtol(cmds[1],0,0),
				strtol(cmds[2],0,0),
				strtol(cmds[3],0,0),
				strtol(cmds[4],0,0),
				strtol(cmds[5],0,0),
				cmds[6]));
	    continue;
	}
#else
	if (!strcasecmp(*cmds,"create") && ncmd == 6) {
	    printf("Create=%d\n",
		   Create_Chunk(d,
				strtol(cmds[1],0,0),
				strtol(cmds[2],0,0),
				strtol(cmds[3],0,0),
				strtol(cmds[4],0,0),
				strtol(cmds[5],0,0), ""));
	    continue;
	}
#endif
	if (!strcasecmp(*cmds,"read")) {
	    db = d;
	    if (ncmd > 1)
		d = Open_Disk(cmds[1]);
	    else
		d = Open_Disk(d->name);
	    if (d)
		Free_Disk(db);
	    else
		d = db;
	    continue;
	}
	if (!strcasecmp(*cmds,"scan")) {
	    Scan_Disk(d);
	    continue;
	}
	if (!strcasecmp(*cmds,"write")) {
	    printf("Write=%d\n",
		   Fake ? 0 : Write_Disk(d));
	    q = strdup(d->name);
	    Free_Disk(d);
	    d = Open_Disk(q);
	    continue;
	}
	if (strcasecmp(*cmds,"help"))
	    printf("\007ERROR\n");
	printf("CMDS:\n");
	printf("allfreebsd\t\t");
	printf("dedicate\t\t");
	printf("bios cyl hd sect\n");
	printf("collapse [pointer]\t\t");
#ifdef PC98
	printf("create offset size enum subtype flags name\n");
#else
	printf("create offset size enum subtype flags\n");
#endif
	printf("subtype(part): swap=1, ffs=7\t\t");
	printf("delete pointer\n");
	printf("list\t\t");
	printf("quit\n");
	printf("read [disk]\t\t");
	printf("scan\n");
	printf("write\t\t");
	printf("\n");

    }
    systemResumeDialog();
}
Пример #4
0
void RuleFilterConnector::OnRunThreadCommand(GML::ML::ConnectorThreadData &thData,UInt32 threadCommand)
{
	CheckRules(thData);
}