Changeset 822 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrio0.c
- Timestamp:
- Jun 1, 2016, 10:25:43 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrio0.c
r777 r822 26 26 27 27 /* --------------------------------------------------------------------------------------------------- */ 28 IMAGE_EXPORT(void) generate_filename_k_ndigit(char *filename, int k, int ndigit, char *complete_filename, int maxlen)28 void generate_filename_k_ndigit(char * filename, int k, int ndigit, char * complete_filename, int maxlen) 29 29 /* --------------------------------------------------------------------------------------------------- */ 30 30 { 31 char *format = "%s%d.txt";31 char * format = "%s%d.txt"; 32 32 33 switch(ndigit) {34 case 0 : format = "%s%d.txt"; break;35 case 1 : format = "%s%01d.txt"; break;36 case 2 : format = "%s%02d.txt"; break;37 case 3 : format = "%s%03d.txt"; break;38 case 4 : format = "%s%04d.txt"; break;39 case 5 : format = "%s%05d.txt"; break;40 case 6 : format = "%s%06d.txt"; break;41 case 7 : format = "%s%07d.txt"; break;42 case 8 : format = "%s%08d.txt"; break;43 case 9 : format = "%s%09d.txt"; break;44 }45 snprintf(complete_filename, maxlen, format, filename, k);33 switch (ndigit) { 34 case 0 : format = "%s%d.txt"; break; 35 case 1 : format = "%s%01d.txt"; break; 36 case 2 : format = "%s%02d.txt"; break; 37 case 3 : format = "%s%03d.txt"; break; 38 case 4 : format = "%s%04d.txt"; break; 39 case 5 : format = "%s%05d.txt"; break; 40 case 6 : format = "%s%06d.txt"; break; 41 case 7 : format = "%s%07d.txt"; break; 42 case 8 : format = "%s%08d.txt"; break; 43 case 9 : format = "%s%09d.txt"; break; 44 } 45 snprintf(complete_filename, maxlen, format, filename, k); 46 46 } 47 47 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 48 IMAGE_EXPORT(void) generate_filename_k_ndigit_extension(char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)48 void generate_filename_k_ndigit_extension(char * filename, int k, int ndigit, char * extension, char * complete_filename, int maxlen) 49 49 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 50 50 { 51 char *format = "%s%d.%s";51 char * format = "%s%d.%s"; 52 52 53 switch(ndigit) {54 case 0 : format = "%s%d.%s"; break;55 case 1 : format = "%s%01d.%s"; break;56 case 2 : format = "%s%02d.%s"; break;57 case 3 : format = "%s%03d.%s"; break;58 case 4 : format = "%s%04d.%s"; break;59 case 5 : format = "%s%05d.%s"; break;60 case 6 : format = "%s%06d.%s"; break;61 case 7 : format = "%s%07d.%s"; break;62 case 8 : format = "%s%08d.%s"; break;63 case 9 : format = "%s%09d.%s"; break;64 }65 snprintf(complete_filename, maxlen, format, filename, k, extension);53 switch (ndigit) { 54 case 0 : format = "%s%d.%s"; break; 55 case 1 : format = "%s%01d.%s"; break; 56 case 2 : format = "%s%02d.%s"; break; 57 case 3 : format = "%s%03d.%s"; break; 58 case 4 : format = "%s%04d.%s"; break; 59 case 5 : format = "%s%05d.%s"; break; 60 case 6 : format = "%s%06d.%s"; break; 61 case 7 : format = "%s%07d.%s"; break; 62 case 8 : format = "%s%08d.%s"; break; 63 case 9 : format = "%s%09d.%s"; break; 64 } 65 snprintf(complete_filename, maxlen, format, filename, k, extension); 66 66 } 67 68 67 69 /* ---------------------------------------------------------------------------------------------------- */ 68 IMAGE_EXPORT(void) generate_path_filename(char *path, char *filename, char *complete_filename, int maxlen)70 void generate_path_filename(char * path, char * filename, char * complete_filename, int maxlen) 69 71 /* ---------------------------------------------------------------------------------------------------- */ 70 72 { 71 snprintf(complete_filename, maxlen, "%s%s", path, filename);73 snprintf(complete_filename, maxlen, "%s%s", path, filename); 72 74 } 75 76 73 77 /* ------------------------------------------------------------------------------------------------------------------------------- */ 74 IMAGE_EXPORT(void) generate_path_filename_extension(char *path, char *filename, char *extension, char *complete_filename, int maxlen)78 void generate_path_filename_extension(char * path, char * filename, char * extension, char * complete_filename, int maxlen) 75 79 /* ------------------------------------------------------------------------------------------------------------------------------- */ 76 80 { 77 snprintf(complete_filename, maxlen, "%s%s.%s", path, filename, extension);81 snprintf(complete_filename, maxlen, "%s%s.%s", path, filename, extension); 78 82 } 83 84 79 85 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 80 IMAGE_EXPORT(void) generate_path_filename_suffix_extension(char *path, char *filename, char *suffix, char *extension, char *complete_filename, int maxlen)86 void generate_path_filename_suffix_extension(char * path, char * filename, char * suffix, char * extension, char * complete_filename, int maxlen) 81 87 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 82 88 { 83 89 snprintf(complete_filename, maxlen, "%s%s%s.%s", path, filename, suffix, extension); 84 90 } 91 92 85 93 /* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */ 86 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_extension(char *path, char *filename, int k, int ndigit, char *extension, char *complete_filename, int maxlen)94 void generate_path_filename_k_ndigit_extension(char * path, char * filename, int k, int ndigit, char * extension, char * complete_filename, int maxlen) 87 95 /* ----------------------------------------------------------------------------------------------------------------------------------------------------------- */ 88 96 { 89 char *format = "%s%s%d.%s";97 char * format = "%s%s%d.%s"; 90 98 91 switch(ndigit) {92 case 0 : format = "%s%s%d.%s"; break;93 case 1 : format = "%s%s%01d.%s"; break;94 case 2 : format = "%s%s%02d.%s"; break;95 case 3 : format = "%s%s%03d.%s"; break;96 case 4 : format = "%s%s%04d.%s"; break;97 case 5 : format = "%s%s%05d.%s"; break;98 case 6 : format = "%s%s%06d.%s"; break;99 case 7 : format = "%s%s%07d.%s"; break;100 case 8 : format = "%s%s%08d.%s"; break;101 case 9 : format = "%s%s%09d.%s"; break;102 }103 snprintf(complete_filename, maxlen, format, path, filename, k, extension);99 switch(ndigit) { 100 case 0 : format = "%s%s%d.%s"; break; 101 case 1 : format = "%s%s%01d.%s"; break; 102 case 2 : format = "%s%s%02d.%s"; break; 103 case 3 : format = "%s%s%03d.%s"; break; 104 case 4 : format = "%s%s%04d.%s"; break; 105 case 5 : format = "%s%s%05d.%s"; break; 106 case 6 : format = "%s%s%06d.%s"; break; 107 case 7 : format = "%s%s%07d.%s"; break; 108 case 8 : format = "%s%s%08d.%s"; break; 109 case 9 : format = "%s%s%09d.%s"; break; 110 } 111 snprintf(complete_filename, maxlen, format, path, filename, k, extension); 104 112 } 113 114 105 115 /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ 106 IMAGE_EXPORT(void) generate_path_filename_k_ndigit_l_extension(char *path, char *filename, int k, int ndigit, int l, char *extension, char *complete_filename, int maxlen)116 void generate_path_filename_k_ndigit_l_extension(char * path, char * filename, int k, int ndigit, int l, char * extension, char * complete_filename, int maxlen) 107 117 /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ 108 118 { 109 char *format = "%s%s%d_%d.%s";119 char * format = "%s%s%d_%d.%s"; 110 120 111 switch(ndigit) {112 case 0 : format = "%s%s%d_%d.%s";break;113 case 1 : format = "%s%s%01d_%01d.%s"; break;114 case 2 : format = "%s%s%02d_%02d.%s"; break;115 case 3 : format = "%s%s%03d_%03d.%s"; break;116 case 4 : format = "%s%s%04d_%04d.%s"; break;117 case 5 : format = "%s%s%05d_%05d.%s"; break;118 case 6 : format = "%s%s%06d_%06d.%s"; break;119 case 7 : format = "%s%s%07d_%07d.%s"; break;120 case 8 : format = "%s%s%08d_%08d.%s"; break;121 case 9 : format = "%s%s%09d_%09d.%s"; break;122 }123 snprintf(complete_filename, maxlen, format, path, filename, k, l, extension);121 switch (ndigit) { 122 case 0 : format = "%s%s%d_%d.%s"; break; 123 case 1 : format = "%s%s%01d_%01d.%s"; break; 124 case 2 : format = "%s%s%02d_%02d.%s"; break; 125 case 3 : format = "%s%s%03d_%03d.%s"; break; 126 case 4 : format = "%s%s%04d_%04d.%s"; break; 127 case 5 : format = "%s%s%05d_%05d.%s"; break; 128 case 6 : format = "%s%s%06d_%06d.%s"; break; 129 case 7 : format = "%s%s%07d_%07d.%s"; break; 130 case 8 : format = "%s%s%08d_%08d.%s"; break; 131 case 9 : format = "%s%s%09d_%09d.%s"; break; 132 } 133 snprintf(complete_filename, maxlen, format, path, filename, k, l, extension); 124 134 } 125 // ---------------------------------------------------------------------------- 126 void select_display_positive_parameters(int iformat, char **format, char **str) 127 // ---------------------------------------------------------------------------- 135 136 137 // ------------------------------------------------------------------------------ 138 void select_display_positive_parameters(int iformat, char ** format, char ** str) 139 // ------------------------------------------------------------------------------ 128 140 { 129 char * format1 = "%1d", *str1 = " ";130 char * format2 = "%2d", *str2 = " ";131 char * format3 = "%3d", *str3 = " ";132 char * format4 = "%4d", *str4 = " ";133 char * format5 = "%5d", *str5 = " ";134 char * format6 = "%6d", *str6 = " ";135 char * format7 = "%7d", *str7 = " ";136 char * format8 = "%8d", *str8 = " ";137 char * format9 = "%9d", *str9 = " ";138 139 switch (iformat) {141 char * format1 = "%1d", * str1 = " "; 142 char * format2 = "%2d", * str2 = " "; 143 char * format3 = "%3d", * str3 = " "; 144 char * format4 = "%4d", * str4 = " "; 145 char * format5 = "%5d", * str5 = " "; 146 char * format6 = "%6d", * str6 = " "; 147 char * format7 = "%7d", * str7 = " "; 148 char * format8 = "%8d", * str8 = " "; 149 char * format9 = "%9d", * str9 = " "; 150 151 switch (iformat) { 140 152 case 1: *format = format1; *str = str1; break; 141 153 case 2: *format = format2; *str = str2; break; … … 150 162 } 151 163 } 164 165 // Local Variables: 166 // tab-width: 4 167 // c-basic-offset: 4 168 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 169 // indent-tabs-mode: nil 170 // End: 171 172 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 173
Note: See TracChangeset
for help on using the changeset viewer.