Line data Source code
1 : /* File: layout_order.inl; Copyright and License: see below */ 2 : 3 : #include "u8/u8_trace.h" 4 : 5 : static inline void layout_order_private_init ( layout_order_t *this_, layout_order_type_t order_type, int32_t first, int32_t second ) 6 : { 7 : (*this_).first = first; 8 : (*this_).second = second; 9 : (*this_).order_type = order_type; 10 : } 11 : 12 : 13 : static inline void layout_order_private_reinit ( layout_order_t *this_, layout_order_type_t order_type, int32_t first, int32_t second ) 14 : { 15 : (*this_).first = first; 16 : (*this_).second = second; 17 : (*this_).order_type = order_type; 18 : } 19 : 20 0 : static inline void layout_order_init_x_y ( layout_order_t *this_, int32_t x_order, int32_t y_order ) 21 : { 22 0 : (*this_).first = x_order; 23 0 : (*this_).second = y_order; 24 0 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_X_Y; 25 0 : } 26 : 27 : static inline void layout_order_reinit_x_y ( layout_order_t *this_, int32_t x_order, int32_t y_order ) 28 : { 29 : (*this_).first = x_order; 30 : (*this_).second = y_order; 31 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_X_Y; 32 : } 33 : 34 0 : static inline void layout_order_init_list ( layout_order_t *this_, int32_t list_order ) 35 : { 36 0 : (*this_).first = list_order; 37 0 : (*this_).second = 0; 38 0 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_LIST; 39 0 : } 40 : 41 : static inline void layout_order_reinit_list ( layout_order_t *this_, int32_t list_order ) 42 : { 43 : (*this_).first = list_order; 44 : (*this_).second = 0; 45 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_LIST; 46 : } 47 : 48 : static inline void layout_order_copy ( layout_order_t *this_, const layout_order_t *original ) 49 : { 50 : (*this_) = (*original); 51 : } 52 : 53 : static inline void layout_order_replace ( layout_order_t *this_, const layout_order_t *original ) 54 : { 55 : (*this_) = (*original); 56 : } 57 : 58 0 : static inline void layout_order_init_empty ( layout_order_t *this_ ) 59 : { 60 0 : (*this_).first = 0; 61 0 : (*this_).second = 0; 62 0 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_NONE; 63 0 : } 64 : 65 : static inline void layout_order_reinit_empty ( layout_order_t *this_ ) 66 : { 67 : (*this_).first = 0; 68 : (*this_).second = 0; 69 : (*this_).order_type = PENCIL_LAYOUT_ORDER_TYPE_NONE; 70 : } 71 : 72 : static inline void layout_order_destroy ( layout_order_t *this_ ) 73 : { 74 : } 75 : 76 0 : static inline layout_order_type_t layout_order_get_order_type ( const layout_order_t *this_ ) 77 : { 78 0 : return (*this_).order_type; 79 : } 80 : 81 0 : static inline int32_t layout_order_get_first ( const layout_order_t *this_ ) 82 : { 83 0 : return (*this_).first; 84 : } 85 : 86 0 : static inline int32_t layout_order_get_second ( const layout_order_t *this_ ) 87 : { 88 0 : return (*this_).second; 89 : } 90 : 91 0 : static inline void layout_order_trace ( const layout_order_t *this_ ) 92 : { 93 0 : U8_TRACE_INFO( "layout_order_t" ); 94 0 : switch ( (*this_).order_type ) 95 : { 96 0 : case PENCIL_LAYOUT_ORDER_TYPE_NONE: 97 : { 98 0 : U8_TRACE_INFO( "- order_type: PENCIL_LAYOUT_ORDER_TYPE_NONE" ); 99 : } 100 0 : break; 101 : 102 0 : case PENCIL_LAYOUT_ORDER_TYPE_OUT_OF_RANGE: 103 : { 104 0 : U8_TRACE_INFO( "- order_type: PENCIL_LAYOUT_ORDER_TYPE_OUT_OF_RANGE" ); 105 : } 106 0 : break; 107 : 108 0 : case PENCIL_LAYOUT_ORDER_TYPE_X_Y: 109 : { 110 0 : U8_TRACE_INFO( "- order_type: PENCIL_LAYOUT_ORDER_TYPE_X_Y" ); 111 : } 112 0 : break; 113 : 114 0 : case PENCIL_LAYOUT_ORDER_TYPE_LIST: 115 : { 116 0 : U8_TRACE_INFO( "- order_type: PENCIL_LAYOUT_ORDER_TYPE_LIST" ); 117 : } 118 0 : break; 119 : 120 0 : default: 121 : { 122 0 : U8_TRACE_INFO( "- order_type: <error>" ); 123 : } 124 0 : break; 125 : } 126 0 : U8_TRACE_INFO_INT( "- first:", (*this_).first ); 127 0 : U8_TRACE_INFO_INT( "- second:", (*this_).second ); 128 0 : } 129 : 130 : 131 : /* 132 : Copyright 2018-2024 Andreas Warnke 133 : 134 : Licensed under the Apache License, Version 2.0 (the "License"); 135 : you may not use this file except in compliance with the License. 136 : You may obtain a copy of the License at 137 : 138 : http://www.apache.org/licenses/LICENSE-2.0 139 : 140 : Unless required by applicable law or agreed to in writing, software 141 : distributed under the License is distributed on an "AS IS" BASIS, 142 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 143 : See the License for the specific language governing permissions and 144 : limitations under the License. 145 : */