Ejemplo n.º 1
0
int main(int argc, char *argv[])
{

    char carray[5] = {'a','b','c','d','e'};
    int ix = 11111;
    float fx = -0.75; 

    int idx; 

    //validate the command line 
    if( argc < 2  || !((strcasecmp(argv[1], "-all") == 0)   
		   || (strcasecmp(argv[1], "-char") == 0) 
		   || (strcasecmp(argv[1], "-int") == 0 ) 
		   || (strcasecmp(argv[1], "-fl") == 0 )))  
    {

       printf ("%s", "Invalid input: ");
       //display the command line input
       for (idx = 0; idx<argc; idx++)
       {
          printf ("argv[%d] = %s ", idx, argv[idx]); 
       }
   	printf ("\n"); 
       printf ( "%s\n", "The input format: program -[all, char, int, fl] number\n"); 

    } else {

    	if (strcasecmp(argv[1], "-char") == 0) 
        {
                print_format = PRINT_CHAR; 
        	printf("show_bytes...\n");
    		show_bytes(carray, 5);
    		//show_pointer(carray);

	}
    	if (strcasecmp(argv[1], "-int") == 0) 
        {
                print_format = PRINT_INT; 
                show_int(ix);
    		show_pointer(&ix);
        }
    	if (strcasecmp(argv[1], "-fl") == 0) 
        {
                print_format = PRINT_FLOAT; 
                show_float(fx);
    		show_pointer(&fx);
        }
   }
//    printf("show_bytes...\n");
//    show_bytes(carray, 5);
//    show_int(ix);
//    show_float(fx);
}
Ejemplo n.º 2
0
int main() {
	int intVariable = 10;
	float floatVariable = 2.5f;
	int* intPointer = &intVariable;
	int intValue = *intPointer;
	short shortVariable = 10;
	long longVariable = 65535;
	double doubleVariable = 0.000125f;

	printf("int:");
	show_int(intVariable);

	printf("float:");
	show_float(floatVariable);

	printf("pointer:");
	show_pointer(intPointer);

	printf("short:");
	show_short(shortVariable);

	printf("long:");
	show_long(longVariable);

	printf("double:");
	show_double(doubleVariable);
}
Ejemplo n.º 3
0
void sdl_window_info::update_cursor_state()
{
#if (USE_XINPUT && USE_XINPUT_WII_LIGHTGUN_HACK)
	// Hack for wii-lightguns:
	// they stop working with a grabbed mouse;
	// even a ShowCursor(SDL_DISABLE) already does this.
	// To make the cursor disappear, we'll just set an empty cursor image.
	unsigned char data[]={0,0,0,0,0,0,0,0};
	SDL_Cursor *c;
	c=SDL_CreateCursor(data, data, 8, 8, 0, 0);
	SDL_SetCursor(c);
#else
	// do not do mouse capture if the debugger's enabled to avoid
	// the possibility of losing control
	if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
	{
		bool should_hide_mouse = downcast<sdl_osd_interface&>(machine().osd()).should_hide_mouse();

		if (!fullscreen() && !should_hide_mouse)
		{
			show_pointer();
			release_pointer();
		}
		else
		{
			hide_pointer();
			capture_pointer();
		}

		SDL_SetCursor(nullptr); // Force an update in case the underlying driver has changed visibility
	}
#endif
}
Ejemplo n.º 4
0
void test_show_bytes(int val){
	int ival = val;
	float fval = (float) ival;
	int* pval = &ival;
	show_int(ival);
	show_float(fval);
	show_pointer(pval);
}
Ejemplo n.º 5
0
int
main() {
    int i = 240;
    float f = 22.2;
    show_int(i);
    show_float(f);
    show_pointer(&f);
    return 0;
}
Ejemplo n.º 6
0
//unit test here
int main()
{
	int x = 10;
	int *ip = &x;
	show_int(x);
    printf("\n");	
	show_pointer(ip);
	return 0;
}
Ejemplo n.º 7
0
void main() {
	int ival = 0x123456;
	float fval = (float) ival;
	int *pval = &ival;
	show_int(ival); 
	show_float(fval);
	show_pointer(pval);

}
Ejemplo n.º 8
0
int main ()
{
    void *p1, *p2, *p3, *p4;
    int local = 0;
    p1 = malloc(1L << 24);
    p2 = malloc(1L << 8);
    p3 = malloc(1L << 28);
    p4 = malloc(1L << 8);

    show_pointer((void *) big_array, "big array");
    show_pointer((void *) huge_array, "huge array");
    show_pointer((void *) &local, "local");
    show_pointer((void *) &global, "global");
    show_pointer((void *) p1, "p1");
    show_pointer((void *) p2, "p2");
    show_pointer((void *) p3, "p3");
    show_pointer((void *) p4, "p4");
    show_pointer((void *) useless, "useless");
    show_pointer((void *) exit, "exit");
    return 0;
}
Ejemplo n.º 9
0
int main()
{
	int a = 10;
	float b = 11.5;
	double c = 13.33;
	void *d = &a;
	show_int(a);
	printf("\n");
	show_float(b);
	printf("\n");
	show_double(c);
	printf("\n");
	show_pointer(d);
	getchar();
}
Ejemplo n.º 10
0
int
main()
{
    int val = 0x87654321;
    byte_pointer valp = (byte_pointer) &val;

    show_int(val);
    show_float((float) val);
    show_pointer(valp);

    show_bytes(valp, 1);
    show_bytes(valp, 2);
    show_bytes(valp, 3);

    return 0;
}
Ejemplo n.º 11
0
void sdl_window_info::complete_destroy()
{
	// Release pointer grab and hide if needed
	show_pointer();
	release_pointer();

	if (fullscreen() && video_config.switchres)
	{
		SDL_SetWindowFullscreen(platform_window(), 0);    // Try to set mode
		SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode);    // Try to set mode
		SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN);    // Try to set mode
	}

	SDL_DestroyWindow(platform_window());
	// release all keys ...
	downcast<sdl_osd_interface &>(machine().osd()).release_keys();
}
Ejemplo n.º 12
0
void test_show_bytes(int val)
{
    int ival    = val;
    float fval  = (float) ival;
    int *pval   = &ival;
    short sval  = (short) ival;
    long lval   = (long) ival;
    double dval = (double) ival;

    show_int(ival);
    show_float(fval);
    show_pointer(pval);
    show_short(sval);
    show_long(lval);
    show_double(dval);

    printf("\n");
}