Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- emu3/include/lzma/block.h +694 -0
- emu3/include/lzma/delta.h +95 -0
- emu3/include/lzma/hardware.h +62 -0
- emu3/include/lzma/index.h +882 -0
- emu3/include/ncurses/curses.h +0 -0
- emu3/include/ncurses/cursesapp.h +191 -0
- emu3/include/ncurses/cursesp.h +271 -0
- emu3/include/ncurses/cursslk.h +240 -0
- emu3/include/ncurses/eti.h +55 -0
- emu3/include/ncurses/etip.h +406 -0
- emu3/include/ncurses/form.h +460 -0
- emu3/include/ncurses/menu.h +281 -0
- emu3/include/ncurses/nc_tparm.h +92 -0
- emu3/include/ncurses/ncurses.h +0 -0
- emu3/include/ncurses/ncurses_dll.h +99 -0
- emu3/include/ncurses/panel.h +100 -0
- emu3/include/ncursesw/curses.h +0 -0
- emu3/include/ncursesw/cursesapp.h +191 -0
- emu3/include/ncursesw/cursesf.h +968 -0
- emu3/include/ncursesw/cursesm.h +674 -0
- emu3/include/ncursesw/cursesp.h +271 -0
- emu3/include/ncursesw/cursesw.h +1581 -0
- emu3/include/ncursesw/cursslk.h +240 -0
- emu3/include/ncursesw/eti.h +55 -0
- emu3/include/ncursesw/etip.h +406 -0
- emu3/include/ncursesw/form.h +460 -0
- emu3/include/ncursesw/menu.h +281 -0
- emu3/include/ncursesw/nc_tparm.h +92 -0
- emu3/include/ncursesw/ncurses.h +0 -0
- emu3/include/ncursesw/ncurses_dll.h +99 -0
- emu3/include/ncursesw/panel.h +100 -0
- emu3/include/ncursesw/term.h +893 -0
- emu3/include/ncursesw/term_entry.h +239 -0
- emu3/include/ncursesw/termcap.h +73 -0
- emu3/include/ncursesw/tic.h +396 -0
- emu3/include/ncursesw/unctrl.h +68 -0
- emu3/include/openssl/buffer.h +62 -0
- emu3/include/openssl/camellia.h +117 -0
- emu3/include/openssl/cmserr.h +125 -0
- emu3/include/openssl/configuration.h +131 -0
- emu3/include/openssl/ecdh.h +10 -0
- emu3/include/openssl/obj_mac.h +0 -0
- emu3/include/openssl/ripemd.h +59 -0
- emu3/include/openssl/x509v3.h +1450 -0
- infer_4_37_2/README.md +249 -0
- infer_4_37_2/bin/2to3-3.10 +5 -0
- infer_4_37_2/bin/accelerate-config +8 -0
- infer_4_37_2/bin/accelerate-launch +8 -0
- infer_4_37_2/bin/bzip2 +3 -0
.gitattributes
CHANGED
|
@@ -1069,3 +1069,4 @@ infer_4_33_0/lib/python3.10/site-packages/scipy/stats/tests/__pycache__/test_sta
|
|
| 1069 |
infer_4_33_0/lib/python3.10/site-packages/scipy/stats/_rcont/rcont.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1070 |
infer_4_33_0/lib/python3.10/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1071 |
infer_4_33_0/lib/python3.10/site-packages/scipy/signal/__pycache__/_signaltools.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1069 |
infer_4_33_0/lib/python3.10/site-packages/scipy/stats/_rcont/rcont.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1070 |
infer_4_33_0/lib/python3.10/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1071 |
infer_4_33_0/lib/python3.10/site-packages/scipy/signal/__pycache__/_signaltools.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1072 |
+
infer_4_37_2/bin/bzip2 filter=lfs diff=lfs merge=lfs -text
|
emu3/include/lzma/block.h
ADDED
|
@@ -0,0 +1,694 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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\file lzma/block.h
|
| 5 |
+
* \brief .xz Block handling
|
| 6 |
+
* \note Never include this file directly. Use <lzma.h> instead.
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
/*
|
| 10 |
+
* Author: Lasse Collin
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
#ifndef LZMA_H_INTERNAL
|
| 14 |
+
# error Never include this file directly. Use <lzma.h> instead.
|
| 15 |
+
#endif
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* \brief Options for the Block and Block Header encoders and decoders
|
| 20 |
+
*
|
| 21 |
+
* Different Block handling functions use different parts of this structure.
|
| 22 |
+
* Some read some members, other functions write, and some do both. Only the
|
| 23 |
+
* members listed for reading need to be initialized when the specified
|
| 24 |
+
* functions are called. The members marked for writing will be assigned
|
| 25 |
+
* new values at some point either by calling the given function or by
|
| 26 |
+
* later calls to lzma_code().
|
| 27 |
+
*/
|
| 28 |
+
typedef struct {
|
| 29 |
+
/**
|
| 30 |
+
* \brief Block format version
|
| 31 |
+
*
|
| 32 |
+
* To prevent API and ABI breakages when new features are needed,
|
| 33 |
+
* a version number is used to indicate which members in this
|
| 34 |
+
* structure are in use:
|
| 35 |
+
* - liblzma >= 5.0.0: version = 0 is supported.
|
| 36 |
+
* - liblzma >= 5.1.4beta: Support for version = 1 was added,
|
| 37 |
+
* which adds the ignore_check member.
|
| 38 |
+
*
|
| 39 |
+
* If version is greater than one, most Block related functions
|
| 40 |
+
* will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works
|
| 41 |
+
* with any version value).
|
| 42 |
+
*
|
| 43 |
+
* Read by:
|
| 44 |
+
* - lzma_block_header_size()
|
| 45 |
+
* - lzma_block_header_encode()
|
| 46 |
+
* - lzma_block_header_decode()
|
| 47 |
+
* - lzma_block_compressed_size()
|
| 48 |
+
* - lzma_block_unpadded_size()
|
| 49 |
+
* - lzma_block_total_size()
|
| 50 |
+
* - lzma_block_encoder()
|
| 51 |
+
* - lzma_block_decoder()
|
| 52 |
+
* - lzma_block_buffer_encode()
|
| 53 |
+
* - lzma_block_uncomp_encode()
|
| 54 |
+
* - lzma_block_buffer_decode()
|
| 55 |
+
*
|
| 56 |
+
* Written by:
|
| 57 |
+
* - lzma_block_header_decode()
|
| 58 |
+
*/
|
| 59 |
+
uint32_t version;
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* \brief Size of the Block Header field in bytes
|
| 63 |
+
*
|
| 64 |
+
* This is always a multiple of four.
|
| 65 |
+
*
|
| 66 |
+
* Read by:
|
| 67 |
+
* - lzma_block_header_encode()
|
| 68 |
+
* - lzma_block_header_decode()
|
| 69 |
+
* - lzma_block_compressed_size()
|
| 70 |
+
* - lzma_block_unpadded_size()
|
| 71 |
+
* - lzma_block_total_size()
|
| 72 |
+
* - lzma_block_decoder()
|
| 73 |
+
* - lzma_block_buffer_decode()
|
| 74 |
+
*
|
| 75 |
+
* Written by:
|
| 76 |
+
* - lzma_block_header_size()
|
| 77 |
+
* - lzma_block_buffer_encode()
|
| 78 |
+
* - lzma_block_uncomp_encode()
|
| 79 |
+
*/
|
| 80 |
+
uint32_t header_size;
|
| 81 |
+
# define LZMA_BLOCK_HEADER_SIZE_MIN 8
|
| 82 |
+
# define LZMA_BLOCK_HEADER_SIZE_MAX 1024
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* \brief Type of integrity Check
|
| 86 |
+
*
|
| 87 |
+
* The Check ID is not stored into the Block Header, thus its value
|
| 88 |
+
* must be provided also when decoding.
|
| 89 |
+
*
|
| 90 |
+
* Read by:
|
| 91 |
+
* - lzma_block_header_encode()
|
| 92 |
+
* - lzma_block_header_decode()
|
| 93 |
+
* - lzma_block_compressed_size()
|
| 94 |
+
* - lzma_block_unpadded_size()
|
| 95 |
+
* - lzma_block_total_size()
|
| 96 |
+
* - lzma_block_encoder()
|
| 97 |
+
* - lzma_block_decoder()
|
| 98 |
+
* - lzma_block_buffer_encode()
|
| 99 |
+
* - lzma_block_buffer_decode()
|
| 100 |
+
*/
|
| 101 |
+
lzma_check check;
|
| 102 |
+
|
| 103 |
+
/**
|
| 104 |
+
* \brief Size of the Compressed Data in bytes
|
| 105 |
+
*
|
| 106 |
+
* Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder
|
| 107 |
+
* will store this value to the Block Header. Block encoder doesn't
|
| 108 |
+
* care about this value, but will set it once the encoding has been
|
| 109 |
+
* finished.
|
| 110 |
+
*
|
| 111 |
+
* Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will
|
| 112 |
+
* verify that the size of the Compressed Data field matches
|
| 113 |
+
* compressed_size.
|
| 114 |
+
*
|
| 115 |
+
* Usually you don't know this value when encoding in streamed mode,
|
| 116 |
+
* and thus cannot write this field into the Block Header.
|
| 117 |
+
*
|
| 118 |
+
* In non-streamed mode you can reserve space for this field before
|
| 119 |
+
* encoding the actual Block. After encoding the data, finish the
|
| 120 |
+
* Block by encoding the Block Header. Steps in detail:
|
| 121 |
+
*
|
| 122 |
+
* - Set compressed_size to some big enough value. If you don't know
|
| 123 |
+
* better, use LZMA_VLI_MAX, but remember that bigger values take
|
| 124 |
+
* more space in Block Header.
|
| 125 |
+
*
|
| 126 |
+
* - Call lzma_block_header_size() to see how much space you need to
|
| 127 |
+
* reserve for the Block Header.
|
| 128 |
+
*
|
| 129 |
+
* - Encode the Block using lzma_block_encoder() and lzma_code().
|
| 130 |
+
* It sets compressed_size to the correct value.
|
| 131 |
+
*
|
| 132 |
+
* - Use lzma_block_header_encode() to encode the Block Header.
|
| 133 |
+
* Because space was reserved in the first step, you don't need
|
| 134 |
+
* to call lzma_block_header_size() anymore, because due to
|
| 135 |
+
* reserving, header_size has to be big enough. If it is "too big",
|
| 136 |
+
* lzma_block_header_encode() will add enough Header Padding to
|
| 137 |
+
* make Block Header to match the size specified by header_size.
|
| 138 |
+
*
|
| 139 |
+
* Read by:
|
| 140 |
+
* - lzma_block_header_size()
|
| 141 |
+
* - lzma_block_header_encode()
|
| 142 |
+
* - lzma_block_compressed_size()
|
| 143 |
+
* - lzma_block_unpadded_size()
|
| 144 |
+
* - lzma_block_total_size()
|
| 145 |
+
* - lzma_block_decoder()
|
| 146 |
+
* - lzma_block_buffer_decode()
|
| 147 |
+
*
|
| 148 |
+
* Written by:
|
| 149 |
+
* - lzma_block_header_decode()
|
| 150 |
+
* - lzma_block_compressed_size()
|
| 151 |
+
* - lzma_block_encoder()
|
| 152 |
+
* - lzma_block_decoder()
|
| 153 |
+
* - lzma_block_buffer_encode()
|
| 154 |
+
* - lzma_block_uncomp_encode()
|
| 155 |
+
* - lzma_block_buffer_decode()
|
| 156 |
+
*/
|
| 157 |
+
lzma_vli compressed_size;
|
| 158 |
+
|
| 159 |
+
/**
|
| 160 |
+
* \brief Uncompressed Size in bytes
|
| 161 |
+
*
|
| 162 |
+
* This is handled very similarly to compressed_size above.
|
| 163 |
+
*
|
| 164 |
+
* uncompressed_size is needed by fewer functions than
|
| 165 |
+
* compressed_size. This is because uncompressed_size isn't
|
| 166 |
+
* needed to validate that Block stays within proper limits.
|
| 167 |
+
*
|
| 168 |
+
* Read by:
|
| 169 |
+
* - lzma_block_header_size()
|
| 170 |
+
* - lzma_block_header_encode()
|
| 171 |
+
* - lzma_block_decoder()
|
| 172 |
+
* - lzma_block_buffer_decode()
|
| 173 |
+
*
|
| 174 |
+
* Written by:
|
| 175 |
+
* - lzma_block_header_decode()
|
| 176 |
+
* - lzma_block_encoder()
|
| 177 |
+
* - lzma_block_decoder()
|
| 178 |
+
* - lzma_block_buffer_encode()
|
| 179 |
+
* - lzma_block_uncomp_encode()
|
| 180 |
+
* - lzma_block_buffer_decode()
|
| 181 |
+
*/
|
| 182 |
+
lzma_vli uncompressed_size;
|
| 183 |
+
|
| 184 |
+
/**
|
| 185 |
+
* \brief Array of filters
|
| 186 |
+
*
|
| 187 |
+
* There can be 1-4 filters. The end of the array is marked with
|
| 188 |
+
* .id = LZMA_VLI_UNKNOWN.
|
| 189 |
+
*
|
| 190 |
+
* Read by:
|
| 191 |
+
* - lzma_block_header_size()
|
| 192 |
+
* - lzma_block_header_encode()
|
| 193 |
+
* - lzma_block_encoder()
|
| 194 |
+
* - lzma_block_decoder()
|
| 195 |
+
* - lzma_block_buffer_encode()
|
| 196 |
+
* - lzma_block_buffer_decode()
|
| 197 |
+
*
|
| 198 |
+
* Written by:
|
| 199 |
+
* - lzma_block_header_decode(): Note that this does NOT free()
|
| 200 |
+
* the old filter options structures. All unused filters[] will
|
| 201 |
+
* have .id == LZMA_VLI_UNKNOWN and .options == NULL. If
|
| 202 |
+
* decoding fails, all filters[] are guaranteed to be
|
| 203 |
+
* LZMA_VLI_UNKNOWN and NULL.
|
| 204 |
+
*
|
| 205 |
+
* \note Because of the array is terminated with
|
| 206 |
+
* .id = LZMA_VLI_UNKNOWN, the actual array must
|
| 207 |
+
* have LZMA_FILTERS_MAX + 1 members or the Block
|
| 208 |
+
* Header decoder will overflow the buffer.
|
| 209 |
+
*/
|
| 210 |
+
lzma_filter *filters;
|
| 211 |
+
|
| 212 |
+
/**
|
| 213 |
+
* \brief Raw value stored in the Check field
|
| 214 |
+
*
|
| 215 |
+
* After successful coding, the first lzma_check_size(check) bytes
|
| 216 |
+
* of this array contain the raw value stored in the Check field.
|
| 217 |
+
*
|
| 218 |
+
* Note that CRC32 and CRC64 are stored in little endian byte order.
|
| 219 |
+
* Take it into account if you display the Check values to the user.
|
| 220 |
+
*
|
| 221 |
+
* Written by:
|
| 222 |
+
* - lzma_block_encoder()
|
| 223 |
+
* - lzma_block_decoder()
|
| 224 |
+
* - lzma_block_buffer_encode()
|
| 225 |
+
* - lzma_block_uncomp_encode()
|
| 226 |
+
* - lzma_block_buffer_decode()
|
| 227 |
+
*/
|
| 228 |
+
uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
|
| 229 |
+
|
| 230 |
+
/*
|
| 231 |
+
* Reserved space to allow possible future extensions without
|
| 232 |
+
* breaking the ABI. You should not touch these, because the names
|
| 233 |
+
* of these variables may change. These are and will never be used
|
| 234 |
+
* with the currently supported options, so it is safe to leave these
|
| 235 |
+
* uninitialized.
|
| 236 |
+
*/
|
| 237 |
+
|
| 238 |
+
/** \private Reserved member. */
|
| 239 |
+
void *reserved_ptr1;
|
| 240 |
+
|
| 241 |
+
/** \private Reserved member. */
|
| 242 |
+
void *reserved_ptr2;
|
| 243 |
+
|
| 244 |
+
/** \private Reserved member. */
|
| 245 |
+
void *reserved_ptr3;
|
| 246 |
+
|
| 247 |
+
/** \private Reserved member. */
|
| 248 |
+
uint32_t reserved_int1;
|
| 249 |
+
|
| 250 |
+
/** \private Reserved member. */
|
| 251 |
+
uint32_t reserved_int2;
|
| 252 |
+
|
| 253 |
+
/** \private Reserved member. */
|
| 254 |
+
lzma_vli reserved_int3;
|
| 255 |
+
|
| 256 |
+
/** \private Reserved member. */
|
| 257 |
+
lzma_vli reserved_int4;
|
| 258 |
+
|
| 259 |
+
/** \private Reserved member. */
|
| 260 |
+
lzma_vli reserved_int5;
|
| 261 |
+
|
| 262 |
+
/** \private Reserved member. */
|
| 263 |
+
lzma_vli reserved_int6;
|
| 264 |
+
|
| 265 |
+
/** \private Reserved member. */
|
| 266 |
+
lzma_vli reserved_int7;
|
| 267 |
+
|
| 268 |
+
/** \private Reserved member. */
|
| 269 |
+
lzma_vli reserved_int8;
|
| 270 |
+
|
| 271 |
+
/** \private Reserved member. */
|
| 272 |
+
lzma_reserved_enum reserved_enum1;
|
| 273 |
+
|
| 274 |
+
/** \private Reserved member. */
|
| 275 |
+
lzma_reserved_enum reserved_enum2;
|
| 276 |
+
|
| 277 |
+
/** \private Reserved member. */
|
| 278 |
+
lzma_reserved_enum reserved_enum3;
|
| 279 |
+
|
| 280 |
+
/** \private Reserved member. */
|
| 281 |
+
lzma_reserved_enum reserved_enum4;
|
| 282 |
+
|
| 283 |
+
/**
|
| 284 |
+
* \brief A flag to Block decoder to not verify the Check field
|
| 285 |
+
*
|
| 286 |
+
* This member is supported by liblzma >= 5.1.4beta if .version >= 1.
|
| 287 |
+
*
|
| 288 |
+
* If this is set to true, the integrity check won't be calculated
|
| 289 |
+
* and verified. Unless you know what you are doing, you should
|
| 290 |
+
* leave this to false. (A reason to set this to true is when the
|
| 291 |
+
* file integrity is verified externally anyway and you want to
|
| 292 |
+
* speed up the decompression, which matters mostly when using
|
| 293 |
+
* SHA-256 as the integrity check.)
|
| 294 |
+
*
|
| 295 |
+
* If .version >= 1, read by:
|
| 296 |
+
* - lzma_block_decoder()
|
| 297 |
+
* - lzma_block_buffer_decode()
|
| 298 |
+
*
|
| 299 |
+
* Written by (.version is ignored):
|
| 300 |
+
* - lzma_block_header_decode() always sets this to false
|
| 301 |
+
*/
|
| 302 |
+
lzma_bool ignore_check;
|
| 303 |
+
|
| 304 |
+
/** \private Reserved member. */
|
| 305 |
+
lzma_bool reserved_bool2;
|
| 306 |
+
|
| 307 |
+
/** \private Reserved member. */
|
| 308 |
+
lzma_bool reserved_bool3;
|
| 309 |
+
|
| 310 |
+
/** \private Reserved member. */
|
| 311 |
+
lzma_bool reserved_bool4;
|
| 312 |
+
|
| 313 |
+
/** \private Reserved member. */
|
| 314 |
+
lzma_bool reserved_bool5;
|
| 315 |
+
|
| 316 |
+
/** \private Reserved member. */
|
| 317 |
+
lzma_bool reserved_bool6;
|
| 318 |
+
|
| 319 |
+
/** \private Reserved member. */
|
| 320 |
+
lzma_bool reserved_bool7;
|
| 321 |
+
|
| 322 |
+
/** \private Reserved member. */
|
| 323 |
+
lzma_bool reserved_bool8;
|
| 324 |
+
|
| 325 |
+
} lzma_block;
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
/**
|
| 329 |
+
* \brief Decode the Block Header Size field
|
| 330 |
+
*
|
| 331 |
+
* To decode Block Header using lzma_block_header_decode(), the size of the
|
| 332 |
+
* Block Header has to be known and stored into lzma_block.header_size.
|
| 333 |
+
* The size can be calculated from the first byte of a Block using this macro.
|
| 334 |
+
* Note that if the first byte is 0x00, it indicates beginning of Index; use
|
| 335 |
+
* this macro only when the byte is not 0x00.
|
| 336 |
+
*
|
| 337 |
+
* There is no encoding macro because lzma_block_header_size() and
|
| 338 |
+
* lzma_block_header_encode() should be used.
|
| 339 |
+
*/
|
| 340 |
+
#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4)
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
/**
|
| 344 |
+
* \brief Calculate Block Header Size
|
| 345 |
+
*
|
| 346 |
+
* Calculate the minimum size needed for the Block Header field using the
|
| 347 |
+
* settings specified in the lzma_block structure. Note that it is OK to
|
| 348 |
+
* increase the calculated header_size value as long as it is a multiple of
|
| 349 |
+
* four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size
|
| 350 |
+
* just means that lzma_block_header_encode() will add Header Padding.
|
| 351 |
+
*
|
| 352 |
+
* \note This doesn't check that all the options are valid i.e. this
|
| 353 |
+
* may return LZMA_OK even if lzma_block_header_encode() or
|
| 354 |
+
* lzma_block_encoder() would fail. If you want to validate the
|
| 355 |
+
* filter chain, consider using lzma_memlimit_encoder() which as
|
| 356 |
+
* a side-effect validates the filter chain.
|
| 357 |
+
*
|
| 358 |
+
* \param block Block options
|
| 359 |
+
*
|
| 360 |
+
* \return Possible lzma_ret values:
|
| 361 |
+
* - LZMA_OK: Size calculated successfully and stored to
|
| 362 |
+
* block->header_size.
|
| 363 |
+
* - LZMA_OPTIONS_ERROR: Unsupported version, filters or
|
| 364 |
+
* filter options.
|
| 365 |
+
* - LZMA_PROG_ERROR: Invalid values like compressed_size == 0.
|
| 366 |
+
*/
|
| 367 |
+
extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block)
|
| 368 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
/**
|
| 372 |
+
* \brief Encode Block Header
|
| 373 |
+
*
|
| 374 |
+
* The caller must have calculated the size of the Block Header already with
|
| 375 |
+
* lzma_block_header_size(). If a value larger than the one calculated by
|
| 376 |
+
* lzma_block_header_size() is used, the Block Header will be padded to the
|
| 377 |
+
* specified size.
|
| 378 |
+
*
|
| 379 |
+
* \param block Block options to be encoded.
|
| 380 |
+
* \param[out] out Beginning of the output buffer. This must be
|
| 381 |
+
* at least block->header_size bytes.
|
| 382 |
+
*
|
| 383 |
+
* \return Possible lzma_ret values:
|
| 384 |
+
* - LZMA_OK: Encoding was successful. block->header_size
|
| 385 |
+
* bytes were written to output buffer.
|
| 386 |
+
* - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
|
| 387 |
+
* - LZMA_PROG_ERROR: Invalid arguments, for example
|
| 388 |
+
* block->header_size is invalid or block->filters is NULL.
|
| 389 |
+
*/
|
| 390 |
+
extern LZMA_API(lzma_ret) lzma_block_header_encode(
|
| 391 |
+
const lzma_block *block, uint8_t *out)
|
| 392 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 393 |
+
|
| 394 |
+
|
| 395 |
+
/**
|
| 396 |
+
* \brief Decode Block Header
|
| 397 |
+
*
|
| 398 |
+
* block->version should (usually) be set to the highest value supported
|
| 399 |
+
* by the application. If the application sets block->version to a value
|
| 400 |
+
* higher than supported by the current liblzma version, this function will
|
| 401 |
+
* downgrade block->version to the highest value supported by it. Thus one
|
| 402 |
+
* should check the value of block->version after calling this function if
|
| 403 |
+
* block->version was set to a non-zero value and the application doesn't
|
| 404 |
+
* otherwise know that the liblzma version being used is new enough to
|
| 405 |
+
* support the specified block->version.
|
| 406 |
+
*
|
| 407 |
+
* The size of the Block Header must have already been decoded with
|
| 408 |
+
* lzma_block_header_size_decode() macro and stored to block->header_size.
|
| 409 |
+
*
|
| 410 |
+
* The integrity check type from Stream Header must have been stored
|
| 411 |
+
* to block->check.
|
| 412 |
+
*
|
| 413 |
+
* block->filters must have been allocated, but they don't need to be
|
| 414 |
+
* initialized (possible existing filter options are not freed).
|
| 415 |
+
*
|
| 416 |
+
* \param[out] block Destination for Block options
|
| 417 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 418 |
+
* Set to NULL to use malloc() (and also free()
|
| 419 |
+
* if an error occurs).
|
| 420 |
+
* \param in Beginning of the input buffer. This must be
|
| 421 |
+
* at least block->header_size bytes.
|
| 422 |
+
*
|
| 423 |
+
* \return Possible lzma_ret values:
|
| 424 |
+
* - LZMA_OK: Decoding was successful. block->header_size
|
| 425 |
+
* bytes were read from the input buffer.
|
| 426 |
+
* - LZMA_OPTIONS_ERROR: The Block Header specifies some
|
| 427 |
+
* unsupported options such as unsupported filters. This can
|
| 428 |
+
* happen also if block->version was set to a too low value
|
| 429 |
+
* compared to what would be required to properly represent
|
| 430 |
+
* the information stored in the Block Header.
|
| 431 |
+
* - LZMA_DATA_ERROR: Block Header is corrupt, for example,
|
| 432 |
+
* the CRC32 doesn't match.
|
| 433 |
+
* - LZMA_PROG_ERROR: Invalid arguments, for example
|
| 434 |
+
* block->header_size is invalid or block->filters is NULL.
|
| 435 |
+
*/
|
| 436 |
+
extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
|
| 437 |
+
const lzma_allocator *allocator, const uint8_t *in)
|
| 438 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
/**
|
| 442 |
+
* \brief Validate and set Compressed Size according to Unpadded Size
|
| 443 |
+
*
|
| 444 |
+
* Block Header stores Compressed Size, but Index has Unpadded Size. If the
|
| 445 |
+
* application has already parsed the Index and is now decoding Blocks,
|
| 446 |
+
* it can calculate Compressed Size from Unpadded Size. This function does
|
| 447 |
+
* exactly that with error checking:
|
| 448 |
+
*
|
| 449 |
+
* - Compressed Size calculated from Unpadded Size must be positive integer,
|
| 450 |
+
* that is, Unpadded Size must be big enough that after Block Header and
|
| 451 |
+
* Check fields there's still at least one byte for Compressed Size.
|
| 452 |
+
*
|
| 453 |
+
* - If Compressed Size was present in Block Header, the new value
|
| 454 |
+
* calculated from Unpadded Size is compared against the value
|
| 455 |
+
* from Block Header.
|
| 456 |
+
*
|
| 457 |
+
* \note This function must be called _after_ decoding the Block Header
|
| 458 |
+
* field so that it can properly validate Compressed Size if it
|
| 459 |
+
* was present in Block Header.
|
| 460 |
+
*
|
| 461 |
+
* \param block Block options: block->header_size must
|
| 462 |
+
* already be set with lzma_block_header_size().
|
| 463 |
+
* \param unpadded_size Unpadded Size from the Index field in bytes
|
| 464 |
+
*
|
| 465 |
+
* \return Possible lzma_ret values:
|
| 466 |
+
* - LZMA_OK: block->compressed_size was set successfully.
|
| 467 |
+
* - LZMA_DATA_ERROR: unpadded_size is too small compared to
|
| 468 |
+
* block->header_size and lzma_check_size(block->check).
|
| 469 |
+
* - LZMA_PROG_ERROR: Some values are invalid. For example,
|
| 470 |
+
* block->header_size must be a multiple of four and
|
| 471 |
+
* between 8 and 1024 inclusive.
|
| 472 |
+
*/
|
| 473 |
+
extern LZMA_API(lzma_ret) lzma_block_compressed_size(
|
| 474 |
+
lzma_block *block, lzma_vli unpadded_size)
|
| 475 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
/**
|
| 479 |
+
* \brief Calculate Unpadded Size
|
| 480 |
+
*
|
| 481 |
+
* The Index field stores Unpadded Size and Uncompressed Size. The latter
|
| 482 |
+
* can be taken directly from the lzma_block structure after coding a Block,
|
| 483 |
+
* but Unpadded Size needs to be calculated from Block Header Size,
|
| 484 |
+
* Compressed Size, and size of the Check field. This is where this function
|
| 485 |
+
* is needed.
|
| 486 |
+
*
|
| 487 |
+
* \param block Block options: block->header_size must already be
|
| 488 |
+
* set with lzma_block_header_size().
|
| 489 |
+
*
|
| 490 |
+
* \return Unpadded Size on success, or zero on error.
|
| 491 |
+
*/
|
| 492 |
+
extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block)
|
| 493 |
+
lzma_nothrow lzma_attr_pure;
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
/**
|
| 497 |
+
* \brief Calculate the total encoded size of a Block
|
| 498 |
+
*
|
| 499 |
+
* This is equivalent to lzma_block_unpadded_size() except that the returned
|
| 500 |
+
* value includes the size of the Block Padding field.
|
| 501 |
+
*
|
| 502 |
+
* \param block Block options: block->header_size must already be
|
| 503 |
+
* set with lzma_block_header_size().
|
| 504 |
+
*
|
| 505 |
+
* \return On success, total encoded size of the Block. On error,
|
| 506 |
+
* zero is returned.
|
| 507 |
+
*/
|
| 508 |
+
extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block)
|
| 509 |
+
lzma_nothrow lzma_attr_pure;
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
/**
|
| 513 |
+
* \brief Initialize .xz Block encoder
|
| 514 |
+
*
|
| 515 |
+
* Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the
|
| 516 |
+
* filter chain supports it), and LZMA_FINISH.
|
| 517 |
+
*
|
| 518 |
+
* The Block encoder encodes the Block Data, Block Padding, and Check value.
|
| 519 |
+
* It does NOT encode the Block Header which can be encoded with
|
| 520 |
+
* lzma_block_header_encode().
|
| 521 |
+
*
|
| 522 |
+
* \param strm Pointer to lzma_stream that is at least initialized
|
| 523 |
+
* with LZMA_STREAM_INIT.
|
| 524 |
+
* \param block Block options: block->version, block->check,
|
| 525 |
+
* and block->filters must have been initialized.
|
| 526 |
+
*
|
| 527 |
+
* \return Possible lzma_ret values:
|
| 528 |
+
* - LZMA_OK: All good, continue with lzma_code().
|
| 529 |
+
* - LZMA_MEM_ERROR
|
| 530 |
+
* - LZMA_OPTIONS_ERROR
|
| 531 |
+
* - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID
|
| 532 |
+
* that is not supported by this build of liblzma. Initializing
|
| 533 |
+
* the encoder failed.
|
| 534 |
+
* - LZMA_PROG_ERROR
|
| 535 |
+
*/
|
| 536 |
+
extern LZMA_API(lzma_ret) lzma_block_encoder(
|
| 537 |
+
lzma_stream *strm, lzma_block *block)
|
| 538 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
/**
|
| 542 |
+
* \brief Initialize .xz Block decoder
|
| 543 |
+
*
|
| 544 |
+
* Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using
|
| 545 |
+
* LZMA_FINISH is not required. It is supported only for convenience.
|
| 546 |
+
*
|
| 547 |
+
* The Block decoder decodes the Block Data, Block Padding, and Check value.
|
| 548 |
+
* It does NOT decode the Block Header which can be decoded with
|
| 549 |
+
* lzma_block_header_decode().
|
| 550 |
+
*
|
| 551 |
+
* \param strm Pointer to lzma_stream that is at least initialized
|
| 552 |
+
* with LZMA_STREAM_INIT.
|
| 553 |
+
* \param block Block options
|
| 554 |
+
*
|
| 555 |
+
* \return Possible lzma_ret values:
|
| 556 |
+
* - LZMA_OK: All good, continue with lzma_code().
|
| 557 |
+
* - LZMA_PROG_ERROR
|
| 558 |
+
* - LZMA_MEM_ERROR
|
| 559 |
+
*/
|
| 560 |
+
extern LZMA_API(lzma_ret) lzma_block_decoder(
|
| 561 |
+
lzma_stream *strm, lzma_block *block)
|
| 562 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 563 |
+
|
| 564 |
+
|
| 565 |
+
/**
|
| 566 |
+
* \brief Calculate maximum output size for single-call Block encoding
|
| 567 |
+
*
|
| 568 |
+
* This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks.
|
| 569 |
+
* See the documentation of lzma_stream_buffer_bound().
|
| 570 |
+
*
|
| 571 |
+
* \param uncompressed_size Size of the data to be encoded with the
|
| 572 |
+
* single-call Block encoder.
|
| 573 |
+
*
|
| 574 |
+
* \return Maximum output size in bytes for single-call Block encoding.
|
| 575 |
+
*/
|
| 576 |
+
extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
|
| 577 |
+
lzma_nothrow;
|
| 578 |
+
|
| 579 |
+
|
| 580 |
+
/**
|
| 581 |
+
* \brief Single-call .xz Block encoder
|
| 582 |
+
*
|
| 583 |
+
* In contrast to the multi-call encoder initialized with
|
| 584 |
+
* lzma_block_encoder(), this function encodes also the Block Header. This
|
| 585 |
+
* is required to make it possible to write appropriate Block Header also
|
| 586 |
+
* in case the data isn't compressible, and different filter chain has to be
|
| 587 |
+
* used to encode the data in uncompressed form using uncompressed chunks
|
| 588 |
+
* of the LZMA2 filter.
|
| 589 |
+
*
|
| 590 |
+
* When the data isn't compressible, header_size, compressed_size, and
|
| 591 |
+
* uncompressed_size are set just like when the data was compressible, but
|
| 592 |
+
* it is possible that header_size is too small to hold the filter chain
|
| 593 |
+
* specified in block->filters, because that isn't necessarily the filter
|
| 594 |
+
* chain that was actually used to encode the data. lzma_block_unpadded_size()
|
| 595 |
+
* still works normally, because it doesn't read the filters array.
|
| 596 |
+
*
|
| 597 |
+
* \param block Block options: block->version, block->check,
|
| 598 |
+
* and block->filters must have been initialized.
|
| 599 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 600 |
+
* Set to NULL to use malloc() and free().
|
| 601 |
+
* \param in Beginning of the input buffer
|
| 602 |
+
* \param in_size Size of the input buffer
|
| 603 |
+
* \param[out] out Beginning of the output buffer
|
| 604 |
+
* \param[out] out_pos The next byte will be written to out[*out_pos].
|
| 605 |
+
* *out_pos is updated only if encoding succeeds.
|
| 606 |
+
* \param out_size Size of the out buffer; the first byte into
|
| 607 |
+
* which no data is written to is out[out_size].
|
| 608 |
+
*
|
| 609 |
+
* \return Possible lzma_ret values:
|
| 610 |
+
* - LZMA_OK: Encoding was successful.
|
| 611 |
+
* - LZMA_BUF_ERROR: Not enough output buffer space.
|
| 612 |
+
* - LZMA_UNSUPPORTED_CHECK
|
| 613 |
+
* - LZMA_OPTIONS_ERROR
|
| 614 |
+
* - LZMA_MEM_ERROR
|
| 615 |
+
* - LZMA_DATA_ERROR
|
| 616 |
+
* - LZMA_PROG_ERROR
|
| 617 |
+
*/
|
| 618 |
+
extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
|
| 619 |
+
lzma_block *block, const lzma_allocator *allocator,
|
| 620 |
+
const uint8_t *in, size_t in_size,
|
| 621 |
+
uint8_t *out, size_t *out_pos, size_t out_size)
|
| 622 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 623 |
+
|
| 624 |
+
|
| 625 |
+
/**
|
| 626 |
+
* \brief Single-call uncompressed .xz Block encoder
|
| 627 |
+
*
|
| 628 |
+
* This is like lzma_block_buffer_encode() except this doesn't try to
|
| 629 |
+
* compress the data and instead encodes the data using LZMA2 uncompressed
|
| 630 |
+
* chunks. The required output buffer size can be determined with
|
| 631 |
+
* lzma_block_buffer_bound().
|
| 632 |
+
*
|
| 633 |
+
* Since the data won't be compressed, this function ignores block->filters.
|
| 634 |
+
* This function doesn't take lzma_allocator because this function doesn't
|
| 635 |
+
* allocate any memory from the heap.
|
| 636 |
+
*
|
| 637 |
+
* \param block Block options: block->version, block->check,
|
| 638 |
+
* and block->filters must have been initialized.
|
| 639 |
+
* \param in Beginning of the input buffer
|
| 640 |
+
* \param in_size Size of the input buffer
|
| 641 |
+
* \param[out] out Beginning of the output buffer
|
| 642 |
+
* \param[out] out_pos The next byte will be written to out[*out_pos].
|
| 643 |
+
* *out_pos is updated only if encoding succeeds.
|
| 644 |
+
* \param out_size Size of the out buffer; the first byte into
|
| 645 |
+
* which no data is written to is out[out_size].
|
| 646 |
+
*
|
| 647 |
+
* \return Possible lzma_ret values:
|
| 648 |
+
* - LZMA_OK: Encoding was successful.
|
| 649 |
+
* - LZMA_BUF_ERROR: Not enough output buffer space.
|
| 650 |
+
* - LZMA_UNSUPPORTED_CHECK
|
| 651 |
+
* - LZMA_OPTIONS_ERROR
|
| 652 |
+
* - LZMA_MEM_ERROR
|
| 653 |
+
* - LZMA_DATA_ERROR
|
| 654 |
+
* - LZMA_PROG_ERROR
|
| 655 |
+
*/
|
| 656 |
+
extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block,
|
| 657 |
+
const uint8_t *in, size_t in_size,
|
| 658 |
+
uint8_t *out, size_t *out_pos, size_t out_size)
|
| 659 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 660 |
+
|
| 661 |
+
|
| 662 |
+
/**
|
| 663 |
+
* \brief Single-call .xz Block decoder
|
| 664 |
+
*
|
| 665 |
+
* This is single-call equivalent of lzma_block_decoder(), and requires that
|
| 666 |
+
* the caller has already decoded Block Header and checked its memory usage.
|
| 667 |
+
*
|
| 668 |
+
* \param block Block options
|
| 669 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 670 |
+
* Set to NULL to use malloc() and free().
|
| 671 |
+
* \param in Beginning of the input buffer
|
| 672 |
+
* \param in_pos The next byte will be read from in[*in_pos].
|
| 673 |
+
* *in_pos is updated only if decoding succeeds.
|
| 674 |
+
* \param in_size Size of the input buffer; the first byte that
|
| 675 |
+
* won't be read is in[in_size].
|
| 676 |
+
* \param[out] out Beginning of the output buffer
|
| 677 |
+
* \param[out] out_pos The next byte will be written to out[*out_pos].
|
| 678 |
+
* *out_pos is updated only if encoding succeeds.
|
| 679 |
+
* \param out_size Size of the out buffer; the first byte into
|
| 680 |
+
* which no data is written to is out[out_size].
|
| 681 |
+
*
|
| 682 |
+
* \return Possible lzma_ret values:
|
| 683 |
+
* - LZMA_OK: Decoding was successful.
|
| 684 |
+
* - LZMA_OPTIONS_ERROR
|
| 685 |
+
* - LZMA_DATA_ERROR
|
| 686 |
+
* - LZMA_MEM_ERROR
|
| 687 |
+
* - LZMA_BUF_ERROR: Output buffer was too small.
|
| 688 |
+
* - LZMA_PROG_ERROR
|
| 689 |
+
*/
|
| 690 |
+
extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
|
| 691 |
+
lzma_block *block, const lzma_allocator *allocator,
|
| 692 |
+
const uint8_t *in, size_t *in_pos, size_t in_size,
|
| 693 |
+
uint8_t *out, size_t *out_pos, size_t out_size)
|
| 694 |
+
lzma_nothrow;
|
emu3/include/lzma/delta.h
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* SPDX-License-Identifier: 0BSD */
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* \file lzma/delta.h
|
| 5 |
+
* \brief Delta filter
|
| 6 |
+
* \note Never include this file directly. Use <lzma.h> instead.
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
/*
|
| 10 |
+
* Author: Lasse Collin
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
#ifndef LZMA_H_INTERNAL
|
| 14 |
+
# error Never include this file directly. Use <lzma.h> instead.
|
| 15 |
+
#endif
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* \brief Filter ID
|
| 20 |
+
*
|
| 21 |
+
* Filter ID of the Delta filter. This is used as lzma_filter.id.
|
| 22 |
+
*/
|
| 23 |
+
#define LZMA_FILTER_DELTA LZMA_VLI_C(0x03)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* \brief Type of the delta calculation
|
| 28 |
+
*
|
| 29 |
+
* Currently only byte-wise delta is supported. Other possible types could
|
| 30 |
+
* be, for example, delta of 16/32/64-bit little/big endian integers, but
|
| 31 |
+
* these are not currently planned since byte-wise delta is almost as good.
|
| 32 |
+
*/
|
| 33 |
+
typedef enum {
|
| 34 |
+
LZMA_DELTA_TYPE_BYTE
|
| 35 |
+
} lzma_delta_type;
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* \brief Options for the Delta filter
|
| 40 |
+
*
|
| 41 |
+
* These options are needed by both encoder and decoder.
|
| 42 |
+
*/
|
| 43 |
+
typedef struct {
|
| 44 |
+
/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */
|
| 45 |
+
lzma_delta_type type;
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* \brief Delta distance
|
| 49 |
+
*
|
| 50 |
+
* With the only currently supported type, LZMA_DELTA_TYPE_BYTE,
|
| 51 |
+
* the distance is as bytes.
|
| 52 |
+
*
|
| 53 |
+
* Examples:
|
| 54 |
+
* - 16-bit stereo audio: distance = 4 bytes
|
| 55 |
+
* - 24-bit RGB image data: distance = 3 bytes
|
| 56 |
+
*/
|
| 57 |
+
uint32_t dist;
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* \brief Minimum value for lzma_options_delta.dist.
|
| 61 |
+
*/
|
| 62 |
+
# define LZMA_DELTA_DIST_MIN 1
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* \brief Maximum value for lzma_options_delta.dist.
|
| 66 |
+
*/
|
| 67 |
+
# define LZMA_DELTA_DIST_MAX 256
|
| 68 |
+
|
| 69 |
+
/*
|
| 70 |
+
* Reserved space to allow possible future extensions without
|
| 71 |
+
* breaking the ABI. You should not touch these, because the names
|
| 72 |
+
* of these variables may change. These are and will never be used
|
| 73 |
+
* when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these
|
| 74 |
+
* uninitialized.
|
| 75 |
+
*/
|
| 76 |
+
|
| 77 |
+
/** \private Reserved member. */
|
| 78 |
+
uint32_t reserved_int1;
|
| 79 |
+
|
| 80 |
+
/** \private Reserved member. */
|
| 81 |
+
uint32_t reserved_int2;
|
| 82 |
+
|
| 83 |
+
/** \private Reserved member. */
|
| 84 |
+
uint32_t reserved_int3;
|
| 85 |
+
|
| 86 |
+
/** \private Reserved member. */
|
| 87 |
+
uint32_t reserved_int4;
|
| 88 |
+
|
| 89 |
+
/** \private Reserved member. */
|
| 90 |
+
void *reserved_ptr1;
|
| 91 |
+
|
| 92 |
+
/** \private Reserved member. */
|
| 93 |
+
void *reserved_ptr2;
|
| 94 |
+
|
| 95 |
+
} lzma_options_delta;
|
emu3/include/lzma/hardware.h
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* SPDX-License-Identifier: 0BSD */
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* \file lzma/hardware.h
|
| 5 |
+
* \brief Hardware information
|
| 6 |
+
* \note Never include this file directly. Use <lzma.h> instead.
|
| 7 |
+
*
|
| 8 |
+
* Since liblzma can consume a lot of system resources, it also provides
|
| 9 |
+
* ways to limit the resource usage. Applications linking against liblzma
|
| 10 |
+
* need to do the actual decisions how much resources to let liblzma to use.
|
| 11 |
+
* To ease making these decisions, liblzma provides functions to find out
|
| 12 |
+
* the relevant capabilities of the underlying hardware. Currently there
|
| 13 |
+
* is only a function to find out the amount of RAM, but in the future there
|
| 14 |
+
* will be also a function to detect how many concurrent threads the system
|
| 15 |
+
* can run.
|
| 16 |
+
*
|
| 17 |
+
* \note On some operating systems, these function may temporarily
|
| 18 |
+
* load a shared library or open file descriptor(s) to find out
|
| 19 |
+
* the requested hardware information. Unless the application
|
| 20 |
+
* assumes that specific file descriptors are not touched by
|
| 21 |
+
* other threads, this should have no effect on thread safety.
|
| 22 |
+
* Possible operations involving file descriptors will restart
|
| 23 |
+
* the syscalls if they return EINTR.
|
| 24 |
+
*/
|
| 25 |
+
|
| 26 |
+
/*
|
| 27 |
+
* Author: Lasse Collin
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
#ifndef LZMA_H_INTERNAL
|
| 31 |
+
# error Never include this file directly. Use <lzma.h> instead.
|
| 32 |
+
#endif
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* \brief Get the total amount of physical memory (RAM) in bytes
|
| 37 |
+
*
|
| 38 |
+
* This function may be useful when determining a reasonable memory
|
| 39 |
+
* usage limit for decompressing or how much memory it is OK to use
|
| 40 |
+
* for compressing.
|
| 41 |
+
*
|
| 42 |
+
* \return On success, the total amount of physical memory in bytes
|
| 43 |
+
* is returned. If the amount of RAM cannot be determined,
|
| 44 |
+
* zero is returned. This can happen if an error occurs
|
| 45 |
+
* or if there is no code in liblzma to detect the amount
|
| 46 |
+
* of RAM on the specific operating system.
|
| 47 |
+
*/
|
| 48 |
+
extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* \brief Get the number of processor cores or threads
|
| 53 |
+
*
|
| 54 |
+
* This function may be useful when determining how many threads to use.
|
| 55 |
+
* If the hardware supports more than one thread per CPU core, the number
|
| 56 |
+
* of hardware threads is returned if that information is available.
|
| 57 |
+
*
|
| 58 |
+
* \return On success, the number of available CPU threads or cores is
|
| 59 |
+
* returned. If this information isn't available or an error
|
| 60 |
+
* occurs, zero is returned.
|
| 61 |
+
*/
|
| 62 |
+
extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;
|
emu3/include/lzma/index.h
ADDED
|
@@ -0,0 +1,882 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* SPDX-License-Identifier: 0BSD */
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* \file lzma/index.h
|
| 5 |
+
* \brief Handling of .xz Index and related information
|
| 6 |
+
* \note Never include this file directly. Use <lzma.h> instead.
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
/*
|
| 10 |
+
* Author: Lasse Collin
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
#ifndef LZMA_H_INTERNAL
|
| 14 |
+
# error Never include this file directly. Use <lzma.h> instead.
|
| 15 |
+
#endif
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* \brief Opaque data type to hold the Index(es) and other information
|
| 20 |
+
*
|
| 21 |
+
* lzma_index often holds just one .xz Index and possibly the Stream Flags
|
| 22 |
+
* of the same Stream and size of the Stream Padding field. However,
|
| 23 |
+
* multiple lzma_indexes can be concatenated with lzma_index_cat() and then
|
| 24 |
+
* there may be information about multiple Streams in the same lzma_index.
|
| 25 |
+
*
|
| 26 |
+
* Notes about thread safety: Only one thread may modify lzma_index at
|
| 27 |
+
* a time. All functions that take non-const pointer to lzma_index
|
| 28 |
+
* modify it. As long as no thread is modifying the lzma_index, getting
|
| 29 |
+
* information from the same lzma_index can be done from multiple threads
|
| 30 |
+
* at the same time with functions that take a const pointer to
|
| 31 |
+
* lzma_index or use lzma_index_iter. The same iterator must be used
|
| 32 |
+
* only by one thread at a time, of course, but there can be as many
|
| 33 |
+
* iterators for the same lzma_index as needed.
|
| 34 |
+
*/
|
| 35 |
+
typedef struct lzma_index_s lzma_index;
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* \brief Iterator to get information about Blocks and Streams
|
| 40 |
+
*/
|
| 41 |
+
typedef struct {
|
| 42 |
+
struct {
|
| 43 |
+
/**
|
| 44 |
+
* \brief Pointer to Stream Flags
|
| 45 |
+
*
|
| 46 |
+
* This is NULL if Stream Flags have not been set for
|
| 47 |
+
* this Stream with lzma_index_stream_flags().
|
| 48 |
+
*/
|
| 49 |
+
const lzma_stream_flags *flags;
|
| 50 |
+
|
| 51 |
+
/** \private Reserved member. */
|
| 52 |
+
const void *reserved_ptr1;
|
| 53 |
+
|
| 54 |
+
/** \private Reserved member. */
|
| 55 |
+
const void *reserved_ptr2;
|
| 56 |
+
|
| 57 |
+
/** \private Reserved member. */
|
| 58 |
+
const void *reserved_ptr3;
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* \brief Stream number in the lzma_index
|
| 62 |
+
*
|
| 63 |
+
* The first Stream is 1.
|
| 64 |
+
*/
|
| 65 |
+
lzma_vli number;
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* \brief Number of Blocks in the Stream
|
| 69 |
+
*
|
| 70 |
+
* If this is zero, the block structure below has
|
| 71 |
+
* undefined values.
|
| 72 |
+
*/
|
| 73 |
+
lzma_vli block_count;
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* \brief Compressed start offset of this Stream
|
| 77 |
+
*
|
| 78 |
+
* The offset is relative to the beginning of the lzma_index
|
| 79 |
+
* (i.e. usually the beginning of the .xz file).
|
| 80 |
+
*/
|
| 81 |
+
lzma_vli compressed_offset;
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* \brief Uncompressed start offset of this Stream
|
| 85 |
+
*
|
| 86 |
+
* The offset is relative to the beginning of the lzma_index
|
| 87 |
+
* (i.e. usually the beginning of the .xz file).
|
| 88 |
+
*/
|
| 89 |
+
lzma_vli uncompressed_offset;
|
| 90 |
+
|
| 91 |
+
/**
|
| 92 |
+
* \brief Compressed size of this Stream
|
| 93 |
+
*
|
| 94 |
+
* This includes all headers except the possible
|
| 95 |
+
* Stream Padding after this Stream.
|
| 96 |
+
*/
|
| 97 |
+
lzma_vli compressed_size;
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* \brief Uncompressed size of this Stream
|
| 101 |
+
*/
|
| 102 |
+
lzma_vli uncompressed_size;
|
| 103 |
+
|
| 104 |
+
/**
|
| 105 |
+
* \brief Size of Stream Padding after this Stream
|
| 106 |
+
*
|
| 107 |
+
* If it hasn't been set with lzma_index_stream_padding(),
|
| 108 |
+
* this defaults to zero. Stream Padding is always
|
| 109 |
+
* a multiple of four bytes.
|
| 110 |
+
*/
|
| 111 |
+
lzma_vli padding;
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
/** \private Reserved member. */
|
| 115 |
+
lzma_vli reserved_vli1;
|
| 116 |
+
|
| 117 |
+
/** \private Reserved member. */
|
| 118 |
+
lzma_vli reserved_vli2;
|
| 119 |
+
|
| 120 |
+
/** \private Reserved member. */
|
| 121 |
+
lzma_vli reserved_vli3;
|
| 122 |
+
|
| 123 |
+
/** \private Reserved member. */
|
| 124 |
+
lzma_vli reserved_vli4;
|
| 125 |
+
} stream;
|
| 126 |
+
|
| 127 |
+
struct {
|
| 128 |
+
/**
|
| 129 |
+
* \brief Block number in the file
|
| 130 |
+
*
|
| 131 |
+
* The first Block is 1.
|
| 132 |
+
*/
|
| 133 |
+
lzma_vli number_in_file;
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* \brief Compressed start offset of this Block
|
| 137 |
+
*
|
| 138 |
+
* This offset is relative to the beginning of the
|
| 139 |
+
* lzma_index (i.e. usually the beginning of the .xz file).
|
| 140 |
+
* Normally this is where you should seek in the .xz file
|
| 141 |
+
* to start decompressing this Block.
|
| 142 |
+
*/
|
| 143 |
+
lzma_vli compressed_file_offset;
|
| 144 |
+
|
| 145 |
+
/**
|
| 146 |
+
* \brief Uncompressed start offset of this Block
|
| 147 |
+
*
|
| 148 |
+
* This offset is relative to the beginning of the lzma_index
|
| 149 |
+
* (i.e. usually the beginning of the .xz file).
|
| 150 |
+
*
|
| 151 |
+
* When doing random-access reading, it is possible that
|
| 152 |
+
* the target offset is not exactly at Block boundary. One
|
| 153 |
+
* will need to compare the target offset against
|
| 154 |
+
* uncompressed_file_offset or uncompressed_stream_offset,
|
| 155 |
+
* and possibly decode and throw away some amount of data
|
| 156 |
+
* before reaching the target offset.
|
| 157 |
+
*/
|
| 158 |
+
lzma_vli uncompressed_file_offset;
|
| 159 |
+
|
| 160 |
+
/**
|
| 161 |
+
* \brief Block number in this Stream
|
| 162 |
+
*
|
| 163 |
+
* The first Block is 1.
|
| 164 |
+
*/
|
| 165 |
+
lzma_vli number_in_stream;
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* \brief Compressed start offset of this Block
|
| 169 |
+
*
|
| 170 |
+
* This offset is relative to the beginning of the Stream
|
| 171 |
+
* containing this Block.
|
| 172 |
+
*/
|
| 173 |
+
lzma_vli compressed_stream_offset;
|
| 174 |
+
|
| 175 |
+
/**
|
| 176 |
+
* \brief Uncompressed start offset of this Block
|
| 177 |
+
*
|
| 178 |
+
* This offset is relative to the beginning of the Stream
|
| 179 |
+
* containing this Block.
|
| 180 |
+
*/
|
| 181 |
+
lzma_vli uncompressed_stream_offset;
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* \brief Uncompressed size of this Block
|
| 185 |
+
*
|
| 186 |
+
* You should pass this to the Block decoder if you will
|
| 187 |
+
* decode this Block. It will allow the Block decoder to
|
| 188 |
+
* validate the uncompressed size.
|
| 189 |
+
*/
|
| 190 |
+
lzma_vli uncompressed_size;
|
| 191 |
+
|
| 192 |
+
/**
|
| 193 |
+
* \brief Unpadded size of this Block
|
| 194 |
+
*
|
| 195 |
+
* You should pass this to the Block decoder if you will
|
| 196 |
+
* decode this Block. It will allow the Block decoder to
|
| 197 |
+
* validate the unpadded size.
|
| 198 |
+
*/
|
| 199 |
+
lzma_vli unpadded_size;
|
| 200 |
+
|
| 201 |
+
/**
|
| 202 |
+
* \brief Total compressed size
|
| 203 |
+
*
|
| 204 |
+
* This includes all headers and padding in this Block.
|
| 205 |
+
* This is useful if you need to know how many bytes
|
| 206 |
+
* the Block decoder will actually read.
|
| 207 |
+
*/
|
| 208 |
+
lzma_vli total_size;
|
| 209 |
+
|
| 210 |
+
/** \private Reserved member. */
|
| 211 |
+
lzma_vli reserved_vli1;
|
| 212 |
+
|
| 213 |
+
/** \private Reserved member. */
|
| 214 |
+
lzma_vli reserved_vli2;
|
| 215 |
+
|
| 216 |
+
/** \private Reserved member. */
|
| 217 |
+
lzma_vli reserved_vli3;
|
| 218 |
+
|
| 219 |
+
/** \private Reserved member. */
|
| 220 |
+
lzma_vli reserved_vli4;
|
| 221 |
+
|
| 222 |
+
/** \private Reserved member. */
|
| 223 |
+
const void *reserved_ptr1;
|
| 224 |
+
|
| 225 |
+
/** \private Reserved member. */
|
| 226 |
+
const void *reserved_ptr2;
|
| 227 |
+
|
| 228 |
+
/** \private Reserved member. */
|
| 229 |
+
const void *reserved_ptr3;
|
| 230 |
+
|
| 231 |
+
/** \private Reserved member. */
|
| 232 |
+
const void *reserved_ptr4;
|
| 233 |
+
} block;
|
| 234 |
+
|
| 235 |
+
/**
|
| 236 |
+
* \private Internal data
|
| 237 |
+
*
|
| 238 |
+
* Internal data which is used to store the state of the iterator.
|
| 239 |
+
* The exact format may vary between liblzma versions, so don't
|
| 240 |
+
* touch these in any way.
|
| 241 |
+
*/
|
| 242 |
+
union {
|
| 243 |
+
/** \private Internal member. */
|
| 244 |
+
const void *p;
|
| 245 |
+
|
| 246 |
+
/** \private Internal member. */
|
| 247 |
+
size_t s;
|
| 248 |
+
|
| 249 |
+
/** \private Internal member. */
|
| 250 |
+
lzma_vli v;
|
| 251 |
+
} internal[6];
|
| 252 |
+
} lzma_index_iter;
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
/**
|
| 256 |
+
* \brief Operation mode for lzma_index_iter_next()
|
| 257 |
+
*/
|
| 258 |
+
typedef enum {
|
| 259 |
+
LZMA_INDEX_ITER_ANY = 0,
|
| 260 |
+
/**<
|
| 261 |
+
* \brief Get the next Block or Stream
|
| 262 |
+
*
|
| 263 |
+
* Go to the next Block if the current Stream has at least
|
| 264 |
+
* one Block left. Otherwise go to the next Stream even if
|
| 265 |
+
* it has no Blocks. If the Stream has no Blocks
|
| 266 |
+
* (lzma_index_iter.stream.block_count == 0),
|
| 267 |
+
* lzma_index_iter.block will have undefined values.
|
| 268 |
+
*/
|
| 269 |
+
|
| 270 |
+
LZMA_INDEX_ITER_STREAM = 1,
|
| 271 |
+
/**<
|
| 272 |
+
* \brief Get the next Stream
|
| 273 |
+
*
|
| 274 |
+
* Go to the next Stream even if the current Stream has
|
| 275 |
+
* unread Blocks left. If the next Stream has at least one
|
| 276 |
+
* Block, the iterator will point to the first Block.
|
| 277 |
+
* If there are no Blocks, lzma_index_iter.block will have
|
| 278 |
+
* undefined values.
|
| 279 |
+
*/
|
| 280 |
+
|
| 281 |
+
LZMA_INDEX_ITER_BLOCK = 2,
|
| 282 |
+
/**<
|
| 283 |
+
* \brief Get the next Block
|
| 284 |
+
*
|
| 285 |
+
* Go to the next Block if the current Stream has at least
|
| 286 |
+
* one Block left. If the current Stream has no Blocks left,
|
| 287 |
+
* the next Stream with at least one Block is located and
|
| 288 |
+
* the iterator will be made to point to the first Block of
|
| 289 |
+
* that Stream.
|
| 290 |
+
*/
|
| 291 |
+
|
| 292 |
+
LZMA_INDEX_ITER_NONEMPTY_BLOCK = 3
|
| 293 |
+
/**<
|
| 294 |
+
* \brief Get the next non-empty Block
|
| 295 |
+
*
|
| 296 |
+
* This is like LZMA_INDEX_ITER_BLOCK except that it will
|
| 297 |
+
* skip Blocks whose Uncompressed Size is zero.
|
| 298 |
+
*/
|
| 299 |
+
|
| 300 |
+
} lzma_index_iter_mode;
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
/**
|
| 304 |
+
* \brief Mask for return value from lzma_index_checks() for check none
|
| 305 |
+
*
|
| 306 |
+
* \note This and the other CHECK_MASK macros were added in 5.5.1alpha.
|
| 307 |
+
*/
|
| 308 |
+
#define LZMA_INDEX_CHECK_MASK_NONE (UINT32_C(1) << LZMA_CHECK_NONE)
|
| 309 |
+
|
| 310 |
+
/**
|
| 311 |
+
* \brief Mask for return value from lzma_index_checks() for check CRC32
|
| 312 |
+
*/
|
| 313 |
+
#define LZMA_INDEX_CHECK_MASK_CRC32 (UINT32_C(1) << LZMA_CHECK_CRC32)
|
| 314 |
+
|
| 315 |
+
/**
|
| 316 |
+
* \brief Mask for return value from lzma_index_checks() for check CRC64
|
| 317 |
+
*/
|
| 318 |
+
#define LZMA_INDEX_CHECK_MASK_CRC64 (UINT32_C(1) << LZMA_CHECK_CRC64)
|
| 319 |
+
|
| 320 |
+
/**
|
| 321 |
+
* \brief Mask for return value from lzma_index_checks() for check SHA256
|
| 322 |
+
*/
|
| 323 |
+
#define LZMA_INDEX_CHECK_MASK_SHA256 (UINT32_C(1) << LZMA_CHECK_SHA256)
|
| 324 |
+
|
| 325 |
+
/**
|
| 326 |
+
* \brief Calculate memory usage of lzma_index
|
| 327 |
+
*
|
| 328 |
+
* On disk, the size of the Index field depends on both the number of Records
|
| 329 |
+
* stored and the size of the Records (due to variable-length integer
|
| 330 |
+
* encoding). When the Index is kept in lzma_index structure, the memory usage
|
| 331 |
+
* depends only on the number of Records/Blocks stored in the Index(es), and
|
| 332 |
+
* in case of concatenated lzma_indexes, the number of Streams. The size in
|
| 333 |
+
* RAM is almost always significantly bigger than in the encoded form on disk.
|
| 334 |
+
*
|
| 335 |
+
* This function calculates an approximate amount of memory needed to hold
|
| 336 |
+
* the given number of Streams and Blocks in lzma_index structure. This
|
| 337 |
+
* value may vary between CPU architectures and also between liblzma versions
|
| 338 |
+
* if the internal implementation is modified.
|
| 339 |
+
*
|
| 340 |
+
* \param streams Number of Streams
|
| 341 |
+
* \param blocks Number of Blocks
|
| 342 |
+
*
|
| 343 |
+
* \return Approximate memory in bytes needed in a lzma_index structure.
|
| 344 |
+
*/
|
| 345 |
+
extern LZMA_API(uint64_t) lzma_index_memusage(
|
| 346 |
+
lzma_vli streams, lzma_vli blocks) lzma_nothrow;
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
/**
|
| 350 |
+
* \brief Calculate the memory usage of an existing lzma_index
|
| 351 |
+
*
|
| 352 |
+
* This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i),
|
| 353 |
+
* lzma_index_block_count(i)).
|
| 354 |
+
*
|
| 355 |
+
* \param i Pointer to lzma_index structure
|
| 356 |
+
*
|
| 357 |
+
* \return Approximate memory in bytes used by the lzma_index structure.
|
| 358 |
+
*/
|
| 359 |
+
extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
|
| 360 |
+
lzma_nothrow;
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
/**
|
| 364 |
+
* \brief Allocate and initialize a new lzma_index structure
|
| 365 |
+
*
|
| 366 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 367 |
+
* Set to NULL to use malloc() and free().
|
| 368 |
+
*
|
| 369 |
+
* \return On success, a pointer to an empty initialized lzma_index is
|
| 370 |
+
* returned. If allocation fails, NULL is returned.
|
| 371 |
+
*/
|
| 372 |
+
extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
|
| 373 |
+
lzma_nothrow;
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
/**
|
| 377 |
+
* \brief Deallocate lzma_index
|
| 378 |
+
*
|
| 379 |
+
* If i is NULL, this does nothing.
|
| 380 |
+
*
|
| 381 |
+
* \param i Pointer to lzma_index structure to deallocate
|
| 382 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 383 |
+
* Set to NULL to use malloc() and free().
|
| 384 |
+
*/
|
| 385 |
+
extern LZMA_API(void) lzma_index_end(
|
| 386 |
+
lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
/**
|
| 390 |
+
* \brief Add a new Block to lzma_index
|
| 391 |
+
*
|
| 392 |
+
* \param i Pointer to a lzma_index structure
|
| 393 |
+
* \param allocator lzma_allocator for custom allocator
|
| 394 |
+
* functions. Set to NULL to use malloc()
|
| 395 |
+
* and free().
|
| 396 |
+
* \param unpadded_size Unpadded Size of a Block. This can be
|
| 397 |
+
* calculated with lzma_block_unpadded_size()
|
| 398 |
+
* after encoding or decoding the Block.
|
| 399 |
+
* \param uncompressed_size Uncompressed Size of a Block. This can be
|
| 400 |
+
* taken directly from lzma_block structure
|
| 401 |
+
* after encoding or decoding the Block.
|
| 402 |
+
*
|
| 403 |
+
* Appending a new Block does not invalidate iterators. For example,
|
| 404 |
+
* if an iterator was pointing to the end of the lzma_index, after
|
| 405 |
+
* lzma_index_append() it is possible to read the next Block with
|
| 406 |
+
* an existing iterator.
|
| 407 |
+
*
|
| 408 |
+
* \return Possible lzma_ret values:
|
| 409 |
+
* - LZMA_OK
|
| 410 |
+
* - LZMA_MEM_ERROR
|
| 411 |
+
* - LZMA_DATA_ERROR: Compressed or uncompressed size of the
|
| 412 |
+
* Stream or size of the Index field would grow too big.
|
| 413 |
+
* - LZMA_PROG_ERROR
|
| 414 |
+
*/
|
| 415 |
+
extern LZMA_API(lzma_ret) lzma_index_append(
|
| 416 |
+
lzma_index *i, const lzma_allocator *allocator,
|
| 417 |
+
lzma_vli unpadded_size, lzma_vli uncompressed_size)
|
| 418 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
/**
|
| 422 |
+
* \brief Set the Stream Flags
|
| 423 |
+
*
|
| 424 |
+
* Set the Stream Flags of the last (and typically the only) Stream
|
| 425 |
+
* in lzma_index. This can be useful when reading information from the
|
| 426 |
+
* lzma_index, because to decode Blocks, knowing the integrity check type
|
| 427 |
+
* is needed.
|
| 428 |
+
*
|
| 429 |
+
* \param i Pointer to lzma_index structure
|
| 430 |
+
* \param stream_flags Pointer to lzma_stream_flags structure. This
|
| 431 |
+
* is copied into the internal preallocated
|
| 432 |
+
* structure, so the caller doesn't need to keep
|
| 433 |
+
* the flags' data available after calling this
|
| 434 |
+
* function.
|
| 435 |
+
*
|
| 436 |
+
* \return Possible lzma_ret values:
|
| 437 |
+
* - LZMA_OK
|
| 438 |
+
* - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version.
|
| 439 |
+
* - LZMA_PROG_ERROR
|
| 440 |
+
*/
|
| 441 |
+
extern LZMA_API(lzma_ret) lzma_index_stream_flags(
|
| 442 |
+
lzma_index *i, const lzma_stream_flags *stream_flags)
|
| 443 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
/**
|
| 447 |
+
* \brief Get the types of integrity Checks
|
| 448 |
+
*
|
| 449 |
+
* If lzma_index_stream_flags() is used to set the Stream Flags for
|
| 450 |
+
* every Stream, lzma_index_checks() can be used to get a bitmask to
|
| 451 |
+
* indicate which Check types have been used. It can be useful e.g. if
|
| 452 |
+
* showing the Check types to the user.
|
| 453 |
+
*
|
| 454 |
+
* The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10.
|
| 455 |
+
* These masks are defined for convenience as LZMA_INDEX_CHECK_MASK_XXX
|
| 456 |
+
*
|
| 457 |
+
* \param i Pointer to lzma_index structure
|
| 458 |
+
*
|
| 459 |
+
* \return Bitmask indicating which Check types are used in the lzma_index
|
| 460 |
+
*/
|
| 461 |
+
extern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i)
|
| 462 |
+
lzma_nothrow lzma_attr_pure;
|
| 463 |
+
|
| 464 |
+
|
| 465 |
+
/**
|
| 466 |
+
* \brief Set the amount of Stream Padding
|
| 467 |
+
*
|
| 468 |
+
* Set the amount of Stream Padding of the last (and typically the only)
|
| 469 |
+
* Stream in the lzma_index. This is needed when planning to do random-access
|
| 470 |
+
* reading within multiple concatenated Streams.
|
| 471 |
+
*
|
| 472 |
+
* By default, the amount of Stream Padding is assumed to be zero bytes.
|
| 473 |
+
*
|
| 474 |
+
* \return Possible lzma_ret values:
|
| 475 |
+
* - LZMA_OK
|
| 476 |
+
* - LZMA_DATA_ERROR: The file size would grow too big.
|
| 477 |
+
* - LZMA_PROG_ERROR
|
| 478 |
+
*/
|
| 479 |
+
extern LZMA_API(lzma_ret) lzma_index_stream_padding(
|
| 480 |
+
lzma_index *i, lzma_vli stream_padding)
|
| 481 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
/**
|
| 485 |
+
* \brief Get the number of Streams
|
| 486 |
+
*
|
| 487 |
+
* \param i Pointer to lzma_index structure
|
| 488 |
+
*
|
| 489 |
+
* \return Number of Streams in the lzma_index
|
| 490 |
+
*/
|
| 491 |
+
extern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i)
|
| 492 |
+
lzma_nothrow lzma_attr_pure;
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
/**
|
| 496 |
+
* \brief Get the number of Blocks
|
| 497 |
+
*
|
| 498 |
+
* This returns the total number of Blocks in lzma_index. To get number
|
| 499 |
+
* of Blocks in individual Streams, use lzma_index_iter.
|
| 500 |
+
*
|
| 501 |
+
* \param i Pointer to lzma_index structure
|
| 502 |
+
*
|
| 503 |
+
* \return Number of blocks in the lzma_index
|
| 504 |
+
*/
|
| 505 |
+
extern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i)
|
| 506 |
+
lzma_nothrow lzma_attr_pure;
|
| 507 |
+
|
| 508 |
+
|
| 509 |
+
/**
|
| 510 |
+
* \brief Get the size of the Index field as bytes
|
| 511 |
+
*
|
| 512 |
+
* This is needed to verify the Backward Size field in the Stream Footer.
|
| 513 |
+
*
|
| 514 |
+
* \param i Pointer to lzma_index structure
|
| 515 |
+
*
|
| 516 |
+
* \return Size in bytes of the Index
|
| 517 |
+
*/
|
| 518 |
+
extern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i)
|
| 519 |
+
lzma_nothrow lzma_attr_pure;
|
| 520 |
+
|
| 521 |
+
|
| 522 |
+
/**
|
| 523 |
+
* \brief Get the total size of the Stream
|
| 524 |
+
*
|
| 525 |
+
* If multiple lzma_indexes have been combined, this works as if the Blocks
|
| 526 |
+
* were in a single Stream. This is useful if you are going to combine
|
| 527 |
+
* Blocks from multiple Streams into a single new Stream.
|
| 528 |
+
*
|
| 529 |
+
* \param i Pointer to lzma_index structure
|
| 530 |
+
*
|
| 531 |
+
* \return Size in bytes of the Stream (if all Blocks are combined
|
| 532 |
+
* into one Stream).
|
| 533 |
+
*/
|
| 534 |
+
extern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i)
|
| 535 |
+
lzma_nothrow lzma_attr_pure;
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
/**
|
| 539 |
+
* \brief Get the total size of the Blocks
|
| 540 |
+
*
|
| 541 |
+
* This doesn't include the Stream Header, Stream Footer, Stream Padding,
|
| 542 |
+
* or Index fields.
|
| 543 |
+
*
|
| 544 |
+
* \param i Pointer to lzma_index structure
|
| 545 |
+
*
|
| 546 |
+
* \return Size in bytes of all Blocks in the Stream(s)
|
| 547 |
+
*/
|
| 548 |
+
extern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i)
|
| 549 |
+
lzma_nothrow lzma_attr_pure;
|
| 550 |
+
|
| 551 |
+
|
| 552 |
+
/**
|
| 553 |
+
* \brief Get the total size of the file
|
| 554 |
+
*
|
| 555 |
+
* When no lzma_indexes have been combined with lzma_index_cat() and there is
|
| 556 |
+
* no Stream Padding, this function is identical to lzma_index_stream_size().
|
| 557 |
+
* If multiple lzma_indexes have been combined, this includes also the headers
|
| 558 |
+
* of each separate Stream and the possible Stream Padding fields.
|
| 559 |
+
*
|
| 560 |
+
* \param i Pointer to lzma_index structure
|
| 561 |
+
*
|
| 562 |
+
* \return Total size of the .xz file in bytes
|
| 563 |
+
*/
|
| 564 |
+
extern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i)
|
| 565 |
+
lzma_nothrow lzma_attr_pure;
|
| 566 |
+
|
| 567 |
+
|
| 568 |
+
/**
|
| 569 |
+
* \brief Get the uncompressed size of the file
|
| 570 |
+
*
|
| 571 |
+
* \param i Pointer to lzma_index structure
|
| 572 |
+
*
|
| 573 |
+
* \return Size in bytes of the uncompressed data in the file
|
| 574 |
+
*/
|
| 575 |
+
extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i)
|
| 576 |
+
lzma_nothrow lzma_attr_pure;
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
/**
|
| 580 |
+
* \brief Initialize an iterator
|
| 581 |
+
*
|
| 582 |
+
* This function associates the iterator with the given lzma_index, and calls
|
| 583 |
+
* lzma_index_iter_rewind() on the iterator.
|
| 584 |
+
*
|
| 585 |
+
* This function doesn't allocate any memory, thus there is no
|
| 586 |
+
* lzma_index_iter_end(). The iterator is valid as long as the
|
| 587 |
+
* associated lzma_index is valid, that is, until lzma_index_end() or
|
| 588 |
+
* using it as source in lzma_index_cat(). Specifically, lzma_index doesn't
|
| 589 |
+
* become invalid if new Blocks are added to it with lzma_index_append() or
|
| 590 |
+
* if it is used as the destination in lzma_index_cat().
|
| 591 |
+
*
|
| 592 |
+
* It is safe to make copies of an initialized lzma_index_iter, for example,
|
| 593 |
+
* to easily restart reading at some particular position.
|
| 594 |
+
*
|
| 595 |
+
* \param iter Pointer to a lzma_index_iter structure
|
| 596 |
+
* \param i lzma_index to which the iterator will be associated
|
| 597 |
+
*/
|
| 598 |
+
extern LZMA_API(void) lzma_index_iter_init(
|
| 599 |
+
lzma_index_iter *iter, const lzma_index *i) lzma_nothrow;
|
| 600 |
+
|
| 601 |
+
|
| 602 |
+
/**
|
| 603 |
+
* \brief Rewind the iterator
|
| 604 |
+
*
|
| 605 |
+
* Rewind the iterator so that next call to lzma_index_iter_next() will
|
| 606 |
+
* return the first Block or Stream.
|
| 607 |
+
*
|
| 608 |
+
* \param iter Pointer to a lzma_index_iter structure
|
| 609 |
+
*/
|
| 610 |
+
extern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter)
|
| 611 |
+
lzma_nothrow;
|
| 612 |
+
|
| 613 |
+
|
| 614 |
+
/**
|
| 615 |
+
* \brief Get the next Block or Stream
|
| 616 |
+
*
|
| 617 |
+
* \param iter Iterator initialized with lzma_index_iter_init()
|
| 618 |
+
* \param mode Specify what kind of information the caller wants
|
| 619 |
+
* to get. See lzma_index_iter_mode for details.
|
| 620 |
+
*
|
| 621 |
+
* \return lzma_bool:
|
| 622 |
+
* - true if no Block or Stream matching the mode is found.
|
| 623 |
+
* *iter is not updated (failure).
|
| 624 |
+
* - false if the next Block or Stream matching the mode was
|
| 625 |
+
* found. *iter is updated (success).
|
| 626 |
+
*/
|
| 627 |
+
extern LZMA_API(lzma_bool) lzma_index_iter_next(
|
| 628 |
+
lzma_index_iter *iter, lzma_index_iter_mode mode)
|
| 629 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 630 |
+
|
| 631 |
+
|
| 632 |
+
/**
|
| 633 |
+
* \brief Locate a Block
|
| 634 |
+
*
|
| 635 |
+
* If it is possible to seek in the .xz file, it is possible to parse
|
| 636 |
+
* the Index field(s) and use lzma_index_iter_locate() to do random-access
|
| 637 |
+
* reading with granularity of Block size.
|
| 638 |
+
*
|
| 639 |
+
* If the target is smaller than the uncompressed size of the Stream (can be
|
| 640 |
+
* checked with lzma_index_uncompressed_size()):
|
| 641 |
+
* - Information about the Stream and Block containing the requested
|
| 642 |
+
* uncompressed offset is stored into *iter.
|
| 643 |
+
* - Internal state of the iterator is adjusted so that
|
| 644 |
+
* lzma_index_iter_next() can be used to read subsequent Blocks or Streams.
|
| 645 |
+
*
|
| 646 |
+
* If the target is greater than the uncompressed size of the Stream, *iter
|
| 647 |
+
* is not modified.
|
| 648 |
+
*
|
| 649 |
+
* \param iter Iterator that was earlier initialized with
|
| 650 |
+
* lzma_index_iter_init().
|
| 651 |
+
* \param target Uncompressed target offset which the caller would
|
| 652 |
+
* like to locate from the Stream
|
| 653 |
+
*
|
| 654 |
+
* \return lzma_bool:
|
| 655 |
+
* - true if the target is greater than or equal to the
|
| 656 |
+
* uncompressed size of the Stream (failure)
|
| 657 |
+
* - false if the target is smaller than the uncompressed size
|
| 658 |
+
* of the Stream (success)
|
| 659 |
+
*/
|
| 660 |
+
extern LZMA_API(lzma_bool) lzma_index_iter_locate(
|
| 661 |
+
lzma_index_iter *iter, lzma_vli target) lzma_nothrow;
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
/**
|
| 665 |
+
* \brief Concatenate lzma_indexes
|
| 666 |
+
*
|
| 667 |
+
* Concatenating lzma_indexes is useful when doing random-access reading in
|
| 668 |
+
* multi-Stream .xz file, or when combining multiple Streams into single
|
| 669 |
+
* Stream.
|
| 670 |
+
*
|
| 671 |
+
* \param[out] dest lzma_index after which src is appended
|
| 672 |
+
* \param src lzma_index to be appended after dest. If this
|
| 673 |
+
* function succeeds, the memory allocated for src
|
| 674 |
+
* is freed or moved to be part of dest, and all
|
| 675 |
+
* iterators pointing to src will become invalid.
|
| 676 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 677 |
+
* Set to NULL to use malloc() and free().
|
| 678 |
+
*
|
| 679 |
+
* \return Possible lzma_ret values:
|
| 680 |
+
* - LZMA_OK: lzma_indexes were concatenated successfully.
|
| 681 |
+
* src is now a dangling pointer.
|
| 682 |
+
* - LZMA_DATA_ERROR: *dest would grow too big.
|
| 683 |
+
* - LZMA_MEM_ERROR
|
| 684 |
+
* - LZMA_PROG_ERROR
|
| 685 |
+
*/
|
| 686 |
+
extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
|
| 687 |
+
const lzma_allocator *allocator)
|
| 688 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 689 |
+
|
| 690 |
+
|
| 691 |
+
/**
|
| 692 |
+
* \brief Duplicate lzma_index
|
| 693 |
+
*
|
| 694 |
+
* \param i Pointer to lzma_index structure to be duplicated
|
| 695 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 696 |
+
* Set to NULL to use malloc() and free().
|
| 697 |
+
*
|
| 698 |
+
* \return A copy of the lzma_index, or NULL if memory allocation failed.
|
| 699 |
+
*/
|
| 700 |
+
extern LZMA_API(lzma_index *) lzma_index_dup(
|
| 701 |
+
const lzma_index *i, const lzma_allocator *allocator)
|
| 702 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 703 |
+
|
| 704 |
+
|
| 705 |
+
/**
|
| 706 |
+
* \brief Initialize .xz Index encoder
|
| 707 |
+
*
|
| 708 |
+
* \param strm Pointer to properly prepared lzma_stream
|
| 709 |
+
* \param i Pointer to lzma_index which should be encoded.
|
| 710 |
+
*
|
| 711 |
+
* The valid 'action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
|
| 712 |
+
* It is enough to use only one of them (you can choose freely).
|
| 713 |
+
*
|
| 714 |
+
* \return Possible lzma_ret values:
|
| 715 |
+
* - LZMA_OK: Initialization succeeded, continue with lzma_code().
|
| 716 |
+
* - LZMA_MEM_ERROR
|
| 717 |
+
* - LZMA_PROG_ERROR
|
| 718 |
+
*/
|
| 719 |
+
extern LZMA_API(lzma_ret) lzma_index_encoder(
|
| 720 |
+
lzma_stream *strm, const lzma_index *i)
|
| 721 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
/**
|
| 725 |
+
* \brief Initialize .xz Index decoder
|
| 726 |
+
*
|
| 727 |
+
* \param strm Pointer to properly prepared lzma_stream
|
| 728 |
+
* \param[out] i The decoded Index will be made available via
|
| 729 |
+
* this pointer. Initially this function will
|
| 730 |
+
* set *i to NULL (the old value is ignored). If
|
| 731 |
+
* decoding succeeds (lzma_code() returns
|
| 732 |
+
* LZMA_STREAM_END), *i will be set to point
|
| 733 |
+
* to a new lzma_index, which the application
|
| 734 |
+
* has to later free with lzma_index_end().
|
| 735 |
+
* \param memlimit How much memory the resulting lzma_index is
|
| 736 |
+
* allowed to require. liblzma 5.2.3 and earlier
|
| 737 |
+
* don't allow 0 here and return LZMA_PROG_ERROR;
|
| 738 |
+
* later versions treat 0 as if 1 had been specified.
|
| 739 |
+
*
|
| 740 |
+
* Valid 'action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
|
| 741 |
+
* There is no need to use LZMA_FINISH, but it's allowed because it may
|
| 742 |
+
* simplify certain types of applications.
|
| 743 |
+
*
|
| 744 |
+
* \return Possible lzma_ret values:
|
| 745 |
+
* - LZMA_OK: Initialization succeeded, continue with lzma_code().
|
| 746 |
+
* - LZMA_MEM_ERROR
|
| 747 |
+
* - LZMA_PROG_ERROR
|
| 748 |
+
*
|
| 749 |
+
* \note liblzma 5.2.3 and older list also LZMA_MEMLIMIT_ERROR here
|
| 750 |
+
* but that error code has never been possible from this
|
| 751 |
+
* initialization function.
|
| 752 |
+
*/
|
| 753 |
+
extern LZMA_API(lzma_ret) lzma_index_decoder(
|
| 754 |
+
lzma_stream *strm, lzma_index **i, uint64_t memlimit)
|
| 755 |
+
lzma_nothrow lzma_attr_warn_unused_result;
|
| 756 |
+
|
| 757 |
+
|
| 758 |
+
/**
|
| 759 |
+
* \brief Single-call .xz Index encoder
|
| 760 |
+
*
|
| 761 |
+
* \note This function doesn't take allocator argument since all
|
| 762 |
+
* the internal data is allocated on stack.
|
| 763 |
+
*
|
| 764 |
+
* \param i lzma_index to be encoded
|
| 765 |
+
* \param[out] out Beginning of the output buffer
|
| 766 |
+
* \param[out] out_pos The next byte will be written to out[*out_pos].
|
| 767 |
+
* *out_pos is updated only if encoding succeeds.
|
| 768 |
+
* \param out_size Size of the out buffer; the first byte into
|
| 769 |
+
* which no data is written to is out[out_size].
|
| 770 |
+
*
|
| 771 |
+
* \return Possible lzma_ret values:
|
| 772 |
+
* - LZMA_OK: Encoding was successful.
|
| 773 |
+
* - LZMA_BUF_ERROR: Output buffer is too small. Use
|
| 774 |
+
* lzma_index_size() to find out how much output
|
| 775 |
+
* space is needed.
|
| 776 |
+
* - LZMA_PROG_ERROR
|
| 777 |
+
*
|
| 778 |
+
*/
|
| 779 |
+
extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
|
| 780 |
+
uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
|
| 781 |
+
|
| 782 |
+
|
| 783 |
+
/**
|
| 784 |
+
* \brief Single-call .xz Index decoder
|
| 785 |
+
*
|
| 786 |
+
* \param[out] i If decoding succeeds, *i will point to a new
|
| 787 |
+
* lzma_index, which the application has to
|
| 788 |
+
* later free with lzma_index_end(). If an error
|
| 789 |
+
* occurs, *i will be NULL. The old value of *i
|
| 790 |
+
* is always ignored and thus doesn't need to be
|
| 791 |
+
* initialized by the caller.
|
| 792 |
+
* \param[out] memlimit Pointer to how much memory the resulting
|
| 793 |
+
* lzma_index is allowed to require. The value
|
| 794 |
+
* pointed by this pointer is modified if and only
|
| 795 |
+
* if LZMA_MEMLIMIT_ERROR is returned.
|
| 796 |
+
* \param allocator lzma_allocator for custom allocator functions.
|
| 797 |
+
* Set to NULL to use malloc() and free().
|
| 798 |
+
* \param in Beginning of the input buffer
|
| 799 |
+
* \param in_pos The next byte will be read from in[*in_pos].
|
| 800 |
+
* *in_pos is updated only if decoding succeeds.
|
| 801 |
+
* \param in_size Size of the input buffer; the first byte that
|
| 802 |
+
* won't be read is in[in_size].
|
| 803 |
+
*
|
| 804 |
+
* \return Possible lzma_ret values:
|
| 805 |
+
* - LZMA_OK: Decoding was successful.
|
| 806 |
+
* - LZMA_MEM_ERROR
|
| 807 |
+
* - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
|
| 808 |
+
* The minimum required memlimit value was stored to *memlimit.
|
| 809 |
+
* - LZMA_DATA_ERROR
|
| 810 |
+
* - LZMA_PROG_ERROR
|
| 811 |
+
*/
|
| 812 |
+
extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
|
| 813 |
+
uint64_t *memlimit, const lzma_allocator *allocator,
|
| 814 |
+
const uint8_t *in, size_t *in_pos, size_t in_size)
|
| 815 |
+
lzma_nothrow;
|
| 816 |
+
|
| 817 |
+
|
| 818 |
+
/**
|
| 819 |
+
* \brief Initialize a .xz file information decoder
|
| 820 |
+
*
|
| 821 |
+
* This decoder decodes the Stream Header, Stream Footer, Index, and
|
| 822 |
+
* Stream Padding field(s) from the input .xz file and stores the resulting
|
| 823 |
+
* combined index in *dest_index. This information can be used to get the
|
| 824 |
+
* uncompressed file size with lzma_index_uncompressed_size(*dest_index) or,
|
| 825 |
+
* for example, to implement random access reading by locating the Blocks
|
| 826 |
+
* in the Streams.
|
| 827 |
+
*
|
| 828 |
+
* To get the required information from the .xz file, lzma_code() may ask
|
| 829 |
+
* the application to seek in the input file by returning LZMA_SEEK_NEEDED
|
| 830 |
+
* and having the target file position specified in lzma_stream.seek_pos.
|
| 831 |
+
* The number of seeks required depends on the input file and how big buffers
|
| 832 |
+
* the application provides. When possible, the decoder will seek backward
|
| 833 |
+
* and forward in the given buffer to avoid useless seek requests. Thus, if
|
| 834 |
+
* the application provides the whole file at once, no external seeking will
|
| 835 |
+
* be required (that is, lzma_code() won't return LZMA_SEEK_NEEDED).
|
| 836 |
+
*
|
| 837 |
+
* The value in lzma_stream.total_in can be used to estimate how much data
|
| 838 |
+
* liblzma had to read to get the file information. However, due to seeking
|
| 839 |
+
* and the way total_in is updated, the value of total_in will be somewhat
|
| 840 |
+
* inaccurate (a little too big). Thus, total_in is a good estimate but don't
|
| 841 |
+
* expect to see the same exact value for the same file if you change the
|
| 842 |
+
* input buffer size or switch to a different liblzma version.
|
| 843 |
+
*
|
| 844 |
+
* Valid 'action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
|
| 845 |
+
* You only need to use LZMA_RUN; LZMA_FINISH is only supported because it
|
| 846 |
+
* might be convenient for some applications. If you use LZMA_FINISH and if
|
| 847 |
+
* lzma_code() asks the application to seek, remember to reset 'action' back
|
| 848 |
+
* to LZMA_RUN unless you hit the end of the file again.
|
| 849 |
+
*
|
| 850 |
+
* Possible return values from lzma_code():
|
| 851 |
+
* - LZMA_OK: All OK so far, more input needed
|
| 852 |
+
* - LZMA_SEEK_NEEDED: Provide more input starting from the absolute
|
| 853 |
+
* file position strm->seek_pos
|
| 854 |
+
* - LZMA_STREAM_END: Decoding was successful, *dest_index has been set
|
| 855 |
+
* - LZMA_FORMAT_ERROR: The input file is not in the .xz format (the
|
| 856 |
+
* expected magic bytes were not found from the beginning of the file)
|
| 857 |
+
* - LZMA_OPTIONS_ERROR: File looks valid but contains headers that aren't
|
| 858 |
+
* supported by this version of liblzma
|
| 859 |
+
* - LZMA_DATA_ERROR: File is corrupt
|
| 860 |
+
* - LZMA_BUF_ERROR
|
| 861 |
+
* - LZMA_MEM_ERROR
|
| 862 |
+
* - LZMA_MEMLIMIT_ERROR
|
| 863 |
+
* - LZMA_PROG_ERROR
|
| 864 |
+
*
|
| 865 |
+
* \param strm Pointer to a properly prepared lzma_stream
|
| 866 |
+
* \param[out] dest_index Pointer to a pointer where the decoder will put
|
| 867 |
+
* the decoded lzma_index. The old value
|
| 868 |
+
* of *dest_index is ignored (not freed).
|
| 869 |
+
* \param memlimit How much memory the resulting lzma_index is
|
| 870 |
+
* allowed to require. Use UINT64_MAX to
|
| 871 |
+
* effectively disable the limiter.
|
| 872 |
+
* \param file_size Size of the input .xz file
|
| 873 |
+
*
|
| 874 |
+
* \return Possible lzma_ret values:
|
| 875 |
+
* - LZMA_OK
|
| 876 |
+
* - LZMA_MEM_ERROR
|
| 877 |
+
* - LZMA_PROG_ERROR
|
| 878 |
+
*/
|
| 879 |
+
extern LZMA_API(lzma_ret) lzma_file_info_decoder(
|
| 880 |
+
lzma_stream *strm, lzma_index **dest_index,
|
| 881 |
+
uint64_t memlimit, uint64_t file_size)
|
| 882 |
+
lzma_nothrow;
|
emu3/include/ncurses/curses.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
emu3/include/ncurses/cursesapp.h
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
/****************************************************************************
|
| 3 |
+
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
| 4 |
+
* Copyright 1998-2005,2011 Free Software Foundation, Inc. *
|
| 5 |
+
* *
|
| 6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 7 |
+
* copy of this software and associated documentation files (the *
|
| 8 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 9 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 10 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 11 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 12 |
+
* furnished to do so, subject to the following conditions: *
|
| 13 |
+
* *
|
| 14 |
+
* The above copyright notice and this permission notice shall be included *
|
| 15 |
+
* in all copies or substantial portions of the Software. *
|
| 16 |
+
* *
|
| 17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 18 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 19 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 20 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 21 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 22 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 23 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 24 |
+
* *
|
| 25 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 26 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 27 |
+
* sale, use or other dealings in this Software without prior written *
|
| 28 |
+
* authorization. *
|
| 29 |
+
****************************************************************************/
|
| 30 |
+
|
| 31 |
+
/****************************************************************************
|
| 32 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
// $Id: cursesapp.h,v 1.18 2021/06/17 21:26:02 tom Exp $
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_CURSESAPP_H_incl
|
| 38 |
+
#define NCURSES_CURSESAPP_H_incl
|
| 39 |
+
|
| 40 |
+
#include <ncursesw/cursslk.h>
|
| 41 |
+
|
| 42 |
+
#if (defined(_WIN32) || defined(_WIN64))
|
| 43 |
+
# define NCURSES_CXX_MAIN_NAME cursespp_main
|
| 44 |
+
# define NCURSES_CXX_MAIN \
|
| 45 |
+
int main(int argc, char *argv[]) { \
|
| 46 |
+
return NCURSES_CXX_MAIN_NAME(argc, argv); \
|
| 47 |
+
}
|
| 48 |
+
#else
|
| 49 |
+
# define NCURSES_CXX_MAIN_NAME main
|
| 50 |
+
#endif
|
| 51 |
+
NCURSES_CXX_IMPEXP int NCURSES_CXX_MAIN_NAME(int argc, char *argv[]);
|
| 52 |
+
|
| 53 |
+
class NCURSES_CXX_IMPEXP NCursesApplication {
|
| 54 |
+
public:
|
| 55 |
+
typedef struct _slk_link { // This structure is used to maintain
|
| 56 |
+
struct _slk_link* prev; // a stack of SLKs
|
| 57 |
+
Soft_Label_Key_Set* SLKs;
|
| 58 |
+
} SLK_Link;
|
| 59 |
+
private:
|
| 60 |
+
static int rinit(NCursesWindow& w); // Internal Init function for title
|
| 61 |
+
static NCursesApplication* theApp; // Global ref. to the application
|
| 62 |
+
|
| 63 |
+
static SLK_Link* slk_stack;
|
| 64 |
+
|
| 65 |
+
protected:
|
| 66 |
+
static NCursesWindow* titleWindow; // The Title Window (if any)
|
| 67 |
+
|
| 68 |
+
bool b_Colors; // Is this a color application?
|
| 69 |
+
NCursesWindow* Root_Window; // This is the stdscr equiv.
|
| 70 |
+
|
| 71 |
+
// Initialization of attributes;
|
| 72 |
+
// Rewrite this in your derived class if you prefer other settings
|
| 73 |
+
virtual void init(bool bColors);
|
| 74 |
+
|
| 75 |
+
// The number of lines for the title window. Default is no title window
|
| 76 |
+
// You may rewrite this in your derived class
|
| 77 |
+
virtual int titlesize() const {
|
| 78 |
+
return 0;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// This method is called to put something into the title window initially
|
| 82 |
+
// You may rewrite this in your derived class
|
| 83 |
+
virtual void title() {
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
// The layout used for the Soft Label Keys. Default is to have no SLKs.
|
| 87 |
+
// You may rewrite this in your derived class
|
| 88 |
+
virtual Soft_Label_Key_Set::Label_Layout useSLKs() const {
|
| 89 |
+
return Soft_Label_Key_Set::None;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// This method is called to initialize the SLKs. Default is nothing.
|
| 93 |
+
// You may rewrite this in your derived class
|
| 94 |
+
virtual void init_labels(Soft_Label_Key_Set& S) const {
|
| 95 |
+
(void) S;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
// Your derived class must implement this method. The return value must
|
| 99 |
+
// be the exit value of your application.
|
| 100 |
+
virtual int run() = 0;
|
| 101 |
+
|
| 102 |
+
// The constructor is protected, so you may use it in your derived
|
| 103 |
+
// class constructor. The argument tells whether or not you want colors.
|
| 104 |
+
NCursesApplication(bool wantColors = FALSE);
|
| 105 |
+
|
| 106 |
+
NCursesApplication& operator=(const NCursesApplication& rhs)
|
| 107 |
+
{
|
| 108 |
+
if (this != &rhs) {
|
| 109 |
+
*this = rhs;
|
| 110 |
+
}
|
| 111 |
+
return *this;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
NCursesApplication(const NCursesApplication& rhs)
|
| 115 |
+
: b_Colors(rhs.b_Colors),
|
| 116 |
+
Root_Window(rhs.Root_Window)
|
| 117 |
+
{
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
static NCursesWindow *&getTitleWindow();
|
| 121 |
+
|
| 122 |
+
public:
|
| 123 |
+
virtual ~NCursesApplication() THROWS(NCursesException);
|
| 124 |
+
|
| 125 |
+
// Get a pointer to the current application object
|
| 126 |
+
static NCursesApplication* getApplication();
|
| 127 |
+
|
| 128 |
+
// This method runs the application and returns its exit value
|
| 129 |
+
int operator()(void);
|
| 130 |
+
|
| 131 |
+
// Process the commandline arguments. The default implementation simply
|
| 132 |
+
// ignores them. Your derived class may rewrite this.
|
| 133 |
+
virtual void handleArgs(int argc, char* argv[]) {
|
| 134 |
+
(void) argc;
|
| 135 |
+
(void) argv;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// Does this application use colors?
|
| 139 |
+
inline bool useColors() const {
|
| 140 |
+
return b_Colors;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
// Push the Key Set S onto the SLK Stack. S then becomes the current set
|
| 144 |
+
// of Soft Labelled Keys.
|
| 145 |
+
void push(Soft_Label_Key_Set& S);
|
| 146 |
+
|
| 147 |
+
// Throw away the current set of SLKs and make the previous one the
|
| 148 |
+
// new current set.
|
| 149 |
+
bool pop();
|
| 150 |
+
|
| 151 |
+
// Retrieve the current set of Soft Labelled Keys.
|
| 152 |
+
Soft_Label_Key_Set* top() const;
|
| 153 |
+
|
| 154 |
+
// Attributes to use for menu and forms foregrounds
|
| 155 |
+
virtual chtype foregrounds() const {
|
| 156 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
// Attributes to use for menu and forms backgrounds
|
| 160 |
+
virtual chtype backgrounds() const {
|
| 161 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
// Attributes to use for inactive (menu) elements
|
| 165 |
+
virtual chtype inactives() const {
|
| 166 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// Attributes to use for (form) labels and SLKs
|
| 170 |
+
virtual chtype labels() const {
|
| 171 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// Attributes to use for form backgrounds
|
| 175 |
+
virtual chtype dialog_backgrounds() const {
|
| 176 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
// Attributes to use as default for (form) window backgrounds
|
| 180 |
+
virtual chtype window_backgrounds() const {
|
| 181 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
// Attributes to use for the title window
|
| 185 |
+
virtual chtype screen_titles() const {
|
| 186 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
};
|
| 190 |
+
|
| 191 |
+
#endif /* NCURSES_CURSESAPP_H_incl */
|
emu3/include/ncurses/cursesp.h
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
// vile:cppmode
|
| 3 |
+
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
/****************************************************************************
|
| 33 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
#ifndef NCURSES_CURSESP_H_incl
|
| 37 |
+
#define NCURSES_CURSESP_H_incl 1
|
| 38 |
+
|
| 39 |
+
// $Id: cursesp.h,v 1.36 2022/08/20 20:52:15 tom Exp $
|
| 40 |
+
|
| 41 |
+
#include <ncursesw/cursesw.h>
|
| 42 |
+
|
| 43 |
+
extern "C" {
|
| 44 |
+
# include <ncursesw/panel.h>
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
class NCURSES_CXX_IMPEXP NCursesPanel
|
| 48 |
+
: public NCursesWindow
|
| 49 |
+
{
|
| 50 |
+
protected:
|
| 51 |
+
PANEL *p;
|
| 52 |
+
static NCursesPanel *dummy;
|
| 53 |
+
|
| 54 |
+
private:
|
| 55 |
+
// This structure is used for the panel's user data field to link the
|
| 56 |
+
// PANEL* to the C++ object and to provide extra space for a user pointer.
|
| 57 |
+
typedef struct {
|
| 58 |
+
void* m_user; // the pointer for the user's data
|
| 59 |
+
const NCursesPanel* m_back; // backward pointer to C++ object
|
| 60 |
+
const PANEL* m_owner; // the panel itself
|
| 61 |
+
} UserHook;
|
| 62 |
+
|
| 63 |
+
inline UserHook *UserPointer()
|
| 64 |
+
{
|
| 65 |
+
UserHook* uptr = reinterpret_cast<UserHook*>(
|
| 66 |
+
const_cast<void *>(::panel_userptr (p)));
|
| 67 |
+
return uptr;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
void init(); // Initialize the panel object
|
| 71 |
+
|
| 72 |
+
protected:
|
| 73 |
+
void set_user(void *user)
|
| 74 |
+
{
|
| 75 |
+
UserHook* uptr = UserPointer();
|
| 76 |
+
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) {
|
| 77 |
+
uptr->m_user = user;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
// Set the user pointer of the panel.
|
| 81 |
+
|
| 82 |
+
void *get_user()
|
| 83 |
+
{
|
| 84 |
+
UserHook* uptr = UserPointer();
|
| 85 |
+
void *result = 0;
|
| 86 |
+
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p)
|
| 87 |
+
result = uptr->m_user;
|
| 88 |
+
return result;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
|
| 92 |
+
{
|
| 93 |
+
if (err==ERR)
|
| 94 |
+
THROW(new NCursesPanelException (this, err));
|
| 95 |
+
}
|
| 96 |
+
// If err is equal to the curses error indicator ERR, an error handler
|
| 97 |
+
// is called.
|
| 98 |
+
|
| 99 |
+
// Get a keystroke. Default implementation calls getch()
|
| 100 |
+
virtual int getKey(void);
|
| 101 |
+
|
| 102 |
+
public:
|
| 103 |
+
NCursesPanel(int nlines,
|
| 104 |
+
int ncols,
|
| 105 |
+
int begin_y = 0,
|
| 106 |
+
int begin_x = 0)
|
| 107 |
+
: NCursesWindow(nlines,ncols,begin_y,begin_x), p(0)
|
| 108 |
+
{
|
| 109 |
+
init();
|
| 110 |
+
}
|
| 111 |
+
// Create a panel with this size starting at the requested position.
|
| 112 |
+
|
| 113 |
+
NCursesPanel()
|
| 114 |
+
: NCursesWindow(::stdscr), p(0)
|
| 115 |
+
{
|
| 116 |
+
init();
|
| 117 |
+
}
|
| 118 |
+
// This constructor creates the default Panel associated with the
|
| 119 |
+
// ::stdscr window
|
| 120 |
+
|
| 121 |
+
NCursesPanel& operator=(const NCursesPanel& rhs)
|
| 122 |
+
{
|
| 123 |
+
if (this != &rhs) {
|
| 124 |
+
*this = rhs;
|
| 125 |
+
NCursesWindow::operator=(rhs);
|
| 126 |
+
}
|
| 127 |
+
return *this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
NCursesPanel(const NCursesPanel& rhs)
|
| 131 |
+
: NCursesWindow(rhs),
|
| 132 |
+
p(rhs.p)
|
| 133 |
+
{
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
virtual ~NCursesPanel() THROWS(NCursesException);
|
| 137 |
+
|
| 138 |
+
// basic manipulation
|
| 139 |
+
inline void hide()
|
| 140 |
+
{
|
| 141 |
+
OnError (::hide_panel(p));
|
| 142 |
+
}
|
| 143 |
+
// Hide the panel. It stays in the stack but becomes invisible.
|
| 144 |
+
|
| 145 |
+
inline void show()
|
| 146 |
+
{
|
| 147 |
+
OnError (::show_panel(p));
|
| 148 |
+
}
|
| 149 |
+
// Show the panel, i.e. make it visible.
|
| 150 |
+
|
| 151 |
+
inline void top()
|
| 152 |
+
{
|
| 153 |
+
OnError (::top_panel(p));
|
| 154 |
+
}
|
| 155 |
+
// Make this panel the top panel in the stack.
|
| 156 |
+
|
| 157 |
+
inline void bottom()
|
| 158 |
+
{
|
| 159 |
+
OnError (::bottom_panel(p));
|
| 160 |
+
}
|
| 161 |
+
// Make this panel the bottom panel in the stack.
|
| 162 |
+
// N.B.: The panel associated with ::stdscr is always on the bottom. So
|
| 163 |
+
// actually bottom() makes the panel the first above ::stdscr.
|
| 164 |
+
|
| 165 |
+
virtual int mvwin(int y, int x) NCURSES_OVERRIDE
|
| 166 |
+
{
|
| 167 |
+
OnError(::move_panel(p, y, x));
|
| 168 |
+
return OK;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
inline bool hidden() const
|
| 172 |
+
{
|
| 173 |
+
return (::panel_hidden (p) ? TRUE : FALSE);
|
| 174 |
+
}
|
| 175 |
+
// Return TRUE if the panel is hidden, FALSE otherwise.
|
| 176 |
+
|
| 177 |
+
/* The functions panel_above() and panel_below() are not reflected in
|
| 178 |
+
the NCursesPanel class. The reason for this is, that we cannot
|
| 179 |
+
assume that a panel retrieved by those operations is one wrapped
|
| 180 |
+
by a C++ class. Although this situation might be handled, we also
|
| 181 |
+
need a reverse mapping from PANEL to NCursesPanel which needs some
|
| 182 |
+
redesign of the low level stuff. At the moment, we define them in the
|
| 183 |
+
interface but they will always produce an error. */
|
| 184 |
+
inline NCursesPanel& above() const
|
| 185 |
+
{
|
| 186 |
+
OnError(ERR);
|
| 187 |
+
return *dummy;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
inline NCursesPanel& below() const
|
| 191 |
+
{
|
| 192 |
+
OnError(ERR);
|
| 193 |
+
return *dummy;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
// Those two are rewrites of the corresponding virtual members of
|
| 197 |
+
// NCursesWindow
|
| 198 |
+
virtual int refresh() NCURSES_OVERRIDE;
|
| 199 |
+
// Propagate all panel changes to the virtual screen and update the
|
| 200 |
+
// physical screen.
|
| 201 |
+
|
| 202 |
+
virtual int noutrefresh() NCURSES_OVERRIDE;
|
| 203 |
+
// Propagate all panel changes to the virtual screen.
|
| 204 |
+
|
| 205 |
+
static void redraw();
|
| 206 |
+
// Redraw all panels.
|
| 207 |
+
|
| 208 |
+
// decorations
|
| 209 |
+
virtual void frame(const char* title=NULL,
|
| 210 |
+
const char* btitle=NULL);
|
| 211 |
+
// Put a frame around the panel and put the title centered in the top line
|
| 212 |
+
// and btitle in the bottom line.
|
| 213 |
+
|
| 214 |
+
virtual void boldframe(const char* title=NULL,
|
| 215 |
+
const char* btitle=NULL);
|
| 216 |
+
// Same as frame(), but use highlighted attributes.
|
| 217 |
+
|
| 218 |
+
virtual void label(const char* topLabel,
|
| 219 |
+
const char* bottomLabel);
|
| 220 |
+
// Put the title centered in the top line and btitle in the bottom line.
|
| 221 |
+
|
| 222 |
+
virtual void centertext(int row,const char* label);
|
| 223 |
+
// Put the label text centered in the specified row.
|
| 224 |
+
};
|
| 225 |
+
|
| 226 |
+
/* We use templates to provide a typesafe mechanism to associate
|
| 227 |
+
* user data with a panel. A NCursesUserPanel<T> is a panel
|
| 228 |
+
* associated with some user data of type T.
|
| 229 |
+
*/
|
| 230 |
+
template<class T> class NCursesUserPanel : public NCursesPanel
|
| 231 |
+
{
|
| 232 |
+
public:
|
| 233 |
+
NCursesUserPanel (int nlines,
|
| 234 |
+
int ncols,
|
| 235 |
+
int begin_y = 0,
|
| 236 |
+
int begin_x = 0,
|
| 237 |
+
const T* p_UserData = STATIC_CAST(T*)(0))
|
| 238 |
+
: NCursesPanel (nlines, ncols, begin_y, begin_x)
|
| 239 |
+
{
|
| 240 |
+
if (p)
|
| 241 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>
|
| 242 |
+
(p_UserData)));
|
| 243 |
+
};
|
| 244 |
+
// This creates an user panel of the requested size with associated
|
| 245 |
+
// user data pointed to by p_UserData.
|
| 246 |
+
|
| 247 |
+
explicit NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
|
| 248 |
+
{
|
| 249 |
+
if (p)
|
| 250 |
+
set_user(const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 251 |
+
};
|
| 252 |
+
// This creates an user panel associated with the ::stdscr and user data
|
| 253 |
+
// pointed to by p_UserData.
|
| 254 |
+
|
| 255 |
+
virtual ~NCursesUserPanel() THROWS(NCursesException) {};
|
| 256 |
+
|
| 257 |
+
T* UserData (void)
|
| 258 |
+
{
|
| 259 |
+
return reinterpret_cast<T*>(get_user ());
|
| 260 |
+
};
|
| 261 |
+
// Retrieve the user data associated with the panel.
|
| 262 |
+
|
| 263 |
+
virtual void setUserData (const T* p_UserData)
|
| 264 |
+
{
|
| 265 |
+
if (p)
|
| 266 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 267 |
+
}
|
| 268 |
+
// Associate the user panel with the user data pointed to by p_UserData.
|
| 269 |
+
};
|
| 270 |
+
|
| 271 |
+
#endif /* NCURSES_CURSESP_H_incl */
|
emu3/include/ncurses/cursslk.h
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * this is for making emacs happy: -*-Mode: C++;-*-
|
| 2 |
+
// vile:cppmode
|
| 3 |
+
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2003,2005 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
/****************************************************************************
|
| 33 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
// $Id: cursslk.h,v 1.19 2021/04/17 18:11:08 tom Exp $
|
| 37 |
+
|
| 38 |
+
#ifndef NCURSES_CURSSLK_H_incl
|
| 39 |
+
#define NCURSES_CURSSLK_H_incl
|
| 40 |
+
|
| 41 |
+
#include <ncursesw/cursesw.h>
|
| 42 |
+
|
| 43 |
+
class NCURSES_CXX_IMPEXP Soft_Label_Key_Set {
|
| 44 |
+
public:
|
| 45 |
+
// This inner class represents the attributes of a Soft Label Key (SLK)
|
| 46 |
+
class NCURSES_CXX_IMPEXP Soft_Label_Key {
|
| 47 |
+
friend class Soft_Label_Key_Set;
|
| 48 |
+
public:
|
| 49 |
+
typedef enum { Left=0, Center=1, Right=2 } Justification;
|
| 50 |
+
|
| 51 |
+
private:
|
| 52 |
+
char *label; // The Text of the Label
|
| 53 |
+
Justification format; // The Justification
|
| 54 |
+
int num; // The number of the Label
|
| 55 |
+
|
| 56 |
+
Soft_Label_Key() : label(NULL), format(Left), num(-1) {
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
virtual ~Soft_Label_Key() {
|
| 60 |
+
delete[] label;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
public:
|
| 64 |
+
// Set the text of the Label
|
| 65 |
+
Soft_Label_Key& operator=(char *text);
|
| 66 |
+
|
| 67 |
+
// Set the Justification of the Label
|
| 68 |
+
Soft_Label_Key& operator=(Justification just) {
|
| 69 |
+
format = just;
|
| 70 |
+
return *this;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
// Retrieve the text of the label
|
| 74 |
+
inline char* operator()(void) const {
|
| 75 |
+
return label;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
Soft_Label_Key& operator=(const Soft_Label_Key& rhs)
|
| 79 |
+
{
|
| 80 |
+
if (this != &rhs) {
|
| 81 |
+
*this = rhs;
|
| 82 |
+
}
|
| 83 |
+
return *this;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
Soft_Label_Key(const Soft_Label_Key& rhs)
|
| 87 |
+
: label(NULL),
|
| 88 |
+
format(rhs.format),
|
| 89 |
+
num(rhs.num)
|
| 90 |
+
{
|
| 91 |
+
*this = rhs.label;
|
| 92 |
+
}
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
public:
|
| 96 |
+
typedef enum {
|
| 97 |
+
None = -1,
|
| 98 |
+
Three_Two_Three = 0,
|
| 99 |
+
Four_Four = 1,
|
| 100 |
+
PC_Style = 2,
|
| 101 |
+
PC_Style_With_Index = 3
|
| 102 |
+
} Label_Layout;
|
| 103 |
+
|
| 104 |
+
private:
|
| 105 |
+
static long count; // Number of Key Sets
|
| 106 |
+
static Label_Layout format; // Layout of the Key Sets
|
| 107 |
+
static int num_labels; // Number Of Labels in Key Sets
|
| 108 |
+
bool b_attrInit; // Are attributes initialized
|
| 109 |
+
|
| 110 |
+
Soft_Label_Key *slk_array; // The array of SLK's
|
| 111 |
+
|
| 112 |
+
// Init the Key Set
|
| 113 |
+
void init();
|
| 114 |
+
|
| 115 |
+
// Activate or Deactivate Label# i, Label counting starts with 1!
|
| 116 |
+
void activate_label(int i, bool bf=TRUE);
|
| 117 |
+
|
| 118 |
+
// Activate of Deactivate all Labels
|
| 119 |
+
void activate_labels(bool bf);
|
| 120 |
+
|
| 121 |
+
protected:
|
| 122 |
+
inline void Error (const char* msg) const THROWS(NCursesException) {
|
| 123 |
+
THROW(new NCursesException (msg));
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Remove SLK's from screen
|
| 127 |
+
void clear() {
|
| 128 |
+
if (ERR==::slk_clear())
|
| 129 |
+
Error("slk_clear");
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
// Restore them
|
| 133 |
+
void restore() {
|
| 134 |
+
if (ERR==::slk_restore())
|
| 135 |
+
Error("slk_restore");
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
public:
|
| 139 |
+
|
| 140 |
+
// Construct a Key Set, use the most comfortable layout as default.
|
| 141 |
+
// You must create a Soft_Label_Key_Set before you create any object of
|
| 142 |
+
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
|
| 143 |
+
// ::initscr() is called).
|
| 144 |
+
explicit Soft_Label_Key_Set(Label_Layout fmt);
|
| 145 |
+
|
| 146 |
+
// This constructor assumes, that you already constructed a Key Set
|
| 147 |
+
// with a layout by the constructor above. This layout will be reused.
|
| 148 |
+
Soft_Label_Key_Set();
|
| 149 |
+
|
| 150 |
+
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
|
| 151 |
+
{
|
| 152 |
+
if (this != &rhs) {
|
| 153 |
+
*this = rhs;
|
| 154 |
+
init(); // allocate a new slk_array[]
|
| 155 |
+
}
|
| 156 |
+
return *this;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs)
|
| 160 |
+
: b_attrInit(rhs.b_attrInit),
|
| 161 |
+
slk_array(NULL)
|
| 162 |
+
{
|
| 163 |
+
init(); // allocate a new slk_array[]
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
virtual ~Soft_Label_Key_Set() THROWS(NCursesException);
|
| 167 |
+
|
| 168 |
+
// Get Label# i. Label counting starts with 1!
|
| 169 |
+
Soft_Label_Key& operator[](int i);
|
| 170 |
+
|
| 171 |
+
// Retrieve number of Labels
|
| 172 |
+
int labels() const;
|
| 173 |
+
|
| 174 |
+
// Refresh the SLK portion of the screen
|
| 175 |
+
inline void refresh() {
|
| 176 |
+
if (ERR==::slk_refresh())
|
| 177 |
+
Error("slk_refresh");
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// Mark the SLK portion of the screen for refresh, defer actual refresh
|
| 181 |
+
// until next update call.
|
| 182 |
+
inline void noutrefresh() {
|
| 183 |
+
if (ERR==::slk_noutrefresh())
|
| 184 |
+
Error("slk_noutrefresh");
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// Mark the whole SLK portion of the screen as modified
|
| 188 |
+
inline void touch() {
|
| 189 |
+
if (ERR==::slk_touch())
|
| 190 |
+
Error("slk_touch");
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
// Activate Label# i
|
| 194 |
+
inline void show(int i) {
|
| 195 |
+
activate_label(i,FALSE);
|
| 196 |
+
activate_label(i,TRUE);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Hide Label# i
|
| 200 |
+
inline void hide(int i) {
|
| 201 |
+
activate_label(i,FALSE);
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
// Show all Labels
|
| 205 |
+
inline void show() {
|
| 206 |
+
activate_labels(FALSE);
|
| 207 |
+
activate_labels(TRUE);
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
// Hide all Labels
|
| 211 |
+
inline void hide() {
|
| 212 |
+
activate_labels(FALSE);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
inline void attron(attr_t attrs) {
|
| 216 |
+
if (ERR==::slk_attron(attrs))
|
| 217 |
+
Error("slk_attron");
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
inline void attroff(attr_t attrs) {
|
| 221 |
+
if (ERR==::slk_attroff(attrs))
|
| 222 |
+
Error("slk_attroff");
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
inline void attrset(attr_t attrs) {
|
| 226 |
+
if (ERR==::slk_attrset(attrs))
|
| 227 |
+
Error("slk_attrset");
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
inline void color(short color_pair_number) {
|
| 231 |
+
if (ERR==::slk_color(color_pair_number))
|
| 232 |
+
Error("slk_color");
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
inline attr_t attr() const {
|
| 236 |
+
return ::slk_attr();
|
| 237 |
+
}
|
| 238 |
+
};
|
| 239 |
+
|
| 240 |
+
#endif /* NCURSES_CURSSLK_H_incl */
|
emu3/include/ncurses/eti.h
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2002,2003 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef NCURSES_ETI_H_incl
|
| 37 |
+
#define NCURSES_ETI_H_incl 1
|
| 38 |
+
|
| 39 |
+
#define E_OK (0)
|
| 40 |
+
#define E_SYSTEM_ERROR (-1)
|
| 41 |
+
#define E_BAD_ARGUMENT (-2)
|
| 42 |
+
#define E_POSTED (-3)
|
| 43 |
+
#define E_CONNECTED (-4)
|
| 44 |
+
#define E_BAD_STATE (-5)
|
| 45 |
+
#define E_NO_ROOM (-6)
|
| 46 |
+
#define E_NOT_POSTED (-7)
|
| 47 |
+
#define E_UNKNOWN_COMMAND (-8)
|
| 48 |
+
#define E_NO_MATCH (-9)
|
| 49 |
+
#define E_NOT_SELECTABLE (-10)
|
| 50 |
+
#define E_NOT_CONNECTED (-11)
|
| 51 |
+
#define E_REQUEST_DENIED (-12)
|
| 52 |
+
#define E_INVALID_FIELD (-13)
|
| 53 |
+
#define E_CURRENT (-14)
|
| 54 |
+
|
| 55 |
+
#endif
|
emu3/include/ncurses/etip.h
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
/****************************************************************************
|
| 3 |
+
* Copyright 2018-2021,2022 Thomas E. Dickey *
|
| 4 |
+
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
|
| 5 |
+
* *
|
| 6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 7 |
+
* copy of this software and associated documentation files (the *
|
| 8 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 9 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 10 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 11 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 12 |
+
* furnished to do so, subject to the following conditions: *
|
| 13 |
+
* *
|
| 14 |
+
* The above copyright notice and this permission notice shall be included *
|
| 15 |
+
* in all copies or substantial portions of the Software. *
|
| 16 |
+
* *
|
| 17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 18 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 19 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 20 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 21 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 22 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 23 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 24 |
+
* *
|
| 25 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 26 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 27 |
+
* sale, use or other dealings in this Software without prior written *
|
| 28 |
+
* authorization. *
|
| 29 |
+
****************************************************************************/
|
| 30 |
+
|
| 31 |
+
/****************************************************************************
|
| 32 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
// $Id: etip.h.in,v 1.50 2022/08/20 20:50:00 tom Exp $
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_ETIP_H_incl
|
| 38 |
+
#define NCURSES_ETIP_H_incl 1
|
| 39 |
+
|
| 40 |
+
// These are substituted at configure/build time
|
| 41 |
+
#ifndef HAVE_BUILTIN_H
|
| 42 |
+
#define HAVE_BUILTIN_H 0
|
| 43 |
+
#endif
|
| 44 |
+
|
| 45 |
+
#ifndef HAVE_GXX_BUILTIN_H
|
| 46 |
+
#define HAVE_GXX_BUILTIN_H 0
|
| 47 |
+
#endif
|
| 48 |
+
|
| 49 |
+
#ifndef HAVE_GPP_BUILTIN_H
|
| 50 |
+
#define HAVE_GPP_BUILTIN_H 0
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
#ifndef HAVE_IOSTREAM
|
| 54 |
+
#define HAVE_IOSTREAM 1
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#ifndef HAVE_TYPEINFO
|
| 58 |
+
#define HAVE_TYPEINFO 1
|
| 59 |
+
#endif
|
| 60 |
+
|
| 61 |
+
#ifndef HAVE_VALUES_H
|
| 62 |
+
#define HAVE_VALUES_H 0
|
| 63 |
+
#endif
|
| 64 |
+
|
| 65 |
+
#ifndef ETIP_NEEDS_MATH_H
|
| 66 |
+
#define ETIP_NEEDS_MATH_H 0
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
#ifndef ETIP_NEEDS_MATH_EXCEPTION
|
| 70 |
+
#define ETIP_NEEDS_MATH_EXCEPTION 0
|
| 71 |
+
#endif
|
| 72 |
+
|
| 73 |
+
#ifndef CPP_HAS_OVERRIDE
|
| 74 |
+
#define CPP_HAS_OVERRIDE 0
|
| 75 |
+
#endif
|
| 76 |
+
|
| 77 |
+
#ifndef CPP_HAS_PARAM_INIT
|
| 78 |
+
#define CPP_HAS_PARAM_INIT 0
|
| 79 |
+
#endif
|
| 80 |
+
|
| 81 |
+
#ifndef CPP_HAS_STATIC_CAST
|
| 82 |
+
#define CPP_HAS_STATIC_CAST 1
|
| 83 |
+
#endif
|
| 84 |
+
|
| 85 |
+
#ifndef IOSTREAM_NAMESPACE
|
| 86 |
+
#define IOSTREAM_NAMESPACE 1
|
| 87 |
+
#endif
|
| 88 |
+
|
| 89 |
+
#ifdef __GNUG__
|
| 90 |
+
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
|
| 91 |
+
# if HAVE_TYPEINFO
|
| 92 |
+
# include <typeinfo>
|
| 93 |
+
# endif
|
| 94 |
+
# endif
|
| 95 |
+
#endif
|
| 96 |
+
|
| 97 |
+
#if defined(__GNUG__)
|
| 98 |
+
# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
|
| 99 |
+
# if ETIP_NEEDS_MATH_H
|
| 100 |
+
# if ETIP_NEEDS_MATH_EXCEPTION
|
| 101 |
+
# undef exception
|
| 102 |
+
# define exception math_exception
|
| 103 |
+
# endif
|
| 104 |
+
# include <math.h>
|
| 105 |
+
# endif
|
| 106 |
+
# undef exception
|
| 107 |
+
# define exception builtin_exception
|
| 108 |
+
# if HAVE_GPP_BUILTIN_H
|
| 109 |
+
# include <gpp/builtin.h>
|
| 110 |
+
# elif HAVE_GXX_BUILTIN_H
|
| 111 |
+
# include <g++/builtin.h>
|
| 112 |
+
# else
|
| 113 |
+
# include <builtin.h>
|
| 114 |
+
# endif
|
| 115 |
+
# undef exception
|
| 116 |
+
# endif
|
| 117 |
+
#elif defined (__SUNPRO_CC)
|
| 118 |
+
# include <generic.h>
|
| 119 |
+
#endif
|
| 120 |
+
|
| 121 |
+
#include <ncursesw/curses.h>
|
| 122 |
+
|
| 123 |
+
extern "C" {
|
| 124 |
+
#if HAVE_VALUES_H
|
| 125 |
+
# include <values.h>
|
| 126 |
+
#endif
|
| 127 |
+
|
| 128 |
+
#include <assert.h>
|
| 129 |
+
#include <ncursesw/eti.h>
|
| 130 |
+
#include <errno.h>
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Language features
|
| 134 |
+
#if CPP_HAS_OVERRIDE
|
| 135 |
+
#define NCURSES_OVERRIDE override
|
| 136 |
+
#else
|
| 137 |
+
#define NCURSES_OVERRIDE /*nothing*/
|
| 138 |
+
#endif
|
| 139 |
+
|
| 140 |
+
#if CPP_HAS_PARAM_INIT
|
| 141 |
+
#define NCURSES_PARAM_INIT(value) = value
|
| 142 |
+
#else
|
| 143 |
+
#define NCURSES_PARAM_INIT(value) /*nothing*/
|
| 144 |
+
#endif
|
| 145 |
+
|
| 146 |
+
#if CPP_HAS_STATIC_CAST
|
| 147 |
+
#define STATIC_CAST(s) static_cast<s>
|
| 148 |
+
#else
|
| 149 |
+
#define STATIC_CAST(s) (s)
|
| 150 |
+
#endif
|
| 151 |
+
|
| 152 |
+
#ifndef NCURSES_CXX_IMPEXP
|
| 153 |
+
#define NCURSES_CXX_IMPEXP /* nothing */
|
| 154 |
+
#endif
|
| 155 |
+
|
| 156 |
+
// Forward Declarations
|
| 157 |
+
class NCURSES_CXX_IMPEXP NCursesPanel;
|
| 158 |
+
class NCURSES_CXX_IMPEXP NCursesMenu;
|
| 159 |
+
class NCURSES_CXX_IMPEXP NCursesForm;
|
| 160 |
+
|
| 161 |
+
class NCURSES_CXX_IMPEXP NCursesException
|
| 162 |
+
{
|
| 163 |
+
public:
|
| 164 |
+
const char *message;
|
| 165 |
+
int errorno;
|
| 166 |
+
|
| 167 |
+
NCursesException (const char* msg, int err)
|
| 168 |
+
: message(msg), errorno (err)
|
| 169 |
+
{};
|
| 170 |
+
|
| 171 |
+
explicit NCursesException (const char* msg)
|
| 172 |
+
: message(msg), errorno (E_SYSTEM_ERROR)
|
| 173 |
+
{};
|
| 174 |
+
|
| 175 |
+
NCursesException& operator=(const NCursesException& rhs)
|
| 176 |
+
{
|
| 177 |
+
message = rhs.message;
|
| 178 |
+
errorno = rhs.errorno;
|
| 179 |
+
return *this;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
NCursesException(const NCursesException& rhs)
|
| 183 |
+
: message(rhs.message), errorno(rhs.errorno)
|
| 184 |
+
{
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
virtual const char *classname() const {
|
| 188 |
+
return "NCursesWindow";
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
virtual ~NCursesException()
|
| 192 |
+
{
|
| 193 |
+
}
|
| 194 |
+
};
|
| 195 |
+
|
| 196 |
+
class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException
|
| 197 |
+
{
|
| 198 |
+
public:
|
| 199 |
+
const NCursesPanel* p;
|
| 200 |
+
|
| 201 |
+
NCursesPanelException (const char *msg, int err) :
|
| 202 |
+
NCursesException (msg, err),
|
| 203 |
+
p (0)
|
| 204 |
+
{};
|
| 205 |
+
|
| 206 |
+
NCursesPanelException (const NCursesPanel* panel,
|
| 207 |
+
const char *msg,
|
| 208 |
+
int err) :
|
| 209 |
+
NCursesException (msg, err),
|
| 210 |
+
p (panel)
|
| 211 |
+
{};
|
| 212 |
+
|
| 213 |
+
explicit NCursesPanelException (int err) :
|
| 214 |
+
NCursesException ("panel library error", err),
|
| 215 |
+
p (0)
|
| 216 |
+
{};
|
| 217 |
+
|
| 218 |
+
NCursesPanelException (const NCursesPanel* panel,
|
| 219 |
+
int err) :
|
| 220 |
+
NCursesException ("panel library error", err),
|
| 221 |
+
p (panel)
|
| 222 |
+
{};
|
| 223 |
+
|
| 224 |
+
NCursesPanelException& operator=(const NCursesPanelException& rhs)
|
| 225 |
+
{
|
| 226 |
+
if (this != &rhs) {
|
| 227 |
+
NCursesException::operator=(rhs);
|
| 228 |
+
p = rhs.p;
|
| 229 |
+
}
|
| 230 |
+
return *this;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
NCursesPanelException(const NCursesPanelException& rhs)
|
| 234 |
+
: NCursesException(rhs), p(rhs.p)
|
| 235 |
+
{
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 239 |
+
return "NCursesPanel";
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
virtual ~NCursesPanelException()
|
| 243 |
+
{
|
| 244 |
+
}
|
| 245 |
+
};
|
| 246 |
+
|
| 247 |
+
class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException
|
| 248 |
+
{
|
| 249 |
+
public:
|
| 250 |
+
const NCursesMenu* m;
|
| 251 |
+
|
| 252 |
+
NCursesMenuException (const char *msg, int err) :
|
| 253 |
+
NCursesException (msg, err),
|
| 254 |
+
m (0)
|
| 255 |
+
{};
|
| 256 |
+
|
| 257 |
+
NCursesMenuException (const NCursesMenu* menu,
|
| 258 |
+
const char *msg,
|
| 259 |
+
int err) :
|
| 260 |
+
NCursesException (msg, err),
|
| 261 |
+
m (menu)
|
| 262 |
+
{};
|
| 263 |
+
|
| 264 |
+
explicit NCursesMenuException (int err) :
|
| 265 |
+
NCursesException ("menu library error", err),
|
| 266 |
+
m (0)
|
| 267 |
+
{};
|
| 268 |
+
|
| 269 |
+
NCursesMenuException (const NCursesMenu* menu,
|
| 270 |
+
int err) :
|
| 271 |
+
NCursesException ("menu library error", err),
|
| 272 |
+
m (menu)
|
| 273 |
+
{};
|
| 274 |
+
|
| 275 |
+
NCursesMenuException& operator=(const NCursesMenuException& rhs)
|
| 276 |
+
{
|
| 277 |
+
if (this != &rhs) {
|
| 278 |
+
NCursesException::operator=(rhs);
|
| 279 |
+
m = rhs.m;
|
| 280 |
+
}
|
| 281 |
+
return *this;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
NCursesMenuException(const NCursesMenuException& rhs)
|
| 285 |
+
: NCursesException(rhs), m(rhs.m)
|
| 286 |
+
{
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 290 |
+
return "NCursesMenu";
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
virtual ~NCursesMenuException()
|
| 294 |
+
{
|
| 295 |
+
}
|
| 296 |
+
};
|
| 297 |
+
|
| 298 |
+
class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException
|
| 299 |
+
{
|
| 300 |
+
public:
|
| 301 |
+
const NCursesForm* f;
|
| 302 |
+
|
| 303 |
+
NCursesFormException (const char *msg, int err) :
|
| 304 |
+
NCursesException (msg, err),
|
| 305 |
+
f (0)
|
| 306 |
+
{};
|
| 307 |
+
|
| 308 |
+
NCursesFormException (const NCursesForm* form,
|
| 309 |
+
const char *msg,
|
| 310 |
+
int err) :
|
| 311 |
+
NCursesException (msg, err),
|
| 312 |
+
f (form)
|
| 313 |
+
{};
|
| 314 |
+
|
| 315 |
+
explicit NCursesFormException (int err) :
|
| 316 |
+
NCursesException ("form library error", err),
|
| 317 |
+
f (0)
|
| 318 |
+
{};
|
| 319 |
+
|
| 320 |
+
NCursesFormException (const NCursesForm* form,
|
| 321 |
+
int err) :
|
| 322 |
+
NCursesException ("form library error", err),
|
| 323 |
+
f (form)
|
| 324 |
+
{};
|
| 325 |
+
|
| 326 |
+
NCursesFormException& operator=(const NCursesFormException& rhs)
|
| 327 |
+
{
|
| 328 |
+
if (this != &rhs) {
|
| 329 |
+
NCursesException::operator=(rhs);
|
| 330 |
+
f = rhs.f;
|
| 331 |
+
}
|
| 332 |
+
return *this;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
NCursesFormException(const NCursesFormException& rhs)
|
| 336 |
+
: NCursesException(rhs), f(rhs.f)
|
| 337 |
+
{
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 341 |
+
return "NCursesForm";
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
virtual ~NCursesFormException()
|
| 345 |
+
{
|
| 346 |
+
}
|
| 347 |
+
};
|
| 348 |
+
|
| 349 |
+
#if !((defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || defined(__SUNPRO_CC))
|
| 350 |
+
# if HAVE_IOSTREAM
|
| 351 |
+
# include <iostream>
|
| 352 |
+
# if IOSTREAM_NAMESPACE
|
| 353 |
+
using std::cerr;
|
| 354 |
+
using std::endl;
|
| 355 |
+
# endif
|
| 356 |
+
# else
|
| 357 |
+
# include <iostream.h>
|
| 358 |
+
# endif
|
| 359 |
+
#endif
|
| 360 |
+
|
| 361 |
+
inline void THROW(const NCursesException *e) {
|
| 362 |
+
#if defined(__GNUG__) && defined(__EXCEPTIONS)
|
| 363 |
+
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
|
| 364 |
+
(*lib_error_handler)(e ? e->classname() : "", e ? e->message : "");
|
| 365 |
+
# elif (__GNUG__ >= 7)
|
| 366 |
+
// g++ 7.0 warns about deprecation, but lacks the predefined symbols
|
| 367 |
+
::endwin();
|
| 368 |
+
std::cerr << "Found a problem - goodbye" << std::endl;
|
| 369 |
+
exit(EXIT_FAILURE);
|
| 370 |
+
# else
|
| 371 |
+
# define CPP_HAS_TRY_CATCH 1
|
| 372 |
+
# endif
|
| 373 |
+
#elif defined(__SUNPRO_CC)
|
| 374 |
+
# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
|
| 375 |
+
genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
|
| 376 |
+
# else
|
| 377 |
+
# define CPP_HAS_TRY_CATCH 1
|
| 378 |
+
# endif
|
| 379 |
+
#else
|
| 380 |
+
if (e)
|
| 381 |
+
cerr << e->message << endl;
|
| 382 |
+
exit(0);
|
| 383 |
+
#endif
|
| 384 |
+
|
| 385 |
+
#ifndef CPP_HAS_TRY_CATCH
|
| 386 |
+
#define CPP_HAS_TRY_CATCH 0
|
| 387 |
+
#define NCURSES_CPP_TRY /* nothing */
|
| 388 |
+
#define NCURSES_CPP_CATCH(e) if (false)
|
| 389 |
+
#define THROWS(s) /* nothing */
|
| 390 |
+
#define THROW2(s,t) /* nothing */
|
| 391 |
+
#elif CPP_HAS_TRY_CATCH
|
| 392 |
+
throw *e;
|
| 393 |
+
#define NCURSES_CPP_TRY try
|
| 394 |
+
#define NCURSES_CPP_CATCH(e) catch(e)
|
| 395 |
+
#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510)
|
| 396 |
+
// C++17 deprecates the usage of throw().
|
| 397 |
+
#define THROWS(s) /* nothing */
|
| 398 |
+
#define THROW2(s,t) /* nothing */
|
| 399 |
+
#else
|
| 400 |
+
#define THROWS(s) throw(s)
|
| 401 |
+
#define THROW2(s,t) throw(s,t)
|
| 402 |
+
#endif
|
| 403 |
+
#endif
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
#endif /* NCURSES_ETIP_H_incl */
|
emu3/include/ncurses/form.h
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2019-2020,2021 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef FORM_H
|
| 37 |
+
#define FORM_H
|
| 38 |
+
/* *INDENT-OFF*/
|
| 39 |
+
|
| 40 |
+
#include <ncursesw/curses.h>
|
| 41 |
+
#include <ncursesw/eti.h>
|
| 42 |
+
|
| 43 |
+
#ifdef __cplusplus
|
| 44 |
+
extern "C" {
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
#if defined(BUILDING_FORM)
|
| 48 |
+
# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 49 |
+
#else
|
| 50 |
+
# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 54 |
+
|
| 55 |
+
#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
|
| 56 |
+
#define FORM_EXPORT_VAR(type) FORM_IMPEXP type
|
| 57 |
+
|
| 58 |
+
#ifndef FORM_PRIV_H
|
| 59 |
+
typedef void *FIELD_CELL;
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
#ifndef NCURSES_FIELD_INTERNALS
|
| 63 |
+
#define NCURSES_FIELD_INTERNALS /* nothing */
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
typedef int Form_Options;
|
| 67 |
+
typedef int Field_Options;
|
| 68 |
+
|
| 69 |
+
/**********
|
| 70 |
+
* _PAGE *
|
| 71 |
+
**********/
|
| 72 |
+
|
| 73 |
+
typedef struct pagenode
|
| 74 |
+
#if !NCURSES_OPAQUE_FORM
|
| 75 |
+
{
|
| 76 |
+
short pmin; /* index of first field on page */
|
| 77 |
+
short pmax; /* index of last field on page */
|
| 78 |
+
short smin; /* index of top leftmost field on page */
|
| 79 |
+
short smax; /* index of bottom rightmost field on page */
|
| 80 |
+
}
|
| 81 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 82 |
+
_PAGE;
|
| 83 |
+
|
| 84 |
+
/**********
|
| 85 |
+
* FIELD *
|
| 86 |
+
**********/
|
| 87 |
+
|
| 88 |
+
typedef struct fieldnode
|
| 89 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
| 90 |
+
{
|
| 91 |
+
unsigned short status; /* flags */
|
| 92 |
+
short rows; /* size in rows */
|
| 93 |
+
short cols; /* size in cols */
|
| 94 |
+
short frow; /* first row */
|
| 95 |
+
short fcol; /* first col */
|
| 96 |
+
int drows; /* dynamic rows */
|
| 97 |
+
int dcols; /* dynamic cols */
|
| 98 |
+
int maxgrow; /* maximum field growth */
|
| 99 |
+
int nrow; /* off-screen rows */
|
| 100 |
+
short nbuf; /* additional buffers */
|
| 101 |
+
short just; /* justification */
|
| 102 |
+
short page; /* page on form */
|
| 103 |
+
short index; /* into form -> field */
|
| 104 |
+
int pad; /* pad character */
|
| 105 |
+
chtype fore; /* foreground attribute */
|
| 106 |
+
chtype back; /* background attribute */
|
| 107 |
+
Field_Options opts; /* options */
|
| 108 |
+
struct fieldnode * snext; /* sorted order pointer */
|
| 109 |
+
struct fieldnode * sprev; /* sorted order pointer */
|
| 110 |
+
struct fieldnode * link; /* linked field chain */
|
| 111 |
+
struct formnode * form; /* containing form */
|
| 112 |
+
struct typenode * type; /* field type */
|
| 113 |
+
void * arg; /* argument for type */
|
| 114 |
+
FIELD_CELL * buf; /* field buffers */
|
| 115 |
+
void * usrptr; /* user pointer */
|
| 116 |
+
/*
|
| 117 |
+
* The wide-character configuration requires extra information. Because
|
| 118 |
+
* there are existing applications that manipulate the members of FIELD
|
| 119 |
+
* directly, we cannot make the struct opaque, except by changing the ABI.
|
| 120 |
+
* Offsets of members up to this point are the same in the narrow- and
|
| 121 |
+
* wide-character configuration. But note that the type of buf depends on
|
| 122 |
+
* the configuration, and is made opaque for that reason.
|
| 123 |
+
*/
|
| 124 |
+
NCURSES_FIELD_INTERNALS
|
| 125 |
+
}
|
| 126 |
+
#endif /* NCURSES_OPAQUE_FORM */
|
| 127 |
+
FIELD;
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
/*********
|
| 131 |
+
* FORM *
|
| 132 |
+
*********/
|
| 133 |
+
|
| 134 |
+
typedef struct formnode
|
| 135 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
| 136 |
+
{
|
| 137 |
+
unsigned short status; /* flags */
|
| 138 |
+
short rows; /* size in rows */
|
| 139 |
+
short cols; /* size in cols */
|
| 140 |
+
int currow; /* current row in field window */
|
| 141 |
+
int curcol; /* current col in field window */
|
| 142 |
+
int toprow; /* in scrollable field window */
|
| 143 |
+
int begincol; /* in horiz. scrollable field */
|
| 144 |
+
short maxfield; /* number of fields */
|
| 145 |
+
short maxpage; /* number of pages */
|
| 146 |
+
short curpage; /* index into page */
|
| 147 |
+
Form_Options opts; /* options */
|
| 148 |
+
WINDOW * win; /* window */
|
| 149 |
+
WINDOW * sub; /* subwindow */
|
| 150 |
+
WINDOW * w; /* window for current field */
|
| 151 |
+
FIELD ** field; /* field [maxfield] */
|
| 152 |
+
FIELD * current; /* current field */
|
| 153 |
+
_PAGE * page; /* page [maxpage] */
|
| 154 |
+
void * usrptr; /* user pointer */
|
| 155 |
+
|
| 156 |
+
void (*forminit)(struct formnode *);
|
| 157 |
+
void (*formterm)(struct formnode *);
|
| 158 |
+
void (*fieldinit)(struct formnode *);
|
| 159 |
+
void (*fieldterm)(struct formnode *);
|
| 160 |
+
|
| 161 |
+
}
|
| 162 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 163 |
+
FORM;
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
/**************
|
| 167 |
+
* FIELDTYPE *
|
| 168 |
+
**************/
|
| 169 |
+
|
| 170 |
+
typedef struct typenode
|
| 171 |
+
#if !NCURSES_OPAQUE_FORM
|
| 172 |
+
{
|
| 173 |
+
unsigned short status; /* flags */
|
| 174 |
+
long ref; /* reference count */
|
| 175 |
+
struct typenode * left; /* ptr to operand for | */
|
| 176 |
+
struct typenode * right; /* ptr to operand for | */
|
| 177 |
+
|
| 178 |
+
void* (*makearg)(va_list *); /* make fieldtype arg */
|
| 179 |
+
void* (*copyarg)(const void *); /* copy fieldtype arg */
|
| 180 |
+
void (*freearg)(void *); /* free fieldtype arg */
|
| 181 |
+
|
| 182 |
+
#if NCURSES_INTEROP_FUNCS
|
| 183 |
+
union {
|
| 184 |
+
bool (*ofcheck)(FIELD *,const void *); /* field validation */
|
| 185 |
+
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
|
| 186 |
+
} fieldcheck;
|
| 187 |
+
union {
|
| 188 |
+
bool (*occheck)(int,const void *); /* character validation */
|
| 189 |
+
bool (*gccheck)(int,FORM*,
|
| 190 |
+
FIELD*,const void*); /* generic char validation */
|
| 191 |
+
} charcheck;
|
| 192 |
+
union {
|
| 193 |
+
bool (*onext)(FIELD *,const void *); /* enumerate next value */
|
| 194 |
+
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
|
| 195 |
+
} enum_next;
|
| 196 |
+
union {
|
| 197 |
+
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
|
| 198 |
+
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
|
| 199 |
+
} enum_prev;
|
| 200 |
+
void* (*genericarg)(void*); /* Alternate Arg method */
|
| 201 |
+
#else
|
| 202 |
+
bool (*fcheck)(FIELD *,const void *); /* field validation */
|
| 203 |
+
bool (*ccheck)(int,const void *); /* character validation */
|
| 204 |
+
|
| 205 |
+
bool (*next)(FIELD *,const void *); /* enumerate next value */
|
| 206 |
+
bool (*prev)(FIELD *,const void *); /* enumerate prev value */
|
| 207 |
+
#endif
|
| 208 |
+
}
|
| 209 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 210 |
+
FIELDTYPE;
|
| 211 |
+
|
| 212 |
+
typedef void (*Form_Hook)(FORM *);
|
| 213 |
+
|
| 214 |
+
/***************************
|
| 215 |
+
* miscellaneous #defines *
|
| 216 |
+
***************************/
|
| 217 |
+
|
| 218 |
+
/* field justification */
|
| 219 |
+
#define NO_JUSTIFICATION (0)
|
| 220 |
+
#define JUSTIFY_LEFT (1)
|
| 221 |
+
#define JUSTIFY_CENTER (2)
|
| 222 |
+
#define JUSTIFY_RIGHT (3)
|
| 223 |
+
|
| 224 |
+
/* field options */
|
| 225 |
+
#define O_VISIBLE (0x0001U)
|
| 226 |
+
#define O_ACTIVE (0x0002U)
|
| 227 |
+
#define O_PUBLIC (0x0004U)
|
| 228 |
+
#define O_EDIT (0x0008U)
|
| 229 |
+
#define O_WRAP (0x0010U)
|
| 230 |
+
#define O_BLANK (0x0020U)
|
| 231 |
+
#define O_AUTOSKIP (0x0040U)
|
| 232 |
+
#define O_NULLOK (0x0080U)
|
| 233 |
+
#define O_PASSOK (0x0100U)
|
| 234 |
+
#define O_STATIC (0x0200U)
|
| 235 |
+
#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
|
| 236 |
+
#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */
|
| 237 |
+
#define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */
|
| 238 |
+
#define O_INPUT_LIMIT (0x2000U) /* ncurses extension */
|
| 239 |
+
|
| 240 |
+
/* form options */
|
| 241 |
+
#define O_NL_OVERLOAD (0x0001U)
|
| 242 |
+
#define O_BS_OVERLOAD (0x0002U)
|
| 243 |
+
|
| 244 |
+
/* form driver commands */
|
| 245 |
+
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
|
| 246 |
+
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
|
| 247 |
+
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
|
| 248 |
+
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
|
| 249 |
+
|
| 250 |
+
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
|
| 251 |
+
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
|
| 252 |
+
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
|
| 253 |
+
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
|
| 254 |
+
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
|
| 255 |
+
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
|
| 256 |
+
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
|
| 257 |
+
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
|
| 258 |
+
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
|
| 259 |
+
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
|
| 260 |
+
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
|
| 261 |
+
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
|
| 262 |
+
|
| 263 |
+
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
|
| 264 |
+
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
|
| 265 |
+
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
|
| 266 |
+
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
|
| 267 |
+
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
|
| 268 |
+
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
|
| 269 |
+
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
|
| 270 |
+
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
|
| 271 |
+
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
|
| 272 |
+
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
|
| 273 |
+
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
|
| 274 |
+
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
|
| 275 |
+
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
|
| 276 |
+
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
|
| 277 |
+
|
| 278 |
+
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
|
| 279 |
+
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
|
| 280 |
+
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
|
| 281 |
+
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
|
| 282 |
+
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
|
| 283 |
+
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
|
| 284 |
+
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
|
| 285 |
+
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
|
| 286 |
+
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
|
| 287 |
+
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
|
| 288 |
+
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
|
| 289 |
+
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
|
| 290 |
+
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
|
| 291 |
+
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
|
| 292 |
+
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
|
| 293 |
+
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
|
| 294 |
+
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
|
| 295 |
+
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
|
| 296 |
+
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
|
| 297 |
+
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
|
| 298 |
+
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
|
| 299 |
+
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
|
| 300 |
+
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
|
| 301 |
+
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
|
| 302 |
+
|
| 303 |
+
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
|
| 304 |
+
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
|
| 305 |
+
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
|
| 306 |
+
|
| 307 |
+
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
|
| 308 |
+
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
|
| 309 |
+
|
| 310 |
+
#if defined(MAX_COMMAND)
|
| 311 |
+
# if (MAX_FORM_COMMAND > MAX_COMMAND)
|
| 312 |
+
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
|
| 313 |
+
# elif (MAX_COMMAND != (KEY_MAX + 128))
|
| 314 |
+
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
|
| 315 |
+
# endif
|
| 316 |
+
#else
|
| 317 |
+
# define MAX_COMMAND (KEY_MAX + 128)
|
| 318 |
+
#endif
|
| 319 |
+
|
| 320 |
+
/*************************
|
| 321 |
+
* standard field types *
|
| 322 |
+
*************************/
|
| 323 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
|
| 324 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
|
| 325 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
|
| 326 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
|
| 327 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
|
| 328 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
|
| 329 |
+
|
| 330 |
+
/************************************
|
| 331 |
+
* built-in additional field types *
|
| 332 |
+
* They are not defined in SVr4 *
|
| 333 |
+
************************************/
|
| 334 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
|
| 335 |
+
|
| 336 |
+
/***********************
|
| 337 |
+
* FIELDTYPE routines *
|
| 338 |
+
***********************/
|
| 339 |
+
extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
|
| 340 |
+
bool (* const field_check)(FIELD *,const void *),
|
| 341 |
+
bool (* const char_check)(int,const void *));
|
| 342 |
+
extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
|
| 343 |
+
FIELDTYPE *, FIELDTYPE *);
|
| 344 |
+
|
| 345 |
+
extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *);
|
| 346 |
+
extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
|
| 347 |
+
void * (* const make_arg)(va_list *),
|
| 348 |
+
void * (* const copy_arg)(const void *),
|
| 349 |
+
void (* const free_arg)(void *));
|
| 350 |
+
extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
|
| 351 |
+
bool (* const next_choice)(FIELD *,const void *),
|
| 352 |
+
bool (* const prev_choice)(FIELD *,const void *));
|
| 353 |
+
|
| 354 |
+
/*******************
|
| 355 |
+
* FIELD routines *
|
| 356 |
+
*******************/
|
| 357 |
+
extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
|
| 358 |
+
extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int);
|
| 359 |
+
extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int);
|
| 360 |
+
|
| 361 |
+
extern FORM_EXPORT(int) free_field (FIELD *);
|
| 362 |
+
extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
|
| 363 |
+
extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
|
| 364 |
+
extern FORM_EXPORT(int) set_max_field ( FIELD *,int);
|
| 365 |
+
extern FORM_EXPORT(int) move_field (FIELD *,int,int);
|
| 366 |
+
extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
|
| 367 |
+
extern FORM_EXPORT(int) set_new_page (FIELD *,bool);
|
| 368 |
+
extern FORM_EXPORT(int) set_field_just (FIELD *,int);
|
| 369 |
+
extern FORM_EXPORT(int) field_just (const FIELD *);
|
| 370 |
+
extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype);
|
| 371 |
+
extern FORM_EXPORT(int) set_field_back (FIELD *,chtype);
|
| 372 |
+
extern FORM_EXPORT(int) set_field_pad (FIELD *,int);
|
| 373 |
+
extern FORM_EXPORT(int) field_pad (const FIELD *);
|
| 374 |
+
extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
|
| 375 |
+
extern FORM_EXPORT(int) set_field_status (FIELD *,bool);
|
| 376 |
+
extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *);
|
| 377 |
+
extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options);
|
| 378 |
+
extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options);
|
| 379 |
+
extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options);
|
| 380 |
+
|
| 381 |
+
extern FORM_EXPORT(chtype) field_fore (const FIELD *);
|
| 382 |
+
extern FORM_EXPORT(chtype) field_back (const FIELD *);
|
| 383 |
+
|
| 384 |
+
extern FORM_EXPORT(bool) new_page (const FIELD *);
|
| 385 |
+
extern FORM_EXPORT(bool) field_status (const FIELD *);
|
| 386 |
+
|
| 387 |
+
extern FORM_EXPORT(void *) field_arg (const FIELD *);
|
| 388 |
+
|
| 389 |
+
extern FORM_EXPORT(void *) field_userptr (const FIELD *);
|
| 390 |
+
|
| 391 |
+
extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *);
|
| 392 |
+
|
| 393 |
+
extern FORM_EXPORT(char *) field_buffer (const FIELD *,int);
|
| 394 |
+
|
| 395 |
+
extern FORM_EXPORT(Field_Options) field_opts (const FIELD *);
|
| 396 |
+
|
| 397 |
+
/******************
|
| 398 |
+
* FORM routines *
|
| 399 |
+
******************/
|
| 400 |
+
|
| 401 |
+
extern FORM_EXPORT(FORM *) new_form (FIELD **);
|
| 402 |
+
|
| 403 |
+
extern FORM_EXPORT(FIELD **) form_fields (const FORM *);
|
| 404 |
+
extern FORM_EXPORT(FIELD *) current_field (const FORM *);
|
| 405 |
+
|
| 406 |
+
extern FORM_EXPORT(WINDOW *) form_win (const FORM *);
|
| 407 |
+
extern FORM_EXPORT(WINDOW *) form_sub (const FORM *);
|
| 408 |
+
|
| 409 |
+
extern FORM_EXPORT(Form_Hook) form_init (const FORM *);
|
| 410 |
+
extern FORM_EXPORT(Form_Hook) form_term (const FORM *);
|
| 411 |
+
extern FORM_EXPORT(Form_Hook) field_init (const FORM *);
|
| 412 |
+
extern FORM_EXPORT(Form_Hook) field_term (const FORM *);
|
| 413 |
+
|
| 414 |
+
extern FORM_EXPORT(int) free_form (FORM *);
|
| 415 |
+
extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **);
|
| 416 |
+
extern FORM_EXPORT(int) field_count (const FORM *);
|
| 417 |
+
extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *);
|
| 418 |
+
extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *);
|
| 419 |
+
extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *);
|
| 420 |
+
extern FORM_EXPORT(int) unfocus_current_field (FORM *);
|
| 421 |
+
extern FORM_EXPORT(int) field_index (const FIELD *);
|
| 422 |
+
extern FORM_EXPORT(int) set_form_page (FORM *,int);
|
| 423 |
+
extern FORM_EXPORT(int) form_page (const FORM *);
|
| 424 |
+
extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *);
|
| 425 |
+
extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook);
|
| 426 |
+
extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook);
|
| 427 |
+
extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook);
|
| 428 |
+
extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook);
|
| 429 |
+
extern FORM_EXPORT(int) post_form (FORM *);
|
| 430 |
+
extern FORM_EXPORT(int) unpost_form (FORM *);
|
| 431 |
+
extern FORM_EXPORT(int) pos_form_cursor (FORM *);
|
| 432 |
+
extern FORM_EXPORT(int) form_driver (FORM *,int);
|
| 433 |
+
# if NCURSES_WIDECHAR
|
| 434 |
+
extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
|
| 435 |
+
# endif
|
| 436 |
+
extern FORM_EXPORT(int) set_form_userptr (FORM *,void *);
|
| 437 |
+
extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options);
|
| 438 |
+
extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options);
|
| 439 |
+
extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options);
|
| 440 |
+
extern FORM_EXPORT(int) form_request_by_name (const char *);
|
| 441 |
+
|
| 442 |
+
extern FORM_EXPORT(const char *) form_request_name (int);
|
| 443 |
+
|
| 444 |
+
extern FORM_EXPORT(void *) form_userptr (const FORM *);
|
| 445 |
+
|
| 446 |
+
extern FORM_EXPORT(Form_Options) form_opts (const FORM *);
|
| 447 |
+
|
| 448 |
+
extern FORM_EXPORT(bool) data_ahead (const FORM *);
|
| 449 |
+
extern FORM_EXPORT(bool) data_behind (const FORM *);
|
| 450 |
+
|
| 451 |
+
#if NCURSES_SP_FUNCS
|
| 452 |
+
extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
|
| 453 |
+
#endif
|
| 454 |
+
|
| 455 |
+
#ifdef __cplusplus
|
| 456 |
+
}
|
| 457 |
+
#endif
|
| 458 |
+
/* *INDENT-ON*/
|
| 459 |
+
|
| 460 |
+
#endif /* FORM_H */
|
emu3/include/ncurses/menu.h
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: menu.h,v 1.26 2020/12/12 00:38:02 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef ETI_MENU
|
| 37 |
+
#define ETI_MENU
|
| 38 |
+
|
| 39 |
+
#ifdef AMIGA
|
| 40 |
+
#define TEXT TEXT_ncurses
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#include <ncursesw/curses.h>
|
| 44 |
+
#include <ncursesw/eti.h>
|
| 45 |
+
|
| 46 |
+
#ifdef __cplusplus
|
| 47 |
+
extern "C"
|
| 48 |
+
{
|
| 49 |
+
#endif
|
| 50 |
+
|
| 51 |
+
#if defined(BUILDING_MENU)
|
| 52 |
+
# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 53 |
+
#else
|
| 54 |
+
# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 58 |
+
|
| 59 |
+
#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API
|
| 60 |
+
#define MENU_EXPORT_VAR(type) MENU_IMPEXP type
|
| 61 |
+
|
| 62 |
+
typedef int Menu_Options;
|
| 63 |
+
typedef int Item_Options;
|
| 64 |
+
|
| 65 |
+
/* Menu options: */
|
| 66 |
+
#define O_ONEVALUE (0x01)
|
| 67 |
+
#define O_SHOWDESC (0x02)
|
| 68 |
+
#define O_ROWMAJOR (0x04)
|
| 69 |
+
#define O_IGNORECASE (0x08)
|
| 70 |
+
#define O_SHOWMATCH (0x10)
|
| 71 |
+
#define O_NONCYCLIC (0x20)
|
| 72 |
+
#define O_MOUSE_MENU (0x40)
|
| 73 |
+
|
| 74 |
+
/* Item options: */
|
| 75 |
+
#define O_SELECTABLE (0x01)
|
| 76 |
+
|
| 77 |
+
#if !NCURSES_OPAQUE_MENU
|
| 78 |
+
typedef struct
|
| 79 |
+
{
|
| 80 |
+
const char *str;
|
| 81 |
+
unsigned short length;
|
| 82 |
+
}
|
| 83 |
+
TEXT;
|
| 84 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 85 |
+
|
| 86 |
+
struct tagMENU;
|
| 87 |
+
|
| 88 |
+
typedef struct tagITEM
|
| 89 |
+
#if !NCURSES_OPAQUE_MENU
|
| 90 |
+
{
|
| 91 |
+
TEXT name; /* name of menu item */
|
| 92 |
+
TEXT description; /* description of item, optional in display */
|
| 93 |
+
struct tagMENU *imenu; /* Pointer to parent menu */
|
| 94 |
+
void *userptr; /* Pointer to user defined per item data */
|
| 95 |
+
Item_Options opt; /* Item options */
|
| 96 |
+
short index; /* Item number if connected to a menu */
|
| 97 |
+
short y; /* y and x location of item in menu */
|
| 98 |
+
short x;
|
| 99 |
+
bool value; /* Selection value */
|
| 100 |
+
|
| 101 |
+
struct tagITEM *left; /* neighbor items */
|
| 102 |
+
struct tagITEM *right;
|
| 103 |
+
struct tagITEM *up;
|
| 104 |
+
struct tagITEM *down;
|
| 105 |
+
|
| 106 |
+
}
|
| 107 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 108 |
+
ITEM;
|
| 109 |
+
|
| 110 |
+
typedef void (*Menu_Hook) (struct tagMENU *);
|
| 111 |
+
|
| 112 |
+
typedef struct tagMENU
|
| 113 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_MENU */
|
| 114 |
+
{
|
| 115 |
+
short height; /* Nr. of chars high */
|
| 116 |
+
short width; /* Nr. of chars wide */
|
| 117 |
+
short rows; /* Nr. of items high */
|
| 118 |
+
short cols; /* Nr. of items wide */
|
| 119 |
+
short frows; /* Nr. of formatted items high */
|
| 120 |
+
short fcols; /* Nr. of formatted items wide */
|
| 121 |
+
short arows; /* Nr. of items high (actual) */
|
| 122 |
+
short namelen; /* Max. name length */
|
| 123 |
+
short desclen; /* Max. description length */
|
| 124 |
+
short marklen; /* Length of mark, if any */
|
| 125 |
+
short itemlen; /* Length of one item */
|
| 126 |
+
short spc_desc; /* Spacing for descriptor */
|
| 127 |
+
short spc_cols; /* Spacing for columns */
|
| 128 |
+
short spc_rows; /* Spacing for rows */
|
| 129 |
+
char *pattern; /* Buffer to store match chars */
|
| 130 |
+
short pindex; /* Index into pattern buffer */
|
| 131 |
+
WINDOW *win; /* Window containing menu */
|
| 132 |
+
WINDOW *sub; /* Subwindow for menu display */
|
| 133 |
+
WINDOW *userwin; /* User's window */
|
| 134 |
+
WINDOW *usersub; /* User's subwindow */
|
| 135 |
+
ITEM **items; /* array of items */
|
| 136 |
+
short nitems; /* Nr. of items in menu */
|
| 137 |
+
ITEM *curitem; /* Current item */
|
| 138 |
+
short toprow; /* Top row of menu */
|
| 139 |
+
chtype fore; /* Selection attribute */
|
| 140 |
+
chtype back; /* Nonselection attribute */
|
| 141 |
+
chtype grey; /* Inactive attribute */
|
| 142 |
+
unsigned char pad; /* Pad character */
|
| 143 |
+
|
| 144 |
+
Menu_Hook menuinit; /* User hooks */
|
| 145 |
+
Menu_Hook menuterm;
|
| 146 |
+
Menu_Hook iteminit;
|
| 147 |
+
Menu_Hook itemterm;
|
| 148 |
+
|
| 149 |
+
void *userptr; /* Pointer to menus user data */
|
| 150 |
+
char *mark; /* Pointer to marker string */
|
| 151 |
+
|
| 152 |
+
Menu_Options opt; /* Menu options */
|
| 153 |
+
unsigned short status; /* Internal state of menu */
|
| 154 |
+
}
|
| 155 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 156 |
+
MENU;
|
| 157 |
+
|
| 158 |
+
/* Define keys */
|
| 159 |
+
|
| 160 |
+
#define REQ_LEFT_ITEM (KEY_MAX + 1)
|
| 161 |
+
#define REQ_RIGHT_ITEM (KEY_MAX + 2)
|
| 162 |
+
#define REQ_UP_ITEM (KEY_MAX + 3)
|
| 163 |
+
#define REQ_DOWN_ITEM (KEY_MAX + 4)
|
| 164 |
+
#define REQ_SCR_ULINE (KEY_MAX + 5)
|
| 165 |
+
#define REQ_SCR_DLINE (KEY_MAX + 6)
|
| 166 |
+
#define REQ_SCR_DPAGE (KEY_MAX + 7)
|
| 167 |
+
#define REQ_SCR_UPAGE (KEY_MAX + 8)
|
| 168 |
+
#define REQ_FIRST_ITEM (KEY_MAX + 9)
|
| 169 |
+
#define REQ_LAST_ITEM (KEY_MAX + 10)
|
| 170 |
+
#define REQ_NEXT_ITEM (KEY_MAX + 11)
|
| 171 |
+
#define REQ_PREV_ITEM (KEY_MAX + 12)
|
| 172 |
+
#define REQ_TOGGLE_ITEM (KEY_MAX + 13)
|
| 173 |
+
#define REQ_CLEAR_PATTERN (KEY_MAX + 14)
|
| 174 |
+
#define REQ_BACK_PATTERN (KEY_MAX + 15)
|
| 175 |
+
#define REQ_NEXT_MATCH (KEY_MAX + 16)
|
| 176 |
+
#define REQ_PREV_MATCH (KEY_MAX + 17)
|
| 177 |
+
|
| 178 |
+
#define MIN_MENU_COMMAND (KEY_MAX + 1)
|
| 179 |
+
#define MAX_MENU_COMMAND (KEY_MAX + 17)
|
| 180 |
+
|
| 181 |
+
/*
|
| 182 |
+
* Some AT&T code expects MAX_COMMAND to be out-of-band not
|
| 183 |
+
* just for menu commands but for forms ones as well.
|
| 184 |
+
*/
|
| 185 |
+
#if defined(MAX_COMMAND)
|
| 186 |
+
# if (MAX_MENU_COMMAND > MAX_COMMAND)
|
| 187 |
+
# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
|
| 188 |
+
# elif (MAX_COMMAND != (KEY_MAX + 128))
|
| 189 |
+
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
|
| 190 |
+
# endif
|
| 191 |
+
#else
|
| 192 |
+
# define MAX_COMMAND (KEY_MAX + 128)
|
| 193 |
+
#endif
|
| 194 |
+
|
| 195 |
+
/* --------- prototypes for libmenu functions ----------------------------- */
|
| 196 |
+
|
| 197 |
+
extern MENU_EXPORT(ITEM **) menu_items(const MENU *);
|
| 198 |
+
extern MENU_EXPORT(ITEM *) current_item(const MENU *);
|
| 199 |
+
extern MENU_EXPORT(ITEM *) new_item(const char *, const char *);
|
| 200 |
+
|
| 201 |
+
extern MENU_EXPORT(MENU *) new_menu(ITEM **);
|
| 202 |
+
|
| 203 |
+
extern MENU_EXPORT(Item_Options) item_opts(const ITEM *);
|
| 204 |
+
extern MENU_EXPORT(Menu_Options) menu_opts(const MENU *);
|
| 205 |
+
|
| 206 |
+
extern MENU_EXPORT(Menu_Hook) item_init(const MENU *);
|
| 207 |
+
extern MENU_EXPORT(Menu_Hook) item_term(const MENU *);
|
| 208 |
+
extern MENU_EXPORT(Menu_Hook) menu_init(const MENU *);
|
| 209 |
+
extern MENU_EXPORT(Menu_Hook) menu_term(const MENU *);
|
| 210 |
+
|
| 211 |
+
extern MENU_EXPORT(WINDOW *) menu_sub(const MENU *);
|
| 212 |
+
extern MENU_EXPORT(WINDOW *) menu_win(const MENU *);
|
| 213 |
+
|
| 214 |
+
extern MENU_EXPORT(const char *) item_description(const ITEM *);
|
| 215 |
+
extern MENU_EXPORT(const char *) item_name(const ITEM *);
|
| 216 |
+
extern MENU_EXPORT(const char *) menu_mark(const MENU *);
|
| 217 |
+
extern MENU_EXPORT(const char *) menu_request_name(int);
|
| 218 |
+
|
| 219 |
+
extern MENU_EXPORT(char *) menu_pattern(const MENU *);
|
| 220 |
+
|
| 221 |
+
extern MENU_EXPORT(void *) menu_userptr(const MENU *);
|
| 222 |
+
extern MENU_EXPORT(void *) item_userptr(const ITEM *);
|
| 223 |
+
|
| 224 |
+
extern MENU_EXPORT(chtype) menu_back(const MENU *);
|
| 225 |
+
extern MENU_EXPORT(chtype) menu_fore(const MENU *);
|
| 226 |
+
extern MENU_EXPORT(chtype) menu_grey(const MENU *);
|
| 227 |
+
|
| 228 |
+
extern MENU_EXPORT(int) free_item(ITEM *);
|
| 229 |
+
extern MENU_EXPORT(int) free_menu(MENU *);
|
| 230 |
+
extern MENU_EXPORT(int) item_count(const MENU *);
|
| 231 |
+
extern MENU_EXPORT(int) item_index(const ITEM *);
|
| 232 |
+
extern MENU_EXPORT(int) item_opts_off(ITEM *, Item_Options);
|
| 233 |
+
extern MENU_EXPORT(int) item_opts_on(ITEM *, Item_Options);
|
| 234 |
+
extern MENU_EXPORT(int) menu_driver(MENU *, int);
|
| 235 |
+
extern MENU_EXPORT(int) menu_opts_off(MENU *, Menu_Options);
|
| 236 |
+
extern MENU_EXPORT(int) menu_opts_on(MENU *, Menu_Options);
|
| 237 |
+
extern MENU_EXPORT(int) menu_pad(const MENU *);
|
| 238 |
+
extern MENU_EXPORT(int) pos_menu_cursor(const MENU *);
|
| 239 |
+
extern MENU_EXPORT(int) post_menu(MENU *);
|
| 240 |
+
extern MENU_EXPORT(int) scale_menu(const MENU *, int *, int *);
|
| 241 |
+
extern MENU_EXPORT(int) set_current_item(MENU *menu, ITEM *item);
|
| 242 |
+
extern MENU_EXPORT(int) set_item_init(MENU *, Menu_Hook);
|
| 243 |
+
extern MENU_EXPORT(int) set_item_opts(ITEM *, Item_Options);
|
| 244 |
+
extern MENU_EXPORT(int) set_item_term(MENU *, Menu_Hook);
|
| 245 |
+
extern MENU_EXPORT(int) set_item_userptr(ITEM *, void *);
|
| 246 |
+
extern MENU_EXPORT(int) set_item_value(ITEM *, bool);
|
| 247 |
+
extern MENU_EXPORT(int) set_menu_back(MENU *, chtype);
|
| 248 |
+
extern MENU_EXPORT(int) set_menu_fore(MENU *, chtype);
|
| 249 |
+
extern MENU_EXPORT(int) set_menu_format(MENU *, int, int);
|
| 250 |
+
extern MENU_EXPORT(int) set_menu_grey(MENU *, chtype);
|
| 251 |
+
extern MENU_EXPORT(int) set_menu_init(MENU *, Menu_Hook);
|
| 252 |
+
extern MENU_EXPORT(int) set_menu_items(MENU *, ITEM **);
|
| 253 |
+
extern MENU_EXPORT(int) set_menu_mark(MENU *, const char *);
|
| 254 |
+
extern MENU_EXPORT(int) set_menu_opts(MENU *, Menu_Options);
|
| 255 |
+
extern MENU_EXPORT(int) set_menu_pad(MENU *, int);
|
| 256 |
+
extern MENU_EXPORT(int) set_menu_pattern(MENU *, const char *);
|
| 257 |
+
extern MENU_EXPORT(int) set_menu_sub(MENU *, WINDOW *);
|
| 258 |
+
extern MENU_EXPORT(int) set_menu_term(MENU *, Menu_Hook);
|
| 259 |
+
extern MENU_EXPORT(int) set_menu_userptr(MENU *, void *);
|
| 260 |
+
extern MENU_EXPORT(int) set_menu_win(MENU *, WINDOW *);
|
| 261 |
+
extern MENU_EXPORT(int) set_top_row(MENU *, int);
|
| 262 |
+
extern MENU_EXPORT(int) top_row(const MENU *);
|
| 263 |
+
extern MENU_EXPORT(int) unpost_menu(MENU *);
|
| 264 |
+
extern MENU_EXPORT(int) menu_request_by_name(const char *);
|
| 265 |
+
extern MENU_EXPORT(int) set_menu_spacing(MENU *, int, int, int);
|
| 266 |
+
extern MENU_EXPORT(int) menu_spacing(const MENU *, int *, int *, int *);
|
| 267 |
+
|
| 268 |
+
extern MENU_EXPORT(bool) item_value(const ITEM *);
|
| 269 |
+
extern MENU_EXPORT(bool) item_visible(const ITEM *);
|
| 270 |
+
|
| 271 |
+
extern MENU_EXPORT(void) menu_format(const MENU *, int *, int *);
|
| 272 |
+
|
| 273 |
+
#if NCURSES_SP_FUNCS
|
| 274 |
+
extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **);
|
| 275 |
+
#endif
|
| 276 |
+
|
| 277 |
+
#ifdef __cplusplus
|
| 278 |
+
}
|
| 279 |
+
#endif
|
| 280 |
+
|
| 281 |
+
#endif /* ETI_MENU */
|
emu3/include/ncurses/nc_tparm.h
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018,2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 2006-2012,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Thomas E. Dickey 2006 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: nc_tparm.h,v 1.11 2020/05/27 23:33:31 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef NC_TPARM_included
|
| 37 |
+
#define NC_TPARM_included 1
|
| 38 |
+
|
| 39 |
+
#include <ncurses_cfg.h>
|
| 40 |
+
#include <ncursesw/curses.h>
|
| 41 |
+
|
| 42 |
+
/*
|
| 43 |
+
* Cast parameters past the formatting-string for tparm() to match the
|
| 44 |
+
* assumption of the varargs code.
|
| 45 |
+
*/
|
| 46 |
+
#ifndef TPARM_ARG
|
| 47 |
+
#ifdef NCURSES_TPARM_ARG
|
| 48 |
+
#define TPARM_ARG NCURSES_TPARM_ARG
|
| 49 |
+
#else
|
| 50 |
+
#define TPARM_ARG long
|
| 51 |
+
#endif
|
| 52 |
+
#endif /* TPARAM_ARG */
|
| 53 |
+
|
| 54 |
+
#define TPARM_N(n) (TPARM_ARG)(n)
|
| 55 |
+
|
| 56 |
+
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
|
| 57 |
+
|
| 58 |
+
#if NCURSES_TPARM_VARARGS
|
| 59 |
+
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
|
| 60 |
+
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
|
| 61 |
+
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
|
| 62 |
+
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
|
| 63 |
+
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
|
| 64 |
+
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
|
| 65 |
+
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
|
| 66 |
+
#define TPARM_1(a,b) tparm(a,TPARM_N(b))
|
| 67 |
+
#define TPARM_0(a) tparm(a)
|
| 68 |
+
#else
|
| 69 |
+
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
|
| 70 |
+
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
|
| 71 |
+
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
|
| 72 |
+
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
|
| 73 |
+
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
|
| 74 |
+
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
|
| 75 |
+
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
|
| 76 |
+
#define TPARM_1(a,b) TPARM_2(a,b,0)
|
| 77 |
+
#define TPARM_0(a) TPARM_1(a,0)
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
#ifdef NCURSES_INTERNALS
|
| 81 |
+
#define TIPARM_1(s,a) _nc_tiparm(1,s,a)
|
| 82 |
+
#define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b)
|
| 83 |
+
#define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c)
|
| 84 |
+
#define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d)
|
| 85 |
+
#define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e)
|
| 86 |
+
#define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f)
|
| 87 |
+
#define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g)
|
| 88 |
+
#define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h)
|
| 89 |
+
#define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i)
|
| 90 |
+
#endif
|
| 91 |
+
|
| 92 |
+
#endif /* NC_TPARM_included */
|
emu3/include/ncurses/ncurses.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
emu3/include/ncurses/ncurses_dll.h
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018,2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 2009,2014 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */
|
| 30 |
+
|
| 31 |
+
#ifndef NCURSES_DLL_H_incl
|
| 32 |
+
#define NCURSES_DLL_H_incl 1
|
| 33 |
+
|
| 34 |
+
/*
|
| 35 |
+
* MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64.
|
| 36 |
+
*/
|
| 37 |
+
#if defined(__MINGW64__)
|
| 38 |
+
|
| 39 |
+
#ifndef _WIN64
|
| 40 |
+
#define _WIN64 1
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#elif defined(__MINGW32__)
|
| 44 |
+
|
| 45 |
+
#ifndef _WIN32
|
| 46 |
+
#define _WIN32 1
|
| 47 |
+
#endif
|
| 48 |
+
|
| 49 |
+
/* 2014-08-02 workaround for broken MinGW compiler.
|
| 50 |
+
* Oddly, only TRACE is mapped to trace - the other -D's are okay.
|
| 51 |
+
* suggest TDM as an alternative.
|
| 52 |
+
*/
|
| 53 |
+
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
|
| 54 |
+
|
| 55 |
+
#ifdef trace
|
| 56 |
+
#undef trace
|
| 57 |
+
#define TRACE
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#endif /* broken compiler */
|
| 61 |
+
|
| 62 |
+
#endif /* MingW */
|
| 63 |
+
|
| 64 |
+
/*
|
| 65 |
+
* For reentrant code, we map the various global variables into SCREEN by
|
| 66 |
+
* using functions to access them.
|
| 67 |
+
*/
|
| 68 |
+
#define NCURSES_PUBLIC_VAR(name) _nc_##name
|
| 69 |
+
|
| 70 |
+
#if defined(BUILDING_NCURSES)
|
| 71 |
+
# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 72 |
+
#else
|
| 73 |
+
# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 77 |
+
|
| 78 |
+
#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
|
| 79 |
+
#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
|
| 80 |
+
|
| 81 |
+
/*
|
| 82 |
+
* These symbols hide dllimport/dllexport, for compilers which care about it.
|
| 83 |
+
*/
|
| 84 |
+
#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64))
|
| 85 |
+
# if defined(NCURSES_STATIC) /* "static" here only implies "not-a-DLL" */
|
| 86 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT
|
| 87 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT
|
| 88 |
+
# else
|
| 89 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport)
|
| 90 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport)
|
| 91 |
+
# endif
|
| 92 |
+
# define NCURSES_API __cdecl
|
| 93 |
+
#else
|
| 94 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT
|
| 95 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT
|
| 96 |
+
# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */
|
| 97 |
+
#endif
|
| 98 |
+
|
| 99 |
+
#endif /* NCURSES_DLL_H_incl */
|
emu3/include/ncurses/panel.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2009,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
* and: Juergen Pfeifer 1996-1999,2008 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */
|
| 37 |
+
|
| 38 |
+
/* panel.h -- interface file for panels library */
|
| 39 |
+
|
| 40 |
+
#ifndef NCURSES_PANEL_H_incl
|
| 41 |
+
#define NCURSES_PANEL_H_incl 1
|
| 42 |
+
|
| 43 |
+
#include <ncursesw/curses.h>
|
| 44 |
+
|
| 45 |
+
typedef struct panel
|
| 46 |
+
#if !NCURSES_OPAQUE_PANEL
|
| 47 |
+
{
|
| 48 |
+
WINDOW *win;
|
| 49 |
+
struct panel *below;
|
| 50 |
+
struct panel *above;
|
| 51 |
+
NCURSES_CONST void *user;
|
| 52 |
+
}
|
| 53 |
+
#endif /* !NCURSES_OPAQUE_PANEL */
|
| 54 |
+
PANEL;
|
| 55 |
+
|
| 56 |
+
#if defined(__cplusplus)
|
| 57 |
+
extern "C" {
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if defined(BUILDING_PANEL)
|
| 61 |
+
# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 62 |
+
#else
|
| 63 |
+
# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 67 |
+
|
| 68 |
+
#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API
|
| 69 |
+
#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type
|
| 70 |
+
|
| 71 |
+
extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *);
|
| 72 |
+
extern PANEL_EXPORT(void) update_panels (void);
|
| 73 |
+
extern PANEL_EXPORT(int) hide_panel (PANEL *);
|
| 74 |
+
extern PANEL_EXPORT(int) show_panel (PANEL *);
|
| 75 |
+
extern PANEL_EXPORT(int) del_panel (PANEL *);
|
| 76 |
+
extern PANEL_EXPORT(int) top_panel (PANEL *);
|
| 77 |
+
extern PANEL_EXPORT(int) bottom_panel (PANEL *);
|
| 78 |
+
extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *);
|
| 79 |
+
extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *);
|
| 80 |
+
extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *);
|
| 81 |
+
extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *);
|
| 82 |
+
extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
|
| 83 |
+
extern PANEL_EXPORT(int) move_panel (PANEL *, int, int);
|
| 84 |
+
extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *);
|
| 85 |
+
extern PANEL_EXPORT(int) panel_hidden (const PANEL *);
|
| 86 |
+
|
| 87 |
+
#if NCURSES_SP_FUNCS
|
| 88 |
+
extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *);
|
| 89 |
+
extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *);
|
| 90 |
+
|
| 91 |
+
extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*);
|
| 92 |
+
#endif
|
| 93 |
+
|
| 94 |
+
#if defined(__cplusplus)
|
| 95 |
+
}
|
| 96 |
+
#endif
|
| 97 |
+
|
| 98 |
+
#endif /* NCURSES_PANEL_H_incl */
|
| 99 |
+
|
| 100 |
+
/* end of panel.h */
|
emu3/include/ncursesw/curses.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
emu3/include/ncursesw/cursesapp.h
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
/****************************************************************************
|
| 3 |
+
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
| 4 |
+
* Copyright 1998-2005,2011 Free Software Foundation, Inc. *
|
| 5 |
+
* *
|
| 6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 7 |
+
* copy of this software and associated documentation files (the *
|
| 8 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 9 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 10 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 11 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 12 |
+
* furnished to do so, subject to the following conditions: *
|
| 13 |
+
* *
|
| 14 |
+
* The above copyright notice and this permission notice shall be included *
|
| 15 |
+
* in all copies or substantial portions of the Software. *
|
| 16 |
+
* *
|
| 17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 18 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 19 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 20 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 21 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 22 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 23 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 24 |
+
* *
|
| 25 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 26 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 27 |
+
* sale, use or other dealings in this Software without prior written *
|
| 28 |
+
* authorization. *
|
| 29 |
+
****************************************************************************/
|
| 30 |
+
|
| 31 |
+
/****************************************************************************
|
| 32 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
// $Id: cursesapp.h,v 1.18 2021/06/17 21:26:02 tom Exp $
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_CURSESAPP_H_incl
|
| 38 |
+
#define NCURSES_CURSESAPP_H_incl
|
| 39 |
+
|
| 40 |
+
#include <ncursesw/cursslk.h>
|
| 41 |
+
|
| 42 |
+
#if (defined(_WIN32) || defined(_WIN64))
|
| 43 |
+
# define NCURSES_CXX_MAIN_NAME cursespp_main
|
| 44 |
+
# define NCURSES_CXX_MAIN \
|
| 45 |
+
int main(int argc, char *argv[]) { \
|
| 46 |
+
return NCURSES_CXX_MAIN_NAME(argc, argv); \
|
| 47 |
+
}
|
| 48 |
+
#else
|
| 49 |
+
# define NCURSES_CXX_MAIN_NAME main
|
| 50 |
+
#endif
|
| 51 |
+
NCURSES_CXX_IMPEXP int NCURSES_CXX_MAIN_NAME(int argc, char *argv[]);
|
| 52 |
+
|
| 53 |
+
class NCURSES_CXX_IMPEXP NCursesApplication {
|
| 54 |
+
public:
|
| 55 |
+
typedef struct _slk_link { // This structure is used to maintain
|
| 56 |
+
struct _slk_link* prev; // a stack of SLKs
|
| 57 |
+
Soft_Label_Key_Set* SLKs;
|
| 58 |
+
} SLK_Link;
|
| 59 |
+
private:
|
| 60 |
+
static int rinit(NCursesWindow& w); // Internal Init function for title
|
| 61 |
+
static NCursesApplication* theApp; // Global ref. to the application
|
| 62 |
+
|
| 63 |
+
static SLK_Link* slk_stack;
|
| 64 |
+
|
| 65 |
+
protected:
|
| 66 |
+
static NCursesWindow* titleWindow; // The Title Window (if any)
|
| 67 |
+
|
| 68 |
+
bool b_Colors; // Is this a color application?
|
| 69 |
+
NCursesWindow* Root_Window; // This is the stdscr equiv.
|
| 70 |
+
|
| 71 |
+
// Initialization of attributes;
|
| 72 |
+
// Rewrite this in your derived class if you prefer other settings
|
| 73 |
+
virtual void init(bool bColors);
|
| 74 |
+
|
| 75 |
+
// The number of lines for the title window. Default is no title window
|
| 76 |
+
// You may rewrite this in your derived class
|
| 77 |
+
virtual int titlesize() const {
|
| 78 |
+
return 0;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// This method is called to put something into the title window initially
|
| 82 |
+
// You may rewrite this in your derived class
|
| 83 |
+
virtual void title() {
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
// The layout used for the Soft Label Keys. Default is to have no SLKs.
|
| 87 |
+
// You may rewrite this in your derived class
|
| 88 |
+
virtual Soft_Label_Key_Set::Label_Layout useSLKs() const {
|
| 89 |
+
return Soft_Label_Key_Set::None;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
// This method is called to initialize the SLKs. Default is nothing.
|
| 93 |
+
// You may rewrite this in your derived class
|
| 94 |
+
virtual void init_labels(Soft_Label_Key_Set& S) const {
|
| 95 |
+
(void) S;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
// Your derived class must implement this method. The return value must
|
| 99 |
+
// be the exit value of your application.
|
| 100 |
+
virtual int run() = 0;
|
| 101 |
+
|
| 102 |
+
// The constructor is protected, so you may use it in your derived
|
| 103 |
+
// class constructor. The argument tells whether or not you want colors.
|
| 104 |
+
NCursesApplication(bool wantColors = FALSE);
|
| 105 |
+
|
| 106 |
+
NCursesApplication& operator=(const NCursesApplication& rhs)
|
| 107 |
+
{
|
| 108 |
+
if (this != &rhs) {
|
| 109 |
+
*this = rhs;
|
| 110 |
+
}
|
| 111 |
+
return *this;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
NCursesApplication(const NCursesApplication& rhs)
|
| 115 |
+
: b_Colors(rhs.b_Colors),
|
| 116 |
+
Root_Window(rhs.Root_Window)
|
| 117 |
+
{
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
static NCursesWindow *&getTitleWindow();
|
| 121 |
+
|
| 122 |
+
public:
|
| 123 |
+
virtual ~NCursesApplication() THROWS(NCursesException);
|
| 124 |
+
|
| 125 |
+
// Get a pointer to the current application object
|
| 126 |
+
static NCursesApplication* getApplication();
|
| 127 |
+
|
| 128 |
+
// This method runs the application and returns its exit value
|
| 129 |
+
int operator()(void);
|
| 130 |
+
|
| 131 |
+
// Process the commandline arguments. The default implementation simply
|
| 132 |
+
// ignores them. Your derived class may rewrite this.
|
| 133 |
+
virtual void handleArgs(int argc, char* argv[]) {
|
| 134 |
+
(void) argc;
|
| 135 |
+
(void) argv;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// Does this application use colors?
|
| 139 |
+
inline bool useColors() const {
|
| 140 |
+
return b_Colors;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
// Push the Key Set S onto the SLK Stack. S then becomes the current set
|
| 144 |
+
// of Soft Labelled Keys.
|
| 145 |
+
void push(Soft_Label_Key_Set& S);
|
| 146 |
+
|
| 147 |
+
// Throw away the current set of SLKs and make the previous one the
|
| 148 |
+
// new current set.
|
| 149 |
+
bool pop();
|
| 150 |
+
|
| 151 |
+
// Retrieve the current set of Soft Labelled Keys.
|
| 152 |
+
Soft_Label_Key_Set* top() const;
|
| 153 |
+
|
| 154 |
+
// Attributes to use for menu and forms foregrounds
|
| 155 |
+
virtual chtype foregrounds() const {
|
| 156 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
// Attributes to use for menu and forms backgrounds
|
| 160 |
+
virtual chtype backgrounds() const {
|
| 161 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
// Attributes to use for inactive (menu) elements
|
| 165 |
+
virtual chtype inactives() const {
|
| 166 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
// Attributes to use for (form) labels and SLKs
|
| 170 |
+
virtual chtype labels() const {
|
| 171 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// Attributes to use for form backgrounds
|
| 175 |
+
virtual chtype dialog_backgrounds() const {
|
| 176 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
// Attributes to use as default for (form) window backgrounds
|
| 180 |
+
virtual chtype window_backgrounds() const {
|
| 181 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
// Attributes to use for the title window
|
| 185 |
+
virtual chtype screen_titles() const {
|
| 186 |
+
return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
};
|
| 190 |
+
|
| 191 |
+
#endif /* NCURSES_CURSESAPP_H_incl */
|
emu3/include/ncursesw/cursesf.h
ADDED
|
@@ -0,0 +1,968 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
// vile:cppmode
|
| 3 |
+
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
/****************************************************************************
|
| 33 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
// $Id: cursesf.h,v 1.39 2022/08/20 20:52:15 tom Exp $
|
| 37 |
+
|
| 38 |
+
#ifndef NCURSES_CURSESF_H_incl
|
| 39 |
+
#define NCURSES_CURSESF_H_incl 1
|
| 40 |
+
|
| 41 |
+
#include <ncursesw/cursesp.h>
|
| 42 |
+
|
| 43 |
+
#ifndef __EXT_QNX
|
| 44 |
+
#include <string.h>
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
extern "C" {
|
| 48 |
+
# include <ncursesw/form.h>
|
| 49 |
+
}
|
| 50 |
+
//
|
| 51 |
+
// -------------------------------------------------------------------------
|
| 52 |
+
// The abstract base class for builtin and user defined Fieldtypes.
|
| 53 |
+
// -------------------------------------------------------------------------
|
| 54 |
+
//
|
| 55 |
+
class NCURSES_CXX_IMPEXP NCursesFormField; // forward declaration
|
| 56 |
+
|
| 57 |
+
// Class to represent builtin field types as well as C++ written new
|
| 58 |
+
// fieldtypes (see classes UserDefineFieldType...
|
| 59 |
+
class NCURSES_CXX_IMPEXP NCursesFieldType
|
| 60 |
+
{
|
| 61 |
+
friend class NCursesFormField;
|
| 62 |
+
|
| 63 |
+
protected:
|
| 64 |
+
FIELDTYPE* fieldtype;
|
| 65 |
+
|
| 66 |
+
inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) {
|
| 67 |
+
if (err!=E_OK)
|
| 68 |
+
THROW(new NCursesFormException (err));
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
NCursesFieldType(FIELDTYPE *f) : fieldtype(f) {
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
virtual ~NCursesFieldType() {}
|
| 75 |
+
|
| 76 |
+
// Set the fields f fieldtype to this one.
|
| 77 |
+
virtual void set(NCursesFormField& f) = 0;
|
| 78 |
+
|
| 79 |
+
public:
|
| 80 |
+
NCursesFieldType()
|
| 81 |
+
: fieldtype(STATIC_CAST(FIELDTYPE*)(0))
|
| 82 |
+
{
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
NCursesFieldType& operator=(const NCursesFieldType& rhs)
|
| 86 |
+
{
|
| 87 |
+
if (this != &rhs) {
|
| 88 |
+
*this = rhs;
|
| 89 |
+
}
|
| 90 |
+
return *this;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
NCursesFieldType(const NCursesFieldType& rhs)
|
| 94 |
+
: fieldtype(rhs.fieldtype)
|
| 95 |
+
{
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
//
|
| 101 |
+
// -------------------------------------------------------------------------
|
| 102 |
+
// The class representing a forms field, wrapping the lowlevel FIELD struct
|
| 103 |
+
// -------------------------------------------------------------------------
|
| 104 |
+
//
|
| 105 |
+
class NCURSES_CXX_IMPEXP NCursesFormField
|
| 106 |
+
{
|
| 107 |
+
friend class NCursesForm;
|
| 108 |
+
|
| 109 |
+
protected:
|
| 110 |
+
FIELD *field; // lowlevel structure
|
| 111 |
+
NCursesFieldType* ftype; // Associated field type
|
| 112 |
+
|
| 113 |
+
// Error handler
|
| 114 |
+
inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
|
| 115 |
+
if (err != E_OK)
|
| 116 |
+
THROW(new NCursesFormException (err));
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
public:
|
| 120 |
+
// Create a 'Null' field. Can be used to delimit a field list
|
| 121 |
+
NCursesFormField()
|
| 122 |
+
: field(STATIC_CAST(FIELD*)(0)),
|
| 123 |
+
ftype(STATIC_CAST(NCursesFieldType*)(0))
|
| 124 |
+
{
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
// Create a new field
|
| 128 |
+
NCursesFormField (int rows,
|
| 129 |
+
int ncols,
|
| 130 |
+
int first_row = 0,
|
| 131 |
+
int first_col = 0,
|
| 132 |
+
int offscreen_rows = 0,
|
| 133 |
+
int additional_buffers = 0)
|
| 134 |
+
: field(0),
|
| 135 |
+
ftype(STATIC_CAST(NCursesFieldType*)(0))
|
| 136 |
+
{
|
| 137 |
+
field = ::new_field(rows, ncols, first_row, first_col,
|
| 138 |
+
offscreen_rows, additional_buffers);
|
| 139 |
+
if (!field)
|
| 140 |
+
OnError(errno);
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
NCursesFormField& operator=(const NCursesFormField& rhs)
|
| 144 |
+
{
|
| 145 |
+
if (this != &rhs) {
|
| 146 |
+
*this = rhs;
|
| 147 |
+
}
|
| 148 |
+
return *this;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
NCursesFormField(const NCursesFormField& rhs)
|
| 152 |
+
: field(rhs.field), ftype(rhs.ftype)
|
| 153 |
+
{
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
virtual ~NCursesFormField () THROWS(NCursesException);
|
| 157 |
+
|
| 158 |
+
// Duplicate the field at a new position
|
| 159 |
+
inline NCursesFormField* dup(int first_row, int first_col)
|
| 160 |
+
{
|
| 161 |
+
NCursesFormField* f = new NCursesFormField();
|
| 162 |
+
if (!f)
|
| 163 |
+
OnError(E_SYSTEM_ERROR);
|
| 164 |
+
else {
|
| 165 |
+
f->ftype = ftype;
|
| 166 |
+
f->field = ::dup_field(field,first_row,first_col);
|
| 167 |
+
if (!f->field)
|
| 168 |
+
OnError(errno);
|
| 169 |
+
}
|
| 170 |
+
return f;
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
// Link the field to a new location
|
| 174 |
+
inline NCursesFormField* link(int first_row, int first_col) {
|
| 175 |
+
NCursesFormField* f = new NCursesFormField();
|
| 176 |
+
if (!f)
|
| 177 |
+
OnError(E_SYSTEM_ERROR);
|
| 178 |
+
else {
|
| 179 |
+
f->ftype = ftype;
|
| 180 |
+
f->field = ::link_field(field,first_row,first_col);
|
| 181 |
+
if (!f->field)
|
| 182 |
+
OnError(errno);
|
| 183 |
+
}
|
| 184 |
+
return f;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// Get the lowlevel field representation
|
| 188 |
+
inline FIELD* get_field() const {
|
| 189 |
+
return field;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
// Retrieve info about the field
|
| 193 |
+
inline void info(int& rows, int& ncols,
|
| 194 |
+
int& first_row, int& first_col,
|
| 195 |
+
int& offscreen_rows, int& additional_buffers) const {
|
| 196 |
+
OnError(::field_info(field, &rows, &ncols,
|
| 197 |
+
&first_row, &first_col,
|
| 198 |
+
&offscreen_rows, &additional_buffers));
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
// Retrieve info about the fields dynamic properties.
|
| 202 |
+
inline void dynamic_info(int& dynamic_rows, int& dynamic_cols,
|
| 203 |
+
int& max_growth) const {
|
| 204 |
+
OnError(::dynamic_field_info(field, &dynamic_rows, &dynamic_cols,
|
| 205 |
+
&max_growth));
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// For a dynamic field you may set the maximum growth limit.
|
| 209 |
+
// A zero means unlimited growth.
|
| 210 |
+
inline void set_maximum_growth(int growth = 0) {
|
| 211 |
+
OnError(::set_max_field(field,growth));
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// Move the field to a new position
|
| 215 |
+
inline void move(int row, int col) {
|
| 216 |
+
OnError(::move_field(field,row,col));
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
// Mark the field to start a new page
|
| 220 |
+
inline void new_page(bool pageFlag = FALSE) {
|
| 221 |
+
OnError(::set_new_page(field,pageFlag));
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
// Retrieve whether or not the field starts a new page.
|
| 225 |
+
inline bool is_new_page() const {
|
| 226 |
+
return ::new_page(field);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
// Set the justification for the field
|
| 230 |
+
inline void set_justification(int just) {
|
| 231 |
+
OnError(::set_field_just(field,just));
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
// Retrieve the fields justification
|
| 235 |
+
inline int justification() const {
|
| 236 |
+
return ::field_just(field);
|
| 237 |
+
}
|
| 238 |
+
// Set the foreground attribute for the field
|
| 239 |
+
inline void set_foreground(chtype foreground) {
|
| 240 |
+
OnError(::set_field_fore(field,foreground));
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
// Retrieve the fields foreground attribute
|
| 244 |
+
inline chtype fore() const {
|
| 245 |
+
return ::field_fore(field);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
// Set the background attribute for the field
|
| 249 |
+
inline void set_background(chtype background) {
|
| 250 |
+
OnError(::set_field_back(field,background));
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
// Retrieve the fields background attribute
|
| 254 |
+
inline chtype back() const {
|
| 255 |
+
return ::field_back(field);
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
// Set the padding character for the field
|
| 259 |
+
inline void set_pad_character(int padding) {
|
| 260 |
+
OnError(::set_field_pad(field, padding));
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// Retrieve the fields padding character
|
| 264 |
+
inline int pad() const {
|
| 265 |
+
return ::field_pad(field);
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
// Switch on the fields options
|
| 269 |
+
inline void options_on (Field_Options opts) {
|
| 270 |
+
OnError (::field_opts_on (field, opts));
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
// Switch off the fields options
|
| 274 |
+
inline void options_off (Field_Options opts) {
|
| 275 |
+
OnError (::field_opts_off (field, opts));
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
// Retrieve the fields options
|
| 279 |
+
inline Field_Options options () const {
|
| 280 |
+
return ::field_opts (field);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
// Set the fields options
|
| 284 |
+
inline void set_options (Field_Options opts) {
|
| 285 |
+
OnError (::set_field_opts (field, opts));
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
// Mark the field as changed
|
| 289 |
+
inline void set_changed(bool changeFlag = TRUE) {
|
| 290 |
+
OnError(::set_field_status(field,changeFlag));
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// Test whether or not the field is marked as changed
|
| 294 |
+
inline bool changed() const {
|
| 295 |
+
return ::field_status(field);
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
// Return the index of the field in the field array of a form
|
| 299 |
+
// or -1 if the field is not associated to a form
|
| 300 |
+
inline int (index)() const {
|
| 301 |
+
return ::field_index(field);
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
// Store a value in a fields buffer. The default buffer is nr. 0
|
| 305 |
+
inline void set_value(const char *val, int buffer = 0) {
|
| 306 |
+
OnError(::set_field_buffer(field,buffer,val));
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
// Retrieve the value of a fields buffer. The default buffer is nr. 0
|
| 310 |
+
inline char* value(int buffer = 0) const {
|
| 311 |
+
return ::field_buffer(field,buffer);
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
// Set the validation type of the field.
|
| 315 |
+
inline void set_fieldtype(NCursesFieldType& f) {
|
| 316 |
+
ftype = &f;
|
| 317 |
+
f.set(*this); // A good friend may do that...
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
// Retrieve the validation type of the field.
|
| 321 |
+
inline NCursesFieldType* fieldtype() const {
|
| 322 |
+
return ftype;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
};
|
| 326 |
+
|
| 327 |
+
// This are the built-in hook functions in this C++ binding. In C++ we use
|
| 328 |
+
// virtual member functions (see below On_..._Init and On_..._Termination)
|
| 329 |
+
// to provide this functionality in an object oriented manner.
|
| 330 |
+
extern "C" {
|
| 331 |
+
void _nc_xx_frm_init(FORM *);
|
| 332 |
+
void _nc_xx_frm_term(FORM *);
|
| 333 |
+
void _nc_xx_fld_init(FORM *);
|
| 334 |
+
void _nc_xx_fld_term(FORM *);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
//
|
| 338 |
+
// -------------------------------------------------------------------------
|
| 339 |
+
// The class representing a form, wrapping the lowlevel FORM struct
|
| 340 |
+
// -------------------------------------------------------------------------
|
| 341 |
+
//
|
| 342 |
+
class NCURSES_CXX_IMPEXP NCursesForm : public NCursesPanel
|
| 343 |
+
{
|
| 344 |
+
protected:
|
| 345 |
+
FORM* form; // the lowlevel structure
|
| 346 |
+
|
| 347 |
+
private:
|
| 348 |
+
NCursesWindow* sub; // the subwindow object
|
| 349 |
+
bool b_sub_owner; // is this our own subwindow?
|
| 350 |
+
bool b_framed; // has the form a border?
|
| 351 |
+
bool b_autoDelete; // Delete fields when deleting form?
|
| 352 |
+
|
| 353 |
+
NCursesFormField** my_fields; // The array of fields for this form
|
| 354 |
+
|
| 355 |
+
// This structure is used for the form's user data field to link the
|
| 356 |
+
// FORM* to the C++ object and to provide extra space for a user pointer.
|
| 357 |
+
typedef struct {
|
| 358 |
+
void* m_user; // the pointer for the user's data
|
| 359 |
+
const NCursesForm* m_back; // backward pointer to C++ object
|
| 360 |
+
const FORM* m_owner;
|
| 361 |
+
} UserHook;
|
| 362 |
+
|
| 363 |
+
// Get the backward pointer to the C++ object from a FORM
|
| 364 |
+
static inline NCursesForm* getHook(const FORM *f) {
|
| 365 |
+
UserHook* hook = reinterpret_cast<UserHook*>(::form_userptr(f));
|
| 366 |
+
assert(hook != 0 && hook->m_owner==f);
|
| 367 |
+
return const_cast<NCursesForm*>(hook->m_back);
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
friend void _nc_xx_frm_init(FORM *);
|
| 371 |
+
friend void _nc_xx_frm_term(FORM *);
|
| 372 |
+
friend void _nc_xx_fld_init(FORM *);
|
| 373 |
+
friend void _nc_xx_fld_term(FORM *);
|
| 374 |
+
|
| 375 |
+
// Calculate FIELD* array for the menu
|
| 376 |
+
FIELD** mapFields(NCursesFormField* nfields[]);
|
| 377 |
+
|
| 378 |
+
protected:
|
| 379 |
+
// internal routines
|
| 380 |
+
inline void set_user(void *user) {
|
| 381 |
+
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form));
|
| 382 |
+
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form);
|
| 383 |
+
uptr->m_user = user;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
inline void *get_user() {
|
| 387 |
+
UserHook* uptr = reinterpret_cast<UserHook*>(::form_userptr (form));
|
| 388 |
+
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form);
|
| 389 |
+
return uptr->m_user;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
void InitForm (NCursesFormField* Fields[],
|
| 393 |
+
bool with_frame,
|
| 394 |
+
bool autoDeleteFields);
|
| 395 |
+
|
| 396 |
+
inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
|
| 397 |
+
if (err != E_OK)
|
| 398 |
+
THROW(new NCursesFormException (err));
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
// this wraps the form_driver call.
|
| 402 |
+
virtual int driver (int c) ;
|
| 403 |
+
|
| 404 |
+
// 'Internal' constructor, builds an object without association to a
|
| 405 |
+
// field array.
|
| 406 |
+
NCursesForm( int nlines,
|
| 407 |
+
int ncols,
|
| 408 |
+
int begin_y = 0,
|
| 409 |
+
int begin_x = 0)
|
| 410 |
+
: NCursesPanel(nlines, ncols, begin_y, begin_x),
|
| 411 |
+
form (STATIC_CAST(FORM*)(0)),
|
| 412 |
+
sub(0),
|
| 413 |
+
b_sub_owner(0),
|
| 414 |
+
b_framed(0),
|
| 415 |
+
b_autoDelete(0),
|
| 416 |
+
my_fields(0)
|
| 417 |
+
{
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
public:
|
| 421 |
+
// Create form for the default panel.
|
| 422 |
+
NCursesForm (NCursesFormField* Fields[],
|
| 423 |
+
bool with_frame=FALSE, // reserve space for a frame?
|
| 424 |
+
bool autoDelete_Fields=FALSE) // do automatic cleanup?
|
| 425 |
+
: NCursesPanel(),
|
| 426 |
+
form(0),
|
| 427 |
+
sub(0),
|
| 428 |
+
b_sub_owner(0),
|
| 429 |
+
b_framed(0),
|
| 430 |
+
b_autoDelete(0),
|
| 431 |
+
my_fields(0)
|
| 432 |
+
{
|
| 433 |
+
InitForm(Fields, with_frame, autoDelete_Fields);
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
// Create a form in a panel with the given position and size.
|
| 437 |
+
NCursesForm (NCursesFormField* Fields[],
|
| 438 |
+
int nlines,
|
| 439 |
+
int ncols,
|
| 440 |
+
int begin_y,
|
| 441 |
+
int begin_x,
|
| 442 |
+
bool with_frame=FALSE, // reserve space for a frame?
|
| 443 |
+
bool autoDelete_Fields=FALSE) // do automatic cleanup?
|
| 444 |
+
: NCursesPanel(nlines, ncols, begin_y, begin_x),
|
| 445 |
+
form(0),
|
| 446 |
+
sub(0),
|
| 447 |
+
b_sub_owner(0),
|
| 448 |
+
b_framed(0),
|
| 449 |
+
b_autoDelete(0),
|
| 450 |
+
my_fields(0)
|
| 451 |
+
{
|
| 452 |
+
InitForm(Fields, with_frame, autoDelete_Fields);
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
NCursesForm& operator=(const NCursesForm& rhs)
|
| 456 |
+
{
|
| 457 |
+
if (this != &rhs) {
|
| 458 |
+
*this = rhs;
|
| 459 |
+
NCursesPanel::operator=(rhs);
|
| 460 |
+
}
|
| 461 |
+
return *this;
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
NCursesForm(const NCursesForm& rhs)
|
| 465 |
+
: NCursesPanel(rhs),
|
| 466 |
+
form(rhs.form),
|
| 467 |
+
sub(rhs.sub),
|
| 468 |
+
b_sub_owner(rhs.b_sub_owner),
|
| 469 |
+
b_framed(rhs.b_framed),
|
| 470 |
+
b_autoDelete(rhs.b_autoDelete),
|
| 471 |
+
my_fields(rhs.my_fields)
|
| 472 |
+
{
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
virtual ~NCursesForm() THROWS(NCursesException);
|
| 476 |
+
|
| 477 |
+
// Set the default attributes for the form
|
| 478 |
+
virtual void setDefaultAttributes();
|
| 479 |
+
|
| 480 |
+
// Retrieve current field of the form.
|
| 481 |
+
inline NCursesFormField* current_field() const {
|
| 482 |
+
return my_fields[::field_index(::current_field(form))];
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
// Set the forms subwindow
|
| 486 |
+
void setSubWindow(NCursesWindow& sub);
|
| 487 |
+
|
| 488 |
+
// Set these fields for the form
|
| 489 |
+
inline void setFields(NCursesFormField* Fields[]) {
|
| 490 |
+
OnError(::set_form_fields(form,mapFields(Fields)));
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
// Remove the form from the screen
|
| 494 |
+
inline void unpost (void) {
|
| 495 |
+
OnError (::unpost_form (form));
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
// Post the form to the screen if flag is true, unpost it otherwise
|
| 499 |
+
inline void post(bool flag = TRUE) {
|
| 500 |
+
OnError (flag ? ::post_form(form) : ::unpost_form (form));
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
// Decorations
|
| 504 |
+
inline void frame(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
|
| 505 |
+
if (b_framed)
|
| 506 |
+
NCursesPanel::frame(title,btitle);
|
| 507 |
+
else
|
| 508 |
+
OnError(E_SYSTEM_ERROR);
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
inline void boldframe(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
|
| 512 |
+
if (b_framed)
|
| 513 |
+
NCursesPanel::boldframe(title,btitle);
|
| 514 |
+
else
|
| 515 |
+
OnError(E_SYSTEM_ERROR);
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
inline void label(const char *topLabel, const char *bottomLabel) NCURSES_OVERRIDE {
|
| 519 |
+
if (b_framed)
|
| 520 |
+
NCursesPanel::label(topLabel,bottomLabel);
|
| 521 |
+
else
|
| 522 |
+
OnError(E_SYSTEM_ERROR);
|
| 523 |
+
}
|
| 524 |
+
|
| 525 |
+
// -----
|
| 526 |
+
// Hooks
|
| 527 |
+
// -----
|
| 528 |
+
|
| 529 |
+
// Called after the form gets repositioned in its window.
|
| 530 |
+
// This is especially true if the form is posted.
|
| 531 |
+
virtual void On_Form_Init();
|
| 532 |
+
|
| 533 |
+
// Called before the form gets repositioned in its window.
|
| 534 |
+
// This is especially true if the form is unposted.
|
| 535 |
+
virtual void On_Form_Termination();
|
| 536 |
+
|
| 537 |
+
// Called after the field became the current field
|
| 538 |
+
virtual void On_Field_Init(NCursesFormField& field);
|
| 539 |
+
|
| 540 |
+
// Called before this field is left as current field.
|
| 541 |
+
virtual void On_Field_Termination(NCursesFormField& field);
|
| 542 |
+
|
| 543 |
+
// Calculate required window size for the form.
|
| 544 |
+
void scale(int& rows, int& ncols) const {
|
| 545 |
+
OnError(::scale_form(form,&rows,&ncols));
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
// Retrieve number of fields in the form.
|
| 549 |
+
int count() const {
|
| 550 |
+
return ::field_count(form);
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
// Make the page the current page of the form.
|
| 554 |
+
void set_page(int pageNum) {
|
| 555 |
+
OnError(::set_form_page(form, pageNum));
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
// Retrieve current page number
|
| 559 |
+
int page() const {
|
| 560 |
+
return ::form_page(form);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
// Switch on the forms options
|
| 564 |
+
inline void options_on (Form_Options opts) {
|
| 565 |
+
OnError (::form_opts_on (form, opts));
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
// Switch off the forms options
|
| 569 |
+
inline void options_off (Form_Options opts) {
|
| 570 |
+
OnError (::form_opts_off (form, opts));
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
// Retrieve the forms options
|
| 574 |
+
inline Form_Options options () const {
|
| 575 |
+
return ::form_opts (form);
|
| 576 |
+
}
|
| 577 |
+
|
| 578 |
+
// Set the forms options
|
| 579 |
+
inline void set_options (Form_Options opts) {
|
| 580 |
+
OnError (::set_form_opts (form, opts));
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
// Are there more data in the current field after the data shown
|
| 584 |
+
inline bool data_ahead() const {
|
| 585 |
+
return ::data_ahead(form);
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
// Are there more data in the current field before the data shown
|
| 589 |
+
inline bool data_behind() const {
|
| 590 |
+
return ::data_behind(form);
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
// Position the cursor to the current field
|
| 594 |
+
inline void position_cursor () {
|
| 595 |
+
OnError (::pos_form_cursor (form));
|
| 596 |
+
}
|
| 597 |
+
// Set the current field
|
| 598 |
+
inline void set_current(NCursesFormField& F) {
|
| 599 |
+
OnError (::set_current_field(form, F.field));
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
// Provide a default key virtualization. Translate the keyboard
|
| 603 |
+
// code c into a form request code.
|
| 604 |
+
// The default implementation provides a hopefully straightforward
|
| 605 |
+
// mapping for the most common keystrokes and form requests.
|
| 606 |
+
virtual int virtualize(int c);
|
| 607 |
+
|
| 608 |
+
// Operators
|
| 609 |
+
inline NCursesFormField* operator[](int i) const {
|
| 610 |
+
if ( (i < 0) || (i >= ::field_count (form)) )
|
| 611 |
+
OnError (E_BAD_ARGUMENT);
|
| 612 |
+
return my_fields[i];
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
// Perform the menu's operation
|
| 616 |
+
// Return the field where you left the form.
|
| 617 |
+
virtual NCursesFormField* operator()(void);
|
| 618 |
+
|
| 619 |
+
// Exception handlers. The default is a Beep.
|
| 620 |
+
virtual void On_Request_Denied(int c) const;
|
| 621 |
+
virtual void On_Invalid_Field(int c) const;
|
| 622 |
+
virtual void On_Unknown_Command(int c) const;
|
| 623 |
+
|
| 624 |
+
};
|
| 625 |
+
|
| 626 |
+
//
|
| 627 |
+
// -------------------------------------------------------------------------
|
| 628 |
+
// This is the typical C++ typesafe way to allow to attach
|
| 629 |
+
// user data to a field of a form. Its assumed that the user
|
| 630 |
+
// data belongs to some class T. Use T as template argument
|
| 631 |
+
// to create a UserField.
|
| 632 |
+
// -------------------------------------------------------------------------
|
| 633 |
+
template<class T> class NCURSES_CXX_IMPEXP NCursesUserField : public NCursesFormField
|
| 634 |
+
{
|
| 635 |
+
public:
|
| 636 |
+
NCursesUserField (int rows,
|
| 637 |
+
int ncols,
|
| 638 |
+
int first_row = 0,
|
| 639 |
+
int first_col = 0,
|
| 640 |
+
const T* p_UserData = STATIC_CAST(T*)(0),
|
| 641 |
+
int offscreen_rows = 0,
|
| 642 |
+
int additional_buffers = 0)
|
| 643 |
+
: NCursesFormField (rows, ncols,
|
| 644 |
+
first_row, first_col,
|
| 645 |
+
offscreen_rows, additional_buffers) {
|
| 646 |
+
if (field)
|
| 647 |
+
OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData)));
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
virtual ~NCursesUserField() THROWS(NCursesException) {};
|
| 651 |
+
|
| 652 |
+
inline const T* UserData (void) const {
|
| 653 |
+
return reinterpret_cast<const T*>(::field_userptr (field));
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
inline virtual void setUserData(const T* p_UserData) {
|
| 657 |
+
if (field)
|
| 658 |
+
OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData)));
|
| 659 |
+
}
|
| 660 |
+
};
|
| 661 |
+
//
|
| 662 |
+
// -------------------------------------------------------------------------
|
| 663 |
+
// The same mechanism is used to attach user data to a form
|
| 664 |
+
// -------------------------------------------------------------------------
|
| 665 |
+
//
|
| 666 |
+
template<class T> class NCURSES_CXX_IMPEXP NCursesUserForm : public NCursesForm
|
| 667 |
+
{
|
| 668 |
+
protected:
|
| 669 |
+
// 'Internal' constructor, builds an object without association to a
|
| 670 |
+
// field array.
|
| 671 |
+
NCursesUserForm( int nlines,
|
| 672 |
+
int ncols,
|
| 673 |
+
int begin_y = 0,
|
| 674 |
+
int begin_x = 0,
|
| 675 |
+
const T* p_UserData = STATIC_CAST(T*)(0))
|
| 676 |
+
: NCursesForm(nlines,ncols,begin_y,begin_x) {
|
| 677 |
+
if (form)
|
| 678 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>
|
| 679 |
+
(p_UserData)));
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
public:
|
| 683 |
+
NCursesUserForm (NCursesFormField* Fields[],
|
| 684 |
+
const T* p_UserData = STATIC_CAST(T*)(0),
|
| 685 |
+
bool with_frame=FALSE,
|
| 686 |
+
bool autoDelete_Fields=FALSE)
|
| 687 |
+
: NCursesForm (&Fields, with_frame, autoDelete_Fields) {
|
| 688 |
+
if (form)
|
| 689 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 690 |
+
};
|
| 691 |
+
|
| 692 |
+
NCursesUserForm (NCursesFormField* Fields[],
|
| 693 |
+
int nlines,
|
| 694 |
+
int ncols,
|
| 695 |
+
int begin_y = 0,
|
| 696 |
+
int begin_x = 0,
|
| 697 |
+
const T* p_UserData = STATIC_CAST(T*)(0),
|
| 698 |
+
bool with_frame=FALSE,
|
| 699 |
+
bool autoDelete_Fields=FALSE)
|
| 700 |
+
: NCursesForm (&Fields, nlines, ncols, begin_y, begin_x,
|
| 701 |
+
with_frame, autoDelete_Fields) {
|
| 702 |
+
if (form)
|
| 703 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>
|
| 704 |
+
(p_UserData)));
|
| 705 |
+
};
|
| 706 |
+
|
| 707 |
+
virtual ~NCursesUserForm() THROWS(NCursesException) {
|
| 708 |
+
};
|
| 709 |
+
|
| 710 |
+
inline T* UserData (void) {
|
| 711 |
+
return reinterpret_cast<T*>(get_user ());
|
| 712 |
+
};
|
| 713 |
+
|
| 714 |
+
inline virtual void setUserData (const T* p_UserData) {
|
| 715 |
+
if (form)
|
| 716 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
};
|
| 720 |
+
//
|
| 721 |
+
// -------------------------------------------------------------------------
|
| 722 |
+
// Builtin Fieldtypes
|
| 723 |
+
// -------------------------------------------------------------------------
|
| 724 |
+
//
|
| 725 |
+
class NCURSES_CXX_IMPEXP Alpha_Field : public NCursesFieldType
|
| 726 |
+
{
|
| 727 |
+
private:
|
| 728 |
+
int min_field_width;
|
| 729 |
+
|
| 730 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 731 |
+
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
public:
|
| 735 |
+
explicit Alpha_Field(int width)
|
| 736 |
+
: NCursesFieldType(TYPE_ALPHA),
|
| 737 |
+
min_field_width(width) {
|
| 738 |
+
}
|
| 739 |
+
};
|
| 740 |
+
|
| 741 |
+
class NCURSES_CXX_IMPEXP Alphanumeric_Field : public NCursesFieldType
|
| 742 |
+
{
|
| 743 |
+
private:
|
| 744 |
+
int min_field_width;
|
| 745 |
+
|
| 746 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 747 |
+
OnError(::set_field_type(f.get_field(),fieldtype,min_field_width));
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
public:
|
| 751 |
+
explicit Alphanumeric_Field(int width)
|
| 752 |
+
: NCursesFieldType(TYPE_ALNUM),
|
| 753 |
+
min_field_width(width) {
|
| 754 |
+
}
|
| 755 |
+
};
|
| 756 |
+
|
| 757 |
+
class NCURSES_CXX_IMPEXP Integer_Field : public NCursesFieldType
|
| 758 |
+
{
|
| 759 |
+
private:
|
| 760 |
+
int precision;
|
| 761 |
+
long lower_limit, upper_limit;
|
| 762 |
+
|
| 763 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 764 |
+
OnError(::set_field_type(f.get_field(),fieldtype,
|
| 765 |
+
precision,lower_limit,upper_limit));
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
public:
|
| 769 |
+
Integer_Field(int prec, long low=0L, long high=0L)
|
| 770 |
+
: NCursesFieldType(TYPE_INTEGER),
|
| 771 |
+
precision(prec), lower_limit(low), upper_limit(high) {
|
| 772 |
+
}
|
| 773 |
+
};
|
| 774 |
+
|
| 775 |
+
class NCURSES_CXX_IMPEXP Numeric_Field : public NCursesFieldType
|
| 776 |
+
{
|
| 777 |
+
private:
|
| 778 |
+
int precision;
|
| 779 |
+
double lower_limit, upper_limit;
|
| 780 |
+
|
| 781 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 782 |
+
OnError(::set_field_type(f.get_field(),fieldtype,
|
| 783 |
+
precision,lower_limit,upper_limit));
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
public:
|
| 787 |
+
Numeric_Field(int prec, double low=0.0, double high=0.0)
|
| 788 |
+
: NCursesFieldType(TYPE_NUMERIC),
|
| 789 |
+
precision(prec), lower_limit(low), upper_limit(high) {
|
| 790 |
+
}
|
| 791 |
+
};
|
| 792 |
+
|
| 793 |
+
class NCURSES_CXX_IMPEXP Regular_Expression_Field : public NCursesFieldType
|
| 794 |
+
{
|
| 795 |
+
private:
|
| 796 |
+
char* regex;
|
| 797 |
+
|
| 798 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 799 |
+
OnError(::set_field_type(f.get_field(),fieldtype,regex));
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
void copy_regex(const char *source)
|
| 803 |
+
{
|
| 804 |
+
regex = new char[1 + ::strlen(source)];
|
| 805 |
+
(::strcpy)(regex, source);
|
| 806 |
+
}
|
| 807 |
+
|
| 808 |
+
public:
|
| 809 |
+
explicit Regular_Expression_Field(const char *expr)
|
| 810 |
+
: NCursesFieldType(TYPE_REGEXP),
|
| 811 |
+
regex(NULL)
|
| 812 |
+
{
|
| 813 |
+
copy_regex(expr);
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs)
|
| 817 |
+
{
|
| 818 |
+
if (this != &rhs) {
|
| 819 |
+
*this = rhs;
|
| 820 |
+
copy_regex(rhs.regex);
|
| 821 |
+
NCursesFieldType::operator=(rhs);
|
| 822 |
+
}
|
| 823 |
+
return *this;
|
| 824 |
+
}
|
| 825 |
+
|
| 826 |
+
Regular_Expression_Field(const Regular_Expression_Field& rhs)
|
| 827 |
+
: NCursesFieldType(rhs),
|
| 828 |
+
regex(NULL)
|
| 829 |
+
{
|
| 830 |
+
copy_regex(rhs.regex);
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
~Regular_Expression_Field() {
|
| 834 |
+
delete[] regex;
|
| 835 |
+
}
|
| 836 |
+
};
|
| 837 |
+
|
| 838 |
+
class NCURSES_CXX_IMPEXP Enumeration_Field : public NCursesFieldType
|
| 839 |
+
{
|
| 840 |
+
private:
|
| 841 |
+
const char** list;
|
| 842 |
+
int case_sensitive;
|
| 843 |
+
int non_unique_matches;
|
| 844 |
+
|
| 845 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 846 |
+
OnError(::set_field_type(f.get_field(),fieldtype,
|
| 847 |
+
list,case_sensitive,non_unique_matches));
|
| 848 |
+
}
|
| 849 |
+
public:
|
| 850 |
+
Enumeration_Field(const char* enums[],
|
| 851 |
+
bool case_sens=FALSE,
|
| 852 |
+
bool non_unique=FALSE)
|
| 853 |
+
: NCursesFieldType(TYPE_ENUM),
|
| 854 |
+
list(enums),
|
| 855 |
+
case_sensitive(case_sens ? -1 : 0),
|
| 856 |
+
non_unique_matches(non_unique ? -1 : 0) {
|
| 857 |
+
}
|
| 858 |
+
|
| 859 |
+
Enumeration_Field& operator=(const Enumeration_Field& rhs)
|
| 860 |
+
{
|
| 861 |
+
if (this != &rhs) {
|
| 862 |
+
*this = rhs;
|
| 863 |
+
NCursesFieldType::operator=(rhs);
|
| 864 |
+
}
|
| 865 |
+
return *this;
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
Enumeration_Field(const Enumeration_Field& rhs)
|
| 869 |
+
: NCursesFieldType(rhs),
|
| 870 |
+
list(rhs.list),
|
| 871 |
+
case_sensitive(rhs.case_sensitive),
|
| 872 |
+
non_unique_matches(rhs.non_unique_matches)
|
| 873 |
+
{
|
| 874 |
+
}
|
| 875 |
+
};
|
| 876 |
+
|
| 877 |
+
class NCURSES_CXX_IMPEXP IPV4_Address_Field : public NCursesFieldType
|
| 878 |
+
{
|
| 879 |
+
private:
|
| 880 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 881 |
+
OnError(::set_field_type(f.get_field(),fieldtype));
|
| 882 |
+
}
|
| 883 |
+
|
| 884 |
+
public:
|
| 885 |
+
IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) {
|
| 886 |
+
}
|
| 887 |
+
};
|
| 888 |
+
|
| 889 |
+
extern "C" {
|
| 890 |
+
bool _nc_xx_fld_fcheck(FIELD *, const void*);
|
| 891 |
+
bool _nc_xx_fld_ccheck(int c, const void *);
|
| 892 |
+
void* _nc_xx_fld_makearg(va_list*);
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
//
|
| 896 |
+
// -------------------------------------------------------------------------
|
| 897 |
+
// Abstract base class for User-Defined Fieldtypes
|
| 898 |
+
// -------------------------------------------------------------------------
|
| 899 |
+
//
|
| 900 |
+
class NCURSES_CXX_IMPEXP UserDefinedFieldType : public NCursesFieldType
|
| 901 |
+
{
|
| 902 |
+
friend class UDF_Init; // Internal helper to set up statics
|
| 903 |
+
private:
|
| 904 |
+
// For all C++ defined fieldtypes we need only one generic lowlevel
|
| 905 |
+
// FIELDTYPE* element.
|
| 906 |
+
static FIELDTYPE* generic_fieldtype;
|
| 907 |
+
|
| 908 |
+
protected:
|
| 909 |
+
// This are the functions required by the low level libforms functions
|
| 910 |
+
// to construct a fieldtype.
|
| 911 |
+
friend bool _nc_xx_fld_fcheck(FIELD *, const void*);
|
| 912 |
+
friend bool _nc_xx_fld_ccheck(int c, const void *);
|
| 913 |
+
friend void* _nc_xx_fld_makearg(va_list*);
|
| 914 |
+
|
| 915 |
+
void set(NCursesFormField& f) NCURSES_OVERRIDE {
|
| 916 |
+
OnError(::set_field_type(f.get_field(),fieldtype,&f));
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
protected:
|
| 920 |
+
// Redefine this function to do a field validation. The argument
|
| 921 |
+
// is a reference to the field you should validate.
|
| 922 |
+
virtual bool field_check(NCursesFormField& f) = 0;
|
| 923 |
+
|
| 924 |
+
// Redefine this function to do a character validation. The argument
|
| 925 |
+
// is the character to be validated.
|
| 926 |
+
virtual bool char_check (int c) = 0;
|
| 927 |
+
|
| 928 |
+
public:
|
| 929 |
+
UserDefinedFieldType();
|
| 930 |
+
};
|
| 931 |
+
|
| 932 |
+
extern "C" {
|
| 933 |
+
bool _nc_xx_next_choice(FIELD*, const void *);
|
| 934 |
+
bool _nc_xx_prev_choice(FIELD*, const void *);
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
//
|
| 938 |
+
// -------------------------------------------------------------------------
|
| 939 |
+
// Abstract base class for User-Defined Fieldtypes with Choice functions
|
| 940 |
+
// -------------------------------------------------------------------------
|
| 941 |
+
//
|
| 942 |
+
class NCURSES_CXX_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType
|
| 943 |
+
{
|
| 944 |
+
friend class UDF_Init; // Internal helper to set up statics
|
| 945 |
+
private:
|
| 946 |
+
// For all C++ defined fieldtypes with choice functions we need only one
|
| 947 |
+
// generic lowlevel FIELDTYPE* element.
|
| 948 |
+
static FIELDTYPE* generic_fieldtype_with_choice;
|
| 949 |
+
|
| 950 |
+
// This are the functions required by the low level libforms functions
|
| 951 |
+
// to construct a fieldtype with choice functions.
|
| 952 |
+
friend bool _nc_xx_next_choice(FIELD*, const void *);
|
| 953 |
+
friend bool _nc_xx_prev_choice(FIELD*, const void *);
|
| 954 |
+
|
| 955 |
+
protected:
|
| 956 |
+
// Redefine this function to do the retrieval of the next choice value.
|
| 957 |
+
// The argument is a reference to the field tobe examined.
|
| 958 |
+
virtual bool next (NCursesFormField& f) = 0;
|
| 959 |
+
|
| 960 |
+
// Redefine this function to do the retrieval of the previous choice value.
|
| 961 |
+
// The argument is a reference to the field t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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
/****************************************************************************
|
| 3 |
+
* Copyright 2019-2020,2022 Thomas E. Dickey *
|
| 4 |
+
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
|
| 5 |
+
* *
|
| 6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 7 |
+
* copy of this software and associated documentation files (the *
|
| 8 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 9 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 10 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 11 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 12 |
+
* furnished to do so, subject to the following conditions: *
|
| 13 |
+
* *
|
| 14 |
+
* The above copyright notice and this permission notice shall be included *
|
| 15 |
+
* in all copies or substantial portions of the Software. *
|
| 16 |
+
* *
|
| 17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 18 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 19 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 20 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 21 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 22 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 23 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 24 |
+
* *
|
| 25 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 26 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 27 |
+
* sale, use or other dealings in this Software without prior written *
|
| 28 |
+
* authorization. *
|
| 29 |
+
****************************************************************************/
|
| 30 |
+
|
| 31 |
+
/****************************************************************************
|
| 32 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
// $Id: cursesm.h,v 1.35 2022/08/20 20:52:15 tom Exp $
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_CURSESM_H_incl
|
| 38 |
+
#define NCURSES_CURSESM_H_incl 1
|
| 39 |
+
|
| 40 |
+
#include <ncursesw/cursesp.h>
|
| 41 |
+
|
| 42 |
+
extern "C" {
|
| 43 |
+
# include <ncursesw/menu.h>
|
| 44 |
+
}
|
| 45 |
+
//
|
| 46 |
+
// -------------------------------------------------------------------------
|
| 47 |
+
// This wraps the ITEM type of <ncursesw/menu.h>
|
| 48 |
+
// -------------------------------------------------------------------------
|
| 49 |
+
//
|
| 50 |
+
class NCURSES_CXX_IMPEXP NCursesMenuItem
|
| 51 |
+
{
|
| 52 |
+
friend class NCursesMenu;
|
| 53 |
+
|
| 54 |
+
protected:
|
| 55 |
+
ITEM *item;
|
| 56 |
+
|
| 57 |
+
inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
|
| 58 |
+
if (err != E_OK)
|
| 59 |
+
THROW(new NCursesMenuException (err));
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
public:
|
| 63 |
+
NCursesMenuItem (const char* p_name = NULL,
|
| 64 |
+
const char* p_descript = NULL)
|
| 65 |
+
: item(0)
|
| 66 |
+
{
|
| 67 |
+
item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0);
|
| 68 |
+
if (p_name && !item)
|
| 69 |
+
OnError (E_SYSTEM_ERROR);
|
| 70 |
+
}
|
| 71 |
+
// Create an item. If you pass both parameters as NULL, a delimiting
|
| 72 |
+
// item is constructed which can be used to terminate a list of
|
| 73 |
+
// NCursesMenu objects.
|
| 74 |
+
|
| 75 |
+
NCursesMenuItem& operator=(const NCursesMenuItem& rhs)
|
| 76 |
+
{
|
| 77 |
+
if (this != &rhs) {
|
| 78 |
+
*this = rhs;
|
| 79 |
+
}
|
| 80 |
+
return *this;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
NCursesMenuItem(const NCursesMenuItem& rhs)
|
| 84 |
+
: item(0)
|
| 85 |
+
{
|
| 86 |
+
(void) rhs;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
virtual ~NCursesMenuItem () THROWS(NCursesException);
|
| 90 |
+
// Release the items memory
|
| 91 |
+
|
| 92 |
+
inline const char* name () const {
|
| 93 |
+
return ::item_name (item);
|
| 94 |
+
}
|
| 95 |
+
// Name of the item
|
| 96 |
+
|
| 97 |
+
inline const char* description () const {
|
| 98 |
+
return ::item_description (item);
|
| 99 |
+
}
|
| 100 |
+
// Description of the item
|
| 101 |
+
|
| 102 |
+
inline int (index) (void) const {
|
| 103 |
+
return ::item_index (item);
|
| 104 |
+
}
|
| 105 |
+
// Index of the item in an item array (or -1)
|
| 106 |
+
|
| 107 |
+
inline void options_on (Item_Options opts) {
|
| 108 |
+
OnError (::item_opts_on (item, opts));
|
| 109 |
+
}
|
| 110 |
+
// Switch on the items options
|
| 111 |
+
|
| 112 |
+
inline void options_off (Item_Options opts) {
|
| 113 |
+
OnError (::item_opts_off (item, opts));
|
| 114 |
+
}
|
| 115 |
+
// Switch off the item's option
|
| 116 |
+
|
| 117 |
+
inline Item_Options options () const {
|
| 118 |
+
return ::item_opts (item);
|
| 119 |
+
}
|
| 120 |
+
// Retrieve the items options
|
| 121 |
+
|
| 122 |
+
inline void set_options (Item_Options opts) {
|
| 123 |
+
OnError (::set_item_opts (item, opts));
|
| 124 |
+
}
|
| 125 |
+
// Set the items options
|
| 126 |
+
|
| 127 |
+
inline void set_value (bool f) {
|
| 128 |
+
OnError (::set_item_value (item,f));
|
| 129 |
+
}
|
| 130 |
+
// Set/Reset the items selection state
|
| 131 |
+
|
| 132 |
+
inline bool value () const {
|
| 133 |
+
return ::item_value (item);
|
| 134 |
+
}
|
| 135 |
+
// Retrieve the items selection state
|
| 136 |
+
|
| 137 |
+
inline bool visible () const {
|
| 138 |
+
return ::item_visible (item);
|
| 139 |
+
}
|
| 140 |
+
// Retrieve visibility of the item
|
| 141 |
+
|
| 142 |
+
virtual bool action();
|
| 143 |
+
// Perform an action associated with this item; you may use this in an
|
| 144 |
+
// user supplied driver for a menu; you may derive from this class and
|
| 145 |
+
// overload action() to supply items with different actions.
|
| 146 |
+
// If an action returns true, the menu will be exited. The default action
|
| 147 |
+
// is to do nothing.
|
| 148 |
+
};
|
| 149 |
+
|
| 150 |
+
// Prototype for an items callback function.
|
| 151 |
+
typedef bool ITEMCALLBACK(NCursesMenuItem&);
|
| 152 |
+
|
| 153 |
+
// If you don't like to create a child class for individual items to
|
| 154 |
+
// overload action(), you may use this class and provide a callback
|
| 155 |
+
// function pointer for items.
|
| 156 |
+
class NCURSES_CXX_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem
|
| 157 |
+
{
|
| 158 |
+
private:
|
| 159 |
+
ITEMCALLBACK* p_fct;
|
| 160 |
+
|
| 161 |
+
public:
|
| 162 |
+
NCursesMenuCallbackItem(ITEMCALLBACK* fct = NULL,
|
| 163 |
+
const char* p_name = NULL,
|
| 164 |
+
const char* p_descript = NULL )
|
| 165 |
+
: NCursesMenuItem (p_name, p_descript),
|
| 166 |
+
p_fct (fct) {
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs)
|
| 170 |
+
{
|
| 171 |
+
if (this != &rhs) {
|
| 172 |
+
*this = rhs;
|
| 173 |
+
}
|
| 174 |
+
return *this;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs)
|
| 178 |
+
: NCursesMenuItem(rhs),
|
| 179 |
+
p_fct(0)
|
| 180 |
+
{
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
virtual ~NCursesMenuCallbackItem() THROWS(NCursesException);
|
| 184 |
+
|
| 185 |
+
bool action() NCURSES_OVERRIDE;
|
| 186 |
+
};
|
| 187 |
+
|
| 188 |
+
// This are the built-in hook functions in this C++ binding. In C++ we use
|
| 189 |
+
// virtual member functions (see below On_..._Init and On_..._Termination)
|
| 190 |
+
// to provide this functionality in an object oriented manner.
|
| 191 |
+
extern "C" {
|
| 192 |
+
void _nc_xx_mnu_init(MENU *);
|
| 193 |
+
void _nc_xx_mnu_term(MENU *);
|
| 194 |
+
void _nc_xx_itm_init(MENU *);
|
| 195 |
+
void _nc_xx_itm_term(MENU *);
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
//
|
| 199 |
+
// -------------------------------------------------------------------------
|
| 200 |
+
// This wraps the MENU type of <ncursesw/menu.h>
|
| 201 |
+
// -------------------------------------------------------------------------
|
| 202 |
+
//
|
| 203 |
+
class NCURSES_CXX_IMPEXP NCursesMenu : public NCursesPanel
|
| 204 |
+
{
|
| 205 |
+
protected:
|
| 206 |
+
MENU *menu;
|
| 207 |
+
|
| 208 |
+
private:
|
| 209 |
+
NCursesWindow* sub; // the subwindow object
|
| 210 |
+
bool b_sub_owner; // is this our own subwindow?
|
| 211 |
+
bool b_framed; // has the menu a border?
|
| 212 |
+
bool b_autoDelete; // Delete items when deleting menu?
|
| 213 |
+
|
| 214 |
+
NCursesMenuItem** my_items; // The array of items for this menu
|
| 215 |
+
|
| 216 |
+
// This structure is used for the menu's user data field to link the
|
| 217 |
+
// MENU* to the C++ object and to provide extra space for a user pointer.
|
| 218 |
+
typedef struct {
|
| 219 |
+
void* m_user; // the pointer for the user's data
|
| 220 |
+
const NCursesMenu* m_back; // backward pointer to C++ object
|
| 221 |
+
const MENU* m_owner;
|
| 222 |
+
} UserHook;
|
| 223 |
+
|
| 224 |
+
// Get the backward pointer to the C++ object from a MENU
|
| 225 |
+
static inline NCursesMenu* getHook(const MENU *m) {
|
| 226 |
+
UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m));
|
| 227 |
+
assert(hook != 0 && hook->m_owner==m);
|
| 228 |
+
return const_cast<NCursesMenu*>(hook->m_back);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
friend void _nc_xx_mnu_init(MENU *);
|
| 232 |
+
friend void _nc_xx_mnu_term(MENU *);
|
| 233 |
+
friend void _nc_xx_itm_init(MENU *);
|
| 234 |
+
friend void _nc_xx_itm_term(MENU *);
|
| 235 |
+
|
| 236 |
+
// Calculate ITEM* array for the menu
|
| 237 |
+
ITEM** mapItems(NCursesMenuItem* nitems[]);
|
| 238 |
+
|
| 239 |
+
protected:
|
| 240 |
+
// internal routines
|
| 241 |
+
inline void set_user(void *user) {
|
| 242 |
+
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu));
|
| 243 |
+
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu);
|
| 244 |
+
uptr->m_user = user;
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
inline void *get_user() {
|
| 248 |
+
UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu));
|
| 249 |
+
assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu);
|
| 250 |
+
return uptr->m_user;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
void InitMenu (NCursesMenuItem* menu[],
|
| 254 |
+
bool with_frame,
|
| 255 |
+
bool autoDeleteItems);
|
| 256 |
+
|
| 257 |
+
inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
|
| 258 |
+
if (err != E_OK)
|
| 259 |
+
THROW(new NCursesMenuException (this, err));
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// this wraps the menu_driver call.
|
| 263 |
+
virtual int driver (int c) ;
|
| 264 |
+
|
| 265 |
+
// 'Internal' constructor to create a menu without association to
|
| 266 |
+
// an array of items.
|
| 267 |
+
NCursesMenu( int nlines,
|
| 268 |
+
int ncols,
|
| 269 |
+
int begin_y = 0,
|
| 270 |
+
int begin_x = 0)
|
| 271 |
+
: NCursesPanel(nlines,ncols,begin_y,begin_x),
|
| 272 |
+
menu (STATIC_CAST(MENU*)(0)),
|
| 273 |
+
sub(0),
|
| 274 |
+
b_sub_owner(0),
|
| 275 |
+
b_framed(0),
|
| 276 |
+
b_autoDelete(0),
|
| 277 |
+
my_items(0)
|
| 278 |
+
{
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
public:
|
| 282 |
+
// Make a full window size menu
|
| 283 |
+
NCursesMenu (NCursesMenuItem* Items[],
|
| 284 |
+
bool with_frame=FALSE, // Reserve space for a frame?
|
| 285 |
+
bool autoDelete_Items=FALSE) // Autocleanup of Items?
|
| 286 |
+
: NCursesPanel(),
|
| 287 |
+
menu(0),
|
| 288 |
+
sub(0),
|
| 289 |
+
b_sub_owner(0),
|
| 290 |
+
b_framed(0),
|
| 291 |
+
b_autoDelete(0),
|
| 292 |
+
my_items(0)
|
| 293 |
+
{
|
| 294 |
+
InitMenu(Items, with_frame, autoDelete_Items);
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
// Make a menu with a window of this size.
|
| 298 |
+
NCursesMenu (NCursesMenuItem* Items[],
|
| 299 |
+
int nlines,
|
| 300 |
+
int ncols,
|
| 301 |
+
int begin_y = 0,
|
| 302 |
+
int begin_x = 0,
|
| 303 |
+
bool with_frame=FALSE, // Reserve space for a frame?
|
| 304 |
+
bool autoDelete_Items=FALSE) // Autocleanup of Items?
|
| 305 |
+
: NCursesPanel(nlines, ncols, begin_y, begin_x),
|
| 306 |
+
menu(0),
|
| 307 |
+
sub(0),
|
| 308 |
+
b_sub_owner(0),
|
| 309 |
+
b_framed(0),
|
| 310 |
+
b_autoDelete(0),
|
| 311 |
+
my_items(0)
|
| 312 |
+
{
|
| 313 |
+
InitMenu(Items, with_frame, autoDelete_Items);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
NCursesMenu& operator=(const NCursesMenu& rhs)
|
| 317 |
+
{
|
| 318 |
+
if (this != &rhs) {
|
| 319 |
+
*this = rhs;
|
| 320 |
+
NCursesPanel::operator=(rhs);
|
| 321 |
+
}
|
| 322 |
+
return *this;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
NCursesMenu(const NCursesMenu& rhs)
|
| 326 |
+
: NCursesPanel(rhs),
|
| 327 |
+
menu(rhs.menu),
|
| 328 |
+
sub(rhs.sub),
|
| 329 |
+
b_sub_owner(rhs.b_sub_owner),
|
| 330 |
+
b_framed(rhs.b_framed),
|
| 331 |
+
b_autoDelete(rhs.b_autoDelete),
|
| 332 |
+
my_items(rhs.my_items)
|
| 333 |
+
{
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
virtual ~NCursesMenu () THROWS(NCursesException);
|
| 337 |
+
|
| 338 |
+
// Retrieve the menus subwindow
|
| 339 |
+
inline NCursesWindow& subWindow() const {
|
| 340 |
+
assert(sub!=NULL);
|
| 341 |
+
return *sub;
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
// Set the menus subwindow
|
| 345 |
+
void setSubWindow(NCursesWindow& sub);
|
| 346 |
+
|
| 347 |
+
// Set these items for the menu
|
| 348 |
+
inline void setItems(NCursesMenuItem* Items[]) {
|
| 349 |
+
OnError(::set_menu_items(menu,mapItems(Items)));
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
// Remove the menu from the screen
|
| 353 |
+
inline void unpost (void) {
|
| 354 |
+
OnError (::unpost_menu (menu));
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
// Post the menu to the screen if flag is true, unpost it otherwise
|
| 358 |
+
inline void post(bool flag = TRUE) {
|
| 359 |
+
flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu));
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
// Get the number of rows and columns for this menu
|
| 363 |
+
inline void scale (int& mrows, int& mcols) const {
|
| 364 |
+
OnError (::scale_menu (menu, &mrows, &mcols));
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
// Set the format of this menu
|
| 368 |
+
inline void set_format(int mrows, int mcols) {
|
| 369 |
+
OnError (::set_menu_format(menu, mrows, mcols));
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
// Get the format of this menu
|
| 373 |
+
inline void menu_format(int& rows,int& ncols) {
|
| 374 |
+
::menu_format(menu,&rows,&ncols);
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
// Items of the menu
|
| 378 |
+
inline NCursesMenuItem* items() const {
|
| 379 |
+
return *my_items;
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// Get the number of items in this menu
|
| 383 |
+
inline int count() const {
|
| 384 |
+
return ::item_count(menu);
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
// Get the current item (i.e. the one the cursor is located)
|
| 388 |
+
inline NCursesMenuItem* current_item() const {
|
| 389 |
+
return my_items[::item_index(::current_item(menu))];
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// Get the marker string
|
| 393 |
+
inline const char* mark() const {
|
| 394 |
+
return ::menu_mark(menu);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
// Set the marker string
|
| 398 |
+
inline void set_mark(const char *marker) {
|
| 399 |
+
OnError (::set_menu_mark (menu, marker));
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
// Get the name of the request code c
|
| 403 |
+
inline static const char* request_name(int c) {
|
| 404 |
+
return ::menu_request_name(c);
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
// Get the current pattern
|
| 408 |
+
inline char* pattern() const {
|
| 409 |
+
return ::menu_pattern(menu);
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
// true if there is a pattern match, false otherwise.
|
| 413 |
+
bool set_pattern (const char *pat);
|
| 414 |
+
|
| 415 |
+
// set the default attributes for the menu
|
| 416 |
+
// i.e. set fore, back and grey attribute
|
| 417 |
+
virtual void setDefaultAttributes();
|
| 418 |
+
|
| 419 |
+
// Get the menus background attributes
|
| 420 |
+
inline chtype back() const {
|
| 421 |
+
return ::menu_back(menu);
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
// Get the menus foreground attributes
|
| 425 |
+
inline chtype fore() const {
|
| 426 |
+
return ::menu_fore(menu);
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
// Get the menus grey attributes (used for unselectable items)
|
| 430 |
+
inline chtype grey() const {
|
| 431 |
+
return ::menu_grey(menu);
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
// Set the menus background attributes
|
| 435 |
+
inline chtype set_background(chtype a) {
|
| 436 |
+
return ::set_menu_back(menu,a);
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// Set the menus foreground attributes
|
| 440 |
+
inline chtype set_foreground(chtype a) {
|
| 441 |
+
return ::set_menu_fore(menu,a);
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
// Set the menus grey attributes (used for unselectable items)
|
| 445 |
+
inline chtype set_grey(chtype a) {
|
| 446 |
+
return ::set_menu_grey(menu,a);
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
inline void options_on (Menu_Options opts) {
|
| 450 |
+
OnError (::menu_opts_on (menu,opts));
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
inline void options_off(Menu_Options opts) {
|
| 454 |
+
OnError (::menu_opts_off(menu,opts));
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
inline Menu_Options options() const {
|
| 458 |
+
return ::menu_opts(menu);
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
inline void set_options (Menu_Options opts) {
|
| 462 |
+
OnError (::set_menu_opts (menu,opts));
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
inline int pad() const {
|
| 466 |
+
return ::menu_pad(menu);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
inline void set_pad (int padch) {
|
| 470 |
+
OnError (::set_menu_pad (menu, padch));
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
// Position the cursor to the current item
|
| 474 |
+
inline void position_cursor () const {
|
| 475 |
+
OnError (::pos_menu_cursor (menu));
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
// Set the current item
|
| 479 |
+
inline void set_current(NCursesMenuItem& I) {
|
| 480 |
+
OnError (::set_current_item(menu, I.item));
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
// Get the current top row of the menu
|
| 484 |
+
inline int top_row (void) const {
|
| 485 |
+
return ::top_row (menu);
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
// Set the current top row of the menu
|
| 489 |
+
inline void set_top_row (int row) {
|
| 490 |
+
OnError (::set_top_row (menu, row));
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
// spacing control
|
| 494 |
+
// Set the spacing for the menu
|
| 495 |
+
inline void setSpacing(int spc_description,
|
| 496 |
+
int spc_rows,
|
| 497 |
+
int spc_columns) {
|
| 498 |
+
OnError(::set_menu_spacing(menu,
|
| 499 |
+
spc_description,
|
| 500 |
+
spc_rows,
|
| 501 |
+
spc_columns));
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
// Get the spacing info for the menu
|
| 505 |
+
inline void Spacing(int& spc_description,
|
| 506 |
+
int& spc_rows,
|
| 507 |
+
int& spc_columns) const {
|
| 508 |
+
OnError(::menu_spacing(menu,
|
| 509 |
+
&spc_description,
|
| 510 |
+
&spc_rows,
|
| 511 |
+
&spc_columns));
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
// Decorations
|
| 515 |
+
inline void frame(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
|
| 516 |
+
if (b_framed)
|
| 517 |
+
NCursesPanel::frame(title,btitle);
|
| 518 |
+
else
|
| 519 |
+
OnError(E_SYSTEM_ERROR);
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
inline void boldframe(const char *title=NULL, const char* btitle=NULL) NCURSES_OVERRIDE {
|
| 523 |
+
if (b_framed)
|
| 524 |
+
NCursesPanel::boldframe(title,btitle);
|
| 525 |
+
else
|
| 526 |
+
OnError(E_SYSTEM_ERROR);
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
inline void label(const char *topLabel, const char *bottomLabel) NCURSES_OVERRIDE {
|
| 530 |
+
if (b_framed)
|
| 531 |
+
NCursesPanel::label(topLabel,bottomLabel);
|
| 532 |
+
else
|
| 533 |
+
OnError(E_SYSTEM_ERROR);
|
| 534 |
+
}
|
| 535 |
+
|
| 536 |
+
// -----
|
| 537 |
+
// Hooks
|
| 538 |
+
// -----
|
| 539 |
+
|
| 540 |
+
// Called after the menu gets repositioned in its window.
|
| 541 |
+
// This is especially true if the menu is posted.
|
| 542 |
+
virtual void On_Menu_Init();
|
| 543 |
+
|
| 544 |
+
// Called before the menu gets repositioned in its window.
|
| 545 |
+
// This is especially true if the menu is unposted.
|
| 546 |
+
virtual void On_Menu_Termination();
|
| 547 |
+
|
| 548 |
+
// Called after the item became the current item
|
| 549 |
+
virtual void On_Item_Init(NCursesMenuItem& item);
|
| 550 |
+
|
| 551 |
+
// Called before this item is left as current item.
|
| 552 |
+
virtual void On_Item_Termination(NCursesMenuItem& item);
|
| 553 |
+
|
| 554 |
+
// Provide a default key virtualization. Translate the keyboard
|
| 555 |
+
// code c into a menu request code.
|
| 556 |
+
// The default implementation provides a hopefully straightforward
|
| 557 |
+
// mapping for the most common keystrokes and menu requests.
|
| 558 |
+
virtual int virtualize(int c);
|
| 559 |
+
|
| 560 |
+
|
| 561 |
+
// Operators
|
| 562 |
+
inline NCursesMenuItem* operator[](int i) const {
|
| 563 |
+
if ( (i < 0) || (i >= ::item_count (menu)) )
|
| 564 |
+
OnError (E_BAD_ARGUMENT);
|
| 565 |
+
return (my_items[i]);
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
// Perform the menu's operation
|
| 569 |
+
// Return the item where you left the selection mark for a single
|
| 570 |
+
// selection menu, or NULL for a multivalued menu.
|
| 571 |
+
virtual NCursesMenuItem* operator()(void);
|
| 572 |
+
|
| 573 |
+
// --------------------
|
| 574 |
+
// Exception handlers
|
| 575 |
+
// Called by operator()
|
| 576 |
+
// --------------------
|
| 577 |
+
|
| 578 |
+
// Called if the request is denied
|
| 579 |
+
virtual void On_Request_Denied(int c) const;
|
| 580 |
+
|
| 581 |
+
// Called if the item is not selectable
|
| 582 |
+
virtual void On_Not_Selectable(int c) const;
|
| 583 |
+
|
| 584 |
+
// Called if pattern doesn't match
|
| 585 |
+
virtual void On_No_Match(int c) const;
|
| 586 |
+
|
| 587 |
+
// Called if the command is unknown
|
| 588 |
+
virtual void On_Unknown_Command(int c) const;
|
| 589 |
+
|
| 590 |
+
};
|
| 591 |
+
//
|
| 592 |
+
// -------------------------------------------------------------------------
|
| 593 |
+
// This is the typical C++ typesafe way to allow to attach
|
| 594 |
+
// user data to an item of a menu. Its assumed that the user
|
| 595 |
+
// data belongs to some class T. Use T as template argument
|
| 596 |
+
// to create a UserItem.
|
| 597 |
+
// -------------------------------------------------------------------------
|
| 598 |
+
//
|
| 599 |
+
template<class T> class NCURSES_CXX_IMPEXP NCursesUserItem : public NCursesMenuItem
|
| 600 |
+
{
|
| 601 |
+
public:
|
| 602 |
+
NCursesUserItem (const char* p_name,
|
| 603 |
+
const char* p_descript = NULL,
|
| 604 |
+
const T* p_UserData = STATIC_CAST(T*)(0))
|
| 605 |
+
: NCursesMenuItem (p_name, p_descript) {
|
| 606 |
+
if (item)
|
| 607 |
+
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void*>(p_UserData))));
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
virtual ~NCursesUserItem() THROWS(NCursesException) {}
|
| 611 |
+
|
| 612 |
+
inline const T* UserData (void) const {
|
| 613 |
+
return reinterpret_cast<const T*>(::item_userptr (item));
|
| 614 |
+
};
|
| 615 |
+
|
| 616 |
+
inline virtual void setUserData(const T* p_UserData) {
|
| 617 |
+
if (item)
|
| 618 |
+
OnError (::set_item_userptr (item, const_cast<void *>(reinterpret_cast<const void *>(p_UserData))));
|
| 619 |
+
}
|
| 620 |
+
};
|
| 621 |
+
//
|
| 622 |
+
// -------------------------------------------------------------------------
|
| 623 |
+
// The same mechanism is used to attach user data to a menu
|
| 624 |
+
// -------------------------------------------------------------------------
|
| 625 |
+
//
|
| 626 |
+
template<class T> class NCURSES_CXX_IMPEXP NCursesUserMenu : public NCursesMenu
|
| 627 |
+
{
|
| 628 |
+
protected:
|
| 629 |
+
NCursesUserMenu( int nlines,
|
| 630 |
+
int ncols,
|
| 631 |
+
int begin_y = 0,
|
| 632 |
+
int begin_x = 0,
|
| 633 |
+
const T* p_UserData = STATIC_CAST(T*)(0))
|
| 634 |
+
: NCursesMenu(nlines,ncols,begin_y,begin_x) {
|
| 635 |
+
if (menu)
|
| 636 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 637 |
+
}
|
| 638 |
+
|
| 639 |
+
public:
|
| 640 |
+
NCursesUserMenu (NCursesMenuItem* Items[],
|
| 641 |
+
const T* p_UserData = STATIC_CAST(T*)(0),
|
| 642 |
+
bool with_frame=FALSE,
|
| 643 |
+
bool autoDelete_Items=FALSE)
|
| 644 |
+
: NCursesMenu (&Items, with_frame, autoDelete_Items) {
|
| 645 |
+
if (menu)
|
| 646 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 647 |
+
};
|
| 648 |
+
|
| 649 |
+
NCursesUserMenu (NCursesMenuItem* Items[],
|
| 650 |
+
int nlines,
|
| 651 |
+
int ncols,
|
| 652 |
+
int begin_y = 0,
|
| 653 |
+
int begin_x = 0,
|
| 654 |
+
const T* p_UserData = STATIC_CAST(T*)(0),
|
| 655 |
+
bool with_frame=FALSE)
|
| 656 |
+
: NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) {
|
| 657 |
+
if (menu)
|
| 658 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 659 |
+
};
|
| 660 |
+
|
| 661 |
+
virtual ~NCursesUserMenu() THROWS(NCursesException) {
|
| 662 |
+
};
|
| 663 |
+
|
| 664 |
+
inline T* UserData (void) {
|
| 665 |
+
return reinterpret_cast<T*>(get_user ());
|
| 666 |
+
};
|
| 667 |
+
|
| 668 |
+
inline virtual void setUserData (const T* p_UserData) {
|
| 669 |
+
if (menu)
|
| 670 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 671 |
+
}
|
| 672 |
+
};
|
| 673 |
+
|
| 674 |
+
#endif /* NCURSES_CURSESM_H_incl */
|
emu3/include/ncursesw/cursesp.h
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
/****************************************************************************
|
| 33 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
#ifndef NCURSES_CURSESP_H_incl
|
| 37 |
+
#define NCURSES_CURSESP_H_incl 1
|
| 38 |
+
|
| 39 |
+
// $Id: cursesp.h,v 1.36 2022/08/20 20:52:15 tom Exp $
|
| 40 |
+
|
| 41 |
+
#include <ncursesw/cursesw.h>
|
| 42 |
+
|
| 43 |
+
extern "C" {
|
| 44 |
+
# include <ncursesw/panel.h>
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
class NCURSES_CXX_IMPEXP NCursesPanel
|
| 48 |
+
: public NCursesWindow
|
| 49 |
+
{
|
| 50 |
+
protected:
|
| 51 |
+
PANEL *p;
|
| 52 |
+
static NCursesPanel *dummy;
|
| 53 |
+
|
| 54 |
+
private:
|
| 55 |
+
// This structure is used for the panel's user data field to link the
|
| 56 |
+
// PANEL* to the C++ object and to provide extra space for a user pointer.
|
| 57 |
+
typedef struct {
|
| 58 |
+
void* m_user; // the pointer for the user's data
|
| 59 |
+
const NCursesPanel* m_back; // backward pointer to C++ object
|
| 60 |
+
const PANEL* m_owner; // the panel itself
|
| 61 |
+
} UserHook;
|
| 62 |
+
|
| 63 |
+
inline UserHook *UserPointer()
|
| 64 |
+
{
|
| 65 |
+
UserHook* uptr = reinterpret_cast<UserHook*>(
|
| 66 |
+
const_cast<void *>(::panel_userptr (p)));
|
| 67 |
+
return uptr;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
void init(); // Initialize the panel object
|
| 71 |
+
|
| 72 |
+
protected:
|
| 73 |
+
void set_user(void *user)
|
| 74 |
+
{
|
| 75 |
+
UserHook* uptr = UserPointer();
|
| 76 |
+
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p) {
|
| 77 |
+
uptr->m_user = user;
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
// Set the user pointer of the panel.
|
| 81 |
+
|
| 82 |
+
void *get_user()
|
| 83 |
+
{
|
| 84 |
+
UserHook* uptr = UserPointer();
|
| 85 |
+
void *result = 0;
|
| 86 |
+
if (uptr != 0 && uptr->m_back==this && uptr->m_owner==p)
|
| 87 |
+
result = uptr->m_user;
|
| 88 |
+
return result;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
|
| 92 |
+
{
|
| 93 |
+
if (err==ERR)
|
| 94 |
+
THROW(new NCursesPanelException (this, err));
|
| 95 |
+
}
|
| 96 |
+
// If err is equal to the curses error indicator ERR, an error handler
|
| 97 |
+
// is called.
|
| 98 |
+
|
| 99 |
+
// Get a keystroke. Default implementation calls getch()
|
| 100 |
+
virtual int getKey(void);
|
| 101 |
+
|
| 102 |
+
public:
|
| 103 |
+
NCursesPanel(int nlines,
|
| 104 |
+
int ncols,
|
| 105 |
+
int begin_y = 0,
|
| 106 |
+
int begin_x = 0)
|
| 107 |
+
: NCursesWindow(nlines,ncols,begin_y,begin_x), p(0)
|
| 108 |
+
{
|
| 109 |
+
init();
|
| 110 |
+
}
|
| 111 |
+
// Create a panel with this size starting at the requested position.
|
| 112 |
+
|
| 113 |
+
NCursesPanel()
|
| 114 |
+
: NCursesWindow(::stdscr), p(0)
|
| 115 |
+
{
|
| 116 |
+
init();
|
| 117 |
+
}
|
| 118 |
+
// This constructor creates the default Panel associated with the
|
| 119 |
+
// ::stdscr window
|
| 120 |
+
|
| 121 |
+
NCursesPanel& operator=(const NCursesPanel& rhs)
|
| 122 |
+
{
|
| 123 |
+
if (this != &rhs) {
|
| 124 |
+
*this = rhs;
|
| 125 |
+
NCursesWindow::operator=(rhs);
|
| 126 |
+
}
|
| 127 |
+
return *this;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
NCursesPanel(const NCursesPanel& rhs)
|
| 131 |
+
: NCursesWindow(rhs),
|
| 132 |
+
p(rhs.p)
|
| 133 |
+
{
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
virtual ~NCursesPanel() THROWS(NCursesException);
|
| 137 |
+
|
| 138 |
+
// basic manipulation
|
| 139 |
+
inline void hide()
|
| 140 |
+
{
|
| 141 |
+
OnError (::hide_panel(p));
|
| 142 |
+
}
|
| 143 |
+
// Hide the panel. It stays in the stack but becomes invisible.
|
| 144 |
+
|
| 145 |
+
inline void show()
|
| 146 |
+
{
|
| 147 |
+
OnError (::show_panel(p));
|
| 148 |
+
}
|
| 149 |
+
// Show the panel, i.e. make it visible.
|
| 150 |
+
|
| 151 |
+
inline void top()
|
| 152 |
+
{
|
| 153 |
+
OnError (::top_panel(p));
|
| 154 |
+
}
|
| 155 |
+
// Make this panel the top panel in the stack.
|
| 156 |
+
|
| 157 |
+
inline void bottom()
|
| 158 |
+
{
|
| 159 |
+
OnError (::bottom_panel(p));
|
| 160 |
+
}
|
| 161 |
+
// Make this panel the bottom panel in the stack.
|
| 162 |
+
// N.B.: The panel associated with ::stdscr is always on the bottom. So
|
| 163 |
+
// actually bottom() makes the panel the first above ::stdscr.
|
| 164 |
+
|
| 165 |
+
virtual int mvwin(int y, int x) NCURSES_OVERRIDE
|
| 166 |
+
{
|
| 167 |
+
OnError(::move_panel(p, y, x));
|
| 168 |
+
return OK;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
inline bool hidden() const
|
| 172 |
+
{
|
| 173 |
+
return (::panel_hidden (p) ? TRUE : FALSE);
|
| 174 |
+
}
|
| 175 |
+
// Return TRUE if the panel is hidden, FALSE otherwise.
|
| 176 |
+
|
| 177 |
+
/* The functions panel_above() and panel_below() are not reflected in
|
| 178 |
+
the NCursesPanel class. The reason for this is, that we cannot
|
| 179 |
+
assume that a panel retrieved by those operations is one wrapped
|
| 180 |
+
by a C++ class. Although this situation might be handled, we also
|
| 181 |
+
need a reverse mapping from PANEL to NCursesPanel which needs some
|
| 182 |
+
redesign of the low level stuff. At the moment, we define them in the
|
| 183 |
+
interface but they will always produce an error. */
|
| 184 |
+
inline NCursesPanel& above() const
|
| 185 |
+
{
|
| 186 |
+
OnError(ERR);
|
| 187 |
+
return *dummy;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
inline NCursesPanel& below() const
|
| 191 |
+
{
|
| 192 |
+
OnError(ERR);
|
| 193 |
+
return *dummy;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
// Those two are rewrites of the corresponding virtual members of
|
| 197 |
+
// NCursesWindow
|
| 198 |
+
virtual int refresh() NCURSES_OVERRIDE;
|
| 199 |
+
// Propagate all panel changes to the virtual screen and update the
|
| 200 |
+
// physical screen.
|
| 201 |
+
|
| 202 |
+
virtual int noutrefresh() NCURSES_OVERRIDE;
|
| 203 |
+
// Propagate all panel changes to the virtual screen.
|
| 204 |
+
|
| 205 |
+
static void redraw();
|
| 206 |
+
// Redraw all panels.
|
| 207 |
+
|
| 208 |
+
// decorations
|
| 209 |
+
virtual void frame(const char* title=NULL,
|
| 210 |
+
const char* btitle=NULL);
|
| 211 |
+
// Put a frame around the panel and put the title centered in the top line
|
| 212 |
+
// and btitle in the bottom line.
|
| 213 |
+
|
| 214 |
+
virtual void boldframe(const char* title=NULL,
|
| 215 |
+
const char* btitle=NULL);
|
| 216 |
+
// Same as frame(), but use highlighted attributes.
|
| 217 |
+
|
| 218 |
+
virtual void label(const char* topLabel,
|
| 219 |
+
const char* bottomLabel);
|
| 220 |
+
// Put the title centered in the top line and btitle in the bottom line.
|
| 221 |
+
|
| 222 |
+
virtual void centertext(int row,const char* label);
|
| 223 |
+
// Put the label text centered in the specified row.
|
| 224 |
+
};
|
| 225 |
+
|
| 226 |
+
/* We use templates to provide a typesafe mechanism to associate
|
| 227 |
+
* user data with a panel. A NCursesUserPanel<T> is a panel
|
| 228 |
+
* associated with some user data of type T.
|
| 229 |
+
*/
|
| 230 |
+
template<class T> class NCursesUserPanel : public NCursesPanel
|
| 231 |
+
{
|
| 232 |
+
public:
|
| 233 |
+
NCursesUserPanel (int nlines,
|
| 234 |
+
int ncols,
|
| 235 |
+
int begin_y = 0,
|
| 236 |
+
int begin_x = 0,
|
| 237 |
+
const T* p_UserData = STATIC_CAST(T*)(0))
|
| 238 |
+
: NCursesPanel (nlines, ncols, begin_y, begin_x)
|
| 239 |
+
{
|
| 240 |
+
if (p)
|
| 241 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>
|
| 242 |
+
(p_UserData)));
|
| 243 |
+
};
|
| 244 |
+
// This creates an user panel of the requested size with associated
|
| 245 |
+
// user data pointed to by p_UserData.
|
| 246 |
+
|
| 247 |
+
explicit NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
|
| 248 |
+
{
|
| 249 |
+
if (p)
|
| 250 |
+
set_user(const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 251 |
+
};
|
| 252 |
+
// This creates an user panel associated with the ::stdscr and user data
|
| 253 |
+
// pointed to by p_UserData.
|
| 254 |
+
|
| 255 |
+
virtual ~NCursesUserPanel() THROWS(NCursesException) {};
|
| 256 |
+
|
| 257 |
+
T* UserData (void)
|
| 258 |
+
{
|
| 259 |
+
return reinterpret_cast<T*>(get_user ());
|
| 260 |
+
};
|
| 261 |
+
// Retrieve the user data associated with the panel.
|
| 262 |
+
|
| 263 |
+
virtual void setUserData (const T* p_UserData)
|
| 264 |
+
{
|
| 265 |
+
if (p)
|
| 266 |
+
set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
|
| 267 |
+
}
|
| 268 |
+
// Associate the user panel with the user data pointed to by p_UserData.
|
| 269 |
+
};
|
| 270 |
+
|
| 271 |
+
#endif /* NCURSES_CURSESP_H_incl */
|
emu3/include/ncursesw/cursesw.h
ADDED
|
@@ -0,0 +1,1581 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
// vile:cppmode
|
| 3 |
+
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2021,2022 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2014,2017 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
#ifndef NCURSES_CURSESW_H_incl
|
| 33 |
+
#define NCURSES_CURSESW_H_incl 1
|
| 34 |
+
|
| 35 |
+
// $Id: cursesw.h,v 1.59 2022/08/20 20:52:15 tom Exp $
|
| 36 |
+
|
| 37 |
+
extern "C" {
|
| 38 |
+
# include <ncursesw/curses.h>
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
#if defined(BUILDING_NCURSES_CXX)
|
| 42 |
+
# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 43 |
+
#else
|
| 44 |
+
# define NCURSES_CXX_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
#define NCURSES_CXX_WRAPPED_VAR(type,name) extern NCURSES_CXX_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 48 |
+
|
| 49 |
+
#define NCURSES_CXX_EXPORT(type) NCURSES_CXX_IMPEXP type NCURSES_API
|
| 50 |
+
#define NCURSES_CXX_EXPORT_VAR(type) NCURSES_CXX_IMPEXP type
|
| 51 |
+
|
| 52 |
+
#include <ncursesw/etip.h>
|
| 53 |
+
|
| 54 |
+
/* SCO 3.2v4 curses.h includes term.h, which defines lines as a macro.
|
| 55 |
+
Undefine it here, because NCursesWindow uses lines as a method. */
|
| 56 |
+
#undef lines
|
| 57 |
+
|
| 58 |
+
/* "Convert" macros to inlines. We'll define it as another symbol to avoid
|
| 59 |
+
* conflict with library symbols.
|
| 60 |
+
*/
|
| 61 |
+
#undef UNDEF
|
| 62 |
+
#define UNDEF(name) CUR_ ##name
|
| 63 |
+
|
| 64 |
+
#ifdef addch
|
| 65 |
+
inline int UNDEF(addch)(chtype ch) { return addch(ch); }
|
| 66 |
+
#undef addch
|
| 67 |
+
#define addch UNDEF(addch)
|
| 68 |
+
#endif
|
| 69 |
+
|
| 70 |
+
#ifdef addchstr
|
| 71 |
+
inline int UNDEF(addchstr)(chtype *at) { return addchstr(at); }
|
| 72 |
+
#undef addchstr
|
| 73 |
+
#define addchstr UNDEF(addchstr)
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#ifdef addnstr
|
| 77 |
+
inline int UNDEF(addnstr)(const char *str, int n)
|
| 78 |
+
{ return addnstr(str, n); }
|
| 79 |
+
#undef addnstr
|
| 80 |
+
#define addnstr UNDEF(addnstr)
|
| 81 |
+
#endif
|
| 82 |
+
|
| 83 |
+
#ifdef addstr
|
| 84 |
+
inline int UNDEF(addstr)(const char * str) { return addstr(str); }
|
| 85 |
+
#undef addstr
|
| 86 |
+
#define addstr UNDEF(addstr)
|
| 87 |
+
#endif
|
| 88 |
+
|
| 89 |
+
#ifdef attroff
|
| 90 |
+
inline int UNDEF(attroff)(chtype at) { return attroff(at); }
|
| 91 |
+
#undef attroff
|
| 92 |
+
#define attroff UNDEF(attroff)
|
| 93 |
+
#endif
|
| 94 |
+
|
| 95 |
+
#ifdef attron
|
| 96 |
+
inline int UNDEF(attron)(chtype at) { return attron(at); }
|
| 97 |
+
#undef attron
|
| 98 |
+
#define attron UNDEF(attron)
|
| 99 |
+
#endif
|
| 100 |
+
|
| 101 |
+
#ifdef attrset
|
| 102 |
+
inline chtype UNDEF(attrset)(chtype at) { return attrset(at); }
|
| 103 |
+
#undef attrset
|
| 104 |
+
#define attrset UNDEF(attrset)
|
| 105 |
+
#endif
|
| 106 |
+
|
| 107 |
+
#ifdef bkgd
|
| 108 |
+
inline int UNDEF(bkgd)(chtype ch) { return bkgd(ch); }
|
| 109 |
+
#undef bkgd
|
| 110 |
+
#define bkgd UNDEF(bkgd)
|
| 111 |
+
#endif
|
| 112 |
+
|
| 113 |
+
#ifdef bkgdset
|
| 114 |
+
inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); }
|
| 115 |
+
#undef bkgdset
|
| 116 |
+
#define bkgdset UNDEF(bkgdset)
|
| 117 |
+
#endif
|
| 118 |
+
|
| 119 |
+
#ifdef border
|
| 120 |
+
inline int UNDEF(border)(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
|
| 121 |
+
{ return border(ls, rs, ts, bs, tl, tr, bl, br); }
|
| 122 |
+
#undef border
|
| 123 |
+
#define border UNDEF(border)
|
| 124 |
+
#endif
|
| 125 |
+
|
| 126 |
+
#ifdef box
|
| 127 |
+
inline int UNDEF(box)(WINDOW *win, int v, int h) { return box(win, v, h); }
|
| 128 |
+
#undef box
|
| 129 |
+
#define box UNDEF(box)
|
| 130 |
+
#endif
|
| 131 |
+
|
| 132 |
+
#ifdef chgat
|
| 133 |
+
inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
|
| 134 |
+
return chgat(n, attr, color, opts); }
|
| 135 |
+
#undef chgat
|
| 136 |
+
#define chgat UNDEF(chgat)
|
| 137 |
+
#endif
|
| 138 |
+
|
| 139 |
+
#ifdef clear
|
| 140 |
+
inline int UNDEF(clear)() { return clear(); }
|
| 141 |
+
#undef clear
|
| 142 |
+
#define clear UNDEF(clear)
|
| 143 |
+
#endif
|
| 144 |
+
|
| 145 |
+
#ifdef clearok
|
| 146 |
+
inline int UNDEF(clearok)(WINDOW* win, bool bf) { return clearok(win, bf); }
|
| 147 |
+
#undef clearok
|
| 148 |
+
#define clearok UNDEF(clearok)
|
| 149 |
+
#else
|
| 150 |
+
extern "C" NCURSES_IMPEXP int NCURSES_API clearok(WINDOW*, bool);
|
| 151 |
+
#endif
|
| 152 |
+
|
| 153 |
+
#ifdef clrtobot
|
| 154 |
+
inline int UNDEF(clrtobot)() { return clrtobot(); }
|
| 155 |
+
#undef clrtobot
|
| 156 |
+
#define clrtobot UNDEF(clrtobot)
|
| 157 |
+
#endif
|
| 158 |
+
|
| 159 |
+
#ifdef clrtoeol
|
| 160 |
+
inline int UNDEF(clrtoeol)() { return clrtoeol(); }
|
| 161 |
+
#undef clrtoeol
|
| 162 |
+
#define clrtoeol UNDEF(clrtoeol)
|
| 163 |
+
#endif
|
| 164 |
+
|
| 165 |
+
#ifdef color_set
|
| 166 |
+
inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
|
| 167 |
+
#undef color_set
|
| 168 |
+
#define color_set UNDEF(color_set)
|
| 169 |
+
#endif
|
| 170 |
+
|
| 171 |
+
#ifdef crmode
|
| 172 |
+
inline int UNDEF(crmode)(void) { return crmode(); }
|
| 173 |
+
#undef crmode
|
| 174 |
+
#define crmode UNDEF(crmode)
|
| 175 |
+
#endif
|
| 176 |
+
|
| 177 |
+
#ifdef delch
|
| 178 |
+
inline int UNDEF(delch)() { return delch(); }
|
| 179 |
+
#undef delch
|
| 180 |
+
#define delch UNDEF(delch)
|
| 181 |
+
#endif
|
| 182 |
+
|
| 183 |
+
#ifdef deleteln
|
| 184 |
+
inline int UNDEF(deleteln)() { return deleteln(); }
|
| 185 |
+
#undef deleteln
|
| 186 |
+
#define deleteln UNDEF(deleteln)
|
| 187 |
+
#endif
|
| 188 |
+
|
| 189 |
+
#ifdef echochar
|
| 190 |
+
inline int UNDEF(echochar)(chtype ch) { return echochar(ch); }
|
| 191 |
+
#undef echochar
|
| 192 |
+
#define echochar UNDEF(echochar)
|
| 193 |
+
#endif
|
| 194 |
+
|
| 195 |
+
#ifdef erase
|
| 196 |
+
inline int UNDEF(erase)() { return erase(); }
|
| 197 |
+
#undef erase
|
| 198 |
+
#define erase UNDEF(erase)
|
| 199 |
+
#endif
|
| 200 |
+
|
| 201 |
+
#ifdef fixterm
|
| 202 |
+
inline int UNDEF(fixterm)(void) { return fixterm(); }
|
| 203 |
+
#undef fixterm
|
| 204 |
+
#define fixterm UNDEF(fixterm)
|
| 205 |
+
#endif
|
| 206 |
+
|
| 207 |
+
#ifdef flushok
|
| 208 |
+
inline int UNDEF(flushok)(WINDOW* _win, bool _bf) {
|
| 209 |
+
return flushok(_win, _bf); }
|
| 210 |
+
#undef flushok
|
| 211 |
+
#define flushok UNDEF(flushok)
|
| 212 |
+
#else
|
| 213 |
+
#define _no_flushok
|
| 214 |
+
#endif
|
| 215 |
+
|
| 216 |
+
#ifdef getattrs
|
| 217 |
+
inline int UNDEF(getattrs)(WINDOW *win) { return getattrs(win); }
|
| 218 |
+
#undef getattrs
|
| 219 |
+
#define getattrs UNDEF(getattrs)
|
| 220 |
+
#endif
|
| 221 |
+
|
| 222 |
+
#ifdef getbegyx
|
| 223 |
+
inline void UNDEF(getbegyx)(WINDOW* win, int& y, int& x) { getbegyx(win, y, x); }
|
| 224 |
+
#undef getbegyx
|
| 225 |
+
#define getbegyx UNDEF(getbegyx)
|
| 226 |
+
#endif
|
| 227 |
+
|
| 228 |
+
#ifdef getbkgd
|
| 229 |
+
inline chtype UNDEF(getbkgd)(const WINDOW *win) { return getbkgd(win); }
|
| 230 |
+
#undef getbkgd
|
| 231 |
+
#define getbkgd UNDEF(getbkgd)
|
| 232 |
+
#endif
|
| 233 |
+
|
| 234 |
+
#ifdef getch
|
| 235 |
+
inline int UNDEF(getch)() { return getch(); }
|
| 236 |
+
#undef getch
|
| 237 |
+
#define getch UNDEF(getch)
|
| 238 |
+
#endif
|
| 239 |
+
|
| 240 |
+
#ifdef getmaxyx
|
| 241 |
+
inline void UNDEF(getmaxyx)(WINDOW* win, int& y, int& x) { getmaxyx(win, y, x); }
|
| 242 |
+
#undef getmaxyx
|
| 243 |
+
#define getmaxyx UNDEF(getmaxyx)
|
| 244 |
+
#endif
|
| 245 |
+
|
| 246 |
+
#ifdef getnstr
|
| 247 |
+
inline int UNDEF(getnstr)(char *_str, int n) { return getnstr(_str, n); }
|
| 248 |
+
#undef getnstr
|
| 249 |
+
#define getnstr UNDEF(getnstr)
|
| 250 |
+
#endif
|
| 251 |
+
|
| 252 |
+
#ifdef getparyx
|
| 253 |
+
inline void UNDEF(getparyx)(WINDOW* win, int& y, int& x) { getparyx(win, y, x); }
|
| 254 |
+
#undef getparyx
|
| 255 |
+
#define getparyx UNDEF(getparyx)
|
| 256 |
+
#endif
|
| 257 |
+
|
| 258 |
+
#ifdef getstr
|
| 259 |
+
inline int UNDEF(getstr)(char *_str) { return getstr(_str); }
|
| 260 |
+
#undef getstr
|
| 261 |
+
#define getstr UNDEF(getstr)
|
| 262 |
+
#endif
|
| 263 |
+
|
| 264 |
+
#ifdef getyx
|
| 265 |
+
inline void UNDEF(getyx)(const WINDOW* win, int& y, int& x) {
|
| 266 |
+
getyx(win, y, x); }
|
| 267 |
+
#undef getyx
|
| 268 |
+
#define getyx UNDEF(getyx)
|
| 269 |
+
#endif
|
| 270 |
+
|
| 271 |
+
#ifdef hline
|
| 272 |
+
inline int UNDEF(hline)(chtype ch, int n) { return hline(ch, n); }
|
| 273 |
+
#undef hline
|
| 274 |
+
#define hline UNDEF(hline)
|
| 275 |
+
#endif
|
| 276 |
+
|
| 277 |
+
#ifdef inch
|
| 278 |
+
inline chtype UNDEF(inch)() { return inch(); }
|
| 279 |
+
#undef inch
|
| 280 |
+
#define inch UNDEF(inch)
|
| 281 |
+
#endif
|
| 282 |
+
|
| 283 |
+
#ifdef inchstr
|
| 284 |
+
inline int UNDEF(inchstr)(chtype *str) { return inchstr(str); }
|
| 285 |
+
#undef inchstr
|
| 286 |
+
#define inchstr UNDEF(inchstr)
|
| 287 |
+
#endif
|
| 288 |
+
|
| 289 |
+
#ifdef innstr
|
| 290 |
+
inline int UNDEF(innstr)(char *_str, int n) { return innstr(_str, n); }
|
| 291 |
+
#undef innstr
|
| 292 |
+
#define innstr UNDEF(innstr)
|
| 293 |
+
#endif
|
| 294 |
+
|
| 295 |
+
#ifdef insch
|
| 296 |
+
inline int UNDEF(insch)(chtype c) { return insch(c); }
|
| 297 |
+
#undef insch
|
| 298 |
+
#define insch UNDEF(insch)
|
| 299 |
+
#endif
|
| 300 |
+
|
| 301 |
+
#ifdef insdelln
|
| 302 |
+
inline int UNDEF(insdelln)(int n) { return insdelln(n); }
|
| 303 |
+
#undef insdelln
|
| 304 |
+
#define insdelln UNDEF(insdelln)
|
| 305 |
+
#endif
|
| 306 |
+
|
| 307 |
+
#ifdef insertln
|
| 308 |
+
inline int UNDEF(insertln)() { return insertln(); }
|
| 309 |
+
#undef insertln
|
| 310 |
+
#define insertln UNDEF(insertln)
|
| 311 |
+
#endif
|
| 312 |
+
|
| 313 |
+
#ifdef insnstr
|
| 314 |
+
inline int UNDEF(insnstr)(const char *_str, int n) {
|
| 315 |
+
return insnstr(_str, n); }
|
| 316 |
+
#undef insnstr
|
| 317 |
+
#define insnstr UNDEF(insnstr)
|
| 318 |
+
#endif
|
| 319 |
+
|
| 320 |
+
#ifdef insstr
|
| 321 |
+
inline int UNDEF(insstr)(const char *_str) {
|
| 322 |
+
return insstr(_str); }
|
| 323 |
+
#undef insstr
|
| 324 |
+
#define insstr UNDEF(insstr)
|
| 325 |
+
#endif
|
| 326 |
+
|
| 327 |
+
#ifdef instr
|
| 328 |
+
inline int UNDEF(instr)(char *_str) { return instr(_str); }
|
| 329 |
+
#undef instr
|
| 330 |
+
#define instr UNDEF(instr)
|
| 331 |
+
#endif
|
| 332 |
+
|
| 333 |
+
#ifdef intrflush
|
| 334 |
+
inline void UNDEF(intrflush)(WINDOW *win, bool bf) { intrflush(); }
|
| 335 |
+
#undef intrflush
|
| 336 |
+
#define intrflush UNDEF(intrflush)
|
| 337 |
+
#endif
|
| 338 |
+
|
| 339 |
+
#ifdef is_linetouched
|
| 340 |
+
inline int UNDEF(is_linetouched)(WINDOW *w, int l) { return is_linetouched(w,l); }
|
| 341 |
+
#undef is_linetouched
|
| 342 |
+
#define is_linetouched UNDEF(is_linetouched)
|
| 343 |
+
#endif
|
| 344 |
+
|
| 345 |
+
#ifdef leaveok
|
| 346 |
+
inline int UNDEF(leaveok)(WINDOW* win, bool bf) { return leaveok(win, bf); }
|
| 347 |
+
#undef leaveok
|
| 348 |
+
#define leaveok UNDEF(leaveok)
|
| 349 |
+
#else
|
| 350 |
+
extern "C" NCURSES_IMPEXP int NCURSES_API leaveok(WINDOW* win, bool bf);
|
| 351 |
+
#endif
|
| 352 |
+
|
| 353 |
+
#ifdef move
|
| 354 |
+
inline int UNDEF(move)(int x, int y) { return move(x, y); }
|
| 355 |
+
#undef move
|
| 356 |
+
#define move UNDEF(move)
|
| 357 |
+
#endif
|
| 358 |
+
|
| 359 |
+
#ifdef mvaddch
|
| 360 |
+
inline int UNDEF(mvaddch)(int y, int x, chtype ch)
|
| 361 |
+
{ return mvaddch(y, x, ch); }
|
| 362 |
+
#undef mvaddch
|
| 363 |
+
#define mvaddch UNDEF(mvaddch)
|
| 364 |
+
#endif
|
| 365 |
+
|
| 366 |
+
#ifdef mvaddnstr
|
| 367 |
+
inline int UNDEF(mvaddnstr)(int y, int x, const char *str, int n)
|
| 368 |
+
{ return mvaddnstr(y, x, str, n); }
|
| 369 |
+
#undef mvaddnstr
|
| 370 |
+
#define mvaddnstr UNDEF(mvaddnstr)
|
| 371 |
+
#endif
|
| 372 |
+
|
| 373 |
+
#ifdef mvaddstr
|
| 374 |
+
inline int UNDEF(mvaddstr)(int y, int x, const char * str)
|
| 375 |
+
{ return mvaddstr(y, x, str); }
|
| 376 |
+
#undef mvaddstr
|
| 377 |
+
#define mvaddstr UNDEF(mvaddstr)
|
| 378 |
+
#endif
|
| 379 |
+
|
| 380 |
+
#ifdef mvchgat
|
| 381 |
+
inline int UNDEF(mvchgat)(int y, int x, int n,
|
| 382 |
+
attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
|
| 383 |
+
return mvchgat(y, x, n, attr, color, opts); }
|
| 384 |
+
#undef mvchgat
|
| 385 |
+
#define mvchgat UNDEF(mvchgat)
|
| 386 |
+
#endif
|
| 387 |
+
|
| 388 |
+
#ifdef mvdelch
|
| 389 |
+
inline int UNDEF(mvdelch)(int y, int x) { return mvdelch(y, x);}
|
| 390 |
+
#undef mvdelch
|
| 391 |
+
#define mvdelch UNDEF(mvdelch)
|
| 392 |
+
#endif
|
| 393 |
+
|
| 394 |
+
#ifdef mvgetch
|
| 395 |
+
inline int UNDEF(mvgetch)(int y, int x) { return mvgetch(y, x);}
|
| 396 |
+
#undef mvgetch
|
| 397 |
+
#define mvgetch UNDEF(mvgetch)
|
| 398 |
+
#endif
|
| 399 |
+
|
| 400 |
+
#ifdef mvgetnstr
|
| 401 |
+
inline int UNDEF(mvgetnstr)(int y, int x, char *str, int n) {
|
| 402 |
+
return mvgetnstr(y, x, str, n);}
|
| 403 |
+
#undef mvgetnstr
|
| 404 |
+
#define mvgetnstr UNDEF(mvgetnstr)
|
| 405 |
+
#endif
|
| 406 |
+
|
| 407 |
+
#ifdef mvgetstr
|
| 408 |
+
inline int UNDEF(mvgetstr)(int y, int x, char *str) {return mvgetstr(y, x, str);}
|
| 409 |
+
#undef mvgetstr
|
| 410 |
+
#define mvgetstr UNDEF(mvgetstr)
|
| 411 |
+
#endif
|
| 412 |
+
|
| 413 |
+
#ifdef mvinch
|
| 414 |
+
inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);}
|
| 415 |
+
#undef mvinch
|
| 416 |
+
#define mvinch UNDEF(mvinch)
|
| 417 |
+
#endif
|
| 418 |
+
|
| 419 |
+
#ifdef mvinnstr
|
| 420 |
+
inline int UNDEF(mvinnstr)(int y, int x, char *_str, int n) {
|
| 421 |
+
return mvinnstr(y, x, _str, n); }
|
| 422 |
+
#undef mvinnstr
|
| 423 |
+
#define mvinnstr UNDEF(mvinnstr)
|
| 424 |
+
#endif
|
| 425 |
+
|
| 426 |
+
#ifdef mvinsch
|
| 427 |
+
inline int UNDEF(mvinsch)(int y, int x, chtype c)
|
| 428 |
+
{ return mvinsch(y, x, c); }
|
| 429 |
+
#undef mvinsch
|
| 430 |
+
#define mvinsch UNDEF(mvinsch)
|
| 431 |
+
#endif
|
| 432 |
+
|
| 433 |
+
#ifdef mvinsnstr
|
| 434 |
+
inline int UNDEF(mvinsnstr)(int y, int x, const char *_str, int n) {
|
| 435 |
+
return mvinsnstr(y, x, _str, n); }
|
| 436 |
+
#undef mvinsnstr
|
| 437 |
+
#define mvinsnstr UNDEF(mvinsnstr)
|
| 438 |
+
#endif
|
| 439 |
+
|
| 440 |
+
#ifdef mvinsstr
|
| 441 |
+
inline int UNDEF(mvinsstr)(int y, int x, const char *_str) {
|
| 442 |
+
return mvinsstr(y, x, _str); }
|
| 443 |
+
#undef mvinsstr
|
| 444 |
+
#define mvinsstr UNDEF(mvinsstr)
|
| 445 |
+
#endif
|
| 446 |
+
|
| 447 |
+
#ifdef mvwaddch
|
| 448 |
+
inline int UNDEF(mvwaddch)(WINDOW *win, int y, int x, const chtype ch)
|
| 449 |
+
{ return mvwaddch(win, y, x, ch); }
|
| 450 |
+
#undef mvwaddch
|
| 451 |
+
#define mvwaddch UNDEF(mvwaddch)
|
| 452 |
+
#endif
|
| 453 |
+
|
| 454 |
+
#ifdef mvwaddchnstr
|
| 455 |
+
inline int UNDEF(mvwaddchnstr)(WINDOW *win, int y, int x, const chtype *str, int n)
|
| 456 |
+
{ return mvwaddchnstr(win, y, x, str, n); }
|
| 457 |
+
#undef mvwaddchnstr
|
| 458 |
+
#define mvwaddchnstr UNDEF(mvwaddchnstr)
|
| 459 |
+
#endif
|
| 460 |
+
|
| 461 |
+
#ifdef mvwaddchstr
|
| 462 |
+
inline int UNDEF(mvwaddchstr)(WINDOW *win, int y, int x, const chtype *str)
|
| 463 |
+
{ return mvwaddchstr(win, y, x, str); }
|
| 464 |
+
#undef mvwaddchstr
|
| 465 |
+
#define mvwaddchstr UNDEF(mvwaddchstr)
|
| 466 |
+
#endif
|
| 467 |
+
|
| 468 |
+
#ifdef mvwaddnstr
|
| 469 |
+
inline int UNDEF(mvwaddnstr)(WINDOW *win, int y, int x, const char *str, int n)
|
| 470 |
+
{ return mvwaddnstr(win, y, x, str, n); }
|
| 471 |
+
#undef mvwaddnstr
|
| 472 |
+
#define mvwaddnstr UNDEF(mvwaddnstr)
|
| 473 |
+
#endif
|
| 474 |
+
|
| 475 |
+
#ifdef mvwaddstr
|
| 476 |
+
inline int UNDEF(mvwaddstr)(WINDOW *win, int y, int x, const char * str)
|
| 477 |
+
{ return mvwaddstr(win, y, x, str); }
|
| 478 |
+
#undef mvwaddstr
|
| 479 |
+
#define mvwaddstr UNDEF(mvwaddstr)
|
| 480 |
+
#endif
|
| 481 |
+
|
| 482 |
+
#ifdef mvwchgat
|
| 483 |
+
inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
|
| 484 |
+
attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
|
| 485 |
+
return mvwchgat(win, y, x, n, attr, color, opts); }
|
| 486 |
+
#undef mvwchgat
|
| 487 |
+
#define mvwchgat UNDEF(mvwchgat)
|
| 488 |
+
#endif
|
| 489 |
+
|
| 490 |
+
#ifdef mvwdelch
|
| 491 |
+
inline int UNDEF(mvwdelch)(WINDOW *win, int y, int x)
|
| 492 |
+
{ return mvwdelch(win, y, x); }
|
| 493 |
+
#undef mvwdelch
|
| 494 |
+
#define mvwdelch UNDEF(mvwdelch)
|
| 495 |
+
#endif
|
| 496 |
+
|
| 497 |
+
#ifdef mvwgetch
|
| 498 |
+
inline int UNDEF(mvwgetch)(WINDOW *win, int y, int x) { return mvwgetch(win, y, x);}
|
| 499 |
+
#undef mvwgetch
|
| 500 |
+
#define mvwgetch UNDEF(mvwgetch)
|
| 501 |
+
#endif
|
| 502 |
+
|
| 503 |
+
#ifdef mvwgetnstr
|
| 504 |
+
inline int UNDEF(mvwgetnstr)(WINDOW *win, int y, int x, char *str, int n)
|
| 505 |
+
{return mvwgetnstr(win, y, x, str, n);}
|
| 506 |
+
#undef mvwgetnstr
|
| 507 |
+
#define mvwgetnstr UNDEF(mvwgetnstr)
|
| 508 |
+
#endif
|
| 509 |
+
|
| 510 |
+
#ifdef mvwgetstr
|
| 511 |
+
inline int UNDEF(mvwgetstr)(WINDOW *win, int y, int x, char *str)
|
| 512 |
+
{return mvwgetstr(win, y, x, str);}
|
| 513 |
+
#undef mvwgetstr
|
| 514 |
+
#define mvwgetstr UNDEF(mvwgetstr)
|
| 515 |
+
#endif
|
| 516 |
+
|
| 517 |
+
#ifdef mvwhline
|
| 518 |
+
inline int UNDEF(mvwhline)(WINDOW *win, int y, int x, chtype c, int n) {
|
| 519 |
+
return mvwhline(win, y, x, c, n); }
|
| 520 |
+
#undef mvwhline
|
| 521 |
+
#define mvwhline UNDEF(mvwhline)
|
| 522 |
+
#endif
|
| 523 |
+
|
| 524 |
+
#ifdef mvwinch
|
| 525 |
+
inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) {
|
| 526 |
+
return mvwinch(win, y, x);}
|
| 527 |
+
#undef mvwinch
|
| 528 |
+
#define mvwinch UNDEF(mvwinch)
|
| 529 |
+
#endif
|
| 530 |
+
|
| 531 |
+
#ifdef mvwinchnstr
|
| 532 |
+
inline int UNDEF(mvwinchnstr)(WINDOW *win, int y, int x, chtype *str, int n) { return mvwinchnstr(win, y, x, str, n); }
|
| 533 |
+
#undef mvwinchnstr
|
| 534 |
+
#define mvwinchnstr UNDEF(mvwinchnstr)
|
| 535 |
+
#endif
|
| 536 |
+
|
| 537 |
+
#ifdef mvwinchstr
|
| 538 |
+
inline int UNDEF(mvwinchstr)(WINDOW *win, int y, int x, chtype *str) { return mvwinchstr(win, y, x, str); }
|
| 539 |
+
#undef mvwinchstr
|
| 540 |
+
#define mvwinchstr UNDEF(mvwinchstr)
|
| 541 |
+
#endif
|
| 542 |
+
|
| 543 |
+
#ifdef mvwinnstr
|
| 544 |
+
inline int UNDEF(mvwinnstr)(WINDOW *win, int y, int x, char *_str, int n) {
|
| 545 |
+
return mvwinnstr(win, y, x, _str, n); }
|
| 546 |
+
#undef mvwinnstr
|
| 547 |
+
#define mvwinnstr UNDEF(mvwinnstr)
|
| 548 |
+
#endif
|
| 549 |
+
|
| 550 |
+
#ifdef mvwinsch
|
| 551 |
+
inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c)
|
| 552 |
+
{ return mvwinsch(win, y, x, c); }
|
| 553 |
+
#undef mvwinsch
|
| 554 |
+
#define mvwinsch UNDEF(mvwinsch)
|
| 555 |
+
#endif
|
| 556 |
+
|
| 557 |
+
#ifdef mvwinsnstr
|
| 558 |
+
inline int UNDEF(mvwinsnstr)(WINDOW *w, int y, int x, const char *_str, int n) {
|
| 559 |
+
return mvwinsnstr(w, y, x, _str, n); }
|
| 560 |
+
#undef mvwinsnstr
|
| 561 |
+
#define mvwinsnstr UNDEF(mvwinsnstr)
|
| 562 |
+
#endif
|
| 563 |
+
|
| 564 |
+
#ifdef mvwinsstr
|
| 565 |
+
inline int UNDEF(mvwinsstr)(WINDOW *w, int y, int x, const char *_str) {
|
| 566 |
+
return mvwinsstr(w, y, x, _str); }
|
| 567 |
+
#undef mvwinsstr
|
| 568 |
+
#define mvwinsstr UNDEF(mvwinsstr)
|
| 569 |
+
#endif
|
| 570 |
+
|
| 571 |
+
#ifdef mvwvline
|
| 572 |
+
inline int UNDEF(mvwvline)(WINDOW *win, int y, int x, chtype c, int n) {
|
| 573 |
+
return mvwvline(win, y, x, c, n); }
|
| 574 |
+
#undef mvwvline
|
| 575 |
+
#define mvwvline UNDEF(mvwvline)
|
| 576 |
+
#endif
|
| 577 |
+
|
| 578 |
+
#ifdef napms
|
| 579 |
+
inline void UNDEF(napms)(unsigned long x) { napms(x); }
|
| 580 |
+
#undef napms
|
| 581 |
+
#define napms UNDEF(napms)
|
| 582 |
+
#endif
|
| 583 |
+
|
| 584 |
+
#ifdef nocrmode
|
| 585 |
+
inline int UNDEF(nocrmode)(void) { return nocrmode(); }
|
| 586 |
+
#undef nocrmode
|
| 587 |
+
#define nocrmode UNDEF(nocrmode)
|
| 588 |
+
#endif
|
| 589 |
+
|
| 590 |
+
#ifdef nodelay
|
| 591 |
+
inline void UNDEF(nodelay)() { nodelay(); }
|
| 592 |
+
#undef nodelay
|
| 593 |
+
#define nodelay UNDEF(nodelay)
|
| 594 |
+
#endif
|
| 595 |
+
|
| 596 |
+
#ifdef redrawwin
|
| 597 |
+
inline int UNDEF(redrawwin)(WINDOW *win) { return redrawwin(win); }
|
| 598 |
+
#undef redrawwin
|
| 599 |
+
#define redrawwin UNDEF(redrawwin)
|
| 600 |
+
#endif
|
| 601 |
+
|
| 602 |
+
#ifdef refresh
|
| 603 |
+
inline int UNDEF(refresh)() { return refresh(); }
|
| 604 |
+
#undef refresh
|
| 605 |
+
#define refresh UNDEF(refresh)
|
| 606 |
+
#endif
|
| 607 |
+
|
| 608 |
+
#ifdef resetterm
|
| 609 |
+
inline int UNDEF(resetterm)(void) { return resetterm(); }
|
| 610 |
+
#undef resetterm
|
| 611 |
+
#define resetterm UNDEF(resetterm)
|
| 612 |
+
#endif
|
| 613 |
+
|
| 614 |
+
#ifdef saveterm
|
| 615 |
+
inline int UNDEF(saveterm)(void) { return saveterm(); }
|
| 616 |
+
#undef saveterm
|
| 617 |
+
#define saveterm UNDEF(saveterm)
|
| 618 |
+
#endif
|
| 619 |
+
|
| 620 |
+
#ifdef scrl
|
| 621 |
+
inline int UNDEF(scrl)(int l) { return scrl(l); }
|
| 622 |
+
#undef scrl
|
| 623 |
+
#define scrl UNDEF(scrl)
|
| 624 |
+
#endif
|
| 625 |
+
|
| 626 |
+
#ifdef scroll
|
| 627 |
+
inline int UNDEF(scroll)(WINDOW *win) { return scroll(win); }
|
| 628 |
+
#undef scroll
|
| 629 |
+
#define scroll UNDEF(scroll)
|
| 630 |
+
#endif
|
| 631 |
+
|
| 632 |
+
#ifdef scrollok
|
| 633 |
+
inline int UNDEF(scrollok)(WINDOW* win, bool bf) { return scrollok(win, bf); }
|
| 634 |
+
#undef scrollok
|
| 635 |
+
#define scrollok UNDEF(scrollok)
|
| 636 |
+
#else
|
| 637 |
+
#if defined(__NCURSES_H)
|
| 638 |
+
extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, bool);
|
| 639 |
+
#else
|
| 640 |
+
extern "C" NCURSES_IMPEXP int NCURSES_API scrollok(WINDOW*, char);
|
| 641 |
+
#endif
|
| 642 |
+
#endif
|
| 643 |
+
|
| 644 |
+
#ifdef setscrreg
|
| 645 |
+
inline int UNDEF(setscrreg)(int t, int b) { return setscrreg(t, b); }
|
| 646 |
+
#undef setscrreg
|
| 647 |
+
#define setscrreg UNDEF(setscrreg)
|
| 648 |
+
#endif
|
| 649 |
+
|
| 650 |
+
#ifdef standend
|
| 651 |
+
inline int UNDEF(standend)() { return standend(); }
|
| 652 |
+
#undef standend
|
| 653 |
+
#define standend UNDEF(standend)
|
| 654 |
+
#endif
|
| 655 |
+
|
| 656 |
+
#ifdef standout
|
| 657 |
+
inline int UNDEF(standout)() { return standout(); }
|
| 658 |
+
#undef standout
|
| 659 |
+
#define standout UNDEF(standout)
|
| 660 |
+
#endif
|
| 661 |
+
|
| 662 |
+
#ifdef subpad
|
| 663 |
+
inline WINDOW *UNDEF(subpad)(WINDOW *p, int l, int c, int y, int x)
|
| 664 |
+
{ return derwin(p, l, c, y, x); }
|
| 665 |
+
#undef subpad
|
| 666 |
+
#define subpad UNDEF(subpad)
|
| 667 |
+
#endif
|
| 668 |
+
|
| 669 |
+
#ifdef timeout
|
| 670 |
+
inline void UNDEF(timeout)(int delay) { timeout(delay); }
|
| 671 |
+
#undef timeout
|
| 672 |
+
#define timeout UNDEF(timeout)
|
| 673 |
+
#endif
|
| 674 |
+
|
| 675 |
+
#ifdef touchline
|
| 676 |
+
inline int UNDEF(touchline)(WINDOW *win, int s, int c)
|
| 677 |
+
{ return touchline(win, s, c); }
|
| 678 |
+
#undef touchline
|
| 679 |
+
#define touchline UNDEF(touchline)
|
| 680 |
+
#endif
|
| 681 |
+
|
| 682 |
+
#ifdef touchwin
|
| 683 |
+
inline int UNDEF(touchwin)(WINDOW *win) { return touchwin(win); }
|
| 684 |
+
#undef touchwin
|
| 685 |
+
#define touchwin UNDEF(touchwin)
|
| 686 |
+
#endif
|
| 687 |
+
|
| 688 |
+
#ifdef untouchwin
|
| 689 |
+
inline int UNDEF(untouchwin)(WINDOW *win) { return untouchwin(win); }
|
| 690 |
+
#undef untouchwin
|
| 691 |
+
#define untouchwin UNDEF(untouchwin)
|
| 692 |
+
#endif
|
| 693 |
+
|
| 694 |
+
#ifdef vline
|
| 695 |
+
inline int UNDEF(vline)(chtype ch, int n) { return vline(ch, n); }
|
| 696 |
+
#undef vline
|
| 697 |
+
#define vline UNDEF(vline)
|
| 698 |
+
#endif
|
| 699 |
+
|
| 700 |
+
#ifdef waddchstr
|
| 701 |
+
inline int UNDEF(waddchstr)(WINDOW *win, chtype *at) { return waddchstr(win, at); }
|
| 702 |
+
#undef waddchstr
|
| 703 |
+
#define waddchstr UNDEF(waddchstr)
|
| 704 |
+
#endif
|
| 705 |
+
|
| 706 |
+
#ifdef waddstr
|
| 707 |
+
inline int UNDEF(waddstr)(WINDOW *win, char *str) { return waddstr(win, str); }
|
| 708 |
+
#undef waddstr
|
| 709 |
+
#define waddstr UNDEF(waddstr)
|
| 710 |
+
#endif
|
| 711 |
+
|
| 712 |
+
#ifdef wattroff
|
| 713 |
+
inline int UNDEF(wattroff)(WINDOW *win, int att) { return wattroff(win, att); }
|
| 714 |
+
#undef wattroff
|
| 715 |
+
#define wattroff UNDEF(wattroff)
|
| 716 |
+
#endif
|
| 717 |
+
|
| 718 |
+
#ifdef wattrset
|
| 719 |
+
inline int UNDEF(wattrset)(WINDOW *win, int att) { return wattrset(win, att); }
|
| 720 |
+
#undef wattrset
|
| 721 |
+
#define wattrset UNDEF(wattrset)
|
| 722 |
+
#endif
|
| 723 |
+
|
| 724 |
+
#ifdef winch
|
| 725 |
+
inline chtype UNDEF(winch)(const WINDOW* win) { return winch(win); }
|
| 726 |
+
#undef winch
|
| 727 |
+
#define winch UNDEF(winch)
|
| 728 |
+
#endif
|
| 729 |
+
|
| 730 |
+
#ifdef winchnstr
|
| 731 |
+
inline int UNDEF(winchnstr)(WINDOW *win, chtype *str, int n) { return winchnstr(win, str, n); }
|
| 732 |
+
#undef winchnstr
|
| 733 |
+
#define winchnstr UNDEF(winchnstr)
|
| 734 |
+
#endif
|
| 735 |
+
|
| 736 |
+
#ifdef winchstr
|
| 737 |
+
inline int UNDEF(winchstr)(WINDOW *win, chtype *str) { return winchstr(win, str); }
|
| 738 |
+
#undef winchstr
|
| 739 |
+
#define winchstr UNDEF(winchstr)
|
| 740 |
+
#endif
|
| 741 |
+
|
| 742 |
+
#ifdef winsstr
|
| 743 |
+
inline int UNDEF(winsstr)(WINDOW *w, const char *_str) {
|
| 744 |
+
return winsstr(w, _str); }
|
| 745 |
+
#undef winsstr
|
| 746 |
+
#define winsstr UNDEF(winsstr)
|
| 747 |
+
#endif
|
| 748 |
+
|
| 749 |
+
#ifdef wstandend
|
| 750 |
+
inline int UNDEF(wstandend)(WINDOW *win) { return wstandend(win); }
|
| 751 |
+
#undef wstandend
|
| 752 |
+
#define wstandend UNDEF(wstandend)
|
| 753 |
+
#endif
|
| 754 |
+
|
| 755 |
+
#ifdef wstandout
|
| 756 |
+
inline int UNDEF(wstandout)(WINDOW *win) { return wstandout(win); }
|
| 757 |
+
#undef wstandout
|
| 758 |
+
#define wstandout UNDEF(wstandout)
|
| 759 |
+
#endif
|
| 760 |
+
|
| 761 |
+
/*
|
| 762 |
+
*
|
| 763 |
+
* C++ class for windows.
|
| 764 |
+
*
|
| 765 |
+
*/
|
| 766 |
+
|
| 767 |
+
extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int));
|
| 768 |
+
extern "C" int _nc_xx_ripoff_init(WINDOW *, int);
|
| 769 |
+
extern "C" int _nc_has_mouse(void);
|
| 770 |
+
|
| 771 |
+
class NCURSES_CXX_IMPEXP NCursesWindow
|
| 772 |
+
{
|
| 773 |
+
friend class NCursesMenu;
|
| 774 |
+
friend class NCursesForm;
|
| 775 |
+
|
| 776 |
+
private:
|
| 777 |
+
static bool b_initialized;
|
| 778 |
+
static void initialize();
|
| 779 |
+
void constructing();
|
| 780 |
+
friend int _nc_xx_ripoff_init(WINDOW *, int);
|
| 781 |
+
|
| 782 |
+
void set_keyboard();
|
| 783 |
+
|
| 784 |
+
NCURSES_COLOR_T getcolor(int getback) const;
|
| 785 |
+
NCURSES_PAIRS_T getPair() const;
|
| 786 |
+
|
| 787 |
+
static int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
|
| 788 |
+
static int colorInitialized;
|
| 789 |
+
|
| 790 |
+
// This private constructor is only used during the initialization
|
| 791 |
+
// of windows generated by ripoffline() calls.
|
| 792 |
+
NCursesWindow(WINDOW* win, int ncols);
|
| 793 |
+
|
| 794 |
+
protected:
|
| 795 |
+
virtual void err_handler(const char *) const THROWS(NCursesException);
|
| 796 |
+
// Signal an error with the given message text.
|
| 797 |
+
|
| 798 |
+
static long count; // count of all active windows:
|
| 799 |
+
// We rely on the c++ promise that
|
| 800 |
+
// all otherwise uninitialized
|
| 801 |
+
// static class vars are set to 0
|
| 802 |
+
|
| 803 |
+
WINDOW* w; // the curses WINDOW
|
| 804 |
+
|
| 805 |
+
bool alloced; // TRUE if we own the WINDOW
|
| 806 |
+
|
| 807 |
+
NCursesWindow* par; // parent, if subwindow
|
| 808 |
+
NCursesWindow* subwins; // head of subwindows list
|
| 809 |
+
NCursesWindow* sib; // next subwindow of parent
|
| 810 |
+
|
| 811 |
+
void kill_subwindows(); // disable all subwindows
|
| 812 |
+
// Destroy all subwindows.
|
| 813 |
+
|
| 814 |
+
/* Only for use by derived classes. They are then in charge to
|
| 815 |
+
fill the member variables correctly. */
|
| 816 |
+
NCursesWindow();
|
| 817 |
+
|
| 818 |
+
public:
|
| 819 |
+
explicit NCursesWindow(WINDOW* window); // useful only for stdscr
|
| 820 |
+
|
| 821 |
+
NCursesWindow(int nlines, // number of lines
|
| 822 |
+
int ncols, // number of columns
|
| 823 |
+
int begin_y, // line origin
|
| 824 |
+
int begin_x); // col origin
|
| 825 |
+
|
| 826 |
+
NCursesWindow(NCursesWindow& par,// parent window
|
| 827 |
+
int nlines, // number of lines
|
| 828 |
+
int ncols, // number of columns
|
| 829 |
+
int begin_y, // absolute or relative
|
| 830 |
+
int begin_x, // origins:
|
| 831 |
+
char absrel = 'a');// if `a', begin_y & begin_x are
|
| 832 |
+
// absolute screen pos, else if `r', they are relative to par origin
|
| 833 |
+
|
| 834 |
+
NCursesWindow(NCursesWindow& par,// parent window
|
| 835 |
+
bool do_box = TRUE);
|
| 836 |
+
// this is the very common case that we want to create the subwindow that
|
| 837 |
+
// is two lines and two columns smaller and begins at (1,1).
|
| 838 |
+
// We may automatically request the box around it.
|
| 839 |
+
|
| 840 |
+
NCursesWindow& operator=(const NCursesWindow& rhs)
|
| 841 |
+
{
|
| 842 |
+
if (this != &rhs)
|
| 843 |
+
*this = rhs;
|
| 844 |
+
return *this;
|
| 845 |
+
}
|
| 846 |
+
|
| 847 |
+
NCursesWindow(const NCursesWindow& rhs)
|
| 848 |
+
: w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib)
|
| 849 |
+
{
|
| 850 |
+
}
|
| 851 |
+
|
| 852 |
+
virtual ~NCursesWindow() THROWS(NCursesException);
|
| 853 |
+
|
| 854 |
+
NCursesWindow Clone();
|
| 855 |
+
// Make an exact copy of the window.
|
| 856 |
+
|
| 857 |
+
// Initialization.
|
| 858 |
+
static void useColors(void);
|
| 859 |
+
// Call this routine very early if you want to have colors.
|
| 860 |
+
|
| 861 |
+
static int ripoffline(int ripoff_lines,
|
| 862 |
+
int (*init)(NCursesWindow& win));
|
| 863 |
+
// This function is used to generate a window of ripped-of lines.
|
| 864 |
+
// If the argument is positive, lines are removed from the top, if it
|
| 865 |
+
// is negative lines are removed from the bottom. This enhances the
|
| 866 |
+
// lowlevel ripoffline() function because it uses the internal
|
| 867 |
+
// implementation that allows to remove more than just a single line.
|
| 868 |
+
// This function must be called before any other ncurses function. The
|
| 869 |
+
// creation of the window is deferred until ncurses gets initialized.
|
| 870 |
+
// The initialization function is then called.
|
| 871 |
+
|
| 872 |
+
// -------------------------------------------------------------------------
|
| 873 |
+
// terminal status
|
| 874 |
+
// -------------------------------------------------------------------------
|
| 875 |
+
int lines() const { initialize(); return LINES; }
|
| 876 |
+
// Number of lines on terminal, *not* window
|
| 877 |
+
|
| 878 |
+
int cols() const { initialize(); return COLS; }
|
| 879 |
+
// Number of cols on terminal, *not* window
|
| 880 |
+
|
| 881 |
+
int tabsize() const { initialize(); return TABSIZE; }
|
| 882 |
+
// Size of a tab on terminal, *not* window
|
| 883 |
+
|
| 884 |
+
static int NumberOfColors();
|
| 885 |
+
// Number of available colors
|
| 886 |
+
|
| 887 |
+
int colors() const { return NumberOfColors(); }
|
| 888 |
+
// Number of available colors
|
| 889 |
+
|
| 890 |
+
// -------------------------------------------------------------------------
|
| 891 |
+
// window status
|
| 892 |
+
// -------------------------------------------------------------------------
|
| 893 |
+
int height() const { return maxy() + 1; }
|
| 894 |
+
// Number of lines in this window
|
| 895 |
+
|
| 896 |
+
int width() const { return maxx() + 1; }
|
| 897 |
+
// Number of columns in this window
|
| 898 |
+
|
| 899 |
+
int begx() const { return getbegx(w); }
|
| 900 |
+
// Column of top left corner relative to stdscr
|
| 901 |
+
|
| 902 |
+
int begy() const { return getbegy(w); }
|
| 903 |
+
// Line of top left corner relative to stdscr
|
| 904 |
+
|
| 905 |
+
int curx() const { return getcurx(w); }
|
| 906 |
+
// Column of top left corner relative to stdscr
|
| 907 |
+
|
| 908 |
+
int cury() const { return getcury(w); }
|
| 909 |
+
// Line of top left corner relative to stdscr
|
| 910 |
+
|
| 911 |
+
int maxx() const { return getmaxx(w) == ERR ? ERR : getmaxx(w)-1; }
|
| 912 |
+
// Largest x coord in window
|
| 913 |
+
|
| 914 |
+
int maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
|
| 915 |
+
// Largest y coord in window
|
| 916 |
+
|
| 917 |
+
NCURSES_PAIRS_T getcolor() const;
|
| 918 |
+
// Actual color pair
|
| 919 |
+
|
| 920 |
+
NCURSES_COLOR_T foreground() const { return getcolor(0); }
|
| 921 |
+
// Actual foreground color
|
| 922 |
+
|
| 923 |
+
NCURSES_COLOR_T background() const { return getcolor(1); }
|
| 924 |
+
// Actual background color
|
| 925 |
+
|
| 926 |
+
int setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
|
| 927 |
+
// Set color palette entry
|
| 928 |
+
|
| 929 |
+
int setcolor(NCURSES_PAIRS_T pair);
|
| 930 |
+
// Set actually used palette entry
|
| 931 |
+
|
| 932 |
+
// -------------------------------------------------------------------------
|
| 933 |
+
// window positioning
|
| 934 |
+
// -------------------------------------------------------------------------
|
| 935 |
+
virtual int mvwin(int begin_y, int begin_x) {
|
| 936 |
+
return ::mvwin(w, begin_y, begin_x); }
|
| 937 |
+
// Move window to new position with the new position as top left corner.
|
| 938 |
+
// This is virtual because it is redefined in NCursesPanel.
|
| 939 |
+
|
| 940 |
+
// -------------------------------------------------------------------------
|
| 941 |
+
// coordinate positioning
|
| 942 |
+
// -------------------------------------------------------------------------
|
| 943 |
+
int move(int y, int x) { return ::wmove(w, y, x); }
|
| 944 |
+
// Move cursor the this position
|
| 945 |
+
|
| 946 |
+
void getyx(int& y, int& x) const { ::getyx(w, y, x); }
|
| 947 |
+
// Get current position of the cursor
|
| 948 |
+
|
| 949 |
+
void getbegyx(int& y, int& x) const { ::getbegyx(w, y, x); }
|
| 950 |
+
// Get beginning of the window
|
| 951 |
+
|
| 952 |
+
void getmaxyx(int& y, int& x) const { ::getmaxyx(w, y, x); }
|
| 953 |
+
// Get size of the window
|
| 954 |
+
|
| 955 |
+
void getparyx(int& y, int& x) const { ::getparyx(w, y, x); }
|
| 956 |
+
// Get parent's beginning of the window
|
| 957 |
+
|
| 958 |
+
int mvcur(int oldrow, int oldcol, int newrow, int newcol) const {
|
| 959 |
+
return ::mvcur(oldrow, oldcol, newrow, newcol); }
|
| 960 |
+
// Perform lowlevel cursor motion that takes effect immediately.
|
| 961 |
+
|
| 962 |
+
// -------------------------------------------------------------------------
|
| 963 |
+
// input
|
| 964 |
+
// -------------------------------------------------------------------------
|
| 965 |
+
int getch() { return ::wgetch(w); }
|
| 966 |
+
// Get a keystroke from the window.
|
| 967 |
+
|
| 968 |
+
int getch(int y, int x) { return ::mvwgetch(w, y, x); }
|
| 969 |
+
// Move cursor to position and get a keystroke from the window
|
| 970 |
+
|
| 971 |
+
int getstr(char* str, int n=-1) {
|
| 972 |
+
return ::wgetnstr(w, str, n); }
|
| 973 |
+
// Read a series of characters into str until a newline or carriage return
|
| 974 |
+
// is received. Read at most n characters. If n is negative, the limit is
|
| 975 |
+
// ignored.
|
| 976 |
+
|
| 977 |
+
int getstr(int y, int x, char* str, int n=-1) {
|
| 978 |
+
return ::mvwgetnstr(w, y, x, str, n); }
|
| 979 |
+
// Move the cursor to the requested position and then perform the getstr()
|
| 980 |
+
// as described above.
|
| 981 |
+
|
| 982 |
+
int instr(char *s, int n=-1) { return ::winnstr(w, s, n); }
|
| 983 |
+
// Get a string of characters from the window into the buffer s. Retrieve
|
| 984 |
+
// at most n characters, if n is negative retrieve all characters up to the
|
| 985 |
+
// end of the current line. Attributes are stripped from the characters.
|
| 986 |
+
|
| 987 |
+
int instr(int y, int x, char *s, int n=-1) {
|
| 988 |
+
return ::mvwinnstr(w, y, x, s, n); }
|
| 989 |
+
// Move the cursor to the requested position and then perform the instr()
|
| 990 |
+
// as described above.
|
| 991 |
+
|
| 992 |
+
int scanw(const char* fmt, ...)
|
| 993 |
+
// Perform a scanw function from the window.
|
| 994 |
+
#if __GNUG__ >= 2
|
| 995 |
+
__attribute__ ((format (scanf, 2, 3)));
|
| 996 |
+
#else
|
| 997 |
+
;
|
| 998 |
+
#endif
|
| 999 |
+
|
| 1000 |
+
int scanw(const char*, va_list);
|
| 1001 |
+
// Perform a scanw function from the window.
|
| 1002 |
+
|
| 1003 |
+
int scanw(int y, int x, const char* fmt, ...)
|
| 1004 |
+
// Move the cursor to the requested position and then perform a scanw
|
| 1005 |
+
// from the window.
|
| 1006 |
+
#if __GNUG__ >= 2
|
| 1007 |
+
__attribute__ ((format (scanf, 4, 5)));
|
| 1008 |
+
#else
|
| 1009 |
+
;
|
| 1010 |
+
#endif
|
| 1011 |
+
|
| 1012 |
+
int scanw(int y, int x, const char* fmt, va_list);
|
| 1013 |
+
// Move the cursor to the requested position and then perform a scanw
|
| 1014 |
+
// from the window.
|
| 1015 |
+
|
| 1016 |
+
// -------------------------------------------------------------------------
|
| 1017 |
+
// output
|
| 1018 |
+
// -------------------------------------------------------------------------
|
| 1019 |
+
int addch(const chtype ch) { return ::waddch(w, ch); }
|
| 1020 |
+
// Put attributed character to the window.
|
| 1021 |
+
|
| 1022 |
+
int addch(int y, int x, const chtype ch) {
|
| 1023 |
+
return ::mvwaddch(w, y, x, ch); }
|
| 1024 |
+
// Move cursor to the requested position and then put attributed character
|
| 1025 |
+
// to the window.
|
| 1026 |
+
|
| 1027 |
+
int echochar(const chtype ch) { return ::wechochar(w, ch); }
|
| 1028 |
+
// Put attributed character to the window and refresh it immediately.
|
| 1029 |
+
|
| 1030 |
+
int addstr(const char* str, int n=-1) {
|
| 1031 |
+
return ::waddnstr(w, str, n); }
|
| 1032 |
+
// Write the string str to the window, stop writing if the terminating
|
| 1033 |
+
// NUL or the limit n is reached. If n is negative, it is ignored.
|
| 1034 |
+
|
| 1035 |
+
int addstr(int y, int x, const char * str, int n=-1) {
|
| 1036 |
+
return ::mvwaddnstr(w, y, x, str, n); }
|
| 1037 |
+
// Move the cursor to the requested position and then perform the addchstr
|
| 1038 |
+
// as described above.
|
| 1039 |
+
|
| 1040 |
+
int addchstr(const chtype* str, int n=-1) {
|
| 1041 |
+
return ::waddchnstr(w, str, n); }
|
| 1042 |
+
// Write the string str to the window, stop writing if the terminating
|
| 1043 |
+
// NUL or the limit n is reached. If n is negative, it is ignored.
|
| 1044 |
+
|
| 1045 |
+
int addchstr(int y, int x, const chtype * str, int n=-1) {
|
| 1046 |
+
return ::mvwaddchnstr(w, y, x, str, n); }
|
| 1047 |
+
// Move the cursor to the requested position and then perform the addchstr
|
| 1048 |
+
// as described above.
|
| 1049 |
+
|
| 1050 |
+
int printw(const char* fmt, ...)
|
| 1051 |
+
// Do a formatted print to the window.
|
| 1052 |
+
#if (__GNUG__ >= 2) && !defined(printf)
|
| 1053 |
+
__attribute__ ((format (printf, 2, 3)));
|
| 1054 |
+
#else
|
| 1055 |
+
;
|
| 1056 |
+
#endif
|
| 1057 |
+
|
| 1058 |
+
int printw(int y, int x, const char * fmt, ...)
|
| 1059 |
+
// Move the cursor and then do a formatted print to the window.
|
| 1060 |
+
#if (__GNUG__ >= 2) && !defined(printf)
|
| 1061 |
+
__attribute__ ((format (printf, 4, 5)));
|
| 1062 |
+
#else
|
| 1063 |
+
;
|
| 1064 |
+
#endif
|
| 1065 |
+
|
| 1066 |
+
int printw(const char* fmt, va_list args);
|
| 1067 |
+
// Do a formatted print to the window.
|
| 1068 |
+
|
| 1069 |
+
int printw(int y, int x, const char * fmt, va_list args);
|
| 1070 |
+
// Move the cursor and then do a formatted print to the window.
|
| 1071 |
+
|
| 1072 |
+
chtype inch() const { return ::winch(w); }
|
| 1073 |
+
// Retrieve attributed character under the current cursor position.
|
| 1074 |
+
|
| 1075 |
+
chtype inch(int y, int x) { return ::mvwinch(w, y, x); }
|
| 1076 |
+
// Move cursor to requested position and then retrieve attributed character
|
| 1077 |
+
// at this position.
|
| 1078 |
+
|
| 1079 |
+
int inchstr(chtype* str, int n=-1) {
|
| 1080 |
+
return ::winchnstr(w, str, n); }
|
| 1081 |
+
// Read the string str from the window, stop reading if the terminating
|
| 1082 |
+
// NUL or the limit n is reached. If n is negative, it is ignored.
|
| 1083 |
+
|
| 1084 |
+
int inchstr(int y, int x, chtype * str, int n=-1) {
|
| 1085 |
+
return ::mvwinchnstr(w, y, x, str, n); }
|
| 1086 |
+
// Move the cursor to the requested position and then perform the inchstr
|
| 1087 |
+
// as described above.
|
| 1088 |
+
|
| 1089 |
+
int insch(chtype ch) { return ::winsch(w, ch); }
|
| 1090 |
+
// Insert attributed character into the window before current cursor
|
| 1091 |
+
// position.
|
| 1092 |
+
|
| 1093 |
+
int insch(int y, int x, chtype ch) {
|
| 1094 |
+
return ::mvwinsch(w, y, x, ch); }
|
| 1095 |
+
// Move cursor to requested position and then insert the attributed
|
| 1096 |
+
// character before that position.
|
| 1097 |
+
|
| 1098 |
+
int insertln() { return ::winsdelln(w, 1); }
|
| 1099 |
+
// Insert an empty line above the current line.
|
| 1100 |
+
|
| 1101 |
+
int insdelln(int n=1) { return ::winsdelln(w, n); }
|
| 1102 |
+
// If n>0 insert that many lines above the current line. If n<0 delete
|
| 1103 |
+
// that many lines beginning with the current line.
|
| 1104 |
+
|
| 1105 |
+
int insstr(const char *s, int n=-1) {
|
| 1106 |
+
return ::winsnstr(w, s, n); }
|
| 1107 |
+
// Insert the string into the window before the current cursor position.
|
| 1108 |
+
// Insert stops at end of string or when the limit n is reached. If n is
|
| 1109 |
+
// negative, it is ignored.
|
| 1110 |
+
|
| 1111 |
+
int insstr(int y, int x, const char *s, int n=-1) {
|
| 1112 |
+
return ::mvwinsnstr(w, y, x, s, n); }
|
| 1113 |
+
// Move the cursor to the requested position and then perform the insstr()
|
| 1114 |
+
// as described above.
|
| 1115 |
+
|
| 1116 |
+
int attron (chtype at) { return ::wattron (w, at); }
|
| 1117 |
+
// Switch on the window attributes;
|
| 1118 |
+
|
| 1119 |
+
int attroff(chtype at) { return ::wattroff(w, static_cast<int>(at)); }
|
| 1120 |
+
// Switch off the window attributes;
|
| 1121 |
+
|
| 1122 |
+
int attrset(chtype at) { return ::wattrset(w, static_cast<int>(at)); }
|
| 1123 |
+
// Set the window attributes;
|
| 1124 |
+
|
| 1125 |
+
chtype attrget() { return ::getattrs(w); }
|
| 1126 |
+
// Get the window attributes;
|
| 1127 |
+
|
| 1128 |
+
int color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
|
| 1129 |
+
return ::wcolor_set(w, color_pair_number, opts); }
|
| 1130 |
+
// Set the window color attribute;
|
| 1131 |
+
|
| 1132 |
+
int chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
|
| 1133 |
+
return ::wchgat(w, n, attr, color, opts); }
|
| 1134 |
+
// Change the attributes of the next n characters in the current line. If
|
| 1135 |
+
// n is negative or greater than the number of remaining characters in the
|
| 1136 |
+
// line, the attributes will be changed up to the end of the line.
|
| 1137 |
+
|
| 1138 |
+
int chgat(int y, int x,
|
| 1139 |
+
int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
|
| 1140 |
+
return ::mvwchgat(w, y, x, n, attr, color, opts); }
|
| 1141 |
+
// Move the cursor to the requested position and then perform chgat() as
|
| 1142 |
+
// described above.
|
| 1143 |
+
|
| 1144 |
+
// -------------------------------------------------------------------------
|
| 1145 |
+
// background
|
| 1146 |
+
// -------------------------------------------------------------------------
|
| 1147 |
+
chtype getbkgd() const { return ::getbkgd(w); }
|
| 1148 |
+
// Get current background setting.
|
| 1149 |
+
|
| 1150 |
+
int bkgd(const chtype ch) { return ::wbkgd(w, ch); }
|
| 1151 |
+
// Set the background property and apply it to the window.
|
| 1152 |
+
|
| 1153 |
+
void bkgdset(chtype ch) { ::wbkgdset(w, ch); }
|
| 1154 |
+
// Set the background property.
|
| 1155 |
+
|
| 1156 |
+
// -------------------------------------------------------------------------
|
| 1157 |
+
// borders
|
| 1158 |
+
// -------------------------------------------------------------------------
|
| 1159 |
+
int box(chtype vert=0, chtype hor=0) {
|
| 1160 |
+
return ::wborder(w, vert, vert, hor, hor, 0, 0, 0, 0); }
|
| 1161 |
+
// Draw a box around the window with the given vertical and horizontal
|
| 1162 |
+
// drawing characters. If you specify a zero as character, curses will try
|
| 1163 |
+
// to find a "nice" character.
|
| 1164 |
+
|
| 1165 |
+
int border(chtype left=0, chtype right=0,
|
| 1166 |
+
chtype top =0, chtype bottom=0,
|
| 1167 |
+
chtype top_left =0, chtype top_right=0,
|
| 1168 |
+
chtype bottom_left =0, chtype bottom_right=0) {
|
| 1169 |
+
return ::wborder(w, left, right, top, bottom, top_left, top_right,
|
| 1170 |
+
bottom_left, bottom_right); }
|
| 1171 |
+
// Draw a border around the window with the given characters for the
|
| 1172 |
+
// various parts of the border. If you pass zero for a character, curses
|
| 1173 |
+
// will try to find "nice" characters.
|
| 1174 |
+
|
| 1175 |
+
// -------------------------------------------------------------------------
|
| 1176 |
+
// lines and boxes
|
| 1177 |
+
// -------------------------------------------------------------------------
|
| 1178 |
+
int hline(int len, chtype ch=0) { return ::whline(w, ch, len); }
|
| 1179 |
+
// Draw a horizontal line of len characters with the given character. If
|
| 1180 |
+
// you pass zero for the character, curses will try to find a "nice" one.
|
| 1181 |
+
|
| 1182 |
+
int hline(int y, int x, int len, chtype ch=0) {
|
| 1183 |
+
return ::mvwhline(w, y, x, ch, len); }
|
| 1184 |
+
// Move the cursor to the requested position and then draw a horizontal line.
|
| 1185 |
+
|
| 1186 |
+
int vline(int len, chtype ch=0) { return ::wvline(w, ch, len); }
|
| 1187 |
+
// Draw a vertical line of len characters with the given character. If
|
| 1188 |
+
// you pass zero for the character, curses will try to find a "nice" one.
|
| 1189 |
+
|
| 1190 |
+
int vline(int y, int x, int len, chtype ch=0) {
|
| 1191 |
+
return ::mvwvline(w, y, x, ch, len); }
|
| 1192 |
+
// Move the cursor to the requested position and then draw a vertical line.
|
| 1193 |
+
|
| 1194 |
+
// -------------------------------------------------------------------------
|
| 1195 |
+
// erasure
|
| 1196 |
+
// -------------------------------------------------------------------------
|
| 1197 |
+
int erase() { return ::werase(w); }
|
| 1198 |
+
// Erase the window.
|
| 1199 |
+
|
| 1200 |
+
int clear() { return ::wclear(w); }
|
| 1201 |
+
// Clear the window.
|
| 1202 |
+
|
| 1203 |
+
int clearok(bool bf) { return ::clearok(w, bf); }
|
| 1204 |
+
// Set/Reset the clear flag. If set, the next refresh() will clear the
|
| 1205 |
+
// screen.
|
| 1206 |
+
|
| 1207 |
+
int clrtobot() { return ::wclrtobot(w); }
|
| 1208 |
+
// Clear to the end of the window.
|
| 1209 |
+
|
| 1210 |
+
int clrtoeol() { return ::wclrtoeol(w); }
|
| 1211 |
+
// Clear to the end of the line.
|
| 1212 |
+
|
| 1213 |
+
int delch() { return ::wdelch(w); }
|
| 1214 |
+
// Delete character under the cursor.
|
| 1215 |
+
|
| 1216 |
+
int delch(int y, int x) { return ::mvwdelch(w, y, x); }
|
| 1217 |
+
// Move cursor to requested position and delete the character under the
|
| 1218 |
+
// cursor.
|
| 1219 |
+
|
| 1220 |
+
int deleteln() { return ::winsdelln(w, -1); }
|
| 1221 |
+
// Delete the current line.
|
| 1222 |
+
|
| 1223 |
+
// -------------------------------------------------------------------------
|
| 1224 |
+
// screen control
|
| 1225 |
+
// -------------------------------------------------------------------------
|
| 1226 |
+
int scroll(int amount=1) { return ::wscrl(w, amount); }
|
| 1227 |
+
// Scroll amount lines. If amount is positive, scroll up, otherwise
|
| 1228 |
+
// scroll down.
|
| 1229 |
+
|
| 1230 |
+
int scrollok(bool bf) { return ::scrollok(w, bf); }
|
| 1231 |
+
// If bf is TRUE, window scrolls if cursor is moved off the bottom
|
| 1232 |
+
// edge of the window or a scrolling region, otherwise the cursor is left
|
| 1233 |
+
// at the bottom line.
|
| 1234 |
+
|
| 1235 |
+
int setscrreg(int from, int to) {
|
| 1236 |
+
return ::wsetscrreg(w, from, to); }
|
| 1237 |
+
// Define a soft scrolling region.
|
| 1238 |
+
|
| 1239 |
+
int idlok(bool bf) { return ::idlok(w, bf); }
|
| 1240 |
+
// If bf is TRUE, use insert/delete line hardware support if possible.
|
| 1241 |
+
// Otherwise do it in software.
|
| 1242 |
+
|
| 1243 |
+
void idcok(bool bf) { ::idcok(w, bf); }
|
| 1244 |
+
// If bf is TRUE, use insert/delete character hardware support if possible.
|
| 1245 |
+
// Otherwise do it in software.
|
| 1246 |
+
|
| 1247 |
+
int touchline(int s, int c) { return ::touchline(w, s, c); }
|
| 1248 |
+
// Mark the given lines as modified.
|
| 1249 |
+
|
| 1250 |
+
int touchwin() { return ::wtouchln(w, 0, height(), 1); }
|
| 1251 |
+
// Mark the whole window as modified.
|
| 1252 |
+
|
| 1253 |
+
int untouchwin() { return ::wtouchln(w, 0, height(), 0); }
|
| 1254 |
+
// Mark the whole window as unmodified.
|
| 1255 |
+
|
| 1256 |
+
int touchln(int s, int cnt, bool changed=TRUE) {
|
| 1257 |
+
return ::wtouchln(w, s, cnt, static_cast<int>(changed ? 1 : 0)); }
|
| 1258 |
+
// Mark cnt lines beginning from line s as changed or unchanged, depending
|
| 1259 |
+
// on the value of the changed flag.
|
| 1260 |
+
|
| 1261 |
+
bool is_linetouched(int line) const {
|
| 1262 |
+
return (::is_linetouched(w, line) == TRUE ? TRUE:FALSE); }
|
| 1263 |
+
// Return TRUE if line is marked as changed, FALSE otherwise
|
| 1264 |
+
|
| 1265 |
+
bool is_wintouched() const {
|
| 1266 |
+
return (::is_wintouched(w) ? TRUE:FALSE); }
|
| 1267 |
+
// Return TRUE if window is marked as changed, FALSE otherwise
|
| 1268 |
+
|
| 1269 |
+
int leaveok(bool bf) { return ::leaveok(w, bf); }
|
| 1270 |
+
// If bf is TRUE, curses will leave the cursor after an update wherever
|
| 1271 |
+
// it is after the update.
|
| 1272 |
+
|
| 1273 |
+
int redrawln(int from, int n) { return ::wredrawln(w, from, n); }
|
| 1274 |
+
// Redraw n lines starting from the requested line
|
| 1275 |
+
|
| 1276 |
+
int redrawwin() { return ::wredrawln(w, 0, height()); }
|
| 1277 |
+
// Redraw the whole window
|
| 1278 |
+
|
| 1279 |
+
int doupdate() { return ::doupdate(); }
|
| 1280 |
+
// Do all outputs to make the physical screen looking like the virtual one
|
| 1281 |
+
|
| 1282 |
+
void syncdown() { ::wsyncdown(w); }
|
| 1283 |
+
// Propagate the changes down to all descendant windows
|
| 1284 |
+
|
| 1285 |
+
void syncup() { ::wsyncup(w); }
|
| 1286 |
+
// Propagate the changes up in the hierarchy
|
| 1287 |
+
|
| 1288 |
+
void cursyncup() { ::wcursyncup(w); }
|
| 1289 |
+
// Position the cursor in all ancestor windows corresponding to our setting
|
| 1290 |
+
|
| 1291 |
+
int syncok(bool bf) { return ::syncok(w, bf); }
|
| 1292 |
+
// If called with bf=TRUE, syncup() is called whenever the window is changed
|
| 1293 |
+
|
| 1294 |
+
#ifndef _no_flushok
|
| 1295 |
+
int flushok(bool bf) { return ::flushok(w, bf); }
|
| 1296 |
+
#endif
|
| 1297 |
+
|
| 1298 |
+
void immedok(bool bf) { ::immedok(w, bf); }
|
| 1299 |
+
// If called with bf=TRUE, any change in the window will cause an
|
| 1300 |
+
// automatic immediate refresh()
|
| 1301 |
+
|
| 1302 |
+
int intrflush(bool bf) { return ::intrflush(w, bf); }
|
| 1303 |
+
|
| 1304 |
+
int keypad(bool bf) { return ::keypad(w, bf); }
|
| 1305 |
+
// If called with bf=TRUE, the application will interpret function keys.
|
| 1306 |
+
|
| 1307 |
+
int nodelay(bool bf) { return ::nodelay(w, bf); }
|
| 1308 |
+
|
| 1309 |
+
int meta(bool bf) { return ::meta(w, bf); }
|
| 1310 |
+
// If called with bf=TRUE, keys may generate 8-Bit characters. Otherwise
|
| 1311 |
+
// 7-Bit characters are generated.
|
| 1312 |
+
|
| 1313 |
+
int standout() { return ::wstandout(w); }
|
| 1314 |
+
// Enable "standout" attributes
|
| 1315 |
+
|
| 1316 |
+
int standend() { return ::wstandend(w); }
|
| 1317 |
+
// Disable "standout" attributes
|
| 1318 |
+
|
| 1319 |
+
// -------------------------------------------------------------------------
|
| 1320 |
+
// The next two are virtual, because we redefine them in the
|
| 1321 |
+
// NCursesPanel class.
|
| 1322 |
+
// -------------------------------------------------------------------------
|
| 1323 |
+
virtual int refresh() { return ::wrefresh(w); }
|
| 1324 |
+
// Propagate the changes in this window to the virtual screen and call
|
| 1325 |
+
// doupdate(). This is redefined in NCursesPanel.
|
| 1326 |
+
|
| 1327 |
+
virtual int noutrefresh() { return ::wnoutrefresh(w); }
|
| 1328 |
+
// Propagate the changes in this window to the virtual screen. This is
|
| 1329 |
+
// redefined in NCursesPanel.
|
| 1330 |
+
|
| 1331 |
+
// -------------------------------------------------------------------------
|
| 1332 |
+
// multiple window control
|
| 1333 |
+
// -------------------------------------------------------------------------
|
| 1334 |
+
int overlay(NCursesWindow& win) {
|
| 1335 |
+
return ::overlay(w, win.w); }
|
| 1336 |
+
// Overlay this window over win.
|
| 1337 |
+
|
| 1338 |
+
int overwrite(NCursesWindow& win) {
|
| 1339 |
+
return ::overwrite(w, win.w); }
|
| 1340 |
+
// Overwrite win with this window.
|
| 1341 |
+
|
| 1342 |
+
int copywin(NCursesWindow& win,
|
| 1343 |
+
int sminrow, int smincol,
|
| 1344 |
+
int dminrow, int dmincol,
|
| 1345 |
+
int dmaxrow, int dmaxcol, bool overlaywin=TRUE) {
|
| 1346 |
+
return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol,
|
| 1347 |
+
dmaxrow, dmaxcol, static_cast<int>(overlaywin ? 1 : 0)); }
|
| 1348 |
+
// Overlay or overwrite the rectangle in win given by dminrow,dmincol,
|
| 1349 |
+
// dmaxrow,dmaxcol with the rectangle in this window beginning at
|
| 1350 |
+
// sminrow,smincol.
|
| 1351 |
+
|
| 1352 |
+
// -------------------------------------------------------------------------
|
| 1353 |
+
// Extended functions
|
| 1354 |
+
// -------------------------------------------------------------------------
|
| 1355 |
+
#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0)
|
| 1356 |
+
int wresize(int newLines, int newColumns) {
|
| 1357 |
+
return ::wresize(w, newLines, newColumns); }
|
| 1358 |
+
#endif
|
| 1359 |
+
|
| 1360 |
+
// -------------------------------------------------------------------------
|
| 1361 |
+
// Mouse related
|
| 1362 |
+
// -------------------------------------------------------------------------
|
| 1363 |
+
bool has_mouse() const;
|
| 1364 |
+
// Return TRUE if terminal supports a mouse, FALSE otherwise
|
| 1365 |
+
|
| 1366 |
+
// -------------------------------------------------------------------------
|
| 1367 |
+
// traversal support
|
| 1368 |
+
// -------------------------------------------------------------------------
|
| 1369 |
+
NCursesWindow* child() { return subwins; }
|
| 1370 |
+
// Get the first child window.
|
| 1371 |
+
|
| 1372 |
+
NCursesWindow* sibling() { return sib; }
|
| 1373 |
+
// Get the next child of my parent.
|
| 1374 |
+
|
| 1375 |
+
NCursesWindow* parent() { return par; }
|
| 1376 |
+
// Get my parent.
|
| 1377 |
+
|
| 1378 |
+
bool isDescendant(NCursesWindow& win);
|
| 1379 |
+
// Return TRUE if win is a descendant of this.
|
| 1380 |
+
};
|
| 1381 |
+
|
| 1382 |
+
// -------------------------------------------------------------------------
|
| 1383 |
+
// We leave this here for compatibility reasons.
|
| 1384 |
+
// -------------------------------------------------------------------------
|
| 1385 |
+
class NCURSES_CXX_IMPEXP NCursesColorWindow : public NCursesWindow
|
| 1386 |
+
{
|
| 1387 |
+
public:
|
| 1388 |
+
explicit NCursesColorWindow(WINDOW* &window) // useful only for stdscr
|
| 1389 |
+
: NCursesWindow(window) {
|
| 1390 |
+
useColors(); }
|
| 1391 |
+
|
| 1392 |
+
NCursesColorWindow(int nlines, // number of lines
|
| 1393 |
+
int ncols, // number of columns
|
| 1394 |
+
int begin_y, // line origin
|
| 1395 |
+
int begin_x) // col origin
|
| 1396 |
+
: NCursesWindow(nlines, ncols, begin_y, begin_x) {
|
| 1397 |
+
useColors(); }
|
| 1398 |
+
|
| 1399 |
+
NCursesColorWindow(NCursesWindow& parentWin,// parent window
|
| 1400 |
+
int nlines, // number of lines
|
| 1401 |
+
int ncols, // number of columns
|
| 1402 |
+
int begin_y, // absolute or relative
|
| 1403 |
+
int begin_x, // origins:
|
| 1404 |
+
char absrel = 'a') // if `a', by & bx are
|
| 1405 |
+
: NCursesWindow(parentWin,
|
| 1406 |
+
nlines, ncols, // absolute screen pos,
|
| 1407 |
+
begin_y, begin_x, // else if `r', they are
|
| 1408 |
+
absrel ) { // relative to par origin
|
| 1409 |
+
useColors(); }
|
| 1410 |
+
};
|
| 1411 |
+
|
| 1412 |
+
// These enum definitions really belong inside the NCursesPad class, but only
|
| 1413 |
+
// recent compilers support that feature.
|
| 1414 |
+
|
| 1415 |
+
typedef enum {
|
| 1416 |
+
REQ_PAD_REFRESH = KEY_MAX + 1,
|
| 1417 |
+
REQ_PAD_UP,
|
| 1418 |
+
REQ_PAD_DOWN,
|
| 1419 |
+
REQ_PAD_LEFT,
|
| 1420 |
+
REQ_PAD_RIGHT,
|
| 1421 |
+
REQ_PAD_EXIT
|
| 1422 |
+
} Pad_Request;
|
| 1423 |
+
|
| 1424 |
+
const Pad_Request PAD_LOW = REQ_PAD_REFRESH; // lowest op-code
|
| 1425 |
+
const Pad_Request PAD_HIGH = REQ_PAD_EXIT; // highest op-code
|
| 1426 |
+
|
| 1427 |
+
// -------------------------------------------------------------------------
|
| 1428 |
+
// Pad Support. We allow an association of a pad with a "real" window
|
| 1429 |
+
// through which the pad may be viewed.
|
| 1430 |
+
// -------------------------------------------------------------------------
|
| 1431 |
+
class NCURSES_CXX_IMPEXP NCursesPad : public NCursesWindow
|
| 1432 |
+
{
|
| 1433 |
+
private:
|
| 1434 |
+
NCursesWindow* viewWin; // the "viewport" window
|
| 1435 |
+
NCursesWindow* viewSub; // the "viewport" subwindow
|
| 1436 |
+
|
| 1437 |
+
int h_gridsize, v_gridsize;
|
| 1438 |
+
|
| 1439 |
+
protected:
|
| 1440 |
+
int min_row, min_col; // top left row/col of the pads display area
|
| 1441 |
+
|
| 1442 |
+
NCursesWindow* Win(void) const {
|
| 1443 |
+
// Get the window into which the pad should be copied (if any)
|
| 1444 |
+
return (viewSub?viewSub:(viewWin?viewWin:0));
|
| 1445 |
+
}
|
| 1446 |
+
|
| 1447 |
+
NCursesWindow* getWindow(void) const {
|
| 1448 |
+
return viewWin;
|
| 1449 |
+
}
|
| 1450 |
+
|
| 1451 |
+
NCursesWindow* getSubWindow(void) const {
|
| 1452 |
+
return viewSub;
|
| 1453 |
+
}
|
| 1454 |
+
|
| 1455 |
+
virtual int driver (int key); // Virtualize keystroke key
|
| 1456 |
+
// The driver translates the keystroke c into an Pad_Request
|
| 1457 |
+
|
| 1458 |
+
virtual void OnUnknownOperation(int pad_req) {
|
| 1459 |
+
(void) pad_req;
|
| 1460 |
+
::beep();
|
| 1461 |
+
}
|
| 1462 |
+
// This is called if the driver returns an unknown op-code
|
| 1463 |
+
|
| 1464 |
+
virtual void OnNavigationError(int pad_req) {
|
| 1465 |
+
(void) pad_req;
|
| 1466 |
+
::beep();
|
| 1467 |
+
}
|
| 1468 |
+
// This is called if a navigation request couldn't be satisfied
|
| 1469 |
+
|
| 1470 |
+
virtual void OnOperation(int pad_req) {
|
| 1471 |
+
(void) pad_req;
|
| 1472 |
+
};
|
| 1473 |
+
// OnOperation is called if a Pad_Operation was executed and just before
|
| 1474 |
+
// the refresh() operation is done.
|
| 1475 |
+
|
| 1476 |
+
public:
|
| 1477 |
+
NCursesPad(int nlines, int ncols);
|
| 1478 |
+
// create a pad with the given size
|
| 1479 |
+
|
| 1480 |
+
NCursesPad& operator=(const NCursesPad& rhs)
|
| 1481 |
+
{
|
| 1482 |
+
if (this != &rhs) {
|
| 1483 |
+
*this = rhs;
|
| 1484 |
+
NCursesWindow::operator=(rhs);
|
| 1485 |
+
}
|
| 1486 |
+
return *this;
|
| 1487 |
+
}
|
| 1488 |
+
|
| 1489 |
+
NCursesPad(const NCursesPad& rhs)
|
| 1490 |
+
: NCursesWindow(rhs),
|
| 1491 |
+
viewWin(rhs.viewWin),
|
| 1492 |
+
viewSub(rhs.viewSub),
|
| 1493 |
+
h_gridsize(rhs.h_gridsize),
|
| 1494 |
+
v_gridsize(rhs.v_gridsize),
|
| 1495 |
+
min_row(rhs.min_row),
|
| 1496 |
+
min_col(rhs.min_col)
|
| 1497 |
+
{
|
| 1498 |
+
}
|
| 1499 |
+
|
| 1500 |
+
virtual ~NCursesPad() THROWS(NCursesException) {}
|
| 1501 |
+
|
| 1502 |
+
int echochar(const chtype ch) { return ::pechochar(w, ch); }
|
| 1503 |
+
// Put the attributed character onto the pad and immediately do a
|
| 1504 |
+
// prefresh().
|
| 1505 |
+
|
| 1506 |
+
int refresh() NCURSES_OVERRIDE;
|
| 1507 |
+
// If a viewport is defined the pad is displayed in this window, otherwise
|
| 1508 |
+
// this is a noop.
|
| 1509 |
+
|
| 1510 |
+
int refresh(int pminrow, int pmincol,
|
| 1511 |
+
int sminrow, int smincol,
|
| 1512 |
+
int smaxrow, int smaxcol) {
|
| 1513 |
+
return ::prefresh(w, pminrow, pmincol,
|
| 1514 |
+
sminrow, smincol, smaxrow, smaxcol);
|
| 1515 |
+
}
|
| 1516 |
+
// The coordinates sminrow,smincol,smaxrow,smaxcol describe a rectangle
|
| 1517 |
+
// on the screen. <b>refresh</b> copies a rectangle of this size beginning
|
| 1518 |
+
// with top left corner pminrow,pmincol onto the screen and calls doupdate().
|
| 1519 |
+
|
| 1520 |
+
int noutrefresh() NCURSES_OVERRIDE;
|
| 1521 |
+
// If a viewport is defined the pad is displayed in this window, otherwise
|
| 1522 |
+
// this is a noop.
|
| 1523 |
+
|
| 1524 |
+
int noutrefresh(int pminrow, int pmincol,
|
| 1525 |
+
int sminrow, int smincol,
|
| 1526 |
+
int smaxrow, int smaxcol) {
|
| 1527 |
+
return ::pnoutrefresh(w, pminrow, pmincol,
|
| 1528 |
+
sminrow, smincol, smaxrow, smaxcol);
|
| 1529 |
+
}
|
| 1530 |
+
// Does the same as refresh() but without calling doupdate().
|
| 1531 |
+
|
| 1532 |
+
virtual void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1);
|
| 1533 |
+
// Add the window "view" as viewing window to the pad.
|
| 1534 |
+
|
| 1535 |
+
virtual void setSubWindow(NCursesWindow& sub);
|
| 1536 |
+
// Use the subwindow "sub" of the viewport window for the actual viewing.
|
| 1537 |
+
// The full viewport window is usually used to provide some decorations
|
| 1538 |
+
// like frames, titles etc.
|
| 1539 |
+
|
| 1540 |
+
virtual void operator() (void);
|
| 1541 |
+
// Perform Pad's operation
|
| 1542 |
+
};
|
| 1543 |
+
|
| 1544 |
+
// A FramedPad is constructed always with a viewport window. This viewport
|
| 1545 |
+
// will be framed (by a box() command) and the interior of the box is the
|
| 1546 |
+
// viewport subwindow. On the frame we display scrollbar sliders.
|
| 1547 |
+
class NCURSES_CXX_IMPEXP NCursesFramedPad : public NCursesPad
|
| 1548 |
+
{
|
| 1549 |
+
protected:
|
| 1550 |
+
virtual void OnOperation(int pad_req) NCURSES_OVERRIDE;
|
| 1551 |
+
|
| 1552 |
+
public:
|
| 1553 |
+
NCursesFramedPad(NCursesWindow& win, int nlines, int ncols,
|
| 1554 |
+
int v_grid = 1, int h_grid = 1)
|
| 1555 |
+
: NCursesPad(nlines, ncols) {
|
| 1556 |
+
NCursesPad::setWindow(win, v_grid, h_grid);
|
| 1557 |
+
NCursesPad::setSubWindow(*(new NCursesWindow(win)));
|
| 1558 |
+
}
|
| 1559 |
+
// Construct the FramedPad with the given Window win as viewport.
|
| 1560 |
+
|
| 1561 |
+
virtual ~NCursesFramedPad() THROWS(NCursesException) {
|
| 1562 |
+
delete getSubWindow();
|
| 1563 |
+
}
|
| 1564 |
+
|
| 1565 |
+
void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) NCURSES_OVERRIDE {
|
| 1566 |
+
(void) view;
|
| 1567 |
+
(void) v_grid;
|
| 1568 |
+
(void) h_grid;
|
| 1569 |
+
err_handler("Operation not allowed");
|
| 1570 |
+
}
|
| 1571 |
+
// Disable this call; the viewport is already defined
|
| 1572 |
+
|
| 1573 |
+
void setSubWindow(NCursesWindow& sub) NCURSES_OVERRIDE {
|
| 1574 |
+
(void) sub;
|
| 1575 |
+
err_handler("Operation not allowed");
|
| 1576 |
+
}
|
| 1577 |
+
// Disable this call; the viewport subwindow is already defined
|
| 1578 |
+
|
| 1579 |
+
};
|
| 1580 |
+
|
| 1581 |
+
#endif /* NCURSES_CURSESW_H_incl */
|
emu3/include/ncursesw/cursslk.h
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * this is for making emacs happy: -*-Mode: C++;-*-
|
| 2 |
+
// vile:cppmode
|
| 3 |
+
/****************************************************************************
|
| 4 |
+
* Copyright 2019-2020,2021 Thomas E. Dickey *
|
| 5 |
+
* Copyright 1998-2003,2005 Free Software Foundation, Inc. *
|
| 6 |
+
* *
|
| 7 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 8 |
+
* copy of this software and associated documentation files (the *
|
| 9 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 10 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 11 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 12 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 13 |
+
* furnished to do so, subject to the following conditions: *
|
| 14 |
+
* *
|
| 15 |
+
* The above copyright notice and this permission notice shall be included *
|
| 16 |
+
* in all copies or substantial portions of the Software. *
|
| 17 |
+
* *
|
| 18 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 19 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 20 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 21 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 22 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 23 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 24 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 25 |
+
* *
|
| 26 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 27 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 28 |
+
* sale, use or other dealings in this Software without prior written *
|
| 29 |
+
* authorization. *
|
| 30 |
+
****************************************************************************/
|
| 31 |
+
|
| 32 |
+
/****************************************************************************
|
| 33 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
// $Id: cursslk.h,v 1.19 2021/04/17 18:11:08 tom Exp $
|
| 37 |
+
|
| 38 |
+
#ifndef NCURSES_CURSSLK_H_incl
|
| 39 |
+
#define NCURSES_CURSSLK_H_incl
|
| 40 |
+
|
| 41 |
+
#include <ncursesw/cursesw.h>
|
| 42 |
+
|
| 43 |
+
class NCURSES_CXX_IMPEXP Soft_Label_Key_Set {
|
| 44 |
+
public:
|
| 45 |
+
// This inner class represents the attributes of a Soft Label Key (SLK)
|
| 46 |
+
class NCURSES_CXX_IMPEXP Soft_Label_Key {
|
| 47 |
+
friend class Soft_Label_Key_Set;
|
| 48 |
+
public:
|
| 49 |
+
typedef enum { Left=0, Center=1, Right=2 } Justification;
|
| 50 |
+
|
| 51 |
+
private:
|
| 52 |
+
char *label; // The Text of the Label
|
| 53 |
+
Justification format; // The Justification
|
| 54 |
+
int num; // The number of the Label
|
| 55 |
+
|
| 56 |
+
Soft_Label_Key() : label(NULL), format(Left), num(-1) {
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
virtual ~Soft_Label_Key() {
|
| 60 |
+
delete[] label;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
public:
|
| 64 |
+
// Set the text of the Label
|
| 65 |
+
Soft_Label_Key& operator=(char *text);
|
| 66 |
+
|
| 67 |
+
// Set the Justification of the Label
|
| 68 |
+
Soft_Label_Key& operator=(Justification just) {
|
| 69 |
+
format = just;
|
| 70 |
+
return *this;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
// Retrieve the text of the label
|
| 74 |
+
inline char* operator()(void) const {
|
| 75 |
+
return label;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
Soft_Label_Key& operator=(const Soft_Label_Key& rhs)
|
| 79 |
+
{
|
| 80 |
+
if (this != &rhs) {
|
| 81 |
+
*this = rhs;
|
| 82 |
+
}
|
| 83 |
+
return *this;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
Soft_Label_Key(const Soft_Label_Key& rhs)
|
| 87 |
+
: label(NULL),
|
| 88 |
+
format(rhs.format),
|
| 89 |
+
num(rhs.num)
|
| 90 |
+
{
|
| 91 |
+
*this = rhs.label;
|
| 92 |
+
}
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
public:
|
| 96 |
+
typedef enum {
|
| 97 |
+
None = -1,
|
| 98 |
+
Three_Two_Three = 0,
|
| 99 |
+
Four_Four = 1,
|
| 100 |
+
PC_Style = 2,
|
| 101 |
+
PC_Style_With_Index = 3
|
| 102 |
+
} Label_Layout;
|
| 103 |
+
|
| 104 |
+
private:
|
| 105 |
+
static long count; // Number of Key Sets
|
| 106 |
+
static Label_Layout format; // Layout of the Key Sets
|
| 107 |
+
static int num_labels; // Number Of Labels in Key Sets
|
| 108 |
+
bool b_attrInit; // Are attributes initialized
|
| 109 |
+
|
| 110 |
+
Soft_Label_Key *slk_array; // The array of SLK's
|
| 111 |
+
|
| 112 |
+
// Init the Key Set
|
| 113 |
+
void init();
|
| 114 |
+
|
| 115 |
+
// Activate or Deactivate Label# i, Label counting starts with 1!
|
| 116 |
+
void activate_label(int i, bool bf=TRUE);
|
| 117 |
+
|
| 118 |
+
// Activate of Deactivate all Labels
|
| 119 |
+
void activate_labels(bool bf);
|
| 120 |
+
|
| 121 |
+
protected:
|
| 122 |
+
inline void Error (const char* msg) const THROWS(NCursesException) {
|
| 123 |
+
THROW(new NCursesException (msg));
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
// Remove SLK's from screen
|
| 127 |
+
void clear() {
|
| 128 |
+
if (ERR==::slk_clear())
|
| 129 |
+
Error("slk_clear");
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
// Restore them
|
| 133 |
+
void restore() {
|
| 134 |
+
if (ERR==::slk_restore())
|
| 135 |
+
Error("slk_restore");
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
public:
|
| 139 |
+
|
| 140 |
+
// Construct a Key Set, use the most comfortable layout as default.
|
| 141 |
+
// You must create a Soft_Label_Key_Set before you create any object of
|
| 142 |
+
// the NCursesWindow, NCursesPanel or derived classes. (Actually before
|
| 143 |
+
// ::initscr() is called).
|
| 144 |
+
explicit Soft_Label_Key_Set(Label_Layout fmt);
|
| 145 |
+
|
| 146 |
+
// This constructor assumes, that you already constructed a Key Set
|
| 147 |
+
// with a layout by the constructor above. This layout will be reused.
|
| 148 |
+
Soft_Label_Key_Set();
|
| 149 |
+
|
| 150 |
+
Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs)
|
| 151 |
+
{
|
| 152 |
+
if (this != &rhs) {
|
| 153 |
+
*this = rhs;
|
| 154 |
+
init(); // allocate a new slk_array[]
|
| 155 |
+
}
|
| 156 |
+
return *this;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs)
|
| 160 |
+
: b_attrInit(rhs.b_attrInit),
|
| 161 |
+
slk_array(NULL)
|
| 162 |
+
{
|
| 163 |
+
init(); // allocate a new slk_array[]
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
virtual ~Soft_Label_Key_Set() THROWS(NCursesException);
|
| 167 |
+
|
| 168 |
+
// Get Label# i. Label counting starts with 1!
|
| 169 |
+
Soft_Label_Key& operator[](int i);
|
| 170 |
+
|
| 171 |
+
// Retrieve number of Labels
|
| 172 |
+
int labels() const;
|
| 173 |
+
|
| 174 |
+
// Refresh the SLK portion of the screen
|
| 175 |
+
inline void refresh() {
|
| 176 |
+
if (ERR==::slk_refresh())
|
| 177 |
+
Error("slk_refresh");
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// Mark the SLK portion of the screen for refresh, defer actual refresh
|
| 181 |
+
// until next update call.
|
| 182 |
+
inline void noutrefresh() {
|
| 183 |
+
if (ERR==::slk_noutrefresh())
|
| 184 |
+
Error("slk_noutrefresh");
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// Mark the whole SLK portion of the screen as modified
|
| 188 |
+
inline void touch() {
|
| 189 |
+
if (ERR==::slk_touch())
|
| 190 |
+
Error("slk_touch");
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
// Activate Label# i
|
| 194 |
+
inline void show(int i) {
|
| 195 |
+
activate_label(i,FALSE);
|
| 196 |
+
activate_label(i,TRUE);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Hide Label# i
|
| 200 |
+
inline void hide(int i) {
|
| 201 |
+
activate_label(i,FALSE);
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
// Show all Labels
|
| 205 |
+
inline void show() {
|
| 206 |
+
activate_labels(FALSE);
|
| 207 |
+
activate_labels(TRUE);
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
// Hide all Labels
|
| 211 |
+
inline void hide() {
|
| 212 |
+
activate_labels(FALSE);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
inline void attron(attr_t attrs) {
|
| 216 |
+
if (ERR==::slk_attron(attrs))
|
| 217 |
+
Error("slk_attron");
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
inline void attroff(attr_t attrs) {
|
| 221 |
+
if (ERR==::slk_attroff(attrs))
|
| 222 |
+
Error("slk_attroff");
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
inline void attrset(attr_t attrs) {
|
| 226 |
+
if (ERR==::slk_attrset(attrs))
|
| 227 |
+
Error("slk_attrset");
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
inline void color(short color_pair_number) {
|
| 231 |
+
if (ERR==::slk_color(color_pair_number))
|
| 232 |
+
Error("slk_color");
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
inline attr_t attr() const {
|
| 236 |
+
return ::slk_attr();
|
| 237 |
+
}
|
| 238 |
+
};
|
| 239 |
+
|
| 240 |
+
#endif /* NCURSES_CURSSLK_H_incl */
|
emu3/include/ncursesw/eti.h
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2002,2003 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: eti.h,v 1.9 2020/02/02 23:34:34 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef NCURSES_ETI_H_incl
|
| 37 |
+
#define NCURSES_ETI_H_incl 1
|
| 38 |
+
|
| 39 |
+
#define E_OK (0)
|
| 40 |
+
#define E_SYSTEM_ERROR (-1)
|
| 41 |
+
#define E_BAD_ARGUMENT (-2)
|
| 42 |
+
#define E_POSTED (-3)
|
| 43 |
+
#define E_CONNECTED (-4)
|
| 44 |
+
#define E_BAD_STATE (-5)
|
| 45 |
+
#define E_NO_ROOM (-6)
|
| 46 |
+
#define E_NOT_POSTED (-7)
|
| 47 |
+
#define E_UNKNOWN_COMMAND (-8)
|
| 48 |
+
#define E_NO_MATCH (-9)
|
| 49 |
+
#define E_NOT_SELECTABLE (-10)
|
| 50 |
+
#define E_NOT_CONNECTED (-11)
|
| 51 |
+
#define E_REQUEST_DENIED (-12)
|
| 52 |
+
#define E_INVALID_FIELD (-13)
|
| 53 |
+
#define E_CURRENT (-14)
|
| 54 |
+
|
| 55 |
+
#endif
|
emu3/include/ncursesw/etip.h
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// * This makes emacs happy -*-Mode: C++;-*-
|
| 2 |
+
/****************************************************************************
|
| 3 |
+
* Copyright 2018-2021,2022 Thomas E. Dickey *
|
| 4 |
+
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
|
| 5 |
+
* *
|
| 6 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 7 |
+
* copy of this software and associated documentation files (the *
|
| 8 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 9 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 10 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 11 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 12 |
+
* furnished to do so, subject to the following conditions: *
|
| 13 |
+
* *
|
| 14 |
+
* The above copyright notice and this permission notice shall be included *
|
| 15 |
+
* in all copies or substantial portions of the Software. *
|
| 16 |
+
* *
|
| 17 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 18 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 19 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 20 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 21 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 22 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 23 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 24 |
+
* *
|
| 25 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 26 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 27 |
+
* sale, use or other dealings in this Software without prior written *
|
| 28 |
+
* authorization. *
|
| 29 |
+
****************************************************************************/
|
| 30 |
+
|
| 31 |
+
/****************************************************************************
|
| 32 |
+
* Author: Juergen Pfeifer, 1997 *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
// $Id: etip.h.in,v 1.50 2022/08/20 20:50:00 tom Exp $
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_ETIP_H_incl
|
| 38 |
+
#define NCURSES_ETIP_H_incl 1
|
| 39 |
+
|
| 40 |
+
// These are substituted at configure/build time
|
| 41 |
+
#ifndef HAVE_BUILTIN_H
|
| 42 |
+
#define HAVE_BUILTIN_H 0
|
| 43 |
+
#endif
|
| 44 |
+
|
| 45 |
+
#ifndef HAVE_GXX_BUILTIN_H
|
| 46 |
+
#define HAVE_GXX_BUILTIN_H 0
|
| 47 |
+
#endif
|
| 48 |
+
|
| 49 |
+
#ifndef HAVE_GPP_BUILTIN_H
|
| 50 |
+
#define HAVE_GPP_BUILTIN_H 0
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
#ifndef HAVE_IOSTREAM
|
| 54 |
+
#define HAVE_IOSTREAM 1
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#ifndef HAVE_TYPEINFO
|
| 58 |
+
#define HAVE_TYPEINFO 1
|
| 59 |
+
#endif
|
| 60 |
+
|
| 61 |
+
#ifndef HAVE_VALUES_H
|
| 62 |
+
#define HAVE_VALUES_H 0
|
| 63 |
+
#endif
|
| 64 |
+
|
| 65 |
+
#ifndef ETIP_NEEDS_MATH_H
|
| 66 |
+
#define ETIP_NEEDS_MATH_H 0
|
| 67 |
+
#endif
|
| 68 |
+
|
| 69 |
+
#ifndef ETIP_NEEDS_MATH_EXCEPTION
|
| 70 |
+
#define ETIP_NEEDS_MATH_EXCEPTION 0
|
| 71 |
+
#endif
|
| 72 |
+
|
| 73 |
+
#ifndef CPP_HAS_OVERRIDE
|
| 74 |
+
#define CPP_HAS_OVERRIDE 0
|
| 75 |
+
#endif
|
| 76 |
+
|
| 77 |
+
#ifndef CPP_HAS_PARAM_INIT
|
| 78 |
+
#define CPP_HAS_PARAM_INIT 0
|
| 79 |
+
#endif
|
| 80 |
+
|
| 81 |
+
#ifndef CPP_HAS_STATIC_CAST
|
| 82 |
+
#define CPP_HAS_STATIC_CAST 1
|
| 83 |
+
#endif
|
| 84 |
+
|
| 85 |
+
#ifndef IOSTREAM_NAMESPACE
|
| 86 |
+
#define IOSTREAM_NAMESPACE 1
|
| 87 |
+
#endif
|
| 88 |
+
|
| 89 |
+
#ifdef __GNUG__
|
| 90 |
+
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
|
| 91 |
+
# if HAVE_TYPEINFO
|
| 92 |
+
# include <typeinfo>
|
| 93 |
+
# endif
|
| 94 |
+
# endif
|
| 95 |
+
#endif
|
| 96 |
+
|
| 97 |
+
#if defined(__GNUG__)
|
| 98 |
+
# if HAVE_BUILTIN_H || HAVE_GXX_BUILTIN_H || HAVE_GPP_BUILTIN_H
|
| 99 |
+
# if ETIP_NEEDS_MATH_H
|
| 100 |
+
# if ETIP_NEEDS_MATH_EXCEPTION
|
| 101 |
+
# undef exception
|
| 102 |
+
# define exception math_exception
|
| 103 |
+
# endif
|
| 104 |
+
# include <math.h>
|
| 105 |
+
# endif
|
| 106 |
+
# undef exception
|
| 107 |
+
# define exception builtin_exception
|
| 108 |
+
# if HAVE_GPP_BUILTIN_H
|
| 109 |
+
# include <gpp/builtin.h>
|
| 110 |
+
# elif HAVE_GXX_BUILTIN_H
|
| 111 |
+
# include <g++/builtin.h>
|
| 112 |
+
# else
|
| 113 |
+
# include <builtin.h>
|
| 114 |
+
# endif
|
| 115 |
+
# undef exception
|
| 116 |
+
# endif
|
| 117 |
+
#elif defined (__SUNPRO_CC)
|
| 118 |
+
# include <generic.h>
|
| 119 |
+
#endif
|
| 120 |
+
|
| 121 |
+
#include <ncursesw/curses.h>
|
| 122 |
+
|
| 123 |
+
extern "C" {
|
| 124 |
+
#if HAVE_VALUES_H
|
| 125 |
+
# include <values.h>
|
| 126 |
+
#endif
|
| 127 |
+
|
| 128 |
+
#include <assert.h>
|
| 129 |
+
#include <ncursesw/eti.h>
|
| 130 |
+
#include <errno.h>
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
// Language features
|
| 134 |
+
#if CPP_HAS_OVERRIDE
|
| 135 |
+
#define NCURSES_OVERRIDE override
|
| 136 |
+
#else
|
| 137 |
+
#define NCURSES_OVERRIDE /*nothing*/
|
| 138 |
+
#endif
|
| 139 |
+
|
| 140 |
+
#if CPP_HAS_PARAM_INIT
|
| 141 |
+
#define NCURSES_PARAM_INIT(value) = value
|
| 142 |
+
#else
|
| 143 |
+
#define NCURSES_PARAM_INIT(value) /*nothing*/
|
| 144 |
+
#endif
|
| 145 |
+
|
| 146 |
+
#if CPP_HAS_STATIC_CAST
|
| 147 |
+
#define STATIC_CAST(s) static_cast<s>
|
| 148 |
+
#else
|
| 149 |
+
#define STATIC_CAST(s) (s)
|
| 150 |
+
#endif
|
| 151 |
+
|
| 152 |
+
#ifndef NCURSES_CXX_IMPEXP
|
| 153 |
+
#define NCURSES_CXX_IMPEXP /* nothing */
|
| 154 |
+
#endif
|
| 155 |
+
|
| 156 |
+
// Forward Declarations
|
| 157 |
+
class NCURSES_CXX_IMPEXP NCursesPanel;
|
| 158 |
+
class NCURSES_CXX_IMPEXP NCursesMenu;
|
| 159 |
+
class NCURSES_CXX_IMPEXP NCursesForm;
|
| 160 |
+
|
| 161 |
+
class NCURSES_CXX_IMPEXP NCursesException
|
| 162 |
+
{
|
| 163 |
+
public:
|
| 164 |
+
const char *message;
|
| 165 |
+
int errorno;
|
| 166 |
+
|
| 167 |
+
NCursesException (const char* msg, int err)
|
| 168 |
+
: message(msg), errorno (err)
|
| 169 |
+
{};
|
| 170 |
+
|
| 171 |
+
explicit NCursesException (const char* msg)
|
| 172 |
+
: message(msg), errorno (E_SYSTEM_ERROR)
|
| 173 |
+
{};
|
| 174 |
+
|
| 175 |
+
NCursesException& operator=(const NCursesException& rhs)
|
| 176 |
+
{
|
| 177 |
+
message = rhs.message;
|
| 178 |
+
errorno = rhs.errorno;
|
| 179 |
+
return *this;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
NCursesException(const NCursesException& rhs)
|
| 183 |
+
: message(rhs.message), errorno(rhs.errorno)
|
| 184 |
+
{
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
virtual const char *classname() const {
|
| 188 |
+
return "NCursesWindow";
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
virtual ~NCursesException()
|
| 192 |
+
{
|
| 193 |
+
}
|
| 194 |
+
};
|
| 195 |
+
|
| 196 |
+
class NCURSES_CXX_IMPEXP NCursesPanelException : public NCursesException
|
| 197 |
+
{
|
| 198 |
+
public:
|
| 199 |
+
const NCursesPanel* p;
|
| 200 |
+
|
| 201 |
+
NCursesPanelException (const char *msg, int err) :
|
| 202 |
+
NCursesException (msg, err),
|
| 203 |
+
p (0)
|
| 204 |
+
{};
|
| 205 |
+
|
| 206 |
+
NCursesPanelException (const NCursesPanel* panel,
|
| 207 |
+
const char *msg,
|
| 208 |
+
int err) :
|
| 209 |
+
NCursesException (msg, err),
|
| 210 |
+
p (panel)
|
| 211 |
+
{};
|
| 212 |
+
|
| 213 |
+
explicit NCursesPanelException (int err) :
|
| 214 |
+
NCursesException ("panel library error", err),
|
| 215 |
+
p (0)
|
| 216 |
+
{};
|
| 217 |
+
|
| 218 |
+
NCursesPanelException (const NCursesPanel* panel,
|
| 219 |
+
int err) :
|
| 220 |
+
NCursesException ("panel library error", err),
|
| 221 |
+
p (panel)
|
| 222 |
+
{};
|
| 223 |
+
|
| 224 |
+
NCursesPanelException& operator=(const NCursesPanelException& rhs)
|
| 225 |
+
{
|
| 226 |
+
if (this != &rhs) {
|
| 227 |
+
NCursesException::operator=(rhs);
|
| 228 |
+
p = rhs.p;
|
| 229 |
+
}
|
| 230 |
+
return *this;
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
NCursesPanelException(const NCursesPanelException& rhs)
|
| 234 |
+
: NCursesException(rhs), p(rhs.p)
|
| 235 |
+
{
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 239 |
+
return "NCursesPanel";
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
virtual ~NCursesPanelException()
|
| 243 |
+
{
|
| 244 |
+
}
|
| 245 |
+
};
|
| 246 |
+
|
| 247 |
+
class NCURSES_CXX_IMPEXP NCursesMenuException : public NCursesException
|
| 248 |
+
{
|
| 249 |
+
public:
|
| 250 |
+
const NCursesMenu* m;
|
| 251 |
+
|
| 252 |
+
NCursesMenuException (const char *msg, int err) :
|
| 253 |
+
NCursesException (msg, err),
|
| 254 |
+
m (0)
|
| 255 |
+
{};
|
| 256 |
+
|
| 257 |
+
NCursesMenuException (const NCursesMenu* menu,
|
| 258 |
+
const char *msg,
|
| 259 |
+
int err) :
|
| 260 |
+
NCursesException (msg, err),
|
| 261 |
+
m (menu)
|
| 262 |
+
{};
|
| 263 |
+
|
| 264 |
+
explicit NCursesMenuException (int err) :
|
| 265 |
+
NCursesException ("menu library error", err),
|
| 266 |
+
m (0)
|
| 267 |
+
{};
|
| 268 |
+
|
| 269 |
+
NCursesMenuException (const NCursesMenu* menu,
|
| 270 |
+
int err) :
|
| 271 |
+
NCursesException ("menu library error", err),
|
| 272 |
+
m (menu)
|
| 273 |
+
{};
|
| 274 |
+
|
| 275 |
+
NCursesMenuException& operator=(const NCursesMenuException& rhs)
|
| 276 |
+
{
|
| 277 |
+
if (this != &rhs) {
|
| 278 |
+
NCursesException::operator=(rhs);
|
| 279 |
+
m = rhs.m;
|
| 280 |
+
}
|
| 281 |
+
return *this;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
NCursesMenuException(const NCursesMenuException& rhs)
|
| 285 |
+
: NCursesException(rhs), m(rhs.m)
|
| 286 |
+
{
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 290 |
+
return "NCursesMenu";
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
virtual ~NCursesMenuException()
|
| 294 |
+
{
|
| 295 |
+
}
|
| 296 |
+
};
|
| 297 |
+
|
| 298 |
+
class NCURSES_CXX_IMPEXP NCursesFormException : public NCursesException
|
| 299 |
+
{
|
| 300 |
+
public:
|
| 301 |
+
const NCursesForm* f;
|
| 302 |
+
|
| 303 |
+
NCursesFormException (const char *msg, int err) :
|
| 304 |
+
NCursesException (msg, err),
|
| 305 |
+
f (0)
|
| 306 |
+
{};
|
| 307 |
+
|
| 308 |
+
NCursesFormException (const NCursesForm* form,
|
| 309 |
+
const char *msg,
|
| 310 |
+
int err) :
|
| 311 |
+
NCursesException (msg, err),
|
| 312 |
+
f (form)
|
| 313 |
+
{};
|
| 314 |
+
|
| 315 |
+
explicit NCursesFormException (int err) :
|
| 316 |
+
NCursesException ("form library error", err),
|
| 317 |
+
f (0)
|
| 318 |
+
{};
|
| 319 |
+
|
| 320 |
+
NCursesFormException (const NCursesForm* form,
|
| 321 |
+
int err) :
|
| 322 |
+
NCursesException ("form library error", err),
|
| 323 |
+
f (form)
|
| 324 |
+
{};
|
| 325 |
+
|
| 326 |
+
NCursesFormException& operator=(const NCursesFormException& rhs)
|
| 327 |
+
{
|
| 328 |
+
if (this != &rhs) {
|
| 329 |
+
NCursesException::operator=(rhs);
|
| 330 |
+
f = rhs.f;
|
| 331 |
+
}
|
| 332 |
+
return *this;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
NCursesFormException(const NCursesFormException& rhs)
|
| 336 |
+
: NCursesException(rhs), f(rhs.f)
|
| 337 |
+
{
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
virtual const char *classname() const NCURSES_OVERRIDE {
|
| 341 |
+
return "NCursesForm";
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
virtual ~NCursesFormException()
|
| 345 |
+
{
|
| 346 |
+
}
|
| 347 |
+
};
|
| 348 |
+
|
| 349 |
+
#if !((defined(__GNUG__) && defined(__EXCEPTIONS) && (__GNUG__ < 7)) || defined(__SUNPRO_CC))
|
| 350 |
+
# if HAVE_IOSTREAM
|
| 351 |
+
# include <iostream>
|
| 352 |
+
# if IOSTREAM_NAMESPACE
|
| 353 |
+
using std::cerr;
|
| 354 |
+
using std::endl;
|
| 355 |
+
# endif
|
| 356 |
+
# else
|
| 357 |
+
# include <iostream.h>
|
| 358 |
+
# endif
|
| 359 |
+
#endif
|
| 360 |
+
|
| 361 |
+
inline void THROW(const NCursesException *e) {
|
| 362 |
+
#if defined(__GNUG__) && defined(__EXCEPTIONS)
|
| 363 |
+
# if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
|
| 364 |
+
(*lib_error_handler)(e ? e->classname() : "", e ? e->message : "");
|
| 365 |
+
# elif (__GNUG__ >= 7)
|
| 366 |
+
// g++ 7.0 warns about deprecation, but lacks the predefined symbols
|
| 367 |
+
::endwin();
|
| 368 |
+
std::cerr << "Found a problem - goodbye" << std::endl;
|
| 369 |
+
exit(EXIT_FAILURE);
|
| 370 |
+
# else
|
| 371 |
+
# define CPP_HAS_TRY_CATCH 1
|
| 372 |
+
# endif
|
| 373 |
+
#elif defined(__SUNPRO_CC)
|
| 374 |
+
# if !defined(__SUNPRO_CC_COMPAT) || (__SUNPRO_CC_COMPAT < 5)
|
| 375 |
+
genericerror(1, ((e != 0) ? (char *)(e->message) : ""));
|
| 376 |
+
# else
|
| 377 |
+
# define CPP_HAS_TRY_CATCH 1
|
| 378 |
+
# endif
|
| 379 |
+
#else
|
| 380 |
+
if (e)
|
| 381 |
+
cerr << e->message << endl;
|
| 382 |
+
exit(0);
|
| 383 |
+
#endif
|
| 384 |
+
|
| 385 |
+
#ifndef CPP_HAS_TRY_CATCH
|
| 386 |
+
#define CPP_HAS_TRY_CATCH 0
|
| 387 |
+
#define NCURSES_CPP_TRY /* nothing */
|
| 388 |
+
#define NCURSES_CPP_CATCH(e) if (false)
|
| 389 |
+
#define THROWS(s) /* nothing */
|
| 390 |
+
#define THROW2(s,t) /* nothing */
|
| 391 |
+
#elif CPP_HAS_TRY_CATCH
|
| 392 |
+
throw *e;
|
| 393 |
+
#define NCURSES_CPP_TRY try
|
| 394 |
+
#define NCURSES_CPP_CATCH(e) catch(e)
|
| 395 |
+
#if defined(__cpp_noexcept_function_type) && (__cpp_noexcept_function_type >= 201510)
|
| 396 |
+
// C++17 deprecates the usage of throw().
|
| 397 |
+
#define THROWS(s) /* nothing */
|
| 398 |
+
#define THROW2(s,t) /* nothing */
|
| 399 |
+
#else
|
| 400 |
+
#define THROWS(s) throw(s)
|
| 401 |
+
#define THROW2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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2019-2020,2021 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef FORM_H
|
| 37 |
+
#define FORM_H
|
| 38 |
+
/* *INDENT-OFF*/
|
| 39 |
+
|
| 40 |
+
#include <ncursesw/curses.h>
|
| 41 |
+
#include <ncursesw/eti.h>
|
| 42 |
+
|
| 43 |
+
#ifdef __cplusplus
|
| 44 |
+
extern "C" {
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
#if defined(BUILDING_FORM)
|
| 48 |
+
# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 49 |
+
#else
|
| 50 |
+
# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 54 |
+
|
| 55 |
+
#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
|
| 56 |
+
#define FORM_EXPORT_VAR(type) FORM_IMPEXP type
|
| 57 |
+
|
| 58 |
+
#ifndef FORM_PRIV_H
|
| 59 |
+
typedef void *FIELD_CELL;
|
| 60 |
+
#endif
|
| 61 |
+
|
| 62 |
+
#ifndef NCURSES_FIELD_INTERNALS
|
| 63 |
+
#define NCURSES_FIELD_INTERNALS /* nothing */
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
typedef int Form_Options;
|
| 67 |
+
typedef int Field_Options;
|
| 68 |
+
|
| 69 |
+
/**********
|
| 70 |
+
* _PAGE *
|
| 71 |
+
**********/
|
| 72 |
+
|
| 73 |
+
typedef struct pagenode
|
| 74 |
+
#if !NCURSES_OPAQUE_FORM
|
| 75 |
+
{
|
| 76 |
+
short pmin; /* index of first field on page */
|
| 77 |
+
short pmax; /* index of last field on page */
|
| 78 |
+
short smin; /* index of top leftmost field on page */
|
| 79 |
+
short smax; /* index of bottom rightmost field on page */
|
| 80 |
+
}
|
| 81 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 82 |
+
_PAGE;
|
| 83 |
+
|
| 84 |
+
/**********
|
| 85 |
+
* FIELD *
|
| 86 |
+
**********/
|
| 87 |
+
|
| 88 |
+
typedef struct fieldnode
|
| 89 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
| 90 |
+
{
|
| 91 |
+
unsigned short status; /* flags */
|
| 92 |
+
short rows; /* size in rows */
|
| 93 |
+
short cols; /* size in cols */
|
| 94 |
+
short frow; /* first row */
|
| 95 |
+
short fcol; /* first col */
|
| 96 |
+
int drows; /* dynamic rows */
|
| 97 |
+
int dcols; /* dynamic cols */
|
| 98 |
+
int maxgrow; /* maximum field growth */
|
| 99 |
+
int nrow; /* off-screen rows */
|
| 100 |
+
short nbuf; /* additional buffers */
|
| 101 |
+
short just; /* justification */
|
| 102 |
+
short page; /* page on form */
|
| 103 |
+
short index; /* into form -> field */
|
| 104 |
+
int pad; /* pad character */
|
| 105 |
+
chtype fore; /* foreground attribute */
|
| 106 |
+
chtype back; /* background attribute */
|
| 107 |
+
Field_Options opts; /* options */
|
| 108 |
+
struct fieldnode * snext; /* sorted order pointer */
|
| 109 |
+
struct fieldnode * sprev; /* sorted order pointer */
|
| 110 |
+
struct fieldnode * link; /* linked field chain */
|
| 111 |
+
struct formnode * form; /* containing form */
|
| 112 |
+
struct typenode * type; /* field type */
|
| 113 |
+
void * arg; /* argument for type */
|
| 114 |
+
FIELD_CELL * buf; /* field buffers */
|
| 115 |
+
void * usrptr; /* user pointer */
|
| 116 |
+
/*
|
| 117 |
+
* The wide-character configuration requires extra information. Because
|
| 118 |
+
* there are existing applications that manipulate the members of FIELD
|
| 119 |
+
* directly, we cannot make the struct opaque, except by changing the ABI.
|
| 120 |
+
* Offsets of members up to this point are the same in the narrow- and
|
| 121 |
+
* wide-character configuration. But note that the type of buf depends on
|
| 122 |
+
* the configuration, and is made opaque for that reason.
|
| 123 |
+
*/
|
| 124 |
+
NCURSES_FIELD_INTERNALS
|
| 125 |
+
}
|
| 126 |
+
#endif /* NCURSES_OPAQUE_FORM */
|
| 127 |
+
FIELD;
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
/*********
|
| 131 |
+
* FORM *
|
| 132 |
+
*********/
|
| 133 |
+
|
| 134 |
+
typedef struct formnode
|
| 135 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
| 136 |
+
{
|
| 137 |
+
unsigned short status; /* flags */
|
| 138 |
+
short rows; /* size in rows */
|
| 139 |
+
short cols; /* size in cols */
|
| 140 |
+
int currow; /* current row in field window */
|
| 141 |
+
int curcol; /* current col in field window */
|
| 142 |
+
int toprow; /* in scrollable field window */
|
| 143 |
+
int begincol; /* in horiz. scrollable field */
|
| 144 |
+
short maxfield; /* number of fields */
|
| 145 |
+
short maxpage; /* number of pages */
|
| 146 |
+
short curpage; /* index into page */
|
| 147 |
+
Form_Options opts; /* options */
|
| 148 |
+
WINDOW * win; /* window */
|
| 149 |
+
WINDOW * sub; /* subwindow */
|
| 150 |
+
WINDOW * w; /* window for current field */
|
| 151 |
+
FIELD ** field; /* field [maxfield] */
|
| 152 |
+
FIELD * current; /* current field */
|
| 153 |
+
_PAGE * page; /* page [maxpage] */
|
| 154 |
+
void * usrptr; /* user pointer */
|
| 155 |
+
|
| 156 |
+
void (*forminit)(struct formnode *);
|
| 157 |
+
void (*formterm)(struct formnode *);
|
| 158 |
+
void (*fieldinit)(struct formnode *);
|
| 159 |
+
void (*fieldterm)(struct formnode *);
|
| 160 |
+
|
| 161 |
+
}
|
| 162 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 163 |
+
FORM;
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
/**************
|
| 167 |
+
* FIELDTYPE *
|
| 168 |
+
**************/
|
| 169 |
+
|
| 170 |
+
typedef struct typenode
|
| 171 |
+
#if !NCURSES_OPAQUE_FORM
|
| 172 |
+
{
|
| 173 |
+
unsigned short status; /* flags */
|
| 174 |
+
long ref; /* reference count */
|
| 175 |
+
struct typenode * left; /* ptr to operand for | */
|
| 176 |
+
struct typenode * right; /* ptr to operand for | */
|
| 177 |
+
|
| 178 |
+
void* (*makearg)(va_list *); /* make fieldtype arg */
|
| 179 |
+
void* (*copyarg)(const void *); /* copy fieldtype arg */
|
| 180 |
+
void (*freearg)(void *); /* free fieldtype arg */
|
| 181 |
+
|
| 182 |
+
#if NCURSES_INTEROP_FUNCS
|
| 183 |
+
union {
|
| 184 |
+
bool (*ofcheck)(FIELD *,const void *); /* field validation */
|
| 185 |
+
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
|
| 186 |
+
} fieldcheck;
|
| 187 |
+
union {
|
| 188 |
+
bool (*occheck)(int,const void *); /* character validation */
|
| 189 |
+
bool (*gccheck)(int,FORM*,
|
| 190 |
+
FIELD*,const void*); /* generic char validation */
|
| 191 |
+
} charcheck;
|
| 192 |
+
union {
|
| 193 |
+
bool (*onext)(FIELD *,const void *); /* enumerate next value */
|
| 194 |
+
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
|
| 195 |
+
} enum_next;
|
| 196 |
+
union {
|
| 197 |
+
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
|
| 198 |
+
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
|
| 199 |
+
} enum_prev;
|
| 200 |
+
void* (*genericarg)(void*); /* Alternate Arg method */
|
| 201 |
+
#else
|
| 202 |
+
bool (*fcheck)(FIELD *,const void *); /* field validation */
|
| 203 |
+
bool (*ccheck)(int,const void *); /* character validation */
|
| 204 |
+
|
| 205 |
+
bool (*next)(FIELD *,const void *); /* enumerate next value */
|
| 206 |
+
bool (*prev)(FIELD *,const void *); /* enumerate prev value */
|
| 207 |
+
#endif
|
| 208 |
+
}
|
| 209 |
+
#endif /* !NCURSES_OPAQUE_FORM */
|
| 210 |
+
FIELDTYPE;
|
| 211 |
+
|
| 212 |
+
typedef void (*Form_Hook)(FORM *);
|
| 213 |
+
|
| 214 |
+
/***************************
|
| 215 |
+
* miscellaneous #defines *
|
| 216 |
+
***************************/
|
| 217 |
+
|
| 218 |
+
/* field justification */
|
| 219 |
+
#define NO_JUSTIFICATION (0)
|
| 220 |
+
#define JUSTIFY_LEFT (1)
|
| 221 |
+
#define JUSTIFY_CENTER (2)
|
| 222 |
+
#define JUSTIFY_RIGHT (3)
|
| 223 |
+
|
| 224 |
+
/* field options */
|
| 225 |
+
#define O_VISIBLE (0x0001U)
|
| 226 |
+
#define O_ACTIVE (0x0002U)
|
| 227 |
+
#define O_PUBLIC (0x0004U)
|
| 228 |
+
#define O_EDIT (0x0008U)
|
| 229 |
+
#define O_WRAP (0x0010U)
|
| 230 |
+
#define O_BLANK (0x0020U)
|
| 231 |
+
#define O_AUTOSKIP (0x0040U)
|
| 232 |
+
#define O_NULLOK (0x0080U)
|
| 233 |
+
#define O_PASSOK (0x0100U)
|
| 234 |
+
#define O_STATIC (0x0200U)
|
| 235 |
+
#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
|
| 236 |
+
#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */
|
| 237 |
+
#define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */
|
| 238 |
+
#define O_INPUT_LIMIT (0x2000U) /* ncurses extension */
|
| 239 |
+
|
| 240 |
+
/* form options */
|
| 241 |
+
#define O_NL_OVERLOAD (0x0001U)
|
| 242 |
+
#define O_BS_OVERLOAD (0x0002U)
|
| 243 |
+
|
| 244 |
+
/* form driver commands */
|
| 245 |
+
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
|
| 246 |
+
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
|
| 247 |
+
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
|
| 248 |
+
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
|
| 249 |
+
|
| 250 |
+
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
|
| 251 |
+
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
|
| 252 |
+
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
|
| 253 |
+
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
|
| 254 |
+
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
|
| 255 |
+
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
|
| 256 |
+
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
|
| 257 |
+
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
|
| 258 |
+
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
|
| 259 |
+
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
|
| 260 |
+
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
|
| 261 |
+
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
|
| 262 |
+
|
| 263 |
+
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
|
| 264 |
+
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
|
| 265 |
+
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
|
| 266 |
+
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
|
| 267 |
+
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
|
| 268 |
+
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
|
| 269 |
+
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
|
| 270 |
+
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
|
| 271 |
+
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
|
| 272 |
+
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
|
| 273 |
+
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
|
| 274 |
+
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
|
| 275 |
+
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
|
| 276 |
+
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
|
| 277 |
+
|
| 278 |
+
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
|
| 279 |
+
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
|
| 280 |
+
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
|
| 281 |
+
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
|
| 282 |
+
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
|
| 283 |
+
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
|
| 284 |
+
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
|
| 285 |
+
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
|
| 286 |
+
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
|
| 287 |
+
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
|
| 288 |
+
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
|
| 289 |
+
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
|
| 290 |
+
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
|
| 291 |
+
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
|
| 292 |
+
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
|
| 293 |
+
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
|
| 294 |
+
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
|
| 295 |
+
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
|
| 296 |
+
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
|
| 297 |
+
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
|
| 298 |
+
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
|
| 299 |
+
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
|
| 300 |
+
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
|
| 301 |
+
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
|
| 302 |
+
|
| 303 |
+
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
|
| 304 |
+
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
|
| 305 |
+
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
|
| 306 |
+
|
| 307 |
+
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
|
| 308 |
+
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
|
| 309 |
+
|
| 310 |
+
#if defined(MAX_COMMAND)
|
| 311 |
+
# if (MAX_FORM_COMMAND > MAX_COMMAND)
|
| 312 |
+
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
|
| 313 |
+
# elif (MAX_COMMAND != (KEY_MAX + 128))
|
| 314 |
+
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
|
| 315 |
+
# endif
|
| 316 |
+
#else
|
| 317 |
+
# define MAX_COMMAND (KEY_MAX + 128)
|
| 318 |
+
#endif
|
| 319 |
+
|
| 320 |
+
/*************************
|
| 321 |
+
* standard field types *
|
| 322 |
+
*************************/
|
| 323 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
|
| 324 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
|
| 325 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
|
| 326 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
|
| 327 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
|
| 328 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
|
| 329 |
+
|
| 330 |
+
/************************************
|
| 331 |
+
* built-in additional field types *
|
| 332 |
+
* They are not defined in SVr4 *
|
| 333 |
+
************************************/
|
| 334 |
+
extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
|
| 335 |
+
|
| 336 |
+
/***********************
|
| 337 |
+
* FIELDTYPE routines *
|
| 338 |
+
***********************/
|
| 339 |
+
extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
|
| 340 |
+
bool (* const field_check)(FIELD *,const void *),
|
| 341 |
+
bool (* const char_check)(int,const void *));
|
| 342 |
+
extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
|
| 343 |
+
FIELDTYPE *, FIELDTYPE *);
|
| 344 |
+
|
| 345 |
+
extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *);
|
| 346 |
+
extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
|
| 347 |
+
void * (* const make_arg)(va_list *),
|
| 348 |
+
void * (* const copy_arg)(const void *),
|
| 349 |
+
void (* const free_arg)(void *));
|
| 350 |
+
extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
|
| 351 |
+
bool (* const next_choice)(FIELD *,const void *),
|
| 352 |
+
bool (* const prev_choice)(FIELD *,const void *));
|
| 353 |
+
|
| 354 |
+
/*******************
|
| 355 |
+
* FIELD routines *
|
| 356 |
+
*******************/
|
| 357 |
+
extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
|
| 358 |
+
extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int);
|
| 359 |
+
extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int);
|
| 360 |
+
|
| 361 |
+
extern FORM_EXPORT(int) free_field (FIELD *);
|
| 362 |
+
extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
|
| 363 |
+
extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
|
| 364 |
+
extern FORM_EXPORT(int) set_max_field ( FIELD *,int);
|
| 365 |
+
extern FORM_EXPORT(int) move_field (FIELD *,int,int);
|
| 366 |
+
extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
|
| 367 |
+
extern FORM_EXPORT(int) set_new_page (FIELD *,bool);
|
| 368 |
+
extern FORM_EXPORT(int) set_field_just (FIELD *,int);
|
| 369 |
+
extern FORM_EXPORT(int) field_just (const FIELD *);
|
| 370 |
+
extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype);
|
| 371 |
+
extern FORM_EXPORT(int) set_field_back (FIELD *,chtype);
|
| 372 |
+
extern FORM_EXPORT(int) set_field_pad (FIELD *,int);
|
| 373 |
+
extern FORM_EXPORT(int) field_pad (const FIELD *);
|
| 374 |
+
extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
|
| 375 |
+
extern FORM_EXPORT(int) set_field_status (FIELD *,bool);
|
| 376 |
+
extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *);
|
| 377 |
+
extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options);
|
| 378 |
+
extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options);
|
| 379 |
+
extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options);
|
| 380 |
+
|
| 381 |
+
extern FORM_EXPORT(chtype) field_fore (const FIELD *);
|
| 382 |
+
extern FORM_EXPORT(chtype) field_back (const FIELD *);
|
| 383 |
+
|
| 384 |
+
extern FORM_EXPORT(bool) new_page (const FIELD *);
|
| 385 |
+
extern FORM_EXPORT(bool) field_status (const FIELD *);
|
| 386 |
+
|
| 387 |
+
extern FORM_EXPORT(void *) field_arg (const FIELD *);
|
| 388 |
+
|
| 389 |
+
extern FORM_EXPORT(void *) field_userptr (const FIELD *);
|
| 390 |
+
|
| 391 |
+
extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *);
|
| 392 |
+
|
| 393 |
+
extern FORM_EXPORT(char *) field_buffer (const FIELD *,int);
|
| 394 |
+
|
| 395 |
+
extern FORM_EXPORT(Field_Options) field_opts (const FIELD *);
|
| 396 |
+
|
| 397 |
+
/******************
|
| 398 |
+
* FORM routines *
|
| 399 |
+
******************/
|
| 400 |
+
|
| 401 |
+
extern FORM_EXPORT(FORM *) new_form (FIELD **);
|
| 402 |
+
|
| 403 |
+
extern FORM_EXPORT(FIELD **) form_fields (const FORM *);
|
| 404 |
+
extern FORM_EXPORT(FIELD *) current_field (const FORM *);
|
| 405 |
+
|
| 406 |
+
extern FORM_EXPORT(WINDOW *) form_win (const FORM *);
|
| 407 |
+
extern FORM_EXPORT(WINDOW *) form_sub (const FORM *);
|
| 408 |
+
|
| 409 |
+
extern FORM_EXPORT(Form_Hook) form_init (const FORM *);
|
| 410 |
+
extern FORM_EXPORT(Form_Hook) form_term (const FORM *);
|
| 411 |
+
extern FORM_EXPORT(Form_Hook) field_init (const FORM *);
|
| 412 |
+
extern FORM_EXPORT(Form_Hook) field_term (const FORM *);
|
| 413 |
+
|
| 414 |
+
extern FORM_EXPORT(int) free_form (FORM *);
|
| 415 |
+
extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **);
|
| 416 |
+
extern FORM_EXPORT(int) field_count (const FORM *);
|
| 417 |
+
extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *);
|
| 418 |
+
extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *);
|
| 419 |
+
extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *);
|
| 420 |
+
extern FORM_EXPORT(int) unfocus_current_field (FORM *);
|
| 421 |
+
extern FORM_EXPORT(int) field_index (const FIELD *);
|
| 422 |
+
extern FORM_EXPORT(int) set_form_page (FORM *,int);
|
| 423 |
+
extern FORM_EXPORT(int) form_page (const FORM *);
|
| 424 |
+
extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *);
|
| 425 |
+
extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook);
|
| 426 |
+
extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook);
|
| 427 |
+
extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook);
|
| 428 |
+
extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook);
|
| 429 |
+
extern FORM_EXPORT(int) post_form (FORM *);
|
| 430 |
+
extern FORM_EXPORT(int) unpost_form (FORM *);
|
| 431 |
+
extern FORM_EXPORT(int) pos_form_cursor (FORM *);
|
| 432 |
+
extern FORM_EXPORT(int) form_driver (FORM *,int);
|
| 433 |
+
# if NCURSES_WIDECHAR
|
| 434 |
+
extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
|
| 435 |
+
# endif
|
| 436 |
+
extern FORM_EXPORT(int) set_form_userptr (FORM *,void *);
|
| 437 |
+
extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options);
|
| 438 |
+
extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options);
|
| 439 |
+
extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options);
|
| 440 |
+
extern FORM_EXPORT(int) form_request_by_name (const char *);
|
| 441 |
+
|
| 442 |
+
extern FORM_EXPORT(const char *) form_request_name (int);
|
| 443 |
+
|
| 444 |
+
extern FORM_EXPORT(void *) form_userptr (const FORM *);
|
| 445 |
+
|
| 446 |
+
extern FORM_EXPORT(Form_Options) form_opts (const FORM *);
|
| 447 |
+
|
| 448 |
+
extern FORM_EXPORT(bool) data_ahead (const FORM *);
|
| 449 |
+
extern FORM_EXPORT(bool) data_behind (const FORM *);
|
| 450 |
+
|
| 451 |
+
#if NCURSES_SP_FUNCS
|
| 452 |
+
extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
|
| 453 |
+
#endif
|
| 454 |
+
|
| 455 |
+
#ifdef __cplusplus
|
| 456 |
+
}
|
| 457 |
+
#endif
|
| 458 |
+
/* *INDENT-ON*/
|
| 459 |
+
|
| 460 |
+
#endif /* FORM_H */
|
emu3/include/ncursesw/menu.h
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Juergen Pfeifer, 1995,1997 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: menu.h,v 1.26 2020/12/12 00:38:02 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef ETI_MENU
|
| 37 |
+
#define ETI_MENU
|
| 38 |
+
|
| 39 |
+
#ifdef AMIGA
|
| 40 |
+
#define TEXT TEXT_ncurses
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#include <ncursesw/curses.h>
|
| 44 |
+
#include <ncursesw/eti.h>
|
| 45 |
+
|
| 46 |
+
#ifdef __cplusplus
|
| 47 |
+
extern "C"
|
| 48 |
+
{
|
| 49 |
+
#endif
|
| 50 |
+
|
| 51 |
+
#if defined(BUILDING_MENU)
|
| 52 |
+
# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 53 |
+
#else
|
| 54 |
+
# define MENU_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 55 |
+
#endif
|
| 56 |
+
|
| 57 |
+
#define MENU_WRAPPED_VAR(type,name) extern MENU_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 58 |
+
|
| 59 |
+
#define MENU_EXPORT(type) MENU_IMPEXP type NCURSES_API
|
| 60 |
+
#define MENU_EXPORT_VAR(type) MENU_IMPEXP type
|
| 61 |
+
|
| 62 |
+
typedef int Menu_Options;
|
| 63 |
+
typedef int Item_Options;
|
| 64 |
+
|
| 65 |
+
/* Menu options: */
|
| 66 |
+
#define O_ONEVALUE (0x01)
|
| 67 |
+
#define O_SHOWDESC (0x02)
|
| 68 |
+
#define O_ROWMAJOR (0x04)
|
| 69 |
+
#define O_IGNORECASE (0x08)
|
| 70 |
+
#define O_SHOWMATCH (0x10)
|
| 71 |
+
#define O_NONCYCLIC (0x20)
|
| 72 |
+
#define O_MOUSE_MENU (0x40)
|
| 73 |
+
|
| 74 |
+
/* Item options: */
|
| 75 |
+
#define O_SELECTABLE (0x01)
|
| 76 |
+
|
| 77 |
+
#if !NCURSES_OPAQUE_MENU
|
| 78 |
+
typedef struct
|
| 79 |
+
{
|
| 80 |
+
const char *str;
|
| 81 |
+
unsigned short length;
|
| 82 |
+
}
|
| 83 |
+
TEXT;
|
| 84 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 85 |
+
|
| 86 |
+
struct tagMENU;
|
| 87 |
+
|
| 88 |
+
typedef struct tagITEM
|
| 89 |
+
#if !NCURSES_OPAQUE_MENU
|
| 90 |
+
{
|
| 91 |
+
TEXT name; /* name of menu item */
|
| 92 |
+
TEXT description; /* description of item, optional in display */
|
| 93 |
+
struct tagMENU *imenu; /* Pointer to parent menu */
|
| 94 |
+
void *userptr; /* Pointer to user defined per item data */
|
| 95 |
+
Item_Options opt; /* Item options */
|
| 96 |
+
short index; /* Item number if connected to a menu */
|
| 97 |
+
short y; /* y and x location of item in menu */
|
| 98 |
+
short x;
|
| 99 |
+
bool value; /* Selection value */
|
| 100 |
+
|
| 101 |
+
struct tagITEM *left; /* neighbor items */
|
| 102 |
+
struct tagITEM *right;
|
| 103 |
+
struct tagITEM *up;
|
| 104 |
+
struct tagITEM *down;
|
| 105 |
+
|
| 106 |
+
}
|
| 107 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 108 |
+
ITEM;
|
| 109 |
+
|
| 110 |
+
typedef void (*Menu_Hook) (struct tagMENU *);
|
| 111 |
+
|
| 112 |
+
typedef struct tagMENU
|
| 113 |
+
#if 1 /* not yet: !NCURSES_OPAQUE_MENU */
|
| 114 |
+
{
|
| 115 |
+
short height; /* Nr. of chars high */
|
| 116 |
+
short width; /* Nr. of chars wide */
|
| 117 |
+
short rows; /* Nr. of items high */
|
| 118 |
+
short cols; /* Nr. of items wide */
|
| 119 |
+
short frows; /* Nr. of formatted items high */
|
| 120 |
+
short fcols; /* Nr. of formatted items wide */
|
| 121 |
+
short arows; /* Nr. of items high (actual) */
|
| 122 |
+
short namelen; /* Max. name length */
|
| 123 |
+
short desclen; /* Max. description length */
|
| 124 |
+
short marklen; /* Length of mark, if any */
|
| 125 |
+
short itemlen; /* Length of one item */
|
| 126 |
+
short spc_desc; /* Spacing for descriptor */
|
| 127 |
+
short spc_cols; /* Spacing for columns */
|
| 128 |
+
short spc_rows; /* Spacing for rows */
|
| 129 |
+
char *pattern; /* Buffer to store match chars */
|
| 130 |
+
short pindex; /* Index into pattern buffer */
|
| 131 |
+
WINDOW *win; /* Window containing menu */
|
| 132 |
+
WINDOW *sub; /* Subwindow for menu display */
|
| 133 |
+
WINDOW *userwin; /* User's window */
|
| 134 |
+
WINDOW *usersub; /* User's subwindow */
|
| 135 |
+
ITEM **items; /* array of items */
|
| 136 |
+
short nitems; /* Nr. of items in menu */
|
| 137 |
+
ITEM *curitem; /* Current item */
|
| 138 |
+
short toprow; /* Top row of menu */
|
| 139 |
+
chtype fore; /* Selection attribute */
|
| 140 |
+
chtype back; /* Nonselection attribute */
|
| 141 |
+
chtype grey; /* Inactive attribute */
|
| 142 |
+
unsigned char pad; /* Pad character */
|
| 143 |
+
|
| 144 |
+
Menu_Hook menuinit; /* User hooks */
|
| 145 |
+
Menu_Hook menuterm;
|
| 146 |
+
Menu_Hook iteminit;
|
| 147 |
+
Menu_Hook itemterm;
|
| 148 |
+
|
| 149 |
+
void *userptr; /* Pointer to menus user data */
|
| 150 |
+
char *mark; /* Pointer to marker string */
|
| 151 |
+
|
| 152 |
+
Menu_Options opt; /* Menu options */
|
| 153 |
+
unsigned short status; /* Internal state of menu */
|
| 154 |
+
}
|
| 155 |
+
#endif /* !NCURSES_OPAQUE_MENU */
|
| 156 |
+
MENU;
|
| 157 |
+
|
| 158 |
+
/* Define keys */
|
| 159 |
+
|
| 160 |
+
#define REQ_LEFT_ITEM (KEY_MAX + 1)
|
| 161 |
+
#define REQ_RIGHT_ITEM (KEY_MAX + 2)
|
| 162 |
+
#define REQ_UP_ITEM (KEY_MAX + 3)
|
| 163 |
+
#define REQ_DOWN_ITEM (KEY_MAX + 4)
|
| 164 |
+
#define REQ_SCR_ULINE (KEY_MAX + 5)
|
| 165 |
+
#define REQ_SCR_DLINE (KEY_MAX + 6)
|
| 166 |
+
#define REQ_SCR_DPAGE (KEY_MAX + 7)
|
| 167 |
+
#define REQ_SCR_UPAGE (KEY_MAX + 8)
|
| 168 |
+
#define REQ_FIRST_ITEM (KEY_MAX + 9)
|
| 169 |
+
#define REQ_LAST_ITEM (KEY_MAX + 10)
|
| 170 |
+
#define REQ_NEXT_ITEM (KEY_MAX + 11)
|
| 171 |
+
#define REQ_PREV_ITEM (KEY_MAX + 12)
|
| 172 |
+
#define REQ_TOGGLE_ITEM (KEY_MAX + 13)
|
| 173 |
+
#define REQ_CLEAR_PATTERN (KEY_MAX + 14)
|
| 174 |
+
#define REQ_BACK_PATTERN (KEY_MAX + 15)
|
| 175 |
+
#define REQ_NEXT_MATCH (KEY_MAX + 16)
|
| 176 |
+
#define REQ_PREV_MATCH (KEY_MAX + 17)
|
| 177 |
+
|
| 178 |
+
#define MIN_MENU_COMMAND (KEY_MAX + 1)
|
| 179 |
+
#define MAX_MENU_COMMAND (KEY_MAX + 17)
|
| 180 |
+
|
| 181 |
+
/*
|
| 182 |
+
* Some AT&T code expects MAX_COMMAND to be out-of-band not
|
| 183 |
+
* just for menu commands but for forms ones as well.
|
| 184 |
+
*/
|
| 185 |
+
#if defined(MAX_COMMAND)
|
| 186 |
+
# if (MAX_MENU_COMMAND > MAX_COMMAND)
|
| 187 |
+
# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
|
| 188 |
+
# elif (MAX_COMMAND != (KEY_MAX + 128))
|
| 189 |
+
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
|
| 190 |
+
# endif
|
| 191 |
+
#else
|
| 192 |
+
# define MAX_COMMAND (KEY_MAX + 128)
|
| 193 |
+
#endif
|
| 194 |
+
|
| 195 |
+
/* --------- prototypes for libmenu functions ----------------------------- */
|
| 196 |
+
|
| 197 |
+
extern MENU_EXPORT(ITEM **) menu_items(const MENU *);
|
| 198 |
+
extern MENU_EXPORT(ITEM *) current_item(const MENU *);
|
| 199 |
+
extern MENU_EXPORT(ITEM *) new_item(const char *, const char *);
|
| 200 |
+
|
| 201 |
+
extern MENU_EXPORT(MENU *) new_menu(ITEM **);
|
| 202 |
+
|
| 203 |
+
extern MENU_EXPORT(Item_Options) item_opts(const ITEM *);
|
| 204 |
+
extern MENU_EXPORT(Menu_Options) menu_opts(const MENU *);
|
| 205 |
+
|
| 206 |
+
extern MENU_EXPORT(Menu_Hook) item_init(const MENU *);
|
| 207 |
+
extern MENU_EXPORT(Menu_Hook) item_term(const MENU *);
|
| 208 |
+
extern MENU_EXPORT(Menu_Hook) menu_init(const MENU *);
|
| 209 |
+
extern MENU_EXPORT(Menu_Hook) menu_term(const MENU *);
|
| 210 |
+
|
| 211 |
+
extern MENU_EXPORT(WINDOW *) menu_sub(const MENU *);
|
| 212 |
+
extern MENU_EXPORT(WINDOW *) menu_win(const MENU *);
|
| 213 |
+
|
| 214 |
+
extern MENU_EXPORT(const char *) item_description(const ITEM *);
|
| 215 |
+
extern MENU_EXPORT(const char *) item_name(const ITEM *);
|
| 216 |
+
extern MENU_EXPORT(const char *) menu_mark(const MENU *);
|
| 217 |
+
extern MENU_EXPORT(const char *) menu_request_name(int);
|
| 218 |
+
|
| 219 |
+
extern MENU_EXPORT(char *) menu_pattern(const MENU *);
|
| 220 |
+
|
| 221 |
+
extern MENU_EXPORT(void *) menu_userptr(const MENU *);
|
| 222 |
+
extern MENU_EXPORT(void *) item_userptr(const ITEM *);
|
| 223 |
+
|
| 224 |
+
extern MENU_EXPORT(chtype) menu_back(const MENU *);
|
| 225 |
+
extern MENU_EXPORT(chtype) menu_fore(const MENU *);
|
| 226 |
+
extern MENU_EXPORT(chtype) menu_grey(const MENU *);
|
| 227 |
+
|
| 228 |
+
extern MENU_EXPORT(int) free_item(ITEM *);
|
| 229 |
+
extern MENU_EXPORT(int) free_menu(MENU *);
|
| 230 |
+
extern MENU_EXPORT(int) item_count(const MENU *);
|
| 231 |
+
extern MENU_EXPORT(int) item_index(const ITEM *);
|
| 232 |
+
extern MENU_EXPORT(int) item_opts_off(ITEM *, Item_Options);
|
| 233 |
+
extern MENU_EXPORT(int) item_opts_on(ITEM *, Item_Options);
|
| 234 |
+
extern MENU_EXPORT(int) menu_driver(MENU *, int);
|
| 235 |
+
extern MENU_EXPORT(int) menu_opts_off(MENU *, Menu_Options);
|
| 236 |
+
extern MENU_EXPORT(int) menu_opts_on(MENU *, Menu_Options);
|
| 237 |
+
extern MENU_EXPORT(int) menu_pad(const MENU *);
|
| 238 |
+
extern MENU_EXPORT(int) pos_menu_cursor(const MENU *);
|
| 239 |
+
extern MENU_EXPORT(int) post_menu(MENU *);
|
| 240 |
+
extern MENU_EXPORT(int) scale_menu(const MENU *, int *, int *);
|
| 241 |
+
extern MENU_EXPORT(int) set_current_item(MENU *menu, ITEM *item);
|
| 242 |
+
extern MENU_EXPORT(int) set_item_init(MENU *, Menu_Hook);
|
| 243 |
+
extern MENU_EXPORT(int) set_item_opts(ITEM *, Item_Options);
|
| 244 |
+
extern MENU_EXPORT(int) set_item_term(MENU *, Menu_Hook);
|
| 245 |
+
extern MENU_EXPORT(int) set_item_userptr(ITEM *, void *);
|
| 246 |
+
extern MENU_EXPORT(int) set_item_value(ITEM *, bool);
|
| 247 |
+
extern MENU_EXPORT(int) set_menu_back(MENU *, chtype);
|
| 248 |
+
extern MENU_EXPORT(int) set_menu_fore(MENU *, chtype);
|
| 249 |
+
extern MENU_EXPORT(int) set_menu_format(MENU *, int, int);
|
| 250 |
+
extern MENU_EXPORT(int) set_menu_grey(MENU *, chtype);
|
| 251 |
+
extern MENU_EXPORT(int) set_menu_init(MENU *, Menu_Hook);
|
| 252 |
+
extern MENU_EXPORT(int) set_menu_items(MENU *, ITEM **);
|
| 253 |
+
extern MENU_EXPORT(int) set_menu_mark(MENU *, const char *);
|
| 254 |
+
extern MENU_EXPORT(int) set_menu_opts(MENU *, Menu_Options);
|
| 255 |
+
extern MENU_EXPORT(int) set_menu_pad(MENU *, int);
|
| 256 |
+
extern MENU_EXPORT(int) set_menu_pattern(MENU *, const char *);
|
| 257 |
+
extern MENU_EXPORT(int) set_menu_sub(MENU *, WINDOW *);
|
| 258 |
+
extern MENU_EXPORT(int) set_menu_term(MENU *, Menu_Hook);
|
| 259 |
+
extern MENU_EXPORT(int) set_menu_userptr(MENU *, void *);
|
| 260 |
+
extern MENU_EXPORT(int) set_menu_win(MENU *, WINDOW *);
|
| 261 |
+
extern MENU_EXPORT(int) set_top_row(MENU *, int);
|
| 262 |
+
extern MENU_EXPORT(int) top_row(const MENU *);
|
| 263 |
+
extern MENU_EXPORT(int) unpost_menu(MENU *);
|
| 264 |
+
extern MENU_EXPORT(int) menu_request_by_name(const char *);
|
| 265 |
+
extern MENU_EXPORT(int) set_menu_spacing(MENU *, int, int, int);
|
| 266 |
+
extern MENU_EXPORT(int) menu_spacing(const MENU *, int *, int *, int *);
|
| 267 |
+
|
| 268 |
+
extern MENU_EXPORT(bool) item_value(const ITEM *);
|
| 269 |
+
extern MENU_EXPORT(bool) item_visible(const ITEM *);
|
| 270 |
+
|
| 271 |
+
extern MENU_EXPORT(void) menu_format(const MENU *, int *, int *);
|
| 272 |
+
|
| 273 |
+
#if NCURSES_SP_FUNCS
|
| 274 |
+
extern MENU_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN *, ITEM **);
|
| 275 |
+
#endif
|
| 276 |
+
|
| 277 |
+
#ifdef __cplusplus
|
| 278 |
+
}
|
| 279 |
+
#endif
|
| 280 |
+
|
| 281 |
+
#endif /* ETI_MENU */
|
emu3/include/ncursesw/nc_tparm.h
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018,2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 2006-2012,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Thomas E. Dickey 2006 *
|
| 32 |
+
****************************************************************************/
|
| 33 |
+
|
| 34 |
+
/* $Id: nc_tparm.h,v 1.11 2020/05/27 23:33:31 tom Exp $ */
|
| 35 |
+
|
| 36 |
+
#ifndef NC_TPARM_included
|
| 37 |
+
#define NC_TPARM_included 1
|
| 38 |
+
|
| 39 |
+
#include <ncurses_cfg.h>
|
| 40 |
+
#include <ncursesw/curses.h>
|
| 41 |
+
|
| 42 |
+
/*
|
| 43 |
+
* Cast parameters past the formatting-string for tparm() to match the
|
| 44 |
+
* assumption of the varargs code.
|
| 45 |
+
*/
|
| 46 |
+
#ifndef TPARM_ARG
|
| 47 |
+
#ifdef NCURSES_TPARM_ARG
|
| 48 |
+
#define TPARM_ARG NCURSES_TPARM_ARG
|
| 49 |
+
#else
|
| 50 |
+
#define TPARM_ARG long
|
| 51 |
+
#endif
|
| 52 |
+
#endif /* TPARAM_ARG */
|
| 53 |
+
|
| 54 |
+
#define TPARM_N(n) (TPARM_ARG)(n)
|
| 55 |
+
|
| 56 |
+
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
|
| 57 |
+
|
| 58 |
+
#if NCURSES_TPARM_VARARGS
|
| 59 |
+
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
|
| 60 |
+
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
|
| 61 |
+
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
|
| 62 |
+
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
|
| 63 |
+
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
|
| 64 |
+
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
|
| 65 |
+
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
|
| 66 |
+
#define TPARM_1(a,b) tparm(a,TPARM_N(b))
|
| 67 |
+
#define TPARM_0(a) tparm(a)
|
| 68 |
+
#else
|
| 69 |
+
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
|
| 70 |
+
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
|
| 71 |
+
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
|
| 72 |
+
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
|
| 73 |
+
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
|
| 74 |
+
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
|
| 75 |
+
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
|
| 76 |
+
#define TPARM_1(a,b) TPARM_2(a,b,0)
|
| 77 |
+
#define TPARM_0(a) TPARM_1(a,0)
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
#ifdef NCURSES_INTERNALS
|
| 81 |
+
#define TIPARM_1(s,a) _nc_tiparm(1,s,a)
|
| 82 |
+
#define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b)
|
| 83 |
+
#define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c)
|
| 84 |
+
#define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d)
|
| 85 |
+
#define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e)
|
| 86 |
+
#define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f)
|
| 87 |
+
#define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g)
|
| 88 |
+
#define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h)
|
| 89 |
+
#define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i)
|
| 90 |
+
#endif
|
| 91 |
+
|
| 92 |
+
#endif /* NC_TPARM_included */
|
emu3/include/ncursesw/ncurses.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
emu3/include/ncursesw/ncurses_dll.h
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018,2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 2009,2014 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
/* $Id: ncurses_dll.h.in,v 1.17 2020/09/05 17:58:47 juergen Exp $ */
|
| 30 |
+
|
| 31 |
+
#ifndef NCURSES_DLL_H_incl
|
| 32 |
+
#define NCURSES_DLL_H_incl 1
|
| 33 |
+
|
| 34 |
+
/*
|
| 35 |
+
* MinGW gcc (unlike MSYS2 and Cygwin) should define _WIN32 and possibly _WIN64.
|
| 36 |
+
*/
|
| 37 |
+
#if defined(__MINGW64__)
|
| 38 |
+
|
| 39 |
+
#ifndef _WIN64
|
| 40 |
+
#define _WIN64 1
|
| 41 |
+
#endif
|
| 42 |
+
|
| 43 |
+
#elif defined(__MINGW32__)
|
| 44 |
+
|
| 45 |
+
#ifndef _WIN32
|
| 46 |
+
#define _WIN32 1
|
| 47 |
+
#endif
|
| 48 |
+
|
| 49 |
+
/* 2014-08-02 workaround for broken MinGW compiler.
|
| 50 |
+
* Oddly, only TRACE is mapped to trace - the other -D's are okay.
|
| 51 |
+
* suggest TDM as an alternative.
|
| 52 |
+
*/
|
| 53 |
+
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
|
| 54 |
+
|
| 55 |
+
#ifdef trace
|
| 56 |
+
#undef trace
|
| 57 |
+
#define TRACE
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#endif /* broken compiler */
|
| 61 |
+
|
| 62 |
+
#endif /* MingW */
|
| 63 |
+
|
| 64 |
+
/*
|
| 65 |
+
* For reentrant code, we map the various global variables into SCREEN by
|
| 66 |
+
* using functions to access them.
|
| 67 |
+
*/
|
| 68 |
+
#define NCURSES_PUBLIC_VAR(name) _nc_##name
|
| 69 |
+
|
| 70 |
+
#if defined(BUILDING_NCURSES)
|
| 71 |
+
# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 72 |
+
#else
|
| 73 |
+
# define NCURSES_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#define NCURSES_WRAPPED_VAR(type,name) extern NCURSES_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 77 |
+
|
| 78 |
+
#define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
|
| 79 |
+
#define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
|
| 80 |
+
|
| 81 |
+
/*
|
| 82 |
+
* These symbols hide dllimport/dllexport, for compilers which care about it.
|
| 83 |
+
*/
|
| 84 |
+
#if defined(__CYGWIN__) || (defined(_WIN32) || defined(_WIN64))
|
| 85 |
+
# if defined(NCURSES_STATIC) /* "static" here only implies "not-a-DLL" */
|
| 86 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT
|
| 87 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT
|
| 88 |
+
# else
|
| 89 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT __declspec(dllimport)
|
| 90 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT __declspec(dllexport)
|
| 91 |
+
# endif
|
| 92 |
+
# define NCURSES_API __cdecl
|
| 93 |
+
#else
|
| 94 |
+
# define NCURSES_EXPORT_GENERAL_IMPORT
|
| 95 |
+
# define NCURSES_EXPORT_GENERAL_EXPORT
|
| 96 |
+
# define NCURSES_API /* FIXME: __attribute__ ((cdecl)) is only available on x86 */
|
| 97 |
+
#endif
|
| 98 |
+
|
| 99 |
+
#endif /* NCURSES_DLL_H_incl */
|
emu3/include/ncursesw/panel.h
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2009,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
* and: Juergen Pfeifer 1996-1999,2008 *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */
|
| 37 |
+
|
| 38 |
+
/* panel.h -- interface file for panels library */
|
| 39 |
+
|
| 40 |
+
#ifndef NCURSES_PANEL_H_incl
|
| 41 |
+
#define NCURSES_PANEL_H_incl 1
|
| 42 |
+
|
| 43 |
+
#include <ncursesw/curses.h>
|
| 44 |
+
|
| 45 |
+
typedef struct panel
|
| 46 |
+
#if !NCURSES_OPAQUE_PANEL
|
| 47 |
+
{
|
| 48 |
+
WINDOW *win;
|
| 49 |
+
struct panel *below;
|
| 50 |
+
struct panel *above;
|
| 51 |
+
NCURSES_CONST void *user;
|
| 52 |
+
}
|
| 53 |
+
#endif /* !NCURSES_OPAQUE_PANEL */
|
| 54 |
+
PANEL;
|
| 55 |
+
|
| 56 |
+
#if defined(__cplusplus)
|
| 57 |
+
extern "C" {
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if defined(BUILDING_PANEL)
|
| 61 |
+
# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
| 62 |
+
#else
|
| 63 |
+
# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
| 64 |
+
#endif
|
| 65 |
+
|
| 66 |
+
#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
| 67 |
+
|
| 68 |
+
#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API
|
| 69 |
+
#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type
|
| 70 |
+
|
| 71 |
+
extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *);
|
| 72 |
+
extern PANEL_EXPORT(void) update_panels (void);
|
| 73 |
+
extern PANEL_EXPORT(int) hide_panel (PANEL *);
|
| 74 |
+
extern PANEL_EXPORT(int) show_panel (PANEL *);
|
| 75 |
+
extern PANEL_EXPORT(int) del_panel (PANEL *);
|
| 76 |
+
extern PANEL_EXPORT(int) top_panel (PANEL *);
|
| 77 |
+
extern PANEL_EXPORT(int) bottom_panel (PANEL *);
|
| 78 |
+
extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *);
|
| 79 |
+
extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *);
|
| 80 |
+
extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *);
|
| 81 |
+
extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *);
|
| 82 |
+
extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
|
| 83 |
+
extern PANEL_EXPORT(int) move_panel (PANEL *, int, int);
|
| 84 |
+
extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *);
|
| 85 |
+
extern PANEL_EXPORT(int) panel_hidden (const PANEL *);
|
| 86 |
+
|
| 87 |
+
#if NCURSES_SP_FUNCS
|
| 88 |
+
extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *);
|
| 89 |
+
extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *);
|
| 90 |
+
|
| 91 |
+
extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*);
|
| 92 |
+
#endif
|
| 93 |
+
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2020,2021 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2013,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************/
|
| 31 |
+
/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */
|
| 32 |
+
/* and: Eric S. Raymond <esr@snark.thyrsus.com> */
|
| 33 |
+
/* and: Thomas E. Dickey 1995-on */
|
| 34 |
+
/****************************************************************************/
|
| 35 |
+
|
| 36 |
+
/* $Id: MKterm.h.awk.in,v 1.82 2021/09/24 17:02:46 tom Exp $ */
|
| 37 |
+
|
| 38 |
+
/*
|
| 39 |
+
** term.h -- Definition of struct term
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
#ifndef NCURSES_TERM_H_incl
|
| 43 |
+
#define NCURSES_TERM_H_incl 1
|
| 44 |
+
|
| 45 |
+
#undef NCURSES_VERSION
|
| 46 |
+
#define NCURSES_VERSION "6.4"
|
| 47 |
+
|
| 48 |
+
#include <ncursesw/ncurses_dll.h>
|
| 49 |
+
|
| 50 |
+
#ifdef __cplusplus
|
| 51 |
+
extern "C" {
|
| 52 |
+
#endif
|
| 53 |
+
|
| 54 |
+
/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
|
| 55 |
+
* definition (based on the system for which this was configured).
|
| 56 |
+
*/
|
| 57 |
+
|
| 58 |
+
#ifndef __NCURSES_H
|
| 59 |
+
|
| 60 |
+
typedef struct screen SCREEN;
|
| 61 |
+
|
| 62 |
+
#if 1
|
| 63 |
+
#undef NCURSES_SP_FUNCS
|
| 64 |
+
#define NCURSES_SP_FUNCS 20221231
|
| 65 |
+
#undef NCURSES_SP_NAME
|
| 66 |
+
#define NCURSES_SP_NAME(name) name##_sp
|
| 67 |
+
|
| 68 |
+
/* Define the sp-funcs helper function */
|
| 69 |
+
#undef NCURSES_SP_OUTC
|
| 70 |
+
#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC)
|
| 71 |
+
typedef int (*NCURSES_SP_OUTC)(SCREEN*, int);
|
| 72 |
+
#endif
|
| 73 |
+
|
| 74 |
+
#endif /* __NCURSES_H */
|
| 75 |
+
|
| 76 |
+
#undef NCURSES_CONST
|
| 77 |
+
#define NCURSES_CONST const
|
| 78 |
+
|
| 79 |
+
#undef NCURSES_SBOOL
|
| 80 |
+
#define NCURSES_SBOOL char
|
| 81 |
+
|
| 82 |
+
#undef NCURSES_USE_DATABASE
|
| 83 |
+
#define NCURSES_USE_DATABASE 1
|
| 84 |
+
|
| 85 |
+
#undef NCURSES_USE_TERMCAP
|
| 86 |
+
#define NCURSES_USE_TERMCAP 1
|
| 87 |
+
|
| 88 |
+
#undef NCURSES_XNAMES
|
| 89 |
+
#define NCURSES_XNAMES 1
|
| 90 |
+
|
| 91 |
+
/* We will use these symbols to hide differences between
|
| 92 |
+
* termios/termio/sgttyb interfaces.
|
| 93 |
+
*/
|
| 94 |
+
#undef TTY
|
| 95 |
+
#undef SET_TTY
|
| 96 |
+
#undef GET_TTY
|
| 97 |
+
|
| 98 |
+
/* Assume POSIX termio if we have the header and function */
|
| 99 |
+
/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */
|
| 100 |
+
#if 1 && 1
|
| 101 |
+
|
| 102 |
+
#undef TERMIOS
|
| 103 |
+
#define TERMIOS 1
|
| 104 |
+
|
| 105 |
+
#include <termios.h>
|
| 106 |
+
#define TTY struct termios
|
| 107 |
+
|
| 108 |
+
#else /* !HAVE_TERMIOS_H */
|
| 109 |
+
|
| 110 |
+
/* #if HAVE_TERMIO_H */
|
| 111 |
+
#if 1
|
| 112 |
+
|
| 113 |
+
#undef TERMIOS
|
| 114 |
+
#define TERMIOS 1
|
| 115 |
+
|
| 116 |
+
#include <termio.h>
|
| 117 |
+
#define TTY struct termio
|
| 118 |
+
|
| 119 |
+
#else /* !HAVE_TERMIO_H */
|
| 120 |
+
|
| 121 |
+
#if (defined(_WIN32) || defined(_WIN64))
|
| 122 |
+
#if 0
|
| 123 |
+
#include <ncursesw/win32_curses.h>
|
| 124 |
+
#define TTY struct winconmode
|
| 125 |
+
#else
|
| 126 |
+
#include <ncursesw/ncurses_mingw.h>
|
| 127 |
+
#define TTY struct termios
|
| 128 |
+
#endif
|
| 129 |
+
#else
|
| 130 |
+
#undef TERMIOS
|
| 131 |
+
#include <sgtty.h>
|
| 132 |
+
#include <sys/ioctl.h>
|
| 133 |
+
#define TTY struct sgttyb
|
| 134 |
+
#endif /* MINGW32 */
|
| 135 |
+
#endif /* HAVE_TERMIO_H */
|
| 136 |
+
|
| 137 |
+
#endif /* HAVE_TERMIOS_H */
|
| 138 |
+
|
| 139 |
+
#ifdef TERMIOS
|
| 140 |
+
#define GET_TTY(fd, buf) tcgetattr(fd, buf)
|
| 141 |
+
#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)
|
| 142 |
+
#elif 0 && (defined(_WIN32) || defined(_WIN64))
|
| 143 |
+
#define GET_TTY(fd, buf) _nc_console_getmode(_nc_console_fd2handle(fd),buf)
|
| 144 |
+
#define SET_TTY(fd, buf) _nc_console_setmode(_nc_console_fd2handle(fd),buf)
|
| 145 |
+
#else
|
| 146 |
+
#define GET_TTY(fd, buf) gtty(fd, buf)
|
| 147 |
+
#define SET_TTY(fd, buf) stty(fd, buf)
|
| 148 |
+
#endif
|
| 149 |
+
|
| 150 |
+
#ifndef GCC_NORETURN
|
| 151 |
+
#define GCC_NORETURN /* nothing */
|
| 152 |
+
#endif
|
| 153 |
+
|
| 154 |
+
#define NAMESIZE 256
|
| 155 |
+
|
| 156 |
+
/* The cast works because TERMTYPE is the first data in TERMINAL */
|
| 157 |
+
#define CUR ((TERMTYPE *)(cur_term))->
|
| 158 |
+
|
| 159 |
+
#define auto_left_margin CUR Booleans[0]
|
| 160 |
+
#define auto_right_margin CUR Booleans[1]
|
| 161 |
+
#define no_esc_ctlc CUR Booleans[2]
|
| 162 |
+
#define ceol_standout_glitch CUR Booleans[3]
|
| 163 |
+
#define eat_newline_glitch CUR Booleans[4]
|
| 164 |
+
#define erase_overstrike CUR Booleans[5]
|
| 165 |
+
#define generic_type CUR Booleans[6]
|
| 166 |
+
#define hard_copy CUR Booleans[7]
|
| 167 |
+
#define has_meta_key CUR Booleans[8]
|
| 168 |
+
#define has_status_line CUR Booleans[9]
|
| 169 |
+
#define insert_null_glitch CUR Booleans[10]
|
| 170 |
+
#define memory_above CUR Booleans[11]
|
| 171 |
+
#define memory_below CUR Booleans[12]
|
| 172 |
+
#define move_insert_mode CUR Booleans[13]
|
| 173 |
+
#define move_standout_mode CUR Booleans[14]
|
| 174 |
+
#define over_strike CUR Booleans[15]
|
| 175 |
+
#define status_line_esc_ok CUR Booleans[16]
|
| 176 |
+
#define dest_tabs_magic_smso CUR Booleans[17]
|
| 177 |
+
#define tilde_glitch CUR Booleans[18]
|
| 178 |
+
#define transparent_underline CUR Booleans[19]
|
| 179 |
+
#define xon_xoff CUR Booleans[20]
|
| 180 |
+
#define needs_xon_xoff CUR Booleans[21]
|
| 181 |
+
#define prtr_silent CUR Booleans[22]
|
| 182 |
+
#define hard_cursor CUR Booleans[23]
|
| 183 |
+
#define non_rev_rmcup CUR Booleans[24]
|
| 184 |
+
#define no_pad_char CUR Booleans[25]
|
| 185 |
+
#define non_dest_scroll_region CUR Booleans[26]
|
| 186 |
+
#define can_change CUR Booleans[27]
|
| 187 |
+
#define back_color_erase CUR Booleans[28]
|
| 188 |
+
#define hue_lightness_saturation CUR Booleans[29]
|
| 189 |
+
#define col_addr_glitch CUR Booleans[30]
|
| 190 |
+
#define cr_cancels_micro_mode CUR Booleans[31]
|
| 191 |
+
#define has_print_wheel CUR Booleans[32]
|
| 192 |
+
#define row_addr_glitch CUR Booleans[33]
|
| 193 |
+
#define semi_auto_right_margin CUR Booleans[34]
|
| 194 |
+
#define cpi_changes_res CUR Booleans[35]
|
| 195 |
+
#define lpi_changes_res CUR Booleans[36]
|
| 196 |
+
#define columns CUR Numbers[0]
|
| 197 |
+
#define init_tabs CUR Numbers[1]
|
| 198 |
+
#define lines CUR Numbers[2]
|
| 199 |
+
#define lines_of_memory CUR Numbers[3]
|
| 200 |
+
#define magic_cookie_glitch CUR Numbers[4]
|
| 201 |
+
#define padding_baud_rate CUR Numbers[5]
|
| 202 |
+
#define virtual_terminal CUR Numbers[6]
|
| 203 |
+
#define width_status_line CUR Numbers[7]
|
| 204 |
+
#define num_labels CUR Numbers[8]
|
| 205 |
+
#define label_height CUR Numbers[9]
|
| 206 |
+
#define label_width CUR Numbers[10]
|
| 207 |
+
#define max_attributes CUR Numbers[11]
|
| 208 |
+
#define maximum_windows CUR Numbers[12]
|
| 209 |
+
#define max_colors CUR Numbers[13]
|
| 210 |
+
#define max_pairs CUR Numbers[14]
|
| 211 |
+
#define no_color_video CUR Numbers[15]
|
| 212 |
+
#define buffer_capacity CUR Numbers[16]
|
| 213 |
+
#define dot_vert_spacing CUR Numbers[17]
|
| 214 |
+
#define dot_horz_spacing CUR Numbers[18]
|
| 215 |
+
#define max_micro_address CUR Numbers[19]
|
| 216 |
+
#define max_micro_jump CUR Numbers[20]
|
| 217 |
+
#define micro_col_size CUR Numbers[21]
|
| 218 |
+
#define micro_line_size CUR Numbers[22]
|
| 219 |
+
#define number_of_pins CUR Numbers[23]
|
| 220 |
+
#define output_res_char CUR Numbers[24]
|
| 221 |
+
#define output_res_line CUR Numbers[25]
|
| 222 |
+
#define output_res_horz_inch CUR Numbers[26]
|
| 223 |
+
#define output_res_vert_inch CUR Numbers[27]
|
| 224 |
+
#define print_rate CUR Numbers[28]
|
| 225 |
+
#define wide_char_size CUR Numbers[29]
|
| 226 |
+
#define buttons CUR Numbers[30]
|
| 227 |
+
#define bit_image_entwining CUR Numbers[31]
|
| 228 |
+
#define bit_image_type CUR Numbers[32]
|
| 229 |
+
#define back_tab CUR Strings[0]
|
| 230 |
+
#define bell CUR Strings[1]
|
| 231 |
+
#define carriage_return CUR Strings[2]
|
| 232 |
+
#define change_scroll_region CUR Strings[3]
|
| 233 |
+
#define clear_all_tabs CUR Strings[4]
|
| 234 |
+
#define clear_screen CUR Strings[5]
|
| 235 |
+
#define clr_eol CUR Strings[6]
|
| 236 |
+
#define clr_eos CUR Strings[7]
|
| 237 |
+
#define column_address CUR Strings[8]
|
| 238 |
+
#define command_character CUR Strings[9]
|
| 239 |
+
#define cursor_address CUR Strings[10]
|
| 240 |
+
#define cursor_down CUR Strings[11]
|
| 241 |
+
#define cursor_home CUR Strings[12]
|
| 242 |
+
#define cursor_invisible CUR Strings[13]
|
| 243 |
+
#define cursor_left CUR Strings[14]
|
| 244 |
+
#define cursor_mem_address CUR Strings[15]
|
| 245 |
+
#define cursor_normal CUR Strings[16]
|
| 246 |
+
#define cursor_right CUR Strings[17]
|
| 247 |
+
#define cursor_to_ll CUR Strings[18]
|
| 248 |
+
#define cursor_up CUR Strings[19]
|
| 249 |
+
#define cursor_visible CUR Strings[20]
|
| 250 |
+
#define delete_character CUR Strings[21]
|
| 251 |
+
#define delete_line CUR Strings[22]
|
| 252 |
+
#define dis_status_line CUR Strings[23]
|
| 253 |
+
#define down_half_line CUR Strings[24]
|
| 254 |
+
#define enter_alt_charset_mode CUR Strings[25]
|
| 255 |
+
#define enter_blink_mode CUR Strings[26]
|
| 256 |
+
#define enter_bold_mode CUR Strings[27]
|
| 257 |
+
#define enter_ca_mode CUR Strings[28]
|
| 258 |
+
#define enter_delete_mode CUR Strings[29]
|
| 259 |
+
#define enter_dim_mode CUR Strings[30]
|
| 260 |
+
#define enter_insert_mode CUR Strings[31]
|
| 261 |
+
#define enter_secure_mode CUR Strings[32]
|
| 262 |
+
#define enter_protected_mode CUR Strings[33]
|
| 263 |
+
#define enter_reverse_mode CUR Strings[34]
|
| 264 |
+
#define enter_standout_mode CUR Strings[35]
|
| 265 |
+
#define enter_underline_mode CUR Strings[36]
|
| 266 |
+
#define erase_chars CUR Strings[37]
|
| 267 |
+
#define exit_alt_charset_mode CUR Strings[38]
|
| 268 |
+
#define exit_attribute_mode CUR Strings[39]
|
| 269 |
+
#define exit_ca_mode CUR Strings[40]
|
| 270 |
+
#define exit_delete_mode CUR Strings[41]
|
| 271 |
+
#define exit_insert_mode CUR Strings[42]
|
| 272 |
+
#define exit_standout_mode CUR Strings[43]
|
| 273 |
+
#define exit_underline_mode CUR Strings[44]
|
| 274 |
+
#define flash_screen CUR Strings[45]
|
| 275 |
+
#define form_feed CUR Strings[46]
|
| 276 |
+
#define from_status_line CUR Strings[47]
|
| 277 |
+
#define init_1string CUR Strings[48]
|
| 278 |
+
#define init_2string CUR Strings[49]
|
| 279 |
+
#define init_3string CUR Strings[50]
|
| 280 |
+
#define init_file CUR Strings[51]
|
| 281 |
+
#define insert_character CUR Strings[52]
|
| 282 |
+
#define insert_line CUR Strings[53]
|
| 283 |
+
#define insert_padding CUR Strings[54]
|
| 284 |
+
#define key_backspace CUR Strings[55]
|
| 285 |
+
#define key_catab CUR Strings[56]
|
| 286 |
+
#define key_clear CUR Strings[57]
|
| 287 |
+
#define key_ctab CUR Strings[58]
|
| 288 |
+
#define key_dc CUR Strings[59]
|
| 289 |
+
#define key_dl CUR Strings[60]
|
| 290 |
+
#define key_down CUR Strings[61]
|
| 291 |
+
#define key_eic CUR Strings[62]
|
| 292 |
+
#define key_eol CUR Strings[63]
|
| 293 |
+
#define key_eos CUR Strings[64]
|
| 294 |
+
#define key_f0 CUR Strings[65]
|
| 295 |
+
#define key_f1 CUR Strings[66]
|
| 296 |
+
#define key_f10 CUR Strings[67]
|
| 297 |
+
#define key_f2 CUR Strings[68]
|
| 298 |
+
#define key_f3 CUR Strings[69]
|
| 299 |
+
#define key_f4 CUR Strings[70]
|
| 300 |
+
#define key_f5 CUR Strings[71]
|
| 301 |
+
#define key_f6 CUR Strings[72]
|
| 302 |
+
#define key_f7 CUR Strings[73]
|
| 303 |
+
#define key_f8 CUR Strings[74]
|
| 304 |
+
#define key_f9 CUR Strings[75]
|
| 305 |
+
#define key_home CUR Strings[76]
|
| 306 |
+
#define key_ic CUR Strings[77]
|
| 307 |
+
#define key_il CUR Strings[78]
|
| 308 |
+
#define key_left CUR Strings[79]
|
| 309 |
+
#define key_ll CUR Strings[80]
|
| 310 |
+
#define key_npage CUR Strings[81]
|
| 311 |
+
#define key_ppage CUR Strings[82]
|
| 312 |
+
#define key_right CUR Strings[83]
|
| 313 |
+
#define key_sf CUR Strings[84]
|
| 314 |
+
#define key_sr CUR Strings[85]
|
| 315 |
+
#define key_stab CUR Strings[86]
|
| 316 |
+
#define key_up CUR Strings[87]
|
| 317 |
+
#define keypad_local CUR Strings[88]
|
| 318 |
+
#define keypad_xmit CUR Strings[89]
|
| 319 |
+
#define lab_f0 CUR Strings[90]
|
| 320 |
+
#define lab_f1 CUR Strings[91]
|
| 321 |
+
#define lab_f10 CUR Strings[92]
|
| 322 |
+
#define lab_f2 CUR Strings[93]
|
| 323 |
+
#define lab_f3 CUR Strings[94]
|
| 324 |
+
#define lab_f4 CUR Strings[95]
|
| 325 |
+
#define lab_f5 CUR Strings[96]
|
| 326 |
+
#define lab_f6 CUR Strings[97]
|
| 327 |
+
#define lab_f7 CUR Strings[98]
|
| 328 |
+
#define lab_f8 CUR Strings[99]
|
| 329 |
+
#define lab_f9 CUR Strings[100]
|
| 330 |
+
#define meta_off CUR Strings[101]
|
| 331 |
+
#define meta_on CUR Strings[102]
|
| 332 |
+
#define newline CUR Strings[103]
|
| 333 |
+
#define pad_char CUR Strings[104]
|
| 334 |
+
#define parm_dch CUR Strings[105]
|
| 335 |
+
#define parm_delete_line CUR Strings[106]
|
| 336 |
+
#define parm_down_cursor CUR Strings[107]
|
| 337 |
+
#define parm_ich CUR Strings[108]
|
| 338 |
+
#define parm_index CUR Strings[109]
|
| 339 |
+
#define parm_insert_line CUR Strings[110]
|
| 340 |
+
#define parm_left_cursor CUR Strings[111]
|
| 341 |
+
#define parm_right_cursor CUR Strings[112]
|
| 342 |
+
#define parm_rindex CUR Strings[113]
|
| 343 |
+
#define parm_up_cursor CUR Strings[114]
|
| 344 |
+
#define pkey_key CUR Strings[115]
|
| 345 |
+
#define pkey_local CUR Strings[116]
|
| 346 |
+
#define pkey_xmit CUR Strings[117]
|
| 347 |
+
#define print_screen CUR Strings[118]
|
| 348 |
+
#define prtr_off CUR Strings[119]
|
| 349 |
+
#define prtr_on CUR Strings[120]
|
| 350 |
+
#define repeat_char CUR Strings[121]
|
| 351 |
+
#define reset_1string CUR Strings[122]
|
| 352 |
+
#define reset_2string CUR Strings[123]
|
| 353 |
+
#define reset_3string CUR Strings[124]
|
| 354 |
+
#define reset_file CUR Strings[125]
|
| 355 |
+
#define restore_cursor CUR Strings[126]
|
| 356 |
+
#define row_address CUR Strings[127]
|
| 357 |
+
#define save_cursor CUR Strings[128]
|
| 358 |
+
#define scroll_forward CUR Strings[129]
|
| 359 |
+
#define scroll_reverse CUR Strings[130]
|
| 360 |
+
#define set_attributes CUR Strings[131]
|
| 361 |
+
#define set_tab CUR Strings[132]
|
| 362 |
+
#define set_window CUR Strings[133]
|
| 363 |
+
#define tab CUR Strings[134]
|
| 364 |
+
#define to_status_line CUR Strings[135]
|
| 365 |
+
#define underline_char CUR Strings[136]
|
| 366 |
+
#define up_half_line CUR Strings[137]
|
| 367 |
+
#define init_prog CUR Strings[138]
|
| 368 |
+
#define key_a1 CUR Strings[139]
|
| 369 |
+
#define key_a3 CUR Strings[140]
|
| 370 |
+
#define key_b2 CUR Strings[141]
|
| 371 |
+
#define key_c1 CUR Strings[142]
|
| 372 |
+
#define key_c3 CUR Strings[143]
|
| 373 |
+
#define prtr_non CUR Strings[144]
|
| 374 |
+
#define char_padding CUR Strings[145]
|
| 375 |
+
#define acs_chars CUR Strings[146]
|
| 376 |
+
#define plab_norm CUR Strings[147]
|
| 377 |
+
#define key_btab CUR Strings[148]
|
| 378 |
+
#define enter_xon_mode CUR Strings[149]
|
| 379 |
+
#define exit_xon_mode CUR Strings[150]
|
| 380 |
+
#define enter_am_mode CUR Strings[151]
|
| 381 |
+
#define exit_am_mode CUR Strings[152]
|
| 382 |
+
#define xon_character CUR Strings[153]
|
| 383 |
+
#define xoff_character CUR Strings[154]
|
| 384 |
+
#define ena_acs CUR Strings[155]
|
| 385 |
+
#define label_on CUR Strings[156]
|
| 386 |
+
#define label_off CUR Strings[157]
|
| 387 |
+
#define key_beg CUR Strings[158]
|
| 388 |
+
#define key_cancel CUR Strings[159]
|
| 389 |
+
#define key_close CUR Strings[160]
|
| 390 |
+
#define key_command CUR Strings[161]
|
| 391 |
+
#define key_copy CUR Strings[162]
|
| 392 |
+
#define key_create CUR Strings[163]
|
| 393 |
+
#define key_end CUR Strings[164]
|
| 394 |
+
#define key_enter CUR Strings[165]
|
| 395 |
+
#define key_exit CUR Strings[166]
|
| 396 |
+
#define key_find CUR Strings[167]
|
| 397 |
+
#define key_help CUR Strings[168]
|
| 398 |
+
#define key_mark CUR Strings[169]
|
| 399 |
+
#define key_message CUR Strings[170]
|
| 400 |
+
#define key_move CUR Strings[171]
|
| 401 |
+
#define key_next CUR Strings[172]
|
| 402 |
+
#define key_open CUR Strings[173]
|
| 403 |
+
#define key_options CUR Strings[174]
|
| 404 |
+
#define key_previous CUR Strings[175]
|
| 405 |
+
#define key_print CUR Strings[176]
|
| 406 |
+
#define key_redo CUR Strings[177]
|
| 407 |
+
#define key_reference CUR Strings[178]
|
| 408 |
+
#define key_refresh CUR Strings[179]
|
| 409 |
+
#define key_replace CUR Strings[180]
|
| 410 |
+
#define key_restart CUR Strings[181]
|
| 411 |
+
#define key_resume CUR Strings[182]
|
| 412 |
+
#define key_save CUR Strings[183]
|
| 413 |
+
#define key_suspend CUR Strings[184]
|
| 414 |
+
#define key_undo CUR Strings[185]
|
| 415 |
+
#define key_sbeg CUR Strings[186]
|
| 416 |
+
#define key_scancel CUR Strings[187]
|
| 417 |
+
#define key_scommand CUR Strings[188]
|
| 418 |
+
#define key_scopy CUR Strings[189]
|
| 419 |
+
#define key_screate CUR Strings[190]
|
| 420 |
+
#define key_sdc CUR Strings[191]
|
| 421 |
+
#define key_sdl CUR Strings[192]
|
| 422 |
+
#define key_select CUR Strings[193]
|
| 423 |
+
#define key_send CUR Strings[194]
|
| 424 |
+
#define key_seol CUR Strings[195]
|
| 425 |
+
#define key_sexit CUR Strings[196]
|
| 426 |
+
#define key_sfind CUR Strings[197]
|
| 427 |
+
#define key_shelp CUR Strings[198]
|
| 428 |
+
#define key_shome CUR Strings[199]
|
| 429 |
+
#define key_sic CUR Strings[200]
|
| 430 |
+
#define key_sleft CUR Strings[201]
|
| 431 |
+
#define key_smessage CUR Strings[202]
|
| 432 |
+
#define key_smove CUR Strings[203]
|
| 433 |
+
#define key_snext CUR Strings[204]
|
| 434 |
+
#define key_soptions CUR Strings[205]
|
| 435 |
+
#define key_sprevious CUR Strings[206]
|
| 436 |
+
#define key_sprint CUR Strings[207]
|
| 437 |
+
#define key_sredo CUR Strings[208]
|
| 438 |
+
#define key_sreplace CUR Strings[209]
|
| 439 |
+
#define key_sright CUR Strings[210]
|
| 440 |
+
#define key_srsume CUR Strings[211]
|
| 441 |
+
#define key_ssave CUR Strings[212]
|
| 442 |
+
#define key_ssuspend CUR Strings[213]
|
| 443 |
+
#define key_sundo CUR Strings[214]
|
| 444 |
+
#define req_for_input CUR Strings[215]
|
| 445 |
+
#define key_f11 CUR Strings[216]
|
| 446 |
+
#define key_f12 CUR Strings[217]
|
| 447 |
+
#define key_f13 CUR Strings[218]
|
| 448 |
+
#define key_f14 CUR Strings[219]
|
| 449 |
+
#define key_f15 CUR Strings[220]
|
| 450 |
+
#define key_f16 CUR Strings[221]
|
| 451 |
+
#define key_f17 CUR Strings[222]
|
| 452 |
+
#define key_f18 CUR Strings[223]
|
| 453 |
+
#define key_f19 CUR Strings[224]
|
| 454 |
+
#define key_f20 CUR Strings[225]
|
| 455 |
+
#define key_f21 CUR Strings[226]
|
| 456 |
+
#define key_f22 CUR Strings[227]
|
| 457 |
+
#define key_f23 CUR Strings[228]
|
| 458 |
+
#define key_f24 CUR Strings[229]
|
| 459 |
+
#define key_f25 CUR Strings[230]
|
| 460 |
+
#define key_f26 CUR Strings[231]
|
| 461 |
+
#define key_f27 CUR Strings[232]
|
| 462 |
+
#define key_f28 CUR Strings[233]
|
| 463 |
+
#define key_f29 CUR Strings[234]
|
| 464 |
+
#define key_f30 CUR Strings[235]
|
| 465 |
+
#define key_f31 CUR Strings[236]
|
| 466 |
+
#define key_f32 CUR Strings[237]
|
| 467 |
+
#define key_f33 CUR Strings[238]
|
| 468 |
+
#define key_f34 CUR Strings[239]
|
| 469 |
+
#define key_f35 CUR Strings[240]
|
| 470 |
+
#define key_f36 CUR Strings[241]
|
| 471 |
+
#define key_f37 CUR Strings[242]
|
| 472 |
+
#define key_f38 CUR Strings[243]
|
| 473 |
+
#define key_f39 CUR Strings[244]
|
| 474 |
+
#define key_f40 CUR Strings[245]
|
| 475 |
+
#define key_f41 CUR Strings[246]
|
| 476 |
+
#define key_f42 CUR Strings[247]
|
| 477 |
+
#define key_f43 CUR Strings[248]
|
| 478 |
+
#define key_f44 CUR Strings[249]
|
| 479 |
+
#define key_f45 CUR Strings[250]
|
| 480 |
+
#define key_f46 CUR Strings[251]
|
| 481 |
+
#define key_f47 CUR Strings[252]
|
| 482 |
+
#define key_f48 CUR Strings[253]
|
| 483 |
+
#define key_f49 CUR Strings[254]
|
| 484 |
+
#define key_f50 CUR Strings[255]
|
| 485 |
+
#define key_f51 CUR Strings[256]
|
| 486 |
+
#define key_f52 CUR Strings[257]
|
| 487 |
+
#define key_f53 CUR Strings[258]
|
| 488 |
+
#define key_f54 CUR Strings[259]
|
| 489 |
+
#define key_f55 CUR Strings[260]
|
| 490 |
+
#define key_f56 CUR Strings[261]
|
| 491 |
+
#define key_f57 CUR Strings[262]
|
| 492 |
+
#define key_f58 CUR Strings[263]
|
| 493 |
+
#define key_f59 CUR Strings[264]
|
| 494 |
+
#define key_f60 CUR Strings[265]
|
| 495 |
+
#define key_f61 CUR Strings[266]
|
| 496 |
+
#define key_f62 CUR Strings[267]
|
| 497 |
+
#define key_f63 CUR Strings[268]
|
| 498 |
+
#define clr_bol CUR Strings[269]
|
| 499 |
+
#define clear_margins CUR Strings[270]
|
| 500 |
+
#define set_left_margin CUR Strings[271]
|
| 501 |
+
#define set_right_margin CUR Strings[272]
|
| 502 |
+
#define label_format CUR Strings[273]
|
| 503 |
+
#define set_clock CUR Strings[274]
|
| 504 |
+
#define display_clock CUR Strings[275]
|
| 505 |
+
#define remove_clock CUR Strings[276]
|
| 506 |
+
#define create_window CUR Strings[277]
|
| 507 |
+
#define goto_window CUR Strings[278]
|
| 508 |
+
#define hangup CUR Strings[279]
|
| 509 |
+
#define dial_phone CUR Strings[280]
|
| 510 |
+
#define quick_dial CUR Strings[281]
|
| 511 |
+
#define tone CUR Strings[282]
|
| 512 |
+
#define pulse CUR Strings[283]
|
| 513 |
+
#define flash_hook CUR Strings[284]
|
| 514 |
+
#define fixed_pause CUR Strings[285]
|
| 515 |
+
#define wait_tone CUR Strings[286]
|
| 516 |
+
#define user0 CUR Strings[287]
|
| 517 |
+
#define user1 CUR Strings[288]
|
| 518 |
+
#define user2 CUR Strings[289]
|
| 519 |
+
#define user3 CUR Strings[290]
|
| 520 |
+
#define user4 CUR Strings[291]
|
| 521 |
+
#define user5 CUR Strings[292]
|
| 522 |
+
#define user6 CUR Strings[293]
|
| 523 |
+
#define user7 CUR Strings[294]
|
| 524 |
+
#define user8 CUR Strings[295]
|
| 525 |
+
#define user9 CUR Strings[296]
|
| 526 |
+
#define orig_pair CUR Strings[297]
|
| 527 |
+
#define orig_colors CUR Strings[298]
|
| 528 |
+
#define initialize_color CUR Strings[299]
|
| 529 |
+
#define initialize_pair CUR Strings[300]
|
| 530 |
+
#define set_color_pair CUR Strings[301]
|
| 531 |
+
#define set_foreground CUR Strings[302]
|
| 532 |
+
#define set_background CUR Strings[303]
|
| 533 |
+
#define change_char_pitch CUR Strings[304]
|
| 534 |
+
#define change_line_pitch CUR Strings[305]
|
| 535 |
+
#define change_res_horz CUR Strings[306]
|
| 536 |
+
#define change_res_vert CUR Strings[307]
|
| 537 |
+
#define define_char CUR Strings[308]
|
| 538 |
+
#define enter_doublewide_mode CUR Strings[309]
|
| 539 |
+
#define enter_draft_quality CUR Strings[310]
|
| 540 |
+
#define enter_italics_mode CUR Strings[311]
|
| 541 |
+
#define enter_leftward_mode CUR Strings[312]
|
| 542 |
+
#define enter_micro_mode CUR Strings[313]
|
| 543 |
+
#define enter_near_letter_quality CUR Strings[314]
|
| 544 |
+
#define enter_normal_quality CUR Strings[315]
|
| 545 |
+
#define enter_shadow_mode CUR Strings[316]
|
| 546 |
+
#define enter_subscript_mode CUR Strings[317]
|
| 547 |
+
#define enter_superscript_mode CUR Strings[318]
|
| 548 |
+
#define enter_upward_mode CUR Strings[319]
|
| 549 |
+
#define exit_doublewide_mode CUR Strings[320]
|
| 550 |
+
#define exit_italics_mode CUR Strings[321]
|
| 551 |
+
#define exit_leftward_mode CUR Strings[322]
|
| 552 |
+
#define exit_micro_mode CUR Strings[323]
|
| 553 |
+
#define exit_shadow_mode CUR Strings[324]
|
| 554 |
+
#define exit_subscript_mode CUR Strings[325]
|
| 555 |
+
#define exit_superscript_mode CUR Strings[326]
|
| 556 |
+
#define exit_upward_mode CUR Strings[327]
|
| 557 |
+
#define micro_column_address CUR Strings[328]
|
| 558 |
+
#define micro_down CUR Strings[329]
|
| 559 |
+
#define micro_left CUR Strings[330]
|
| 560 |
+
#define micro_right CUR Strings[331]
|
| 561 |
+
#define micro_row_address CUR Strings[332]
|
| 562 |
+
#define micro_up CUR Strings[333]
|
| 563 |
+
#define order_of_pins CUR Strings[334]
|
| 564 |
+
#define parm_down_micro CUR Strings[335]
|
| 565 |
+
#define parm_left_micro CUR Strings[336]
|
| 566 |
+
#define parm_right_micro CUR Strings[337]
|
| 567 |
+
#define parm_up_micro CUR Strings[338]
|
| 568 |
+
#define select_char_set CUR Strings[339]
|
| 569 |
+
#define set_bottom_margin CUR Strings[340]
|
| 570 |
+
#define set_bottom_margin_parm CUR Strings[341]
|
| 571 |
+
#define set_left_margin_parm CUR Strings[342]
|
| 572 |
+
#define set_right_margin_parm CUR Strings[343]
|
| 573 |
+
#define set_top_margin CUR Strings[344]
|
| 574 |
+
#define set_top_margin_parm CUR Strings[345]
|
| 575 |
+
#define start_bit_image CUR Strings[346]
|
| 576 |
+
#define start_char_set_def CUR Strings[347]
|
| 577 |
+
#define stop_bit_image CUR Strings[348]
|
| 578 |
+
#define stop_char_set_def CUR Strings[349]
|
| 579 |
+
#define subscript_characters CUR Strings[350]
|
| 580 |
+
#define superscript_characters CUR Strings[351]
|
| 581 |
+
#define these_cause_cr CUR Strings[352]
|
| 582 |
+
#define zero_motion CUR Strings[353]
|
| 583 |
+
#define char_set_names CUR Strings[354]
|
| 584 |
+
#define key_mouse CUR Strings[355]
|
| 585 |
+
#define mouse_info CUR Strings[356]
|
| 586 |
+
#define req_mouse_pos CUR Strings[357]
|
| 587 |
+
#define get_mouse CUR Strings[358]
|
| 588 |
+
#define set_a_foreground CUR Strings[359]
|
| 589 |
+
#define set_a_background CUR Strings[360]
|
| 590 |
+
#define pkey_plab CUR Strings[361]
|
| 591 |
+
#define device_type CUR Strings[362]
|
| 592 |
+
#define code_set_init CUR Strings[363]
|
| 593 |
+
#define set0_des_seq CUR Strings[364]
|
| 594 |
+
#define set1_des_seq CUR Strings[365]
|
| 595 |
+
#define set2_des_seq CUR Strings[366]
|
| 596 |
+
#define set3_des_seq CUR Strings[367]
|
| 597 |
+
#define set_lr_margin CUR Strings[368]
|
| 598 |
+
#define set_tb_margin CUR Strings[369]
|
| 599 |
+
#define bit_image_repeat CUR Strings[370]
|
| 600 |
+
#define bit_image_newline CUR Strings[371]
|
| 601 |
+
#define bit_image_carriage_return CUR Strings[372]
|
| 602 |
+
#define color_names CUR Strings[373]
|
| 603 |
+
#define define_bit_image_region CUR Strings[374]
|
| 604 |
+
#define end_bit_image_region CUR Strings[375]
|
| 605 |
+
#define set_color_band CUR Strings[376]
|
| 606 |
+
#define set_page_length CUR Strings[377]
|
| 607 |
+
#define display_pc_char CUR Strings[378]
|
| 608 |
+
#define enter_pc_charset_mode CUR Strings[379]
|
| 609 |
+
#define exit_pc_charset_mode CUR Strings[380]
|
| 610 |
+
#define enter_scancode_mode CUR Strings[381]
|
| 611 |
+
#define exit_scancode_mode CUR Strings[382]
|
| 612 |
+
#define pc_term_options CUR Strings[383]
|
| 613 |
+
#define scancode_escape CUR Strings[384]
|
| 614 |
+
#define alt_scancode_esc CUR Strings[385]
|
| 615 |
+
#define enter_horizontal_hl_mode CUR Strings[386]
|
| 616 |
+
#define enter_left_hl_mode CUR Strings[387]
|
| 617 |
+
#define enter_low_hl_mode CUR Strings[388]
|
| 618 |
+
#define enter_right_hl_mode CUR Strings[389]
|
| 619 |
+
#define enter_top_hl_mode CUR Strings[390]
|
| 620 |
+
#define enter_vertical_hl_mode CUR Strings[391]
|
| 621 |
+
#define set_a_attributes CUR Strings[392]
|
| 622 |
+
#define set_pglen_inch CUR Strings[393]
|
| 623 |
+
|
| 624 |
+
#define BOOLWRITE 37
|
| 625 |
+
#define NUMWRITE 33
|
| 626 |
+
#define STRWRITE 394
|
| 627 |
+
|
| 628 |
+
/* older synonyms for some capabilities */
|
| 629 |
+
#define beehive_glitch no_esc_ctlc
|
| 630 |
+
#define teleray_glitch dest_tabs_magic_smso
|
| 631 |
+
|
| 632 |
+
/* HPUX-11 uses this name rather than the standard one */
|
| 633 |
+
#ifndef micro_char_size
|
| 634 |
+
#define micro_char_size micro_col_size
|
| 635 |
+
#endif
|
| 636 |
+
|
| 637 |
+
#ifdef __INTERNAL_CAPS_VISIBLE
|
| 638 |
+
#define termcap_init2 CUR Strings[394]
|
| 639 |
+
#define termcap_reset CUR Strings[395]
|
| 640 |
+
#define magic_cookie_glitch_ul CUR Numbers[33]
|
| 641 |
+
#define backspaces_with_bs CUR Booleans[37]
|
| 642 |
+
#define crt_no_scrolling CUR Booleans[38]
|
| 643 |
+
#define no_correctly_working_cr CUR Booleans[39]
|
| 644 |
+
#define carriage_return_delay CUR Numbers[34]
|
| 645 |
+
#define new_line_delay CUR Numbers[35]
|
| 646 |
+
#define linefeed_if_not_lf CUR Strings[396]
|
| 647 |
+
#define backspace_if_not_bs CUR Strings[397]
|
| 648 |
+
#define gnu_has_meta_key CUR Booleans[40]
|
| 649 |
+
#define linefeed_is_newline CUR Booleans[41]
|
| 650 |
+
#define backspace_delay CUR Numbers[36]
|
| 651 |
+
#define horizontal_tab_delay CUR Numbers[37]
|
| 652 |
+
#define number_of_function_keys CUR Numbers[38]
|
| 653 |
+
#define other_non_function_keys CUR Strings[398]
|
| 654 |
+
#define arrow_key_map CUR Strings[399]
|
| 655 |
+
#define has_hardware_tabs CUR Booleans[42]
|
| 656 |
+
#define return_does_clr_eol CUR Booleans[43]
|
| 657 |
+
#define acs_ulcorner CUR Strings[400]
|
| 658 |
+
#define acs_llcorner CUR Strings[401]
|
| 659 |
+
#define acs_urcorner CUR Strings[402]
|
| 660 |
+
#define acs_lrcorner CUR Strings[403]
|
| 661 |
+
#define acs_ltee CUR Strings[404]
|
| 662 |
+
#define acs_rtee CUR Strings[405]
|
| 663 |
+
#define acs_btee CUR Strings[406]
|
| 664 |
+
#define acs_ttee CUR Strings[407]
|
| 665 |
+
#define acs_hline CUR Strings[408]
|
| 666 |
+
#define acs_vline CUR Strings[409]
|
| 667 |
+
#define acs_plus CUR Strings[410]
|
| 668 |
+
#define memory_lock CUR Strings[411]
|
| 669 |
+
#define memory_unlock CUR Strings[412]
|
| 670 |
+
#define box_chars_1 CUR Strings[413]
|
| 671 |
+
#endif /* __INTERNAL_CAPS_VISIBLE */
|
| 672 |
+
|
| 673 |
+
|
| 674 |
+
/*
|
| 675 |
+
* Predefined terminfo array sizes
|
| 676 |
+
*/
|
| 677 |
+
#define BOOLCOUNT 44
|
| 678 |
+
#define NUMCOUNT 39
|
| 679 |
+
#define STRCOUNT 414
|
| 680 |
+
|
| 681 |
+
/* used by code for comparing entries */
|
| 682 |
+
#define acs_chars_index 146
|
| 683 |
+
|
| 684 |
+
typedef struct termtype { /* in-core form of terminfo data */
|
| 685 |
+
char *term_names; /* str_table offset of term names */
|
| 686 |
+
char *str_table; /* pointer to string table */
|
| 687 |
+
NCURSES_SBOOL *Booleans; /* array of boolean values */
|
| 688 |
+
short *Numbers; /* array of integer values */
|
| 689 |
+
char **Strings; /* array of string offsets */
|
| 690 |
+
|
| 691 |
+
#if NCURSES_XNAMES
|
| 692 |
+
char *ext_str_table; /* pointer to extended string table */
|
| 693 |
+
char **ext_Names; /* corresponding names */
|
| 694 |
+
|
| 695 |
+
unsigned short num_Booleans;/* count total Booleans */
|
| 696 |
+
unsigned short num_Numbers; /* count total Numbers */
|
| 697 |
+
unsigned short num_Strings; /* count total Strings */
|
| 698 |
+
|
| 699 |
+
unsigned short ext_Booleans;/* count extensions to Booleans */
|
| 700 |
+
unsigned short ext_Numbers; /* count extensions to Numbers */
|
| 701 |
+
unsigned short ext_Strings; /* count extensions to Strings */
|
| 702 |
+
#endif /* NCURSES_XNAMES */
|
| 703 |
+
|
| 704 |
+
} TERMTYPE;
|
| 705 |
+
|
| 706 |
+
/*
|
| 707 |
+
* The only reason these structures are visible is for read-only use.
|
| 708 |
+
* Programs which modify the data are not, never were, portable across
|
| 709 |
+
* curses implementations.
|
| 710 |
+
*
|
| 711 |
+
* The first field in TERMINAL is used in macros.
|
| 712 |
+
* The remaining fields are private.
|
| 713 |
+
*/
|
| 714 |
+
#ifdef NCURSES_INTERNALS
|
| 715 |
+
|
| 716 |
+
#undef TERMINAL
|
| 717 |
+
#define TERMINAL struct term
|
| 718 |
+
TERMINAL;
|
| 719 |
+
|
| 720 |
+
typedef struct termtype2 { /* in-core form of terminfo data */
|
| 721 |
+
char *term_names; /* str_table offset of term names */
|
| 722 |
+
char *str_table; /* pointer to string table */
|
| 723 |
+
NCURSES_SBOOL *Booleans; /* array of boolean values */
|
| 724 |
+
int *Numbers; /* array of integer values */
|
| 725 |
+
char **Strings; /* array of string offsets */
|
| 726 |
+
|
| 727 |
+
#if NCURSES_XNAMES
|
| 728 |
+
char *ext_str_table; /* pointer to extended string table */
|
| 729 |
+
char **ext_Names; /* corresponding names */
|
| 730 |
+
|
| 731 |
+
unsigned short num_Booleans;/* count total Booleans */
|
| 732 |
+
unsigned short num_Numbers; /* count total Numbers */
|
| 733 |
+
unsigned short num_Strings; /* count total Strings */
|
| 734 |
+
|
| 735 |
+
unsigned short ext_Booleans;/* count extensions to Booleans */
|
| 736 |
+
unsigned short ext_Numbers; /* count extensions to Numbers */
|
| 737 |
+
unsigned short ext_Strings; /* count extensions to Strings */
|
| 738 |
+
#endif /* NCURSES_XNAMES */
|
| 739 |
+
|
| 740 |
+
} TERMTYPE2;
|
| 741 |
+
#else
|
| 742 |
+
|
| 743 |
+
typedef struct term { /* describe an actual terminal */
|
| 744 |
+
TERMTYPE type; /* terminal type description */
|
| 745 |
+
} TERMINAL;
|
| 746 |
+
|
| 747 |
+
#endif /* NCURSES_INTERNALS */
|
| 748 |
+
|
| 749 |
+
|
| 750 |
+
#if 0 && !0
|
| 751 |
+
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
|
| 752 |
+
#elif 0
|
| 753 |
+
NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);
|
| 754 |
+
#define cur_term NCURSES_PUBLIC_VAR(cur_term())
|
| 755 |
+
#else
|
| 756 |
+
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
|
| 757 |
+
#endif
|
| 758 |
+
|
| 759 |
+
#if 0 || 0
|
| 760 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);
|
| 761 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);
|
| 762 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);
|
| 763 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);
|
| 764 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);
|
| 765 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);
|
| 766 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);
|
| 767 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);
|
| 768 |
+
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);
|
| 769 |
+
|
| 770 |
+
#define boolnames NCURSES_PUBLIC_VAR(boolnames())
|
| 771 |
+
#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())
|
| 772 |
+
#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())
|
| 773 |
+
#define numnames NCURSES_PUBLIC_VAR(numnames())
|
| 774 |
+
#define numcodes NCURSES_PUBLIC_VAR(numcodes())
|
| 775 |
+
#define numfnames NCURSES_PUBLIC_VAR(numfnames())
|
| 776 |
+
#define strnames NCURSES_PUBLIC_VAR(strnames())
|
| 777 |
+
#define strcodes NCURSES_PUBLIC_VAR(strcodes())
|
| 778 |
+
#define strfnames NCURSES_PUBLIC_VAR(strfnames())
|
| 779 |
+
|
| 780 |
+
#else
|
| 781 |
+
|
| 782 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
|
| 783 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
|
| 784 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
|
| 785 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
|
| 786 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
|
| 787 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
|
| 788 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
|
| 789 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
|
| 790 |
+
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];
|
| 791 |
+
|
| 792 |
+
#endif
|
| 793 |
+
|
| 794 |
+
/*
|
| 795 |
+
* These entrypoints are used only by the ncurses utilities such as tic.
|
| 796 |
+
*/
|
| 797 |
+
#ifdef NCURSES_INTERNALS
|
| 798 |
+
|
| 799 |
+
extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);
|
| 800 |
+
extern NCURSES_EXPORT(int) _nc_read_entry2 (const char * const, char * const, TERMTYPE2 *const);
|
| 801 |
+
extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE2 *);
|
| 802 |
+
extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE2 *, char *, int);
|
| 803 |
+
extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);
|
| 804 |
+
extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);
|
| 805 |
+
extern NCURSES_EXPORT(char *) _nc_tiparm(int, const char *, ...);
|
| 806 |
+
|
| 807 |
+
#endif /* NCURSES_INTERNALS */
|
| 808 |
+
|
| 809 |
+
|
| 810 |
+
/*
|
| 811 |
+
* These entrypoints are used by tack 1.07.
|
| 812 |
+
*/
|
| 813 |
+
extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);
|
| 814 |
+
extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);
|
| 815 |
+
|
| 816 |
+
/*
|
| 817 |
+
* Normal entry points
|
| 818 |
+
*/
|
| 819 |
+
extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);
|
| 820 |
+
extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);
|
| 821 |
+
|
| 822 |
+
/* miscellaneous entry points */
|
| 823 |
+
extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);
|
| 824 |
+
extern NCURSES_EXPORT(int) setupterm (const char *,int,int *);
|
| 825 |
+
|
| 826 |
+
/* terminfo entry points, also declared in curses.h */
|
| 827 |
+
#if !defined(__NCURSES_H)
|
| 828 |
+
extern NCURSES_EXPORT(char *) tigetstr (const char *);
|
| 829 |
+
extern NCURSES_EXPORT_VAR(char) ttytype[];
|
| 830 |
+
extern NCURSES_EXPORT(int) putp (const char *);
|
| 831 |
+
extern NCURSES_EXPORT(int) tigetflag (const char *);
|
| 832 |
+
extern NCURSES_EXPORT(int) tigetnum (const char *);
|
| 833 |
+
|
| 834 |
+
#if 1 /* NCURSES_TPARM_VARARGS */
|
| 835 |
+
extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */
|
| 836 |
+
#else
|
| 837 |
+
extern NCURSES_EXPORT(char *) tparm (const char *, long,long,long,long,long,long,long,long,long); /* special */
|
| 838 |
+
#endif
|
| 839 |
+
|
| 840 |
+
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
|
| 841 |
+
|
| 842 |
+
#endif /* __NCURSES_H */
|
| 843 |
+
|
| 844 |
+
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
|
| 845 |
+
#if !defined(NCURSES_TERMCAP_H_incl)
|
| 846 |
+
extern NCURSES_EXPORT(char *) tgetstr (const char *, char **);
|
| 847 |
+
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
|
| 848 |
+
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
|
| 849 |
+
extern NCURSES_EXPORT(int) tgetflag (const char *);
|
| 850 |
+
extern NCURSES_EXPORT(int) tgetnum (const char *);
|
| 851 |
+
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
|
| 852 |
+
#endif /* NCURSES_TERMCAP_H_incl */
|
| 853 |
+
|
| 854 |
+
/*
|
| 855 |
+
* Include curses.h before term.h to enable these extensions.
|
| 856 |
+
*/
|
| 857 |
+
#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)
|
| 858 |
+
|
| 859 |
+
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, const char *);
|
| 860 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);
|
| 861 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, const char *);
|
| 862 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, const char *);
|
| 863 |
+
|
| 864 |
+
#if 1 /* NCURSES_TPARM_VARARGS */
|
| 865 |
+
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, ...); /* special */
|
| 866 |
+
#else
|
| 867 |
+
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, long,long,long,long,long,long,long,long,long); /* special */
|
| 868 |
+
#endif
|
| 869 |
+
|
| 870 |
+
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
|
| 871 |
+
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, const char *, char **);
|
| 872 |
+
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);
|
| 873 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);
|
| 874 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, const char *);
|
| 875 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, const char *);
|
| 876 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);
|
| 877 |
+
|
| 878 |
+
extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);
|
| 879 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);
|
| 880 |
+
|
| 881 |
+
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);
|
| 882 |
+
#endif /* NCURSES_SP_FUNCS */
|
| 883 |
+
|
| 884 |
+
/*
|
| 885 |
+
* Debugging features.
|
| 886 |
+
*/
|
| 887 |
+
extern GCC_NORETURN NCURSES_EXPORT(void) exit_terminfo(int);
|
| 888 |
+
|
| 889 |
+
#ifdef __cplusplus
|
| 890 |
+
}
|
| 891 |
+
#endif
|
| 892 |
+
|
| 893 |
+
#endif /* NCURSES_TERM_H_incl */
|
emu3/include/ncursesw/term_entry.h
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2021,2022 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2015,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
* and: Thomas E. Dickey 1998-on *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
/* $Id: term_entry.h,v 1.63 2022/09/24 15:04:59 tom Exp $ */
|
| 37 |
+
|
| 38 |
+
/*
|
| 39 |
+
* term_entry.h -- interface to entry-manipulation code
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
#ifndef NCURSES_TERM_ENTRY_H_incl
|
| 43 |
+
#define NCURSES_TERM_ENTRY_H_incl 1
|
| 44 |
+
/* *INDENT-OFF* */
|
| 45 |
+
|
| 46 |
+
#ifdef __cplusplus
|
| 47 |
+
extern "C" {
|
| 48 |
+
#endif
|
| 49 |
+
|
| 50 |
+
#include <ncursesw/curses.h>
|
| 51 |
+
#include <ncursesw/term.h>
|
| 52 |
+
|
| 53 |
+
/*
|
| 54 |
+
* These macros may be used by programs that know about TERMTYPE:
|
| 55 |
+
*/
|
| 56 |
+
#if NCURSES_XNAMES
|
| 57 |
+
#define NUM_BOOLEANS(tp) (tp)->num_Booleans
|
| 58 |
+
#define NUM_NUMBERS(tp) (tp)->num_Numbers
|
| 59 |
+
#define NUM_STRINGS(tp) (tp)->num_Strings
|
| 60 |
+
#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i]
|
| 61 |
+
#else
|
| 62 |
+
#define NUM_BOOLEANS(tp) BOOLCOUNT
|
| 63 |
+
#define NUM_NUMBERS(tp) NUMCOUNT
|
| 64 |
+
#define NUM_STRINGS(tp) STRCOUNT
|
| 65 |
+
#define EXT_NAMES(tp,i,limit,index,table) table[i]
|
| 66 |
+
#endif
|
| 67 |
+
|
| 68 |
+
#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
|
| 69 |
+
|
| 70 |
+
#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++)
|
| 71 |
+
#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++)
|
| 72 |
+
#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++)
|
| 73 |
+
|
| 74 |
+
#if NCURSES_XNAMES
|
| 75 |
+
#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; (int) n < (int) NUM_BOOLEANS(tp); n++)
|
| 76 |
+
#define for_each_ext_number(n,tp) for(n = NUMCOUNT; (int) n < (int) NUM_NUMBERS(tp); n++)
|
| 77 |
+
#define for_each_ext_string(n,tp) for(n = STRCOUNT; (int) n < (int) NUM_STRINGS(tp); n++)
|
| 78 |
+
#endif
|
| 79 |
+
|
| 80 |
+
#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names)
|
| 81 |
+
#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names)
|
| 82 |
+
#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names)
|
| 83 |
+
|
| 84 |
+
/*
|
| 85 |
+
* The remaining type-definitions and macros are used only internally by the
|
| 86 |
+
* ncurses utilities.
|
| 87 |
+
*/
|
| 88 |
+
#ifdef NCURSES_INTERNALS
|
| 89 |
+
|
| 90 |
+
/*
|
| 91 |
+
* see db_iterator.c - this enumeration lists the places searched for a
|
| 92 |
+
* terminal description and defines the order in which they are searched.
|
| 93 |
+
*/
|
| 94 |
+
typedef enum {
|
| 95 |
+
dbdTIC = 0, /* special, used by tic when writing entry */
|
| 96 |
+
#if NCURSES_USE_DATABASE
|
| 97 |
+
dbdEnvOnce, /* the $TERMINFO environment variable */
|
| 98 |
+
dbdHome, /* $HOME/.terminfo */
|
| 99 |
+
dbdEnvList, /* the $TERMINFO_DIRS environment variable */
|
| 100 |
+
dbdCfgList, /* the compiled-in TERMINFO_DIRS value */
|
| 101 |
+
dbdCfgOnce, /* the compiled-in TERMINFO value */
|
| 102 |
+
#endif
|
| 103 |
+
#if NCURSES_USE_TERMCAP
|
| 104 |
+
dbdEnvOnce2, /* the $TERMCAP environment variable */
|
| 105 |
+
dbdEnvList2, /* the $TERMPATH environment variable */
|
| 106 |
+
dbdCfgList2, /* the compiled-in TERMPATH */
|
| 107 |
+
#endif
|
| 108 |
+
dbdLAST
|
| 109 |
+
} DBDIRS;
|
| 110 |
+
|
| 111 |
+
#define MAX_USES 32
|
| 112 |
+
#define MAX_CROSSLINKS 16
|
| 113 |
+
|
| 114 |
+
typedef struct entry ENTRY;
|
| 115 |
+
|
| 116 |
+
typedef struct {
|
| 117 |
+
char *name;
|
| 118 |
+
ENTRY *link;
|
| 119 |
+
long line;
|
| 120 |
+
} ENTRY_USES;
|
| 121 |
+
|
| 122 |
+
struct entry {
|
| 123 |
+
TERMTYPE2 tterm;
|
| 124 |
+
unsigned nuses;
|
| 125 |
+
ENTRY_USES uses[MAX_USES];
|
| 126 |
+
int ncrosslinks;
|
| 127 |
+
ENTRY *crosslinks[MAX_CROSSLINKS];
|
| 128 |
+
long cstart;
|
| 129 |
+
long cend;
|
| 130 |
+
long startline;
|
| 131 |
+
ENTRY *next;
|
| 132 |
+
ENTRY *last;
|
| 133 |
+
};
|
| 134 |
+
|
| 135 |
+
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head;
|
| 136 |
+
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail;
|
| 137 |
+
#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next)
|
| 138 |
+
#define for_entry_list2(qp,q0) for (qp = q0; qp; qp = qp->next)
|
| 139 |
+
|
| 140 |
+
#define MAX_LINE 132
|
| 141 |
+
|
| 142 |
+
#define NULLHOOK (bool(*)(ENTRY *))0
|
| 143 |
+
|
| 144 |
+
/*
|
| 145 |
+
* Note that WANTED and PRESENT are not simple inverses! If a capability
|
| 146 |
+
* has been explicitly cancelled, it is not considered WANTED.
|
| 147 |
+
*/
|
| 148 |
+
#define WANTED(s) ((s) == ABSENT_STRING)
|
| 149 |
+
#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
|
| 150 |
+
|
| 151 |
+
#define ANDMISSING(p,q) \
|
| 152 |
+
{ \
|
| 153 |
+
if (PRESENT(p) && !PRESENT(q)) \
|
| 154 |
+
_nc_warning(#p " but no " #q); \
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
#define PAIRED(p,q) \
|
| 158 |
+
{ \
|
| 159 |
+
if (PRESENT(q) && !PRESENT(p)) \
|
| 160 |
+
_nc_warning(#q " but no " #p); \
|
| 161 |
+
if (PRESENT(p) && !PRESENT(q)) \
|
| 162 |
+
_nc_warning(#p " but no " #q); \
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
/*
|
| 166 |
+
* These entrypoints are used only by the ncurses utilities such as tic.
|
| 167 |
+
*/
|
| 168 |
+
|
| 169 |
+
/* alloc_entry.c: elementary allocation code */
|
| 170 |
+
extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp);
|
| 171 |
+
extern NCURSES_EXPORT(char *) _nc_save_str (const char *const);
|
| 172 |
+
extern NCURSES_EXPORT(void) _nc_init_entry (ENTRY *const);
|
| 173 |
+
extern NCURSES_EXPORT(void) _nc_merge_entry (ENTRY *const, ENTRY *const);
|
| 174 |
+
extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool);
|
| 175 |
+
|
| 176 |
+
/* alloc_ttype.c: elementary allocation code */
|
| 177 |
+
extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE2 *, TERMTYPE2 *);
|
| 178 |
+
|
| 179 |
+
/* free_ttype.c: elementary allocation code */
|
| 180 |
+
extern NCURSES_EXPORT(void) _nc_free_termtype1 (TERMTYPE *);
|
| 181 |
+
extern NCURSES_EXPORT(void) _nc_free_termtype2 (TERMTYPE2 *);
|
| 182 |
+
|
| 183 |
+
/* lib_termcap.c: trim sgr0 string for termcap users */
|
| 184 |
+
extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE2 *);
|
| 185 |
+
|
| 186 |
+
/* parse_entry.c: entry-parsing code */
|
| 187 |
+
#if NCURSES_XNAMES
|
| 188 |
+
extern NCURSES_EXPORT_VAR(bool) _nc_user_definable;
|
| 189 |
+
extern NCURSES_EXPORT_VAR(bool) _nc_disable_period;
|
| 190 |
+
#endif
|
| 191 |
+
extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool);
|
| 192 |
+
extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *);
|
| 193 |
+
|
| 194 |
+
/* write_entry.c: writing an entry to the file system */
|
| 195 |
+
extern NCURSES_EXPORT(void) _nc_set_writedir (const char *);
|
| 196 |
+
extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE2 *const);
|
| 197 |
+
extern NCURSES_EXPORT(int) _nc_write_object (TERMTYPE2 *, char *, unsigned *, unsigned);
|
| 198 |
+
|
| 199 |
+
/* comp_parse.c: entry list handling */
|
| 200 |
+
extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*));
|
| 201 |
+
extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *);
|
| 202 |
+
extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */
|
| 203 |
+
extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool);
|
| 204 |
+
extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *);
|
| 205 |
+
extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */
|
| 206 |
+
extern NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2)(TERMTYPE2 *, bool);
|
| 207 |
+
|
| 208 |
+
/* trace_xnames.c */
|
| 209 |
+
extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
|
| 210 |
+
|
| 211 |
+
#endif /* NCURSES_INTERNALS */
|
| 212 |
+
|
| 213 |
+
/*
|
| 214 |
+
* These entrypoints were used by tack before 1.08.
|
| 215 |
+
*/
|
| 216 |
+
|
| 217 |
+
#undef NCURSES_TACK_1_08
|
| 218 |
+
#ifdef NCURSES_INTERNALS
|
| 219 |
+
#define NCURSES_TACK_1_08 /* nothing */
|
| 220 |
+
#else
|
| 221 |
+
#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08")
|
| 222 |
+
#endif
|
| 223 |
+
|
| 224 |
+
/* alloc_ttype.c: elementary allocation code */
|
| 225 |
+
extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *) NCURSES_TACK_1_08;
|
| 226 |
+
|
| 227 |
+
/* lib_acs.c */
|
| 228 |
+
extern NCURSES_EXPORT(void) _nc_init_acs (void) NCURSES_TACK_1_08; /* corresponds to traditional 'init_acs()' */
|
| 229 |
+
|
| 230 |
+
/* free_ttype.c: elementary allocation code */
|
| 231 |
+
extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *) NCURSES_TACK_1_08;
|
| 232 |
+
|
| 233 |
+
#ifdef __cplusplus
|
| 234 |
+
}
|
| 235 |
+
#endif
|
| 236 |
+
|
| 237 |
+
/* *INDENT-ON* */
|
| 238 |
+
|
| 239 |
+
#endif /* NCURSES_TERM_ENTRY_H_incl */
|
emu3/include/ncursesw/termcap.h
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2020,2021 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2000,2001 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
/* $Id: termcap.h.in,v 1.20 2021/06/17 21:26:02 tom Exp $ */
|
| 36 |
+
|
| 37 |
+
#ifndef NCURSES_TERMCAP_H_incl
|
| 38 |
+
#define NCURSES_TERMCAP_H_incl 1
|
| 39 |
+
|
| 40 |
+
#undef NCURSES_VERSION
|
| 41 |
+
#define NCURSES_VERSION "6.4"
|
| 42 |
+
|
| 43 |
+
#include <ncursesw/ncurses_dll.h>
|
| 44 |
+
|
| 45 |
+
#ifdef __cplusplus
|
| 46 |
+
extern "C"
|
| 47 |
+
{
|
| 48 |
+
#endif /* __cplusplus */
|
| 49 |
+
|
| 50 |
+
#include <sys/types.h>
|
| 51 |
+
|
| 52 |
+
#undef NCURSES_OSPEED
|
| 53 |
+
#define NCURSES_OSPEED short
|
| 54 |
+
|
| 55 |
+
extern NCURSES_EXPORT_VAR(char) PC;
|
| 56 |
+
extern NCURSES_EXPORT_VAR(char *) UP;
|
| 57 |
+
extern NCURSES_EXPORT_VAR(char *) BC;
|
| 58 |
+
extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed;
|
| 59 |
+
|
| 60 |
+
#if !defined(NCURSES_TERM_H_incl)
|
| 61 |
+
extern NCURSES_EXPORT(char *) tgetstr (const char *, char **);
|
| 62 |
+
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
|
| 63 |
+
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
|
| 64 |
+
extern NCURSES_EXPORT(int) tgetflag (const char *);
|
| 65 |
+
extern NCURSES_EXPORT(int) tgetnum (const char *);
|
| 66 |
+
extern NCURSES_EXPORT(int) tputs (const char *, int, int (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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2018-2021,2022 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
* and: Thomas E. Dickey 1996 on *
|
| 34 |
+
****************************************************************************/
|
| 35 |
+
|
| 36 |
+
/*
|
| 37 |
+
* $Id: tic.h,v 1.86 2022/09/17 16:01:45 tom Exp $
|
| 38 |
+
* tic.h - Global variables and structures for the terminfo compiler.
|
| 39 |
+
*/
|
| 40 |
+
|
| 41 |
+
#ifndef __TIC_H
|
| 42 |
+
#define __TIC_H
|
| 43 |
+
/* *INDENT-OFF* */
|
| 44 |
+
#ifdef __cplusplus
|
| 45 |
+
extern "C" {
|
| 46 |
+
#endif
|
| 47 |
+
|
| 48 |
+
#include <ncurses_cfg.h>
|
| 49 |
+
|
| 50 |
+
#include <ncursesw/curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
|
| 51 |
+
|
| 52 |
+
/*
|
| 53 |
+
** The format of SVr2 compiled terminfo files is as follows:
|
| 54 |
+
**
|
| 55 |
+
** Header (12 bytes), containing information given below
|
| 56 |
+
** Names Section, containing the names of the terminal
|
| 57 |
+
** Boolean Section, containing the values of all of the
|
| 58 |
+
** boolean capabilities
|
| 59 |
+
** A null byte may be inserted here to make
|
| 60 |
+
** sure that the Number Section begins on an
|
| 61 |
+
** even word boundary.
|
| 62 |
+
** Number Section, containing the values of all of the numeric
|
| 63 |
+
** capabilities, each as a short integer
|
| 64 |
+
** String Section, containing short integer offsets into the
|
| 65 |
+
** String Table, one per string capability
|
| 66 |
+
** String Table, containing the actual characters of the string
|
| 67 |
+
** capabilities.
|
| 68 |
+
**
|
| 69 |
+
** In the SVr2 format, "short" means signed 16-bit numbers, which is sometimes
|
| 70 |
+
** inconvenient. The numbers are signed, to provide for absent and canceled
|
| 71 |
+
** values. ncurses6.1 introduced an extension to this compiled format, by
|
| 72 |
+
** making the Number Section a list of signed 32-bit integers.
|
| 73 |
+
**
|
| 74 |
+
** NOTE that all short integers in the file are stored using VAX/PDP-style
|
| 75 |
+
** byte-order, i.e., least-significant byte first.
|
| 76 |
+
**
|
| 77 |
+
** There is no structure definition here because it would only confuse
|
| 78 |
+
** matters. Terminfo format is a raw byte layout, not a structure
|
| 79 |
+
** dump. If you happen to be on a little-endian machine with 16-bit
|
| 80 |
+
** shorts that requires no padding between short members in a struct,
|
| 81 |
+
** then there is a natural C structure that captures the header, but
|
| 82 |
+
** not very helpfully.
|
| 83 |
+
*/
|
| 84 |
+
|
| 85 |
+
#define MAGIC 0432 /* first two bytes of a compiled entry */
|
| 86 |
+
#define MAGIC2 01036 /* first two bytes of a compiled 32-bit entry */
|
| 87 |
+
|
| 88 |
+
#undef BYTE
|
| 89 |
+
#define BYTE(p,n) (unsigned char)((p)[n])
|
| 90 |
+
|
| 91 |
+
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
|
| 92 |
+
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
|
| 93 |
+
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
|
| 94 |
+
|
| 95 |
+
#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC || LOW_MSB(p) == MAGIC2)
|
| 96 |
+
|
| 97 |
+
#define quick_prefix(s) (!strncmp((s), "b64:", (size_t)4) || !strncmp((s), "hex:", (size_t)4))
|
| 98 |
+
|
| 99 |
+
/*
|
| 100 |
+
* The "maximum" here is misleading; XSI guarantees minimum values, which a
|
| 101 |
+
* given implementation may exceed.
|
| 102 |
+
*/
|
| 103 |
+
#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */
|
| 104 |
+
#define MAX_ENTRY_SIZE1 4096 /* maximum legal entry size (SVr2) */
|
| 105 |
+
#define MAX_ENTRY_SIZE2 32768 /* maximum legal entry size (ncurses6.1) */
|
| 106 |
+
|
| 107 |
+
#if NCURSES_EXT_COLORS && HAVE_INIT_EXTENDED_COLOR
|
| 108 |
+
#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE2
|
| 109 |
+
#else
|
| 110 |
+
#define MAX_ENTRY_SIZE MAX_ENTRY_SIZE1
|
| 111 |
+
#endif
|
| 112 |
+
|
| 113 |
+
/*
|
| 114 |
+
* The maximum size of individual name or alias is guaranteed in XSI to be at
|
| 115 |
+
* least 14, since that corresponds to the older filename lengths. Newer
|
| 116 |
+
* systems allow longer aliases, though not many terminal descriptions are
|
| 117 |
+
* written to use them. The MAX_ALIAS symbol is used for warnings.
|
| 118 |
+
*/
|
| 119 |
+
#if HAVE_LONG_FILE_NAMES
|
| 120 |
+
#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */
|
| 121 |
+
#else
|
| 122 |
+
#define MAX_ALIAS 14 /* SVr3 filename length */
|
| 123 |
+
#endif
|
| 124 |
+
|
| 125 |
+
/* location of user's personal info directory */
|
| 126 |
+
#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
|
| 127 |
+
|
| 128 |
+
/*
|
| 129 |
+
* Some traces are designed to be used via tic's verbose option (and similar in
|
| 130 |
+
* infocmp and toe) rather than the 'trace()' function. So we use the bits
|
| 131 |
+
* above the normal trace() parameter as a debug-level.
|
| 132 |
+
*/
|
| 133 |
+
|
| 134 |
+
#define MAX_DEBUG_LEVEL 15
|
| 135 |
+
#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT)
|
| 136 |
+
|
| 137 |
+
#define set_trace_level(n) \
|
| 138 |
+
_nc_tracing &= TRACE_MAXIMUM, \
|
| 139 |
+
_nc_tracing |= DEBUG_LEVEL(n)
|
| 140 |
+
|
| 141 |
+
#ifdef TRACE
|
| 142 |
+
#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
|
| 143 |
+
#else
|
| 144 |
+
#define DEBUG(n, a) /*nothing*/
|
| 145 |
+
#endif
|
| 146 |
+
|
| 147 |
+
/*
|
| 148 |
+
* These are the types of tokens returned by the scanner. The first
|
| 149 |
+
* three are also used in the hash table of capability names. The scanner
|
| 150 |
+
* returns one of these values after loading the specifics into the global
|
| 151 |
+
* structure curr_token.
|
| 152 |
+
*/
|
| 153 |
+
|
| 154 |
+
#define BOOLEAN 0 /* Boolean capability */
|
| 155 |
+
#define NUMBER 1 /* Numeric capability */
|
| 156 |
+
#define STRING 2 /* String-valued capability */
|
| 157 |
+
#define CANCEL 3 /* Capability to be cancelled in following tc's */
|
| 158 |
+
#define NAMES 4 /* The names for a terminal type */
|
| 159 |
+
#define UNDEF 5 /* Undefined */
|
| 160 |
+
|
| 161 |
+
#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */
|
| 162 |
+
|
| 163 |
+
/*
|
| 164 |
+
* The global structure in which the specific parts of a
|
| 165 |
+
* scanned token are returned.
|
| 166 |
+
*/
|
| 167 |
+
|
| 168 |
+
struct token
|
| 169 |
+
{
|
| 170 |
+
char *tk_name; /* name of capability */
|
| 171 |
+
int tk_valnumber; /* value of capability (if a number) */
|
| 172 |
+
char *tk_valstring; /* value of capability (if a string) */
|
| 173 |
+
};
|
| 174 |
+
|
| 175 |
+
/*
|
| 176 |
+
* Offsets to string capabilities, with the corresponding functionkey codes.
|
| 177 |
+
*/
|
| 178 |
+
struct tinfo_fkeys {
|
| 179 |
+
unsigned offset;
|
| 180 |
+
chtype code;
|
| 181 |
+
};
|
| 182 |
+
|
| 183 |
+
typedef short HashValue;
|
| 184 |
+
|
| 185 |
+
/*
|
| 186 |
+
* The file comp_captab.c contains an array of these structures, one per
|
| 187 |
+
* possible capability. These are indexed by a hash table array of pointers to
|
| 188 |
+
* the same structures for use by the parser.
|
| 189 |
+
*/
|
| 190 |
+
struct name_table_entry
|
| 191 |
+
{
|
| 192 |
+
const char *nte_name; /* name to hash on */
|
| 193 |
+
int nte_type; /* BOOLEAN, NUMBER or STRING */
|
| 194 |
+
HashValue nte_index; /* index of associated variable in its array */
|
| 195 |
+
HashValue nte_link; /* index in table of next hash, or -1 */
|
| 196 |
+
};
|
| 197 |
+
|
| 198 |
+
/*
|
| 199 |
+
* Use this structure to hide differences between terminfo and termcap tables.
|
| 200 |
+
*/
|
| 201 |
+
typedef struct {
|
| 202 |
+
unsigned table_size;
|
| 203 |
+
const HashValue *table_data;
|
| 204 |
+
HashValue (*hash_of)(const char *);
|
| 205 |
+
int (*compare_names)(const char *, const char *);
|
| 206 |
+
} HashData;
|
| 207 |
+
|
| 208 |
+
struct alias
|
| 209 |
+
{
|
| 210 |
+
const char *from;
|
| 211 |
+
const char *to;
|
| 212 |
+
const char *source;
|
| 213 |
+
};
|
| 214 |
+
|
| 215 |
+
#define NOTFOUND ((struct name_table_entry *) 0)
|
| 216 |
+
|
| 217 |
+
/*
|
| 218 |
+
* The file comp_userdefs.c contains an array of these structures, one per
|
| 219 |
+
* possible capability. These are indexed by a hash table array of pointers to
|
| 220 |
+
* the same structures for use by the parser.
|
| 221 |
+
*/
|
| 222 |
+
struct user_table_entry
|
| 223 |
+
{
|
| 224 |
+
const char *ute_name; /* name to hash on */
|
| 225 |
+
int ute_type; /* mask (BOOLEAN, NUMBER, STRING) */
|
| 226 |
+
unsigned ute_argc; /* number of parameters */
|
| 227 |
+
unsigned ute_args; /* bit-mask for string parameters */
|
| 228 |
+
HashValue ute_index; /* index of associated variable in its array */
|
| 229 |
+
HashValue ute_link; /* index in table of next hash, or -1 */
|
| 230 |
+
};
|
| 231 |
+
|
| 232 |
+
/*
|
| 233 |
+
* The casts are required for correct sign-propagation with systems such as
|
| 234 |
+
* AIX, IRIX64, Solaris which default to unsigned characters. The C standard
|
| 235 |
+
* leaves this detail unspecified.
|
| 236 |
+
*/
|
| 237 |
+
|
| 238 |
+
/* out-of-band values for representing absent capabilities */
|
| 239 |
+
#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
|
| 240 |
+
#define ABSENT_NUMERIC (-1)
|
| 241 |
+
#define ABSENT_STRING (char *)0
|
| 242 |
+
|
| 243 |
+
/* out-of-band values for representing cancels */
|
| 244 |
+
#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
|
| 245 |
+
#define CANCELLED_NUMERIC (-2)
|
| 246 |
+
#define CANCELLED_STRING (char *)(-1)
|
| 247 |
+
|
| 248 |
+
#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
|
| 249 |
+
#define VALID_NUMERIC(s) ((s) >= 0)
|
| 250 |
+
#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
|
| 251 |
+
|
| 252 |
+
/* termcap entries longer than this may break old binaries */
|
| 253 |
+
#define MAX_TERMCAP_LENGTH 1023
|
| 254 |
+
|
| 255 |
+
/* this is a documented limitation of terminfo */
|
| 256 |
+
#define MAX_TERMINFO_LENGTH 4096
|
| 257 |
+
|
| 258 |
+
#ifndef TERMINFO
|
| 259 |
+
#define TERMINFO "/usr/share/terminfo"
|
| 260 |
+
#endif
|
| 261 |
+
|
| 262 |
+
#ifdef NCURSES_TERM_ENTRY_H_incl
|
| 263 |
+
|
| 264 |
+
/*
|
| 265 |
+
* These entrypoints are used only by the ncurses utilities such as tic.
|
| 266 |
+
*/
|
| 267 |
+
#ifdef NCURSES_INTERNALS
|
| 268 |
+
/* access.c */
|
| 269 |
+
extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
|
| 270 |
+
extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
|
| 271 |
+
extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
|
| 272 |
+
extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
|
| 273 |
+
extern NCURSES_EXPORT(char *) _nc_basename (char *);
|
| 274 |
+
extern NCURSES_EXPORT(char *) _nc_rootname (char *);
|
| 275 |
+
|
| 276 |
+
/* comp_captab.c */
|
| 277 |
+
extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
|
| 278 |
+
extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
|
| 279 |
+
extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
|
| 280 |
+
|
| 281 |
+
/* comp_hash.c: name lookup */
|
| 282 |
+
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
|
| 283 |
+
(const char *, int, bool);
|
| 284 |
+
extern NCURSES_EXPORT(struct user_table_entry const *) _nc_find_user_entry
|
| 285 |
+
(const char *);
|
| 286 |
+
|
| 287 |
+
/* comp_scan.c: lexical analysis */
|
| 288 |
+
extern NCURSES_EXPORT(int) _nc_get_token (bool);
|
| 289 |
+
extern NCURSES_EXPORT(void) _nc_panic_mode (char);
|
| 290 |
+
extern NCURSES_EXPORT(void) _nc_push_token (int);
|
| 291 |
+
extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
|
| 292 |
+
extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
|
| 293 |
+
extern NCURSES_EXPORT_VAR(int) _nc_syntax;
|
| 294 |
+
extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
|
| 295 |
+
extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
|
| 296 |
+
extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
|
| 297 |
+
extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
|
| 298 |
+
extern NCURSES_EXPORT_VAR(long) _nc_start_line;
|
| 299 |
+
#define SYN_TERMINFO 0
|
| 300 |
+
#define SYN_TERMCAP 1
|
| 301 |
+
|
| 302 |
+
/* comp_error.c: warning & abort messages */
|
| 303 |
+
extern NCURSES_EXPORT(const char *) _nc_get_source (void);
|
| 304 |
+
extern GCC_NORETURN NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2);
|
| 305 |
+
extern NCURSES_EXPORT(void) _nc_get_type (char *name);
|
| 306 |
+
extern NCURSES_EXPORT(void) _nc_set_source (const char *const);
|
| 307 |
+
extern NCURSES_EXPORT(void) _nc_set_type (const char *const);
|
| 308 |
+
extern GCC_NORETURN NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2);
|
| 309 |
+
extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2);
|
| 310 |
+
extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
|
| 311 |
+
|
| 312 |
+
/* comp_scan.c */
|
| 313 |
+
extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
|
| 314 |
+
|
| 315 |
+
/* comp_userdefs.c */
|
| 316 |
+
NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void);
|
| 317 |
+
NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void);
|
| 318 |
+
|
| 319 |
+
/* captoinfo.c: capability conversion */
|
| 320 |
+
extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
|
| 321 |
+
extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const);
|
| 322 |
+
|
| 323 |
+
/* home_terminfo.c */
|
| 324 |
+
extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
|
| 325 |
+
|
| 326 |
+
/* init_keytry.c */
|
| 327 |
+
#if BROKEN_LINKER
|
| 328 |
+
#define _nc_tinfo_fkeys _nc_tinfo_fkeysf()
|
| 329 |
+
extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void);
|
| 330 |
+
#else
|
| 331 |
+
extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
|
| 332 |
+
#endif
|
| 333 |
+
|
| 334 |
+
/* lib_tparm.c */
|
| 335 |
+
#define NUM_PARM 9
|
| 336 |
+
|
| 337 |
+
extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
|
| 338 |
+
|
| 339 |
+
extern NCURSES_EXPORT(int) _nc_tparm_analyze(TERMINAL *, const char *, char **, int *);
|
| 340 |
+
extern NCURSES_EXPORT(void) _nc_reset_tparm(TERMINAL *);
|
| 341 |
+
|
| 342 |
+
/* lib_trace.c */
|
| 343 |
+
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
|
| 344 |
+
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
|
| 345 |
+
extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
|
| 346 |
+
|
| 347 |
+
/* lib_tputs.c */
|
| 348 |
+
extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */
|
| 349 |
+
|
| 350 |
+
/* comp_main.c: compiler main */
|
| 351 |
+
extern const char * _nc_progname;
|
| 352 |
+
|
| 353 |
+
/* db_iterator.c */
|
| 354 |
+
extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
|
| 355 |
+
extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
|
| 356 |
+
extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
|
| 357 |
+
extern NCURSES_EXPORT(void) _nc_last_db(void);
|
| 358 |
+
|
| 359 |
+
/* write_entry.c */
|
| 360 |
+
extern NCURSES_EXPORT(int) _nc_tic_written (void);
|
| 361 |
+
|
| 362 |
+
#endif /* NCURSES_INTERNALS */
|
| 363 |
+
|
| 364 |
+
/*
|
| 365 |
+
* These entrypoints were used by tack before 1.08.
|
| 366 |
+
*/
|
| 367 |
+
|
| 368 |
+
#undef NCURSES_TACK_1_08
|
| 369 |
+
#ifdef NCURSES_INTERNALS
|
| 370 |
+
#define NCURSES_TACK_1_08 /* nothing */
|
| 371 |
+
#else
|
| 372 |
+
#define NCURSES_TACK_1_08 GCC_DEPRECATED("upgrade to tack 1.08")
|
| 373 |
+
#endif
|
| 374 |
+
|
| 375 |
+
/* comp_hash.c: name lookup */
|
| 376 |
+
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
|
| 377 |
+
(const char *, const HashValue *) NCURSES_TACK_1_08;
|
| 378 |
+
extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool) NCURSES_TACK_1_08;
|
| 379 |
+
|
| 380 |
+
/* comp_scan.c: lexical analysis */
|
| 381 |
+
extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *) NCURSES_TACK_1_08;
|
| 382 |
+
|
| 383 |
+
/* comp_expand.c: expand string into readable form */
|
| 384 |
+
extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int) NCURSES_TACK_1_08;
|
| 385 |
+
|
| 386 |
+
/* comp_scan.c: decode string from readable form */
|
| 387 |
+
extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *) NCURSES_TACK_1_08;
|
| 388 |
+
|
| 389 |
+
#endif /* NCURSES_TERM_ENTRY_H_incl */
|
| 390 |
+
|
| 391 |
+
#ifdef __cplusplus
|
| 392 |
+
}
|
| 393 |
+
#endif
|
| 394 |
+
|
| 395 |
+
/* *INDENT-ON* */
|
| 396 |
+
#endif /* __TIC_H */
|
emu3/include/ncursesw/unctrl.h
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/****************************************************************************
|
| 2 |
+
* Copyright 2020 Thomas E. Dickey *
|
| 3 |
+
* Copyright 1998-2001,2009 Free Software Foundation, Inc. *
|
| 4 |
+
* *
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining a *
|
| 6 |
+
* copy of this software and associated documentation files (the *
|
| 7 |
+
* "Software"), to deal in the Software without restriction, including *
|
| 8 |
+
* without limitation the rights to use, copy, modify, merge, publish, *
|
| 9 |
+
* distribute, distribute with modifications, sublicense, and/or sell *
|
| 10 |
+
* copies of the Software, and to permit persons to whom the Software is *
|
| 11 |
+
* furnished to do so, subject to the following conditions: *
|
| 12 |
+
* *
|
| 13 |
+
* The above copyright notice and this permission notice shall be included *
|
| 14 |
+
* in all copies or substantial portions of the Software. *
|
| 15 |
+
* *
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
| 17 |
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
| 19 |
+
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
| 20 |
+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
| 21 |
+
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
| 22 |
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
| 23 |
+
* *
|
| 24 |
+
* Except as contained in this notice, the name(s) of the above copyright *
|
| 25 |
+
* holders shall not be used in advertising or otherwise to promote the *
|
| 26 |
+
* sale, use or other dealings in this Software without prior written *
|
| 27 |
+
* authorization. *
|
| 28 |
+
****************************************************************************/
|
| 29 |
+
|
| 30 |
+
/****************************************************************************
|
| 31 |
+
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
|
| 32 |
+
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
| 33 |
+
****************************************************************************/
|
| 34 |
+
|
| 35 |
+
/*
|
| 36 |
+
* unctrl.h
|
| 37 |
+
*
|
| 38 |
+
* Display a printable version of a control character.
|
| 39 |
+
* Control characters are displayed in caret notation (^x), DELETE is displayed
|
| 40 |
+
* as ^?. Printable characters are displayed as is.
|
| 41 |
+
*/
|
| 42 |
+
|
| 43 |
+
/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */
|
| 44 |
+
|
| 45 |
+
#ifndef NCURSES_UNCTRL_H_incl
|
| 46 |
+
#define NCURSES_UNCTRL_H_incl 1
|
| 47 |
+
|
| 48 |
+
#undef NCURSES_VERSION
|
| 49 |
+
#define NCURSES_VERSION "6.4"
|
| 50 |
+
|
| 51 |
+
#ifdef __cplusplus
|
| 52 |
+
extern "C" {
|
| 53 |
+
#endif
|
| 54 |
+
|
| 55 |
+
#include <ncursesw/curses.h>
|
| 56 |
+
|
| 57 |
+
#undef unctrl
|
| 58 |
+
NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
|
| 59 |
+
|
| 60 |
+
#if 1
|
| 61 |
+
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
|
| 62 |
+
#endif
|
| 63 |
+
|
| 64 |
+
#ifdef __cplusplus
|
| 65 |
+
}
|
| 66 |
+
#endif
|
| 67 |
+
|
| 68 |
+
#endif /* NCURSES_UNCTRL_H_incl */
|
emu3/include/openssl/buffer.h
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 5 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 6 |
+
* in the file LICENSE in the source distribution or at
|
| 7 |
+
* https://www.openssl.org/source/license.html
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
#ifndef OPENSSL_BUFFER_H
|
| 11 |
+
# define OPENSSL_BUFFER_H
|
| 12 |
+
# pragma once
|
| 13 |
+
|
| 14 |
+
# include <openssl/macros.h>
|
| 15 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 16 |
+
# define HEADER_BUFFER_H
|
| 17 |
+
# endif
|
| 18 |
+
|
| 19 |
+
# include <openssl/types.h>
|
| 20 |
+
# ifndef OPENSSL_CRYPTO_H
|
| 21 |
+
# include <openssl/crypto.h>
|
| 22 |
+
# endif
|
| 23 |
+
# include <openssl/buffererr.h>
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
#ifdef __cplusplus
|
| 27 |
+
extern "C" {
|
| 28 |
+
#endif
|
| 29 |
+
|
| 30 |
+
# include <stddef.h>
|
| 31 |
+
# include <sys/types.h>
|
| 32 |
+
|
| 33 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 34 |
+
# define BUF_strdup(s) OPENSSL_strdup(s)
|
| 35 |
+
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
| 36 |
+
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
| 37 |
+
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
| 38 |
+
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
| 39 |
+
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
| 40 |
+
# endif
|
| 41 |
+
|
| 42 |
+
struct buf_mem_st {
|
| 43 |
+
size_t length; /* current number of bytes */
|
| 44 |
+
char *data;
|
| 45 |
+
size_t max; /* size of buffer */
|
| 46 |
+
unsigned long flags;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
# define BUF_MEM_FLAG_SECURE 0x01
|
| 50 |
+
|
| 51 |
+
BUF_MEM *BUF_MEM_new(void);
|
| 52 |
+
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
| 53 |
+
void BUF_MEM_free(BUF_MEM *a);
|
| 54 |
+
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
| 55 |
+
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
| 56 |
+
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# ifdef __cplusplus
|
| 60 |
+
}
|
| 61 |
+
# endif
|
| 62 |
+
#endif
|
emu3/include/openssl/camellia.h
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 5 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 6 |
+
* in the file LICENSE in the source distribution or at
|
| 7 |
+
* https://www.openssl.org/source/license.html
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
#ifndef OPENSSL_CAMELLIA_H
|
| 11 |
+
# define OPENSSL_CAMELLIA_H
|
| 12 |
+
# pragma once
|
| 13 |
+
|
| 14 |
+
# include <openssl/macros.h>
|
| 15 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 16 |
+
# define HEADER_CAMELLIA_H
|
| 17 |
+
# endif
|
| 18 |
+
|
| 19 |
+
# include <openssl/opensslconf.h>
|
| 20 |
+
|
| 21 |
+
# ifndef OPENSSL_NO_CAMELLIA
|
| 22 |
+
# include <stddef.h>
|
| 23 |
+
#ifdef __cplusplus
|
| 24 |
+
extern "C" {
|
| 25 |
+
#endif
|
| 26 |
+
|
| 27 |
+
# define CAMELLIA_BLOCK_SIZE 16
|
| 28 |
+
|
| 29 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 30 |
+
|
| 31 |
+
# define CAMELLIA_ENCRYPT 1
|
| 32 |
+
# define CAMELLIA_DECRYPT 0
|
| 33 |
+
|
| 34 |
+
/*
|
| 35 |
+
* Because array size can't be a const in C, the following two are macros.
|
| 36 |
+
* Both sizes are in bytes.
|
| 37 |
+
*/
|
| 38 |
+
|
| 39 |
+
/* This should be a hidden type, but EVP requires that the size be known */
|
| 40 |
+
|
| 41 |
+
# define CAMELLIA_TABLE_BYTE_LEN 272
|
| 42 |
+
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
| 43 |
+
|
| 44 |
+
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
| 45 |
+
* with WORD */
|
| 46 |
+
|
| 47 |
+
struct camellia_key_st {
|
| 48 |
+
union {
|
| 49 |
+
double d; /* ensures 64-bit align */
|
| 50 |
+
KEY_TABLE_TYPE rd_key;
|
| 51 |
+
} u;
|
| 52 |
+
int grand_rounds;
|
| 53 |
+
};
|
| 54 |
+
typedef struct camellia_key_st CAMELLIA_KEY;
|
| 55 |
+
|
| 56 |
+
# endif /* OPENSSL_NO_DEPRECATED_3_0 */
|
| 57 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 58 |
+
OSSL_DEPRECATEDIN_3_0 int Camellia_set_key(const unsigned char *userKey,
|
| 59 |
+
const int bits,
|
| 60 |
+
CAMELLIA_KEY *key);
|
| 61 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_encrypt(const unsigned char *in,
|
| 62 |
+
unsigned char *out,
|
| 63 |
+
const CAMELLIA_KEY *key);
|
| 64 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_decrypt(const unsigned char *in,
|
| 65 |
+
unsigned char *out,
|
| 66 |
+
const CAMELLIA_KEY *key);
|
| 67 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_ecb_encrypt(const unsigned char *in,
|
| 68 |
+
unsigned char *out,
|
| 69 |
+
const CAMELLIA_KEY *key,
|
| 70 |
+
const int enc);
|
| 71 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_cbc_encrypt(const unsigned char *in,
|
| 72 |
+
unsigned char *out,
|
| 73 |
+
size_t length,
|
| 74 |
+
const CAMELLIA_KEY *key,
|
| 75 |
+
unsigned char *ivec,
|
| 76 |
+
const int enc);
|
| 77 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb128_encrypt(const unsigned char *in,
|
| 78 |
+
unsigned char *out,
|
| 79 |
+
size_t length,
|
| 80 |
+
const CAMELLIA_KEY *key,
|
| 81 |
+
unsigned char *ivec,
|
| 82 |
+
int *num,
|
| 83 |
+
const int enc);
|
| 84 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb1_encrypt(const unsigned char *in,
|
| 85 |
+
unsigned char *out,
|
| 86 |
+
size_t length,
|
| 87 |
+
const CAMELLIA_KEY *key,
|
| 88 |
+
unsigned char *ivec,
|
| 89 |
+
int *num,
|
| 90 |
+
const int enc);
|
| 91 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_cfb8_encrypt(const unsigned char *in,
|
| 92 |
+
unsigned char *out,
|
| 93 |
+
size_t length,
|
| 94 |
+
const CAMELLIA_KEY *key,
|
| 95 |
+
unsigned char *ivec,
|
| 96 |
+
int *num,
|
| 97 |
+
const int enc);
|
| 98 |
+
OSSL_DEPRECATEDIN_3_0 void Camellia_ofb128_encrypt(const unsigned char *in,
|
| 99 |
+
unsigned char *out,
|
| 100 |
+
size_t length,
|
| 101 |
+
const CAMELLIA_KEY *key,
|
| 102 |
+
unsigned char *ivec,
|
| 103 |
+
int *num);
|
| 104 |
+
OSSL_DEPRECATEDIN_3_0
|
| 105 |
+
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
| 106 |
+
size_t length, const CAMELLIA_KEY *key,
|
| 107 |
+
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
| 108 |
+
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
| 109 |
+
unsigned int *num);
|
| 110 |
+
# endif
|
| 111 |
+
|
| 112 |
+
# ifdef __cplusplus
|
| 113 |
+
}
|
| 114 |
+
# endif
|
| 115 |
+
# endif
|
| 116 |
+
|
| 117 |
+
#endif
|
emu3/include/openssl/cmserr.h
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Generated by util/mkerr.pl DO NOT EDIT
|
| 3 |
+
* Copyright 1995-2025 The OpenSSL Project Authors. All Rights Reserved.
|
| 4 |
+
*
|
| 5 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 6 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 7 |
+
* in the file LICENSE in the source distribution or at
|
| 8 |
+
* https://www.openssl.org/source/license.html
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
#ifndef OPENSSL_CMSERR_H
|
| 12 |
+
# define OPENSSL_CMSERR_H
|
| 13 |
+
# pragma once
|
| 14 |
+
|
| 15 |
+
# include <openssl/opensslconf.h>
|
| 16 |
+
# include <openssl/symhacks.h>
|
| 17 |
+
# include <openssl/cryptoerr_legacy.h>
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# ifndef OPENSSL_NO_CMS
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
/*
|
| 24 |
+
* CMS reason codes.
|
| 25 |
+
*/
|
| 26 |
+
# define CMS_R_ADD_SIGNER_ERROR 99
|
| 27 |
+
# define CMS_R_ATTRIBUTE_ERROR 161
|
| 28 |
+
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
| 29 |
+
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
| 30 |
+
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
| 31 |
+
# define CMS_R_CIPHER_AEAD_SET_TAG_ERROR 184
|
| 32 |
+
# define CMS_R_CIPHER_GET_TAG 185
|
| 33 |
+
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
| 34 |
+
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
| 35 |
+
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
| 36 |
+
# define CMS_R_CMS_LIB 104
|
| 37 |
+
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
| 38 |
+
# define CMS_R_CONTENT_NOT_FOUND 105
|
| 39 |
+
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
| 40 |
+
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
| 41 |
+
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
| 42 |
+
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
| 43 |
+
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
| 44 |
+
# define CMS_R_CTRL_ERROR 110
|
| 45 |
+
# define CMS_R_CTRL_FAILURE 111
|
| 46 |
+
# define CMS_R_DECODE_ERROR 187
|
| 47 |
+
# define CMS_R_DECRYPT_ERROR 112
|
| 48 |
+
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
| 49 |
+
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
| 50 |
+
# define CMS_R_ERROR_SETTING_KEY 115
|
| 51 |
+
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
| 52 |
+
# define CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT 196
|
| 53 |
+
# define CMS_R_ESS_SIGNING_CERTID_MISMATCH_ERROR 183
|
| 54 |
+
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
| 55 |
+
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
| 56 |
+
# define CMS_R_INVALID_KEY_LENGTH 118
|
| 57 |
+
# define CMS_R_INVALID_LABEL 190
|
| 58 |
+
# define CMS_R_INVALID_OAEP_PARAMETERS 191
|
| 59 |
+
# define CMS_R_KDF_PARAMETER_ERROR 186
|
| 60 |
+
# define CMS_R_MD_BIO_INIT_ERROR 119
|
| 61 |
+
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
| 62 |
+
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
| 63 |
+
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
| 64 |
+
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
| 65 |
+
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
| 66 |
+
# define CMS_R_NEED_ONE_SIGNER 164
|
| 67 |
+
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
| 68 |
+
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
| 69 |
+
# define CMS_R_NOT_KEK 123
|
| 70 |
+
# define CMS_R_NOT_KEY_AGREEMENT 181
|
| 71 |
+
# define CMS_R_NOT_KEY_TRANSPORT 124
|
| 72 |
+
# define CMS_R_NOT_PWRI 177
|
| 73 |
+
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
| 74 |
+
# define CMS_R_NO_CIPHER 126
|
| 75 |
+
# define CMS_R_NO_CONTENT 127
|
| 76 |
+
# define CMS_R_NO_CONTENT_TYPE 173
|
| 77 |
+
# define CMS_R_NO_DEFAULT_DIGEST 128
|
| 78 |
+
# define CMS_R_NO_DIGEST_SET 129
|
| 79 |
+
# define CMS_R_NO_KEY 130
|
| 80 |
+
# define CMS_R_NO_KEY_OR_CERT 174
|
| 81 |
+
# define CMS_R_NO_MATCHING_DIGEST 131
|
| 82 |
+
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
| 83 |
+
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
| 84 |
+
# define CMS_R_NO_MSGSIGDIGEST 167
|
| 85 |
+
# define CMS_R_NO_PASSWORD 178
|
| 86 |
+
# define CMS_R_NO_PRIVATE_KEY 133
|
| 87 |
+
# define CMS_R_NO_PUBLIC_KEY 134
|
| 88 |
+
# define CMS_R_NO_RECEIPT_REQUEST 168
|
| 89 |
+
# define CMS_R_NO_SIGNERS 135
|
| 90 |
+
# define CMS_R_PEER_KEY_ERROR 188
|
| 91 |
+
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
| 92 |
+
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
| 93 |
+
# define CMS_R_RECIPIENT_ERROR 137
|
| 94 |
+
# define CMS_R_SHARED_INFO_ERROR 189
|
| 95 |
+
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
| 96 |
+
# define CMS_R_SIGNFINAL_ERROR 139
|
| 97 |
+
# define CMS_R_SMIME_TEXT_ERROR 140
|
| 98 |
+
# define CMS_R_STORE_INIT_ERROR 141
|
| 99 |
+
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
| 100 |
+
# define CMS_R_TYPE_NOT_DATA 143
|
| 101 |
+
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
| 102 |
+
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
| 103 |
+
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
| 104 |
+
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
| 105 |
+
# define CMS_R_UNKNOWN_CIPHER 148
|
| 106 |
+
# define CMS_R_UNKNOWN_DIGEST_ALGORITHM 149
|
| 107 |
+
# define CMS_R_UNKNOWN_ID 150
|
| 108 |
+
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
| 109 |
+
# define CMS_R_UNSUPPORTED_CONTENT_ENCRYPTION_ALGORITHM 194
|
| 110 |
+
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
| 111 |
+
# define CMS_R_UNSUPPORTED_ENCRYPTION_TYPE 192
|
| 112 |
+
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
| 113 |
+
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
| 114 |
+
# define CMS_R_UNSUPPORTED_LABEL_SOURCE 193
|
| 115 |
+
# define CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE 155
|
| 116 |
+
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
| 117 |
+
# define CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM 195
|
| 118 |
+
# define CMS_R_UNSUPPORTED_TYPE 156
|
| 119 |
+
# define CMS_R_UNWRAP_ERROR 157
|
| 120 |
+
# define CMS_R_UNWRAP_FAILURE 180
|
| 121 |
+
# define CMS_R_VERIFICATION_FAILURE 158
|
| 122 |
+
# define CMS_R_WRAP_ERROR 159
|
| 123 |
+
|
| 124 |
+
# endif
|
| 125 |
+
#endif
|
emu3/include/openssl/configuration.h
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* WARNING: do not edit!
|
| 3 |
+
* Generated by configdata.pm from Configurations/common0.tmpl, Configurations/unix-Makefile.tmpl
|
| 4 |
+
* via Makefile.in
|
| 5 |
+
*
|
| 6 |
+
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
|
| 7 |
+
*
|
| 8 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 9 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 10 |
+
* in the file LICENSE in the source distribution or at
|
| 11 |
+
* https://www.openssl.org/source/license.html
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
#ifndef OPENSSL_CONFIGURATION_H
|
| 15 |
+
# define OPENSSL_CONFIGURATION_H
|
| 16 |
+
# pragma once
|
| 17 |
+
|
| 18 |
+
# ifdef __cplusplus
|
| 19 |
+
extern "C" {
|
| 20 |
+
# endif
|
| 21 |
+
|
| 22 |
+
# ifdef OPENSSL_ALGORITHM_DEFINES
|
| 23 |
+
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
| 24 |
+
# endif
|
| 25 |
+
|
| 26 |
+
/*
|
| 27 |
+
* OpenSSL was configured with the following options:
|
| 28 |
+
*/
|
| 29 |
+
|
| 30 |
+
# define OPENSSL_CONFIGURED_API 30000
|
| 31 |
+
# ifndef OPENSSL_RAND_SEED_OS
|
| 32 |
+
# define OPENSSL_RAND_SEED_OS
|
| 33 |
+
# endif
|
| 34 |
+
# ifndef OPENSSL_THREADS
|
| 35 |
+
# define OPENSSL_THREADS
|
| 36 |
+
# endif
|
| 37 |
+
# ifndef OPENSSL_NO_ACVP_TESTS
|
| 38 |
+
# define OPENSSL_NO_ACVP_TESTS
|
| 39 |
+
# endif
|
| 40 |
+
# ifndef OPENSSL_NO_ASAN
|
| 41 |
+
# define OPENSSL_NO_ASAN
|
| 42 |
+
# endif
|
| 43 |
+
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
| 44 |
+
# define OPENSSL_NO_CRYPTO_MDEBUG
|
| 45 |
+
# endif
|
| 46 |
+
# ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
| 47 |
+
# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
| 48 |
+
# endif
|
| 49 |
+
# ifndef OPENSSL_NO_DEVCRYPTOENG
|
| 50 |
+
# define OPENSSL_NO_DEVCRYPTOENG
|
| 51 |
+
# endif
|
| 52 |
+
# ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
| 53 |
+
# define OPENSSL_NO_EC_NISTP_64_GCC_128
|
| 54 |
+
# endif
|
| 55 |
+
# ifndef OPENSSL_NO_EGD
|
| 56 |
+
# define OPENSSL_NO_EGD
|
| 57 |
+
# endif
|
| 58 |
+
# ifndef OPENSSL_NO_EXTERNAL_TESTS
|
| 59 |
+
# define OPENSSL_NO_EXTERNAL_TESTS
|
| 60 |
+
# endif
|
| 61 |
+
# ifndef OPENSSL_NO_FIPS_SECURITYCHECKS
|
| 62 |
+
# define OPENSSL_NO_FIPS_SECURITYCHECKS
|
| 63 |
+
# endif
|
| 64 |
+
# ifndef OPENSSL_NO_FUZZ_AFL
|
| 65 |
+
# define OPENSSL_NO_FUZZ_AFL
|
| 66 |
+
# endif
|
| 67 |
+
# ifndef OPENSSL_NO_FUZZ_LIBFUZZER
|
| 68 |
+
# define OPENSSL_NO_FUZZ_LIBFUZZER
|
| 69 |
+
# endif
|
| 70 |
+
# ifndef OPENSSL_NO_KTLS
|
| 71 |
+
# define OPENSSL_NO_KTLS
|
| 72 |
+
# endif
|
| 73 |
+
# ifndef OPENSSL_NO_MD2
|
| 74 |
+
# define OPENSSL_NO_MD2
|
| 75 |
+
# endif
|
| 76 |
+
# ifndef OPENSSL_NO_MSAN
|
| 77 |
+
# define OPENSSL_NO_MSAN
|
| 78 |
+
# endif
|
| 79 |
+
# ifndef OPENSSL_NO_RC5
|
| 80 |
+
# define OPENSSL_NO_RC5
|
| 81 |
+
# endif
|
| 82 |
+
# ifndef OPENSSL_NO_SCTP
|
| 83 |
+
# define OPENSSL_NO_SCTP
|
| 84 |
+
# endif
|
| 85 |
+
# ifndef OPENSSL_NO_SSL3
|
| 86 |
+
# define OPENSSL_NO_SSL3
|
| 87 |
+
# endif
|
| 88 |
+
# ifndef OPENSSL_NO_SSL3_METHOD
|
| 89 |
+
# define OPENSSL_NO_SSL3_METHOD
|
| 90 |
+
# endif
|
| 91 |
+
# ifndef OPENSSL_NO_TRACE
|
| 92 |
+
# define OPENSSL_NO_TRACE
|
| 93 |
+
# endif
|
| 94 |
+
# ifndef OPENSSL_NO_UBSAN
|
| 95 |
+
# define OPENSSL_NO_UBSAN
|
| 96 |
+
# endif
|
| 97 |
+
# ifndef OPENSSL_NO_UNIT_TEST
|
| 98 |
+
# define OPENSSL_NO_UNIT_TEST
|
| 99 |
+
# endif
|
| 100 |
+
# ifndef OPENSSL_NO_UPLINK
|
| 101 |
+
# define OPENSSL_NO_UPLINK
|
| 102 |
+
# endif
|
| 103 |
+
# ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
|
| 104 |
+
# define OPENSSL_NO_WEAK_SSL_CIPHERS
|
| 105 |
+
# endif
|
| 106 |
+
# ifndef OPENSSL_NO_STATIC_ENGINE
|
| 107 |
+
# define OPENSSL_NO_STATIC_ENGINE
|
| 108 |
+
# endif
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
/* Generate 80386 code? */
|
| 112 |
+
# undef I386_ONLY
|
| 113 |
+
|
| 114 |
+
/*
|
| 115 |
+
* The following are cipher-specific, but are part of the public API.
|
| 116 |
+
*/
|
| 117 |
+
# if !defined(OPENSSL_SYS_UEFI)
|
| 118 |
+
# undef BN_LLONG
|
| 119 |
+
/* Only one for the following should be defined */
|
| 120 |
+
# define SIXTY_FOUR_BIT_LONG
|
| 121 |
+
# undef SIXTY_FOUR_BIT
|
| 122 |
+
# undef THIRTY_TWO_BIT
|
| 123 |
+
# endif
|
| 124 |
+
|
| 125 |
+
# define RC4_INT unsigned int
|
| 126 |
+
|
| 127 |
+
# ifdef __cplusplus
|
| 128 |
+
}
|
| 129 |
+
# endif
|
| 130 |
+
|
| 131 |
+
#endif /* OPENSSL_CONFIGURATION_H */
|
emu3/include/openssl/ecdh.h
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 5 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 6 |
+
* in the file LICENSE in the source distribution or at
|
| 7 |
+
* https://www.openssl.org/source/license.html
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
#include <openssl/ec.h>
|
emu3/include/openssl/obj_mac.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
emu3/include/openssl/ripemd.h
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
|
| 3 |
+
*
|
| 4 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 5 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 6 |
+
* in the file LICENSE in the source distribution or at
|
| 7 |
+
* https://www.openssl.org/source/license.html
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
#ifndef OPENSSL_RIPEMD_H
|
| 11 |
+
# define OPENSSL_RIPEMD_H
|
| 12 |
+
# pragma once
|
| 13 |
+
|
| 14 |
+
# include <openssl/macros.h>
|
| 15 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 16 |
+
# define HEADER_RIPEMD_H
|
| 17 |
+
# endif
|
| 18 |
+
|
| 19 |
+
# include <openssl/opensslconf.h>
|
| 20 |
+
|
| 21 |
+
# ifndef OPENSSL_NO_RMD160
|
| 22 |
+
# include <openssl/e_os2.h>
|
| 23 |
+
# include <stddef.h>
|
| 24 |
+
|
| 25 |
+
# define RIPEMD160_DIGEST_LENGTH 20
|
| 26 |
+
|
| 27 |
+
# ifdef __cplusplus
|
| 28 |
+
extern "C" {
|
| 29 |
+
# endif
|
| 30 |
+
# if !defined(OPENSSL_NO_DEPRECATED_3_0)
|
| 31 |
+
|
| 32 |
+
# define RIPEMD160_LONG unsigned int
|
| 33 |
+
|
| 34 |
+
# define RIPEMD160_CBLOCK 64
|
| 35 |
+
# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
|
| 36 |
+
|
| 37 |
+
typedef struct RIPEMD160state_st {
|
| 38 |
+
RIPEMD160_LONG A, B, C, D, E;
|
| 39 |
+
RIPEMD160_LONG Nl, Nh;
|
| 40 |
+
RIPEMD160_LONG data[RIPEMD160_LBLOCK];
|
| 41 |
+
unsigned int num;
|
| 42 |
+
} RIPEMD160_CTX;
|
| 43 |
+
# endif
|
| 44 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 45 |
+
OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Init(RIPEMD160_CTX *c);
|
| 46 |
+
OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data,
|
| 47 |
+
size_t len);
|
| 48 |
+
OSSL_DEPRECATEDIN_3_0 int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
|
| 49 |
+
OSSL_DEPRECATEDIN_3_0 unsigned char *RIPEMD160(const unsigned char *d, size_t n,
|
| 50 |
+
unsigned char *md);
|
| 51 |
+
OSSL_DEPRECATEDIN_3_0 void RIPEMD160_Transform(RIPEMD160_CTX *c,
|
| 52 |
+
const unsigned char *b);
|
| 53 |
+
# endif
|
| 54 |
+
|
| 55 |
+
# ifdef __cplusplus
|
| 56 |
+
}
|
| 57 |
+
# endif
|
| 58 |
+
# endif
|
| 59 |
+
#endif
|
emu3/include/openssl/x509v3.h
ADDED
|
@@ -0,0 +1,1450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* WARNING: do not edit!
|
| 3 |
+
* Generated by Makefile from include/openssl/x509v3.h.in
|
| 4 |
+
*
|
| 5 |
+
* Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved.
|
| 6 |
+
*
|
| 7 |
+
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
| 8 |
+
* this file except in compliance with the License. You can obtain a copy
|
| 9 |
+
* in the file LICENSE in the source distribution or at
|
| 10 |
+
* https://www.openssl.org/source/license.html
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
#ifndef OPENSSL_X509V3_H
|
| 16 |
+
# define OPENSSL_X509V3_H
|
| 17 |
+
# pragma once
|
| 18 |
+
|
| 19 |
+
# include <openssl/macros.h>
|
| 20 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 21 |
+
# define HEADER_X509V3_H
|
| 22 |
+
# endif
|
| 23 |
+
|
| 24 |
+
# include <openssl/bio.h>
|
| 25 |
+
# include <openssl/x509.h>
|
| 26 |
+
# include <openssl/conf.h>
|
| 27 |
+
# include <openssl/x509v3err.h>
|
| 28 |
+
|
| 29 |
+
#ifdef __cplusplus
|
| 30 |
+
extern "C" {
|
| 31 |
+
#endif
|
| 32 |
+
|
| 33 |
+
/* Forward reference */
|
| 34 |
+
struct v3_ext_method;
|
| 35 |
+
struct v3_ext_ctx;
|
| 36 |
+
|
| 37 |
+
/* Useful typedefs */
|
| 38 |
+
|
| 39 |
+
typedef void *(*X509V3_EXT_NEW)(void);
|
| 40 |
+
typedef void (*X509V3_EXT_FREE) (void *);
|
| 41 |
+
typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long);
|
| 42 |
+
typedef int (*X509V3_EXT_I2D) (const void *, unsigned char **);
|
| 43 |
+
typedef STACK_OF(CONF_VALUE) *
|
| 44 |
+
(*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext,
|
| 45 |
+
STACK_OF(CONF_VALUE) *extlist);
|
| 46 |
+
typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method,
|
| 47 |
+
struct v3_ext_ctx *ctx,
|
| 48 |
+
STACK_OF(CONF_VALUE) *values);
|
| 49 |
+
typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method,
|
| 50 |
+
void *ext);
|
| 51 |
+
typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method,
|
| 52 |
+
struct v3_ext_ctx *ctx, const char *str);
|
| 53 |
+
typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext,
|
| 54 |
+
BIO *out, int indent);
|
| 55 |
+
typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method,
|
| 56 |
+
struct v3_ext_ctx *ctx, const char *str);
|
| 57 |
+
|
| 58 |
+
/* V3 extension structure */
|
| 59 |
+
|
| 60 |
+
struct v3_ext_method {
|
| 61 |
+
int ext_nid;
|
| 62 |
+
int ext_flags;
|
| 63 |
+
/* If this is set the following four fields are ignored */
|
| 64 |
+
ASN1_ITEM_EXP *it;
|
| 65 |
+
/* Old style ASN1 calls */
|
| 66 |
+
X509V3_EXT_NEW ext_new;
|
| 67 |
+
X509V3_EXT_FREE ext_free;
|
| 68 |
+
X509V3_EXT_D2I d2i;
|
| 69 |
+
X509V3_EXT_I2D i2d;
|
| 70 |
+
/* The following pair is used for string extensions */
|
| 71 |
+
X509V3_EXT_I2S i2s;
|
| 72 |
+
X509V3_EXT_S2I s2i;
|
| 73 |
+
/* The following pair is used for multi-valued extensions */
|
| 74 |
+
X509V3_EXT_I2V i2v;
|
| 75 |
+
X509V3_EXT_V2I v2i;
|
| 76 |
+
/* The following are used for raw extensions */
|
| 77 |
+
X509V3_EXT_I2R i2r;
|
| 78 |
+
X509V3_EXT_R2I r2i;
|
| 79 |
+
void *usr_data; /* Any extension specific data */
|
| 80 |
+
};
|
| 81 |
+
|
| 82 |
+
typedef struct X509V3_CONF_METHOD_st {
|
| 83 |
+
char *(*get_string) (void *db, const char *section, const char *value);
|
| 84 |
+
STACK_OF(CONF_VALUE) *(*get_section) (void *db, const char *section);
|
| 85 |
+
void (*free_string) (void *db, char *string);
|
| 86 |
+
void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section);
|
| 87 |
+
} X509V3_CONF_METHOD;
|
| 88 |
+
|
| 89 |
+
/* Context specific info for producing X509 v3 extensions*/
|
| 90 |
+
struct v3_ext_ctx {
|
| 91 |
+
# define X509V3_CTX_TEST 0x1
|
| 92 |
+
# ifndef OPENSSL_NO_DEPRECATED_3_0
|
| 93 |
+
# define CTX_TEST X509V3_CTX_TEST
|
| 94 |
+
# endif
|
| 95 |
+
# define X509V3_CTX_REPLACE 0x2
|
| 96 |
+
int flags;
|
| 97 |
+
X509 *issuer_cert;
|
| 98 |
+
X509 *subject_cert;
|
| 99 |
+
X509_REQ *subject_req;
|
| 100 |
+
X509_CRL *crl;
|
| 101 |
+
X509V3_CONF_METHOD *db_meth;
|
| 102 |
+
void *db;
|
| 103 |
+
EVP_PKEY *issuer_pkey;
|
| 104 |
+
/* Maybe more here */
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
typedef struct v3_ext_method X509V3_EXT_METHOD;
|
| 108 |
+
|
| 109 |
+
SKM_DEFINE_STACK_OF_INTERNAL(X509V3_EXT_METHOD, X509V3_EXT_METHOD, X509V3_EXT_METHOD)
|
| 110 |
+
#define sk_X509V3_EXT_METHOD_num(sk) OPENSSL_sk_num(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk))
|
| 111 |
+
#define sk_X509V3_EXT_METHOD_value(sk, idx) ((X509V3_EXT_METHOD *)OPENSSL_sk_value(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), (idx)))
|
| 112 |
+
#define sk_X509V3_EXT_METHOD_new(cmp) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp)))
|
| 113 |
+
#define sk_X509V3_EXT_METHOD_new_null() ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_null())
|
| 114 |
+
#define sk_X509V3_EXT_METHOD_new_reserve(cmp, n) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_new_reserve(ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp), (n)))
|
| 115 |
+
#define sk_X509V3_EXT_METHOD_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (n))
|
| 116 |
+
#define sk_X509V3_EXT_METHOD_free(sk) OPENSSL_sk_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk))
|
| 117 |
+
#define sk_X509V3_EXT_METHOD_zero(sk) OPENSSL_sk_zero(ossl_check_X509V3_EXT_METHOD_sk_type(sk))
|
| 118 |
+
#define sk_X509V3_EXT_METHOD_delete(sk, i) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (i)))
|
| 119 |
+
#define sk_X509V3_EXT_METHOD_delete_ptr(sk, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_delete_ptr(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr)))
|
| 120 |
+
#define sk_X509V3_EXT_METHOD_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))
|
| 121 |
+
#define sk_X509V3_EXT_METHOD_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))
|
| 122 |
+
#define sk_X509V3_EXT_METHOD_pop(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_pop(ossl_check_X509V3_EXT_METHOD_sk_type(sk)))
|
| 123 |
+
#define sk_X509V3_EXT_METHOD_shift(sk) ((X509V3_EXT_METHOD *)OPENSSL_sk_shift(ossl_check_X509V3_EXT_METHOD_sk_type(sk)))
|
| 124 |
+
#define sk_X509V3_EXT_METHOD_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509V3_EXT_METHOD_sk_type(sk),ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc))
|
| 125 |
+
#define sk_X509V3_EXT_METHOD_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), (idx))
|
| 126 |
+
#define sk_X509V3_EXT_METHOD_set(sk, idx, ptr) ((X509V3_EXT_METHOD *)OPENSSL_sk_set(ossl_check_X509V3_EXT_METHOD_sk_type(sk), (idx), ossl_check_X509V3_EXT_METHOD_type(ptr)))
|
| 127 |
+
#define sk_X509V3_EXT_METHOD_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))
|
| 128 |
+
#define sk_X509V3_EXT_METHOD_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr))
|
| 129 |
+
#define sk_X509V3_EXT_METHOD_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_type(ptr), pnum)
|
| 130 |
+
#define sk_X509V3_EXT_METHOD_sort(sk) OPENSSL_sk_sort(ossl_check_X509V3_EXT_METHOD_sk_type(sk))
|
| 131 |
+
#define sk_X509V3_EXT_METHOD_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk))
|
| 132 |
+
#define sk_X509V3_EXT_METHOD_dup(sk) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_dup(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk)))
|
| 133 |
+
#define sk_X509V3_EXT_METHOD_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509V3_EXT_METHOD) *)OPENSSL_sk_deep_copy(ossl_check_const_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_copyfunc_type(copyfunc), ossl_check_X509V3_EXT_METHOD_freefunc_type(freefunc)))
|
| 134 |
+
#define sk_X509V3_EXT_METHOD_set_cmp_func(sk, cmp) ((sk_X509V3_EXT_METHOD_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509V3_EXT_METHOD_sk_type(sk), ossl_check_X509V3_EXT_METHOD_compfunc_type(cmp)))
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
/* ext_flags values */
|
| 138 |
+
# define X509V3_EXT_DYNAMIC 0x1
|
| 139 |
+
# define X509V3_EXT_CTX_DEP 0x2
|
| 140 |
+
# define X509V3_EXT_MULTILINE 0x4
|
| 141 |
+
|
| 142 |
+
typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
|
| 143 |
+
|
| 144 |
+
typedef struct BASIC_CONSTRAINTS_st {
|
| 145 |
+
int ca;
|
| 146 |
+
ASN1_INTEGER *pathlen;
|
| 147 |
+
} BASIC_CONSTRAINTS;
|
| 148 |
+
|
| 149 |
+
typedef struct PKEY_USAGE_PERIOD_st {
|
| 150 |
+
ASN1_GENERALIZEDTIME *notBefore;
|
| 151 |
+
ASN1_GENERALIZEDTIME *notAfter;
|
| 152 |
+
} PKEY_USAGE_PERIOD;
|
| 153 |
+
|
| 154 |
+
typedef struct otherName_st {
|
| 155 |
+
ASN1_OBJECT *type_id;
|
| 156 |
+
ASN1_TYPE *value;
|
| 157 |
+
} OTHERNAME;
|
| 158 |
+
|
| 159 |
+
typedef struct EDIPartyName_st {
|
| 160 |
+
ASN1_STRING *nameAssigner;
|
| 161 |
+
ASN1_STRING *partyName;
|
| 162 |
+
} EDIPARTYNAME;
|
| 163 |
+
|
| 164 |
+
typedef struct GENERAL_NAME_st {
|
| 165 |
+
# define GEN_OTHERNAME 0
|
| 166 |
+
# define GEN_EMAIL 1
|
| 167 |
+
# define GEN_DNS 2
|
| 168 |
+
# define GEN_X400 3
|
| 169 |
+
# define GEN_DIRNAME 4
|
| 170 |
+
# define GEN_EDIPARTY 5
|
| 171 |
+
# define GEN_URI 6
|
| 172 |
+
# define GEN_IPADD 7
|
| 173 |
+
# define GEN_RID 8
|
| 174 |
+
int type;
|
| 175 |
+
union {
|
| 176 |
+
char *ptr;
|
| 177 |
+
OTHERNAME *otherName; /* otherName */
|
| 178 |
+
ASN1_IA5STRING *rfc822Name;
|
| 179 |
+
ASN1_IA5STRING *dNSName;
|
| 180 |
+
ASN1_STRING *x400Address;
|
| 181 |
+
X509_NAME *directoryName;
|
| 182 |
+
EDIPARTYNAME *ediPartyName;
|
| 183 |
+
ASN1_IA5STRING *uniformResourceIdentifier;
|
| 184 |
+
ASN1_OCTET_STRING *iPAddress;
|
| 185 |
+
ASN1_OBJECT *registeredID;
|
| 186 |
+
/* Old names */
|
| 187 |
+
ASN1_OCTET_STRING *ip; /* iPAddress */
|
| 188 |
+
X509_NAME *dirn; /* dirn */
|
| 189 |
+
ASN1_IA5STRING *ia5; /* rfc822Name, dNSName,
|
| 190 |
+
* uniformResourceIdentifier */
|
| 191 |
+
ASN1_OBJECT *rid; /* registeredID */
|
| 192 |
+
ASN1_TYPE *other; /* x400Address */
|
| 193 |
+
} d;
|
| 194 |
+
} GENERAL_NAME;
|
| 195 |
+
|
| 196 |
+
typedef struct ACCESS_DESCRIPTION_st {
|
| 197 |
+
ASN1_OBJECT *method;
|
| 198 |
+
GENERAL_NAME *location;
|
| 199 |
+
} ACCESS_DESCRIPTION;
|
| 200 |
+
|
| 201 |
+
SKM_DEFINE_STACK_OF_INTERNAL(ACCESS_DESCRIPTION, ACCESS_DESCRIPTION, ACCESS_DESCRIPTION)
|
| 202 |
+
#define sk_ACCESS_DESCRIPTION_num(sk) OPENSSL_sk_num(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk))
|
| 203 |
+
#define sk_ACCESS_DESCRIPTION_value(sk, idx) ((ACCESS_DESCRIPTION *)OPENSSL_sk_value(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), (idx)))
|
| 204 |
+
#define sk_ACCESS_DESCRIPTION_new(cmp) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp)))
|
| 205 |
+
#define sk_ACCESS_DESCRIPTION_new_null() ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_null())
|
| 206 |
+
#define sk_ACCESS_DESCRIPTION_new_reserve(cmp, n) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_new_reserve(ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp), (n)))
|
| 207 |
+
#define sk_ACCESS_DESCRIPTION_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (n))
|
| 208 |
+
#define sk_ACCESS_DESCRIPTION_free(sk) OPENSSL_sk_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))
|
| 209 |
+
#define sk_ACCESS_DESCRIPTION_zero(sk) OPENSSL_sk_zero(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))
|
| 210 |
+
#define sk_ACCESS_DESCRIPTION_delete(sk, i) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (i)))
|
| 211 |
+
#define sk_ACCESS_DESCRIPTION_delete_ptr(sk, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_delete_ptr(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr)))
|
| 212 |
+
#define sk_ACCESS_DESCRIPTION_push(sk, ptr) OPENSSL_sk_push(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))
|
| 213 |
+
#define sk_ACCESS_DESCRIPTION_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))
|
| 214 |
+
#define sk_ACCESS_DESCRIPTION_pop(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_pop(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)))
|
| 215 |
+
#define sk_ACCESS_DESCRIPTION_shift(sk) ((ACCESS_DESCRIPTION *)OPENSSL_sk_shift(ossl_check_ACCESS_DESCRIPTION_sk_type(sk)))
|
| 216 |
+
#define sk_ACCESS_DESCRIPTION_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ACCESS_DESCRIPTION_sk_type(sk),ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc))
|
| 217 |
+
#define sk_ACCESS_DESCRIPTION_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), (idx))
|
| 218 |
+
#define sk_ACCESS_DESCRIPTION_set(sk, idx, ptr) ((ACCESS_DESCRIPTION *)OPENSSL_sk_set(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), (idx), ossl_check_ACCESS_DESCRIPTION_type(ptr)))
|
| 219 |
+
#define sk_ACCESS_DESCRIPTION_find(sk, ptr) OPENSSL_sk_find(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))
|
| 220 |
+
#define sk_ACCESS_DESCRIPTION_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr))
|
| 221 |
+
#define sk_ACCESS_DESCRIPTION_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_type(ptr), pnum)
|
| 222 |
+
#define sk_ACCESS_DESCRIPTION_sort(sk) OPENSSL_sk_sort(ossl_check_ACCESS_DESCRIPTION_sk_type(sk))
|
| 223 |
+
#define sk_ACCESS_DESCRIPTION_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk))
|
| 224 |
+
#define sk_ACCESS_DESCRIPTION_dup(sk) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_dup(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk)))
|
| 225 |
+
#define sk_ACCESS_DESCRIPTION_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ACCESS_DESCRIPTION) *)OPENSSL_sk_deep_copy(ossl_check_const_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_copyfunc_type(copyfunc), ossl_check_ACCESS_DESCRIPTION_freefunc_type(freefunc)))
|
| 226 |
+
#define sk_ACCESS_DESCRIPTION_set_cmp_func(sk, cmp) ((sk_ACCESS_DESCRIPTION_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ACCESS_DESCRIPTION_sk_type(sk), ossl_check_ACCESS_DESCRIPTION_compfunc_type(cmp)))
|
| 227 |
+
SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAME, GENERAL_NAME, GENERAL_NAME)
|
| 228 |
+
#define sk_GENERAL_NAME_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAME_sk_type(sk))
|
| 229 |
+
#define sk_GENERAL_NAME_value(sk, idx) ((GENERAL_NAME *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAME_sk_type(sk), (idx)))
|
| 230 |
+
#define sk_GENERAL_NAME_new(cmp) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new(ossl_check_GENERAL_NAME_compfunc_type(cmp)))
|
| 231 |
+
#define sk_GENERAL_NAME_new_null() ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_null())
|
| 232 |
+
#define sk_GENERAL_NAME_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAME_compfunc_type(cmp), (n)))
|
| 233 |
+
#define sk_GENERAL_NAME_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAME_sk_type(sk), (n))
|
| 234 |
+
#define sk_GENERAL_NAME_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAME_sk_type(sk))
|
| 235 |
+
#define sk_GENERAL_NAME_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAME_sk_type(sk))
|
| 236 |
+
#define sk_GENERAL_NAME_delete(sk, i) ((GENERAL_NAME *)OPENSSL_sk_delete(ossl_check_GENERAL_NAME_sk_type(sk), (i)))
|
| 237 |
+
#define sk_GENERAL_NAME_delete_ptr(sk, ptr) ((GENERAL_NAME *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr)))
|
| 238 |
+
#define sk_GENERAL_NAME_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))
|
| 239 |
+
#define sk_GENERAL_NAME_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))
|
| 240 |
+
#define sk_GENERAL_NAME_pop(sk) ((GENERAL_NAME *)OPENSSL_sk_pop(ossl_check_GENERAL_NAME_sk_type(sk)))
|
| 241 |
+
#define sk_GENERAL_NAME_shift(sk) ((GENERAL_NAME *)OPENSSL_sk_shift(ossl_check_GENERAL_NAME_sk_type(sk)))
|
| 242 |
+
#define sk_GENERAL_NAME_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAME_sk_type(sk),ossl_check_GENERAL_NAME_freefunc_type(freefunc))
|
| 243 |
+
#define sk_GENERAL_NAME_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), (idx))
|
| 244 |
+
#define sk_GENERAL_NAME_set(sk, idx, ptr) ((GENERAL_NAME *)OPENSSL_sk_set(ossl_check_GENERAL_NAME_sk_type(sk), (idx), ossl_check_GENERAL_NAME_type(ptr)))
|
| 245 |
+
#define sk_GENERAL_NAME_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))
|
| 246 |
+
#define sk_GENERAL_NAME_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr))
|
| 247 |
+
#define sk_GENERAL_NAME_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_type(ptr), pnum)
|
| 248 |
+
#define sk_GENERAL_NAME_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAME_sk_type(sk))
|
| 249 |
+
#define sk_GENERAL_NAME_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAME_sk_type(sk))
|
| 250 |
+
#define sk_GENERAL_NAME_dup(sk) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAME_sk_type(sk)))
|
| 251 |
+
#define sk_GENERAL_NAME_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAME) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_copyfunc_type(copyfunc), ossl_check_GENERAL_NAME_freefunc_type(freefunc)))
|
| 252 |
+
#define sk_GENERAL_NAME_set_cmp_func(sk, cmp) ((sk_GENERAL_NAME_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAME_sk_type(sk), ossl_check_GENERAL_NAME_compfunc_type(cmp)))
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
|
| 256 |
+
typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
|
| 257 |
+
typedef STACK_OF(ASN1_INTEGER) TLS_FEATURE;
|
| 258 |
+
typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
|
| 259 |
+
|
| 260 |
+
SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_NAMES, GENERAL_NAMES, GENERAL_NAMES)
|
| 261 |
+
#define sk_GENERAL_NAMES_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_NAMES_sk_type(sk))
|
| 262 |
+
#define sk_GENERAL_NAMES_value(sk, idx) ((GENERAL_NAMES *)OPENSSL_sk_value(ossl_check_const_GENERAL_NAMES_sk_type(sk), (idx)))
|
| 263 |
+
#define sk_GENERAL_NAMES_new(cmp) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new(ossl_check_GENERAL_NAMES_compfunc_type(cmp)))
|
| 264 |
+
#define sk_GENERAL_NAMES_new_null() ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_null())
|
| 265 |
+
#define sk_GENERAL_NAMES_new_reserve(cmp, n) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_NAMES_compfunc_type(cmp), (n)))
|
| 266 |
+
#define sk_GENERAL_NAMES_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_NAMES_sk_type(sk), (n))
|
| 267 |
+
#define sk_GENERAL_NAMES_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_NAMES_sk_type(sk))
|
| 268 |
+
#define sk_GENERAL_NAMES_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_NAMES_sk_type(sk))
|
| 269 |
+
#define sk_GENERAL_NAMES_delete(sk, i) ((GENERAL_NAMES *)OPENSSL_sk_delete(ossl_check_GENERAL_NAMES_sk_type(sk), (i)))
|
| 270 |
+
#define sk_GENERAL_NAMES_delete_ptr(sk, ptr) ((GENERAL_NAMES *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr)))
|
| 271 |
+
#define sk_GENERAL_NAMES_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))
|
| 272 |
+
#define sk_GENERAL_NAMES_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))
|
| 273 |
+
#define sk_GENERAL_NAMES_pop(sk) ((GENERAL_NAMES *)OPENSSL_sk_pop(ossl_check_GENERAL_NAMES_sk_type(sk)))
|
| 274 |
+
#define sk_GENERAL_NAMES_shift(sk) ((GENERAL_NAMES *)OPENSSL_sk_shift(ossl_check_GENERAL_NAMES_sk_type(sk)))
|
| 275 |
+
#define sk_GENERAL_NAMES_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_NAMES_sk_type(sk),ossl_check_GENERAL_NAMES_freefunc_type(freefunc))
|
| 276 |
+
#define sk_GENERAL_NAMES_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), (idx))
|
| 277 |
+
#define sk_GENERAL_NAMES_set(sk, idx, ptr) ((GENERAL_NAMES *)OPENSSL_sk_set(ossl_check_GENERAL_NAMES_sk_type(sk), (idx), ossl_check_GENERAL_NAMES_type(ptr)))
|
| 278 |
+
#define sk_GENERAL_NAMES_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))
|
| 279 |
+
#define sk_GENERAL_NAMES_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr))
|
| 280 |
+
#define sk_GENERAL_NAMES_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_type(ptr), pnum)
|
| 281 |
+
#define sk_GENERAL_NAMES_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_NAMES_sk_type(sk))
|
| 282 |
+
#define sk_GENERAL_NAMES_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_NAMES_sk_type(sk))
|
| 283 |
+
#define sk_GENERAL_NAMES_dup(sk) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_NAMES_sk_type(sk)))
|
| 284 |
+
#define sk_GENERAL_NAMES_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_NAMES) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_copyfunc_type(copyfunc), ossl_check_GENERAL_NAMES_freefunc_type(freefunc)))
|
| 285 |
+
#define sk_GENERAL_NAMES_set_cmp_func(sk, cmp) ((sk_GENERAL_NAMES_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_NAMES_sk_type(sk), ossl_check_GENERAL_NAMES_compfunc_type(cmp)))
|
| 286 |
+
|
| 287 |
+
|
| 288 |
+
typedef struct DIST_POINT_NAME_st {
|
| 289 |
+
int type;
|
| 290 |
+
union {
|
| 291 |
+
GENERAL_NAMES *fullname;
|
| 292 |
+
STACK_OF(X509_NAME_ENTRY) *relativename;
|
| 293 |
+
} name;
|
| 294 |
+
/* If relativename then this contains the full distribution point name */
|
| 295 |
+
X509_NAME *dpname;
|
| 296 |
+
} DIST_POINT_NAME;
|
| 297 |
+
/* All existing reasons */
|
| 298 |
+
# define CRLDP_ALL_REASONS 0x807f
|
| 299 |
+
|
| 300 |
+
# define CRL_REASON_NONE -1
|
| 301 |
+
# define CRL_REASON_UNSPECIFIED 0
|
| 302 |
+
# define CRL_REASON_KEY_COMPROMISE 1
|
| 303 |
+
# define CRL_REASON_CA_COMPROMISE 2
|
| 304 |
+
# define CRL_REASON_AFFILIATION_CHANGED 3
|
| 305 |
+
# define CRL_REASON_SUPERSEDED 4
|
| 306 |
+
# define CRL_REASON_CESSATION_OF_OPERATION 5
|
| 307 |
+
# define CRL_REASON_CERTIFICATE_HOLD 6
|
| 308 |
+
# define CRL_REASON_REMOVE_FROM_CRL 8
|
| 309 |
+
# define CRL_REASON_PRIVILEGE_WITHDRAWN 9
|
| 310 |
+
# define CRL_REASON_AA_COMPROMISE 10
|
| 311 |
+
|
| 312 |
+
struct DIST_POINT_st {
|
| 313 |
+
DIST_POINT_NAME *distpoint;
|
| 314 |
+
ASN1_BIT_STRING *reasons;
|
| 315 |
+
GENERAL_NAMES *CRLissuer;
|
| 316 |
+
int dp_reasons;
|
| 317 |
+
};
|
| 318 |
+
|
| 319 |
+
SKM_DEFINE_STACK_OF_INTERNAL(DIST_POINT, DIST_POINT, DIST_POINT)
|
| 320 |
+
#define sk_DIST_POINT_num(sk) OPENSSL_sk_num(ossl_check_const_DIST_POINT_sk_type(sk))
|
| 321 |
+
#define sk_DIST_POINT_value(sk, idx) ((DIST_POINT *)OPENSSL_sk_value(ossl_check_const_DIST_POINT_sk_type(sk), (idx)))
|
| 322 |
+
#define sk_DIST_POINT_new(cmp) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new(ossl_check_DIST_POINT_compfunc_type(cmp)))
|
| 323 |
+
#define sk_DIST_POINT_new_null() ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_null())
|
| 324 |
+
#define sk_DIST_POINT_new_reserve(cmp, n) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_new_reserve(ossl_check_DIST_POINT_compfunc_type(cmp), (n)))
|
| 325 |
+
#define sk_DIST_POINT_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_DIST_POINT_sk_type(sk), (n))
|
| 326 |
+
#define sk_DIST_POINT_free(sk) OPENSSL_sk_free(ossl_check_DIST_POINT_sk_type(sk))
|
| 327 |
+
#define sk_DIST_POINT_zero(sk) OPENSSL_sk_zero(ossl_check_DIST_POINT_sk_type(sk))
|
| 328 |
+
#define sk_DIST_POINT_delete(sk, i) ((DIST_POINT *)OPENSSL_sk_delete(ossl_check_DIST_POINT_sk_type(sk), (i)))
|
| 329 |
+
#define sk_DIST_POINT_delete_ptr(sk, ptr) ((DIST_POINT *)OPENSSL_sk_delete_ptr(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr)))
|
| 330 |
+
#define sk_DIST_POINT_push(sk, ptr) OPENSSL_sk_push(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))
|
| 331 |
+
#define sk_DIST_POINT_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))
|
| 332 |
+
#define sk_DIST_POINT_pop(sk) ((DIST_POINT *)OPENSSL_sk_pop(ossl_check_DIST_POINT_sk_type(sk)))
|
| 333 |
+
#define sk_DIST_POINT_shift(sk) ((DIST_POINT *)OPENSSL_sk_shift(ossl_check_DIST_POINT_sk_type(sk)))
|
| 334 |
+
#define sk_DIST_POINT_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_DIST_POINT_sk_type(sk),ossl_check_DIST_POINT_freefunc_type(freefunc))
|
| 335 |
+
#define sk_DIST_POINT_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), (idx))
|
| 336 |
+
#define sk_DIST_POINT_set(sk, idx, ptr) ((DIST_POINT *)OPENSSL_sk_set(ossl_check_DIST_POINT_sk_type(sk), (idx), ossl_check_DIST_POINT_type(ptr)))
|
| 337 |
+
#define sk_DIST_POINT_find(sk, ptr) OPENSSL_sk_find(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))
|
| 338 |
+
#define sk_DIST_POINT_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr))
|
| 339 |
+
#define sk_DIST_POINT_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_type(ptr), pnum)
|
| 340 |
+
#define sk_DIST_POINT_sort(sk) OPENSSL_sk_sort(ossl_check_DIST_POINT_sk_type(sk))
|
| 341 |
+
#define sk_DIST_POINT_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_DIST_POINT_sk_type(sk))
|
| 342 |
+
#define sk_DIST_POINT_dup(sk) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_dup(ossl_check_const_DIST_POINT_sk_type(sk)))
|
| 343 |
+
#define sk_DIST_POINT_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(DIST_POINT) *)OPENSSL_sk_deep_copy(ossl_check_const_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_copyfunc_type(copyfunc), ossl_check_DIST_POINT_freefunc_type(freefunc)))
|
| 344 |
+
#define sk_DIST_POINT_set_cmp_func(sk, cmp) ((sk_DIST_POINT_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_DIST_POINT_sk_type(sk), ossl_check_DIST_POINT_compfunc_type(cmp)))
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
|
| 348 |
+
|
| 349 |
+
struct AUTHORITY_KEYID_st {
|
| 350 |
+
ASN1_OCTET_STRING *keyid;
|
| 351 |
+
GENERAL_NAMES *issuer;
|
| 352 |
+
ASN1_INTEGER *serial;
|
| 353 |
+
};
|
| 354 |
+
|
| 355 |
+
/* Strong extranet structures */
|
| 356 |
+
|
| 357 |
+
typedef struct SXNET_ID_st {
|
| 358 |
+
ASN1_INTEGER *zone;
|
| 359 |
+
ASN1_OCTET_STRING *user;
|
| 360 |
+
} SXNETID;
|
| 361 |
+
|
| 362 |
+
SKM_DEFINE_STACK_OF_INTERNAL(SXNETID, SXNETID, SXNETID)
|
| 363 |
+
#define sk_SXNETID_num(sk) OPENSSL_sk_num(ossl_check_const_SXNETID_sk_type(sk))
|
| 364 |
+
#define sk_SXNETID_value(sk, idx) ((SXNETID *)OPENSSL_sk_value(ossl_check_const_SXNETID_sk_type(sk), (idx)))
|
| 365 |
+
#define sk_SXNETID_new(cmp) ((STACK_OF(SXNETID) *)OPENSSL_sk_new(ossl_check_SXNETID_compfunc_type(cmp)))
|
| 366 |
+
#define sk_SXNETID_new_null() ((STACK_OF(SXNETID) *)OPENSSL_sk_new_null())
|
| 367 |
+
#define sk_SXNETID_new_reserve(cmp, n) ((STACK_OF(SXNETID) *)OPENSSL_sk_new_reserve(ossl_check_SXNETID_compfunc_type(cmp), (n)))
|
| 368 |
+
#define sk_SXNETID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SXNETID_sk_type(sk), (n))
|
| 369 |
+
#define sk_SXNETID_free(sk) OPENSSL_sk_free(ossl_check_SXNETID_sk_type(sk))
|
| 370 |
+
#define sk_SXNETID_zero(sk) OPENSSL_sk_zero(ossl_check_SXNETID_sk_type(sk))
|
| 371 |
+
#define sk_SXNETID_delete(sk, i) ((SXNETID *)OPENSSL_sk_delete(ossl_check_SXNETID_sk_type(sk), (i)))
|
| 372 |
+
#define sk_SXNETID_delete_ptr(sk, ptr) ((SXNETID *)OPENSSL_sk_delete_ptr(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr)))
|
| 373 |
+
#define sk_SXNETID_push(sk, ptr) OPENSSL_sk_push(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))
|
| 374 |
+
#define sk_SXNETID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))
|
| 375 |
+
#define sk_SXNETID_pop(sk) ((SXNETID *)OPENSSL_sk_pop(ossl_check_SXNETID_sk_type(sk)))
|
| 376 |
+
#define sk_SXNETID_shift(sk) ((SXNETID *)OPENSSL_sk_shift(ossl_check_SXNETID_sk_type(sk)))
|
| 377 |
+
#define sk_SXNETID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SXNETID_sk_type(sk),ossl_check_SXNETID_freefunc_type(freefunc))
|
| 378 |
+
#define sk_SXNETID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), (idx))
|
| 379 |
+
#define sk_SXNETID_set(sk, idx, ptr) ((SXNETID *)OPENSSL_sk_set(ossl_check_SXNETID_sk_type(sk), (idx), ossl_check_SXNETID_type(ptr)))
|
| 380 |
+
#define sk_SXNETID_find(sk, ptr) OPENSSL_sk_find(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))
|
| 381 |
+
#define sk_SXNETID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr))
|
| 382 |
+
#define sk_SXNETID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_type(ptr), pnum)
|
| 383 |
+
#define sk_SXNETID_sort(sk) OPENSSL_sk_sort(ossl_check_SXNETID_sk_type(sk))
|
| 384 |
+
#define sk_SXNETID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SXNETID_sk_type(sk))
|
| 385 |
+
#define sk_SXNETID_dup(sk) ((STACK_OF(SXNETID) *)OPENSSL_sk_dup(ossl_check_const_SXNETID_sk_type(sk)))
|
| 386 |
+
#define sk_SXNETID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(SXNETID) *)OPENSSL_sk_deep_copy(ossl_check_const_SXNETID_sk_type(sk), ossl_check_SXNETID_copyfunc_type(copyfunc), ossl_check_SXNETID_freefunc_type(freefunc)))
|
| 387 |
+
#define sk_SXNETID_set_cmp_func(sk, cmp) ((sk_SXNETID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SXNETID_sk_type(sk), ossl_check_SXNETID_compfunc_type(cmp)))
|
| 388 |
+
|
| 389 |
+
|
| 390 |
+
|
| 391 |
+
typedef struct SXNET_st {
|
| 392 |
+
ASN1_INTEGER *version;
|
| 393 |
+
STACK_OF(SXNETID) *ids;
|
| 394 |
+
} SXNET;
|
| 395 |
+
|
| 396 |
+
typedef struct ISSUER_SIGN_TOOL_st {
|
| 397 |
+
ASN1_UTF8STRING *signTool;
|
| 398 |
+
ASN1_UTF8STRING *cATool;
|
| 399 |
+
ASN1_UTF8STRING *signToolCert;
|
| 400 |
+
ASN1_UTF8STRING *cAToolCert;
|
| 401 |
+
} ISSUER_SIGN_TOOL;
|
| 402 |
+
|
| 403 |
+
typedef struct NOTICEREF_st {
|
| 404 |
+
ASN1_STRING *organization;
|
| 405 |
+
STACK_OF(ASN1_INTEGER) *noticenos;
|
| 406 |
+
} NOTICEREF;
|
| 407 |
+
|
| 408 |
+
typedef struct USERNOTICE_st {
|
| 409 |
+
NOTICEREF *noticeref;
|
| 410 |
+
ASN1_STRING *exptext;
|
| 411 |
+
} USERNOTICE;
|
| 412 |
+
|
| 413 |
+
typedef struct POLICYQUALINFO_st {
|
| 414 |
+
ASN1_OBJECT *pqualid;
|
| 415 |
+
union {
|
| 416 |
+
ASN1_IA5STRING *cpsuri;
|
| 417 |
+
USERNOTICE *usernotice;
|
| 418 |
+
ASN1_TYPE *other;
|
| 419 |
+
} d;
|
| 420 |
+
} POLICYQUALINFO;
|
| 421 |
+
|
| 422 |
+
SKM_DEFINE_STACK_OF_INTERNAL(POLICYQUALINFO, POLICYQUALINFO, POLICYQUALINFO)
|
| 423 |
+
#define sk_POLICYQUALINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYQUALINFO_sk_type(sk))
|
| 424 |
+
#define sk_POLICYQUALINFO_value(sk, idx) ((POLICYQUALINFO *)OPENSSL_sk_value(ossl_check_const_POLICYQUALINFO_sk_type(sk), (idx)))
|
| 425 |
+
#define sk_POLICYQUALINFO_new(cmp) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new(ossl_check_POLICYQUALINFO_compfunc_type(cmp)))
|
| 426 |
+
#define sk_POLICYQUALINFO_new_null() ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_null())
|
| 427 |
+
#define sk_POLICYQUALINFO_new_reserve(cmp, n) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYQUALINFO_compfunc_type(cmp), (n)))
|
| 428 |
+
#define sk_POLICYQUALINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYQUALINFO_sk_type(sk), (n))
|
| 429 |
+
#define sk_POLICYQUALINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYQUALINFO_sk_type(sk))
|
| 430 |
+
#define sk_POLICYQUALINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYQUALINFO_sk_type(sk))
|
| 431 |
+
#define sk_POLICYQUALINFO_delete(sk, i) ((POLICYQUALINFO *)OPENSSL_sk_delete(ossl_check_POLICYQUALINFO_sk_type(sk), (i)))
|
| 432 |
+
#define sk_POLICYQUALINFO_delete_ptr(sk, ptr) ((POLICYQUALINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr)))
|
| 433 |
+
#define sk_POLICYQUALINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))
|
| 434 |
+
#define sk_POLICYQUALINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))
|
| 435 |
+
#define sk_POLICYQUALINFO_pop(sk) ((POLICYQUALINFO *)OPENSSL_sk_pop(ossl_check_POLICYQUALINFO_sk_type(sk)))
|
| 436 |
+
#define sk_POLICYQUALINFO_shift(sk) ((POLICYQUALINFO *)OPENSSL_sk_shift(ossl_check_POLICYQUALINFO_sk_type(sk)))
|
| 437 |
+
#define sk_POLICYQUALINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYQUALINFO_sk_type(sk),ossl_check_POLICYQUALINFO_freefunc_type(freefunc))
|
| 438 |
+
#define sk_POLICYQUALINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), (idx))
|
| 439 |
+
#define sk_POLICYQUALINFO_set(sk, idx, ptr) ((POLICYQUALINFO *)OPENSSL_sk_set(ossl_check_POLICYQUALINFO_sk_type(sk), (idx), ossl_check_POLICYQUALINFO_type(ptr)))
|
| 440 |
+
#define sk_POLICYQUALINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))
|
| 441 |
+
#define sk_POLICYQUALINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr))
|
| 442 |
+
#define sk_POLICYQUALINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_type(ptr), pnum)
|
| 443 |
+
#define sk_POLICYQUALINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYQUALINFO_sk_type(sk))
|
| 444 |
+
#define sk_POLICYQUALINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYQUALINFO_sk_type(sk))
|
| 445 |
+
#define sk_POLICYQUALINFO_dup(sk) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYQUALINFO_sk_type(sk)))
|
| 446 |
+
#define sk_POLICYQUALINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYQUALINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_copyfunc_type(copyfunc), ossl_check_POLICYQUALINFO_freefunc_type(freefunc)))
|
| 447 |
+
#define sk_POLICYQUALINFO_set_cmp_func(sk, cmp) ((sk_POLICYQUALINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYQUALINFO_sk_type(sk), ossl_check_POLICYQUALINFO_compfunc_type(cmp)))
|
| 448 |
+
|
| 449 |
+
|
| 450 |
+
|
| 451 |
+
typedef struct POLICYINFO_st {
|
| 452 |
+
ASN1_OBJECT *policyid;
|
| 453 |
+
STACK_OF(POLICYQUALINFO) *qualifiers;
|
| 454 |
+
} POLICYINFO;
|
| 455 |
+
|
| 456 |
+
SKM_DEFINE_STACK_OF_INTERNAL(POLICYINFO, POLICYINFO, POLICYINFO)
|
| 457 |
+
#define sk_POLICYINFO_num(sk) OPENSSL_sk_num(ossl_check_const_POLICYINFO_sk_type(sk))
|
| 458 |
+
#define sk_POLICYINFO_value(sk, idx) ((POLICYINFO *)OPENSSL_sk_value(ossl_check_const_POLICYINFO_sk_type(sk), (idx)))
|
| 459 |
+
#define sk_POLICYINFO_new(cmp) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new(ossl_check_POLICYINFO_compfunc_type(cmp)))
|
| 460 |
+
#define sk_POLICYINFO_new_null() ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_null())
|
| 461 |
+
#define sk_POLICYINFO_new_reserve(cmp, n) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_new_reserve(ossl_check_POLICYINFO_compfunc_type(cmp), (n)))
|
| 462 |
+
#define sk_POLICYINFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICYINFO_sk_type(sk), (n))
|
| 463 |
+
#define sk_POLICYINFO_free(sk) OPENSSL_sk_free(ossl_check_POLICYINFO_sk_type(sk))
|
| 464 |
+
#define sk_POLICYINFO_zero(sk) OPENSSL_sk_zero(ossl_check_POLICYINFO_sk_type(sk))
|
| 465 |
+
#define sk_POLICYINFO_delete(sk, i) ((POLICYINFO *)OPENSSL_sk_delete(ossl_check_POLICYINFO_sk_type(sk), (i)))
|
| 466 |
+
#define sk_POLICYINFO_delete_ptr(sk, ptr) ((POLICYINFO *)OPENSSL_sk_delete_ptr(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr)))
|
| 467 |
+
#define sk_POLICYINFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))
|
| 468 |
+
#define sk_POLICYINFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))
|
| 469 |
+
#define sk_POLICYINFO_pop(sk) ((POLICYINFO *)OPENSSL_sk_pop(ossl_check_POLICYINFO_sk_type(sk)))
|
| 470 |
+
#define sk_POLICYINFO_shift(sk) ((POLICYINFO *)OPENSSL_sk_shift(ossl_check_POLICYINFO_sk_type(sk)))
|
| 471 |
+
#define sk_POLICYINFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICYINFO_sk_type(sk),ossl_check_POLICYINFO_freefunc_type(freefunc))
|
| 472 |
+
#define sk_POLICYINFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), (idx))
|
| 473 |
+
#define sk_POLICYINFO_set(sk, idx, ptr) ((POLICYINFO *)OPENSSL_sk_set(ossl_check_POLICYINFO_sk_type(sk), (idx), ossl_check_POLICYINFO_type(ptr)))
|
| 474 |
+
#define sk_POLICYINFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))
|
| 475 |
+
#define sk_POLICYINFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr))
|
| 476 |
+
#define sk_POLICYINFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_type(ptr), pnum)
|
| 477 |
+
#define sk_POLICYINFO_sort(sk) OPENSSL_sk_sort(ossl_check_POLICYINFO_sk_type(sk))
|
| 478 |
+
#define sk_POLICYINFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICYINFO_sk_type(sk))
|
| 479 |
+
#define sk_POLICYINFO_dup(sk) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_dup(ossl_check_const_POLICYINFO_sk_type(sk)))
|
| 480 |
+
#define sk_POLICYINFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICYINFO) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_copyfunc_type(copyfunc), ossl_check_POLICYINFO_freefunc_type(freefunc)))
|
| 481 |
+
#define sk_POLICYINFO_set_cmp_func(sk, cmp) ((sk_POLICYINFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICYINFO_sk_type(sk), ossl_check_POLICYINFO_compfunc_type(cmp)))
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
|
| 485 |
+
|
| 486 |
+
typedef struct POLICY_MAPPING_st {
|
| 487 |
+
ASN1_OBJECT *issuerDomainPolicy;
|
| 488 |
+
ASN1_OBJECT *subjectDomainPolicy;
|
| 489 |
+
} POLICY_MAPPING;
|
| 490 |
+
|
| 491 |
+
SKM_DEFINE_STACK_OF_INTERNAL(POLICY_MAPPING, POLICY_MAPPING, POLICY_MAPPING)
|
| 492 |
+
#define sk_POLICY_MAPPING_num(sk) OPENSSL_sk_num(ossl_check_const_POLICY_MAPPING_sk_type(sk))
|
| 493 |
+
#define sk_POLICY_MAPPING_value(sk, idx) ((POLICY_MAPPING *)OPENSSL_sk_value(ossl_check_const_POLICY_MAPPING_sk_type(sk), (idx)))
|
| 494 |
+
#define sk_POLICY_MAPPING_new(cmp) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new(ossl_check_POLICY_MAPPING_compfunc_type(cmp)))
|
| 495 |
+
#define sk_POLICY_MAPPING_new_null() ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_null())
|
| 496 |
+
#define sk_POLICY_MAPPING_new_reserve(cmp, n) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_new_reserve(ossl_check_POLICY_MAPPING_compfunc_type(cmp), (n)))
|
| 497 |
+
#define sk_POLICY_MAPPING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_POLICY_MAPPING_sk_type(sk), (n))
|
| 498 |
+
#define sk_POLICY_MAPPING_free(sk) OPENSSL_sk_free(ossl_check_POLICY_MAPPING_sk_type(sk))
|
| 499 |
+
#define sk_POLICY_MAPPING_zero(sk) OPENSSL_sk_zero(ossl_check_POLICY_MAPPING_sk_type(sk))
|
| 500 |
+
#define sk_POLICY_MAPPING_delete(sk, i) ((POLICY_MAPPING *)OPENSSL_sk_delete(ossl_check_POLICY_MAPPING_sk_type(sk), (i)))
|
| 501 |
+
#define sk_POLICY_MAPPING_delete_ptr(sk, ptr) ((POLICY_MAPPING *)OPENSSL_sk_delete_ptr(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr)))
|
| 502 |
+
#define sk_POLICY_MAPPING_push(sk, ptr) OPENSSL_sk_push(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))
|
| 503 |
+
#define sk_POLICY_MAPPING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))
|
| 504 |
+
#define sk_POLICY_MAPPING_pop(sk) ((POLICY_MAPPING *)OPENSSL_sk_pop(ossl_check_POLICY_MAPPING_sk_type(sk)))
|
| 505 |
+
#define sk_POLICY_MAPPING_shift(sk) ((POLICY_MAPPING *)OPENSSL_sk_shift(ossl_check_POLICY_MAPPING_sk_type(sk)))
|
| 506 |
+
#define sk_POLICY_MAPPING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_POLICY_MAPPING_sk_type(sk),ossl_check_POLICY_MAPPING_freefunc_type(freefunc))
|
| 507 |
+
#define sk_POLICY_MAPPING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), (idx))
|
| 508 |
+
#define sk_POLICY_MAPPING_set(sk, idx, ptr) ((POLICY_MAPPING *)OPENSSL_sk_set(ossl_check_POLICY_MAPPING_sk_type(sk), (idx), ossl_check_POLICY_MAPPING_type(ptr)))
|
| 509 |
+
#define sk_POLICY_MAPPING_find(sk, ptr) OPENSSL_sk_find(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))
|
| 510 |
+
#define sk_POLICY_MAPPING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr))
|
| 511 |
+
#define sk_POLICY_MAPPING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_type(ptr), pnum)
|
| 512 |
+
#define sk_POLICY_MAPPING_sort(sk) OPENSSL_sk_sort(ossl_check_POLICY_MAPPING_sk_type(sk))
|
| 513 |
+
#define sk_POLICY_MAPPING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_POLICY_MAPPING_sk_type(sk))
|
| 514 |
+
#define sk_POLICY_MAPPING_dup(sk) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_dup(ossl_check_const_POLICY_MAPPING_sk_type(sk)))
|
| 515 |
+
#define sk_POLICY_MAPPING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(POLICY_MAPPING) *)OPENSSL_sk_deep_copy(ossl_check_const_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_copyfunc_type(copyfunc), ossl_check_POLICY_MAPPING_freefunc_type(freefunc)))
|
| 516 |
+
#define sk_POLICY_MAPPING_set_cmp_func(sk, cmp) ((sk_POLICY_MAPPING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_POLICY_MAPPING_sk_type(sk), ossl_check_POLICY_MAPPING_compfunc_type(cmp)))
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
|
| 520 |
+
|
| 521 |
+
typedef struct GENERAL_SUBTREE_st {
|
| 522 |
+
GENERAL_NAME *base;
|
| 523 |
+
ASN1_INTEGER *minimum;
|
| 524 |
+
ASN1_INTEGER *maximum;
|
| 525 |
+
} GENERAL_SUBTREE;
|
| 526 |
+
|
| 527 |
+
SKM_DEFINE_STACK_OF_INTERNAL(GENERAL_SUBTREE, GENERAL_SUBTREE, GENERAL_SUBTREE)
|
| 528 |
+
#define sk_GENERAL_SUBTREE_num(sk) OPENSSL_sk_num(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))
|
| 529 |
+
#define sk_GENERAL_SUBTREE_value(sk, idx) ((GENERAL_SUBTREE *)OPENSSL_sk_value(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), (idx)))
|
| 530 |
+
#define sk_GENERAL_SUBTREE_new(cmp) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp)))
|
| 531 |
+
#define sk_GENERAL_SUBTREE_new_null() ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_null())
|
| 532 |
+
#define sk_GENERAL_SUBTREE_new_reserve(cmp, n) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_new_reserve(ossl_check_GENERAL_SUBTREE_compfunc_type(cmp), (n)))
|
| 533 |
+
#define sk_GENERAL_SUBTREE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_GENERAL_SUBTREE_sk_type(sk), (n))
|
| 534 |
+
#define sk_GENERAL_SUBTREE_free(sk) OPENSSL_sk_free(ossl_check_GENERAL_SUBTREE_sk_type(sk))
|
| 535 |
+
#define sk_GENERAL_SUBTREE_zero(sk) OPENSSL_sk_zero(ossl_check_GENERAL_SUBTREE_sk_type(sk))
|
| 536 |
+
#define sk_GENERAL_SUBTREE_delete(sk, i) ((GENERAL_SUBTREE *)OPENSSL_sk_delete(ossl_check_GENERAL_SUBTREE_sk_type(sk), (i)))
|
| 537 |
+
#define sk_GENERAL_SUBTREE_delete_ptr(sk, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_delete_ptr(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr)))
|
| 538 |
+
#define sk_GENERAL_SUBTREE_push(sk, ptr) OPENSSL_sk_push(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))
|
| 539 |
+
#define sk_GENERAL_SUBTREE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))
|
| 540 |
+
#define sk_GENERAL_SUBTREE_pop(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_pop(ossl_check_GENERAL_SUBTREE_sk_type(sk)))
|
| 541 |
+
#define sk_GENERAL_SUBTREE_shift(sk) ((GENERAL_SUBTREE *)OPENSSL_sk_shift(ossl_check_GENERAL_SUBTREE_sk_type(sk)))
|
| 542 |
+
#define sk_GENERAL_SUBTREE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_GENERAL_SUBTREE_sk_type(sk),ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc))
|
| 543 |
+
#define sk_GENERAL_SUBTREE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), (idx))
|
| 544 |
+
#define sk_GENERAL_SUBTREE_set(sk, idx, ptr) ((GENERAL_SUBTREE *)OPENSSL_sk_set(ossl_check_GENERAL_SUBTREE_sk_type(sk), (idx), ossl_check_GENERAL_SUBTREE_type(ptr)))
|
| 545 |
+
#define sk_GENERAL_SUBTREE_find(sk, ptr) OPENSSL_sk_find(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))
|
| 546 |
+
#define sk_GENERAL_SUBTREE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr))
|
| 547 |
+
#define sk_GENERAL_SUBTREE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_type(ptr), pnum)
|
| 548 |
+
#define sk_GENERAL_SUBTREE_sort(sk) OPENSSL_sk_sort(ossl_check_GENERAL_SUBTREE_sk_type(sk))
|
| 549 |
+
#define sk_GENERAL_SUBTREE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_GENERAL_SUBTREE_sk_type(sk))
|
| 550 |
+
#define sk_GENERAL_SUBTREE_dup(sk) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_dup(ossl_check_const_GENERAL_SUBTREE_sk_type(sk)))
|
| 551 |
+
#define sk_GENERAL_SUBTREE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(GENERAL_SUBTREE) *)OPENSSL_sk_deep_copy(ossl_check_const_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_copyfunc_type(copyfunc), ossl_check_GENERAL_SUBTREE_freefunc_type(freefunc)))
|
| 552 |
+
#define sk_GENERAL_SUBTREE_set_cmp_func(sk, cmp) ((sk_GENERAL_SUBTREE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_GENERAL_SUBTREE_sk_type(sk), ossl_check_GENERAL_SUBTREE_compfunc_type(cmp)))
|
| 553 |
+
|
| 554 |
+
|
| 555 |
+
struct NAME_CONSTRAINTS_st {
|
| 556 |
+
STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
|
| 557 |
+
STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
|
| 558 |
+
};
|
| 559 |
+
|
| 560 |
+
typedef struct POLICY_CONSTRAINTS_st {
|
| 561 |
+
ASN1_INTEGER *requireExplicitPolicy;
|
| 562 |
+
ASN1_INTEGER *inhibitPolicyMapping;
|
| 563 |
+
} POLICY_CONSTRAINTS;
|
| 564 |
+
|
| 565 |
+
/* Proxy certificate structures, see RFC 3820 */
|
| 566 |
+
typedef struct PROXY_POLICY_st {
|
| 567 |
+
ASN1_OBJECT *policyLanguage;
|
| 568 |
+
ASN1_OCTET_STRING *policy;
|
| 569 |
+
} PROXY_POLICY;
|
| 570 |
+
|
| 571 |
+
typedef struct PROXY_CERT_INFO_EXTENSION_st {
|
| 572 |
+
ASN1_INTEGER *pcPathLengthConstraint;
|
| 573 |
+
PROXY_POLICY *proxyPolicy;
|
| 574 |
+
} PROXY_CERT_INFO_EXTENSION;
|
| 575 |
+
|
| 576 |
+
DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
|
| 577 |
+
DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
|
| 578 |
+
|
| 579 |
+
struct ISSUING_DIST_POINT_st {
|
| 580 |
+
DIST_POINT_NAME *distpoint;
|
| 581 |
+
int onlyuser;
|
| 582 |
+
int onlyCA;
|
| 583 |
+
ASN1_BIT_STRING *onlysomereasons;
|
| 584 |
+
int indirectCRL;
|
| 585 |
+
int onlyattr;
|
| 586 |
+
};
|
| 587 |
+
|
| 588 |
+
/* Values in idp_flags field */
|
| 589 |
+
/* IDP present */
|
| 590 |
+
# define IDP_PRESENT 0x1
|
| 591 |
+
/* IDP values inconsistent */
|
| 592 |
+
# define IDP_INVALID 0x2
|
| 593 |
+
/* onlyuser true */
|
| 594 |
+
# define IDP_ONLYUSER 0x4
|
| 595 |
+
/* onlyCA true */
|
| 596 |
+
# define IDP_ONLYCA 0x8
|
| 597 |
+
/* onlyattr true */
|
| 598 |
+
# define IDP_ONLYATTR 0x10
|
| 599 |
+
/* indirectCRL true */
|
| 600 |
+
# define IDP_INDIRECT 0x20
|
| 601 |
+
/* onlysomereasons present */
|
| 602 |
+
# define IDP_REASONS 0x40
|
| 603 |
+
|
| 604 |
+
# define X509V3_conf_err(val) ERR_add_error_data(6, \
|
| 605 |
+
"section:", (val)->section, \
|
| 606 |
+
",name:", (val)->name, ",value:", (val)->value)
|
| 607 |
+
|
| 608 |
+
# define X509V3_set_ctx_test(ctx) \
|
| 609 |
+
X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, X509V3_CTX_TEST)
|
| 610 |
+
# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
|
| 611 |
+
|
| 612 |
+
# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
|
| 613 |
+
0,0,0,0, \
|
| 614 |
+
0,0, \
|
| 615 |
+
(X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
|
| 616 |
+
(X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
|
| 617 |
+
NULL, NULL, \
|
| 618 |
+
table}
|
| 619 |
+
|
| 620 |
+
# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
|
| 621 |
+
0,0,0,0, \
|
| 622 |
+
(X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
|
| 623 |
+
(X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
|
| 624 |
+
0,0,0,0, \
|
| 625 |
+
NULL}
|
| 626 |
+
|
| 627 |
+
#define EXT_UTF8STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_UTF8STRING), \
|
| 628 |
+
0,0,0,0, \
|
| 629 |
+
(X509V3_EXT_I2S)i2s_ASN1_UTF8STRING, \
|
| 630 |
+
(X509V3_EXT_S2I)s2i_ASN1_UTF8STRING, \
|
| 631 |
+
0,0,0,0, \
|
| 632 |
+
NULL}
|
| 633 |
+
|
| 634 |
+
# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
| 635 |
+
|
| 636 |
+
/* X509_PURPOSE stuff */
|
| 637 |
+
|
| 638 |
+
# define EXFLAG_BCONS 0x1
|
| 639 |
+
# define EXFLAG_KUSAGE 0x2
|
| 640 |
+
# define EXFLAG_XKUSAGE 0x4
|
| 641 |
+
# define EXFLAG_NSCERT 0x8
|
| 642 |
+
|
| 643 |
+
# define EXFLAG_CA 0x10
|
| 644 |
+
# define EXFLAG_SI 0x20 /* self-issued, maybe not self-signed */
|
| 645 |
+
# define EXFLAG_V1 0x40
|
| 646 |
+
# define EXFLAG_INVALID 0x80
|
| 647 |
+
/* EXFLAG_SET is set to indicate that some values have been precomputed */
|
| 648 |
+
# define EXFLAG_SET 0x100
|
| 649 |
+
# define EXFLAG_CRITICAL 0x200
|
| 650 |
+
# define EXFLAG_PROXY 0x400
|
| 651 |
+
|
| 652 |
+
# define EXFLAG_INVALID_POLICY 0x800
|
| 653 |
+
# define EXFLAG_FRESHEST 0x1000
|
| 654 |
+
# define EXFLAG_SS 0x2000 /* cert is apparently self-signed */
|
| 655 |
+
|
| 656 |
+
# define EXFLAG_BCONS_CRITICAL 0x10000
|
| 657 |
+
# define EXFLAG_AKID_CRITICAL 0x20000
|
| 658 |
+
# define EXFLAG_SKID_CRITICAL 0x40000
|
| 659 |
+
# define EXFLAG_SAN_CRITICAL 0x80000
|
| 660 |
+
# define EXFLAG_NO_FINGERPRINT 0x100000
|
| 661 |
+
|
| 662 |
+
# define KU_DIGITAL_SIGNATURE 0x0080
|
| 663 |
+
# define KU_NON_REPUDIATION 0x0040
|
| 664 |
+
# define KU_KEY_ENCIPHERMENT 0x0020
|
| 665 |
+
# define KU_DATA_ENCIPHERMENT 0x0010
|
| 666 |
+
# define KU_KEY_AGREEMENT 0x0008
|
| 667 |
+
# define KU_KEY_CERT_SIGN 0x0004
|
| 668 |
+
# define KU_CRL_SIGN 0x0002
|
| 669 |
+
# define KU_ENCIPHER_ONLY 0x0001
|
| 670 |
+
# define KU_DECIPHER_ONLY 0x8000
|
| 671 |
+
|
| 672 |
+
# define NS_SSL_CLIENT 0x80
|
| 673 |
+
# define NS_SSL_SERVER 0x40
|
| 674 |
+
# define NS_SMIME 0x20
|
| 675 |
+
# define NS_OBJSIGN 0x10
|
| 676 |
+
# define NS_SSL_CA 0x04
|
| 677 |
+
# define NS_SMIME_CA 0x02
|
| 678 |
+
# define NS_OBJSIGN_CA 0x01
|
| 679 |
+
# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
|
| 680 |
+
|
| 681 |
+
# define XKU_SSL_SERVER 0x1
|
| 682 |
+
# define XKU_SSL_CLIENT 0x2
|
| 683 |
+
# define XKU_SMIME 0x4
|
| 684 |
+
# define XKU_CODE_SIGN 0x8
|
| 685 |
+
# define XKU_SGC 0x10 /* Netscape or MS Server-Gated Crypto */
|
| 686 |
+
# define XKU_OCSP_SIGN 0x20
|
| 687 |
+
# define XKU_TIMESTAMP 0x40
|
| 688 |
+
# define XKU_DVCS 0x80
|
| 689 |
+
# define XKU_ANYEKU 0x100
|
| 690 |
+
|
| 691 |
+
# define X509_PURPOSE_DYNAMIC 0x1
|
| 692 |
+
# define X509_PURPOSE_DYNAMIC_NAME 0x2
|
| 693 |
+
|
| 694 |
+
typedef struct x509_purpose_st {
|
| 695 |
+
int purpose;
|
| 696 |
+
int trust; /* Default trust ID */
|
| 697 |
+
int flags;
|
| 698 |
+
int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int);
|
| 699 |
+
char *name;
|
| 700 |
+
char *sname;
|
| 701 |
+
void *usr_data;
|
| 702 |
+
} X509_PURPOSE;
|
| 703 |
+
|
| 704 |
+
SKM_DEFINE_STACK_OF_INTERNAL(X509_PURPOSE, X509_PURPOSE, X509_PURPOSE)
|
| 705 |
+
#define sk_X509_PURPOSE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_PURPOSE_sk_type(sk))
|
| 706 |
+
#define sk_X509_PURPOSE_value(sk, idx) ((X509_PURPOSE *)OPENSSL_sk_value(ossl_check_const_X509_PURPOSE_sk_type(sk), (idx)))
|
| 707 |
+
#define sk_X509_PURPOSE_new(cmp) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new(ossl_check_X509_PURPOSE_compfunc_type(cmp)))
|
| 708 |
+
#define sk_X509_PURPOSE_new_null() ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_null())
|
| 709 |
+
#define sk_X509_PURPOSE_new_reserve(cmp, n) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_new_reserve(ossl_check_X509_PURPOSE_compfunc_type(cmp), (n)))
|
| 710 |
+
#define sk_X509_PURPOSE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_PURPOSE_sk_type(sk), (n))
|
| 711 |
+
#define sk_X509_PURPOSE_free(sk) OPENSSL_sk_free(ossl_check_X509_PURPOSE_sk_type(sk))
|
| 712 |
+
#define sk_X509_PURPOSE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_PURPOSE_sk_type(sk))
|
| 713 |
+
#define sk_X509_PURPOSE_delete(sk, i) ((X509_PURPOSE *)OPENSSL_sk_delete(ossl_check_X509_PURPOSE_sk_type(sk), (i)))
|
| 714 |
+
#define sk_X509_PURPOSE_delete_ptr(sk, ptr) ((X509_PURPOSE *)OPENSSL_sk_delete_ptr(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr)))
|
| 715 |
+
#define sk_X509_PURPOSE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))
|
| 716 |
+
#define sk_X509_PURPOSE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))
|
| 717 |
+
#define sk_X509_PURPOSE_pop(sk) ((X509_PURPOSE *)OPENSSL_sk_pop(ossl_check_X509_PURPOSE_sk_type(sk)))
|
| 718 |
+
#define sk_X509_PURPOSE_shift(sk) ((X509_PURPOSE *)OPENSSL_sk_shift(ossl_check_X509_PURPOSE_sk_type(sk)))
|
| 719 |
+
#define sk_X509_PURPOSE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_PURPOSE_sk_type(sk),ossl_check_X509_PURPOSE_freefunc_type(freefunc))
|
| 720 |
+
#define sk_X509_PURPOSE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), (idx))
|
| 721 |
+
#define sk_X509_PURPOSE_set(sk, idx, ptr) ((X509_PURPOSE *)OPENSSL_sk_set(ossl_check_X509_PURPOSE_sk_type(sk), (idx), ossl_check_X509_PURPOSE_type(ptr)))
|
| 722 |
+
#define sk_X509_PURPOSE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))
|
| 723 |
+
#define sk_X509_PURPOSE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr))
|
| 724 |
+
#define sk_X509_PURPOSE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_type(ptr), pnum)
|
| 725 |
+
#define sk_X509_PURPOSE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_PURPOSE_sk_type(sk))
|
| 726 |
+
#define sk_X509_PURPOSE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_PURPOSE_sk_type(sk))
|
| 727 |
+
#define sk_X509_PURPOSE_dup(sk) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_dup(ossl_check_const_X509_PURPOSE_sk_type(sk)))
|
| 728 |
+
#define sk_X509_PURPOSE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_PURPOSE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_copyfunc_type(copyfunc), ossl_check_X509_PURPOSE_freefunc_type(freefunc)))
|
| 729 |
+
#define sk_X509_PURPOSE_set_cmp_func(sk, cmp) ((sk_X509_PURPOSE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_PURPOSE_sk_type(sk), ossl_check_X509_PURPOSE_compfunc_type(cmp)))
|
| 730 |
+
|
| 731 |
+
|
| 732 |
+
|
| 733 |
+
# define X509_PURPOSE_SSL_CLIENT 1
|
| 734 |
+
# define X509_PURPOSE_SSL_SERVER 2
|
| 735 |
+
# define X509_PURPOSE_NS_SSL_SERVER 3
|
| 736 |
+
# define X509_PURPOSE_SMIME_SIGN 4
|
| 737 |
+
# define X509_PURPOSE_SMIME_ENCRYPT 5
|
| 738 |
+
# define X509_PURPOSE_CRL_SIGN 6
|
| 739 |
+
# define X509_PURPOSE_ANY 7
|
| 740 |
+
# define X509_PURPOSE_OCSP_HELPER 8
|
| 741 |
+
# define X509_PURPOSE_TIMESTAMP_SIGN 9
|
| 742 |
+
|
| 743 |
+
# define X509_PURPOSE_MIN 1
|
| 744 |
+
# define X509_PURPOSE_MAX 9
|
| 745 |
+
|
| 746 |
+
/* Flags for X509V3_EXT_print() */
|
| 747 |
+
|
| 748 |
+
# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
|
| 749 |
+
/* Return error for unknown extensions */
|
| 750 |
+
# define X509V3_EXT_DEFAULT 0
|
| 751 |
+
/* Print error for unknown extensions */
|
| 752 |
+
# define X509V3_EXT_ERROR_UNKNOWN (1L << 16)
|
| 753 |
+
/* ASN1 parse unknown extensions */
|
| 754 |
+
# define X509V3_EXT_PARSE_UNKNOWN (2L << 16)
|
| 755 |
+
/* BIO_dump unknown extensions */
|
| 756 |
+
# define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
|
| 757 |
+
|
| 758 |
+
/* Flags for X509V3_add1_i2d */
|
| 759 |
+
|
| 760 |
+
# define X509V3_ADD_OP_MASK 0xfL
|
| 761 |
+
# define X509V3_ADD_DEFAULT 0L
|
| 762 |
+
# define X509V3_ADD_APPEND 1L
|
| 763 |
+
# define X509V3_ADD_REPLACE 2L
|
| 764 |
+
# define X509V3_ADD_REPLACE_EXISTING 3L
|
| 765 |
+
# define X509V3_ADD_KEEP_EXISTING 4L
|
| 766 |
+
# define X509V3_ADD_DELETE 5L
|
| 767 |
+
# define X509V3_ADD_SILENT 0x10
|
| 768 |
+
|
| 769 |
+
DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
|
| 770 |
+
|
| 771 |
+
DECLARE_ASN1_FUNCTIONS(SXNET)
|
| 772 |
+
DECLARE_ASN1_FUNCTIONS(SXNETID)
|
| 773 |
+
|
| 774 |
+
DECLARE_ASN1_FUNCTIONS(ISSUER_SIGN_TOOL)
|
| 775 |
+
|
| 776 |
+
int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen);
|
| 777 |
+
int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user,
|
| 778 |
+
int userlen);
|
| 779 |
+
int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user,
|
| 780 |
+
int userlen);
|
| 781 |
+
|
| 782 |
+
ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone);
|
| 783 |
+
ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
|
| 784 |
+
ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);
|
| 785 |
+
|
| 786 |
+
DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
|
| 787 |
+
|
| 788 |
+
DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
|
| 789 |
+
|
| 790 |
+
DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
|
| 791 |
+
DECLARE_ASN1_DUP_FUNCTION(GENERAL_NAME)
|
| 792 |
+
int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b);
|
| 793 |
+
|
| 794 |
+
ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
|
| 795 |
+
X509V3_CTX *ctx,
|
| 796 |
+
STACK_OF(CONF_VALUE) *nval);
|
| 797 |
+
STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
|
| 798 |
+
ASN1_BIT_STRING *bits,
|
| 799 |
+
STACK_OF(CONF_VALUE) *extlist);
|
| 800 |
+
char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5);
|
| 801 |
+
ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method,
|
| 802 |
+
X509V3_CTX *ctx, const char *str);
|
| 803 |
+
char *i2s_ASN1_UTF8STRING(X509V3_EXT_METHOD *method, ASN1_UTF8STRING *utf8);
|
| 804 |
+
ASN1_UTF8STRING *s2i_ASN1_UTF8STRING(X509V3_EXT_METHOD *method,
|
| 805 |
+
X509V3_CTX *ctx, const char *str);
|
| 806 |
+
|
| 807 |
+
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
|
| 808 |
+
GENERAL_NAME *gen,
|
| 809 |
+
STACK_OF(CONF_VALUE) *ret);
|
| 810 |
+
int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
|
| 811 |
+
|
| 812 |
+
DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
|
| 813 |
+
|
| 814 |
+
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
|
| 815 |
+
GENERAL_NAMES *gen,
|
| 816 |
+
STACK_OF(CONF_VALUE) *extlist);
|
| 817 |
+
GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
|
| 818 |
+
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
|
| 819 |
+
|
| 820 |
+
DECLARE_ASN1_FUNCTIONS(OTHERNAME)
|
| 821 |
+
DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
|
| 822 |
+
int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);
|
| 823 |
+
void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value);
|
| 824 |
+
void *GENERAL_NAME_get0_value(const GENERAL_NAME *a, int *ptype);
|
| 825 |
+
int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
|
| 826 |
+
ASN1_OBJECT *oid, ASN1_TYPE *value);
|
| 827 |
+
int GENERAL_NAME_get0_otherName(const GENERAL_NAME *gen,
|
| 828 |
+
ASN1_OBJECT **poid, ASN1_TYPE **pvalue);
|
| 829 |
+
|
| 830 |
+
char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
|
| 831 |
+
const ASN1_OCTET_STRING *ia5);
|
| 832 |
+
ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
|
| 833 |
+
X509V3_CTX *ctx, const char *str);
|
| 834 |
+
|
| 835 |
+
DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
|
| 836 |
+
int i2a_ACCESS_DESCRIPTION(BIO *bp, const ACCESS_DESCRIPTION *a);
|
| 837 |
+
|
| 838 |
+
DECLARE_ASN1_ALLOC_FUNCTIONS(TLS_FEATURE)
|
| 839 |
+
|
| 840 |
+
DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
|
| 841 |
+
DECLARE_ASN1_FUNCTIONS(POLICYINFO)
|
| 842 |
+
DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
|
| 843 |
+
DECLARE_ASN1_FUNCTIONS(USERNOTICE)
|
| 844 |
+
DECLARE_ASN1_FUNCTIONS(NOTICEREF)
|
| 845 |
+
|
| 846 |
+
DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
|
| 847 |
+
DECLARE_ASN1_FUNCTIONS(DIST_POINT)
|
| 848 |
+
DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
|
| 849 |
+
DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
|
| 850 |
+
|
| 851 |
+
int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, const X509_NAME *iname);
|
| 852 |
+
|
| 853 |
+
int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);
|
| 854 |
+
int NAME_CONSTRAINTS_check_CN(X509 *x, NAME_CONSTRAINTS *nc);
|
| 855 |
+
|
| 856 |
+
DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
|
| 857 |
+
DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
|
| 858 |
+
|
| 859 |
+
DECLARE_ASN1_ITEM(POLICY_MAPPING)
|
| 860 |
+
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
|
| 861 |
+
DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
|
| 862 |
+
|
| 863 |
+
DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
|
| 864 |
+
DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
|
| 865 |
+
|
| 866 |
+
DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
|
| 867 |
+
DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
|
| 868 |
+
|
| 869 |
+
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
|
| 870 |
+
DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
|
| 871 |
+
|
| 872 |
+
GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
|
| 873 |
+
const X509V3_EXT_METHOD *method,
|
| 874 |
+
X509V3_CTX *ctx, int gen_type,
|
| 875 |
+
const char *value, int is_nc);
|
| 876 |
+
|
| 877 |
+
# ifdef OPENSSL_CONF_H
|
| 878 |
+
GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
|
| 879 |
+
X509V3_CTX *ctx, CONF_VALUE *cnf);
|
| 880 |
+
GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
|
| 881 |
+
const X509V3_EXT_METHOD *method,
|
| 882 |
+
X509V3_CTX *ctx, CONF_VALUE *cnf,
|
| 883 |
+
int is_nc);
|
| 884 |
+
|
| 885 |
+
void X509V3_conf_free(CONF_VALUE *val);
|
| 886 |
+
|
| 887 |
+
X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid,
|
| 888 |
+
const char *value);
|
| 889 |
+
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, const char *name,
|
| 890 |
+
const char *value);
|
| 891 |
+
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, const char *section,
|
| 892 |
+
STACK_OF(X509_EXTENSION) **sk);
|
| 893 |
+
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
| 894 |
+
X509 *cert);
|
| 895 |
+
int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
| 896 |
+
X509_REQ *req);
|
| 897 |
+
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, const char *section,
|
| 898 |
+
X509_CRL *crl);
|
| 899 |
+
|
| 900 |
+
X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
|
| 901 |
+
X509V3_CTX *ctx, int ext_nid,
|
| 902 |
+
const char *value);
|
| 903 |
+
X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
|
| 904 |
+
const char *name, const char *value);
|
| 905 |
+
int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
|
| 906 |
+
const char *section, X509 *cert);
|
| 907 |
+
int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
|
| 908 |
+
const char *section, X509_REQ *req);
|
| 909 |
+
int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
|
| 910 |
+
const char *section, X509_CRL *crl);
|
| 911 |
+
|
| 912 |
+
int X509V3_add_value_bool_nf(const char *name, int asn1_bool,
|
| 913 |
+
STACK_OF(CONF_VALUE) **extlist);
|
| 914 |
+
int X509V3_get_value_bool(const CONF_VALUE *value, int *asn1_bool);
|
| 915 |
+
int X509V3_get_value_int(const CONF_VALUE *value, ASN1_INTEGER **aint);
|
| 916 |
+
void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
|
| 917 |
+
void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash);
|
| 918 |
+
# endif
|
| 919 |
+
|
| 920 |
+
char *X509V3_get_string(X509V3_CTX *ctx, const char *name, const char *section);
|
| 921 |
+
STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, const char *section);
|
| 922 |
+
void X509V3_string_free(X509V3_CTX *ctx, char *str);
|
| 923 |
+
void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
|
| 924 |
+
void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
|
| 925 |
+
X509_REQ *req, X509_CRL *crl, int flags);
|
| 926 |
+
/* For API backward compatibility, this is separate from X509V3_set_ctx(): */
|
| 927 |
+
int X509V3_set_issuer_pkey(X509V3_CTX *ctx, EVP_PKEY *pkey);
|
| 928 |
+
|
| 929 |
+
int X509V3_add_value(const char *name, const char *value,
|
| 930 |
+
STACK_OF(CONF_VALUE) **extlist);
|
| 931 |
+
int X509V3_add_value_uchar(const char *name, const unsigned char *value,
|
| 932 |
+
STACK_OF(CONF_VALUE) **extlist);
|
| 933 |
+
int X509V3_add_value_bool(const char *name, int asn1_bool,
|
| 934 |
+
STACK_OF(CONF_VALUE) **extlist);
|
| 935 |
+
int X509V3_add_value_int(const char *name, const ASN1_INTEGER *aint,
|
| 936 |
+
STACK_OF(CONF_VALUE) **extlist);
|
| 937 |
+
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const ASN1_INTEGER *aint);
|
| 938 |
+
ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, const char *value);
|
| 939 |
+
char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, const ASN1_ENUMERATED *aint);
|
| 940 |
+
char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth,
|
| 941 |
+
const ASN1_ENUMERATED *aint);
|
| 942 |
+
int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
|
| 943 |
+
int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
|
| 944 |
+
int X509V3_EXT_add_alias(int nid_to, int nid_from);
|
| 945 |
+
void X509V3_EXT_cleanup(void);
|
| 946 |
+
|
| 947 |
+
const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
|
| 948 |
+
const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
|
| 949 |
+
int X509V3_add_standard_extensions(void);
|
| 950 |
+
STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
|
| 951 |
+
void *X509V3_EXT_d2i(X509_EXTENSION *ext);
|
| 952 |
+
void *X509V3_get_d2i(const STACK_OF(X509_EXTENSION) *x, int nid, int *crit,
|
| 953 |
+
int *idx);
|
| 954 |
+
|
| 955 |
+
X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
|
| 956 |
+
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,
|
| 957 |
+
int crit, unsigned long flags);
|
| 958 |
+
|
| 959 |
+
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
|
| 960 |
+
/* The new declarations are in crypto.h, but the old ones were here. */
|
| 961 |
+
# define hex_to_string OPENSSL_buf2hexstr
|
| 962 |
+
# define string_to_hex OPENSSL_hexstr2buf
|
| 963 |
+
#endif
|
| 964 |
+
|
| 965 |
+
void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
|
| 966 |
+
int ml);
|
| 967 |
+
int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
|
| 968 |
+
int indent);
|
| 969 |
+
#ifndef OPENSSL_NO_STDIO
|
| 970 |
+
int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
|
| 971 |
+
#endif
|
| 972 |
+
int X509V3_extensions_print(BIO *out, const char *title,
|
| 973 |
+
const STACK_OF(X509_EXTENSION) *exts,
|
| 974 |
+
unsigned long flag, int indent);
|
| 975 |
+
|
| 976 |
+
int X509_check_ca(X509 *x);
|
| 977 |
+
int X509_check_purpose(X509 *x, int id, int ca);
|
| 978 |
+
int X509_supported_extension(X509_EXTENSION *ex);
|
| 979 |
+
int X509_PURPOSE_set(int *p, int purpose);
|
| 980 |
+
int X509_check_issued(X509 *issuer, X509 *subject);
|
| 981 |
+
int X509_check_akid(const X509 *issuer, const AUTHORITY_KEYID *akid);
|
| 982 |
+
void X509_set_proxy_flag(X509 *x);
|
| 983 |
+
void X509_set_proxy_pathlen(X509 *x, long l);
|
| 984 |
+
long X509_get_proxy_pathlen(X509 *x);
|
| 985 |
+
|
| 986 |
+
uint32_t X509_get_extension_flags(X509 *x);
|
| 987 |
+
uint32_t X509_get_key_usage(X509 *x);
|
| 988 |
+
uint32_t X509_get_extended_key_usage(X509 *x);
|
| 989 |
+
const ASN1_OCTET_STRING *X509_get0_subject_key_id(X509 *x);
|
| 990 |
+
const ASN1_OCTET_STRING *X509_get0_authority_key_id(X509 *x);
|
| 991 |
+
const GENERAL_NAMES *X509_get0_authority_issuer(X509 *x);
|
| 992 |
+
const ASN1_INTEGER *X509_get0_authority_serial(X509 *x);
|
| 993 |
+
|
| 994 |
+
int X509_PURPOSE_get_count(void);
|
| 995 |
+
X509_PURPOSE *X509_PURPOSE_get0(int idx);
|
| 996 |
+
int X509_PURPOSE_get_by_sname(const char *sname);
|
| 997 |
+
int X509_PURPOSE_get_by_id(int id);
|
| 998 |
+
int X509_PURPOSE_add(int id, int trust, int flags,
|
| 999 |
+
int (*ck) (const X509_PURPOSE *, const X509 *, int),
|
| 1000 |
+
const char *name, const char *sname, void *arg);
|
| 1001 |
+
char *X509_PURPOSE_get0_name(const X509_PURPOSE *xp);
|
| 1002 |
+
char *X509_PURPOSE_get0_sname(const X509_PURPOSE *xp);
|
| 1003 |
+
int X509_PURPOSE_get_trust(const X509_PURPOSE *xp);
|
| 1004 |
+
void X509_PURPOSE_cleanup(void);
|
| 1005 |
+
int X509_PURPOSE_get_id(const X509_PURPOSE *);
|
| 1006 |
+
|
| 1007 |
+
STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
|
| 1008 |
+
STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);
|
| 1009 |
+
void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
|
| 1010 |
+
STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);
|
| 1011 |
+
/* Flags for X509_check_* functions */
|
| 1012 |
+
|
| 1013 |
+
/*
|
| 1014 |
+
* Always check subject name for host match even if subject alt names present
|
| 1015 |
+
*/
|
| 1016 |
+
# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1
|
| 1017 |
+
/* Disable wildcard matching for dnsName fields and common name. */
|
| 1018 |
+
# define X509_CHECK_FLAG_NO_WILDCARDS 0x2
|
| 1019 |
+
/* Wildcards must not match a partial label. */
|
| 1020 |
+
# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4
|
| 1021 |
+
/* Allow (non-partial) wildcards to match multiple labels. */
|
| 1022 |
+
# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8
|
| 1023 |
+
/* Constraint verifier subdomain patterns to match a single labels. */
|
| 1024 |
+
# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10
|
| 1025 |
+
/* Never check the subject CN */
|
| 1026 |
+
# define X509_CHECK_FLAG_NEVER_CHECK_SUBJECT 0x20
|
| 1027 |
+
/*
|
| 1028 |
+
* Match reference identifiers starting with "." to any sub-domain.
|
| 1029 |
+
* This is a non-public flag, turned on implicitly when the subject
|
| 1030 |
+
* reference identity is a DNS name.
|
| 1031 |
+
*/
|
| 1032 |
+
# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000
|
| 1033 |
+
|
| 1034 |
+
int X509_check_host(X509 *x, const char *chk, size_t chklen,
|
| 1035 |
+
unsigned int flags, char **peername);
|
| 1036 |
+
int X509_check_email(X509 *x, const char *chk, size_t chklen,
|
| 1037 |
+
unsigned int flags);
|
| 1038 |
+
int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen,
|
| 1039 |
+
unsigned int flags);
|
| 1040 |
+
int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags);
|
| 1041 |
+
|
| 1042 |
+
ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
|
| 1043 |
+
ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
|
| 1044 |
+
int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
|
| 1045 |
+
unsigned long chtype);
|
| 1046 |
+
|
| 1047 |
+
void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
|
| 1048 |
+
SKM_DEFINE_STACK_OF_INTERNAL(X509_POLICY_NODE, X509_POLICY_NODE, X509_POLICY_NODE)
|
| 1049 |
+
#define sk_X509_POLICY_NODE_num(sk) OPENSSL_sk_num(ossl_check_const_X509_POLICY_NODE_sk_type(sk))
|
| 1050 |
+
#define sk_X509_POLICY_NODE_value(sk, idx) ((X509_POLICY_NODE *)OPENSSL_sk_value(ossl_check_const_X509_POLICY_NODE_sk_type(sk), (idx)))
|
| 1051 |
+
#define sk_X509_POLICY_NODE_new(cmp) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new(ossl_check_X509_POLICY_NODE_compfunc_type(cmp)))
|
| 1052 |
+
#define sk_X509_POLICY_NODE_new_null() ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_null())
|
| 1053 |
+
#define sk_X509_POLICY_NODE_new_reserve(cmp, n) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_new_reserve(ossl_check_X509_POLICY_NODE_compfunc_type(cmp), (n)))
|
| 1054 |
+
#define sk_X509_POLICY_NODE_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_X509_POLICY_NODE_sk_type(sk), (n))
|
| 1055 |
+
#define sk_X509_POLICY_NODE_free(sk) OPENSSL_sk_free(ossl_check_X509_POLICY_NODE_sk_type(sk))
|
| 1056 |
+
#define sk_X509_POLICY_NODE_zero(sk) OPENSSL_sk_zero(ossl_check_X509_POLICY_NODE_sk_type(sk))
|
| 1057 |
+
#define sk_X509_POLICY_NODE_delete(sk, i) ((X509_POLICY_NODE *)OPENSSL_sk_delete(ossl_check_X509_POLICY_NODE_sk_type(sk), (i)))
|
| 1058 |
+
#define sk_X509_POLICY_NODE_delete_ptr(sk, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_delete_ptr(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr)))
|
| 1059 |
+
#define sk_X509_POLICY_NODE_push(sk, ptr) OPENSSL_sk_push(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))
|
| 1060 |
+
#define sk_X509_POLICY_NODE_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))
|
| 1061 |
+
#define sk_X509_POLICY_NODE_pop(sk) ((X509_POLICY_NODE *)OPENSSL_sk_pop(ossl_check_X509_POLICY_NODE_sk_type(sk)))
|
| 1062 |
+
#define sk_X509_POLICY_NODE_shift(sk) ((X509_POLICY_NODE *)OPENSSL_sk_shift(ossl_check_X509_POLICY_NODE_sk_type(sk)))
|
| 1063 |
+
#define sk_X509_POLICY_NODE_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_X509_POLICY_NODE_sk_type(sk),ossl_check_X509_POLICY_NODE_freefunc_type(freefunc))
|
| 1064 |
+
#define sk_X509_POLICY_NODE_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), (idx))
|
| 1065 |
+
#define sk_X509_POLICY_NODE_set(sk, idx, ptr) ((X509_POLICY_NODE *)OPENSSL_sk_set(ossl_check_X509_POLICY_NODE_sk_type(sk), (idx), ossl_check_X509_POLICY_NODE_type(ptr)))
|
| 1066 |
+
#define sk_X509_POLICY_NODE_find(sk, ptr) OPENSSL_sk_find(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))
|
| 1067 |
+
#define sk_X509_POLICY_NODE_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr))
|
| 1068 |
+
#define sk_X509_POLICY_NODE_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_type(ptr), pnum)
|
| 1069 |
+
#define sk_X509_POLICY_NODE_sort(sk) OPENSSL_sk_sort(ossl_check_X509_POLICY_NODE_sk_type(sk))
|
| 1070 |
+
#define sk_X509_POLICY_NODE_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_X509_POLICY_NODE_sk_type(sk))
|
| 1071 |
+
#define sk_X509_POLICY_NODE_dup(sk) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_dup(ossl_check_const_X509_POLICY_NODE_sk_type(sk)))
|
| 1072 |
+
#define sk_X509_POLICY_NODE_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(X509_POLICY_NODE) *)OPENSSL_sk_deep_copy(ossl_check_const_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_copyfunc_type(copyfunc), ossl_check_X509_POLICY_NODE_freefunc_type(freefunc)))
|
| 1073 |
+
#define sk_X509_POLICY_NODE_set_cmp_func(sk, cmp) ((sk_X509_POLICY_NODE_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_X509_POLICY_NODE_sk_type(sk), ossl_check_X509_POLICY_NODE_compfunc_type(cmp)))
|
| 1074 |
+
|
| 1075 |
+
|
| 1076 |
+
|
| 1077 |
+
#ifndef OPENSSL_NO_RFC3779
|
| 1078 |
+
typedef struct ASRange_st {
|
| 1079 |
+
ASN1_INTEGER *min, *max;
|
| 1080 |
+
} ASRange;
|
| 1081 |
+
|
| 1082 |
+
# define ASIdOrRange_id 0
|
| 1083 |
+
# define ASIdOrRange_range 1
|
| 1084 |
+
|
| 1085 |
+
typedef struct ASIdOrRange_st {
|
| 1086 |
+
int type;
|
| 1087 |
+
union {
|
| 1088 |
+
ASN1_INTEGER *id;
|
| 1089 |
+
ASRange *range;
|
| 1090 |
+
} u;
|
| 1091 |
+
} ASIdOrRange;
|
| 1092 |
+
|
| 1093 |
+
SKM_DEFINE_STACK_OF_INTERNAL(ASIdOrRange, ASIdOrRange, ASIdOrRange)
|
| 1094 |
+
#define sk_ASIdOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_ASIdOrRange_sk_type(sk))
|
| 1095 |
+
#define sk_ASIdOrRange_value(sk, idx) ((ASIdOrRange *)OPENSSL_sk_value(ossl_check_const_ASIdOrRange_sk_type(sk), (idx)))
|
| 1096 |
+
#define sk_ASIdOrRange_new(cmp) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new(ossl_check_ASIdOrRange_compfunc_type(cmp)))
|
| 1097 |
+
#define sk_ASIdOrRange_new_null() ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_null())
|
| 1098 |
+
#define sk_ASIdOrRange_new_reserve(cmp, n) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_new_reserve(ossl_check_ASIdOrRange_compfunc_type(cmp), (n)))
|
| 1099 |
+
#define sk_ASIdOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASIdOrRange_sk_type(sk), (n))
|
| 1100 |
+
#define sk_ASIdOrRange_free(sk) OPENSSL_sk_free(ossl_check_ASIdOrRange_sk_type(sk))
|
| 1101 |
+
#define sk_ASIdOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_ASIdOrRange_sk_type(sk))
|
| 1102 |
+
#define sk_ASIdOrRange_delete(sk, i) ((ASIdOrRange *)OPENSSL_sk_delete(ossl_check_ASIdOrRange_sk_type(sk), (i)))
|
| 1103 |
+
#define sk_ASIdOrRange_delete_ptr(sk, ptr) ((ASIdOrRange *)OPENSSL_sk_delete_ptr(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr)))
|
| 1104 |
+
#define sk_ASIdOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))
|
| 1105 |
+
#define sk_ASIdOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))
|
| 1106 |
+
#define sk_ASIdOrRange_pop(sk) ((ASIdOrRange *)OPENSSL_sk_pop(ossl_check_ASIdOrRange_sk_type(sk)))
|
| 1107 |
+
#define sk_ASIdOrRange_shift(sk) ((ASIdOrRange *)OPENSSL_sk_shift(ossl_check_ASIdOrRange_sk_type(sk)))
|
| 1108 |
+
#define sk_ASIdOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASIdOrRange_sk_type(sk),ossl_check_ASIdOrRange_freefunc_type(freefunc))
|
| 1109 |
+
#define sk_ASIdOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), (idx))
|
| 1110 |
+
#define sk_ASIdOrRange_set(sk, idx, ptr) ((ASIdOrRange *)OPENSSL_sk_set(ossl_check_ASIdOrRange_sk_type(sk), (idx), ossl_check_ASIdOrRange_type(ptr)))
|
| 1111 |
+
#define sk_ASIdOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))
|
| 1112 |
+
#define sk_ASIdOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr))
|
| 1113 |
+
#define sk_ASIdOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_type(ptr), pnum)
|
| 1114 |
+
#define sk_ASIdOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_ASIdOrRange_sk_type(sk))
|
| 1115 |
+
#define sk_ASIdOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASIdOrRange_sk_type(sk))
|
| 1116 |
+
#define sk_ASIdOrRange_dup(sk) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_dup(ossl_check_const_ASIdOrRange_sk_type(sk)))
|
| 1117 |
+
#define sk_ASIdOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASIdOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_copyfunc_type(copyfunc), ossl_check_ASIdOrRange_freefunc_type(freefunc)))
|
| 1118 |
+
#define sk_ASIdOrRange_set_cmp_func(sk, cmp) ((sk_ASIdOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASIdOrRange_sk_type(sk), ossl_check_ASIdOrRange_compfunc_type(cmp)))
|
| 1119 |
+
|
| 1120 |
+
|
| 1121 |
+
typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
|
| 1122 |
+
|
| 1123 |
+
# define ASIdentifierChoice_inherit 0
|
| 1124 |
+
# define ASIdentifierChoice_asIdsOrRanges 1
|
| 1125 |
+
|
| 1126 |
+
typedef struct ASIdentifierChoice_st {
|
| 1127 |
+
int type;
|
| 1128 |
+
union {
|
| 1129 |
+
ASN1_NULL *inherit;
|
| 1130 |
+
ASIdOrRanges *asIdsOrRanges;
|
| 1131 |
+
} u;
|
| 1132 |
+
} ASIdentifierChoice;
|
| 1133 |
+
|
| 1134 |
+
typedef struct ASIdentifiers_st {
|
| 1135 |
+
ASIdentifierChoice *asnum, *rdi;
|
| 1136 |
+
} ASIdentifiers;
|
| 1137 |
+
|
| 1138 |
+
DECLARE_ASN1_FUNCTIONS(ASRange)
|
| 1139 |
+
DECLARE_ASN1_FUNCTIONS(ASIdOrRange)
|
| 1140 |
+
DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)
|
| 1141 |
+
DECLARE_ASN1_FUNCTIONS(ASIdentifiers)
|
| 1142 |
+
|
| 1143 |
+
typedef struct IPAddressRange_st {
|
| 1144 |
+
ASN1_BIT_STRING *min, *max;
|
| 1145 |
+
} IPAddressRange;
|
| 1146 |
+
|
| 1147 |
+
# define IPAddressOrRange_addressPrefix 0
|
| 1148 |
+
# define IPAddressOrRange_addressRange 1
|
| 1149 |
+
|
| 1150 |
+
typedef struct IPAddressOrRange_st {
|
| 1151 |
+
int type;
|
| 1152 |
+
union {
|
| 1153 |
+
ASN1_BIT_STRING *addressPrefix;
|
| 1154 |
+
IPAddressRange *addressRange;
|
| 1155 |
+
} u;
|
| 1156 |
+
} IPAddressOrRange;
|
| 1157 |
+
|
| 1158 |
+
SKM_DEFINE_STACK_OF_INTERNAL(IPAddressOrRange, IPAddressOrRange, IPAddressOrRange)
|
| 1159 |
+
#define sk_IPAddressOrRange_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressOrRange_sk_type(sk))
|
| 1160 |
+
#define sk_IPAddressOrRange_value(sk, idx) ((IPAddressOrRange *)OPENSSL_sk_value(ossl_check_const_IPAddressOrRange_sk_type(sk), (idx)))
|
| 1161 |
+
#define sk_IPAddressOrRange_new(cmp) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new(ossl_check_IPAddressOrRange_compfunc_type(cmp)))
|
| 1162 |
+
#define sk_IPAddressOrRange_new_null() ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_null())
|
| 1163 |
+
#define sk_IPAddressOrRange_new_reserve(cmp, n) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressOrRange_compfunc_type(cmp), (n)))
|
| 1164 |
+
#define sk_IPAddressOrRange_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressOrRange_sk_type(sk), (n))
|
| 1165 |
+
#define sk_IPAddressOrRange_free(sk) OPENSSL_sk_free(ossl_check_IPAddressOrRange_sk_type(sk))
|
| 1166 |
+
#define sk_IPAddressOrRange_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressOrRange_sk_type(sk))
|
| 1167 |
+
#define sk_IPAddressOrRange_delete(sk, i) ((IPAddressOrRange *)OPENSSL_sk_delete(ossl_check_IPAddressOrRange_sk_type(sk), (i)))
|
| 1168 |
+
#define sk_IPAddressOrRange_delete_ptr(sk, ptr) ((IPAddressOrRange *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr)))
|
| 1169 |
+
#define sk_IPAddressOrRange_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))
|
| 1170 |
+
#define sk_IPAddressOrRange_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))
|
| 1171 |
+
#define sk_IPAddressOrRange_pop(sk) ((IPAddressOrRange *)OPENSSL_sk_pop(ossl_check_IPAddressOrRange_sk_type(sk)))
|
| 1172 |
+
#define sk_IPAddressOrRange_shift(sk) ((IPAddressOrRange *)OPENSSL_sk_shift(ossl_check_IPAddressOrRange_sk_type(sk)))
|
| 1173 |
+
#define sk_IPAddressOrRange_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressOrRange_sk_type(sk),ossl_check_IPAddressOrRange_freefunc_type(freefunc))
|
| 1174 |
+
#define sk_IPAddressOrRange_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), (idx))
|
| 1175 |
+
#define sk_IPAddressOrRange_set(sk, idx, ptr) ((IPAddressOrRange *)OPENSSL_sk_set(ossl_check_IPAddressOrRange_sk_type(sk), (idx), ossl_check_IPAddressOrRange_type(ptr)))
|
| 1176 |
+
#define sk_IPAddressOrRange_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))
|
| 1177 |
+
#define sk_IPAddressOrRange_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr))
|
| 1178 |
+
#define sk_IPAddressOrRange_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_type(ptr), pnum)
|
| 1179 |
+
#define sk_IPAddressOrRange_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressOrRange_sk_type(sk))
|
| 1180 |
+
#define sk_IPAddressOrRange_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressOrRange_sk_type(sk))
|
| 1181 |
+
#define sk_IPAddressOrRange_dup(sk) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_dup(ossl_check_const_IPAddressOrRange_sk_type(sk)))
|
| 1182 |
+
#define sk_IPAddressOrRange_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressOrRange) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_copyfunc_type(copyfunc), ossl_check_IPAddressOrRange_freefunc_type(freefunc)))
|
| 1183 |
+
#define sk_IPAddressOrRange_set_cmp_func(sk, cmp) ((sk_IPAddressOrRange_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressOrRange_sk_type(sk), ossl_check_IPAddressOrRange_compfunc_type(cmp)))
|
| 1184 |
+
|
| 1185 |
+
|
| 1186 |
+
typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
|
| 1187 |
+
|
| 1188 |
+
# define IPAddressChoice_inherit 0
|
| 1189 |
+
# define IPAddressChoice_addressesOrRanges 1
|
| 1190 |
+
|
| 1191 |
+
typedef struct IPAddressChoice_st {
|
| 1192 |
+
int type;
|
| 1193 |
+
union {
|
| 1194 |
+
ASN1_NULL *inherit;
|
| 1195 |
+
IPAddressOrRanges *addressesOrRanges;
|
| 1196 |
+
} u;
|
| 1197 |
+
} IPAddressChoice;
|
| 1198 |
+
|
| 1199 |
+
typedef struct IPAddressFamily_st {
|
| 1200 |
+
ASN1_OCTET_STRING *addressFamily;
|
| 1201 |
+
IPAddressChoice *ipAddressChoice;
|
| 1202 |
+
} IPAddressFamily;
|
| 1203 |
+
|
| 1204 |
+
SKM_DEFINE_STACK_OF_INTERNAL(IPAddressFamily, IPAddressFamily, IPAddressFamily)
|
| 1205 |
+
#define sk_IPAddressFamily_num(sk) OPENSSL_sk_num(ossl_check_const_IPAddressFamily_sk_type(sk))
|
| 1206 |
+
#define sk_IPAddressFamily_value(sk, idx) ((IPAddressFamily *)OPENSSL_sk_value(ossl_check_const_IPAddressFamily_sk_type(sk), (idx)))
|
| 1207 |
+
#define sk_IPAddressFamily_new(cmp) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new(ossl_check_IPAddressFamily_compfunc_type(cmp)))
|
| 1208 |
+
#define sk_IPAddressFamily_new_null() ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_null())
|
| 1209 |
+
#define sk_IPAddressFamily_new_reserve(cmp, n) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_new_reserve(ossl_check_IPAddressFamily_compfunc_type(cmp), (n)))
|
| 1210 |
+
#define sk_IPAddressFamily_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_IPAddressFamily_sk_type(sk), (n))
|
| 1211 |
+
#define sk_IPAddressFamily_free(sk) OPENSSL_sk_free(ossl_check_IPAddressFamily_sk_type(sk))
|
| 1212 |
+
#define sk_IPAddressFamily_zero(sk) OPENSSL_sk_zero(ossl_check_IPAddressFamily_sk_type(sk))
|
| 1213 |
+
#define sk_IPAddressFamily_delete(sk, i) ((IPAddressFamily *)OPENSSL_sk_delete(ossl_check_IPAddressFamily_sk_type(sk), (i)))
|
| 1214 |
+
#define sk_IPAddressFamily_delete_ptr(sk, ptr) ((IPAddressFamily *)OPENSSL_sk_delete_ptr(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr)))
|
| 1215 |
+
#define sk_IPAddressFamily_push(sk, ptr) OPENSSL_sk_push(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))
|
| 1216 |
+
#define sk_IPAddressFamily_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))
|
| 1217 |
+
#define sk_IPAddressFamily_pop(sk) ((IPAddressFamily *)OPENSSL_sk_pop(ossl_check_IPAddressFamily_sk_type(sk)))
|
| 1218 |
+
#define sk_IPAddressFamily_shift(sk) ((IPAddressFamily *)OPENSSL_sk_shift(ossl_check_IPAddressFamily_sk_type(sk)))
|
| 1219 |
+
#define sk_IPAddressFamily_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_IPAddressFamily_sk_type(sk),ossl_check_IPAddressFamily_freefunc_type(freefunc))
|
| 1220 |
+
#define sk_IPAddressFamily_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), (idx))
|
| 1221 |
+
#define sk_IPAddressFamily_set(sk, idx, ptr) ((IPAddressFamily *)OPENSSL_sk_set(ossl_check_IPAddressFamily_sk_type(sk), (idx), ossl_check_IPAddressFamily_type(ptr)))
|
| 1222 |
+
#define sk_IPAddressFamily_find(sk, ptr) OPENSSL_sk_find(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))
|
| 1223 |
+
#define sk_IPAddressFamily_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr))
|
| 1224 |
+
#define sk_IPAddressFamily_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_type(ptr), pnum)
|
| 1225 |
+
#define sk_IPAddressFamily_sort(sk) OPENSSL_sk_sort(ossl_check_IPAddressFamily_sk_type(sk))
|
| 1226 |
+
#define sk_IPAddressFamily_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_IPAddressFamily_sk_type(sk))
|
| 1227 |
+
#define sk_IPAddressFamily_dup(sk) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_dup(ossl_check_const_IPAddressFamily_sk_type(sk)))
|
| 1228 |
+
#define sk_IPAddressFamily_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(IPAddressFamily) *)OPENSSL_sk_deep_copy(ossl_check_const_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_copyfunc_type(copyfunc), ossl_check_IPAddressFamily_freefunc_type(freefunc)))
|
| 1229 |
+
#define sk_IPAddressFamily_set_cmp_func(sk, cmp) ((sk_IPAddressFamily_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_IPAddressFamily_sk_type(sk), ossl_check_IPAddressFamily_compfunc_type(cmp)))
|
| 1230 |
+
|
| 1231 |
+
|
| 1232 |
+
|
| 1233 |
+
typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
|
| 1234 |
+
|
| 1235 |
+
DECLARE_ASN1_FUNCTIONS(IPAddressRange)
|
| 1236 |
+
DECLARE_ASN1_FUNCTIONS(IPAddressOrRange)
|
| 1237 |
+
DECLARE_ASN1_FUNCTIONS(IPAddressChoice)
|
| 1238 |
+
DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
|
| 1239 |
+
|
| 1240 |
+
/*
|
| 1241 |
+
* API tag for elements of the ASIdentifer SEQUENCE.
|
| 1242 |
+
*/
|
| 1243 |
+
# define V3_ASID_ASNUM 0
|
| 1244 |
+
# define V3_ASID_RDI 1
|
| 1245 |
+
|
| 1246 |
+
/*
|
| 1247 |
+
* AFI values, assigned by IANA. It'd be nice to make the AFI
|
| 1248 |
+
* handling code totally generic, but there are too many little things
|
| 1249 |
+
* that would need to be defined for other address families for it to
|
| 1250 |
+
* be worth the trouble.
|
| 1251 |
+
*/
|
| 1252 |
+
# define IANA_AFI_IPV4 1
|
| 1253 |
+
# define IANA_AFI_IPV6 2
|
| 1254 |
+
|
| 1255 |
+
/*
|
| 1256 |
+
* Utilities to construct and extract values from RFC3779 extensions,
|
| 1257 |
+
* since some of the encodings (particularly for IP address prefixes
|
| 1258 |
+
* and ranges) are a bit tedious to work with directly.
|
| 1259 |
+
*/
|
| 1260 |
+
int X509v3_asid_add_inherit(ASIdentifiers *asid, int which);
|
| 1261 |
+
int X509v3_asid_add_id_or_range(ASIdentifiers *asid, int which,
|
| 1262 |
+
ASN1_INTEGER *min, ASN1_INTEGER *max);
|
| 1263 |
+
int X509v3_addr_add_inherit(IPAddrBlocks *addr,
|
| 1264 |
+
const unsigned afi, const unsigned *safi);
|
| 1265 |
+
int X509v3_addr_add_prefix(IPAddrBlocks *addr,
|
| 1266 |
+
const unsigned afi, const unsigned *safi,
|
| 1267 |
+
unsigned char *a, const int prefixlen);
|
| 1268 |
+
int X509v3_addr_add_range(IPAddrBlocks *addr,
|
| 1269 |
+
const unsigned afi, const unsigned *safi,
|
| 1270 |
+
unsigned char *min, unsigned char *max);
|
| 1271 |
+
unsigned X509v3_addr_get_afi(const IPAddressFamily *f);
|
| 1272 |
+
int X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
|
| 1273 |
+
unsigned char *min, unsigned char *max,
|
| 1274 |
+
const int length);
|
| 1275 |
+
|
| 1276 |
+
/*
|
| 1277 |
+
* Canonical forms.
|
| 1278 |
+
*/
|
| 1279 |
+
int X509v3_asid_is_canonical(ASIdentifiers *asid);
|
| 1280 |
+
int X509v3_addr_is_canonical(IPAddrBlocks *addr);
|
| 1281 |
+
int X509v3_asid_canonize(ASIdentifiers *asid);
|
| 1282 |
+
int X509v3_addr_canonize(IPAddrBlocks *addr);
|
| 1283 |
+
|
| 1284 |
+
/*
|
| 1285 |
+
* Tests for inheritance and containment.
|
| 1286 |
+
*/
|
| 1287 |
+
int X509v3_asid_inherits(ASIdentifiers *asid);
|
| 1288 |
+
int X509v3_addr_inherits(IPAddrBlocks *addr);
|
| 1289 |
+
int X509v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);
|
| 1290 |
+
int X509v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);
|
| 1291 |
+
|
| 1292 |
+
/*
|
| 1293 |
+
* Check whether RFC 3779 extensions nest properly in chains.
|
| 1294 |
+
*/
|
| 1295 |
+
int X509v3_asid_validate_path(X509_STORE_CTX *);
|
| 1296 |
+
int X509v3_addr_validate_path(X509_STORE_CTX *);
|
| 1297 |
+
int X509v3_asid_validate_resource_set(STACK_OF(X509) *chain,
|
| 1298 |
+
ASIdentifiers *ext,
|
| 1299 |
+
int allow_inheritance);
|
| 1300 |
+
int X509v3_addr_validate_resource_set(STACK_OF(X509) *chain,
|
| 1301 |
+
IPAddrBlocks *ext, int allow_inheritance);
|
| 1302 |
+
|
| 1303 |
+
#endif /* OPENSSL_NO_RFC3779 */
|
| 1304 |
+
|
| 1305 |
+
SKM_DEFINE_STACK_OF_INTERNAL(ASN1_STRING, ASN1_STRING, ASN1_STRING)
|
| 1306 |
+
#define sk_ASN1_STRING_num(sk) OPENSSL_sk_num(ossl_check_const_ASN1_STRING_sk_type(sk))
|
| 1307 |
+
#define sk_ASN1_STRING_value(sk, idx) ((ASN1_STRING *)OPENSSL_sk_value(ossl_check_const_ASN1_STRING_sk_type(sk), (idx)))
|
| 1308 |
+
#define sk_ASN1_STRING_new(cmp) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new(ossl_check_ASN1_STRING_compfunc_type(cmp)))
|
| 1309 |
+
#define sk_ASN1_STRING_new_null() ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_null())
|
| 1310 |
+
#define sk_ASN1_STRING_new_reserve(cmp, n) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_new_reserve(ossl_check_ASN1_STRING_compfunc_type(cmp), (n)))
|
| 1311 |
+
#define sk_ASN1_STRING_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ASN1_STRING_sk_type(sk), (n))
|
| 1312 |
+
#define sk_ASN1_STRING_free(sk) OPENSSL_sk_free(ossl_check_ASN1_STRING_sk_type(sk))
|
| 1313 |
+
#define sk_ASN1_STRING_zero(sk) OPENSSL_sk_zero(ossl_check_ASN1_STRING_sk_type(sk))
|
| 1314 |
+
#define sk_ASN1_STRING_delete(sk, i) ((ASN1_STRING *)OPENSSL_sk_delete(ossl_check_ASN1_STRING_sk_type(sk), (i)))
|
| 1315 |
+
#define sk_ASN1_STRING_delete_ptr(sk, ptr) ((ASN1_STRING *)OPENSSL_sk_delete_ptr(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr)))
|
| 1316 |
+
#define sk_ASN1_STRING_push(sk, ptr) OPENSSL_sk_push(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))
|
| 1317 |
+
#define sk_ASN1_STRING_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))
|
| 1318 |
+
#define sk_ASN1_STRING_pop(sk) ((ASN1_STRING *)OPENSSL_sk_pop(ossl_check_ASN1_STRING_sk_type(sk)))
|
| 1319 |
+
#define sk_ASN1_STRING_shift(sk) ((ASN1_STRING *)OPENSSL_sk_shift(ossl_check_ASN1_STRING_sk_type(sk)))
|
| 1320 |
+
#define sk_ASN1_STRING_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ASN1_STRING_sk_type(sk),ossl_check_ASN1_STRING_freefunc_type(freefunc))
|
| 1321 |
+
#define sk_ASN1_STRING_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), (idx))
|
| 1322 |
+
#define sk_ASN1_STRING_set(sk, idx, ptr) ((ASN1_STRING *)OPENSSL_sk_set(ossl_check_ASN1_STRING_sk_type(sk), (idx), ossl_check_ASN1_STRING_type(ptr)))
|
| 1323 |
+
#define sk_ASN1_STRING_find(sk, ptr) OPENSSL_sk_find(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))
|
| 1324 |
+
#define sk_ASN1_STRING_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr))
|
| 1325 |
+
#define sk_ASN1_STRING_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_type(ptr), pnum)
|
| 1326 |
+
#define sk_ASN1_STRING_sort(sk) OPENSSL_sk_sort(ossl_check_ASN1_STRING_sk_type(sk))
|
| 1327 |
+
#define sk_ASN1_STRING_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ASN1_STRING_sk_type(sk))
|
| 1328 |
+
#define sk_ASN1_STRING_dup(sk) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_dup(ossl_check_const_ASN1_STRING_sk_type(sk)))
|
| 1329 |
+
#define sk_ASN1_STRING_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ASN1_STRING) *)OPENSSL_sk_deep_copy(ossl_check_const_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_copyfunc_type(copyfunc), ossl_check_ASN1_STRING_freefunc_type(freefunc)))
|
| 1330 |
+
#define sk_ASN1_STRING_set_cmp_func(sk, cmp) ((sk_ASN1_STRING_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ASN1_STRING_sk_type(sk), ossl_check_ASN1_STRING_compfunc_type(cmp)))
|
| 1331 |
+
|
| 1332 |
+
|
| 1333 |
+
/*
|
| 1334 |
+
* Admission Syntax
|
| 1335 |
+
*/
|
| 1336 |
+
typedef struct NamingAuthority_st NAMING_AUTHORITY;
|
| 1337 |
+
typedef struct ProfessionInfo_st PROFESSION_INFO;
|
| 1338 |
+
typedef struct Admissions_st ADMISSIONS;
|
| 1339 |
+
typedef struct AdmissionSyntax_st ADMISSION_SYNTAX;
|
| 1340 |
+
DECLARE_ASN1_FUNCTIONS(NAMING_AUTHORITY)
|
| 1341 |
+
DECLARE_ASN1_FUNCTIONS(PROFESSION_INFO)
|
| 1342 |
+
DECLARE_ASN1_FUNCTIONS(ADMISSIONS)
|
| 1343 |
+
DECLARE_ASN1_FUNCTIONS(ADMISSION_SYNTAX)
|
| 1344 |
+
SKM_DEFINE_STACK_OF_INTERNAL(PROFESSION_INFO, PROFESSION_INFO, PROFESSION_INFO)
|
| 1345 |
+
#define sk_PROFESSION_INFO_num(sk) OPENSSL_sk_num(ossl_check_const_PROFESSION_INFO_sk_type(sk))
|
| 1346 |
+
#define sk_PROFESSION_INFO_value(sk, idx) ((PROFESSION_INFO *)OPENSSL_sk_value(ossl_check_const_PROFESSION_INFO_sk_type(sk), (idx)))
|
| 1347 |
+
#define sk_PROFESSION_INFO_new(cmp) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new(ossl_check_PROFESSION_INFO_compfunc_type(cmp)))
|
| 1348 |
+
#define sk_PROFESSION_INFO_new_null() ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_null())
|
| 1349 |
+
#define sk_PROFESSION_INFO_new_reserve(cmp, n) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_new_reserve(ossl_check_PROFESSION_INFO_compfunc_type(cmp), (n)))
|
| 1350 |
+
#define sk_PROFESSION_INFO_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_PROFESSION_INFO_sk_type(sk), (n))
|
| 1351 |
+
#define sk_PROFESSION_INFO_free(sk) OPENSSL_sk_free(ossl_check_PROFESSION_INFO_sk_type(sk))
|
| 1352 |
+
#define sk_PROFESSION_INFO_zero(sk) OPENSSL_sk_zero(ossl_check_PROFESSION_INFO_sk_type(sk))
|
| 1353 |
+
#define sk_PROFESSION_INFO_delete(sk, i) ((PROFESSION_INFO *)OPENSSL_sk_delete(ossl_check_PROFESSION_INFO_sk_type(sk), (i)))
|
| 1354 |
+
#define sk_PROFESSION_INFO_delete_ptr(sk, ptr) ((PROFESSION_INFO *)OPENSSL_sk_delete_ptr(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr)))
|
| 1355 |
+
#define sk_PROFESSION_INFO_push(sk, ptr) OPENSSL_sk_push(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))
|
| 1356 |
+
#define sk_PROFESSION_INFO_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))
|
| 1357 |
+
#define sk_PROFESSION_INFO_pop(sk) ((PROFESSION_INFO *)OPENSSL_sk_pop(ossl_check_PROFESSION_INFO_sk_type(sk)))
|
| 1358 |
+
#define sk_PROFESSION_INFO_shift(sk) ((PROFESSION_INFO *)OPENSSL_sk_shift(ossl_check_PROFESSION_INFO_sk_type(sk)))
|
| 1359 |
+
#define sk_PROFESSION_INFO_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_PROFESSION_INFO_sk_type(sk),ossl_check_PROFESSION_INFO_freefunc_type(freefunc))
|
| 1360 |
+
#define sk_PROFESSION_INFO_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), (idx))
|
| 1361 |
+
#define sk_PROFESSION_INFO_set(sk, idx, ptr) ((PROFESSION_INFO *)OPENSSL_sk_set(ossl_check_PROFESSION_INFO_sk_type(sk), (idx), ossl_check_PROFESSION_INFO_type(ptr)))
|
| 1362 |
+
#define sk_PROFESSION_INFO_find(sk, ptr) OPENSSL_sk_find(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))
|
| 1363 |
+
#define sk_PROFESSION_INFO_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr))
|
| 1364 |
+
#define sk_PROFESSION_INFO_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_type(ptr), pnum)
|
| 1365 |
+
#define sk_PROFESSION_INFO_sort(sk) OPENSSL_sk_sort(ossl_check_PROFESSION_INFO_sk_type(sk))
|
| 1366 |
+
#define sk_PROFESSION_INFO_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_PROFESSION_INFO_sk_type(sk))
|
| 1367 |
+
#define sk_PROFESSION_INFO_dup(sk) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_dup(ossl_check_const_PROFESSION_INFO_sk_type(sk)))
|
| 1368 |
+
#define sk_PROFESSION_INFO_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(PROFESSION_INFO) *)OPENSSL_sk_deep_copy(ossl_check_const_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_copyfunc_type(copyfunc), ossl_check_PROFESSION_INFO_freefunc_type(freefunc)))
|
| 1369 |
+
#define sk_PROFESSION_INFO_set_cmp_func(sk, cmp) ((sk_PROFESSION_INFO_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_PROFESSION_INFO_sk_type(sk), ossl_check_PROFESSION_INFO_compfunc_type(cmp)))
|
| 1370 |
+
SKM_DEFINE_STACK_OF_INTERNAL(ADMISSIONS, ADMISSIONS, ADMISSIONS)
|
| 1371 |
+
#define sk_ADMISSIONS_num(sk) OPENSSL_sk_num(ossl_check_const_ADMISSIONS_sk_type(sk))
|
| 1372 |
+
#define sk_ADMISSIONS_value(sk, idx) ((ADMISSIONS *)OPENSSL_sk_value(ossl_check_const_ADMISSIONS_sk_type(sk), (idx)))
|
| 1373 |
+
#define sk_ADMISSIONS_new(cmp) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new(ossl_check_ADMISSIONS_compfunc_type(cmp)))
|
| 1374 |
+
#define sk_ADMISSIONS_new_null() ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_null())
|
| 1375 |
+
#define sk_ADMISSIONS_new_reserve(cmp, n) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_new_reserve(ossl_check_ADMISSIONS_compfunc_type(cmp), (n)))
|
| 1376 |
+
#define sk_ADMISSIONS_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_ADMISSIONS_sk_type(sk), (n))
|
| 1377 |
+
#define sk_ADMISSIONS_free(sk) OPENSSL_sk_free(ossl_check_ADMISSIONS_sk_type(sk))
|
| 1378 |
+
#define sk_ADMISSIONS_zero(sk) OPENSSL_sk_zero(ossl_check_ADMISSIONS_sk_type(sk))
|
| 1379 |
+
#define sk_ADMISSIONS_delete(sk, i) ((ADMISSIONS *)OPENSSL_sk_delete(ossl_check_ADMISSIONS_sk_type(sk), (i)))
|
| 1380 |
+
#define sk_ADMISSIONS_delete_ptr(sk, ptr) ((ADMISSIONS *)OPENSSL_sk_delete_ptr(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr)))
|
| 1381 |
+
#define sk_ADMISSIONS_push(sk, ptr) OPENSSL_sk_push(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))
|
| 1382 |
+
#define sk_ADMISSIONS_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))
|
| 1383 |
+
#define sk_ADMISSIONS_pop(sk) ((ADMISSIONS *)OPENSSL_sk_pop(ossl_check_ADMISSIONS_sk_type(sk)))
|
| 1384 |
+
#define sk_ADMISSIONS_shift(sk) ((ADMISSIONS *)OPENSSL_sk_shift(ossl_check_ADMISSIONS_sk_type(sk)))
|
| 1385 |
+
#define sk_ADMISSIONS_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_ADMISSIONS_sk_type(sk),ossl_check_ADMISSIONS_freefunc_type(freefunc))
|
| 1386 |
+
#define sk_ADMISSIONS_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), (idx))
|
| 1387 |
+
#define sk_ADMISSIONS_set(sk, idx, ptr) ((ADMISSIONS *)OPENSSL_sk_set(ossl_check_ADMISSIONS_sk_type(sk), (idx), ossl_check_ADMISSIONS_type(ptr)))
|
| 1388 |
+
#define sk_ADMISSIONS_find(sk, ptr) OPENSSL_sk_find(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))
|
| 1389 |
+
#define sk_ADMISSIONS_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr))
|
| 1390 |
+
#define sk_ADMISSIONS_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_type(ptr), pnum)
|
| 1391 |
+
#define sk_ADMISSIONS_sort(sk) OPENSSL_sk_sort(ossl_check_ADMISSIONS_sk_type(sk))
|
| 1392 |
+
#define sk_ADMISSIONS_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_ADMISSIONS_sk_type(sk))
|
| 1393 |
+
#define sk_ADMISSIONS_dup(sk) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_dup(ossl_check_const_ADMISSIONS_sk_type(sk)))
|
| 1394 |
+
#define sk_ADMISSIONS_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(ADMISSIONS) *)OPENSSL_sk_deep_copy(ossl_check_const_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_copyfunc_type(copyfunc), ossl_check_ADMISSIONS_freefunc_type(freefunc)))
|
| 1395 |
+
#define sk_ADMISSIONS_set_cmp_func(sk, cmp) ((sk_ADMISSIONS_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_ADMISSIONS_sk_type(sk), ossl_check_ADMISSIONS_compfunc_type(cmp)))
|
| 1396 |
+
|
| 1397 |
+
typedef STACK_OF(PROFESSION_INFO) PROFESSION_INFOS;
|
| 1398 |
+
|
| 1399 |
+
const ASN1_OBJECT *NAMING_AUTHORITY_get0_authorityId(
|
| 1400 |
+
const NAMING_AUTHORITY *n);
|
| 1401 |
+
const ASN1_IA5STRING *NAMING_AUTHORITY_get0_authorityURL(
|
| 1402 |
+
const NAMING_AUTHORITY *n);
|
| 1403 |
+
const ASN1_STRING *NAMING_AUTHORITY_get0_authorityText(
|
| 1404 |
+
const NAMING_AUTHORITY *n);
|
| 1405 |
+
void NAMING_AUTHORITY_set0_authorityId(NAMING_AUTHORITY *n,
|
| 1406 |
+
ASN1_OBJECT* namingAuthorityId);
|
| 1407 |
+
void NAMING_AUTHORITY_set0_authorityURL(NAMING_AUTHORITY *n,
|
| 1408 |
+
ASN1_IA5STRING* namingAuthorityUrl);
|
| 1409 |
+
void NAMING_AUTHORITY_set0_authorityText(NAMING_AUTHORITY *n,
|
| 1410 |
+
ASN1_STRING* namingAuthorityText);
|
| 1411 |
+
|
| 1412 |
+
const GENERAL_NAME *ADMISSION_SYNTAX_get0_admissionAuthority(
|
| 1413 |
+
const ADMISSION_SYNTAX *as);
|
| 1414 |
+
void ADMISSION_SYNTAX_set0_admissionAuthority(
|
| 1415 |
+
ADMISSION_SYNTAX *as, GENERAL_NAME *aa);
|
| 1416 |
+
const STACK_OF(ADMISSIONS) *ADMISSION_SYNTAX_get0_contentsOfAdmissions(
|
| 1417 |
+
const ADMISSION_SYNTAX *as);
|
| 1418 |
+
void ADMISSION_SYNTAX_set0_contentsOfAdmissions(
|
| 1419 |
+
ADMISSION_SYNTAX *as, STACK_OF(ADMISSIONS) *a);
|
| 1420 |
+
const GENERAL_NAME *ADMISSIONS_get0_admissionAuthority(const ADMISSIONS *a);
|
| 1421 |
+
void ADMISSIONS_set0_admissionAuthority(ADMISSIONS *a, GENERAL_NAME *aa);
|
| 1422 |
+
const NAMING_AUTHORITY *ADMISSIONS_get0_namingAuthority(const ADMISSIONS *a);
|
| 1423 |
+
void ADMISSIONS_set0_namingAuthority(ADMISSIONS *a, NAMING_AUTHORITY *na);
|
| 1424 |
+
const PROFESSION_INFOS *ADMISSIONS_get0_professionInfos(const ADMISSIONS *a);
|
| 1425 |
+
void ADMISSIONS_set0_professionInfos(ADMISSIONS *a, PROFESSION_INFOS *pi);
|
| 1426 |
+
const ASN1_OCTET_STRING *PROFESSION_INFO_get0_addProfessionInfo(
|
| 1427 |
+
const PROFESSION_INFO *pi);
|
| 1428 |
+
void PROFESSION_INFO_set0_addProfessionInfo(
|
| 1429 |
+
PROFESSION_INFO *pi, ASN1_OCTET_STRING *aos);
|
| 1430 |
+
const NAMING_AUTHORITY *PROFESSION_INFO_get0_namingAuthority(
|
| 1431 |
+
const PROFESSION_INFO *pi);
|
| 1432 |
+
void PROFESSION_INFO_set0_namingAuthority(
|
| 1433 |
+
PROFESSION_INFO *pi, NAMING_AUTHORITY *na);
|
| 1434 |
+
const STACK_OF(ASN1_STRING) *PROFESSION_INFO_get0_professionItems(
|
| 1435 |
+
const PROFESSION_INFO *pi);
|
| 1436 |
+
void PROFESSION_INFO_set0_professionItems(
|
| 1437 |
+
PROFESSION_INFO *pi, STACK_OF(ASN1_STRING) *as);
|
| 1438 |
+
const STACK_OF(ASN1_OBJECT) *PROFESSION_INFO_get0_professionOIDs(
|
| 1439 |
+
const PROFESSION_INFO *pi);
|
| 1440 |
+
void PROFESSION_INFO_set0_professionOIDs(
|
| 1441 |
+
PROFESSION_INFO *pi, STACK_OF(ASN1_OBJECT) *po);
|
| 1442 |
+
const ASN1_PRINTABLESTRING *PROFESSION_INFO_get0_registrationNumber(
|
| 1443 |
+
const PROFESSION_INFO *pi);
|
| 1444 |
+
void PROFESSION_INFO_set0_registrationNumber(
|
| 1445 |
+
PROFESSION_INFO *pi, ASN1_PRINTABLESTRING *rn);
|
| 1446 |
+
|
| 1447 |
+
# ifdef __cplusplus
|
| 1448 |
+
}
|
| 1449 |
+
# endif
|
| 1450 |
+
#endif
|
infer_4_37_2/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
| 1 |
+
# 🦩 OpenFlamingo
|
| 2 |
+
|
| 3 |
+
[](https://badge.fury.io/py/open_flamingo)
|
| 4 |
+
|
| 5 |
+
[Blog post](https://laion.ai/blog/open-flamingo/) | Paper (coming soon)
|
| 6 |
+
|
| 7 |
+
Welcome to our open source version of DeepMind's [Flamingo](https://www.deepmind.com/blog/tackling-multiple-tasks-with-a-single-visual-language-model) model! In this repository, we provide a PyTorch implementation for training and evaluating OpenFlamingo models. We also provide an initial [OpenFlamingo 9B model](https://huggingface.co/openflamingo/OpenFlamingo-9B) trained on a new Multimodal C4 dataset (coming soon). Please refer to our blog post for more details.
|
| 8 |
+
|
| 9 |
+
This repo is still under development, and we hope to release better performing and larger OpenFlamingo models soon. If you have any questions, please feel free to open an issue. We also welcome contributions!
|
| 10 |
+
|
| 11 |
+
# Table of Contents
|
| 12 |
+
- [Installation](#installation)
|
| 13 |
+
- [Approach](#approach)
|
| 14 |
+
* [Model architecture](#model-architecture)
|
| 15 |
+
- [Usage](#usage)
|
| 16 |
+
* [Initializing an OpenFlamingo model](#initializing-an-openflamingo-model)
|
| 17 |
+
* [Generating text](#generating-text)
|
| 18 |
+
- [Training](#training)
|
| 19 |
+
* [Dataset](#dataset)
|
| 20 |
+
- [Evaluation](#evaluation)
|
| 21 |
+
- [Future plans](#future-plans)
|
| 22 |
+
- [Team](#team)
|
| 23 |
+
- [Acknowledgments](#acknowledgments)
|
| 24 |
+
- [Citing](#citing)
|
| 25 |
+
|
| 26 |
+
# Installation
|
| 27 |
+
|
| 28 |
+
To install the package in an existing environment, run
|
| 29 |
+
```
|
| 30 |
+
pip install open-flamingo
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
or to create a conda environment for running OpenFlamingo, run
|
| 34 |
+
```
|
| 35 |
+
conda env create -f environment.yml
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
# Usage
|
| 39 |
+
We provide an initial [OpenFlamingo 9B model](https://huggingface.co/openflamingo/OpenFlamingo-9B) using a CLIP ViT-Large vision encoder and a LLaMA-7B language model. In general, we support any [CLIP vision encoder](https://huggingface.co/models?search=clip). For the language model, we support [LLaMA](https://huggingface.co/models?search=llama), [OPT](https://huggingface.co/models?search=opt), [GPT-Neo](https://huggingface.co/models?search=gpt-neo), [GPT-J](https://huggingface.co/models?search=gptj), and [Pythia](https://huggingface.co/models?search=pythia) models.
|
| 40 |
+
|
| 41 |
+
#### NOTE: To use LLaMA models, you will need to install the latest version of transformers via
|
| 42 |
+
```
|
| 43 |
+
pip install git+https://github.com/huggingface/transformers
|
| 44 |
+
```
|
| 45 |
+
Use this [script](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py) for converting LLaMA weights to HuggingFace format.
|
| 46 |
+
|
| 47 |
+
## Initializing an OpenFlamingo model
|
| 48 |
+
``` python
|
| 49 |
+
from open_flamingo import create_model_and_transforms
|
| 50 |
+
|
| 51 |
+
model, image_processor, tokenizer = create_model_and_transforms(
|
| 52 |
+
clip_vision_encoder_path="ViT-L-14",
|
| 53 |
+
clip_vision_encoder_pretrained="openai",
|
| 54 |
+
lang_encoder_path="<path to llama weights in HuggingFace format>",
|
| 55 |
+
tokenizer_path="<path to llama tokenizer in HuggingFace format>",
|
| 56 |
+
cross_attn_every_n_layers=4
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# grab model checkpoint from huggingface hub
|
| 60 |
+
from huggingface_hub import hf_hub_download
|
| 61 |
+
import torch
|
| 62 |
+
|
| 63 |
+
checkpoint_path = hf_hub_download("openflamingo/OpenFlamingo-9B", "checkpoint.pt")
|
| 64 |
+
model.load_state_dict(torch.load(checkpoint_path), strict=False)
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## Generating text
|
| 68 |
+
Here is an example of generating text conditioned on interleaved images/text, in this case we will do few-shot image captioning.
|
| 69 |
+
|
| 70 |
+
``` python
|
| 71 |
+
from PIL import Image
|
| 72 |
+
import requests
|
| 73 |
+
|
| 74 |
+
"""
|
| 75 |
+
Step 1: Load images
|
| 76 |
+
"""
|
| 77 |
+
demo_image_one = Image.open(
|
| 78 |
+
requests.get(
|
| 79 |
+
"http://images.cocodataset.org/val2017/000000039769.jpg", stream=True
|
| 80 |
+
).raw
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
demo_image_two = Image.open(
|
| 84 |
+
requests.get(
|
| 85 |
+
"http://images.cocodataset.org/test-stuff2017/000000028137.jpg",
|
| 86 |
+
stream=True
|
| 87 |
+
).raw
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
query_image = Image.open(
|
| 91 |
+
requests.get(
|
| 92 |
+
"http://images.cocodataset.org/test-stuff2017/000000028352.jpg",
|
| 93 |
+
stream=True
|
| 94 |
+
).raw
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
"""
|
| 99 |
+
Step 2: Preprocessing images
|
| 100 |
+
Details: For OpenFlamingo, we expect the image to be a torch tensor of shape
|
| 101 |
+
batch_size x num_media x num_frames x channels x height x width.
|
| 102 |
+
In this case batch_size = 1, num_media = 3, num_frames = 1
|
| 103 |
+
(this will always be one expect for video which we don't support yet),
|
| 104 |
+
channels = 3, height = 224, width = 224.
|
| 105 |
+
"""
|
| 106 |
+
vision_x = [image_processor(demo_image_one).unsqueeze(0), image_processor(demo_image_two).unsqueeze(0), image_processor(query_image).unsqueeze(0)]
|
| 107 |
+
vision_x = torch.cat(vision_x, dim=0)
|
| 108 |
+
vision_x = vision_x.unsqueeze(1).unsqueeze(0)
|
| 109 |
+
|
| 110 |
+
"""
|
| 111 |
+
Step 3: Preprocessing text
|
| 112 |
+
Details: In the text we expect an <image> special token to indicate where an image is.
|
| 113 |
+
We also expect an <|endofchunk|> special token to indicate the end of the text
|
| 114 |
+
portion associated with an image.
|
| 115 |
+
"""
|
| 116 |
+
tokenizer.padding_side = "left" # For generation padding tokens should be on the left
|
| 117 |
+
lang_x = tokenizer(
|
| 118 |
+
["<image>An image of two cats.<|endofchunk|><image>An image of a bathroom sink.<|endofchunk|><image>An image of"],
|
| 119 |
+
return_tensors="pt",
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
"""
|
| 124 |
+
Step 4: Generate text
|
| 125 |
+
"""
|
| 126 |
+
generated_text = model.generate(
|
| 127 |
+
vision_x=vision_x,
|
| 128 |
+
lang_x=lang_x["input_ids"],
|
| 129 |
+
attention_mask=lang_x["attention_mask"],
|
| 130 |
+
max_new_tokens=20,
|
| 131 |
+
num_beams=3,
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
print("Generated text: ", tokenizer.decode(generated_text[0]))
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
# Approach
|
| 138 |
+
OpenFlamingo is a multimodal language model that can be used for a variety of tasks. It is trained on a large multimodal dataset (e.g. Multimodal C4) and can be used to generate text conditioned on interleaved images/text. For example, OpenFlamingo can be used to generate a caption for an image, or to generate a question given an image and a text passage. The benefit of this approach is that we are able to rapidly adapt to new tasks using in-context training.
|
| 139 |
+
|
| 140 |
+
## Model architecture
|
| 141 |
+
OpenFlamingo seeks to fuse pretrained a vision encoder and a language model using cross attention layers. The model architecture is shown below.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Credit: [Flamingo](https://www.deepmind.com/blog/tackling-multiple-tasks-with-a-single-visual-language-model)
|
| 145 |
+
|
| 146 |
+
# Training
|
| 147 |
+
To train a model, modify the following example command, which uses OPT 1.3B as an example LM:
|
| 148 |
+
```
|
| 149 |
+
torchrun --nnodes=1 --nproc_per_node=4 train.py \
|
| 150 |
+
--run_name flamingo3B \
|
| 151 |
+
--lm_path facebook/opt-1.3b \
|
| 152 |
+
--tokenizer_path facebook/opt-1.3b \
|
| 153 |
+
--dataset_resampled \
|
| 154 |
+
--laion_shards "/path/to/shards/shard-{0000..0999}.tar" \
|
| 155 |
+
--mmc4_shards "/path/to/shards/shard-{0000..0999}.tar" \
|
| 156 |
+
--batch_size_mmc4 4 \
|
| 157 |
+
--batch_size_laion 8 \
|
| 158 |
+
--train_num_samples_mmc4 125000 \
|
| 159 |
+
--train_num_samples_laion 250000 \
|
| 160 |
+
--loss_multiplier_laion 0.2 \
|
| 161 |
+
--workers=6 \
|
| 162 |
+
--num_epochs 250 \
|
| 163 |
+
--lr_scheduler constant \
|
| 164 |
+
--warmup_steps 5000 \
|
| 165 |
+
--use_media_placement_augmentation \
|
| 166 |
+
--mmc4_textsim_threshold 30
|
| 167 |
+
```
|
| 168 |
+
|
| 169 |
+
## Dataset
|
| 170 |
+
We expect all our training datasets to be [WebDataset](https://github.com/webdataset/webdataset) shards.
|
| 171 |
+
We train our models on the [LAION 2B](https://huggingface.co/datasets/laion/laion2B-en) and Multimodal C4 (coming soon) datasets. By default the LAION 2B dataset is in WebDataset format if it is downloaded using the [img2dataset tool](https://github.com/rom1504/img2dataset) and Multimodal C4 comes packaged in the WebDataset format.
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
# Evaluation
|
| 175 |
+
We currently support running evaluations on [COCO](https://cocodataset.org/#home), [VQAv2](https://visualqa.org/index.html), [OKVQA](https://okvqa.allenai.org), [Flickr30k](https://www.kaggle.com/datasets/hsankesara/flickr-image-dataset), and [ImageNet](https://image-net.org/index.php). Note that currently these evaluations are ran in validation mode (as specified in the Flamingo paper). We will be adding support for running evaluations in test mode in the future.
|
| 176 |
+
|
| 177 |
+
Before evaluating the model, you will need to install the coco evaluation package by running the following command:
|
| 178 |
+
```
|
| 179 |
+
pip install pycocoevalcap
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
To run evaluations on OKVQA you will need to run the following command:
|
| 183 |
+
```
|
| 184 |
+
import nltk
|
| 185 |
+
nltk.download('wordnet')
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
To evaluate the model, use script open_flamingo/eval/evaluate.py. For example, to evaluate the model on COCO and VQAv2, run the following command which uses OPT 1.3B as an example LM:
|
| 189 |
+
|
| 190 |
+
```
|
| 191 |
+
python evaluate.py \
|
| 192 |
+
--lm_path facebook/opt-1.3b \
|
| 193 |
+
--lm_tokenizer_path facebook/opt-1.3b \
|
| 194 |
+
--clip_path openai/clip-vit-large-patch14 \
|
| 195 |
+
--checkpoint_path path/to/checkpoint.pt \
|
| 196 |
+
--device 0 \
|
| 197 |
+
--coco_image_dir_path path/to/coco/images \
|
| 198 |
+
--coco_annotations_json_path path/to/coco/captions_train2017.json \
|
| 199 |
+
--vqav2_image_dir_path path/to/vqav2/images \
|
| 200 |
+
--vqav2_annotations_json_path path/to/vqav2/v2_mscoco_train2014_annotations.json \
|
| 201 |
+
--vqav2_questions_json_path path/to/vqav2/v2_OpenEnded_mscoco_train2014_questions.json \
|
| 202 |
+
--eval_coco \
|
| 203 |
+
--eval_vqav2
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
# Future plans
|
| 207 |
+
- [ ] Add support for video input
|
| 208 |
+
- [ ] Release better performing and larger OpenFlamingo models
|
| 209 |
+
- [ ] Expand our evaluation suite
|
| 210 |
+
- [ ] Add support for FSDP training
|
| 211 |
+
|
| 212 |
+
# Team
|
| 213 |
+
|
| 214 |
+
OpenFlamingo is developed by:
|
| 215 |
+
|
| 216 |
+
[Anas Awadalla](https://anas-awadalla.streamlit.app/), [Irena Gao](https://i-gao.github.io/), [Joshua Gardner](https://homes.cs.washington.edu/~jpgard/), [Jack Hessel](https://jmhessel.com/), [Yusuf Hanafy](https://www.linkedin.com/in/yusufhanafy/), [Wanrong Zhu](https://wanrong-zhu.com/), [Kalyani Marathe](https://sites.google.com/uw.edu/kalyanimarathe/home?authuser=0), [Yonatan Bitton](https://yonatanbitton.github.io/), [Samir Gadre](https://sagadre.github.io/), [Jenia Jitsev](https://scholar.google.de/citations?user=p1FuAMkAAAAJ&hl=en), [Simon Kornblith](https://simonster.com/), [Pang Wei Koh](https://koh.pw/), [Gabriel Ilharco](https://gabrielilharco.com/), [Mitchell Wortsman](https://mitchellnw.github.io/), [Ludwig Schmidt](https://people.csail.mit.edu/ludwigs/).
|
| 217 |
+
|
| 218 |
+
The team is primarily from the University of Washington, Stanford, AI2, UCSB, and Google.
|
| 219 |
+
|
| 220 |
+
# Acknowledgments
|
| 221 |
+
This code is based on Lucidrains' [flamingo implementation](https://github.com/lucidrains/flamingo-pytorch) and David Hansmair's [flamingo-mini repo](https://github.com/dhansmair/flamingo-mini). Thank you for making your code public! We also thank the [OpenCLIP](https://github.com/mlfoundations/open_clip) team as we use their data loading code and take inspiration from their library design.
|
| 222 |
+
|
| 223 |
+
We would also like to thank [Jean-Baptiste Alayrac](https://www.jbalayrac.com) and [Antoine Miech](https://antoine77340.github.io) for their advice, [Rohan Taori](https://www.rohantaori.com/), [Nicholas Schiefer](https://nicholasschiefer.com/), [Deep Ganguli](https://hai.stanford.edu/people/deep-ganguli), [Thomas Liao](https://thomasliao.com/), [Tatsunori Hashimoto](https://thashim.github.io/), and [Nicholas Carlini](https://nicholas.carlini.com/) for their help with assessing the safety risks of our release, and to [Stability AI](https://stability.ai) for providing us with compute resources to train these models.
|
| 224 |
+
|
| 225 |
+
# Citing
|
| 226 |
+
If you found this repository useful, please consider citing:
|
| 227 |
+
|
| 228 |
+
```
|
| 229 |
+
@software{anas_awadalla_2023_7733589,
|
| 230 |
+
author = {Awadalla, Anas and Gao, Irena and Gardner, Joshua and Hessel, Jack and Hanafy, Yusuf and Zhu, Wanrong and Marathe, Kalyani and Bitton, Yonatan and Gadre, Samir and Jitsev, Jenia and Kornblith, Simon and Koh, Pang Wei and Ilharco, Gabriel and Wortsman, Mitchell and Schmidt, Ludwig},
|
| 231 |
+
title = {OpenFlamingo},
|
| 232 |
+
month = mar,
|
| 233 |
+
year = 2023,
|
| 234 |
+
publisher = {Zenodo},
|
| 235 |
+
version = {v0.1.1},
|
| 236 |
+
doi = {10.5281/zenodo.7733589},
|
| 237 |
+
url = {https://doi.org/10.5281/zenodo.7733589}
|
| 238 |
+
}
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
```
|
| 242 |
+
@article{Alayrac2022FlamingoAV,
|
| 243 |
+
title={Flamingo: a Visual Language Model for Few-Shot Learning},
|
| 244 |
+
author={Jean-Baptiste Alayrac and Jeff Donahue and Pauline Luc and Antoine Miech and Iain Barr and Yana Hasson and Karel Lenc and Arthur Mensch and Katie Millican and Malcolm Reynolds and Roman Ring and Eliza Rutherford and Serkan Cabi and Tengda Han and Zhitao Gong and Sina Samangooei and Marianne Monteiro and Jacob Menick and Sebastian Borgeaud and Andy Brock and Aida Nematzadeh and Sahand Sharifzadeh and Mikolaj Binkowski and Ricardo Barreira and Oriol Vinyals and Andrew Zisserman and Karen Simonyan},
|
| 245 |
+
journal={ArXiv},
|
| 246 |
+
year={2022},
|
| 247 |
+
volume={abs/2204.14198}
|
| 248 |
+
}
|
| 249 |
+
```
|
infer_4_37_2/bin/2to3-3.10
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/infer_4_37_2/bin/python3.10
|
| 2 |
+
import sys
|
| 3 |
+
from lib2to3.main import main
|
| 4 |
+
|
| 5 |
+
sys.exit(main("lib2to3.fixes"))
|
infer_4_37_2/bin/accelerate-config
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/infer_4_37_2/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.config import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
infer_4_37_2/bin/accelerate-launch
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/root/envs/infer_4_37_2/bin/python
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from accelerate.commands.launch import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
infer_4_37_2/bin/bzip2
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a514cce807cb1656a3bcd59794401e7d63c9554267e9acc77097a406092a8ed
|
| 3 |
+
size 299464
|