コード例 #1
0
ファイル: edge.c プロジェクト: hossbeast/fab
int edge_key_compare_label(void * _ctx, const void * _e, size_t idx)
{
  struct edge_key_compare_label_context * ctx = _ctx;
  const edge * e = _e;

  if(ctx->A)
    ctx->lc = memncmp(ctx->A, ctx->len, e->A->label, e->A->label_len);
  else
    ctx->lc = memncmp(ctx->B, ctx->len, e->B->label, e->B->label_len);

  ctx->lx = idx;
  return ctx->lc;
}
コード例 #2
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void install_global_options_service_provider (void)
{

	//
	// Install service provider
	//

   service_provider_table_type
      *this_service;

   this_service = direct_play_get_service_provider_table ();

   while ( this_service )
   {

		if ( memncmp ( (unsigned char * ) this_service->guid, (unsigned char * ) &global_options.service_provider_guid, sizeof ( GUID ) ) == TRUE )
		{

			start_service_provider ( this_service );

//			add_service_provider_to_connection_message_list ( this_service->name );
		}

      this_service = this_service->next;
   }
}
コード例 #3
0
ファイル: query.c プロジェクト: hossbeast/fab
static int value_query_compare(void * ud, const void * _el, size_t idx)
{
  const value * el = _el;
  struct search_context * ctx = ud;
  ctx->idx = idx;

  // keys are strings
  return memncmp(ctx->key, ctx->len, el->s->s, el->s->l);
}
コード例 #4
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void notify_multi_player_setup (void)
{

	connection_data_type
		*this_connection;

	char
		text [10];

//	if ( get_ui_object_drawable ( obj ) )
//	{

		this_connection = direct_play_get_connection_data ();

		blit_front_buffer_to_render_buffer ();


		// Setup the service provider cycle button
#ifdef _WIN32
		if ( this_connection->service_provider.name )
		{
			if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_TCPIP, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_INTERNET"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_SERIAL"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_MODEM, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_MODEM"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_IPX, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_IPX"));
			}
        }
		else
		{
			set_ui_object_text (connection_type_button, get_trans ("MP_NO_SERVICE_PROVIDER"));
		}
#elif defined __unix__
if ( this_connection->service_provider.name )
		{
/*ö			if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_TCPIP, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_INTERNET"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_SERIAL"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_MODEM, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_MODEM"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_IPX, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_IPX"));
			}*/
        }
		else
		{
			set_ui_object_text (connection_type_button, get_trans ("MP_NO_SERVICE_PROVIDER"));
		}
#endif
		preprocess_translation_object_size (connection_type_bdrop, connection_type_button, NULL, 0, RESIZE_OPTION_BOX_TITLE);

		// initialise modem to first in list (? Shouldn't we store the current modem elsewhere - ie globally ?)

		current_modem = modem_name_list;

		if (!current_modem)
		{
			set_ui_object_text (modem_type_button, "No Modem Installed");
		}
		else
		{
			set_ui_object_text (modem_type_button, current_modem->name);
		}

		// Com port button

		sprintf (text, "%d", get_global_comms_port ());

		set_ui_object_text (com_port_button, text);

		// Baud rate

		set_ui_object_text (baud_rate_button, baud_rate_text [get_global_baud_rate () - 1]);

		// Stop bits

		set_ui_object_text (stop_bits_button, stop_bits_text [get_global_stop_bits () - 1]);

		// Parity

		set_ui_object_text (parity_button, parity_text [get_global_parity () - 1]);

		// Flow

		set_ui_object_text (flow_button, flow_text [get_global_flow () - 1]);

		// Phone Number

		set_ui_object_text (phone_number_text_obj, global_options.phone_number);

		// IP Address

		set_ui_object_text (ip_address_text_obj, global_options.ip_address);


		// Now setup the connection type areas

		set_multiplayer_options_display ();


		// Lastly load in the stuff for the screen
/*
		if ( multiplayer_screen_graphic )
		{

			destroy_texture_graphic ( multiplayer_screen_graphic );

			multiplayer_screen_graphic = NULL;
		}

		multiplayer_screen_graphic = create_texture_graphic ( "graphics\\ui\\cohokum\\multi.psd" );

		set_ui_object_texture_graphic ( multi_player_setup_area, multiplayer_screen_graphic );

		blit_front_buffer_to_render_buffer ();

		reset_time_values ( options_screen );
*/
//	}
//	else
//	{
/*
		if ( multiplayer_screen_graphic )
		{

			destroy_texture_graphic ( multiplayer_screen_graphic );

			multiplayer_screen_graphic = NULL;
		}
*/
//	}

	display_options_page (OPTIONS_PAGE_MULTIPLAYER);
}
コード例 #5
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void set_serial_connection_status ( void )
{

	char
		text_buffer [256];

	connection_data_type
		*this_connection;

	this_connection = direct_play_get_connection_data ();
#ifdef _WIN32
	if ( ( this_connection ) && ( this_connection->service_provider.guid ) )
	{

		if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
		{

			set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () );

			if ( direct_play_create_session ( 0 ) )
			{

				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED"));

				set_ui_object_text (serial_status_text, text_buffer);

				direct_play_close_session ();

				this_connection->is_initialised = TRUE;
			}
			else
			{

				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_INVALID_PROPERTIES"));

				set_ui_object_text (serial_status_text, text_buffer);

				this_connection->is_initialised = FALSE;
			}
		}
	}
#elif defined __unix__
if ( ( this_connection ) && ( this_connection->service_provider.guid ) )
	{

		if (1)//ö memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
		{

			set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () );

			if ( direct_play_create_session ( 0 ) )
			{

				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED"));

				set_ui_object_text (serial_status_text, text_buffer);

				direct_play_close_session ();

				this_connection->is_initialised = TRUE;
			}
			else
			{

				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_INVALID_PROPERTIES"));

				set_ui_object_text (serial_status_text, text_buffer);

				this_connection->is_initialised = FALSE;
			}
		}
	}
}