Changeset 805 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrio2.c
- Timestamp:
- Mar 15, 2016, 6:35:28 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrio2.c
r798 r805 734 734 int i, j; 735 735 736 char * format; 737 char * str; 738 739 select_display_positive_parameters(iformat, &format, &str); 740 741 if (name != NULL) { 742 printf("%s\n", name); 743 } 744 745 // @QM have to hack this function for the giet 746 for (i = i0; i <= i1; i++) { 747 for (j = j0; j <= j1; j++) { 748 if (m[i][j]) { 749 // For the giet 750 int a = m[i][j]; 751 int len = 0; 752 if (a == 0) { 753 len = 1; 754 } 755 else { 756 while (a != 0) { 757 a = a / 10; 758 len++; 759 } 760 } 761 for (int k = len; k < iformat; k++) { 762 printf(" "); 763 } 764 printf("%d", m[i][j]); 765 } 766 else { 767 printf("%s", str); 768 } 769 } 770 printf("\n"); 771 } 772 } 773 774 775 // -------------------------------------------------------------------------------------------------- 776 void display_si16matrix_positive(sint16 **m, int i0, int i1, int j0, int j1, int iformat, char *name) 777 // -------------------------------------------------------------------------------------------------- 778 { 779 int i, j; 780 736 781 char *format, *str; 737 782 … … 752 797 } 753 798 // -------------------------------------------------------------------------------------------------- 754 void display_ si16matrix_positive(sint16 **m, int i0, int i1, int j0, int j1, int iformat, char *name)799 void display_ui16matrix_positive(uint16 **m, int i0, int i1, int j0, int j1, int iformat, char *name) 755 800 // -------------------------------------------------------------------------------------------------- 756 801 { 757 802 int i, j; 758 759 803 char *format, *str; 760 804 … … 775 819 } 776 820 // -------------------------------------------------------------------------------------------------- 777 void display_ ui16matrix_positive(uint16**m, int i0, int i1, int j0, int j1, int iformat, char *name)821 void display_si32matrix_positive(sint32 **m, int i0, int i1, int j0, int j1, int iformat, char *name) 778 822 // -------------------------------------------------------------------------------------------------- 779 823 { … … 797 841 } 798 842 // -------------------------------------------------------------------------------------------------- 799 void display_ si32matrix_positive(sint32 **m, int i0, int i1, int j0, int j1, int iformat, char *name)843 void display_ui32matrix_positive(uint32 **m, int i0, int i1, int j0, int j1, int iformat, char *name) 800 844 // -------------------------------------------------------------------------------------------------- 801 845 { 802 846 int i, j; 803 char *format, *str; 847 char * format; 848 char * str; 804 849 805 850 select_display_positive_parameters(iformat, &format, &str); 806 851 807 if(name != NULL) printf(name); 808 809 for(i=i0; i<=i1; i++) { 810 for(j=j0; j<=j1; j++) { 811 if(m[i][j]) { 812 printf(format, m[i][j]); 813 } else { 852 if (name != NULL) { 853 printf("%s\n", name); 854 } 855 856 // @QM have to hack this function for the giet 857 for (i = i0; i <= i1; i++) { 858 for (j = j0; j <= j1; j++) { 859 if (m[i][j] != 0) { 860 int a = m[i][j]; 861 int len = 0; 862 if (a == 0) { 863 len = 1; 864 } 865 else { 866 while (a != 0) { 867 a = a / 10; 868 len++; 869 } 870 } 871 for (int k = len; k < iformat; k++) { 872 printf(" "); 873 } 874 printf("%d", m[i][j]); 875 } 876 else { 814 877 printf("%s", str); 815 878 } … … 817 880 printf("\n"); 818 881 } 819 } 820 // -------------------------------------------------------------------------------------------------- 821 void display_ui32matrix_positive(uint32 **m, int i0, int i1, int j0, int j1, int iformat, char *name) 822 // -------------------------------------------------------------------------------------------------- 823 { 824 int i, j; 825 char *format, *str; 826 827 select_display_positive_parameters(iformat, &format, &str); 828 829 if(name != NULL) printf(name); 830 831 for(i=i0; i<=i1; i++) { 832 for(j=j0; j<=j1; j++) { 833 if(m[i][j]) { 834 printf(format, m[i][j]); 835 } else { 836 printf("%s", str); 837 } 838 } 839 printf("\n"); 840 } 882 841 883 } 842 884 // --------------------------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.