1 | /* ---------------- */ |
---|
2 | /* --- nrio2x.c --- */ |
---|
3 | /* ---------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | */ |
---|
9 | |
---|
10 | #include <stdio.h> |
---|
11 | #include <stddef.h> |
---|
12 | #include <stdlib.h> |
---|
13 | |
---|
14 | #include "nrc_os_config.h" |
---|
15 | #include "mypredef.h" |
---|
16 | #include "nrtype.h" |
---|
17 | #include "nrdef.h" |
---|
18 | #include "nrmacro.h" |
---|
19 | #include "nrkernel.h" |
---|
20 | |
---|
21 | #include "nrio0.h" |
---|
22 | #include "nralloc1.h" |
---|
23 | #include "nralloc2.h" |
---|
24 | #include "nrio1.h" |
---|
25 | #include "nrio2.h" |
---|
26 | #include "nrio2x.h" |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | /* ------------------------------ */ |
---|
31 | /* --- display_matrix_endline --- */ |
---|
32 | /* ------------------------------ */ |
---|
33 | |
---|
34 | #undef display_type_matrix_endline |
---|
35 | #define display_type_matrix_endline(t) \ |
---|
36 | void short_name(t,display_,matrix_endline)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, char * format, char * name) \ |
---|
37 | { \ |
---|
38 | int32_t n = (i1 - i0 + 1) * (j1 - j0 + 1); \ |
---|
39 | t * p = &m[i0][j0]; \ |
---|
40 | \ |
---|
41 | if (name != NULL) { \ |
---|
42 | printf(name); \ |
---|
43 | } \ |
---|
44 | \ |
---|
45 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
46 | for (int32_t j = j0; j <= j0 + n; j++) { \ |
---|
47 | printf(format, *p++); \ |
---|
48 | } \ |
---|
49 | printf("\n"); \ |
---|
50 | } \ |
---|
51 | printf("\n"); \ |
---|
52 | } |
---|
53 | |
---|
54 | display_type_matrix_endline(int8_t); |
---|
55 | display_type_matrix_endline(uint8_t); |
---|
56 | display_type_matrix_endline(int16_t); |
---|
57 | display_type_matrix_endline(uint16_t); |
---|
58 | display_type_matrix_endline(int32_t); |
---|
59 | display_type_matrix_endline(uint32_t); |
---|
60 | display_type_matrix_endline(int64_t); |
---|
61 | display_type_matrix_endline(uint64_t); |
---|
62 | |
---|
63 | |
---|
64 | /* ------------------------------- */ |
---|
65 | /* --- display_matrix_endline0 --- */ |
---|
66 | /* ------------------------------- */ |
---|
67 | |
---|
68 | #undef display_type_matrix_endline0 |
---|
69 | #define display_type_matrix_endline0(t) \ |
---|
70 | void short_name(t,display_,matrix_endline0)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, char * format, char * name) \ |
---|
71 | { \ |
---|
72 | if (name != NULL) { \ |
---|
73 | printf(name); \ |
---|
74 | } \ |
---|
75 | \ |
---|
76 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
77 | int32_t n = (int32_t) m[i][j0]; \ |
---|
78 | for (int32_t j = j0; j <= j0 + n; j++) { \ |
---|
79 | printf(format, m[i][j]); \ |
---|
80 | } \ |
---|
81 | printf("\n"); \ |
---|
82 | } \ |
---|
83 | printf("\n"); \ |
---|
84 | } |
---|
85 | |
---|
86 | display_type_matrix_endline0(int8_t); |
---|
87 | display_type_matrix_endline0(uint8_t); |
---|
88 | display_type_matrix_endline0(int16_t); |
---|
89 | display_type_matrix_endline0(uint16_t); |
---|
90 | display_type_matrix_endline0(int32_t); |
---|
91 | display_type_matrix_endline0(uint32_t); |
---|
92 | display_type_matrix_endline0(int64_t); |
---|
93 | display_type_matrix_endline0(uint64_t); |
---|
94 | |
---|
95 | |
---|
96 | /* ------------------------------- */ |
---|
97 | /* --- display_matrix_endline1 --- */ |
---|
98 | /* ------------------------------- */ |
---|
99 | |
---|
100 | #undef display_type_matrix_endline1 |
---|
101 | #define display_type_matrix_endline1(t) \ |
---|
102 | void short_name(t,display_,matrix_endline1)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, char * format, char * name) \ |
---|
103 | { \ |
---|
104 | if (name != NULL) { \ |
---|
105 | printf(name); \ |
---|
106 | } \ |
---|
107 | \ |
---|
108 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
109 | int32_t n = (int32_t) m[i][j0 - 1]; \ |
---|
110 | for (int32_t j = j0; j <= j0 + n - 1; j++) { \ |
---|
111 | printf(format, m[i][j]); \ |
---|
112 | } \ |
---|
113 | printf("\n"); \ |
---|
114 | } \ |
---|
115 | printf("\n"); \ |
---|
116 | } |
---|
117 | |
---|
118 | display_type_matrix_endline1(int8_t); |
---|
119 | display_type_matrix_endline1(uint8_t); |
---|
120 | display_type_matrix_endline1(int16_t); |
---|
121 | display_type_matrix_endline1(uint16_t); |
---|
122 | display_type_matrix_endline1(int32_t); |
---|
123 | display_type_matrix_endline1(uint32_t); |
---|
124 | display_type_matrix_endline1(int64_t); |
---|
125 | display_type_matrix_endline1(uint64_t); |
---|
126 | |
---|
127 | |
---|
128 | /* -------------------------------------- */ |
---|
129 | /* --- display_matrix_number_endline0 --- */ |
---|
130 | /* -------------------------------------- */ |
---|
131 | |
---|
132 | #undef display_type_matrix_number_endline0 |
---|
133 | #define display_type_matrix_number_endline0(t) \ |
---|
134 | void short_name(t,display_,matrix_number_endline0)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, char * format, char * name) \ |
---|
135 | { \ |
---|
136 | if (name != NULL) { \ |
---|
137 | printf(name); \ |
---|
138 | } \ |
---|
139 | \ |
---|
140 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
141 | printf("[%3d] ", i); \ |
---|
142 | int32_t n = (int32_t) m[i][j0]; \ |
---|
143 | for (int32_t j = j0; j <= j0 + n; j++) { \ |
---|
144 | printf(format, m[i][j]); \ |
---|
145 | } \ |
---|
146 | printf("\n"); \ |
---|
147 | } \ |
---|
148 | printf("\n"); \ |
---|
149 | } |
---|
150 | |
---|
151 | display_type_matrix_number_endline0(int8_t); |
---|
152 | display_type_matrix_number_endline0(uint8_t); |
---|
153 | display_type_matrix_number_endline0(int16_t); |
---|
154 | display_type_matrix_number_endline0(uint16_t); |
---|
155 | display_type_matrix_number_endline0(int32_t); |
---|
156 | display_type_matrix_number_endline0(uint32_t); |
---|
157 | display_type_matrix_number_endline0(int64_t); |
---|
158 | display_type_matrix_number_endline0(uint64_t); |
---|
159 | |
---|
160 | |
---|
161 | /* -------------------------------------- */ |
---|
162 | /* --- display_matrix_number_endline1 --- */ |
---|
163 | /* -------------------------------------- */ |
---|
164 | |
---|
165 | #undef display_type_matrix_number_endline1 |
---|
166 | #define display_type_matrix_number_endline1(t) \ |
---|
167 | void short_name(t,display_,matrix_number_endline1)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, char * format, char * name) \ |
---|
168 | { \ |
---|
169 | if (name != NULL) { \ |
---|
170 | printf(name); \ |
---|
171 | } \ |
---|
172 | \ |
---|
173 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
174 | printf("[%3d] ", i); \ |
---|
175 | int32_t n = (int32_t) m[i][j0 - 1]; \ |
---|
176 | for (int32_t j = j0; j <= j0 + n - 1; j++) { \ |
---|
177 | printf(format, m[i][j]); \ |
---|
178 | } \ |
---|
179 | printf("\n"); \ |
---|
180 | } \ |
---|
181 | printf("\n"); \ |
---|
182 | } |
---|
183 | |
---|
184 | display_type_matrix_number_endline1(int8_t); |
---|
185 | display_type_matrix_number_endline1(uint8_t); |
---|
186 | display_type_matrix_number_endline1(int16_t); |
---|
187 | display_type_matrix_number_endline1(uint16_t); |
---|
188 | display_type_matrix_number_endline1(int32_t); |
---|
189 | display_type_matrix_number_endline1(uint32_t); |
---|
190 | display_type_matrix_number_endline1(int64_t); |
---|
191 | display_type_matrix_number_endline1(uint64_t); |
---|
192 | |
---|
193 | |
---|
194 | /* ------------------------- */ |
---|
195 | /* --- display_trimatrix --- */ |
---|
196 | /* ------------------------- */ |
---|
197 | |
---|
198 | #undef display_type_trimatrix |
---|
199 | #define display_type_trimatrix(t) \ |
---|
200 | void short_name(t,display_,trimatrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t step, char * format, char * name) \ |
---|
201 | { \ |
---|
202 | if (name != NULL) { \ |
---|
203 | printf(name); \ |
---|
204 | } \ |
---|
205 | \ |
---|
206 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
207 | for (int32_t j = j0; j <= j1; j++) { \ |
---|
208 | printf(format, m[i][j]); \ |
---|
209 | } \ |
---|
210 | printf("\n"); \ |
---|
211 | j1 += step; \ |
---|
212 | } \ |
---|
213 | printf("\n"); \ |
---|
214 | } |
---|
215 | |
---|
216 | display_type_trimatrix(int8_t); |
---|
217 | display_type_trimatrix(uint8_t); |
---|
218 | display_type_trimatrix(int16_t); |
---|
219 | display_type_trimatrix(uint16_t); |
---|
220 | display_type_trimatrix(int32_t); |
---|
221 | display_type_trimatrix(uint32_t); |
---|
222 | display_type_trimatrix(int64_t); |
---|
223 | display_type_trimatrix(uint64_t); |
---|
224 | display_type_trimatrix(float); |
---|
225 | display_type_trimatrix(double); |
---|
226 | |
---|
227 | |
---|
228 | // Local Variables: |
---|
229 | // tab-width: 4 |
---|
230 | // c-basic-offset: 4 |
---|
231 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
232 | // indent-tabs-mode: nil |
---|
233 | // End: |
---|
234 | |
---|
235 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
236 | |
---|