1 | /* --------------- */ |
---|
2 | /* --- nrio1.c --- */ |
---|
3 | /* --------------- */ |
---|
4 | |
---|
5 | /* |
---|
6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
7 | * Univ Paris Sud XI, CNRS |
---|
8 | * |
---|
9 | * Distributed under the Boost Software License, Version 1.0 |
---|
10 | * see accompanying file LICENSE.txt or copy it at |
---|
11 | * http://www.boost.org/LICENSE_1_0.txt |
---|
12 | */ |
---|
13 | |
---|
14 | #include <stdio.h> |
---|
15 | #include <stddef.h> |
---|
16 | #include <stdlib.h> |
---|
17 | |
---|
18 | #include "nrc_os_config.h" |
---|
19 | #include "mypredef.h" |
---|
20 | #include "nrtype.h" |
---|
21 | #include "nrdef.h" |
---|
22 | #include "nrmacro.h" |
---|
23 | #include "nrkernel.h" |
---|
24 | |
---|
25 | #include "nralloc1.h" |
---|
26 | #include "nrio0.h" |
---|
27 | #include "nrio1.h" |
---|
28 | |
---|
29 | /* |
---|
30 | * ---------------------- |
---|
31 | * --- display_vector --- |
---|
32 | * ---------------------- |
---|
33 | */ |
---|
34 | |
---|
35 | #undef display_type_vector |
---|
36 | #define display_type_vector(t) \ |
---|
37 | void short_name(t,display_,vector)(t * v, int32_t nl, int32_t nh, char * format, char * name) \ |
---|
38 | { \ |
---|
39 | if (name != NULL) { \ |
---|
40 | printf("%s", name); \ |
---|
41 | } \ |
---|
42 | for (int32_t i = nl; i <= nh; i++) { \ |
---|
43 | printf(format, v[i]); \ |
---|
44 | } \ |
---|
45 | printf("\n"); \ |
---|
46 | } |
---|
47 | |
---|
48 | display_type_vector(int8_t); |
---|
49 | display_type_vector(uint8_t); |
---|
50 | display_type_vector(int16_t); |
---|
51 | display_type_vector(uint16_t); |
---|
52 | display_type_vector(int32_t); |
---|
53 | display_type_vector(uint32_t); |
---|
54 | display_type_vector(int64_t); |
---|
55 | display_type_vector(uint64_t); |
---|
56 | display_type_vector(float); |
---|
57 | display_type_vector(double); |
---|
58 | display_type_vector(rgb8); |
---|
59 | display_type_vector(rgbx8); |
---|
60 | |
---|
61 | |
---|
62 | /* |
---|
63 | * ----------------------------- |
---|
64 | * --- display_vector_number --- |
---|
65 | * ----------------------------- |
---|
66 | */ |
---|
67 | |
---|
68 | #undef display_type_vector_number |
---|
69 | #define display_type_vector_number(t) \ |
---|
70 | void short_name(t,display_,vector_number)(t * v, int32_t nl, int32_t nh, char * format, char * name) \ |
---|
71 | { \ |
---|
72 | if (name != NULL) { \ |
---|
73 | printf("%s\n", name); \ |
---|
74 | } \ |
---|
75 | for (int32_t i = nl; i <= nh; i++) { \ |
---|
76 | printf(format, i); \ |
---|
77 | } \ |
---|
78 | printf("\n"); \ |
---|
79 | for (int32_t i = nl; i <= nh; i++) { \ |
---|
80 | printf(format, v[i]); \ |
---|
81 | } \ |
---|
82 | printf("\n"); \ |
---|
83 | } |
---|
84 | |
---|
85 | |
---|
86 | display_type_vector_number(int8_t); |
---|
87 | display_type_vector_number(uint8_t); |
---|
88 | display_type_vector_number(int16_t); |
---|
89 | display_type_vector_number(uint16_t); |
---|
90 | display_type_vector_number(int32_t); |
---|
91 | display_type_vector_number(uint32_t); |
---|
92 | display_type_vector_number(int64_t); |
---|
93 | display_type_vector_number(uint64_t); |
---|
94 | display_type_vector_number(float); |
---|
95 | display_type_vector_number(double); |
---|
96 | display_type_vector_number(rgb8); |
---|
97 | display_type_vector_number(rgbx8); |
---|
98 | |
---|
99 | |
---|
100 | /* |
---|
101 | * ------------------------ |
---|
102 | * --- display_vector_T --- |
---|
103 | * ------------------------ |
---|
104 | */ |
---|
105 | |
---|
106 | |
---|
107 | #undef display_type_vector_T |
---|
108 | #define display_type_vector_T(t) \ |
---|
109 | void short_name(t,display_,vector_T)(t * v, int32_t i0, int32_t i1, char * format, char * name) \ |
---|
110 | { \ |
---|
111 | if (name != NULL) { \ |
---|
112 | printf("%s", name); \ |
---|
113 | } \ |
---|
114 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
115 | printf(format, v[i]); \ |
---|
116 | printf("\n"); \ |
---|
117 | } \ |
---|
118 | printf("\n"); \ |
---|
119 | } |
---|
120 | |
---|
121 | display_type_vector_T(int8_t); |
---|
122 | display_type_vector_T(uint8_t); |
---|
123 | display_type_vector_T(int16_t); |
---|
124 | display_type_vector_T(uint16_t); |
---|
125 | display_type_vector_T(int32_t); |
---|
126 | display_type_vector_T(uint32_t); |
---|
127 | display_type_vector_T(int64_t); |
---|
128 | display_type_vector_T(uint64_t); |
---|
129 | display_type_vector_T(float); |
---|
130 | display_type_vector_T(double); |
---|
131 | display_type_vector_T(rgb8); |
---|
132 | display_type_vector_T(rgbx8); |
---|
133 | |
---|
134 | |
---|
135 | /* |
---|
136 | * ------------------------------- |
---|
137 | * --- display_vector_number_T --- |
---|
138 | * ------------------------------- |
---|
139 | */ |
---|
140 | |
---|
141 | |
---|
142 | #undef display_type_vector_number_T |
---|
143 | #define display_type_vector_number_T(t) \ |
---|
144 | void short_name(t,display_,vector_number_T)(t * v, int32_t i0, int32_t i1, char * format, char * name) \ |
---|
145 | { \ |
---|
146 | if (name != NULL) { \ |
---|
147 | printf("%s", name); \ |
---|
148 | } \ |
---|
149 | for (int32_t i = i0; i <= i1; i++) { \ |
---|
150 | printf("%8d ", i); \ |
---|
151 | printf(format, v[i]); \ |
---|
152 | printf("\n"); \ |
---|
153 | } \ |
---|
154 | printf("\n"); \ |
---|
155 | } |
---|
156 | |
---|
157 | display_type_vector_number_T(int8_t); |
---|
158 | display_type_vector_number_T(uint8_t); |
---|
159 | display_type_vector_number_T(int16_t); |
---|
160 | display_type_vector_number_T(uint16_t); |
---|
161 | display_type_vector_number_T(int32_t); |
---|
162 | display_type_vector_number_T(uint32_t); |
---|
163 | display_type_vector_number_T(int64_t); |
---|
164 | display_type_vector_number_T(uint64_t); |
---|
165 | display_type_vector_number_T(float); |
---|
166 | display_type_vector_number_T(double); |
---|
167 | display_type_vector_number_T(rgb8); |
---|
168 | display_type_vector_number_T(rgbx8); |
---|
169 | |
---|
170 | |
---|
171 | /* |
---|
172 | * ------------------------------- |
---|
173 | * --- display_vector_positive --- |
---|
174 | * ------------------------------- |
---|
175 | */ |
---|
176 | |
---|
177 | #undef display_type_vector_positive |
---|
178 | #define display_type_vector_positive(t) \ |
---|
179 | void short_name(t,display_,vector_positive)(t * v, int32_t j0, int32_t j1, int32_t iformat, char * name) \ |
---|
180 | { \ |
---|
181 | char * format; \ |
---|
182 | char * str; \ |
---|
183 | select_display_positive_parameters(iformat, &format, &str); \ |
---|
184 | if (name != NULL) { \ |
---|
185 | printf(name); \ |
---|
186 | } \ |
---|
187 | for (int32_t j = j0; j <= j1; j++) { \ |
---|
188 | if (v[j] != 0) { \ |
---|
189 | printf(format, v[j]); \ |
---|
190 | } \ |
---|
191 | else { \ |
---|
192 | printf("%s", str); \ |
---|
193 | } \ |
---|
194 | } \ |
---|
195 | printf("\n"); \ |
---|
196 | } |
---|
197 | |
---|
198 | |
---|
199 | display_type_vector_positive(int8_t); |
---|
200 | display_type_vector_positive(uint8_t); |
---|
201 | display_type_vector_positive(int16_t); |
---|
202 | display_type_vector_positive(uint16_t); |
---|
203 | display_type_vector_positive(int32_t); |
---|
204 | display_type_vector_positive(uint32_t); |
---|
205 | display_type_vector_positive(int64_t); |
---|
206 | display_type_vector_positive(uint64_t); |
---|
207 | display_type_vector_positive(float); |
---|
208 | display_type_vector_positive(double); |
---|
209 | |
---|
210 | // Local Variables: |
---|
211 | // tab-width: 4 |
---|
212 | // c-basic-offset: 4 |
---|
213 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
214 | // indent-tabs-mode: nil |
---|
215 | // End: |
---|
216 | |
---|
217 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
218 | |
---|