Changeset 823 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrio2x.c
- Timestamp:
- Jun 14, 2016, 5:23:56 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrio2x.c
r772 r823 26 26 #include "nrio2x.h" 27 27 28 29 28 30 /* ------------------------------ */ 29 31 /* --- display_matrix_endline --- */ 30 32 /* ------------------------------ */ 31 /* ---------------------------------------------------------------------------------------------------------- */ 32 IMAGE_EXPORT(void) display_matrix_endline(byte **m,long i0, long i1, long j0, long j1, char *format, char *name) 33 /* ---------------------------------------------------------------------------------------------------------- */ 34 { 35 int i, j; 36 int n = (i1-i0+1) * (j1-j0+1); 37 byte *p = &m[i0][j0]; 38 39 if(name != NULL) puts(name); 40 41 for(i=i0; i<=i1; i++) { 42 for(j=j0; j<=j0+n; j++) { 43 printf(format, *p++); 44 } 45 putchar('\n'); 46 } 47 putchar('\n'); 48 } 49 /* -------------------------------------------------------------------------------------------------------------- */ 50 IMAGE_EXPORT(void) display_i16matrix_endline(int16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 51 /* -------------------------------------------------------------------------------------------------------------- */ 52 { 53 int i, j; 54 int n = (i1-i0+1) * (j1-j0+1); 55 int16 *p = &m[i0][j0]; 56 57 if(name != NULL) puts(name); 58 59 for(i=i0; i<=i1; i++) { 60 for(j=j0; j<=j0+n; j++) { 61 printf(format, *p++); 62 } 63 putchar('\n'); 64 } 65 putchar('\n'); 66 } 67 /* ---------------------------------------------------------------------------------------------------------------- */ 68 IMAGE_EXPORT(void) display_ui16matrix_endline(uint16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 69 /* ---------------------------------------------------------------------------------------------------------------- */ 70 { 71 int i, j; 72 int n = (i1-i0+1) * (j1-j0+1); 73 uint16 *p = &m[i0][j0]; 74 75 if(name != NULL) puts(name); 76 77 for(i=i0; i<=i1; i++) { 78 for(j=j0; j<=j0+n; j++) { 79 printf(format, *p++); 80 } 81 putchar('\n'); 82 } 83 putchar('\n'); 84 } 85 /* -------------------------------------------------------------------------------------------------------------- */ 86 IMAGE_EXPORT(void) display_i32matrix_endline(int32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 87 /* -------------------------------------------------------------------------------------------------------------- */ 88 { 89 int i, j; 90 int n = (i1-i0+1) * (j1-j0+1); 91 int32 *p = &m[i0][j0]; 92 93 if(name != NULL) puts(name); 94 95 for(i=i0; i<=i1; i++) { 96 for(j=j0; j<=j0+n; j++) { 97 printf(format, *p++); 98 } 99 putchar('\n'); 100 } 101 putchar('\n'); 102 } 103 /* ----------------------------------------------------------------------------------------------------------------- */ 104 IMAGE_EXPORT(void) display_ui32matrix_endline(uint32 **m, long i0, long i1, long j0, long j1, char *format, char *name) 105 /* ----------------------------------------------------------------------------------------------------------------- */ 106 { 107 int i, j; 108 int n = (i1-i0+1) * (j1-j0+1); 109 uint32 *p = &m[i0][j0]; 110 111 if(name != NULL) puts(name); 112 113 for(i=i0; i<=i1; i++) { 114 for(j=j0; j<=j0+n; j++) { 115 printf(format, *p++); 116 } 117 putchar('\n'); 118 } 119 putchar('\n'); 120 } 121 /* -------------------------------------------------------------------------------------------------------------- */ 122 IMAGE_EXPORT(void) display_i64matrix_endline(int64 **m,long i0, long i1, long j0, long j1, char *format, char *name) 123 /* -------------------------------------------------------------------------------------------------------------- */ 124 { 125 int i, j; 126 int n = (i1-i0+1) * (j1-j0+1); 127 int64 *p = &m[i0][j0]; 128 129 if(name != NULL) puts(name); 130 131 for(i=i0; i<=i1; i++) { 132 for(j=j0; j<=j0+n; j++) { 133 printf(format, *p++); 134 } 135 putchar('\n'); 136 } 137 putchar('\n'); 138 } 139 /* ---------------------------------------------------------------------------------------------------------- */ 140 IMAGE_EXPORT(void) display_imatrix_endline(int **m,long i0, long i1, long j0, long j1, char *format, char *name) 141 /* ---------------------------------------------------------------------------------------------------------- */ 142 { 143 int i, j; 144 int n = (i1-i0+1) * (j1-j0+1); 145 int *p = &m[i0][j0]; 146 147 if(name != NULL) puts(name); 148 149 for(i=i0; i<=i1; i++) { 150 for(j=j0; j<=j0+n; j++) { 151 printf(format, *p++); 152 } 153 putchar('\n'); 154 } 155 putchar('\n'); 156 } 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 157 64 /* ------------------------------- */ 158 65 /* --- display_matrix_endline0 --- */ 159 66 /* ------------------------------- */ 160 /* ------------------------------------------------------------------------------------------------------------ */ 161 //IMAGE_EXPORT(void) display_bmatrix_endline0(byte **m,long i0, long i1, long j0, long j1, char *format, char *name) 162 /* ------------------------------------------------------------------------------------------------------------ */ 163 /*{ 164 int i, j, n; 165 166 if(name != NULL) puts(name); 167 168 for(i=i0; i<=i1; i++) { 169 n = m[i][j0]; 170 for(j=j0; j<=j0+n; j++) { 171 printf(format, m[i][j]); 172 } 173 putchar('\n'); 174 } 175 putchar('\n'); 176 }*/ 177 /* ----------------------------------------------------------------------------------------- */ 178 IMAGE_EXPORT(void) display_bmatrix_endline0(byte **m,long i0, long i1,char *format, char *name) 179 /* ----------------------------------------------------------------------------------------- */ 180 { 181 int i, j, n; 182 183 if(name != NULL) puts(name); 184 185 for(i=i0; i<=i1; i++) { 186 printf("[%3d] ", i); 187 n = m[i][0]; 188 for(j=1; j<=+n; j++) { 189 printf(format, m[i][j]); 190 } 191 putchar('\n'); 192 } 193 putchar('\n'); 194 } 195 /* --------------------------------------------------------------------------------------------------------------- */ 196 //IMAGE_EXPORT(void) display_i16matrix_endline0(int16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 197 /* --------------------------------------------------------------------------------------------------------------- */ 198 /*{ 199 int i, j, n; 200 201 if(name != NULL) puts(name); 202 203 for(i=i0; i<=i1; i++) { 204 n = m[i][j0]; 205 for(j=j0; j<=j0+n; j++) { 206 printf(format, m[i][j]); 207 } 208 putchar('\n'); 209 } 210 putchar('\n'); 211 }*/ 212 /* --------------------------------------------------------------------------------------------- */ 213 IMAGE_EXPORT(void) display_i16matrix_endline0(int16 **m,long i0, long i1, char *format, char *name) 214 /* --------------------------------------------------------------------------------------------- */ 215 { 216 int i, j, n; 217 218 if(name != NULL) puts(name); 219 220 for(i=i0; i<=i1; i++) { 221 printf("[%3d] ", i); 222 n = m[i][0]; 223 for(j=1; j<=+n; j++) { 224 printf(format, m[i][j]); 225 } 226 putchar('\n'); 227 } 228 putchar('\n'); 229 } 230 /* ---------------------------------------------------------------------------------------------------------------- */ 231 //IMAGE_EXPORT(void) display_ui16matrix_endline0(uint16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 232 /* ---------------------------------------------------------------------------------------------------------------- */ 233 /*{ 234 int i, j, n; 235 236 if(name != NULL) puts(name); 237 238 for(i=i0; i<=i1; i++) { 239 n = m[i][j0]; 240 for(j=j0; j<=j0+n; j++) { 241 printf(format, m[i][j]); 242 } 243 putchar('\n'); 244 } 245 putchar('\n'); 246 }*/ 247 /* ----------------------------------------------------------------------------------------------- */ 248 IMAGE_EXPORT(void) display_ui16matrix_endline0(uint16 **m,long i0, long i1, char *format, char *name) 249 /* ----------------------------------------------------------------------------------------------- */ 250 { 251 int i, j, n; 252 253 if(name != NULL) puts(name); 254 255 for(i=i0; i<=i1; i++) { 256 printf("[%3d] ", i); 257 n = m[i][0]; 258 for(j=1; j<=+n; j++) { 259 printf(format, m[i][j]); 260 } 261 putchar('\n'); 262 } 263 putchar('\n'); 264 } 265 /* --------------------------------------------------------------------------------------------------------------- */ 266 //IMAGE_EXPORT(void) display_i32matrix_endline0(int32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 267 /* --------------------------------------------------------------------------------------------------------------- */ 268 /*{ 269 int i, j, n; 270 271 if(name != NULL) puts(name); 272 273 for(i=i0; i<=i1; i++) { 274 n = m[i][j0]; 275 for(j=j0; j<=j0+n; j++) { 276 printf(format, m[i][j]); 277 } 278 putchar('\n'); 279 } 280 putchar('\n'); 281 }*/ 282 /* --------------------------------------------------------------------------------------------- */ 283 IMAGE_EXPORT(void) display_i32matrix_endline0(int32 **m,long i0, long i1, char *format, char *name) 284 /* --------------------------------------------------------------------------------------------- */ 285 { 286 int i, j, n; 287 288 if(name != NULL) puts(name); 289 290 for(i=i0; i<=i1; i++) { 291 printf("[%3d] ", i); 292 n = m[i][0]; 293 for(j=1; j<=+n; j++) { 294 printf(format, m[i][j]); 295 } 296 putchar('\n'); 297 } 298 putchar('\n'); 299 } 300 /* ---------------------------------------------------------------------------------------------------------------- */ 301 //IMAGE_EXPORT(void) display_ui32matrix_endline0(uint32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 302 /* ---------------------------------------------------------------------------------------------------------------- */ 303 /*{ 304 int i, j, n; 305 306 if(name != NULL) puts(name); 307 308 for(i=i0; i<=i1; i++) { 309 n = m[i][j0]; 310 for(j=j0; j<=j0+n; j++) { 311 printf(format, m[i][j]); 312 } 313 putchar('\n'); 314 } 315 putchar('\n'); 316 }*/ 317 /* ----------------------------------------------------------------------------------------------- */ 318 IMAGE_EXPORT(void) display_ui32matrix_endline0(uint32 **m,long i0, long i1, char *format, char *name) 319 /* ----------------------------------------------------------------------------------------------- */ 320 { 321 int i, j, n; 322 323 if(name != NULL) puts(name); 324 325 for(i=i0; i<=i1; i++) { 326 printf("[%3d] ", i); 327 n = m[i][0]; 328 for(j=1; j<=+n; j++) { 329 printf(format, m[i][j]); 330 } 331 putchar('\n'); 332 } 333 putchar('\n'); 334 } 335 /* --------------------------------------------------------------------------------------------- */ 336 IMAGE_EXPORT(void) display_i64matrix_endline0(int64 **m,long i0, long i1, char *format, char *name) 337 /* --------------------------------------------------------------------------------------------- */ 338 { 339 int i, j; 340 int64 n; 341 342 if(name != NULL) puts(name); 343 344 for(i=i0; i<=i1; i++) { 345 printf("[%3d] ", i); 346 n = m[i][0]; 347 for(j=1; j<=+n; j++) { 348 printf(format, m[i][j]); 349 } 350 putchar('\n'); 351 } 352 putchar('\n'); 353 } 354 /* ----------------------------------------------------------------------------------------------------------- */ 355 //IMAGE_EXPORT(void) display_imatrix_endline0(int **m,long i0, long i1, long j0, long j1, char *format, char *name) 356 /* ----------------------------------------------------------------------------------------------------------- */ 357 /*{ 358 int i, j, n; 359 360 if(name != NULL) puts(name); 361 362 for(i=i0; i<=i1; i++) { 363 n = m[i][j0]; 364 for(j=j0; j<=j0+n; j++) { 365 printf(format, m[i][j]); 366 } 367 putchar('\n'); 368 } 369 putchar('\n'); 370 }*/ 371 /* ----------------------------------------------------------------------------------------- */ 372 IMAGE_EXPORT(void) display_imatrix_endline0(int **m,long i0, long i1, char *format, char *name) 373 /* ----------------------------------------------------------------------------------------- */ 374 { 375 int i, j, n; 376 377 if(name != NULL) puts(name); 378 379 for(i=i0; i<=i1; i++) { 380 printf("[%3d] ", i); 381 n = m[i][0]; 382 for(j=1; j<=+n; j++) { 383 printf(format, m[i][j]); 384 } 385 putchar('\n'); 386 } 387 putchar('\n'); 388 } 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 389 96 /* ------------------------------- */ 390 97 /* --- display_matrix_endline1 --- */ 391 98 /* ------------------------------- */ 392 /* ------------------------------------------------------------------------------------------------------------ */ 393 IMAGE_EXPORT(void) display_bmatrix_endline1(byte **m,long i0, long i1, long j0, long j1, char *format, char *name) 394 /* ------------------------------------------------------------------------------------------------------------ */ 395 { 396 int i, j, n; 397 398 if(name != NULL) puts(name); 399 400 for(i=i0; i<=i1; i++) { 401 n = m[i][j0-1]; 402 for(j=j0; j<=j0+n-1; j++) { 403 printf(format, m[i][j]); 404 } 405 putchar('\n'); 406 } 407 putchar('\n'); 408 } 409 /* --------------------------------------------------------------------------------------------------------------- */ 410 IMAGE_EXPORT(void) display_i16matrix_endline1(int16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 411 /* --------------------------------------------------------------------------------------------------------------- */ 412 { 413 int i, j, n; 414 415 if(name != NULL) puts(name); 416 417 for(i=i0; i<=i1; i++) { 418 n = m[i][j0-1]; 419 for(j=j0; j<=j0+n-1; j++) { 420 printf(format, m[i][j]); 421 } 422 putchar('\n'); 423 } 424 putchar('\n'); 425 } 426 /* ----------------------------------------------------------------------------------------------------------------- */ 427 IMAGE_EXPORT(void) display_ui16matrix_endline1(uint16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 428 /* ----------------------------------------------------------------------------------------------------------------- */ 429 { 430 int i, j, n; 431 432 if(name != NULL) puts(name); 433 434 for(i=i0; i<=i1; i++) { 435 n = m[i][j0-1]; 436 for(j=j0; j<=j0+n-1; j++) { 437 printf(format, m[i][j]); 438 } 439 putchar('\n'); 440 } 441 putchar('\n'); 442 } 443 /* --------------------------------------------------------------------------------------------------------------- */ 444 IMAGE_EXPORT(void) display_i32matrix_endline1(int32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 445 /* --------------------------------------------------------------------------------------------------------------- */ 446 { 447 int i, j, n; 448 449 if(name != NULL) puts(name); 450 451 for(i=i0; i<=i1; i++) { 452 n = m[i][j0-1]; 453 for(j=j0; j<=j0+n-1; j++) { 454 printf(format, m[i][j]); 455 } 456 putchar('\n'); 457 } 458 putchar('\n'); 459 } 460 /* ----------------------------------------------------------------------------------------------------------------- */ 461 IMAGE_EXPORT(void) display_ui32matrix_endline1(uint32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 462 /* ----------------------------------------------------------------------------------------------------------------- */ 463 { 464 int i, j, n; 465 466 if(name != NULL) puts(name); 467 468 for(i=i0; i<=i1; i++) { 469 n = m[i][j0-1]; 470 for(j=j0; j<=j0+n-1; j++) { 471 printf(format, m[i][j]); 472 } 473 putchar('\n'); 474 } 475 putchar('\n'); 476 } 477 /* --------------------------------------------------------------------------------------------------------------- */ 478 IMAGE_EXPORT(void) display_i64matrix_endline1(int64 **m,long i0, long i1, long j0, long j1, char *format, char *name) 479 /* --------------------------------------------------------------------------------------------------------------- */ 480 { 481 int i, j; 482 int64 n; 483 484 if(name != NULL) puts(name); 485 486 for(i=i0; i<=i1; i++) { 487 n = m[i][j0-1]; 488 for(j=j0; j<=j0+n-1; j++) { 489 printf(format, m[i][j]); 490 } 491 putchar('\n'); 492 } 493 putchar('\n'); 494 } 495 /* ----------------------------------------------------------------------------------------------------------- */ 496 IMAGE_EXPORT(void) display_imatrix_endline1(int **m,long i0, long i1, long j0, long j1, char *format, char *name) 497 /* ----------------------------------------------------------------------------------------------------------- */ 498 { 499 int i, j, n; 500 501 if(name != NULL) puts(name); 502 503 for(i=i0; i<=i1; i++) { 504 n = m[i][j0-1]; 505 for(j=j0; j<=j0+n-1; j++) { 506 printf(format, m[i][j]); 507 } 508 putchar('\n'); 509 } 510 putchar('\n'); 511 } 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 512 128 /* -------------------------------------- */ 513 129 /* --- display_matrix_number_endline0 --- */ 514 130 /* -------------------------------------- */ 515 /* ------------------------------------------------------------------------------------------------------------------- */ 516 IMAGE_EXPORT(void) display_bmatrix_number_endline0(byte **m,long i0, long i1, long j0, long j1, char *format, char *name) 517 /* ------------------------------------------------------------------------------------------------------------------- */ 518 { 519 int i, j, n; 520 521 if(name != NULL) puts(name); 522 523 for(i=i0; i<=i1; i++) { 524 printf("[%3d]", i); 525 n = m[i][j0]; 526 for(j=j0; j<=j0+n; j++) { 527 printf(format, m[i][j]); 528 } 529 putchar('\n'); 530 } 531 putchar('\n'); 532 } 533 /* ---------------------------------------------------------------------------------------------------------------------- */ 534 IMAGE_EXPORT(void) display_i16matrix_number_endline0(int16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 535 /* ---------------------------------------------------------------------------------------------------------------------- */ 536 { 537 int i, j, n; 538 539 if(name != NULL) puts(name); 540 541 for(i=i0; i<=i1; i++) { 542 printf("[%3d]", i); 543 n = m[i][j0]; 544 for(j=j0; j<=j0+n; j++) { 545 printf(format, m[i][j]); 546 } 547 putchar('\n'); 548 } 549 putchar('\n'); 550 } 551 /* ------------------------------------------------------------------------------------------------------------------------ */ 552 IMAGE_EXPORT(void) display_ui16matrix_number_endline0(uint16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 553 /* ------------------------------------------------------------------------------------------------------------------------ */ 554 { 555 int i, j, n; 556 557 if(name != NULL) puts(name); 558 559 for(i=i0; i<=i1; i++) { 560 printf("[%3d]", i); 561 n = m[i][j0]; 562 for(j=j0; j<=j0+n; j++) { 563 printf(format, m[i][j]); 564 } 565 putchar('\n'); 566 } 567 putchar('\n'); 568 } 569 /* ---------------------------------------------------------------------------------------------------------------------- */ 570 IMAGE_EXPORT(void) display_i32matrix_number_endline0(int32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 571 /* ---------------------------------------------------------------------------------------------------------------------- */ 572 { 573 int i, j, n; 574 575 if(name != NULL) puts(name); 576 577 for(i=i0; i<=i1; i++) { 578 printf("[%3d]", i); 579 n = m[i][j0]; 580 for(j=j0; j<=j0+n; j++) { 581 printf(format, m[i][j]); 582 } 583 putchar('\n'); 584 } 585 putchar('\n'); 586 } 587 /* ------------------------------------------------------------------------------------------------------------------------ */ 588 IMAGE_EXPORT(void) display_ui32matrix_number_endline0(uint32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 589 /* ------------------------------------------------------------------------------------------------------------------------ */ 590 { 591 int i, j, n; 592 593 if(name != NULL) puts(name); 594 595 for(i=i0; i<=i1; i++) { 596 printf("[%3d]", i); 597 n = m[i][j0]; 598 for(j=j0; j<=j0+n; j++) { 599 printf(format, m[i][j]); 600 } 601 putchar('\n'); 602 } 603 putchar('\n'); 604 } 605 /* ---------------------------------------------------------------------------------------------------------------------- */ 606 IMAGE_EXPORT(void) display_i64matrix_number_endline0(int64 **m,long i0, long i1, long j0, long j1, char *format, char *name) 607 /* ---------------------------------------------------------------------------------------------------------------------- */ 608 { 609 int i, j; 610 int64 n; 611 612 if(name != NULL) puts(name); 613 614 for(i=i0; i<=i1; i++) { 615 printf("[%3d]", i); 616 n = m[i][j0]; 617 for(j=j0; j<=j0+n; j++) { 618 printf(format, m[i][j]); 619 } 620 putchar('\n'); 621 } 622 putchar('\n'); 623 } 624 /* ------------------------------------------------------------------------------------------------------------------ */ 625 IMAGE_EXPORT(void) display_imatrix_number_endline0(int **m,long i0, long i1, long j0, long j1, char *format, char *name) 626 /* ------------------------------------------------------------------------------------------------------------------ */ 627 { 628 int i, j, n; 629 630 if(name != NULL) puts(name); 631 632 for(i=i0; i<=i1; i++) { 633 printf("[%3d]", i); 634 n = m[i][j0]; 635 for(j=j0; j<=j0+n; j++) { 636 printf(format, m[i][j]); 637 } 638 putchar('\n'); 639 } 640 putchar('\n'); 641 } 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 642 161 /* -------------------------------------- */ 643 162 /* --- display_matrix_number_endline1 --- */ 644 163 /* -------------------------------------- */ 645 /* ------------------------------------------------------------------------------------------------------------------- */ 646 IMAGE_EXPORT(void) display_bmatrix_number_endline1(byte **m,long i0, long i1, long j0, long j1, char *format, char *name) 647 /* ------------------------------------------------------------------------------------------------------------------- */ 648 { 649 int i, j, n; 650 651 if(name != NULL) puts(name); 652 653 for(i=i0; i<=i1; i++) { 654 printf("[%3d]", i); 655 n = m[i][j0-1]; 656 for(j=j0; j<=j0+n-1; j++) { 657 printf(format, m[i][j]); 658 } 659 putchar('\n'); 660 } 661 putchar('\n'); 662 } 663 /* ---------------------------------------------------------------------------------------------------------------------- */ 664 IMAGE_EXPORT(void) display_i16matrix_number_endline1(int16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 665 /* ---------------------------------------------------------------------------------------------------------------------- */ 666 { 667 int i, j, n; 668 669 if(name != NULL) puts(name); 670 671 for(i=i0; i<=i1; i++) { 672 printf("[%3d]", i); 673 n = m[i][j0-1]; 674 for(j=j0; j<=j0+n-1; j++) { 675 printf(format, m[i][j]); 676 } 677 putchar('\n'); 678 } 679 putchar('\n'); 680 } 681 /* ------------------------------------------------------------------------------------------------------------------------ */ 682 IMAGE_EXPORT(void) display_ui16matrix_number_endline1(uint16 **m,long i0, long i1, long j0, long j1, char *format, char *name) 683 /* ------------------------------------------------------------------------------------------------------------------------ */ 684 { 685 int i, j, n; 686 687 if(name != NULL) puts(name); 688 689 for(i=i0; i<=i1; i++) { 690 printf("[%3d]", i); 691 n = m[i][j0-1]; 692 for(j=j0; j<=j0+n-1; j++) { 693 printf(format, m[i][j]); 694 } 695 putchar('\n'); 696 } 697 putchar('\n'); 698 } 699 /* ---------------------------------------------------------------------------------------------------------------------- */ 700 IMAGE_EXPORT(void) display_i32matrix_number_endline1(int32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 701 /* ---------------------------------------------------------------------------------------------------------------------- */ 702 { 703 int i, j, n; 704 705 if(name != NULL) puts(name); 706 707 for(i=i0; i<=i1; i++) { 708 printf("[%3d]", i); 709 n = m[i][j0-1]; 710 for(j=j0; j<=j0+n-1; j++) { 711 printf(format, m[i][j]); 712 } 713 putchar('\n'); 714 } 715 putchar('\n'); 716 } 717 /* ------------------------------------------------------------------------------------------------------------------------ */ 718 IMAGE_EXPORT(void) display_ui32matrix_number_endline1(uint32 **m,long i0, long i1, long j0, long j1, char *format, char *name) 719 /* ------------------------------------------------------------------------------------------------------------------------ */ 720 { 721 int i, j, n; 722 723 if(name != NULL) puts(name); 724 725 for(i=i0; i<=i1; i++) { 726 printf("[%3d]", i); 727 n = m[i][j0-1]; 728 for(j=j0; j<=j0+n-1; j++) { 729 printf(format, m[i][j]); 730 } 731 putchar('\n'); 732 } 733 putchar('\n'); 734 } 735 /* ---------------------------------------------------------------------------------------------------------------------- */ 736 IMAGE_EXPORT(void) display_i64matrix_number_endline1(int64 **m,long i0, long i1, long j0, long j1, char *format, char *name) 737 /* ---------------------------------------------------------------------------------------------------------------------- */ 738 { 739 int i, j; 740 int64 n; 741 742 if(name != NULL) puts(name); 743 744 for(i=i0; i<=i1; i++) { 745 printf("[%3d]", i); 746 n = m[i][j0-1]; 747 for(j=j0; j<=j0+n-1; j++) { 748 printf(format, m[i][j]); 749 } 750 putchar('\n'); 751 } 752 putchar('\n'); 753 } 754 /* ------------------------------------------------------------------------------------------------------------------ */ 755 IMAGE_EXPORT(void) display_imatrix_number_endline1(int **m,long i0, long i1, long j0, long j1, char *format, char *name) 756 /* ------------------------------------------------------------------------------------------------------------------ */ 757 { 758 int i, j, n; 759 760 if(name != NULL) puts(name); 761 762 for(i=i0; i<=i1; i++) { 763 printf("[%3d]", i); 764 n = m[i][j0-1]; 765 for(j=j0; j<=j0+n-1; j++) { 766 printf(format, m[i][j]); 767 } 768 putchar('\n'); 769 } 770 putchar('\n'); 771 } 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 772 194 /* ------------------------- */ 773 195 /* --- display_trimatrix --- */ 774 196 /* ------------------------- */ 775 /* ------------------------------------------------------------------------------------------------------------------ */ 776 IMAGE_EXPORT(void) display_btrimatrix(byte **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 777 /* ------------------------------------------------------------------------------------------------------------------ */ 778 { 779 int i, j; 780 if(name != NULL) puts(name); 781 782 for(i=i0; i<=i1; i++) { 783 for(j=j0; j<=j1; j++) { 784 printf(format, m[i][j]); 785 } 786 putchar('\n'); 787 j1 += step; 788 } 789 putchar('\n'); 790 } 791 /* --------------------------------------------------------------------------------------------------------------------- */ 792 IMAGE_EXPORT(void) display_i16trimatrix(int16 **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 793 /* --------------------------------------------------------------------------------------------------------------------- */ 794 { 795 int i, j; 796 797 if(name != NULL) puts(name); 798 799 for(i=i0; i<=i1; i++) { 800 for(j=j0; j<=j1; j++) { 801 printf(format, m[i][j]); 802 } 803 putchar('\n'); 804 j1 += step; 805 } 806 putchar('\n'); 807 } 808 /* ----------------------------------------------------------------------------------------------------------------------- */ 809 IMAGE_EXPORT(void) display_ui16trimatrix(uint16 **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 810 /* ----------------------------------------------------------------------------------------------------------------------- */ 811 { 812 int i, j; 813 814 if(name != NULL) puts(name); 815 816 for(i=i0; i<=i1; i++) { 817 for(j=j0; j<=j1; j++) { 818 printf(format, m[i][j]); 819 } 820 putchar('\n'); 821 j1 += step; 822 } 823 putchar('\n'); 824 } 825 /* ----------------------------------------------------------------------------------------------------------------- */ 826 IMAGE_EXPORT(void) display_itrimatrix(int **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 827 /* ----------------------------------------------------------------------------------------------------------------- */ 828 { 829 int i, j; 830 831 if(name != NULL) puts(name); 832 833 for(i=i0; i<=i1; i++) { 834 for(j=j0; j<=j1; j++) { 835 printf(format, m[i][j]); 836 } 837 putchar('\n'); 838 j1 += step; 839 } 840 putchar('\n'); 841 } 842 /* --------------------------------------------------------------------------------------------------------------------- */ 843 IMAGE_EXPORT(void) display_i32trimatrix(int32 **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 844 /* --------------------------------------------------------------------------------------------------------------------- */ 845 { 846 int i, j; 847 848 if(name != NULL) puts(name); 849 850 for(i=i0; i<=i1; i++) { 851 for(j=j0; j<=j1; j++) { 852 printf(format, m[i][j]); 853 } 854 putchar('\n'); 855 j1 += step; 856 } 857 putchar('\n'); 858 } 859 /* ------------------------------------------------------------------------------------------------------------------ */ 860 IMAGE_EXPORT(void) display_f32trimatrix(float32 **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 861 /* ------------------------------------------------------------------------------------------------------------------ */ 862 { 863 int i, j; 864 865 if(name != NULL) puts(name); 866 867 for(i=i0; i<=i1; i++) { 868 for(j=j0; j<=j1; j++) { 869 printf(format, m[i][j]); 870 } 871 putchar('\n'); 872 j1 += step; 873 } 874 putchar('\n'); 875 } 876 /* ------------------------------------------------------------------------------------------------------------------ */ 877 IMAGE_EXPORT(void) display_f64trimatrix(float64 **m, long i0, long i1, long j0, long j1, long step, char *format, char *name) 878 /* ------------------------------------------------------------------------------------------------------------------ */ 879 { 880 int i, j; 881 882 if(name != NULL) puts(name); 883 884 for(i=i0; i<=i1; i++) { 885 for(j=j0; j<=j1; j++) { 886 printf(format, m[i][j]); 887 } 888 putchar('\n'); 889 j1 += step; 890 } 891 putchar('\n'); 892 } 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
Note: See TracChangeset
for help on using the changeset viewer.