[772] | 1 | /* ---------------- */ |
---|
| 2 | /* --- nrio1x.c --- */ |
---|
| 3 | /* ---------------- */ |
---|
| 4 | |
---|
| 5 | /* |
---|
| 6 | * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved |
---|
| 7 | * Univ Paris Sud XI, CNRS |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include <stdlib.h> |
---|
| 11 | #include <stdio.h> |
---|
| 12 | |
---|
| 13 | #include "nrc_os_config.h" |
---|
| 14 | #include "mypredef.h" |
---|
| 15 | #include "nrtype.h" |
---|
| 16 | #include "nrdef.h" |
---|
| 17 | #include "nrkernel.h" |
---|
| 18 | #include "nrmacro.h" |
---|
| 19 | |
---|
| 20 | #include "nralloc1.h" |
---|
| 21 | #include "nrio1x.h" |
---|
| 22 | |
---|
[822] | 23 | #undef display_type_vector_circular |
---|
| 24 | #define display_type_vector_circular(t) \ |
---|
| 25 | void short_name(t,display_,vector_circular)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \ |
---|
| 26 | { \ |
---|
| 27 | int32_t n = nh - nl + 1; \ |
---|
| 28 | if (name != NULL) { \ |
---|
| 29 | printf("%s\n", name); \ |
---|
| 30 | } \ |
---|
| 31 | for (int32_t i = c0; i <= c1; i++) { \ |
---|
| 32 | printf(format, v[i % n + nl]); \ |
---|
| 33 | } \ |
---|
| 34 | printf("\n"); \ |
---|
[772] | 35 | } |
---|
| 36 | |
---|
| 37 | |
---|
[822] | 38 | display_type_vector_circular(int8_t); |
---|
| 39 | display_type_vector_circular(uint8_t); |
---|
| 40 | display_type_vector_circular(int16_t); |
---|
| 41 | display_type_vector_circular(uint16_t); |
---|
| 42 | display_type_vector_circular(int32_t); |
---|
| 43 | display_type_vector_circular(uint32_t); |
---|
| 44 | display_type_vector_circular(int64_t); |
---|
| 45 | display_type_vector_circular(uint64_t); |
---|
| 46 | display_type_vector_circular(float); |
---|
| 47 | display_type_vector_circular(double); |
---|
[772] | 48 | |
---|
| 49 | |
---|
| 50 | |
---|
[822] | 51 | #undef display_type_vector_circular_number |
---|
| 52 | #define display_type_vector_circular_number(t) \ |
---|
| 53 | void short_name(t,display_,vector_circular_number)(t * v, int32_t nl, int32_t nh, int32_t c0, int32_t c1, char * format, char * name) \ |
---|
| 54 | { \ |
---|
| 55 | int32_t n = nh - nl + 1; \ |
---|
| 56 | if (name != NULL) { \ |
---|
| 57 | printf("%s", name); \ |
---|
| 58 | } \ |
---|
| 59 | printf("#"); \ |
---|
| 60 | for (int32_t i = c0; i <= c1; i++) { \ |
---|
| 61 | printf(format, i % n + nl); \ |
---|
| 62 | } \ |
---|
| 63 | printf("\n "); \ |
---|
| 64 | for (int32_t i = c0; i <= c1; i++) { \ |
---|
| 65 | printf(format, v[i % n + nl]); \ |
---|
| 66 | } \ |
---|
| 67 | printf("\n"); \ |
---|
[772] | 68 | } |
---|
| 69 | |
---|
| 70 | |
---|
[822] | 71 | display_type_vector_circular_number(int8_t); |
---|
| 72 | display_type_vector_circular_number(uint8_t); |
---|
| 73 | display_type_vector_circular_number(int16_t); |
---|
| 74 | display_type_vector_circular_number(uint16_t); |
---|
| 75 | display_type_vector_circular_number(int32_t); |
---|
| 76 | display_type_vector_circular_number(uint32_t); |
---|
| 77 | display_type_vector_circular_number(int64_t); |
---|
| 78 | display_type_vector_circular_number(uint64_t); |
---|
| 79 | display_type_vector_circular_number(float); |
---|
| 80 | display_type_vector_circular_number(double); |
---|
[772] | 81 | |
---|
| 82 | |
---|
| 83 | |
---|
[822] | 84 | #undef display_type_vector_cycle |
---|
| 85 | #define display_type_vector_cycle(t) \ |
---|
| 86 | void short_name(t,display_,vector_cycle)(t * v, int32_t nl, int32_t nh, char * format, char * name) \ |
---|
| 87 | { \ |
---|
| 88 | uint8_t first; \ |
---|
| 89 | uint8_t next; \ |
---|
| 90 | uint8_t * displayed; \ |
---|
| 91 | \ |
---|
| 92 | if (name != NULL) { \ |
---|
| 93 | printf("%s", name); \ |
---|
| 94 | } \ |
---|
| 95 | displayed = ui8vector0(nl, nh); \ |
---|
| 96 | for (int32_t i = nl; i <= nh; i++) { \ |
---|
| 97 | if (!displayed[i]) { \ |
---|
| 98 | displayed[i] = 1; \ |
---|
| 99 | printf(format, i); \ |
---|
| 100 | first = (t) i; \ |
---|
| 101 | next = v[i]; \ |
---|
| 102 | while (first != next) { \ |
---|
| 103 | displayed[next] = 1; \ |
---|
| 104 | printf(format, next); \ |
---|
| 105 | next = v[next]; \ |
---|
| 106 | } \ |
---|
| 107 | printf("\n"); \ |
---|
| 108 | } \ |
---|
| 109 | } \ |
---|
| 110 | printf("\n"); \ |
---|
| 111 | free_ui8vector(displayed, nl, nh); \ |
---|
[772] | 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
[822] | 115 | display_type_vector_cycle(int8_t); |
---|
| 116 | display_type_vector_cycle(uint8_t); |
---|
| 117 | display_type_vector_cycle(int16_t); |
---|
| 118 | display_type_vector_cycle(uint16_t); |
---|
| 119 | display_type_vector_cycle(int32_t); |
---|
| 120 | display_type_vector_cycle(uint32_t); |
---|
| 121 | display_type_vector_cycle(int64_t); |
---|
| 122 | display_type_vector_cycle(uint64_t); |
---|
| 123 | display_type_vector_cycle(float); |
---|
| 124 | display_type_vector_cycle(double); |
---|
[772] | 125 | |
---|
| 126 | |
---|
[822] | 127 | // Local Variables: |
---|
| 128 | // tab-width: 4 |
---|
| 129 | // c-basic-offset: 4 |
---|
| 130 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 131 | // indent-tabs-mode: nil |
---|
| 132 | // End: |
---|
[772] | 133 | |
---|
[822] | 134 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
[772] | 135 | |
---|