comparison dwtest.c @ 1102:cfe7d2b6bc16

Added DW_INT_TO_POINTER/DW_UINT_TO_POINTER/DW_POINTER_TO_INT/DW_POINTER_TO_UINT macros. These are used to cast between pointer and integers without generate warnings on 64bit systems. Converted Mac source and dwtest source to use them. Not sure if limits.h is available on all target platforms, will commit fixes as necessary.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 03:09:41 +0000
parents b905fd8e7fd1
children 404b639f096b
comparison
equal deleted inserted replaced
1101:d7eafaa054ab 1102:cfe7d2b6bc16
646 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data ) 646 int DWSIGNAL item_enter_cb( HWND window, char *text, void *data )
647 { 647 {
648 char buf[200]; 648 char buf[200];
649 HWND statline = (HWND)data; 649 HWND statline = (HWND)data;
650 650
651 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", (unsigned int)window, text ); 651 sprintf(buf,"DW_SIGNAL_ITEM_ENTER: Window: %x Text: %s", DW_POINTER_TO_UINT(window), text );
652 dw_window_set_text( statline, buf); 652 dw_window_set_text( statline, buf);
653 return 0; 653 return 0;
654 } 654 }
655 655
656 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata ) 656 int DWSIGNAL item_context_cb( HWND window, char *text, int x, int y, void *data, void *itemdata )
657 { 657 {
658 char buf[200]; 658 char buf[200];
659 HWND statline = (HWND)data; 659 HWND statline = (HWND)data;
660 660
661 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", (unsigned int)window, text, x, y, (unsigned int)itemdata ); 661 sprintf(buf,"DW_SIGNAL_ITEM_CONTEXT: Window: %x Text: %s x: %d y: %d Itemdata: %x", DW_POINTER_TO_UINT(window), text, x, y, DW_POINTER_TO_UINT(itemdata) );
662 dw_window_set_text( statline, buf); 662 dw_window_set_text( statline, buf);
663 return 0; 663 return 0;
664 } 664 }
665 665
666 int DWSIGNAL list_select_cb( HWND window, int item, void *data ) 666 int DWSIGNAL list_select_cb( HWND window, int item, void *data )
667 { 667 {
668 char buf[200]; 668 char buf[200];
669 HWND statline = (HWND)data; 669 HWND statline = (HWND)data;
670 670
671 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", (unsigned int)window, item ); 671 sprintf(buf,"DW_SIGNAL_LIST_SELECT: Window: %d Item: %d", DW_POINTER_TO_UINT(window), item );
672 dw_window_set_text( statline, buf); 672 dw_window_set_text( statline, buf);
673 return 0; 673 return 0;
674 } 674 }
675 675
676 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) 676 int DWSIGNAL item_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata )
677 { 677 {
678 char buf[200]; 678 char buf[200];
679 HWND statline = (HWND)data; 679 HWND statline = (HWND)data;
680 680
681 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 681 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
682 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
682 dw_window_set_text( statline, buf); 683 dw_window_set_text( statline, buf);
683 return 0; 684 return 0;
684 } 685 }
685 686
686 int DWSIGNAL container_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata ) 687 int DWSIGNAL container_select_cb( HWND window, HTREEITEM item, char *text, void *data, void *itemdata )
688 char buf[200]; 689 char buf[200];
689 char *str; 690 char *str;
690 HWND statline = (HWND)data; 691 HWND statline = (HWND)data;
691 unsigned long size; 692 unsigned long size;
692 693
693 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 694 sprintf(buf,"DW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
695 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
694 dw_window_set_text( statline, buf); 696 dw_window_set_text( statline, buf);
695 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", (unsigned int)window, (unsigned int)item, text, (unsigned int)itemdata ); 697 sprintf(buf,"\r\nDW_SIGNAL_ITEM_SELECT: Window: %x Item: %x Text: %s Itemdata: %x\r\n", DW_POINTER_TO_UINT(window),
698 DW_POINTER_TO_UINT(item), text, DW_POINTER_TO_UINT(itemdata) );
696 mle_point = dw_mle_import( container_mle, buf, mle_point); 699 mle_point = dw_mle_import( container_mle, buf, mle_point);
697 str = dw_container_query_start(container, DW_CRA_SELECTED); 700 str = dw_container_query_start(container, DW_CRA_SELECTED);
698 while(str) 701 while(str)
699 { 702 {
700 sprintf(buf,"Selected: %s\r\n", str); 703 sprintf(buf,"Selected: %s\r\n", str);
702 str = dw_container_query_next(container, DW_CRA_SELECTED); 705 str = dw_container_query_next(container, DW_CRA_SELECTED);
703 } 706 }
704 /* Make the last inserted point the cursor location */ 707 /* Make the last inserted point the cursor location */
705 dw_mle_set_cursor(container_mle, mle_point); 708 dw_mle_set_cursor(container_mle, mle_point);
706 /* set the details of item 0 to new data */ 709 /* set the details of item 0 to new data */
707 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); 710 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
711 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
708 dw_filesystem_change_file(container, 0, "new data", fileicon); 712 dw_filesystem_change_file(container, 0, "new data", fileicon);
709 size = 999; 713 size = 999;
710 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)fileicon); 714 fprintf(stderr,"In cb: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
715 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(fileicon));
711 dw_filesystem_change_item(container, 1, 0, &size); 716 dw_filesystem_change_item(container, 1, 0, &size);
712 return 0; 717 return 0;
713 } 718 }
714 719
715 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata ) 720 int DWSIGNAL switch_page_cb( HWND window, unsigned long page_num, void *itemdata )
716 { 721 {
717 FILE *fp=fopen("log","a"); 722 FILE *fp=fopen("log","a");
718 if ( fp ) 723 if ( fp )
719 { 724 {
720 fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", (unsigned int)window, (unsigned int)page_num, (unsigned int)itemdata ); 725 fprintf(fp,"DW_SIGNAL_SWITCH_PAGE: Window: %x PageNum: %u Itemdata: %x\n", DW_POINTER_TO_UINT(window),
726 DW_POINTER_TO_UINT(page_num), DW_POINTER_TO_UINT(itemdata) );
721 fclose(fp); 727 fclose(fp);
722 } 728 }
723 return 0; 729 return 0;
724 } 730 }
725 731
745 else if( column_type == DW_CFA_BITMAPORICON) 751 else if( column_type == DW_CFA_BITMAPORICON)
746 strcpy(buf1,"BitmapOrIcon"); 752 strcpy(buf1,"BitmapOrIcon");
747 else 753 else
748 strcpy(buf1,"Unknown"); 754 strcpy(buf1,"Unknown");
749 } 755 }
750 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", (unsigned int)window, column_num, buf1, (unsigned int)data ); 756 sprintf(buf,"DW_SIGNAL_COLUMN_CLICK: Window: %x Column: %d Type: %s Itemdata: %x", DW_POINTER_TO_UINT(window),
757 column_num, buf1, DW_POINTER_TO_UINT(data) );
751 dw_window_set_text( statline, buf); 758 dw_window_set_text( statline, buf);
752 return 0; 759 return 0;
753 } 760 }
754 761
755 int DWSIGNAL combobox_select_event_callback(HWND window, int index) 762 int DWSIGNAL combobox_select_event_callback(HWND window, int index)
1016 sprintf(names[z],"Don't allocate from stack: Item: %d",z); 1023 sprintf(names[z],"Don't allocate from stack: Item: %d",z);
1017 size = z*100; 1024 size = z*100;
1018 sprintf(buffer, "Filename %d",z+1); 1025 sprintf(buffer, "Filename %d",z+1);
1019 if (z == 0 ) thisicon = foldericon; 1026 if (z == 0 ) thisicon = foldericon;
1020 else thisicon = fileicon; 1027 else thisicon = fileicon;
1021 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", (int)container, (int)containerinfo, (int)thisicon); 1028 fprintf(stderr,"Initial: container: %x containerinfo: %x icon: %x\n", DW_POINTER_TO_INT(container),
1029 DW_POINTER_TO_INT(containerinfo), DW_POINTER_TO_INT(thisicon));
1022 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon); 1030 dw_filesystem_set_file(container, containerinfo, z, buffer, thisicon);
1023 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon); 1031 dw_filesystem_set_item(container, containerinfo, 0, z, &thisicon);
1024 dw_filesystem_set_item(container, containerinfo, 1, z, &size); 1032 dw_filesystem_set_item(container, containerinfo, 1, z, &size);
1025 1033
1026 time.seconds = z+10; 1034 time.seconds = z+10;