ZTWHHH commited on
Commit
697be85
·
verified ·
1 Parent(s): 18900a9

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. evalkit_cambrian/bin/2to3-3.10 +5 -0
  3. evalkit_cambrian/bin/accelerate-config +8 -0
  4. evalkit_cambrian/bin/accelerate-launch +8 -0
  5. evalkit_cambrian/bin/f2py +8 -0
  6. evalkit_cambrian/bin/hjson +8 -0
  7. evalkit_cambrian/bin/huggingface-cli +8 -0
  8. evalkit_cambrian/bin/imageio_download_bin +8 -0
  9. evalkit_cambrian/bin/ipython +8 -0
  10. evalkit_cambrian/bin/isympy +8 -0
  11. evalkit_cambrian/bin/jsonschema +8 -0
  12. evalkit_cambrian/bin/latex2mathml +8 -0
  13. evalkit_cambrian/bin/ncursesw6-config +331 -0
  14. evalkit_cambrian/bin/pip3 +8 -0
  15. evalkit_cambrian/bin/pydoc +5 -0
  16. evalkit_cambrian/bin/pyrsa-keygen +8 -0
  17. evalkit_cambrian/bin/shortuuid +8 -0
  18. evalkit_cambrian/bin/torchrun +8 -0
  19. evalkit_cambrian/bin/tput +0 -0
  20. evalkit_cambrian/bin/tqdm +8 -0
  21. evalkit_cambrian/bin/tset +0 -0
  22. evalkit_cambrian/bin/upload_theme +8 -0
  23. evalkit_cambrian/bin/wandb +8 -0
  24. evalkit_llava/include/lzma/base.h +747 -0
  25. evalkit_llava/include/lzma/block.h +694 -0
  26. evalkit_llava/include/lzma/check.h +163 -0
  27. evalkit_llava/include/lzma/container.h +995 -0
  28. evalkit_llava/include/lzma/hardware.h +62 -0
  29. evalkit_llava/include/lzma/index_hash.h +123 -0
  30. evalkit_llava/include/lzma/lzma12.h +568 -0
  31. evalkit_llava/include/lzma/stream_flags.h +265 -0
  32. evalkit_llava/include/lzma/version.h +134 -0
  33. evalkit_llava/include/lzma/vli.h +166 -0
  34. evalkit_llava/include/ncurses/curses.h +0 -0
  35. evalkit_llava/include/ncurses/cursesm.h +674 -0
  36. evalkit_llava/include/ncurses/cursesp.h +271 -0
  37. evalkit_llava/include/ncurses/cursesw.h +1581 -0
  38. evalkit_llava/include/ncurses/form.h +460 -0
  39. evalkit_llava/include/ncurses/menu.h +281 -0
  40. evalkit_llava/include/ncurses/nc_tparm.h +92 -0
  41. evalkit_llava/include/ncurses/ncurses_dll.h +99 -0
  42. evalkit_llava/include/ncurses/term.h +893 -0
  43. evalkit_llava/include/ncurses/term_entry.h +239 -0
  44. evalkit_llava/include/ncurses/termcap.h +73 -0
  45. evalkit_llava/include/ncursesw/curses.h +0 -0
  46. evalkit_llava/include/ncursesw/cursesapp.h +191 -0
  47. evalkit_llava/include/ncursesw/cursesf.h +968 -0
  48. evalkit_llava/include/ncursesw/cursesm.h +674 -0
  49. evalkit_llava/include/ncursesw/cursesp.h +271 -0
  50. evalkit_llava/include/ncursesw/cursesw.h +1581 -0
.gitattributes CHANGED
@@ -189,3 +189,4 @@ evalkit_llava/lib/liblsan.so.0.0.0 filter=lfs diff=lfs merge=lfs -text
189
  evalkit_llava/lib/libitm.so.1 filter=lfs diff=lfs merge=lfs -text
190
  evalkit_llava/lib/libgomp.so.1 filter=lfs diff=lfs merge=lfs -text
191
  evalkit_llava/bin/sqlite3 filter=lfs diff=lfs merge=lfs -text
 
 
189
  evalkit_llava/lib/libitm.so.1 filter=lfs diff=lfs merge=lfs -text
190
  evalkit_llava/lib/libgomp.so.1 filter=lfs diff=lfs merge=lfs -text
191
  evalkit_llava/bin/sqlite3 filter=lfs diff=lfs merge=lfs -text
192
+ evalkit_llava/lib/python3.10/ensurepip/_bundled/pip-23.0.1-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
evalkit_cambrian/bin/2to3-3.10 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python3.10
2
+ import sys
3
+ from lib2to3.main import main
4
+
5
+ sys.exit(main("lib2to3.fixes"))
evalkit_cambrian/bin/accelerate-config ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/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())
evalkit_cambrian/bin/accelerate-launch ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/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())
evalkit_cambrian/bin/f2py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from numpy.f2py.f2py2e import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/hjson ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from hjson.tool import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/huggingface-cli ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from huggingface_hub.commands.huggingface_cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/imageio_download_bin ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from imageio.__main__ import download_bin_main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(download_bin_main())
evalkit_cambrian/bin/ipython ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from IPython import start_ipython
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(start_ipython())
evalkit_cambrian/bin/isympy ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from isympy import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/jsonschema ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from jsonschema.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/latex2mathml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from latex2mathml.converter import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/ncursesw6-config ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # $Id: ncurses-config.in,v 1.52 2022/07/26 21:36:28 tom Exp $
3
+ ##############################################################################
4
+ # Copyright 2018-2021,2022 Thomas E. Dickey #
5
+ # Copyright 2006-2015,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 "Software"), #
9
+ # to deal in the Software without restriction, including without limitation #
10
+ # the rights to use, copy, modify, merge, publish, distribute, distribute #
11
+ # with modifications, sublicense, and/or sell copies of the Software, and to #
12
+ # permit persons to whom the Software is furnished to do so, subject to the #
13
+ # following conditions: #
14
+ # #
15
+ # The above copyright notice and this permission notice shall be included in #
16
+ # all copies or substantial portions of the Software. #
17
+ # #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL #
21
+ # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING #
23
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER #
24
+ # 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 sale, #
28
+ # use or other dealings in this Software without prior written #
29
+ # authorization. #
30
+ ##############################################################################
31
+ #
32
+ # Author: Thomas E. Dickey, 2006-on
33
+
34
+ LANG=C; export LANG
35
+ LANGUAGE=C; export LANGUAGE
36
+ LC_ALL=C; export LC_ALL
37
+ LC_CTYPE=C; export LC_CTYPE
38
+
39
+ prefix="/root/envs/evalkit_cambrian"
40
+ exec_prefix="${prefix}"
41
+
42
+ bindir="${exec_prefix}/bin"
43
+ includedir="${prefix}/include"
44
+ libdir="${exec_prefix}/lib"
45
+ datarootdir="${prefix}/share"
46
+ datadir="${datarootdir}"
47
+ mandir="${datarootdir}/man"
48
+
49
+ THIS="ncursesw"
50
+ TINFO_LIB="tinfow"
51
+ RPATH_LIST="${libdir}"
52
+
53
+ includesubdir="${prefix}/include/${THIS}"
54
+
55
+ # Ensure that RPATH_LIST contains only absolute pathnames, if it is nonempty.
56
+ # We cannot filter it out within the build-process since the variable is used
57
+ # in some special cases of installation using a relative path.
58
+ if [ -n "$RPATH_LIST" ]
59
+ then
60
+ save_IFS="$IFS"
61
+ IFS=':'
62
+ filtered=
63
+ for item in $RPATH_LIST
64
+ do
65
+ case "$item" in
66
+ ./*|../*|*/..|*/../*)
67
+ ;;
68
+ *)
69
+ [ -n "$filtered" ] && filtered="${filtered}:"
70
+ filtered="${filtered}${item}"
71
+ ;;
72
+ esac
73
+ done
74
+ IFS="$save_IFS"
75
+ # if the result is empty, there is little we can do to fix it
76
+ RPATH_LIST="$filtered"
77
+ fi
78
+
79
+ # with --disable-overwrite, we installed into a subdirectory, but transformed
80
+ # the headers to include like this:
81
+ # <ncursesw/curses.h>
82
+ if [ xno = xno ]; then
83
+ case $includedir in
84
+ $prefix/include/ncursesw)
85
+ includedir=`echo "$includedir" | sed -e 's,/[^/]*$,,'`
86
+ ;;
87
+ esac
88
+ fi
89
+
90
+ LIBS=""
91
+ if [ "tinfo" = "ncurses" ]; then
92
+ LIBS="-l${THIS} $LIBS"
93
+ else
94
+ LIBS="-l${THIS} -l${TINFO_LIB} $LIBS"
95
+ fi
96
+
97
+ # Ignore -L options which do not correspond to an actual directory, or which
98
+ # are standard library directories (i.e., the linker is supposed to search
99
+ # those directories).
100
+ #
101
+ # There is no portable way to find the list of standard library directories.
102
+ # Require a POSIX shell anyway, to keep this simple.
103
+ lib_flags=
104
+ for opt in -L$libdir -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/root/envs/evalkit_cambrian/lib -Wl,-rpath-link,/root/envs/evalkit_cambrian/lib -L/root/envs/evalkit_cambrian/lib $LIBS
105
+ do
106
+ case $opt in
107
+ -specs*) # ignore linker specs-files which were used to build library
108
+ continue
109
+ ;;
110
+ -Wl,-z,*) # ignore flags used to manipulate shared image
111
+ continue
112
+ ;;
113
+ -Wl,--dynamic-linker*) # ignore ELF interpreter
114
+ continue
115
+ ;;
116
+ -Wl,--as-needed|-Wl,--build-id=*|-Wl,-dT,*|-Wl,-T,*)
117
+ continue
118
+ ;;
119
+ -L*)
120
+ lib_check=`echo "x$opt" | sed -e 's/^.-L//'`
121
+ [ -d "$lib_check" ] || continue
122
+ case "$lib_check" in
123
+ /usr/local/lib64|/lib64|/usr/lib64|/usr/local/lib|/lib|/usr/lib) # skip standard libdir
124
+ if [ "$lib_check" = "$libdir" ]
125
+ then
126
+ lib_first=yes
127
+ IFS_save="$IFS"
128
+ IFS='|'
129
+ LIBDIRS="/usr/local/lib64|/lib64|/usr/lib64|/usr/local/lib|/lib|/usr/lib"
130
+ for lib_check in $LIBDIRS
131
+ do
132
+ if [ -d "$lib_check" ]
133
+ then
134
+ if [ "$lib_check" != "$libdir" ]
135
+ then
136
+ lib_first=no
137
+ fi
138
+ break
139
+ fi
140
+ done
141
+ IFS="$IFS_save"
142
+ [ $lib_first = yes ] && continue
143
+ found=no
144
+ for check in $lib_flags
145
+ do
146
+ if [ "x$check" = "x$opt" ]
147
+ then
148
+ found=yes
149
+ break
150
+ fi
151
+ done
152
+ [ $found = yes ] && continue
153
+ :
154
+ else
155
+ continue
156
+ fi
157
+ ;;
158
+ *)
159
+ found=no
160
+ for check in $lib_flags
161
+ do
162
+ if [ "x$check" = "x$opt" ]
163
+ then
164
+ found=yes
165
+ break
166
+ fi
167
+ done
168
+ [ $found = yes ] && continue
169
+ ;;
170
+ esac
171
+ ;;
172
+ esac
173
+ lib_flags="$lib_flags $opt"
174
+ done
175
+
176
+ [ $# = 0 ] && exec /bin/sh "$0" --error
177
+
178
+ while [ $# -gt 0 ]; do
179
+ case "$1" in
180
+ # basic configuration
181
+ --prefix)
182
+ echo "$prefix"
183
+ ;;
184
+ --exec-prefix)
185
+ echo "$exec_prefix"
186
+ ;;
187
+ # compile/link
188
+ --cflags)
189
+ INCS=" -D_GNU_SOURCE -DNCURSES_WIDECHAR"
190
+ if [ "xno" = xno ]; then
191
+ INCS="$INCS -I${includesubdir}"
192
+ fi
193
+ if [ "${includedir}" != /usr/include ]; then
194
+ INCS="$INCS -I${includedir}"
195
+ fi
196
+ sed -e 's,^[ ]*,,' -e 's, [ ]*, ,g' -e 's,[ ]*$,,' <<-ENDECHO
197
+ $INCS
198
+ ENDECHO
199
+ ;;
200
+ --libs)
201
+ OPTS=
202
+ for opt in $lib_flags
203
+ do
204
+ [ -n "$OPTS" ] && OPTS="$OPTS "
205
+ OPTS="${OPTS}${opt}"
206
+ done
207
+ printf '%s\n' "$OPTS"
208
+ ;;
209
+ --libs-only-L)
210
+ OPTS=
211
+ for opt in $lib_flags
212
+ do
213
+ case "x$opt" in
214
+ x-L*)
215
+ [ -n "$OPTS" ] && OPTS="$OPTS "
216
+ OPTS="${OPTS}${opt}"
217
+ ;;
218
+ esac
219
+ done
220
+ printf '%s\n' "$OPTS"
221
+ ;;
222
+ --libs-only-l)
223
+ OPTS=
224
+ for opt in $lib_flags
225
+ do
226
+ case "x$opt" in
227
+ x-l*)
228
+ [ -n "$OPTS" ] && OPTS="$OPTS "
229
+ OPTS="${OPTS}${opt}"
230
+ ;;
231
+ esac
232
+ done
233
+ printf '%s\n' "$OPTS"
234
+ ;;
235
+ --libs-only-other)
236
+ OPTS=
237
+ for opt in $lib_flags
238
+ do
239
+ case "x$opt" in
240
+ x-[lL]*)
241
+ ;;
242
+ *)
243
+ [ -n "$OPTS" ] && OPTS="$OPTS "
244
+ OPTS="${OPTS}${opt}"
245
+ ;;
246
+ esac
247
+ done
248
+ printf '%s\n' "$OPTS"
249
+ ;;
250
+ # identification
251
+ --version)
252
+ echo "6.4.20221231"
253
+ ;;
254
+ --abi-version)
255
+ echo "6"
256
+ ;;
257
+ --mouse-version)
258
+ echo "2"
259
+ ;;
260
+ # locations
261
+ --bindir)
262
+ echo "${bindir}"
263
+ ;;
264
+ --datadir)
265
+ echo "${datadir}"
266
+ ;;
267
+ --includedir)
268
+ INCS=
269
+ if [ "xno" = xno ]; then
270
+ INCS="${includesubdir}"
271
+ elif [ "${includedir}" != /usr/include ]; then
272
+ INCS="${includedir}"
273
+ fi
274
+ echo "$INCS"
275
+ ;;
276
+ --libdir)
277
+ echo "${libdir}"
278
+ ;;
279
+ --mandir)
280
+ echo "${mandir}"
281
+ ;;
282
+ --terminfo)
283
+ echo "/root/envs/evalkit_cambrian/share/terminfo"
284
+ ;;
285
+ --terminfo-dirs)
286
+ echo "/root/envs/evalkit_cambrian/share/terminfo"
287
+ ;;
288
+ --termpath)
289
+ echo "/etc/termcap:/usr/share/misc/termcap"
290
+ ;;
291
+ # general info
292
+ --help)
293
+ cat <<ENDHELP
294
+ Usage: `basename "$0"` [options]
295
+
296
+ Options:
297
+ --prefix echos the package-prefix of ${THIS}
298
+ --exec-prefix echos the executable-prefix of ${THIS}
299
+
300
+ --cflags echos the C compiler flags needed to compile with ${THIS}
301
+ --libs echos the libraries needed to link with ${THIS}
302
+
303
+ --libs-only-L echos -L linker options (search path) for ${THIS}
304
+ --libs-only-l echos -l linker options (libraries) for ${THIS}
305
+ --libs-only-other echos linker options other than -L/-l
306
+
307
+ --version echos the release+patchdate version of ${THIS}
308
+ --abi-version echos the ABI version of ${THIS}
309
+ --mouse-version echos the mouse-interface version of ${THIS}
310
+
311
+ --bindir echos the directory containing ${THIS} programs
312
+ --datadir echos the directory containing ${THIS} data
313
+ --includedir echos the directory containing ${THIS} header files
314
+ --libdir echos the directory containing ${THIS} libraries
315
+ --mandir echos the directory containing ${THIS} manpages
316
+ --terminfo echos the \$TERMINFO terminfo database path
317
+ --terminfo-dirs echos the \$TERMINFO_DIRS directory list
318
+ --termpath echos the \$TERMPATH termcap list
319
+
320
+ --help prints this message
321
+ ENDHELP
322
+ ;;
323
+ --error|*)
324
+ /bin/sh "$0" --help 1>&2
325
+ exit 1
326
+ ;;
327
+ esac
328
+ shift
329
+ done
330
+ # vi:ts=4 sw=4
331
+ # vile:shmode
evalkit_cambrian/bin/pip3 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/pydoc ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python3.10
2
+
3
+ import pydoc
4
+ if __name__ == '__main__':
5
+ pydoc.cli()
evalkit_cambrian/bin/pyrsa-keygen ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import keygen
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(keygen())
evalkit_cambrian/bin/shortuuid ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from shortuuid.cli import cli
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(cli())
evalkit_cambrian/bin/torchrun ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from torch.distributed.run import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/tput ADDED
Binary file (22.5 kB). View file
 
evalkit_cambrian/bin/tqdm ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from tqdm.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/tset ADDED
Binary file (30.7 kB). View file
 
evalkit_cambrian/bin/upload_theme ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from gradio.themes.upload_theme import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
evalkit_cambrian/bin/wandb ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/root/envs/evalkit_cambrian/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from wandb.cli.cli import cli
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(cli())
evalkit_llava/include/lzma/base.h ADDED
@@ -0,0 +1,747 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/base.h
5
+ * \brief Data types and functions used in many places in liblzma API
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 Boolean
20
+ *
21
+ * This is here because C89 doesn't have stdbool.h. To set a value for
22
+ * variables having type lzma_bool, you can use
23
+ * - C99's 'true' and 'false' from stdbool.h;
24
+ * - C++'s internal 'true' and 'false'; or
25
+ * - integers one (true) and zero (false).
26
+ */
27
+ typedef unsigned char lzma_bool;
28
+
29
+
30
+ /**
31
+ * \brief Type of reserved enumeration variable in structures
32
+ *
33
+ * To avoid breaking library ABI when new features are added, several
34
+ * structures contain extra variables that may be used in future. Since
35
+ * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may
36
+ * even vary depending on the range of enumeration constants, we specify
37
+ * a separate type to be used for reserved enumeration variables. All
38
+ * enumeration constants in liblzma API will be non-negative and less
39
+ * than 128, which should guarantee that the ABI won't break even when
40
+ * new constants are added to existing enumerations.
41
+ */
42
+ typedef enum {
43
+ LZMA_RESERVED_ENUM = 0
44
+ } lzma_reserved_enum;
45
+
46
+
47
+ /**
48
+ * \brief Return values used by several functions in liblzma
49
+ *
50
+ * Check the descriptions of specific functions to find out which return
51
+ * values they can return. With some functions the return values may have
52
+ * more specific meanings than described here; those differences are
53
+ * described per-function basis.
54
+ */
55
+ typedef enum {
56
+ LZMA_OK = 0,
57
+ /**<
58
+ * \brief Operation completed successfully
59
+ */
60
+
61
+ LZMA_STREAM_END = 1,
62
+ /**<
63
+ * \brief End of stream was reached
64
+ *
65
+ * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or
66
+ * LZMA_FINISH was finished. In decoder, this indicates
67
+ * that all the data was successfully decoded.
68
+ *
69
+ * In all cases, when LZMA_STREAM_END is returned, the last
70
+ * output bytes should be picked from strm->next_out.
71
+ */
72
+
73
+ LZMA_NO_CHECK = 2,
74
+ /**<
75
+ * \brief Input stream has no integrity check
76
+ *
77
+ * This return value can be returned only if the
78
+ * LZMA_TELL_NO_CHECK flag was used when initializing
79
+ * the decoder. LZMA_NO_CHECK is just a warning, and
80
+ * the decoding can be continued normally.
81
+ *
82
+ * It is possible to call lzma_get_check() immediately after
83
+ * lzma_code has returned LZMA_NO_CHECK. The result will
84
+ * naturally be LZMA_CHECK_NONE, but the possibility to call
85
+ * lzma_get_check() may be convenient in some applications.
86
+ */
87
+
88
+ LZMA_UNSUPPORTED_CHECK = 3,
89
+ /**<
90
+ * \brief Cannot calculate the integrity check
91
+ *
92
+ * The usage of this return value is different in encoders
93
+ * and decoders.
94
+ *
95
+ * Encoders can return this value only from the initialization
96
+ * function. If initialization fails with this value, the
97
+ * encoding cannot be done, because there's no way to produce
98
+ * output with the correct integrity check.
99
+ *
100
+ * Decoders can return this value only from lzma_code() and
101
+ * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when
102
+ * initializing the decoder. The decoding can still be
103
+ * continued normally even if the check type is unsupported,
104
+ * but naturally the check will not be validated, and possible
105
+ * errors may go undetected.
106
+ *
107
+ * With decoder, it is possible to call lzma_get_check()
108
+ * immediately after lzma_code() has returned
109
+ * LZMA_UNSUPPORTED_CHECK. This way it is possible to find
110
+ * out what the unsupported Check ID was.
111
+ */
112
+
113
+ LZMA_GET_CHECK = 4,
114
+ /**<
115
+ * \brief Integrity check type is now available
116
+ *
117
+ * This value can be returned only by the lzma_code() function
118
+ * and only if the decoder was initialized with the
119
+ * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the
120
+ * application that it may now call lzma_get_check() to find
121
+ * out the Check ID. This can be used, for example, to
122
+ * implement a decoder that accepts only files that have
123
+ * strong enough integrity check.
124
+ */
125
+
126
+ LZMA_MEM_ERROR = 5,
127
+ /**<
128
+ * \brief Cannot allocate memory
129
+ *
130
+ * Memory allocation failed, or the size of the allocation
131
+ * would be greater than SIZE_MAX.
132
+ *
133
+ * Due to internal implementation reasons, the coding cannot
134
+ * be continued even if more memory were made available after
135
+ * LZMA_MEM_ERROR.
136
+ */
137
+
138
+ LZMA_MEMLIMIT_ERROR = 6,
139
+ /**<
140
+ * \brief Memory usage limit was reached
141
+ *
142
+ * Decoder would need more memory than allowed by the
143
+ * specified memory usage limit. To continue decoding,
144
+ * the memory usage limit has to be increased with
145
+ * lzma_memlimit_set().
146
+ *
147
+ * liblzma 5.2.6 and earlier had a bug in single-threaded .xz
148
+ * decoder (lzma_stream_decoder()) which made it impossible
149
+ * to continue decoding after LZMA_MEMLIMIT_ERROR even if
150
+ * the limit was increased using lzma_memlimit_set().
151
+ * Other decoders worked correctly.
152
+ */
153
+
154
+ LZMA_FORMAT_ERROR = 7,
155
+ /**<
156
+ * \brief File format not recognized
157
+ *
158
+ * The decoder did not recognize the input as supported file
159
+ * format. This error can occur, for example, when trying to
160
+ * decode .lzma format file with lzma_stream_decoder,
161
+ * because lzma_stream_decoder accepts only the .xz format.
162
+ */
163
+
164
+ LZMA_OPTIONS_ERROR = 8,
165
+ /**<
166
+ * \brief Invalid or unsupported options
167
+ *
168
+ * Invalid or unsupported options, for example
169
+ * - unsupported filter(s) or filter options; or
170
+ * - reserved bits set in headers (decoder only).
171
+ *
172
+ * Rebuilding liblzma with more features enabled, or
173
+ * upgrading to a newer version of liblzma may help.
174
+ */
175
+
176
+ LZMA_DATA_ERROR = 9,
177
+ /**<
178
+ * \brief Data is corrupt
179
+ *
180
+ * The usage of this return value is different in encoders
181
+ * and decoders. In both encoder and decoder, the coding
182
+ * cannot continue after this error.
183
+ *
184
+ * Encoders return this if size limits of the target file
185
+ * format would be exceeded. These limits are huge, thus
186
+ * getting this error from an encoder is mostly theoretical.
187
+ * For example, the maximum compressed and uncompressed
188
+ * size of a .xz Stream is roughly 8 EiB (2^63 bytes).
189
+ *
190
+ * Decoders return this error if the input data is corrupt.
191
+ * This can mean, for example, invalid CRC32 in headers
192
+ * or invalid check of uncompressed data.
193
+ */
194
+
195
+ LZMA_BUF_ERROR = 10,
196
+ /**<
197
+ * \brief No progress is possible
198
+ *
199
+ * This error code is returned when the coder cannot consume
200
+ * any new input and produce any new output. The most common
201
+ * reason for this error is that the input stream being
202
+ * decoded is truncated or corrupt.
203
+ *
204
+ * This error is not fatal. Coding can be continued normally
205
+ * by providing more input and/or more output space, if
206
+ * possible.
207
+ *
208
+ * Typically the first call to lzma_code() that can do no
209
+ * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only
210
+ * the second consecutive call doing no progress will return
211
+ * LZMA_BUF_ERROR. This is intentional.
212
+ *
213
+ * With zlib, Z_BUF_ERROR may be returned even if the
214
+ * application is doing nothing wrong, so apps will need
215
+ * to handle Z_BUF_ERROR specially. The above hack
216
+ * guarantees that liblzma never returns LZMA_BUF_ERROR
217
+ * to properly written applications unless the input file
218
+ * is truncated or corrupt. This should simplify the
219
+ * applications a little.
220
+ */
221
+
222
+ LZMA_PROG_ERROR = 11,
223
+ /**<
224
+ * \brief Programming error
225
+ *
226
+ * This indicates that the arguments given to the function are
227
+ * invalid or the internal state of the decoder is corrupt.
228
+ * - Function arguments are invalid or the structures
229
+ * pointed by the argument pointers are invalid
230
+ * e.g. if strm->next_out has been set to NULL and
231
+ * strm->avail_out > 0 when calling lzma_code().
232
+ * - lzma_* functions have been called in wrong order
233
+ * e.g. lzma_code() was called right after lzma_end().
234
+ * - If errors occur randomly, the reason might be flaky
235
+ * hardware.
236
+ *
237
+ * If you think that your code is correct, this error code
238
+ * can be a sign of a bug in liblzma. See the documentation
239
+ * how to report bugs.
240
+ */
241
+
242
+ LZMA_SEEK_NEEDED = 12,
243
+ /**<
244
+ * \brief Request to change the input file position
245
+ *
246
+ * Some coders can do random access in the input file. The
247
+ * initialization functions of these coders take the file size
248
+ * as an argument. No other coders can return LZMA_SEEK_NEEDED.
249
+ *
250
+ * When this value is returned, the application must seek to
251
+ * the file position given in lzma_stream.seek_pos. This value
252
+ * is guaranteed to never exceed the file size that was
253
+ * specified at the coder initialization.
254
+ *
255
+ * After seeking the application should read new input and
256
+ * pass it normally via lzma_stream.next_in and .avail_in.
257
+ */
258
+
259
+ /*
260
+ * These enumerations may be used internally by liblzma
261
+ * but they will never be returned to applications.
262
+ */
263
+ LZMA_RET_INTERNAL1 = 101,
264
+ LZMA_RET_INTERNAL2 = 102,
265
+ LZMA_RET_INTERNAL3 = 103,
266
+ LZMA_RET_INTERNAL4 = 104,
267
+ LZMA_RET_INTERNAL5 = 105,
268
+ LZMA_RET_INTERNAL6 = 106,
269
+ LZMA_RET_INTERNAL7 = 107,
270
+ LZMA_RET_INTERNAL8 = 108
271
+ } lzma_ret;
272
+
273
+
274
+ /**
275
+ * \brief The 'action' argument for lzma_code()
276
+ *
277
+ * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
278
+ * or LZMA_FINISH, the same 'action' must be used until lzma_code() returns
279
+ * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
280
+ * not be modified by the application until lzma_code() returns
281
+ * LZMA_STREAM_END. Changing the 'action' or modifying the amount of input
282
+ * will make lzma_code() return LZMA_PROG_ERROR.
283
+ */
284
+ typedef enum {
285
+ LZMA_RUN = 0,
286
+ /**<
287
+ * \brief Continue coding
288
+ *
289
+ * Encoder: Encode as much input as possible. Some internal
290
+ * buffering will probably be done (depends on the filter
291
+ * chain in use), which causes latency: the input used won't
292
+ * usually be decodeable from the output of the same
293
+ * lzma_code() call.
294
+ *
295
+ * Decoder: Decode as much input as possible and produce as
296
+ * much output as possible.
297
+ */
298
+
299
+ LZMA_SYNC_FLUSH = 1,
300
+ /**<
301
+ * \brief Make all the input available at output
302
+ *
303
+ * Normally the encoder introduces some latency.
304
+ * LZMA_SYNC_FLUSH forces all the buffered data to be
305
+ * available at output without resetting the internal
306
+ * state of the encoder. This way it is possible to use
307
+ * compressed stream for example for communication over
308
+ * network.
309
+ *
310
+ * Only some filters support LZMA_SYNC_FLUSH. Trying to use
311
+ * LZMA_SYNC_FLUSH with filters that don't support it will
312
+ * make lzma_code() return LZMA_OPTIONS_ERROR. For example,
313
+ * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.
314
+ *
315
+ * Using LZMA_SYNC_FLUSH very often can dramatically reduce
316
+ * the compression ratio. With some filters (for example,
317
+ * LZMA2), fine-tuning the compression options may help
318
+ * mitigate this problem significantly (for example,
319
+ * match finder with LZMA2).
320
+ *
321
+ * Decoders don't support LZMA_SYNC_FLUSH.
322
+ */
323
+
324
+ LZMA_FULL_FLUSH = 2,
325
+ /**<
326
+ * \brief Finish encoding of the current Block
327
+ *
328
+ * All the input data going to the current Block must have
329
+ * been given to the encoder (the last bytes can still be
330
+ * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
331
+ * until it returns LZMA_STREAM_END. Then continue normally
332
+ * with LZMA_RUN or finish the Stream with LZMA_FINISH.
333
+ *
334
+ * This action is currently supported only by Stream encoder
335
+ * and easy encoder (which uses Stream encoder). If there is
336
+ * no unfinished Block, no empty Block is created.
337
+ */
338
+
339
+ LZMA_FULL_BARRIER = 4,
340
+ /**<
341
+ * \brief Finish encoding of the current Block
342
+ *
343
+ * This is like LZMA_FULL_FLUSH except that this doesn't
344
+ * necessarily wait until all the input has been made
345
+ * available via the output buffer. That is, lzma_code()
346
+ * might return LZMA_STREAM_END as soon as all the input
347
+ * has been consumed (avail_in == 0).
348
+ *
349
+ * LZMA_FULL_BARRIER is useful with a threaded encoder if
350
+ * one wants to split the .xz Stream into Blocks at specific
351
+ * offsets but doesn't care if the output isn't flushed
352
+ * immediately. Using LZMA_FULL_BARRIER allows keeping
353
+ * the threads busy while LZMA_FULL_FLUSH would make
354
+ * lzma_code() wait until all the threads have finished
355
+ * until more data could be passed to the encoder.
356
+ *
357
+ * With a lzma_stream initialized with the single-threaded
358
+ * lzma_stream_encoder() or lzma_easy_encoder(),
359
+ * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
360
+ */
361
+
362
+ LZMA_FINISH = 3
363
+ /**<
364
+ * \brief Finish the coding operation
365
+ *
366
+ * All the input data must have been given to the encoder
367
+ * (the last bytes can still be pending in next_in).
368
+ * Call lzma_code() with LZMA_FINISH until it returns
369
+ * LZMA_STREAM_END. Once LZMA_FINISH has been used,
370
+ * the amount of input must no longer be changed by
371
+ * the application.
372
+ *
373
+ * When decoding, using LZMA_FINISH is optional unless the
374
+ * LZMA_CONCATENATED flag was used when the decoder was
375
+ * initialized. When LZMA_CONCATENATED was not used, the only
376
+ * effect of LZMA_FINISH is that the amount of input must not
377
+ * be changed just like in the encoder.
378
+ */
379
+ } lzma_action;
380
+
381
+
382
+ /**
383
+ * \brief Custom functions for memory handling
384
+ *
385
+ * A pointer to lzma_allocator may be passed via lzma_stream structure
386
+ * to liblzma, and some advanced functions take a pointer to lzma_allocator
387
+ * as a separate function argument. The library will use the functions
388
+ * specified in lzma_allocator for memory handling instead of the default
389
+ * malloc() and free(). C++ users should note that the custom memory
390
+ * handling functions must not throw exceptions.
391
+ *
392
+ * Single-threaded mode only: liblzma doesn't make an internal copy of
393
+ * lzma_allocator. Thus, it is OK to change these function pointers in
394
+ * the middle of the coding process, but obviously it must be done
395
+ * carefully to make sure that the replacement 'free' can deallocate
396
+ * memory allocated by the earlier 'alloc' function(s).
397
+ *
398
+ * Multithreaded mode: liblzma might internally store pointers to the
399
+ * lzma_allocator given via the lzma_stream structure. The application
400
+ * must not change the allocator pointer in lzma_stream or the contents
401
+ * of the pointed lzma_allocator structure until lzma_end() has been used
402
+ * to free the memory associated with that lzma_stream. The allocation
403
+ * functions might be called simultaneously from multiple threads, and
404
+ * thus they must be thread safe.
405
+ */
406
+ typedef struct {
407
+ /**
408
+ * \brief Pointer to a custom memory allocation function
409
+ *
410
+ * If you don't want a custom allocator, but still want
411
+ * custom free(), set this to NULL and liblzma will use
412
+ * the standard malloc().
413
+ *
414
+ * \param opaque lzma_allocator.opaque (see below)
415
+ * \param nmemb Number of elements like in calloc(). liblzma
416
+ * will always set nmemb to 1, so it is safe to
417
+ * ignore nmemb in a custom allocator if you like.
418
+ * The nmemb argument exists only for
419
+ * compatibility with zlib and libbzip2.
420
+ * \param size Size of an element in bytes.
421
+ * liblzma never sets this to zero.
422
+ *
423
+ * \return Pointer to the beginning of a memory block of
424
+ * 'size' bytes, or NULL if allocation fails
425
+ * for some reason. When allocation fails, functions
426
+ * of liblzma return LZMA_MEM_ERROR.
427
+ *
428
+ * The allocator should not waste time zeroing the allocated buffers.
429
+ * This is not only about speed, but also memory usage, since the
430
+ * operating system kernel doesn't necessarily allocate the requested
431
+ * memory in physical memory until it is actually used. With small
432
+ * input files, liblzma may actually need only a fraction of the
433
+ * memory that it requested for allocation.
434
+ *
435
+ * \note LZMA_MEM_ERROR is also used when the size of the
436
+ * allocation would be greater than SIZE_MAX. Thus,
437
+ * don't assume that the custom allocator must have
438
+ * returned NULL if some function from liblzma
439
+ * returns LZMA_MEM_ERROR.
440
+ */
441
+ void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);
442
+
443
+ /**
444
+ * \brief Pointer to a custom memory freeing function
445
+ *
446
+ * If you don't want a custom freeing function, but still
447
+ * want a custom allocator, set this to NULL and liblzma
448
+ * will use the standard free().
449
+ *
450
+ * \param opaque lzma_allocator.opaque (see below)
451
+ * \param ptr Pointer returned by lzma_allocator.alloc(),
452
+ * or when it is set to NULL, a pointer returned
453
+ * by the standard malloc().
454
+ */
455
+ void (LZMA_API_CALL *free)(void *opaque, void *ptr);
456
+
457
+ /**
458
+ * \brief Pointer passed to .alloc() and .free()
459
+ *
460
+ * opaque is passed as the first argument to lzma_allocator.alloc()
461
+ * and lzma_allocator.free(). This intended to ease implementing
462
+ * custom memory allocation functions for use with liblzma.
463
+ *
464
+ * If you don't need this, you should set this to NULL.
465
+ */
466
+ void *opaque;
467
+
468
+ } lzma_allocator;
469
+
470
+
471
+ /**
472
+ * \brief Internal data structure
473
+ *
474
+ * The contents of this structure is not visible outside the library.
475
+ */
476
+ typedef struct lzma_internal_s lzma_internal;
477
+
478
+
479
+ /**
480
+ * \brief Passing data to and from liblzma
481
+ *
482
+ * The lzma_stream structure is used for
483
+ * - passing pointers to input and output buffers to liblzma;
484
+ * - defining custom memory handler functions; and
485
+ * - holding a pointer to coder-specific internal data structures.
486
+ *
487
+ * Typical usage:
488
+ *
489
+ * - After allocating lzma_stream (on stack or with malloc()), it must be
490
+ * initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
491
+ *
492
+ * - Initialize a coder to the lzma_stream, for example by using
493
+ * lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
494
+ * - In contrast to zlib, strm->next_in and strm->next_out are
495
+ * ignored by all initialization functions, thus it is safe
496
+ * to not initialize them yet.
497
+ * - The initialization functions always set strm->total_in and
498
+ * strm->total_out to zero.
499
+ * - If the initialization function fails, no memory is left allocated
500
+ * that would require freeing with lzma_end() even if some memory was
501
+ * associated with the lzma_stream structure when the initialization
502
+ * function was called.
503
+ *
504
+ * - Use lzma_code() to do the actual work.
505
+ *
506
+ * - Once the coding has been finished, the existing lzma_stream can be
507
+ * reused. It is OK to reuse lzma_stream with different initialization
508
+ * function without calling lzma_end() first. Old allocations are
509
+ * automatically freed.
510
+ *
511
+ * - Finally, use lzma_end() to free the allocated memory. lzma_end() never
512
+ * frees the lzma_stream structure itself.
513
+ *
514
+ * Application may modify the values of total_in and total_out as it wants.
515
+ * They are updated by liblzma to match the amount of data read and
516
+ * written but aren't used for anything else except as a possible return
517
+ * values from lzma_get_progress().
518
+ */
519
+ typedef struct {
520
+ const uint8_t *next_in; /**< Pointer to the next input byte. */
521
+ size_t avail_in; /**< Number of available input bytes in next_in. */
522
+ uint64_t total_in; /**< Total number of bytes read by liblzma. */
523
+
524
+ uint8_t *next_out; /**< Pointer to the next output position. */
525
+ size_t avail_out; /**< Amount of free space in next_out. */
526
+ uint64_t total_out; /**< Total number of bytes written by liblzma. */
527
+
528
+ /**
529
+ * \brief Custom memory allocation functions
530
+ *
531
+ * In most cases this is NULL which makes liblzma use
532
+ * the standard malloc() and free().
533
+ *
534
+ * \note In 5.0.x this is not a const pointer.
535
+ */
536
+ const lzma_allocator *allocator;
537
+
538
+ /** Internal state is not visible to applications. */
539
+ lzma_internal *internal;
540
+
541
+ /*
542
+ * Reserved space to allow possible future extensions without
543
+ * breaking the ABI. Excluding the initialization of this structure,
544
+ * you should not touch these, because the names of these variables
545
+ * may change.
546
+ */
547
+
548
+ /** \private Reserved member. */
549
+ void *reserved_ptr1;
550
+
551
+ /** \private Reserved member. */
552
+ void *reserved_ptr2;
553
+
554
+ /** \private Reserved member. */
555
+ void *reserved_ptr3;
556
+
557
+ /** \private Reserved member. */
558
+ void *reserved_ptr4;
559
+
560
+ /**
561
+ * \brief New seek input position for LZMA_SEEK_NEEDED
562
+ *
563
+ * When lzma_code() returns LZMA_SEEK_NEEDED, the new input position
564
+ * needed by liblzma will be available seek_pos. The value is
565
+ * guaranteed to not exceed the file size that was specified when
566
+ * this lzma_stream was initialized.
567
+ *
568
+ * In all other situations the value of this variable is undefined.
569
+ */
570
+ uint64_t seek_pos;
571
+
572
+ /** \private Reserved member. */
573
+ uint64_t reserved_int2;
574
+
575
+ /** \private Reserved member. */
576
+ size_t reserved_int3;
577
+
578
+ /** \private Reserved member. */
579
+ size_t reserved_int4;
580
+
581
+ /** \private Reserved member. */
582
+ lzma_reserved_enum reserved_enum1;
583
+
584
+ /** \private Reserved member. */
585
+ lzma_reserved_enum reserved_enum2;
586
+
587
+ } lzma_stream;
588
+
589
+
590
+ /**
591
+ * \brief Initialization for lzma_stream
592
+ *
593
+ * When you declare an instance of lzma_stream, you can immediately
594
+ * initialize it so that initialization functions know that no memory
595
+ * has been allocated yet:
596
+ *
597
+ * lzma_stream strm = LZMA_STREAM_INIT;
598
+ *
599
+ * If you need to initialize a dynamically allocated lzma_stream, you can use
600
+ * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this
601
+ * violates the C standard since NULL may have different internal
602
+ * representation than zero, but it should be portable enough in practice.
603
+ * Anyway, for maximum portability, you can use something like this:
604
+ *
605
+ * lzma_stream tmp = LZMA_STREAM_INIT;
606
+ * *strm = tmp;
607
+ */
608
+ #define LZMA_STREAM_INIT \
609
+ { NULL, 0, 0, NULL, 0, 0, NULL, NULL, \
610
+ NULL, NULL, NULL, NULL, 0, 0, 0, 0, \
611
+ LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }
612
+
613
+
614
+ /**
615
+ * \brief Encode or decode data
616
+ *
617
+ * Once the lzma_stream has been successfully initialized (e.g. with
618
+ * lzma_stream_encoder()), the actual encoding or decoding is done
619
+ * using this function. The application has to update strm->next_in,
620
+ * strm->avail_in, strm->next_out, and strm->avail_out to pass input
621
+ * to and get output from liblzma.
622
+ *
623
+ * See the description of the coder-specific initialization function to find
624
+ * out what 'action' values are supported by the coder.
625
+ *
626
+ * \param strm Pointer to lzma_stream that is at least initialized
627
+ * with LZMA_STREAM_INIT.
628
+ * \param action Action for this function to take. Must be a valid
629
+ * lzma_action enum value.
630
+ *
631
+ * \return Any valid lzma_ret. See the lzma_ret enum description for more
632
+ * information.
633
+ */
634
+ extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)
635
+ lzma_nothrow lzma_attr_warn_unused_result;
636
+
637
+
638
+ /**
639
+ * \brief Free memory allocated for the coder data structures
640
+ *
641
+ * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other
642
+ * members of the lzma_stream structure are touched.
643
+ *
644
+ * \note zlib indicates an error if application end()s unfinished
645
+ * stream structure. liblzma doesn't do this, and assumes that
646
+ * application knows what it is doing.
647
+ *
648
+ * \param strm Pointer to lzma_stream that is at least initialized
649
+ * with LZMA_STREAM_INIT.
650
+ */
651
+ extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;
652
+
653
+
654
+ /**
655
+ * \brief Get progress information
656
+ *
657
+ * In single-threaded mode, applications can get progress information from
658
+ * strm->total_in and strm->total_out. In multi-threaded mode this is less
659
+ * useful because a significant amount of both input and output data gets
660
+ * buffered internally by liblzma. This makes total_in and total_out give
661
+ * misleading information and also makes the progress indicator updates
662
+ * non-smooth.
663
+ *
664
+ * This function gives realistic progress information also in multi-threaded
665
+ * mode by taking into account the progress made by each thread. In
666
+ * single-threaded mode *progress_in and *progress_out are set to
667
+ * strm->total_in and strm->total_out, respectively.
668
+ *
669
+ * \param strm Pointer to lzma_stream that is at least
670
+ * initialized with LZMA_STREAM_INIT.
671
+ * \param[out] progress_in Pointer to the number of input bytes processed.
672
+ * \param[out] progress_out Pointer to the number of output bytes processed.
673
+ */
674
+ extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
675
+ uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;
676
+
677
+
678
+ /**
679
+ * \brief Get the memory usage of decoder filter chain
680
+ *
681
+ * This function is currently supported only when *strm has been initialized
682
+ * with a function that takes a memlimit argument. With other functions, you
683
+ * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()
684
+ * to estimate the memory requirements.
685
+ *
686
+ * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big
687
+ * the memory usage limit should have been to decode the input. Note that
688
+ * this may give misleading information if decoding .xz Streams that have
689
+ * multiple Blocks, because each Block can have different memory requirements.
690
+ *
691
+ * \param strm Pointer to lzma_stream that is at least initialized
692
+ * with LZMA_STREAM_INIT.
693
+ *
694
+ * \return How much memory is currently allocated for the filter
695
+ * decoders. If no filter chain is currently allocated,
696
+ * some non-zero value is still returned, which is less than
697
+ * or equal to what any filter chain would indicate as its
698
+ * memory requirement.
699
+ *
700
+ * If this function isn't supported by *strm or some other error
701
+ * occurs, zero is returned.
702
+ */
703
+ extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm)
704
+ lzma_nothrow lzma_attr_pure;
705
+
706
+
707
+ /**
708
+ * \brief Get the current memory usage limit
709
+ *
710
+ * This function is supported only when *strm has been initialized with
711
+ * a function that takes a memlimit argument.
712
+ *
713
+ * \param strm Pointer to lzma_stream that is at least initialized
714
+ * with LZMA_STREAM_INIT.
715
+ *
716
+ * \return On success, the current memory usage limit is returned
717
+ * (always non-zero). On error, zero is returned.
718
+ */
719
+ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
720
+ lzma_nothrow lzma_attr_pure;
721
+
722
+
723
+ /**
724
+ * \brief Set the memory usage limit
725
+ *
726
+ * This function is supported only when *strm has been initialized with
727
+ * a function that takes a memlimit argument.
728
+ *
729
+ * liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
730
+ * this function to do nothing (leaving the limit unchanged) and still
731
+ * return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
732
+ * lzma_memlimit_get() will return 1 even if you specify 0 here).
733
+ *
734
+ * liblzma 5.2.6 and earlier had a bug in single-threaded .xz decoder
735
+ * (lzma_stream_decoder()) which made it impossible to continue decoding
736
+ * after LZMA_MEMLIMIT_ERROR even if the limit was increased using
737
+ * lzma_memlimit_set(). Other decoders worked correctly.
738
+ *
739
+ * \return Possible lzma_ret values:
740
+ * - LZMA_OK: New memory usage limit successfully set.
741
+ * - LZMA_MEMLIMIT_ERROR: The new limit is too small.
742
+ * The limit was not changed.
743
+ * - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
744
+ * support memory usage limit.
745
+ */
746
+ extern LZMA_API(lzma_ret) lzma_memlimit_set(
747
+ lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
evalkit_llava/include/lzma/block.h ADDED
@@ -0,0 +1,694 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \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;
evalkit_llava/include/lzma/check.h ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/check.h
5
+ * \brief Integrity checks
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 Type of the integrity check (Check ID)
20
+ *
21
+ * The .xz format supports multiple types of checks that are calculated
22
+ * from the uncompressed data. They vary in both speed and ability to
23
+ * detect errors.
24
+ */
25
+ typedef enum {
26
+ LZMA_CHECK_NONE = 0,
27
+ /**<
28
+ * No Check is calculated.
29
+ *
30
+ * Size of the Check field: 0 bytes
31
+ */
32
+
33
+ LZMA_CHECK_CRC32 = 1,
34
+ /**<
35
+ * CRC32 using the polynomial from the IEEE 802.3 standard
36
+ *
37
+ * Size of the Check field: 4 bytes
38
+ */
39
+
40
+ LZMA_CHECK_CRC64 = 4,
41
+ /**<
42
+ * CRC64 using the polynomial from the ECMA-182 standard
43
+ *
44
+ * Size of the Check field: 8 bytes
45
+ */
46
+
47
+ LZMA_CHECK_SHA256 = 10
48
+ /**<
49
+ * SHA-256
50
+ *
51
+ * Size of the Check field: 32 bytes
52
+ */
53
+ } lzma_check;
54
+
55
+
56
+ /**
57
+ * \brief Maximum valid Check ID
58
+ *
59
+ * The .xz file format specification specifies 16 Check IDs (0-15). Some
60
+ * of them are only reserved, that is, no actual Check algorithm has been
61
+ * assigned. When decoding, liblzma still accepts unknown Check IDs for
62
+ * future compatibility. If a valid but unsupported Check ID is detected,
63
+ * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK,
64
+ * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h.
65
+ */
66
+ #define LZMA_CHECK_ID_MAX 15
67
+
68
+
69
+ /**
70
+ * \brief Test if the given Check ID is supported
71
+ *
72
+ * LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if
73
+ * liblzma is built with limited features).
74
+ *
75
+ * \note It is safe to call this with a value that is not in the
76
+ * range [0, 15]; in that case the return value is always false.
77
+ *
78
+ * \param check Check ID
79
+ *
80
+ * \return lzma_bool:
81
+ * - true if Check ID is supported by this liblzma build.
82
+ * - false otherwise.
83
+ */
84
+ extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check)
85
+ lzma_nothrow lzma_attr_const;
86
+
87
+
88
+ /**
89
+ * \brief Get the size of the Check field with the given Check ID
90
+ *
91
+ * Although not all Check IDs have a check algorithm associated, the size of
92
+ * every Check is already frozen. This function returns the size (in bytes) of
93
+ * the Check field with the specified Check ID. The values are:
94
+ * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }
95
+ *
96
+ * \param check Check ID
97
+ *
98
+ * \return Size of the Check field in bytes. If the argument is not in
99
+ * the range [0, 15], UINT32_MAX is returned.
100
+ */
101
+ extern LZMA_API(uint32_t) lzma_check_size(lzma_check check)
102
+ lzma_nothrow lzma_attr_const;
103
+
104
+
105
+ /**
106
+ * \brief Maximum size of a Check field
107
+ */
108
+ #define LZMA_CHECK_SIZE_MAX 64
109
+
110
+
111
+ /**
112
+ * \brief Calculate CRC32
113
+ *
114
+ * Calculate CRC32 using the polynomial from the IEEE 802.3 standard.
115
+ *
116
+ * \param buf Pointer to the input buffer
117
+ * \param size Size of the input buffer
118
+ * \param crc Previously returned CRC value. This is used to
119
+ * calculate the CRC of a big buffer in smaller chunks.
120
+ * Set to zero when starting a new calculation.
121
+ *
122
+ * \return Updated CRC value, which can be passed to this function
123
+ * again to continue CRC calculation.
124
+ */
125
+ extern LZMA_API(uint32_t) lzma_crc32(
126
+ const uint8_t *buf, size_t size, uint32_t crc)
127
+ lzma_nothrow lzma_attr_pure;
128
+
129
+
130
+ /**
131
+ * \brief Calculate CRC64
132
+ *
133
+ * Calculate CRC64 using the polynomial from the ECMA-182 standard.
134
+ *
135
+ * This function is used similarly to lzma_crc32().
136
+ *
137
+ * \param buf Pointer to the input buffer
138
+ * \param size Size of the input buffer
139
+ * \param crc Previously returned CRC value. This is used to
140
+ * calculate the CRC of a big buffer in smaller chunks.
141
+ * Set to zero when starting a new calculation.
142
+ *
143
+ * \return Updated CRC value, which can be passed to this function
144
+ * again to continue CRC calculation.
145
+ */
146
+ extern LZMA_API(uint64_t) lzma_crc64(
147
+ const uint8_t *buf, size_t size, uint64_t crc)
148
+ lzma_nothrow lzma_attr_pure;
149
+
150
+
151
+ /**
152
+ * \brief Get the type of the integrity check
153
+ *
154
+ * This function can be called only immediately after lzma_code() has
155
+ * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.
156
+ * Calling this function in any other situation has undefined behavior.
157
+ *
158
+ * \param strm Pointer to lzma_stream meeting the above conditions.
159
+ *
160
+ * \return Check ID in the lzma_stream, or undefined if called improperly.
161
+ */
162
+ extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm)
163
+ lzma_nothrow;
evalkit_llava/include/lzma/container.h ADDED
@@ -0,0 +1,995 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/container.h
5
+ * \brief File formats
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
+ * Encoding *
20
+ ************/
21
+
22
+ /**
23
+ * \brief Default compression preset
24
+ *
25
+ * It's not straightforward to recommend a default preset, because in some
26
+ * cases keeping the resource usage relatively low is more important that
27
+ * getting the maximum compression ratio.
28
+ */
29
+ #define LZMA_PRESET_DEFAULT UINT32_C(6)
30
+
31
+
32
+ /**
33
+ * \brief Mask for preset level
34
+ *
35
+ * This is useful only if you need to extract the level from the preset
36
+ * variable. That should be rare.
37
+ */
38
+ #define LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F)
39
+
40
+
41
+ /*
42
+ * Preset flags
43
+ *
44
+ * Currently only one flag is defined.
45
+ */
46
+
47
+ /**
48
+ * \brief Extreme compression preset
49
+ *
50
+ * This flag modifies the preset to make the encoding significantly slower
51
+ * while improving the compression ratio only marginally. This is useful
52
+ * when you don't mind spending time to get as small result as possible.
53
+ *
54
+ * This flag doesn't affect the memory usage requirements of the decoder (at
55
+ * least not significantly). The memory usage of the encoder may be increased
56
+ * a little but only at the lowest preset levels (0-3).
57
+ */
58
+ #define LZMA_PRESET_EXTREME (UINT32_C(1) << 31)
59
+
60
+
61
+ /**
62
+ * \brief Multithreading options
63
+ */
64
+ typedef struct {
65
+ /**
66
+ * \brief Flags
67
+ *
68
+ * Set this to zero if no flags are wanted.
69
+ *
70
+ * Encoder: No flags are currently supported.
71
+ *
72
+ * Decoder: Bitwise-or of zero or more of the decoder flags:
73
+ * - LZMA_TELL_NO_CHECK
74
+ * - LZMA_TELL_UNSUPPORTED_CHECK
75
+ * - LZMA_TELL_ANY_CHECK
76
+ * - LZMA_IGNORE_CHECK
77
+ * - LZMA_CONCATENATED
78
+ * - LZMA_FAIL_FAST
79
+ */
80
+ uint32_t flags;
81
+
82
+ /**
83
+ * \brief Number of worker threads to use
84
+ */
85
+ uint32_t threads;
86
+
87
+ /**
88
+ * \brief Encoder only: Maximum uncompressed size of a Block
89
+ *
90
+ * The encoder will start a new .xz Block every block_size bytes.
91
+ * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code()
92
+ * the caller may tell liblzma to start a new Block earlier.
93
+ *
94
+ * With LZMA2, a recommended block size is 2-4 times the LZMA2
95
+ * dictionary size. With very small dictionaries, it is recommended
96
+ * to use at least 1 MiB block size for good compression ratio, even
97
+ * if this is more than four times the dictionary size. Note that
98
+ * these are only recommendations for typical use cases; feel free
99
+ * to use other values. Just keep in mind that using a block size
100
+ * less than the LZMA2 dictionary size is waste of RAM.
101
+ *
102
+ * Set this to 0 to let liblzma choose the block size depending
103
+ * on the compression options. For LZMA2 it will be 3*dict_size
104
+ * or 1 MiB, whichever is more.
105
+ *
106
+ * For each thread, about 3 * block_size bytes of memory will be
107
+ * allocated. This may change in later liblzma versions. If so,
108
+ * the memory usage will probably be reduced, not increased.
109
+ */
110
+ uint64_t block_size;
111
+
112
+ /**
113
+ * \brief Timeout to allow lzma_code() to return early
114
+ *
115
+ * Multithreading can make liblzma consume input and produce
116
+ * output in a very bursty way: it may first read a lot of input
117
+ * to fill internal buffers, then no input or output occurs for
118
+ * a while.
119
+ *
120
+ * In single-threaded mode, lzma_code() won't return until it has
121
+ * either consumed all the input or filled the output buffer. If
122
+ * this is done in multithreaded mode, it may cause a call
123
+ * lzma_code() to take even tens of seconds, which isn't acceptable
124
+ * in all applications.
125
+ *
126
+ * To avoid very long blocking times in lzma_code(), a timeout
127
+ * (in milliseconds) may be set here. If lzma_code() would block
128
+ * longer than this number of milliseconds, it will return with
129
+ * LZMA_OK. Reasonable values are 100 ms or more. The xz command
130
+ * line tool uses 300 ms.
131
+ *
132
+ * If long blocking times are acceptable, set timeout to a special
133
+ * value of 0. This will disable the timeout mechanism and will make
134
+ * lzma_code() block until all the input is consumed or the output
135
+ * buffer has been filled.
136
+ *
137
+ * \note Even with a timeout, lzma_code() might sometimes take
138
+ * a long time to return. No timing guarantees are made.
139
+ */
140
+ uint32_t timeout;
141
+
142
+ /**
143
+ * \brief Encoder only: Compression preset
144
+ *
145
+ * The preset is set just like with lzma_easy_encoder().
146
+ * The preset is ignored if filters below is non-NULL.
147
+ */
148
+ uint32_t preset;
149
+
150
+ /**
151
+ * \brief Encoder only: Filter chain (alternative to a preset)
152
+ *
153
+ * If this is NULL, the preset above is used. Otherwise the preset
154
+ * is ignored and the filter chain specified here is used.
155
+ */
156
+ const lzma_filter *filters;
157
+
158
+ /**
159
+ * \brief Encoder only: Integrity check type
160
+ *
161
+ * See check.h for available checks. The xz command line tool
162
+ * defaults to LZMA_CHECK_CRC64, which is a good choice if you
163
+ * are unsure.
164
+ */
165
+ lzma_check check;
166
+
167
+ /*
168
+ * Reserved space to allow possible future extensions without
169
+ * breaking the ABI. You should not touch these, because the names
170
+ * of these variables may change. These are and will never be used
171
+ * with the currently supported options, so it is safe to leave these
172
+ * uninitialized.
173
+ */
174
+ /** \private Reserved member. */
175
+ lzma_reserved_enum reserved_enum1;
176
+
177
+ /** \private Reserved member. */
178
+ lzma_reserved_enum reserved_enum2;
179
+
180
+ /** \private Reserved member. */
181
+ lzma_reserved_enum reserved_enum3;
182
+
183
+ /** \private Reserved member. */
184
+ uint32_t reserved_int1;
185
+
186
+ /** \private Reserved member. */
187
+ uint32_t reserved_int2;
188
+
189
+ /** \private Reserved member. */
190
+ uint32_t reserved_int3;
191
+
192
+ /** \private Reserved member. */
193
+ uint32_t reserved_int4;
194
+
195
+ /**
196
+ * \brief Memory usage limit to reduce the number of threads
197
+ *
198
+ * Encoder: Ignored.
199
+ *
200
+ * Decoder:
201
+ *
202
+ * If the number of threads has been set so high that more than
203
+ * memlimit_threading bytes of memory would be needed, the number
204
+ * of threads will be reduced so that the memory usage will not exceed
205
+ * memlimit_threading bytes. However, if memlimit_threading cannot
206
+ * be met even in single-threaded mode, then decoding will continue
207
+ * in single-threaded mode and memlimit_threading may be exceeded
208
+ * even by a large amount. That is, memlimit_threading will never make
209
+ * lzma_code() return LZMA_MEMLIMIT_ERROR. To truly cap the memory
210
+ * usage, see memlimit_stop below.
211
+ *
212
+ * Setting memlimit_threading to UINT64_MAX or a similar huge value
213
+ * means that liblzma is allowed to keep the whole compressed file
214
+ * and the whole uncompressed file in memory in addition to the memory
215
+ * needed by the decompressor data structures used by each thread!
216
+ * In other words, a reasonable value limit must be set here or it
217
+ * will cause problems sooner or later. If you have no idea what
218
+ * a reasonable value could be, try lzma_physmem() / 4 as a starting
219
+ * point. Setting this limit will never prevent decompression of
220
+ * a file; this will only reduce the number of threads.
221
+ *
222
+ * If memlimit_threading is greater than memlimit_stop, then the value
223
+ * of memlimit_stop will be used for both.
224
+ */
225
+ uint64_t memlimit_threading;
226
+
227
+ /**
228
+ * \brief Memory usage limit that should never be exceeded
229
+ *
230
+ * Encoder: Ignored.
231
+ *
232
+ * Decoder: If decompressing will need more than this amount of
233
+ * memory even in the single-threaded mode, then lzma_code() will
234
+ * return LZMA_MEMLIMIT_ERROR.
235
+ */
236
+ uint64_t memlimit_stop;
237
+
238
+ /** \private Reserved member. */
239
+ uint64_t reserved_int7;
240
+
241
+ /** \private Reserved member. */
242
+ uint64_t reserved_int8;
243
+
244
+ /** \private Reserved member. */
245
+ void *reserved_ptr1;
246
+
247
+ /** \private Reserved member. */
248
+ void *reserved_ptr2;
249
+
250
+ /** \private Reserved member. */
251
+ void *reserved_ptr3;
252
+
253
+ /** \private Reserved member. */
254
+ void *reserved_ptr4;
255
+
256
+ } lzma_mt;
257
+
258
+
259
+ /**
260
+ * \brief Calculate approximate memory usage of easy encoder
261
+ *
262
+ * This function is a wrapper for lzma_raw_encoder_memusage().
263
+ *
264
+ * \param preset Compression preset (level and possible flags)
265
+ *
266
+ * \return Number of bytes of memory required for the given
267
+ * preset when encoding or UINT64_MAX on error.
268
+ */
269
+ extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
270
+ lzma_nothrow lzma_attr_pure;
271
+
272
+
273
+ /**
274
+ * \brief Calculate approximate decoder memory usage of a preset
275
+ *
276
+ * This function is a wrapper for lzma_raw_decoder_memusage().
277
+ *
278
+ * \param preset Compression preset (level and possible flags)
279
+ *
280
+ * \return Number of bytes of memory required to decompress a file
281
+ * that was compressed using the given preset or UINT64_MAX
282
+ * on error.
283
+ */
284
+ extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
285
+ lzma_nothrow lzma_attr_pure;
286
+
287
+
288
+ /**
289
+ * \brief Initialize .xz Stream encoder using a preset number
290
+ *
291
+ * This function is intended for those who just want to use the basic features
292
+ * of liblzma (that is, most developers out there).
293
+ *
294
+ * If initialization fails (return value is not LZMA_OK), all the memory
295
+ * allocated for *strm by liblzma is always freed. Thus, there is no need
296
+ * to call lzma_end() after failed initialization.
297
+ *
298
+ * If initialization succeeds, use lzma_code() to do the actual encoding.
299
+ * Valid values for 'action' (the second argument of lzma_code()) are
300
+ * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,
301
+ * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.
302
+ *
303
+ * \param strm Pointer to lzma_stream that is at least initialized
304
+ * with LZMA_STREAM_INIT.
305
+ * \param preset Compression preset to use. A preset consist of level
306
+ * number and zero or more flags. Usually flags aren't
307
+ * used, so preset is simply a number [0, 9] which match
308
+ * the options -0 ... -9 of the xz command line tool.
309
+ * Additional flags can be set using bitwise-or with
310
+ * the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.
311
+ * \param check Integrity check type to use. See check.h for available
312
+ * checks. The xz command line tool defaults to
313
+ * LZMA_CHECK_CRC64, which is a good choice if you are
314
+ * unsure. LZMA_CHECK_CRC32 is good too as long as the
315
+ * uncompressed file is not many gigabytes.
316
+ *
317
+ * \return Possible lzma_ret values:
318
+ * - LZMA_OK: Initialization succeeded. Use lzma_code() to
319
+ * encode your data.
320
+ * - LZMA_MEM_ERROR: Memory allocation failed.
321
+ * - LZMA_OPTIONS_ERROR: The given compression preset is not
322
+ * supported by this build of liblzma.
323
+ * - LZMA_UNSUPPORTED_CHECK: The given check type is not
324
+ * supported by this liblzma build.
325
+ * - LZMA_PROG_ERROR: One or more of the parameters have values
326
+ * that will never be valid. For example, strm == NULL.
327
+ */
328
+ extern LZMA_API(lzma_ret) lzma_easy_encoder(
329
+ lzma_stream *strm, uint32_t preset, lzma_check check)
330
+ lzma_nothrow lzma_attr_warn_unused_result;
331
+
332
+
333
+ /**
334
+ * \brief Single-call .xz Stream encoding using a preset number
335
+ *
336
+ * The maximum required output buffer size can be calculated with
337
+ * lzma_stream_buffer_bound().
338
+ *
339
+ * \param preset Compression preset to use. See the description
340
+ * in lzma_easy_encoder().
341
+ * \param check Type of the integrity check to calculate from
342
+ * uncompressed data.
343
+ * \param allocator lzma_allocator for custom allocator functions.
344
+ * Set to NULL to use malloc() and free().
345
+ * \param in Beginning of the input buffer
346
+ * \param in_size Size of the input buffer
347
+ * \param[out] out Beginning of the output buffer
348
+ * \param[out] out_pos The next byte will be written to out[*out_pos].
349
+ * *out_pos is updated only if encoding succeeds.
350
+ * \param out_size Size of the out buffer; the first byte into
351
+ * which no data is written to is out[out_size].
352
+ *
353
+ * \return Possible lzma_ret values:
354
+ * - LZMA_OK: Encoding was successful.
355
+ * - LZMA_BUF_ERROR: Not enough output buffer space.
356
+ * - LZMA_UNSUPPORTED_CHECK
357
+ * - LZMA_OPTIONS_ERROR
358
+ * - LZMA_MEM_ERROR
359
+ * - LZMA_DATA_ERROR
360
+ * - LZMA_PROG_ERROR
361
+ */
362
+ extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
363
+ uint32_t preset, lzma_check check,
364
+ const lzma_allocator *allocator,
365
+ const uint8_t *in, size_t in_size,
366
+ uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
367
+
368
+
369
+ /**
370
+ * \brief Initialize .xz Stream encoder using a custom filter chain
371
+ *
372
+ * \param strm Pointer to lzma_stream that is at least initialized
373
+ * with LZMA_STREAM_INIT.
374
+ * \param filters Array of filters terminated with
375
+ * .id == LZMA_VLI_UNKNOWN. See filters.h for more
376
+ * information.
377
+ * \param check Type of the integrity check to calculate from
378
+ * uncompressed data.
379
+ *
380
+ * \return Possible lzma_ret values:
381
+ * - LZMA_OK: Initialization was successful.
382
+ * - LZMA_MEM_ERROR
383
+ * - LZMA_UNSUPPORTED_CHECK
384
+ * - LZMA_OPTIONS_ERROR
385
+ * - LZMA_PROG_ERROR
386
+ */
387
+ extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
388
+ const lzma_filter *filters, lzma_check check)
389
+ lzma_nothrow lzma_attr_warn_unused_result;
390
+
391
+
392
+ /**
393
+ * \brief Calculate approximate memory usage of multithreaded .xz encoder
394
+ *
395
+ * Since doing the encoding in threaded mode doesn't affect the memory
396
+ * requirements of single-threaded decompressor, you can use
397
+ * lzma_easy_decoder_memusage(options->preset) or
398
+ * lzma_raw_decoder_memusage(options->filters) to calculate
399
+ * the decompressor memory requirements.
400
+ *
401
+ * \param options Compression options
402
+ *
403
+ * \return Number of bytes of memory required for encoding with the
404
+ * given options. If an error occurs, for example due to
405
+ * unsupported preset or filter chain, UINT64_MAX is returned.
406
+ */
407
+ extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
408
+ const lzma_mt *options) lzma_nothrow lzma_attr_pure;
409
+
410
+
411
+ /**
412
+ * \brief Initialize multithreaded .xz Stream encoder
413
+ *
414
+ * This provides the functionality of lzma_easy_encoder() and
415
+ * lzma_stream_encoder() as a single function for multithreaded use.
416
+ *
417
+ * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH,
418
+ * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be
419
+ * added in the future.
420
+ *
421
+ * \param strm Pointer to lzma_stream that is at least initialized
422
+ * with LZMA_STREAM_INIT.
423
+ * \param options Pointer to multithreaded compression options
424
+ *
425
+ * \return Possible lzma_ret values:
426
+ * - LZMA_OK
427
+ * - LZMA_MEM_ERROR
428
+ * - LZMA_UNSUPPORTED_CHECK
429
+ * - LZMA_OPTIONS_ERROR
430
+ * - LZMA_PROG_ERROR
431
+ */
432
+ extern LZMA_API(lzma_ret) lzma_stream_encoder_mt(
433
+ lzma_stream *strm, const lzma_mt *options)
434
+ lzma_nothrow lzma_attr_warn_unused_result;
435
+
436
+
437
+ /**
438
+ * \brief Calculate recommended Block size for multithreaded .xz encoder
439
+ *
440
+ * This calculates a recommended Block size for multithreaded encoding given
441
+ * a filter chain. This is used internally by lzma_stream_encoder_mt() to
442
+ * determine the Block size if the block_size member is not set to the
443
+ * special value of 0 in the lzma_mt options struct.
444
+ *
445
+ * If one wishes to change the filters between Blocks, this function is
446
+ * helpful to set the block_size member of the lzma_mt struct before calling
447
+ * lzma_stream_encoder_mt(). Since the block_size member represents the
448
+ * maximum possible Block size for the multithreaded .xz encoder, one can
449
+ * use this function to find the maximum recommended Block size based on
450
+ * all planned filter chains. Otherwise, the multithreaded encoder will
451
+ * base its maximum Block size on the first filter chain used (if the
452
+ * block_size member is not set), which may unnecessarily limit the Block
453
+ * size for a later filter chain.
454
+ *
455
+ * \param filters Array of filters terminated with
456
+ * .id == LZMA_VLI_UNKNOWN.
457
+ *
458
+ * \return Recommended Block size in bytes, or UINT64_MAX if
459
+ * an error occurred.
460
+ */
461
+ extern LZMA_API(uint64_t) lzma_mt_block_size(const lzma_filter *filters)
462
+ lzma_nothrow;
463
+
464
+
465
+ /**
466
+ * \brief Initialize .lzma encoder (legacy file format)
467
+ *
468
+ * The .lzma format is sometimes called the LZMA_Alone format, which is the
469
+ * reason for the name of this function. The .lzma format supports only the
470
+ * LZMA1 filter. There is no support for integrity checks like CRC32.
471
+ *
472
+ * Use this function if and only if you need to create files readable by
473
+ * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format
474
+ * is strongly recommended.
475
+ *
476
+ * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH.
477
+ * No kind of flushing is supported, because the file format doesn't make
478
+ * it possible.
479
+ *
480
+ * \param strm Pointer to lzma_stream that is at least initialized
481
+ * with LZMA_STREAM_INIT.
482
+ * \param options Pointer to encoder options
483
+ *
484
+ * \return Possible lzma_ret values:
485
+ * - LZMA_OK
486
+ * - LZMA_MEM_ERROR
487
+ * - LZMA_OPTIONS_ERROR
488
+ * - LZMA_PROG_ERROR
489
+ */
490
+ extern LZMA_API(lzma_ret) lzma_alone_encoder(
491
+ lzma_stream *strm, const lzma_options_lzma *options)
492
+ lzma_nothrow lzma_attr_warn_unused_result;
493
+
494
+
495
+ /**
496
+ * \brief Calculate output buffer size for single-call Stream encoder
497
+ *
498
+ * When trying to compress incompressible data, the encoded size will be
499
+ * slightly bigger than the input data. This function calculates how much
500
+ * output buffer space is required to be sure that lzma_stream_buffer_encode()
501
+ * doesn't return LZMA_BUF_ERROR.
502
+ *
503
+ * The calculated value is not exact, but it is guaranteed to be big enough.
504
+ * The actual maximum output space required may be slightly smaller (up to
505
+ * about 100 bytes). This should not be a problem in practice.
506
+ *
507
+ * If the calculated maximum size doesn't fit into size_t or would make the
508
+ * Stream grow past LZMA_VLI_MAX (which should never happen in practice),
509
+ * zero is returned to indicate the error.
510
+ *
511
+ * \note The limit calculated by this function applies only to
512
+ * single-call encoding. Multi-call encoding may (and probably
513
+ * will) have larger maximum expansion when encoding
514
+ * incompressible data. Currently there is no function to
515
+ * calculate the maximum expansion of multi-call encoding.
516
+ *
517
+ * \param uncompressed_size Size in bytes of the uncompressed
518
+ * input data
519
+ *
520
+ * \return Maximum number of bytes needed to store the compressed data.
521
+ */
522
+ extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
523
+ lzma_nothrow;
524
+
525
+
526
+ /**
527
+ * \brief Single-call .xz Stream encoder
528
+ *
529
+ * \param filters Array of filters terminated with
530
+ * .id == LZMA_VLI_UNKNOWN. See filters.h for more
531
+ * information.
532
+ * \param check Type of the integrity check to calculate from
533
+ * uncompressed data.
534
+ * \param allocator lzma_allocator for custom allocator functions.
535
+ * Set to NULL to use malloc() and free().
536
+ * \param in Beginning of the input buffer
537
+ * \param in_size Size of the input buffer
538
+ * \param[out] out Beginning of the output buffer
539
+ * \param[out] out_pos The next byte will be written to out[*out_pos].
540
+ * *out_pos is updated only if encoding succeeds.
541
+ * \param out_size Size of the out buffer; the first byte into
542
+ * which no data is written to is out[out_size].
543
+ *
544
+ * \return Possible lzma_ret values:
545
+ * - LZMA_OK: Encoding was successful.
546
+ * - LZMA_BUF_ERROR: Not enough output buffer space.
547
+ * - LZMA_UNSUPPORTED_CHECK
548
+ * - LZMA_OPTIONS_ERROR
549
+ * - LZMA_MEM_ERROR
550
+ * - LZMA_DATA_ERROR
551
+ * - LZMA_PROG_ERROR
552
+ */
553
+ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
554
+ lzma_filter *filters, lzma_check check,
555
+ const lzma_allocator *allocator,
556
+ const uint8_t *in, size_t in_size,
557
+ uint8_t *out, size_t *out_pos, size_t out_size)
558
+ lzma_nothrow lzma_attr_warn_unused_result;
559
+
560
+
561
+ /**
562
+ * \brief MicroLZMA encoder
563
+ *
564
+ * The MicroLZMA format is a raw LZMA stream whose first byte (always 0x00)
565
+ * has been replaced with bitwise-negation of the LZMA properties (lc/lp/pb).
566
+ * This encoding ensures that the first byte of MicroLZMA stream is never
567
+ * 0x00. There is no end of payload marker and thus the uncompressed size
568
+ * must be stored separately. For the best error detection the dictionary
569
+ * size should be stored separately as well but alternatively one may use
570
+ * the uncompressed size as the dictionary size when decoding.
571
+ *
572
+ * With the MicroLZMA encoder, lzma_code() behaves slightly unusually.
573
+ * The action argument must be LZMA_FINISH and the return value will never be
574
+ * LZMA_OK. Thus the encoding is always done with a single lzma_code() after
575
+ * the initialization. The benefit of the combination of initialization
576
+ * function and lzma_code() is that memory allocations can be re-used for
577
+ * better performance.
578
+ *
579
+ * lzma_code() will try to encode as much input as is possible to fit into
580
+ * the given output buffer. If not all input can be encoded, the stream will
581
+ * be finished without encoding all the input. The caller must check both
582
+ * input and output buffer usage after lzma_code() (total_in and total_out
583
+ * in lzma_stream can be convenient). Often lzma_code() can fill the output
584
+ * buffer completely if there is a lot of input, but sometimes a few bytes
585
+ * may remain unused because the next LZMA symbol would require more space.
586
+ *
587
+ * lzma_stream.avail_out must be at least 6. Otherwise LZMA_PROG_ERROR
588
+ * will be returned.
589
+ *
590
+ * The LZMA dictionary should be reasonably low to speed up the encoder
591
+ * re-initialization. A good value is bigger than the resulting
592
+ * uncompressed size of most of the output chunks. For example, if output
593
+ * size is 4 KiB, dictionary size of 32 KiB or 64 KiB is good. If the
594
+ * data compresses extremely well, even 128 KiB may be useful.
595
+ *
596
+ * The MicroLZMA format and this encoder variant were made with the EROFS
597
+ * file system in mind. This format may be convenient in other embedded
598
+ * uses too where many small streams are needed. XZ Embedded includes a
599
+ * decoder for this format.
600
+ *
601
+ * \param strm Pointer to lzma_stream that is at least initialized
602
+ * with LZMA_STREAM_INIT.
603
+ * \param options Pointer to encoder options
604
+ *
605
+ * \return Possible lzma_ret values:
606
+ * - LZMA_STREAM_END: All good. Check the amounts of input used
607
+ * and output produced. Store the amount of input used
608
+ * (uncompressed size) as it needs to be known to decompress
609
+ * the data.
610
+ * - LZMA_OPTIONS_ERROR
611
+ * - LZMA_MEM_ERROR
612
+ * - LZMA_PROG_ERROR: In addition to the generic reasons for this
613
+ * error code, this may also be returned if there isn't enough
614
+ * output space (6 bytes) to create a valid MicroLZMA stream.
615
+ */
616
+ extern LZMA_API(lzma_ret) lzma_microlzma_encoder(
617
+ lzma_stream *strm, const lzma_options_lzma *options)
618
+ lzma_nothrow;
619
+
620
+
621
+ /************
622
+ * Decoding *
623
+ ************/
624
+
625
+ /**
626
+ * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream
627
+ * being decoded has no integrity check. Note that when used with
628
+ * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK
629
+ * if LZMA_TELL_NO_CHECK is used.
630
+ */
631
+ #define LZMA_TELL_NO_CHECK UINT32_C(0x01)
632
+
633
+
634
+ /**
635
+ * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input
636
+ * stream has an integrity check, but the type of the integrity check is not
637
+ * supported by this liblzma version or build. Such files can still be
638
+ * decoded, but the integrity check cannot be verified.
639
+ */
640
+ #define LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02)
641
+
642
+
643
+ /**
644
+ * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type
645
+ * of the integrity check is known. The type can then be got with
646
+ * lzma_get_check().
647
+ */
648
+ #define LZMA_TELL_ANY_CHECK UINT32_C(0x04)
649
+
650
+
651
+ /**
652
+ * This flag makes lzma_code() not calculate and verify the integrity check
653
+ * of the compressed data in .xz files. This means that invalid integrity
654
+ * check values won't be detected and LZMA_DATA_ERROR won't be returned in
655
+ * such cases.
656
+ *
657
+ * This flag only affects the checks of the compressed data itself; the CRC32
658
+ * values in the .xz headers will still be verified normally.
659
+ *
660
+ * Don't use this flag unless you know what you are doing. Possible reasons
661
+ * to use this flag:
662
+ *
663
+ * - Trying to recover data from a corrupt .xz file.
664
+ *
665
+ * - Speeding up decompression, which matters mostly with SHA-256
666
+ * or with files that have compressed extremely well. It's recommended
667
+ * to not use this flag for this purpose unless the file integrity is
668
+ * verified externally in some other way.
669
+ *
670
+ * Support for this flag was added in liblzma 5.1.4beta.
671
+ */
672
+ #define LZMA_IGNORE_CHECK UINT32_C(0x10)
673
+
674
+
675
+ /**
676
+ * This flag enables decoding of concatenated files with file formats that
677
+ * allow concatenating compressed files as is. From the formats currently
678
+ * supported by liblzma, only the .xz and .lz formats allow concatenated
679
+ * files. Concatenated files are not allowed with the legacy .lzma format.
680
+ *
681
+ * This flag also affects the usage of the 'action' argument for lzma_code().
682
+ * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END
683
+ * unless LZMA_FINISH is used as 'action'. Thus, the application has to set
684
+ * LZMA_FINISH in the same way as it does when encoding.
685
+ *
686
+ * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH
687
+ * as 'action' for lzma_code(), but the usage of LZMA_FINISH isn't required.
688
+ */
689
+ #define LZMA_CONCATENATED UINT32_C(0x08)
690
+
691
+
692
+ /**
693
+ * This flag makes the threaded decoder report errors (like LZMA_DATA_ERROR)
694
+ * as soon as they are detected. This saves time when the application has no
695
+ * interest in a partially decompressed truncated or corrupt file. Note that
696
+ * due to timing randomness, if the same truncated or corrupt input is
697
+ * decompressed multiple times with this flag, a different amount of output
698
+ * may be produced by different runs, and even the error code might vary.
699
+ *
700
+ * When using LZMA_FAIL_FAST, it is recommended to use LZMA_FINISH to tell
701
+ * the decoder when no more input will be coming because it can help fast
702
+ * detection and reporting of truncated files. Note that in this situation
703
+ * truncated files might be diagnosed with LZMA_DATA_ERROR instead of
704
+ * LZMA_OK or LZMA_BUF_ERROR!
705
+ *
706
+ * Without this flag the threaded decoder will provide as much output as
707
+ * possible at first and then report the pending error. This default behavior
708
+ * matches the single-threaded decoder and provides repeatable behavior
709
+ * with truncated or corrupt input. There are a few special cases where the
710
+ * behavior can still differ like memory allocation failures (LZMA_MEM_ERROR).
711
+ *
712
+ * Single-threaded decoders currently ignore this flag.
713
+ *
714
+ * Support for this flag was added in liblzma 5.3.3alpha. Note that in older
715
+ * versions this flag isn't supported (LZMA_OPTIONS_ERROR) even by functions
716
+ * that ignore this flag in newer liblzma versions.
717
+ */
718
+ #define LZMA_FAIL_FAST UINT32_C(0x20)
719
+
720
+
721
+ /**
722
+ * \brief Initialize .xz Stream decoder
723
+ *
724
+ * \param strm Pointer to lzma_stream that is at least initialized
725
+ * with LZMA_STREAM_INIT.
726
+ * \param memlimit Memory usage limit as bytes. Use UINT64_MAX
727
+ * to effectively disable the limiter. liblzma
728
+ * 5.2.3 and earlier don't allow 0 here and return
729
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
730
+ * had been specified.
731
+ * \param flags Bitwise-or of zero or more of the decoder flags:
732
+ * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
733
+ * LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK,
734
+ * LZMA_CONCATENATED, LZMA_FAIL_FAST
735
+ *
736
+ * \return Possible lzma_ret values:
737
+ * - LZMA_OK: Initialization was successful.
738
+ * - LZMA_MEM_ERROR: Cannot allocate memory.
739
+ * - LZMA_OPTIONS_ERROR: Unsupported flags
740
+ * - LZMA_PROG_ERROR
741
+ */
742
+ extern LZMA_API(lzma_ret) lzma_stream_decoder(
743
+ lzma_stream *strm, uint64_t memlimit, uint32_t flags)
744
+ lzma_nothrow lzma_attr_warn_unused_result;
745
+
746
+
747
+ /**
748
+ * \brief Initialize multithreaded .xz Stream decoder
749
+ *
750
+ * The decoder can decode multiple Blocks in parallel. This requires that each
751
+ * Block Header contains the Compressed Size and Uncompressed size fields
752
+ * which are added by the multi-threaded encoder, see lzma_stream_encoder_mt().
753
+ *
754
+ * A Stream with one Block will only utilize one thread. A Stream with multiple
755
+ * Blocks but without size information in Block Headers will be processed in
756
+ * single-threaded mode in the same way as done by lzma_stream_decoder().
757
+ * Concatenated Streams are processed one Stream at a time; no inter-Stream
758
+ * parallelization is done.
759
+ *
760
+ * This function behaves like lzma_stream_decoder() when options->threads == 1
761
+ * and options->memlimit_threading <= 1.
762
+ *
763
+ * \param strm Pointer to lzma_stream that is at least initialized
764
+ * with LZMA_STREAM_INIT.
765
+ * \param options Pointer to multithreaded compression options
766
+ *
767
+ * \return Possible lzma_ret values:
768
+ * - LZMA_OK: Initialization was successful.
769
+ * - LZMA_MEM_ERROR: Cannot allocate memory.
770
+ * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
771
+ * - LZMA_OPTIONS_ERROR: Unsupported flags.
772
+ * - LZMA_PROG_ERROR
773
+ */
774
+ extern LZMA_API(lzma_ret) lzma_stream_decoder_mt(
775
+ lzma_stream *strm, const lzma_mt *options)
776
+ lzma_nothrow lzma_attr_warn_unused_result;
777
+
778
+
779
+ /**
780
+ * \brief Decode .xz, .lzma, and .lz (lzip) files with autodetection
781
+ *
782
+ * This decoder autodetects between the .xz, .lzma, and .lz file formats,
783
+ * and calls lzma_stream_decoder(), lzma_alone_decoder(), or
784
+ * lzma_lzip_decoder() once the type of the input file has been detected.
785
+ *
786
+ * Support for .lz was added in 5.4.0.
787
+ *
788
+ * If the flag LZMA_CONCATENATED is used and the input is a .lzma file:
789
+ * For historical reasons concatenated .lzma files aren't supported.
790
+ * If there is trailing data after one .lzma stream, lzma_code() will
791
+ * return LZMA_DATA_ERROR. (lzma_alone_decoder() doesn't have such a check
792
+ * as it doesn't support any decoder flags. It will return LZMA_STREAM_END
793
+ * after one .lzma stream.)
794
+ *
795
+ * \param strm Pointer to lzma_stream that is at least initialized
796
+ * with LZMA_STREAM_INIT.
797
+ * \param memlimit Memory usage limit as bytes. Use UINT64_MAX
798
+ * to effectively disable the limiter. liblzma
799
+ * 5.2.3 and earlier don't allow 0 here and return
800
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
801
+ * had been specified.
802
+ * \param flags Bitwise-or of zero or more of the decoder flags:
803
+ * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
804
+ * LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK,
805
+ * LZMA_CONCATENATED, LZMA_FAIL_FAST
806
+ *
807
+ * \return Possible lzma_ret values:
808
+ * - LZMA_OK: Initialization was successful.
809
+ * - LZMA_MEM_ERROR: Cannot allocate memory.
810
+ * - LZMA_OPTIONS_ERROR: Unsupported flags
811
+ * - LZMA_PROG_ERROR
812
+ */
813
+ extern LZMA_API(lzma_ret) lzma_auto_decoder(
814
+ lzma_stream *strm, uint64_t memlimit, uint32_t flags)
815
+ lzma_nothrow lzma_attr_warn_unused_result;
816
+
817
+
818
+ /**
819
+ * \brief Initialize .lzma decoder (legacy file format)
820
+ *
821
+ * Valid 'action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
822
+ * There is no need to use LZMA_FINISH, but it's allowed because it may
823
+ * simplify certain types of applications.
824
+ *
825
+ * \param strm Pointer to lzma_stream that is at least initialized
826
+ * with LZMA_STREAM_INIT.
827
+ * \param memlimit Memory usage limit as bytes. Use UINT64_MAX
828
+ * to effectively disable the limiter. liblzma
829
+ * 5.2.3 and earlier don't allow 0 here and return
830
+ * LZMA_PROG_ERROR; later versions treat 0 as if 1
831
+ * had been specified.
832
+ *
833
+ * \return Possible lzma_ret values:
834
+ * - LZMA_OK
835
+ * - LZMA_MEM_ERROR
836
+ * - LZMA_PROG_ERROR
837
+ */
838
+ extern LZMA_API(lzma_ret) lzma_alone_decoder(
839
+ lzma_stream *strm, uint64_t memlimit)
840
+ lzma_nothrow lzma_attr_warn_unused_result;
841
+
842
+
843
+ /**
844
+ * \brief Initialize .lz (lzip) decoder (a foreign file format)
845
+ *
846
+ * This decoder supports the .lz format version 0 and the unextended .lz
847
+ * format version 1:
848
+ *
849
+ * - Files in the format version 0 were produced by lzip 1.3 and older.
850
+ * Such files aren't common but may be found from file archives
851
+ * as a few source packages were released in this format. People
852
+ * might have old personal files in this format too. Decompression
853
+ * support for the format version 0 was removed in lzip 1.18.
854
+ *
855
+ * - lzip 1.3 added decompression support for .lz format version 1 files.
856
+ * Compression support was added in lzip 1.4. In lzip 1.6 the .lz format
857
+ * version 1 was extended to support the Sync Flush marker. This extension
858
+ * is not supported by liblzma. lzma_code() will return LZMA_DATA_ERROR
859
+ * at the location of the Sync Flush marker. In practice files with
860
+ * the Sync Flush marker are very rare and thus liblzma can decompress
861
+ * almost all .lz files.
862
+ *
863
+ * Just like with lzma_stream_decoder() for .xz files, LZMA_CONCATENATED
864
+ * should be used when decompressing normal standalone .lz files.
865
+ *
866
+ * The .lz format allows putting non-.lz data at the end of a file after at
867
+ * least one valid .lz member. That is, one can append custom data at the end
868
+ * of a .lz file and the decoder is required to ignore it. In liblzma this
869
+ * is relevant only when LZMA_CONCATENATED is used. In that case lzma_code()
870
+ * will return LZMA_STREAM_END and leave lzma_stream.next_in pointing to
871
+ * the first byte of the non-.lz data. An exception to this is if the first
872
+ * 1-3 bytes of the non-.lz data are identical to the .lz magic bytes
873
+ * (0x4C, 0x5A, 0x49, 0x50; "LZIP" in US-ASCII). In such a case the 1-3 bytes
874
+ * will have been ignored by lzma_code(). If one wishes to locate the non-.lz
875
+ * data reliably, one must ensure that the first byte isn't 0x4C. Actually
876
+ * one should ensure that none of the first four bytes of trailing data are
877
+ * equal to the magic bytes because lzip >= 1.20 requires it by default.
878
+ *
879
+ * \param strm Pointer to lzma_stream that is at least initialized
880
+ * with LZMA_STREAM_INIT.
881
+ * \param memlimit Memory usage limit as bytes. Use UINT64_MAX
882
+ * to effectively disable the limiter.
883
+ * \param flags Bitwise-or of flags, or zero for no flags.
884
+ * All decoder flags listed above are supported
885
+ * although only LZMA_CONCATENATED and (in very rare
886
+ * cases) LZMA_IGNORE_CHECK are actually useful.
887
+ * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
888
+ * and LZMA_FAIL_FAST do nothing. LZMA_TELL_ANY_CHECK
889
+ * is supported for consistency only as CRC32 is
890
+ * always used in the .lz format.
891
+ *
892
+ * \return Possible lzma_ret values:
893
+ * - LZMA_OK: Initialization was successful.
894
+ * - LZMA_MEM_ERROR: Cannot allocate memory.
895
+ * - LZMA_OPTIONS_ERROR: Unsupported flags
896
+ * - LZMA_PROG_ERROR
897
+ */
898
+ extern LZMA_API(lzma_ret) lzma_lzip_decoder(
899
+ lzma_stream *strm, uint64_t memlimit, uint32_t flags)
900
+ lzma_nothrow lzma_attr_warn_unused_result;
901
+
902
+
903
+ /**
904
+ * \brief Single-call .xz Stream decoder
905
+ *
906
+ * \param memlimit Pointer to how much memory the decoder is allowed
907
+ * to allocate. The value pointed by this pointer is
908
+ * modified if and only if LZMA_MEMLIMIT_ERROR is
909
+ * returned.
910
+ * \param flags Bitwise-or of zero or more of the decoder flags:
911
+ * LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
912
+ * LZMA_IGNORE_CHECK, LZMA_CONCATENATED,
913
+ * LZMA_FAIL_FAST. Note that LZMA_TELL_ANY_CHECK
914
+ * is not allowed and will return LZMA_PROG_ERROR.
915
+ * \param allocator lzma_allocator for custom allocator functions.
916
+ * Set to NULL to use malloc() and free().
917
+ * \param in Beginning of the input buffer
918
+ * \param in_pos The next byte will be read from in[*in_pos].
919
+ * *in_pos is updated only if decoding succeeds.
920
+ * \param in_size Size of the input buffer; the first byte that
921
+ * won't be read is in[in_size].
922
+ * \param[out] out Beginning of the output buffer
923
+ * \param[out] out_pos The next byte will be written to out[*out_pos].
924
+ * *out_pos is updated only if decoding succeeds.
925
+ * \param out_size Size of the out buffer; the first byte into
926
+ * which no data is written to is out[out_size].
927
+ *
928
+ * \return Possible lzma_ret values:
929
+ * - LZMA_OK: Decoding was successful.
930
+ * - LZMA_FORMAT_ERROR
931
+ * - LZMA_OPTIONS_ERROR
932
+ * - LZMA_DATA_ERROR
933
+ * - LZMA_NO_CHECK: This can be returned only if using
934
+ * the LZMA_TELL_NO_CHECK flag.
935
+ * - LZMA_UNSUPPORTED_CHECK: This can be returned only if using
936
+ * the LZMA_TELL_UNSUPPORTED_CHECK flag.
937
+ * - LZMA_MEM_ERROR
938
+ * - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
939
+ * The minimum required memlimit value was stored to *memlimit.
940
+ * - LZMA_BUF_ERROR: Output buffer was too small.
941
+ * - LZMA_PROG_ERROR
942
+ */
943
+ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
944
+ uint64_t *memlimit, uint32_t flags,
945
+ const lzma_allocator *allocator,
946
+ const uint8_t *in, size_t *in_pos, size_t in_size,
947
+ uint8_t *out, size_t *out_pos, size_t out_size)
948
+ lzma_nothrow lzma_attr_warn_unused_result;
949
+
950
+
951
+ /**
952
+ * \brief MicroLZMA decoder
953
+ *
954
+ * See lzma_microlzma_encoder() for more information.
955
+ *
956
+ * The lzma_code() usage with this decoder is completely normal. The
957
+ * special behavior of lzma_code() applies to lzma_microlzma_encoder() only.
958
+ *
959
+ * \param strm Pointer to lzma_stream that is at least initialized
960
+ * with LZMA_STREAM_INIT.
961
+ * \param comp_size Compressed size of the MicroLZMA stream.
962
+ * The caller must somehow know this exactly.
963
+ * \param uncomp_size Uncompressed size of the MicroLZMA stream.
964
+ * If the exact uncompressed size isn't known, this
965
+ * can be set to a value that is at most as big as
966
+ * the exact uncompressed size would be, but then the
967
+ * next argument uncomp_size_is_exact must be false.
968
+ * \param uncomp_size_is_exact
969
+ * If true, uncomp_size must be exactly correct.
970
+ * This will improve error detection at the end of
971
+ * the stream. If the exact uncompressed size isn't
972
+ * known, this must be false. uncomp_size must still
973
+ * be at most as big as the exact uncompressed size
974
+ * is. Setting this to false when the exact size is
975
+ * known will work but error detection at the end of
976
+ * the stream will be weaker.
977
+ * \param dict_size LZMA dictionary size that was used when
978
+ * compressing the data. It is OK to use a bigger
979
+ * value too but liblzma will then allocate more
980
+ * memory than would actually be required and error
981
+ * detection will be slightly worse. (Note that with
982
+ * the implementation in XZ Embedded it doesn't
983
+ * affect the memory usage if one specifies bigger
984
+ * dictionary than actually required.)
985
+ *
986
+ * \return Possible lzma_ret values:
987
+ * - LZMA_OK
988
+ * - LZMA_MEM_ERROR
989
+ * - LZMA_OPTIONS_ERROR
990
+ * - LZMA_PROG_ERROR
991
+ */
992
+ extern LZMA_API(lzma_ret) lzma_microlzma_decoder(
993
+ lzma_stream *strm, uint64_t comp_size,
994
+ uint64_t uncomp_size, lzma_bool uncomp_size_is_exact,
995
+ uint32_t dict_size) lzma_nothrow;
evalkit_llava/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;
evalkit_llava/include/lzma/index_hash.h ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/index_hash.h
5
+ * \brief Validate Index by using a hash function
6
+ * \note Never include this file directly. Use <lzma.h> instead.
7
+ *
8
+ * Hashing makes it possible to use constant amount of memory to validate
9
+ * Index of arbitrary size.
10
+ */
11
+
12
+ /*
13
+ * Author: Lasse Collin
14
+ */
15
+
16
+ #ifndef LZMA_H_INTERNAL
17
+ # error Never include this file directly. Use <lzma.h> instead.
18
+ #endif
19
+
20
+ /**
21
+ * \brief Opaque data type to hold the Index hash
22
+ */
23
+ typedef struct lzma_index_hash_s lzma_index_hash;
24
+
25
+
26
+ /**
27
+ * \brief Allocate and initialize a new lzma_index_hash structure
28
+ *
29
+ * If index_hash is NULL, this function allocates and initializes a new
30
+ * lzma_index_hash structure and returns a pointer to it. If allocation
31
+ * fails, NULL is returned.
32
+ *
33
+ * If index_hash is non-NULL, this function reinitializes the lzma_index_hash
34
+ * structure and returns the same pointer. In this case, return value cannot
35
+ * be NULL or a different pointer than the index_hash that was given as
36
+ * an argument.
37
+ *
38
+ * \param index_hash Pointer to a lzma_index_hash structure or NULL.
39
+ * \param allocator lzma_allocator for custom allocator functions.
40
+ * Set to NULL to use malloc() and free().
41
+ *
42
+ * \return Initialized lzma_index_hash structure on success or
43
+ * NULL on failure.
44
+ */
45
+ extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
46
+ lzma_index_hash *index_hash, const lzma_allocator *allocator)
47
+ lzma_nothrow lzma_attr_warn_unused_result;
48
+
49
+
50
+ /**
51
+ * \brief Deallocate lzma_index_hash structure
52
+ *
53
+ * \param index_hash Pointer to a lzma_index_hash structure to free.
54
+ * \param allocator lzma_allocator for custom allocator functions.
55
+ * Set to NULL to use malloc() and free().
56
+ */
57
+ extern LZMA_API(void) lzma_index_hash_end(
58
+ lzma_index_hash *index_hash, const lzma_allocator *allocator)
59
+ lzma_nothrow;
60
+
61
+
62
+ /**
63
+ * \brief Add a new Record to an Index hash
64
+ *
65
+ * \param index_hash Pointer to a lzma_index_hash structure
66
+ * \param unpadded_size Unpadded Size of a Block
67
+ * \param uncompressed_size Uncompressed Size of a Block
68
+ *
69
+ * \return Possible lzma_ret values:
70
+ * - LZMA_OK
71
+ * - LZMA_DATA_ERROR: Compressed or uncompressed size of the
72
+ * Stream or size of the Index field would grow too big.
73
+ * - LZMA_PROG_ERROR: Invalid arguments or this function is being
74
+ * used when lzma_index_hash_decode() has already been used.
75
+ */
76
+ extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash,
77
+ lzma_vli unpadded_size, lzma_vli uncompressed_size)
78
+ lzma_nothrow lzma_attr_warn_unused_result;
79
+
80
+
81
+ /**
82
+ * \brief Decode and validate the Index field
83
+ *
84
+ * After telling the sizes of all Blocks with lzma_index_hash_append(),
85
+ * the actual Index field is decoded with this function. Specifically,
86
+ * once decoding of the Index field has been started, no more Records
87
+ * can be added using lzma_index_hash_append().
88
+ *
89
+ * This function doesn't use lzma_stream structure to pass the input data.
90
+ * Instead, the input buffer is specified using three arguments. This is
91
+ * because it matches better the internal APIs of liblzma.
92
+ *
93
+ * \param index_hash Pointer to a lzma_index_hash structure
94
+ * \param in Pointer to the beginning of the input buffer
95
+ * \param[out] in_pos in[*in_pos] is the next byte to process
96
+ * \param in_size in[in_size] is the first byte not to process
97
+ *
98
+ * \return Possible lzma_ret values:
99
+ * - LZMA_OK: So far good, but more input is needed.
100
+ * - LZMA_STREAM_END: Index decoded successfully and it matches
101
+ * the Records given with lzma_index_hash_append().
102
+ * - LZMA_DATA_ERROR: Index is corrupt or doesn't match the
103
+ * information given with lzma_index_hash_append().
104
+ * - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size.
105
+ * - LZMA_PROG_ERROR
106
+ */
107
+ extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash,
108
+ const uint8_t *in, size_t *in_pos, size_t in_size)
109
+ lzma_nothrow lzma_attr_warn_unused_result;
110
+
111
+
112
+ /**
113
+ * \brief Get the size of the Index field as bytes
114
+ *
115
+ * This is needed to verify the Backward Size field in the Stream Footer.
116
+ *
117
+ * \param index_hash Pointer to a lzma_index_hash structure
118
+ *
119
+ * \return Size of the Index field in bytes.
120
+ */
121
+ extern LZMA_API(lzma_vli) lzma_index_hash_size(
122
+ const lzma_index_hash *index_hash)
123
+ lzma_nothrow lzma_attr_pure;
evalkit_llava/include/lzma/lzma12.h ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/lzma12.h
5
+ * \brief LZMA1 and LZMA2 filters
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 LZMA1 Filter ID (for raw encoder/decoder only, not in .xz)
20
+ *
21
+ * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils,
22
+ * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from
23
+ * accidentally using LZMA when they actually want LZMA2.
24
+ */
25
+ #define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001)
26
+
27
+ /**
28
+ * \brief LZMA1 Filter ID with extended options (for raw encoder/decoder)
29
+ *
30
+ * This is like LZMA_FILTER_LZMA1 but with this ID a few extra options
31
+ * are supported in the lzma_options_lzma structure:
32
+ *
33
+ * - A flag to tell the encoder if the end of payload marker (EOPM) alias
34
+ * end of stream (EOS) marker must be written at the end of the stream.
35
+ * In contrast, LZMA_FILTER_LZMA1 always writes the end marker.
36
+ *
37
+ * - Decoder needs to be told the uncompressed size of the stream
38
+ * or that it is unknown (using the special value UINT64_MAX).
39
+ * If the size is known, a flag can be set to allow the presence of
40
+ * the end marker anyway. In contrast, LZMA_FILTER_LZMA1 always
41
+ * behaves as if the uncompressed size was unknown.
42
+ *
43
+ * This allows handling file formats where LZMA1 streams are used but where
44
+ * the end marker isn't allowed or where it might not (always) be present.
45
+ * This extended LZMA1 functionality is provided as a Filter ID for raw
46
+ * encoder and decoder instead of adding new encoder and decoder initialization
47
+ * functions because this way it is possible to also use extra filters,
48
+ * for example, LZMA_FILTER_X86 in a filter chain with LZMA_FILTER_LZMA1EXT,
49
+ * which might be needed to handle some file formats.
50
+ */
51
+ #define LZMA_FILTER_LZMA1EXT LZMA_VLI_C(0x4000000000000002)
52
+
53
+ /**
54
+ * \brief LZMA2 Filter ID
55
+ *
56
+ * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds
57
+ * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion
58
+ * when trying to compress incompressible data), possibility to change
59
+ * lc/lp/pb in the middle of encoding, and some other internal improvements.
60
+ */
61
+ #define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21)
62
+
63
+
64
+ /**
65
+ * \brief Match finders
66
+ *
67
+ * Match finder has major effect on both speed and compression ratio.
68
+ * Usually hash chains are faster than binary trees.
69
+ *
70
+ * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better
71
+ * choice, because binary trees get much higher compression ratio penalty
72
+ * with LZMA_SYNC_FLUSH.
73
+ *
74
+ * The memory usage formulas are only rough estimates, which are closest to
75
+ * reality when dict_size is a power of two. The formulas are more complex
76
+ * in reality, and can also change a little between liblzma versions. Use
77
+ * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage.
78
+ */
79
+ typedef enum {
80
+ LZMA_MF_HC3 = 0x03,
81
+ /**<
82
+ * \brief Hash Chain with 2- and 3-byte hashing
83
+ *
84
+ * Minimum nice_len: 3
85
+ *
86
+ * Memory usage:
87
+ * - dict_size <= 16 MiB: dict_size * 7.5
88
+ * - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB
89
+ */
90
+
91
+ LZMA_MF_HC4 = 0x04,
92
+ /**<
93
+ * \brief Hash Chain with 2-, 3-, and 4-byte hashing
94
+ *
95
+ * Minimum nice_len: 4
96
+ *
97
+ * Memory usage:
98
+ * - dict_size <= 32 MiB: dict_size * 7.5
99
+ * - dict_size > 32 MiB: dict_size * 6.5
100
+ */
101
+
102
+ LZMA_MF_BT2 = 0x12,
103
+ /**<
104
+ * \brief Binary Tree with 2-byte hashing
105
+ *
106
+ * Minimum nice_len: 2
107
+ *
108
+ * Memory usage: dict_size * 9.5
109
+ */
110
+
111
+ LZMA_MF_BT3 = 0x13,
112
+ /**<
113
+ * \brief Binary Tree with 2- and 3-byte hashing
114
+ *
115
+ * Minimum nice_len: 3
116
+ *
117
+ * Memory usage:
118
+ * - dict_size <= 16 MiB: dict_size * 11.5
119
+ * - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB
120
+ */
121
+
122
+ LZMA_MF_BT4 = 0x14
123
+ /**<
124
+ * \brief Binary Tree with 2-, 3-, and 4-byte hashing
125
+ *
126
+ * Minimum nice_len: 4
127
+ *
128
+ * Memory usage:
129
+ * - dict_size <= 32 MiB: dict_size * 11.5
130
+ * - dict_size > 32 MiB: dict_size * 10.5
131
+ */
132
+ } lzma_match_finder;
133
+
134
+
135
+ /**
136
+ * \brief Test if given match finder is supported
137
+ *
138
+ * It is safe to call this with a value that isn't listed in
139
+ * lzma_match_finder enumeration; the return value will be false.
140
+ *
141
+ * There is no way to list which match finders are available in this
142
+ * particular liblzma version and build. It would be useless, because
143
+ * a new match finder, which the application developer wasn't aware,
144
+ * could require giving additional options to the encoder that the older
145
+ * match finders don't need.
146
+ *
147
+ * \param match_finder Match finder ID
148
+ *
149
+ * \return lzma_bool:
150
+ * - true if the match finder is supported by this liblzma build.
151
+ * - false otherwise.
152
+ */
153
+ extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder)
154
+ lzma_nothrow lzma_attr_const;
155
+
156
+
157
+ /**
158
+ * \brief Compression modes
159
+ *
160
+ * This selects the function used to analyze the data produced by the match
161
+ * finder.
162
+ */
163
+ typedef enum {
164
+ LZMA_MODE_FAST = 1,
165
+ /**<
166
+ * \brief Fast compression
167
+ *
168
+ * Fast mode is usually at its best when combined with
169
+ * a hash chain match finder.
170
+ */
171
+
172
+ LZMA_MODE_NORMAL = 2
173
+ /**<
174
+ * \brief Normal compression
175
+ *
176
+ * This is usually notably slower than fast mode. Use this
177
+ * together with binary tree match finders to expose the
178
+ * full potential of the LZMA1 or LZMA2 encoder.
179
+ */
180
+ } lzma_mode;
181
+
182
+
183
+ /**
184
+ * \brief Test if given compression mode is supported
185
+ *
186
+ * It is safe to call this with a value that isn't listed in lzma_mode
187
+ * enumeration; the return value will be false.
188
+ *
189
+ * There is no way to list which modes are available in this particular
190
+ * liblzma version and build. It would be useless, because a new compression
191
+ * mode, which the application developer wasn't aware, could require giving
192
+ * additional options to the encoder that the older modes don't need.
193
+ *
194
+ * \param mode Mode ID.
195
+ *
196
+ * \return lzma_bool:
197
+ * - true if the compression mode is supported by this liblzma
198
+ * build.
199
+ * - false otherwise.
200
+ */
201
+ extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode)
202
+ lzma_nothrow lzma_attr_const;
203
+
204
+
205
+ /**
206
+ * \brief Options specific to the LZMA1 and LZMA2 filters
207
+ *
208
+ * Since LZMA1 and LZMA2 share most of the code, it's simplest to share
209
+ * the options structure too. For encoding, all but the reserved variables
210
+ * need to be initialized unless specifically mentioned otherwise.
211
+ * lzma_lzma_preset() can be used to get a good starting point.
212
+ *
213
+ * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and
214
+ * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb.
215
+ */
216
+ typedef struct {
217
+ /**
218
+ * \brief Dictionary size in bytes
219
+ *
220
+ * Dictionary size indicates how many bytes of the recently processed
221
+ * uncompressed data is kept in memory. One method to reduce size of
222
+ * the uncompressed data is to store distance-length pairs, which
223
+ * indicate what data to repeat from the dictionary buffer. Thus,
224
+ * the bigger the dictionary, the better the compression ratio
225
+ * usually is.
226
+ *
227
+ * Maximum size of the dictionary depends on multiple things:
228
+ * - Memory usage limit
229
+ * - Available address space (not a problem on 64-bit systems)
230
+ * - Selected match finder (encoder only)
231
+ *
232
+ * Currently the maximum dictionary size for encoding is 1.5 GiB
233
+ * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit
234
+ * systems for certain match finder implementation reasons. In the
235
+ * future, there may be match finders that support bigger
236
+ * dictionaries.
237
+ *
238
+ * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
239
+ * UINT32_MAX), so increasing the maximum dictionary size of the
240
+ * encoder won't cause problems for old decoders.
241
+ *
242
+ * Because extremely small dictionaries sizes would have unneeded
243
+ * overhead in the decoder, the minimum dictionary size is 4096 bytes.
244
+ *
245
+ * \note When decoding, too big dictionary does no other harm
246
+ * than wasting memory.
247
+ */
248
+ uint32_t dict_size;
249
+ # define LZMA_DICT_SIZE_MIN UINT32_C(4096)
250
+ # define LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23)
251
+
252
+ /**
253
+ * \brief Pointer to an initial dictionary
254
+ *
255
+ * It is possible to initialize the LZ77 history window using
256
+ * a preset dictionary. It is useful when compressing many
257
+ * similar, relatively small chunks of data independently from
258
+ * each other. The preset dictionary should contain typical
259
+ * strings that occur in the files being compressed. The most
260
+ * probable strings should be near the end of the preset dictionary.
261
+ *
262
+ * This feature should be used only in special situations. For
263
+ * now, it works correctly only with raw encoding and decoding.
264
+ * Currently none of the container formats supported by
265
+ * liblzma allow preset dictionary when decoding, thus if
266
+ * you create a .xz or .lzma file with preset dictionary, it
267
+ * cannot be decoded with the regular decoder functions. In the
268
+ * future, the .xz format will likely get support for preset
269
+ * dictionary though.
270
+ */
271
+ const uint8_t *preset_dict;
272
+
273
+ /**
274
+ * \brief Size of the preset dictionary
275
+ *
276
+ * Specifies the size of the preset dictionary. If the size is
277
+ * bigger than dict_size, only the last dict_size bytes are
278
+ * processed.
279
+ *
280
+ * This variable is read only when preset_dict is not NULL.
281
+ * If preset_dict is not NULL but preset_dict_size is zero,
282
+ * no preset dictionary is used (identical to only setting
283
+ * preset_dict to NULL).
284
+ */
285
+ uint32_t preset_dict_size;
286
+
287
+ /**
288
+ * \brief Number of literal context bits
289
+ *
290
+ * How many of the highest bits of the previous uncompressed
291
+ * eight-bit byte (also known as 'literal') are taken into
292
+ * account when predicting the bits of the next literal.
293
+ *
294
+ * E.g. in typical English text, an upper-case letter is
295
+ * often followed by a lower-case letter, and a lower-case
296
+ * letter is usually followed by another lower-case letter.
297
+ * In the US-ASCII character set, the highest three bits are 010
298
+ * for upper-case letters and 011 for lower-case letters.
299
+ * When lc is at least 3, the literal coding can take advantage of
300
+ * this property in the uncompressed data.
301
+ *
302
+ * There is a limit that applies to literal context bits and literal
303
+ * position bits together: lc + lp <= 4. Without this limit the
304
+ * decoding could become very slow, which could have security related
305
+ * results in some cases like email servers doing virus scanning.
306
+ * This limit also simplifies the internal implementation in liblzma.
307
+ *
308
+ * There may be LZMA1 streams that have lc + lp > 4 (maximum possible
309
+ * lc would be 8). It is not possible to decode such streams with
310
+ * liblzma.
311
+ */
312
+ uint32_t lc;
313
+ # define LZMA_LCLP_MIN 0
314
+ # define LZMA_LCLP_MAX 4
315
+ # define LZMA_LC_DEFAULT 3
316
+
317
+ /**
318
+ * \brief Number of literal position bits
319
+ *
320
+ * lp affects what kind of alignment in the uncompressed data is
321
+ * assumed when encoding literals. A literal is a single 8-bit byte.
322
+ * See pb below for more information about alignment.
323
+ */
324
+ uint32_t lp;
325
+ # define LZMA_LP_DEFAULT 0
326
+
327
+ /**
328
+ * \brief Number of position bits
329
+ *
330
+ * pb affects what kind of alignment in the uncompressed data is
331
+ * assumed in general. The default means four-byte alignment
332
+ * (2^ pb =2^2=4), which is often a good choice when there's
333
+ * no better guess.
334
+ *
335
+ * When the alignment is known, setting pb accordingly may reduce
336
+ * the file size a little. E.g. with text files having one-byte
337
+ * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can
338
+ * improve compression slightly. For UTF-16 text, pb=1 is a good
339
+ * choice. If the alignment is an odd number like 3 bytes, pb=0
340
+ * might be the best choice.
341
+ *
342
+ * Even though the assumed alignment can be adjusted with pb and
343
+ * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment.
344
+ * It might be worth taking into account when designing file formats
345
+ * that are likely to be often compressed with LZMA1 or LZMA2.
346
+ */
347
+ uint32_t pb;
348
+ # define LZMA_PB_MIN 0
349
+ # define LZMA_PB_MAX 4
350
+ # define LZMA_PB_DEFAULT 2
351
+
352
+ /** Compression mode */
353
+ lzma_mode mode;
354
+
355
+ /**
356
+ * \brief Nice length of a match
357
+ *
358
+ * This determines how many bytes the encoder compares from the match
359
+ * candidates when looking for the best match. Once a match of at
360
+ * least nice_len bytes long is found, the encoder stops looking for
361
+ * better candidates and encodes the match. (Naturally, if the found
362
+ * match is actually longer than nice_len, the actual length is
363
+ * encoded; it's not truncated to nice_len.)
364
+ *
365
+ * Bigger values usually increase the compression ratio and
366
+ * compression time. For most files, 32 to 128 is a good value,
367
+ * which gives very good compression ratio at good speed.
368
+ *
369
+ * The exact minimum value depends on the match finder. The maximum
370
+ * is 273, which is the maximum length of a match that LZMA1 and
371
+ * LZMA2 can encode.
372
+ */
373
+ uint32_t nice_len;
374
+
375
+ /** Match finder ID */
376
+ lzma_match_finder mf;
377
+
378
+ /**
379
+ * \brief Maximum search depth in the match finder
380
+ *
381
+ * For every input byte, match finder searches through the hash chain
382
+ * or binary tree in a loop, each iteration going one step deeper in
383
+ * the chain or tree. The searching stops if
384
+ * - a match of at least nice_len bytes long is found;
385
+ * - all match candidates from the hash chain or binary tree have
386
+ * been checked; or
387
+ * - maximum search depth is reached.
388
+ *
389
+ * Maximum search depth is needed to prevent the match finder from
390
+ * wasting too much time in case there are lots of short match
391
+ * candidates. On the other hand, stopping the search before all
392
+ * candidates have been checked can reduce compression ratio.
393
+ *
394
+ * Setting depth to zero tells liblzma to use an automatic default
395
+ * value, that depends on the selected match finder and nice_len.
396
+ * The default is in the range [4, 200] or so (it may vary between
397
+ * liblzma versions).
398
+ *
399
+ * Using a bigger depth value than the default can increase
400
+ * compression ratio in some cases. There is no strict maximum value,
401
+ * but high values (thousands or millions) should be used with care:
402
+ * the encoder could remain fast enough with typical input, but
403
+ * malicious input could cause the match finder to slow down
404
+ * dramatically, possibly creating a denial of service attack.
405
+ */
406
+ uint32_t depth;
407
+
408
+ /**
409
+ * \brief For LZMA_FILTER_LZMA1EXT: Extended flags
410
+ *
411
+ * This is used only with LZMA_FILTER_LZMA1EXT.
412
+ *
413
+ * Currently only one flag is supported, LZMA_LZMA1EXT_ALLOW_EOPM:
414
+ *
415
+ * - Encoder: If the flag is set, then end marker is written just
416
+ * like it is with LZMA_FILTER_LZMA1. Without this flag the
417
+ * end marker isn't written and the application has to store
418
+ * the uncompressed size somewhere outside the compressed stream.
419
+ * To decompress streams without the end marker, the application
420
+ * has to set the correct uncompressed size in ext_size_low and
421
+ * ext_size_high.
422
+ *
423
+ * - Decoder: If the uncompressed size in ext_size_low and
424
+ * ext_size_high is set to the special value UINT64_MAX
425
+ * (indicating unknown uncompressed size) then this flag is
426
+ * ignored and the end marker must always be present, that is,
427
+ * the behavior is identical to LZMA_FILTER_LZMA1.
428
+ *
429
+ * Otherwise, if this flag isn't set, then the input stream
430
+ * must not have the end marker; if the end marker is detected
431
+ * then it will result in LZMA_DATA_ERROR. This is useful when
432
+ * it is known that the stream must not have the end marker and
433
+ * strict validation is wanted.
434
+ *
435
+ * If this flag is set, then it is autodetected if the end marker
436
+ * is present after the specified number of uncompressed bytes
437
+ * has been decompressed (ext_size_low and ext_size_high). The
438
+ * end marker isn't allowed in any other position. This behavior
439
+ * is useful when uncompressed size is known but the end marker
440
+ * may or may not be present. This is the case, for example,
441
+ * in .7z files (valid .7z files that have the end marker in
442
+ * LZMA1 streams are rare but they do exist).
443
+ */
444
+ uint32_t ext_flags;
445
+ # define LZMA_LZMA1EXT_ALLOW_EOPM UINT32_C(0x01)
446
+
447
+ /**
448
+ * \brief For LZMA_FILTER_LZMA1EXT: Uncompressed size (low bits)
449
+ *
450
+ * The 64-bit uncompressed size is needed for decompression with
451
+ * LZMA_FILTER_LZMA1EXT. The size is ignored by the encoder.
452
+ *
453
+ * The special value UINT64_MAX indicates that the uncompressed size
454
+ * is unknown and that the end of payload marker (also known as
455
+ * end of stream marker) must be present to indicate the end of
456
+ * the LZMA1 stream. Any other value indicates the expected
457
+ * uncompressed size of the LZMA1 stream. (If LZMA1 was used together
458
+ * with filters that change the size of the data then the uncompressed
459
+ * size of the LZMA1 stream could be different than the final
460
+ * uncompressed size of the filtered stream.)
461
+ *
462
+ * ext_size_low holds the least significant 32 bits of the
463
+ * uncompressed size. The most significant 32 bits must be set
464
+ * in ext_size_high. The macro lzma_set_ext_size(opt_lzma, u64size)
465
+ * can be used to set these members.
466
+ *
467
+ * The 64-bit uncompressed size is split into two uint32_t variables
468
+ * because there were no reserved uint64_t members and using the
469
+ * same options structure for LZMA_FILTER_LZMA1, LZMA_FILTER_LZMA1EXT,
470
+ * and LZMA_FILTER_LZMA2 was otherwise more convenient than having
471
+ * a new options structure for LZMA_FILTER_LZMA1EXT. (Replacing two
472
+ * uint32_t members with one uint64_t changes the ABI on some systems
473
+ * as the alignment of this struct can increase from 4 bytes to 8.)
474
+ */
475
+ uint32_t ext_size_low;
476
+
477
+ /**
478
+ * \brief For LZMA_FILTER_LZMA1EXT: Uncompressed size (high bits)
479
+ *
480
+ * This holds the most significant 32 bits of the uncompressed size.
481
+ */
482
+ uint32_t ext_size_high;
483
+
484
+ /*
485
+ * Reserved space to allow possible future extensions without
486
+ * breaking the ABI. You should not touch these, because the names
487
+ * of these variables may change. These are and will never be used
488
+ * with the currently supported options, so it is safe to leave these
489
+ * uninitialized.
490
+ */
491
+
492
+ /** \private Reserved member. */
493
+ uint32_t reserved_int4;
494
+
495
+ /** \private Reserved member. */
496
+ uint32_t reserved_int5;
497
+
498
+ /** \private Reserved member. */
499
+ uint32_t reserved_int6;
500
+
501
+ /** \private Reserved member. */
502
+ uint32_t reserved_int7;
503
+
504
+ /** \private Reserved member. */
505
+ uint32_t reserved_int8;
506
+
507
+ /** \private Reserved member. */
508
+ lzma_reserved_enum reserved_enum1;
509
+
510
+ /** \private Reserved member. */
511
+ lzma_reserved_enum reserved_enum2;
512
+
513
+ /** \private Reserved member. */
514
+ lzma_reserved_enum reserved_enum3;
515
+
516
+ /** \private Reserved member. */
517
+ lzma_reserved_enum reserved_enum4;
518
+
519
+ /** \private Reserved member. */
520
+ void *reserved_ptr1;
521
+
522
+ /** \private Reserved member. */
523
+ void *reserved_ptr2;
524
+
525
+ } lzma_options_lzma;
526
+
527
+
528
+ /**
529
+ * \brief Macro to set the 64-bit uncompressed size in ext_size_*
530
+ *
531
+ * This might be convenient when decoding using LZMA_FILTER_LZMA1EXT.
532
+ * This isn't used with LZMA_FILTER_LZMA1 or LZMA_FILTER_LZMA2.
533
+ */
534
+ #define lzma_set_ext_size(opt_lzma2, u64size) \
535
+ do { \
536
+ (opt_lzma2).ext_size_low = (uint32_t)(u64size); \
537
+ (opt_lzma2).ext_size_high = (uint32_t)((uint64_t)(u64size) >> 32); \
538
+ } while (0)
539
+
540
+
541
+ /**
542
+ * \brief Set a compression preset to lzma_options_lzma structure
543
+ *
544
+ * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9
545
+ * of the xz command line tool. In addition, it is possible to bitwise-or
546
+ * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported.
547
+ * The flags are defined in container.h, because the flags are used also
548
+ * with lzma_easy_encoder().
549
+ *
550
+ * The preset levels are subject to changes between liblzma versions.
551
+ *
552
+ * This function is available only if LZMA1 or LZMA2 encoder has been enabled
553
+ * when building liblzma.
554
+ *
555
+ * If features (like certain match finders) have been disabled at build time,
556
+ * then the function may return success (false) even though the resulting
557
+ * LZMA1/LZMA2 options may not be usable for encoder initialization
558
+ * (LZMA_OPTIONS_ERROR).
559
+ *
560
+ * \param[out] options Pointer to LZMA1 or LZMA2 options to be filled
561
+ * \param preset Preset level bitwse-ORed with preset flags
562
+ *
563
+ * \return lzma_bool:
564
+ * - true if the preset is not supported (failure).
565
+ * - false otherwise (success).
566
+ */
567
+ extern LZMA_API(lzma_bool) lzma_lzma_preset(
568
+ lzma_options_lzma *options, uint32_t preset) lzma_nothrow;
evalkit_llava/include/lzma/stream_flags.h ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/stream_flags.h
5
+ * \brief .xz Stream Header and Stream Footer encoder and decoder
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 Size of Stream Header and Stream Footer
20
+ *
21
+ * Stream Header and Stream Footer have the same size and they are not
22
+ * going to change even if a newer version of the .xz file format is
23
+ * developed in future.
24
+ */
25
+ #define LZMA_STREAM_HEADER_SIZE 12
26
+
27
+
28
+ /**
29
+ * \brief Options for encoding/decoding Stream Header and Stream Footer
30
+ */
31
+ typedef struct {
32
+ /**
33
+ * \brief Stream Flags format version
34
+ *
35
+ * To prevent API and ABI breakages if new features are needed in
36
+ * Stream Header or Stream Footer, a version number is used to
37
+ * indicate which members in this structure are in use. For now,
38
+ * version must always be zero. With non-zero version, the
39
+ * lzma_stream_header_encode() and lzma_stream_footer_encode()
40
+ * will return LZMA_OPTIONS_ERROR.
41
+ *
42
+ * lzma_stream_header_decode() and lzma_stream_footer_decode()
43
+ * will always set this to the lowest value that supports all the
44
+ * features indicated by the Stream Flags field. The application
45
+ * must check that the version number set by the decoding functions
46
+ * is supported by the application. Otherwise it is possible that
47
+ * the application will decode the Stream incorrectly.
48
+ */
49
+ uint32_t version;
50
+
51
+ /**
52
+ * \brief Backward Size
53
+ *
54
+ * Backward Size must be a multiple of four bytes. In this Stream
55
+ * format version, Backward Size is the size of the Index field.
56
+ *
57
+ * Backward Size isn't actually part of the Stream Flags field, but
58
+ * it is convenient to include in this structure anyway. Backward
59
+ * Size is present only in the Stream Footer. There is no need to
60
+ * initialize backward_size when encoding Stream Header.
61
+ *
62
+ * lzma_stream_header_decode() always sets backward_size to
63
+ * LZMA_VLI_UNKNOWN so that it is convenient to use
64
+ * lzma_stream_flags_compare() when both Stream Header and Stream
65
+ * Footer have been decoded.
66
+ */
67
+ lzma_vli backward_size;
68
+
69
+ /**
70
+ * \brief Minimum value for lzma_stream_flags.backward_size
71
+ */
72
+ # define LZMA_BACKWARD_SIZE_MIN 4
73
+
74
+ /**
75
+ * \brief Maximum value for lzma_stream_flags.backward_size
76
+ */
77
+ # define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34)
78
+
79
+ /**
80
+ * \brief Check ID
81
+ *
82
+ * This indicates the type of the integrity check calculated from
83
+ * uncompressed data.
84
+ */
85
+ lzma_check check;
86
+
87
+ /*
88
+ * Reserved space to allow possible future extensions without
89
+ * breaking the ABI. You should not touch these, because the
90
+ * names of these variables may change.
91
+ *
92
+ * (We will never be able to use all of these since Stream Flags
93
+ * is just two bytes plus Backward Size of four bytes. But it's
94
+ * nice to have the proper types when they are needed.)
95
+ */
96
+
97
+ /** \private Reserved member. */
98
+ lzma_reserved_enum reserved_enum1;
99
+
100
+ /** \private Reserved member. */
101
+ lzma_reserved_enum reserved_enum2;
102
+
103
+ /** \private Reserved member. */
104
+ lzma_reserved_enum reserved_enum3;
105
+
106
+ /** \private Reserved member. */
107
+ lzma_reserved_enum reserved_enum4;
108
+
109
+ /** \private Reserved member. */
110
+ lzma_bool reserved_bool1;
111
+
112
+ /** \private Reserved member. */
113
+ lzma_bool reserved_bool2;
114
+
115
+ /** \private Reserved member. */
116
+ lzma_bool reserved_bool3;
117
+
118
+ /** \private Reserved member. */
119
+ lzma_bool reserved_bool4;
120
+
121
+ /** \private Reserved member. */
122
+ lzma_bool reserved_bool5;
123
+
124
+ /** \private Reserved member. */
125
+ lzma_bool reserved_bool6;
126
+
127
+ /** \private Reserved member. */
128
+ lzma_bool reserved_bool7;
129
+
130
+ /** \private Reserved member. */
131
+ lzma_bool reserved_bool8;
132
+
133
+ /** \private Reserved member. */
134
+ uint32_t reserved_int1;
135
+
136
+ /** \private Reserved member. */
137
+ uint32_t reserved_int2;
138
+
139
+ } lzma_stream_flags;
140
+
141
+
142
+ /**
143
+ * \brief Encode Stream Header
144
+ *
145
+ * \param options Stream Header options to be encoded.
146
+ * options->backward_size is ignored and doesn't
147
+ * need to be initialized.
148
+ * \param[out] out Beginning of the output buffer of
149
+ * LZMA_STREAM_HEADER_SIZE bytes.
150
+ *
151
+ * \return Possible lzma_ret values:
152
+ * - LZMA_OK: Encoding was successful.
153
+ * - LZMA_OPTIONS_ERROR: options->version is not supported by
154
+ * this liblzma version.
155
+ * - LZMA_PROG_ERROR: Invalid options.
156
+ */
157
+ extern LZMA_API(lzma_ret) lzma_stream_header_encode(
158
+ const lzma_stream_flags *options, uint8_t *out)
159
+ lzma_nothrow lzma_attr_warn_unused_result;
160
+
161
+
162
+ /**
163
+ * \brief Encode Stream Footer
164
+ *
165
+ * \param options Stream Footer options to be encoded.
166
+ * \param[out] out Beginning of the output buffer of
167
+ * LZMA_STREAM_HEADER_SIZE bytes.
168
+ *
169
+ * \return Possible lzma_ret values:
170
+ * - LZMA_OK: Encoding was successful.
171
+ * - LZMA_OPTIONS_ERROR: options->version is not supported by
172
+ * this liblzma version.
173
+ * - LZMA_PROG_ERROR: Invalid options.
174
+ */
175
+ extern LZMA_API(lzma_ret) lzma_stream_footer_encode(
176
+ const lzma_stream_flags *options, uint8_t *out)
177
+ lzma_nothrow lzma_attr_warn_unused_result;
178
+
179
+
180
+ /**
181
+ * \brief Decode Stream Header
182
+ *
183
+ * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to
184
+ * help comparing Stream Flags from Stream Header and Stream Footer with
185
+ * lzma_stream_flags_compare().
186
+ *
187
+ * \note When decoding .xz files that contain multiple Streams, it may
188
+ * make sense to print "file format not recognized" only if
189
+ * decoding of the Stream Header of the \a first Stream gives
190
+ * LZMA_FORMAT_ERROR. If non-first Stream Header gives
191
+ * LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is
192
+ * probably more appropriate.
193
+ * For example, the Stream decoder in liblzma uses
194
+ * LZMA_DATA_ERROR if LZMA_FORMAT_ERROR is returned by
195
+ * lzma_stream_header_decode() when decoding non-first Stream.
196
+ *
197
+ * \param[out] options Target for the decoded Stream Header options.
198
+ * \param in Beginning of the input buffer of
199
+ * LZMA_STREAM_HEADER_SIZE bytes.
200
+ *
201
+ *
202
+ * \return Possible lzma_ret values:
203
+ * - LZMA_OK: Decoding was successful.
204
+ * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
205
+ * buffer cannot be Stream Header.
206
+ * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header
207
+ * is corrupt.
208
+ * - LZMA_OPTIONS_ERROR: Unsupported options are present
209
+ * in the header.
210
+ */
211
+ extern LZMA_API(lzma_ret) lzma_stream_header_decode(
212
+ lzma_stream_flags *options, const uint8_t *in)
213
+ lzma_nothrow lzma_attr_warn_unused_result;
214
+
215
+
216
+ /**
217
+ * \brief Decode Stream Footer
218
+ *
219
+ * \note If Stream Header was already decoded successfully, but
220
+ * decoding Stream Footer returns LZMA_FORMAT_ERROR, the
221
+ * application should probably report some other error message
222
+ * than "file format not recognized". The file likely
223
+ * is corrupt (possibly truncated). The Stream decoder in liblzma
224
+ * uses LZMA_DATA_ERROR in this situation.
225
+ *
226
+ * \param[out] options Target for the decoded Stream Footer options.
227
+ * \param in Beginning of the input buffer of
228
+ * LZMA_STREAM_HEADER_SIZE bytes.
229
+ *
230
+ * \return Possible lzma_ret values:
231
+ * - LZMA_OK: Decoding was successful.
232
+ * - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
233
+ * buffer cannot be Stream Footer.
234
+ * - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer
235
+ * is corrupt.
236
+ * - LZMA_OPTIONS_ERROR: Unsupported options are present
237
+ * in Stream Footer.
238
+ */
239
+ extern LZMA_API(lzma_ret) lzma_stream_footer_decode(
240
+ lzma_stream_flags *options, const uint8_t *in)
241
+ lzma_nothrow lzma_attr_warn_unused_result;
242
+
243
+
244
+ /**
245
+ * \brief Compare two lzma_stream_flags structures
246
+ *
247
+ * backward_size values are compared only if both are not
248
+ * LZMA_VLI_UNKNOWN.
249
+ *
250
+ * \param a Pointer to lzma_stream_flags structure
251
+ * \param b Pointer to lzma_stream_flags structure
252
+ *
253
+ * \return Possible lzma_ret values:
254
+ * - LZMA_OK: Both are equal. If either had backward_size set
255
+ * to LZMA_VLI_UNKNOWN, backward_size values were not
256
+ * compared or validated.
257
+ * - LZMA_DATA_ERROR: The structures differ.
258
+ * - LZMA_OPTIONS_ERROR: version in either structure is greater
259
+ * than the maximum supported version (currently zero).
260
+ * - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or
261
+ * backward_size.
262
+ */
263
+ extern LZMA_API(lzma_ret) lzma_stream_flags_compare(
264
+ const lzma_stream_flags *a, const lzma_stream_flags *b)
265
+ lzma_nothrow lzma_attr_pure;
evalkit_llava/include/lzma/version.h ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/version.h
5
+ * \brief Version number
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
+ /** \brief Major version number of the liblzma release. */
19
+ #define LZMA_VERSION_MAJOR 5
20
+
21
+ /** \brief Minor version number of the liblzma release. */
22
+ #define LZMA_VERSION_MINOR 6
23
+
24
+ /** \brief Patch version number of the liblzma release. */
25
+ #define LZMA_VERSION_PATCH 4
26
+
27
+ /**
28
+ * \brief Version stability marker
29
+ *
30
+ * This will always be one of three values:
31
+ * - LZMA_VERSION_STABILITY_ALPHA
32
+ * - LZMA_VERSION_STABILITY_BETA
33
+ * - LZMA_VERSION_STABILITY_STABLE
34
+ */
35
+ #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
36
+
37
+ /** \brief Commit version number of the liblzma release */
38
+ #ifndef LZMA_VERSION_COMMIT
39
+ # define LZMA_VERSION_COMMIT ""
40
+ #endif
41
+
42
+
43
+ /*
44
+ * Map symbolic stability levels to integers.
45
+ */
46
+ #define LZMA_VERSION_STABILITY_ALPHA 0
47
+ #define LZMA_VERSION_STABILITY_BETA 1
48
+ #define LZMA_VERSION_STABILITY_STABLE 2
49
+
50
+
51
+ /**
52
+ * \brief Compile-time version number
53
+ *
54
+ * The version number is of format xyyyzzzs where
55
+ * - x = major
56
+ * - yyy = minor
57
+ * - zzz = revision
58
+ * - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
59
+ *
60
+ * The same xyyyzzz triplet is never reused with different stability levels.
61
+ * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
62
+ * or 5.1.0 stable.
63
+ *
64
+ * \note The version number of liblzma has nothing to with
65
+ * the version number of Igor Pavlov's LZMA SDK.
66
+ */
67
+ #define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
68
+ + LZMA_VERSION_MINOR * UINT32_C(10000) \
69
+ + LZMA_VERSION_PATCH * UINT32_C(10) \
70
+ + LZMA_VERSION_STABILITY)
71
+
72
+
73
+ /*
74
+ * Macros to construct the compile-time version string
75
+ */
76
+ #if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
77
+ # define LZMA_VERSION_STABILITY_STRING "alpha"
78
+ #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
79
+ # define LZMA_VERSION_STABILITY_STRING "beta"
80
+ #elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
81
+ # define LZMA_VERSION_STABILITY_STRING ""
82
+ #else
83
+ # error Incorrect LZMA_VERSION_STABILITY
84
+ #endif
85
+
86
+ #define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
87
+ #major "." #minor "." #patch stability commit
88
+
89
+ #define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
90
+ LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
91
+
92
+
93
+ /**
94
+ * \brief Compile-time version as a string
95
+ *
96
+ * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
97
+ * versions don't have any "stable" suffix). In future, a snapshot built
98
+ * from source code repository may include an additional suffix, for example
99
+ * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
100
+ * in LZMA_VERSION macro.
101
+ */
102
+ #define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
103
+ LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
104
+ LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
105
+ LZMA_VERSION_COMMIT)
106
+
107
+
108
+ /* #ifndef is needed for use with windres (MinGW-w64 or Cygwin). */
109
+ #ifndef LZMA_H_INTERNAL_RC
110
+
111
+ /**
112
+ * \brief Run-time version number as an integer
113
+ *
114
+ * This allows an application to compare if it was built against the same,
115
+ * older, or newer version of liblzma that is currently running.
116
+ *
117
+ * \return The value of LZMA_VERSION macro at the compile time of liblzma
118
+ */
119
+ extern LZMA_API(uint32_t) lzma_version_number(void)
120
+ lzma_nothrow lzma_attr_const;
121
+
122
+
123
+ /**
124
+ * \brief Run-time version as a string
125
+ *
126
+ * This function may be useful to display which version of liblzma an
127
+ * application is currently using.
128
+ *
129
+ * \return Run-time version of liblzma
130
+ */
131
+ extern LZMA_API(const char *) lzma_version_string(void)
132
+ lzma_nothrow lzma_attr_const;
133
+
134
+ #endif
evalkit_llava/include/lzma/vli.h ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SPDX-License-Identifier: 0BSD */
2
+
3
+ /**
4
+ * \file lzma/vli.h
5
+ * \brief Variable-length integer handling
6
+ * \note Never include this file directly. Use <lzma.h> instead.
7
+ *
8
+ * In the .xz format, most integers are encoded in a variable-length
9
+ * representation, which is sometimes called little endian base-128 encoding.
10
+ * This saves space when smaller values are more likely than bigger values.
11
+ *
12
+ * The encoding scheme encodes seven bits to every byte, using minimum
13
+ * number of bytes required to represent the given value. Encodings that use
14
+ * non-minimum number of bytes are invalid, thus every integer has exactly
15
+ * one encoded representation. The maximum number of bits in a VLI is 63,
16
+ * thus the vli argument must be less than or equal to UINT64_MAX / 2. You
17
+ * should use LZMA_VLI_MAX for clarity.
18
+ */
19
+
20
+ /*
21
+ * Author: Lasse Collin
22
+ */
23
+
24
+ #ifndef LZMA_H_INTERNAL
25
+ # error Never include this file directly. Use <lzma.h> instead.
26
+ #endif
27
+
28
+
29
+ /**
30
+ * \brief Maximum supported value of a variable-length integer
31
+ */
32
+ #define LZMA_VLI_MAX (UINT64_MAX / 2)
33
+
34
+ /**
35
+ * \brief VLI value to denote that the value is unknown
36
+ */
37
+ #define LZMA_VLI_UNKNOWN UINT64_MAX
38
+
39
+ /**
40
+ * \brief Maximum supported encoded length of variable length integers
41
+ */
42
+ #define LZMA_VLI_BYTES_MAX 9
43
+
44
+ /**
45
+ * \brief VLI constant suffix
46
+ */
47
+ #define LZMA_VLI_C(n) UINT64_C(n)
48
+
49
+
50
+ /**
51
+ * \brief Variable-length integer type
52
+ *
53
+ * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is
54
+ * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the
55
+ * underlying integer type.
56
+ *
57
+ * lzma_vli will be uint64_t for the foreseeable future. If a bigger size
58
+ * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will
59
+ * not overflow lzma_vli. This simplifies integer overflow detection.
60
+ */
61
+ typedef uint64_t lzma_vli;
62
+
63
+
64
+ /**
65
+ * \brief Validate a variable-length integer
66
+ *
67
+ * This is useful to test that application has given acceptable values
68
+ * for example in the uncompressed_size and compressed_size variables.
69
+ *
70
+ * \return True if the integer is representable as a VLI or if it
71
+ * indicates an unknown value. False otherwise.
72
+ */
73
+ #define lzma_vli_is_valid(vli) \
74
+ ((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN)
75
+
76
+
77
+ /**
78
+ * \brief Encode a variable-length integer
79
+ *
80
+ * This function has two modes: single-call and multi-call. Single-call mode
81
+ * encodes the whole integer at once; it is an error if the output buffer is
82
+ * too small. Multi-call mode saves the position in *vli_pos, and thus it is
83
+ * possible to continue encoding if the buffer becomes full before the whole
84
+ * integer has been encoded.
85
+ *
86
+ * \param vli Integer to be encoded
87
+ * \param[out] vli_pos How many VLI-encoded bytes have already been written
88
+ * out. When starting to encode a new integer in
89
+ * multi-call mode, *vli_pos must be set to zero.
90
+ * To use single-call encoding, set vli_pos to NULL.
91
+ * \param[out] out Beginning of the output buffer
92
+ * \param[out] out_pos The next byte will be written to out[*out_pos].
93
+ * \param out_size Size of the out buffer; the first byte into
94
+ * which no data is written to is out[out_size].
95
+ *
96
+ * \return Slightly different return values are used in multi-call and
97
+ * single-call modes.
98
+ *
99
+ * Single-call (vli_pos == NULL):
100
+ * - LZMA_OK: Integer successfully encoded.
101
+ * - LZMA_PROG_ERROR: Arguments are not sane. This can be due
102
+ * to too little output space; single-call mode doesn't use
103
+ * LZMA_BUF_ERROR, since the application should have checked
104
+ * the encoded size with lzma_vli_size().
105
+ *
106
+ * Multi-call (vli_pos != NULL):
107
+ * - LZMA_OK: So far all OK, but the integer is not
108
+ * completely written out yet.
109
+ * - LZMA_STREAM_END: Integer successfully encoded.
110
+ * - LZMA_BUF_ERROR: No output space was provided.
111
+ * - LZMA_PROG_ERROR: Arguments are not sane.
112
+ */
113
+ extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos,
114
+ uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
115
+
116
+
117
+ /**
118
+ * \brief Decode a variable-length integer
119
+ *
120
+ * Like lzma_vli_encode(), this function has single-call and multi-call modes.
121
+ *
122
+ * \param[out] vli Pointer to decoded integer. The decoder will
123
+ * initialize it to zero when *vli_pos == 0, so
124
+ * application isn't required to initialize *vli.
125
+ * \param[out] vli_pos How many bytes have already been decoded. When
126
+ * starting to decode a new integer in multi-call
127
+ * mode, *vli_pos must be initialized to zero. To
128
+ * use single-call decoding, set vli_pos to NULL.
129
+ * \param in Beginning of the input buffer
130
+ * \param[out] in_pos The next byte will be read from in[*in_pos].
131
+ * \param in_size Size of the input buffer; the first byte that
132
+ * won't be read is in[in_size].
133
+ *
134
+ * \return Slightly different return values are used in multi-call and
135
+ * single-call modes.
136
+ *
137
+ * Single-call (vli_pos == NULL):
138
+ * - LZMA_OK: Integer successfully decoded.
139
+ * - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting
140
+ * the end of the input buffer before the whole integer was
141
+ * decoded; providing no input at all will use LZMA_DATA_ERROR.
142
+ * - LZMA_PROG_ERROR: Arguments are not sane.
143
+ *
144
+ * Multi-call (vli_pos != NULL):
145
+ * - LZMA_OK: So far all OK, but the integer is not
146
+ * completely decoded yet.
147
+ * - LZMA_STREAM_END: Integer successfully decoded.
148
+ * - LZMA_DATA_ERROR: Integer is corrupt.
149
+ * - LZMA_BUF_ERROR: No input was provided.
150
+ * - LZMA_PROG_ERROR: Arguments are not sane.
151
+ */
152
+ extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos,
153
+ const uint8_t *in, size_t *in_pos, size_t in_size)
154
+ lzma_nothrow;
155
+
156
+
157
+ /**
158
+ * \brief Get the number of bytes required to encode a VLI
159
+ *
160
+ * \param vli Integer whose encoded size is to be determined
161
+ *
162
+ * \return Number of bytes on success (1-9). If vli isn't valid,
163
+ * zero is returned.
164
+ */
165
+ extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli)
166
+ lzma_nothrow lzma_attr_pure;
evalkit_llava/include/ncurses/curses.h ADDED
The diff for this file is too large to render. See raw diff
 
evalkit_llava/include/ncurses/cursesm.h ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncurses/cursesp.h ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncurses/cursesw.h ADDED
@@ -0,0 +1,1581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncurses/form.h ADDED
@@ -0,0 +1,460 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncurses/menu.h ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/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 */
evalkit_llava/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 */
evalkit_llava/include/ncurses/term.h ADDED
@@ -0,0 +1,893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncurses/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 */
evalkit_llava/include/ncurses/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 (*)(int));
67
+ #endif
68
+
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
72
+
73
+ #endif /* NCURSES_TERMCAP_H_incl */
evalkit_llava/include/ncursesw/curses.h ADDED
The diff for this file is too large to render. See raw diff
 
evalkit_llava/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 */
evalkit_llava/include/ncursesw/cursesf.h ADDED
@@ -0,0 +1,968 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 tobe examined.
962
+ virtual bool previous(NCursesFormField& f) = 0;
963
+
964
+ public:
965
+ UserDefinedFieldType_With_Choice();
966
+ };
967
+
968
+ #endif /* NCURSES_CURSESF_H_incl */
evalkit_llava/include/ncursesw/cursesm.h ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncursesw/cursesp.h ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */
evalkit_llava/include/ncursesw/cursesw.h ADDED
@@ -0,0 +1,1581 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 */