Пример #1
0
int main(int argc, char *argv[])
{
  list l = new_list(sizeof(int), NULL, NULL);
  int x = 10;
  int y = 11;
  int z = 12;
  app_to_list(l, &x);
  prep_to_list(l, &y);
  printf("\n");

  map_list(l, print);
  printf("\n");

  map_list(l, addTwo);

  map_list(l, print);
  printf("\n");

  map_compare_del(l, compareInts, &z);

  map_list(l, print);
  printf("\n");

  app_to_list(l, &x);
  prep_to_list(l, &y);  
  
  map_list(l, print);
  printf("\n");

  destroy_list(l);
  return 0;
}
Пример #2
0
void map_float(TTPtr self, t_float value)
{
	t_atom a;
	
	atom_setfloat(&a, value);
	map_list(self, _sym_float, 1, &a);
}
Пример #3
0
void map_int(TTPtr self, long value)
{
	t_atom a;
	
	atom_setlong(&a, value);
	map_list(self, _sym_int, 1, &a);
}
Пример #4
0
void		        expulse_task_function(t_server *server,
					      t_client *client,
					      char *arg)
{
  (void)arg;
  request_expulse(server, NULL, 0);
  map_list(server->clients, map_expulse_player, (void *)client);
  request_expulse(server, client, 2);
}
Пример #5
0
struct variable *variable_map_list(struct context *context,
                                   struct variable *indexable,
                                   struct array* (*map_list)(const struct map*))
{
    assert_message(indexable->type == VAR_LST, "values are only for list");
    struct variable *result = variable_new_list(context, NULL);
    if (NULL != indexable->list.map) {
        struct array *a = map_list(indexable->list.map);
        for (int i=0; i<a->length; i++) {
            struct variable *u = variable_copy(context, (struct variable*)array_get(a, i));
            array_add(result->list.ordered, u);
        }
        array_del(a);
    }
    return result;
}
Пример #6
0
void CUIMapList::UpdateMapList(EGameIDs GameType)
{
	typedef buffer_vector<shared_str>	MapList;

	m_pList1->Clear				();

	const SGameTypeMaps& M		= gMapListHelper.GetMapListFor(GameType);
	u32 cnt						= M.m_map_names.size();
	for (u32 i=0; i<cnt; ++i)
	{
		CUIListBoxItem* itm		= m_pList1->AddTextItem( CStringTable().translate(M.m_map_names[i].map_name).c_str() );
		itm->SetData			( (void*)(__int64)i );
		itm->Enable				(true);
	}
	
	u32 list_size				= m_pList2->GetSize();
	if ( list_size == 0 )
	{
		m_pList2->Clear			();
		return;
	}

	MapList		map_list( _alloca( sizeof(shared_str) * list_size ), list_size );

	for ( u32 i = 0; i < list_size; ++i )
	{
		LPCSTR st = m_pList2->GetText( i );
		map_list.push_back( st );
	}
	m_pList2->Clear();

	MapList::const_iterator itb = map_list.begin();
	MapList::const_iterator ite = map_list.end();
	for ( ; itb != ite; ++itb )
	{
		CUIListBoxItem* itm1 = GetMapItem_fromList1( *itb );
		if ( itm1 )
		{
			CUIListBoxItem* itm2 = m_pList2->AddTextItem( (*itb).c_str() );
			itm2->SetData( itm1->GetData() );
			itm2->Enable( true );
		}
	}
}
Пример #7
0
void map_bang(TTPtr self)
{
	map_list(self, _sym_bang, 0, NULL);
}